Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
926c386c
Commit
926c386c
authored
Sep 19, 2019
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
fd1aa5ac
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
48 deletions
+58
-48
config/dev.env.js
+2
-1
config/prod.env.js
+3
-1
src/pages/index/index.vue
+31
-14
src/pages/wxPay/index.vue
+22
-32
No files found.
config/dev.env.js
View file @
926c386c
...
@@ -4,5 +4,6 @@ var prodEnv = require('./prod.env')
...
@@ -4,5 +4,6 @@ var prodEnv = require('./prod.env')
module
.
exports
=
merge
(
prodEnv
,
{
module
.
exports
=
merge
(
prodEnv
,
{
NODE_ENV
:
'"development"'
,
NODE_ENV
:
'"development"'
,
OLSHOP_URL
:
'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"'
OLSHOP_URL
:
'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"'
,
IMG_DOMAIN
:
'"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com"'
})
})
config/prod.env.js
View file @
926c386c
module
.
exports
=
{
module
.
exports
=
{
NODE_ENV
:
'"production"'
NODE_ENV
:
'"production"'
,
OLSHOP_URL
:
'"http://shop.mayi888.com"'
,
IMG_DOMAIN
:
'"http://cdn.mayi888.com"'
}
}
src/pages/index/index.vue
View file @
926c386c
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<
script
>
<
script
>
import
spokesman
from
"@/api/spokesman.js"
;
import
spokesman
from
"@/api/spokesman.js"
;
import
{
serialize
}
from
"@/utils/index"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -29,7 +30,9 @@ export default {
...
@@ -29,7 +30,9 @@ export default {
spokesmanRelId
:
""
,
//代言人的id
spokesmanRelId
:
""
,
//代言人的id
spokesmanBindId
:
""
,
//代言人街道id
spokesmanBindId
:
""
,
//代言人街道id
hasInvitationStatus
:
0
,
// 邀请资格:0-不能够邀请下级,1-能够邀请下级
hasInvitationStatus
:
0
,
// 邀请资格:0-不能够邀请下级,1-能够邀请下级
newHref
:
""
newHref
:
""
,
shopName
:
""
,
logoUrl
:
""
};
};
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
...
@@ -42,16 +45,18 @@ export default {
...
@@ -42,16 +45,18 @@ export default {
this
.
page
=
""
;
this
.
page
=
""
;
this
.
params
=
""
;
this
.
params
=
""
;
}
else
if
(
options
.
from
&&
options
.
from
==
"h5login"
)
{
}
else
if
(
options
.
from
&&
options
.
from
==
"h5login"
)
{
//来自h5登录
let
params
=
JSON
.
parse
(
options
.
params
);
wx
.
setStorage
({
wx
.
setStorage
({
key
:
"sessionid"
,
key
:
"sessionid"
,
data
:
JSON
.
parse
(
options
.
params
)
.
sessionid
data
:
params
.
sessionid
});
});
}
else
if
(
options
.
from
&&
options
.
from
==
"login"
)
{
}
else
if
(
options
.
from
&&
options
.
from
==
"login"
)
{
//来自登录页面
//来自登录页面
this
.
page
=
decodeURIComponent
(
options
.
backpath
);
this
.
page
=
decodeURIComponent
(
options
.
backpath
);
this
.
params
+=
"&"
+
decodeURIComponent
(
options
.
params
);
this
.
params
+=
"&"
+
decodeURIComponent
(
options
.
params
);
}
else
if
(
options
.
from
&&
options
.
from
==
"logout"
)
{
}
else
if
(
options
.
from
&&
options
.
from
==
"logout"
)
{
this
.
page
=
"/"
;
//来自用户登出
wx
.
removeStorage
({
wx
.
removeStorage
({
key
:
"sessionid"
key
:
"sessionid"
});
});
...
@@ -61,7 +66,7 @@ export default {
...
@@ -61,7 +66,7 @@ export default {
}
else
if
(
options
.
from
==
"wxPay"
)
{
}
else
if
(
options
.
from
==
"wxPay"
)
{
//来自支付页面
//来自支付页面
this
.
page
=
options
.
backpath
;
this
.
page
=
options
.
backpath
;
this
.
params
=
this
.
params
+
"&orderSn="
+
options
.
params
;
this
.
params
+=
"&"
+
serialize
(
options
.
params
)
;
}
else
if
(
options
.
scene
)
{
}
else
if
(
options
.
scene
)
{
//来自扫码
//来自扫码
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
...
@@ -69,8 +74,8 @@ export default {
...
@@ -69,8 +74,8 @@ export default {
var
query
=
options
.
query
.
dentistId
;
// 参数二维码传递过来的场景参数
var
query
=
options
.
query
.
dentistId
;
// 参数二维码传递过来的场景参数
}
}
console
.
log
(
"url"
,
this
.
link
+
this
.
page
+
this
.
params
);
console
.
log
(
"url"
,
this
.
link
+
this
.
page
+
this
.
params
);
this
.
getSpokesman
();
//获取店铺信息
},
},
components
:
{
components
:
{
// card
// card
...
@@ -93,9 +98,17 @@ export default {
...
@@ -93,9 +98,17 @@ export default {
this
.
spokesmanBindId
=
res
.
data
.
data
.
belongToShopId
;
this
.
spokesmanBindId
=
res
.
data
.
data
.
belongToShopId
;
}
}
if
(
this
.
spokesmanBindId
)
{
if
(
this
.
spokesmanBindId
)
{
this
.
newHref
=
`&spokesmanGroupId=
${
this
.
spokesmanGroupId
}
&spokesmanShopId=
${
this
.
spokesmanShopId
}
&spokesmanRelId=
${
this
.
spokesmanRelId
}
&spokesmanBindId=
${
this
.
spokesmanBindId
}
`
;
this
.
newHref
=
`&spokesmanGroupId=
${
this
.
spokesmanGroupId
}
&spokesmanShopId=
${
this
.
spokesmanShopId
}
&spokesmanRelId=
${
this
.
spokesmanRelId
}
&spokesmanBindId=
${
this
.
spokesmanBindId
}
`
;
}
else
{
}
else
{
this
.
newHref
=
`&spokesmanGroupId=
${
this
.
spokesmanGroupId
}
&spokesmanShopId=
${
this
.
spokesmanShopId
}
&spokesmanRelId=
${
this
.
spokesmanRelId
}
`
;
this
.
newHref
=
`&spokesmanGroupId=
${
this
.
spokesmanGroupId
}
&spokesmanShopId=
${
this
.
spokesmanShopId
}
&spokesmanRelId=
${
this
.
spokesmanRelId
}
`
;
}
}
}
}
console
.
log
(
this
.
newHref
,
"this.newHrefthis.newHrefthis.newHref"
);
console
.
log
(
this
.
newHref
,
"this.newHrefthis.newHrefthis.newHref"
);
...
@@ -116,6 +129,10 @@ export default {
...
@@ -116,6 +129,10 @@ export default {
},
},
getMessage
(
res
)
{
getMessage
(
res
)
{
console
.
log
(
"h5消息"
,
res
);
console
.
log
(
"h5消息"
,
res
);
if
(
res
.
target
.
data
[
0
].
code
==
200
)
{
this
.
shopName
=
res
.
target
.
data
[
0
].
data
.
shopName
;
this
.
logoUrl
=
process
.
env
.
IMG_DOMAIN
+
res
.
target
.
data
[
0
].
data
.
logoUrl
;
}
}
}
},
},
onUnload
()
{
onUnload
()
{
...
@@ -134,25 +151,25 @@ export default {
...
@@ -134,25 +151,25 @@ export default {
// }
// }
// }
// }
},
},
async
onShareAppMessage
(
res
)
{
onShareAppMessage
(
res
)
{
await
this
.
getSpokesman
();
//获取webview当前页面地址
this
.
shareUrl
=
res
.
webViewUrl
+
this
.
newHref
;
this
.
shareUrl
=
res
.
webViewUrl
+
this
.
newHref
;
console
.
log
(
"share"
,
res
,
this
.
shareUrl
);
console
.
log
(
"share"
,
res
,
this
.
shareUrl
);
return
{
return
{
title
:
this
.
sh
areUrl
,
// 默认是小程序的名称
title
:
this
.
sh
opName
,
// 默认是小程序的名称
path
:
`/pages/index/main?share=
${
encodeURIComponent
(
this
.
shareUrl
)}
`
,
// 默认是当前页面
path
:
`/pages/index/main?share=
${
encodeURIComponent
(
this
.
shareUrl
)}
`
,
// 默认是当前页面
imageUrl
:
imageUrl
:
this
.
logoUrl
,
"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/026da85e-d78d-4260-bbe1-4ca5e1fed10d.png"
,
//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
//
"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/026da85e-d78d-4260-bbe1-4ca5e1fed10d.png", //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success
:
function
(
res
)
{
success
:
function
(
res
)
{
// 转发成功之后的回调
// 转发成功之后的回调
if
(
res
.
errMsg
==
"shareAppMessage:ok"
)
{
if
(
res
.
errMsg
==
"shareAppMessage:ok"
)
{
consol
.
log
(
res
,
"分享成功"
);
}
}
},
},
fail
:
function
()
{
fail
:
function
()
{
// 转发失败之后的回调
// 转发失败之后的回调
if
(
res
.
errMsg
==
"shareAppMessage:fail cancel"
)
{
if
(
res
.
errMsg
==
"shareAppMessage:fail cancel"
)
{
// 用户取消转发
// 用户取消转发
consol
.
log
(
res
,
"分享失败"
);
}
else
if
(
res
.
errMsg
==
"shareAppMessage:fail"
)
{
}
else
if
(
res
.
errMsg
==
"shareAppMessage:fail"
)
{
// 转发失败,其中 detail message 为详细失败信息
// 转发失败,其中 detail message 为详细失败信息
}
}
...
...
src/pages/wxPay/index.vue
View file @
926c386c
...
@@ -44,64 +44,54 @@ export default {
...
@@ -44,64 +44,54 @@ export default {
.
to_wx_pay
(
this
.
options
)
.
to_wx_pay
(
this
.
options
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
payData
=
JSON
.
parse
(
res
.
data
.
data
);
let
payData
=
JSON
.
parse
(
res
.
data
.
data
);
// {
// timestamp: 0, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
// nonceStr: '', // 支付签名随机串,不长于 32 位
// package: '', // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
// signType: '', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
// paySign: '', // 支付签名
// success:
// }
payData
.
success
=
res
=>
{
payData
.
success
=
res
=>
{
console
.
log
(
"支付成功"
,
res
,
this
.
options
);
console
.
log
(
"支付成功"
,
res
,
this
.
options
);
this
.
message
=
"支付成功"
;
this
.
message
=
"支付成功"
;
let
that
=
this
;
let
query
=
{
orderSn
:
this
.
options
.
orderSn
};
wx
.
redirectTo
({
wx
.
redirectTo
({
url
:
`../index/main?from=wxPay&backpath=/pay/paySuccess¶ms=
${
url
:
`../index/main?from=wxPay&backpath=/pay/paySuccess¶ms=
${
JSON
.
stringify
(
that
.
options
.
orderSn
query
}
`
)
}
`
});
});
};
};
payData
.
fail
=
res
=>
{
payData
.
fail
=
res
=>
{
console
.
log
(
"支付失败"
,
res
,
this
.
options
.
orderSn
);
console
.
log
(
"支付失败"
,
res
,
this
.
options
.
orderSn
);
this
.
message
=
"支付失败"
;
this
.
message
=
"支付失败"
;
let
that
=
this
;
this
.
toPage
();
console
.
log
(
`../index/main?from=wxPay&backpath=/pay/paySuccess¶ms=
${
that
.
options
.
orderSn
}
`
)
wx
.
redirectTo
({
url
:
`../index/main?from=wxPay&backpath=/pay/paySuccess¶ms=
${
that
.
options
.
orderSn
}
`
});
};
};
payData
.
complete
=
res
=>
{
payData
.
complete
=
res
=>
{
if
(
res
.
errMsg
==
"chooseWXPay:cancel"
)
{
if
(
res
.
errMsg
==
"chooseWXPay:cancel"
)
{
console
.
log
(
"支付取消"
,
this
.
options
);
console
.
log
(
"支付取消"
,
this
.
options
);
this
.
message
=
"支付取消"
;
this
.
message
=
"支付取消"
;
this
.
toPage
();
let
that
=
this
;
wx
.
redirectTo
({
url
:
`../index/main?from=wxPay&backpath=/pay/paySuccess¶ms=
${
that
.
options
.
orderSn
}
`
});
}
}
};
};
wx
.
requestPayment
(
payData
);
wx
.
requestPayment
(
payData
);
})
})
.
catch
(
err
=>
{});
.
catch
(
err
=>
{});
},
toPage
()
{
let
query
=
{
orderSn
:
this
.
options
.
orderSn
,
payList
:
true
,
orderListToorderDetail
:
true
};
wx
.
redirectTo
({
url
:
`../index/main?from=wxPay&backpath=/order/orderDetail¶ms=
${
JSON
.
stringify
(
query
)}
`
});
}
}
}
}
};
};
</
script
>
</
script
>
<
style
>
<
style
>
.domain
{
.domain
{
text-align
:
center
;
text-align
:
center
;
padding-top
:
50%
;
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment