Commit 4bbe9853 by 程智春

订单订阅消息

parent 7489c404
...@@ -63,8 +63,9 @@ export default { ...@@ -63,8 +63,9 @@ export default {
console.log('wxPay',res.data) console.log('wxPay',res.data)
payData.success = res => { payData.success = res => {
console.log("支付成功", res, this.options); console.log("支付成功", res, this.options);
this.message = "支付成功";
const orderSn = this.options.orderSn; const orderSn = this.options.orderSn;
let that = this
try { try {
const subscribeMessageObj = this.$store.state.subscribeMessageObj; const subscribeMessageObj = this.$store.state.subscribeMessageObj;
if (subscribeMessageObj && Object.keys(subscribeMessageObj).length > 0) { if (subscribeMessageObj && Object.keys(subscribeMessageObj).length > 0) {
...@@ -85,21 +86,29 @@ export default { ...@@ -85,21 +86,29 @@ export default {
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: tmplIds, tmplIds: tmplIds,
success(res) { success(res) {
fn(that)
console.log("message success response: ", res); console.log("message success response: ", res);
}, },
fail(res) { fail(res) {
fn(that)
console.log("message fail response: ", res) console.log("message fail response: ", res)
} }
}) })
}else{
fn(that)
} }
}else {
fn(this)
} }
} catch (err) { } catch (err) {
console.error("subscribeMessage-err", err); console.error("subscribeMessage-err", err);
} }
this.message = "支付成功";
if(!this.options_isCard){ function fn(_this){
if(!_this.options_isCard){
let query = { let query = {
orderSn: this.options.orderSn orderSn: _this.options.orderSn
}; };
wx.redirectTo({ wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify( url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify(
...@@ -108,7 +117,7 @@ export default { ...@@ -108,7 +117,7 @@ export default {
}); });
}else{ }else{
let query = { let query = {
cardTitle: this.options_isCardTitle cardTitle: _this.options_isCardTitle
}; };
wx.redirectTo({ wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify( url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify(
...@@ -116,6 +125,8 @@ export default { ...@@ -116,6 +125,8 @@ export default {
)}` )}`
}); });
} }
}
}; };
payData.fail = res => { payData.fail = res => {
console.log("支付失败", res, this.options.orderSn); console.log("支付失败", res, this.options.orderSn);
......
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