修复小程序订阅消息问题
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
|
||||
// export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
|
||||
//export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
|
||||
// export const VUE_APP_API_URL = '/h5api'
|
||||
export const VUE_APP_API_URL = 'http://127.0.0.1:8008/api'
|
||||
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'
|
||||
|
@ -120,9 +120,13 @@ export async function payOrderHandle(orderId, type, from) {
|
||||
|
||||
// 处理调用支付接口的逻辑
|
||||
// @type create(创建订单)||pay(支付订单)
|
||||
export function handleOrderPayResults(data, type, payType) {
|
||||
export function handleOrderPayResults(data, type, payType) {
|
||||
// #ifdef MP-WEIXIN
|
||||
//subscribeMessage()
|
||||
// #endif
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.hideLoading()
|
||||
uni.hideLoading()
|
||||
|
||||
switch (data.status) {
|
||||
// 订单号已存在
|
||||
case "ORDER_EXIST":
|
||||
@ -179,7 +183,7 @@ export function handleOrderPayResults(data, type, payType) {
|
||||
goOrderDetails(data.result.orderId, type)
|
||||
}).then(res => {
|
||||
// #ifdef MP-WEIXIN
|
||||
subscribeMessage()
|
||||
//subscribeMessage()
|
||||
// #endif
|
||||
})
|
||||
break;
|
||||
@ -196,18 +200,33 @@ export function handleOrderPayResults(data, type, payType) {
|
||||
|
||||
export function subscribeMessage() {
|
||||
// 调用订阅
|
||||
console.log('调用订阅')
|
||||
console.log('调用订阅')
|
||||
|
||||
getSubscribeTemplate()
|
||||
.then(res => {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: res.data,
|
||||
success(res) {
|
||||
console.log(res)
|
||||
},
|
||||
fail(error) {
|
||||
console.log(error)
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.showModal({
|
||||
title: '温馨提示',
|
||||
content: '为更好的促进您与商家的交流,小程序需要在您成交时向您发送消息',
|
||||
confirmText: "同意",
|
||||
cancelText: "拒绝",
|
||||
success: function(res1) {
|
||||
if (res1.confirm) {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: res.data,
|
||||
success(res2) {
|
||||
console.log('res01:',res2)
|
||||
},
|
||||
fail(error) {
|
||||
console.log('res02:',error)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
//revolve(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
.catch(err => {});
|
||||
}
|
||||
|
@ -310,7 +310,11 @@ export default {
|
||||
this.computedPrice()
|
||||
},
|
||||
},
|
||||
onLoad: function() {
|
||||
onLoad: function() {
|
||||
// #ifdef MP-WEIXIN
|
||||
|
||||
subscribeMessage()
|
||||
// #endif
|
||||
let that = this
|
||||
this.$store.dispatch('getUser', true)
|
||||
that.getCartInfo()
|
||||
@ -511,8 +515,9 @@ export default {
|
||||
from.from = 'app'
|
||||
}
|
||||
console.log(this.$deviceType)
|
||||
// #ifdef MP-WEIXIN
|
||||
subscribeMessage()
|
||||
// #ifdef MP-WEIXIN
|
||||
|
||||
// subscribeMessage()
|
||||
// #endif
|
||||
createOrder(this.orderGroupInfo.orderKey, {
|
||||
realName: this.contacts,
|
||||
|
Reference in New Issue
Block a user