Commit c849cf29 by chenhui

小程序订阅消息

parent 3c27ab27
...@@ -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
...@@ -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 = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment