Browse Source

订阅

master
jiazhipeng 8 months ago
parent
commit
92b91ff16d
  1. 42
      pages/order/pay/index.js

42
pages/order/pay/index.js

@ -50,6 +50,24 @@ Page({
isPaying: false, isPaying: false,
sku_model_type: "",
templateIds: {
"ticket": [
// 订单状态变化通知
"cgeAlh1IzNlCua-q0UInEHzWaZdqvpfiVq1eBo-Oj4o",
//出票结果通知
"zdh2DYFLJ8M-jwiW6EXfhJ4qPpreWp1rHIMd0jrLWII",
// 订单支付成功通知
"KFtX7CPbFkYTbxowaLC0-bEdeGdzfWpaOXCTOOWS_NM",
],
"post": [
// 订单支付成功通知
"KFtX7CPbFkYTbxowaLC0-bEdeGdzfWpaOXCTOOWS_NM",
// 订单发货通知
"zyoVCQnrhXYojldRffIgz8O4uEeuJvbhWBxqNbhrPMU"
],
}
}, },
/** /**
@ -141,9 +159,6 @@ Page({
commonApi.user_post("order/query",{ commonApi.user_post("order/query",{
order_id:this.data.id order_id:this.data.id
}).then(res=>{ }).then(res=>{
// 书券产品 // 书券产品
if(res.data.order_product_list[0].product_id == 75012 || if(res.data.order_product_list[0].product_id == 75012 ||
res.data.order_product_list[0].product_id == 75013 || res.data.order_product_list[0].product_id == 75013 ||
@ -156,7 +171,7 @@ Page({
isBook:true, isBook:true,
payIndex:1 payIndex:1
}) })
} }
if(res.data.create_time && res.data.auto_close_time && res.data.state=='UNPAID'){ if(res.data.create_time && res.data.auto_close_time && res.data.state=='UNPAID'){
let time = (new Date(res.data.create_time.replace(/-/g,'/')).getTime() + Number(res.data.auto_close_time) * 1000); let time = (new Date(res.data.create_time.replace(/-/g,'/')).getTime() + Number(res.data.auto_close_time) * 1000);
this.daojishi(time); this.daojishi(time);
@ -199,6 +214,7 @@ Page({
carCouponTip:carCouponTip, carCouponTip:carCouponTip,
info: res.data, info: res.data,
MTTip: MTTip, MTTip: MTTip,
sku_model_type: res.data.order_product_list[0].product_model
}) })
console.log(this.data.ERMB); console.log(this.data.ERMB);
@ -230,6 +246,7 @@ Page({
}) })
}, },
pay:function(){ pay:function(){
let _this = this;
let arr = [] let arr = []
this.data.info.order_product_list.forEach(item => { this.data.info.order_product_list.forEach(item => {
arr.push(item.product_id) arr.push(item.product_id)
@ -260,7 +277,6 @@ Page({
} }
} }
let _this = this;
if(this.data.payIndex==1) { if(this.data.payIndex==1) {
this.setData({ this.setData({
showNumMask:true showNumMask:true
@ -289,11 +305,25 @@ Page({
title: '支付成功', title: '支付成功',
icon:'success' icon:'success'
}) })
let templateIds = _this.data.templateIds[_this.data.sku_model_type];
if (templateIds && Array.isArray(templateIds) && templateIds.length>0) {
wx.requestSubscribeMessage({
tmplIds: templateIds,
complete (res) {
wx.redirectTo({
url: '../payresult/index?tid='+_this.data.id+'&ids='+_this.data.ids.join(',')
})
}
})
return
}
setTimeout(()=>{ setTimeout(()=>{
// 支付成功不还原isPaying redirectTo 会删掉当前页面触发unload // 支付成功不还原isPaying redirectTo 会删掉当前页面触发unload
// _this.data.isPaying = false // _this.data.isPaying = false
wx.redirectTo({ wx.redirectTo({
url: '../payresult/index?tid='+_this.data.id+'&ids='+_this.data.ids.join(',') url: '../payresult/index?tid='+_this.data.id+'&ids='+_this.data.ids.join(',')
}) })
},1000) },1000)
}, },

Loading…
Cancel
Save