Commit 852f7ed3 authored by 罗超's avatar 罗超

1

parent 56449934
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
<view class="big-title"> <view class="big-title">
<text>{{ currentPriceInfo.startCityName }}出发</text> <text>{{ currentPriceInfo.startCityName }}出发</text>
</view> </view>
<view class="jz_ReseQue" @click="subscribeMsgAli"> <view class="jz_ReseQue">
<img <img
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png"
/>即时确认:本产品付款后可快速确认,放心期待您的旅行 />即时确认:本产品付款后可快速确认,放心期待您的旅行
...@@ -887,17 +887,6 @@ export default { ...@@ -887,17 +887,6 @@ export default {
// #endif // #endif
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
//支付宝支付 //支付宝支付
subscribeMsgAli() {
let idsArr = uni.getStorageSync("basedata")?.mall?.alimessage ?? [];
let ids = [];
if (idsArr.length > 0) {
idsArr.map((e) => {
ids.push(e.MessageId);
});
}
console.log("ids", ids);
this.$utils.SubscribeMsgAli(ids, () => {});
},
querenAli(data) { querenAli(data) {
let that = this; let that = this;
let url = "/api/WeChatPay/GetTravlePayInfo"; let url = "/api/WeChatPay/GetTravlePayInfo";
...@@ -915,7 +904,9 @@ export default { ...@@ -915,7 +904,9 @@ export default {
(res) => { (res) => {
this.orderInfo = JSON.parse(res.data); this.orderInfo = JSON.parse(res.data);
if (res.data) { if (res.data) {
that.$utils.SubscribeMsgAli(() => {
that.PayAli(res.data, data); that.PayAli(res.data, data);
});
} else { } else {
uni.showToast({ uni.showToast({
title: "获取交易号失败", title: "获取交易号失败",
......
...@@ -40,13 +40,22 @@ function getretailer() {//判断是否是分销商 ...@@ -40,13 +40,22 @@ function getretailer() {//判断是否是分销商
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
// 引入消息模板方法 // 引入消息模板方法
const { requestSubscribeMessage } = requirePlugin("subscribeMsg"); const { requestSubscribeMessage } = requirePlugin("subscribeMsg");
function SubscribeMsgAli(ids, cb) {//支付宝小程序订阅消息 //支付宝小程序订阅消息
function SubscribeMsgAli(cb) {
let idsArr = uni.getStorageSync("basedata")?.mall?.alimessage ?? [];
let ids = [];
if (idsArr.length > 0) {
idsArr.map((e) => {
ids.push(e.MessageId);
});
}
if (ids.length === 0) { if (ids.length === 0) {
my.showToast({ my.showToast({
type: 'fail', type: 'fail',
content: '请传入模板id', content: '请传入模板id',
duration: 3000, duration: 3000,
}); });
cb();
return; return;
} }
requestSubscribeMessage({ // 触发消息订阅弹框 requestSubscribeMessage({ // 触发消息订阅弹框
...@@ -54,12 +63,16 @@ function SubscribeMsgAli(ids, cb) {//支付宝小程序订阅消息 ...@@ -54,12 +63,16 @@ function SubscribeMsgAli(ids, cb) {//支付宝小程序订阅消息
callback(res) { callback(res) {
console.log('订阅回调', res); console.log('订阅回调', res);
if (res.success) { if (res.success) {
uni.showToast({
title: "订阅成功",
duration: 1000,
});
cb(); cb();
} else { } else {
switch (res.errorCode) { switch (res.errorCode) {
case 11: { case 11: {
my.call('toast', { my.call('toast', {
content: '用户未订阅关闭弹窗', content: '用户取消订阅',
}); });
break; break;
} }
......
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