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
c849cf29
Commit
c849cf29
authored
Feb 11, 2020
by
chenhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序订阅消息
parent
3c27ab27
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
src/api/wxPay.js
+11
-4
src/pages/wxPay/index.vue
+19
-0
No files found.
src/api/wxPay.js
View file @
c849cf29
...
@@ -2,9 +2,16 @@ import {requestPOST,requestPOST1} from "@/utils/request.js";
...
@@ -2,9 +2,16 @@ import {requestPOST,requestPOST1} from "@/utils/request.js";
export
default
{
export
default
{
to_wx_pay
(
options
)
{
to_wx_pay
(
options
)
{
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/to_wx_pay`
,
options
)
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/to_wx_pay`
,
options
);
},
},
cancelPayment
(
options
)
{
cancelPayment
(
options
)
{
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/payment_cancel?orderSn=
${
options
}
`
)
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/payment_cancel?orderSn=
${
options
}
`
);
},
sendMiniSubscribeMessage
(
orderSn
)
{
return
requestPOST1
(
`
${
process
.
env
.
OLSHOP_URL
}
/pay/sendMiniSubscribeMessage?orderSn=
${
orderSn
}
`
);
}
}
}
};
\ No newline at end of file
\ No newline at end of file
src/pages/wxPay/index.vue
View file @
c849cf29
...
@@ -52,6 +52,25 @@ export default {
...
@@ -52,6 +52,25 @@ export default {
let
payData
=
JSON
.
parse
(
res
.
data
.
data
);
let
payData
=
JSON
.
parse
(
res
.
data
.
data
);
payData
.
success
=
res
=>
{
payData
.
success
=
res
=>
{
console
.
log
(
"支付成功"
,
res
,
this
.
options
);
console
.
log
(
"支付成功"
,
res
,
this
.
options
);
// TODO 小程序订阅消息埋点-支付成功 nnEVpqCfNzkj07oIlF3X2Ms8sdzCjkCpqYWGKNiZK2g
const
orderSn
=
this
.
options
.
orderSn
;
try
{
wx
.
requestSubscribeMessage
({
tmplIds
:
[
'CdnNUqNZRyQLfdH376ptwSBPwt7pJA5QWjcQ426_XyE'
],
success
(
res
)
{
console
.
log
(
"message success response: "
,
res
);
wxPay
.
sendMiniSubscribeMessage
(
orderSn
);
},
fail
(
res
)
{
console
.
log
(
"message fail response: "
,
res
)
}
})
}
catch
(
err
)
{
console
.
error
(
"subscribeMessage-err"
,
err
);
}
this
.
message
=
"支付成功"
;
this
.
message
=
"支付成功"
;
if
(
!
this
.
options_isCard
){
if
(
!
this
.
options_isCard
){
let
query
=
{
let
query
=
{
...
...
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