mall-uniapp/utils/SubscribeMessage.js

95 lines
2.0 KiB
JavaScript
Raw Normal View History

2021-02-06 09:25:18 +00:00
const arrTemp = ["beforePay","afterPay","refundApply", "beforeRecharge", "createBargain","pink"];
2020-08-13 08:12:57 +00:00
// export function auth() {
// let tmplIds = {};
// let messageTmplIds = uni.getStorageSync(SUBSCRIBE_MESSAGE);
// tmplIds = messageTmplIds ? JSON.parse(messageTmplIds) : {};
// return tmplIds;
// }
2020-08-13 08:12:57 +00:00
/**
* 支付成功后订阅消息id
* 订阅 确认收货通知 订单支付成功 新订单管理员提醒
*/
export function openPaySubscribe() {
let tmplIds = uni.getStorageSync('tempID' + arrTemp[0]);
return subscribe(tmplIds);
2020-08-13 08:12:57 +00:00
}
/**
* 订单相关订阅消息
* 送货 发货 取消订单
*/
export function openOrderSubscribe() {
let tmplIds = uni.getStorageSync('tempID' + arrTemp[1]);
return subscribe(tmplIds);
2020-08-13 08:12:57 +00:00
}
/**
* 提现消息订阅
* 成功 失败 消息
*/
2021-02-06 09:25:18 +00:00
// export function openExtrctSubscribe() {
// let tmplIds = uni.getStorageSync('tempID' + arrTemp[2]);
// return subscribe(tmplIds);
// }
2020-08-13 08:12:57 +00:00
/**
* 订单退款
2020-08-13 08:12:57 +00:00
*/
export function openOrderRefundSubscribe() {
2021-02-06 09:25:18 +00:00
let tmplIds = uni.getStorageSync('tempID' + arrTemp[2]);
return subscribe(tmplIds);
2020-08-13 08:12:57 +00:00
}
/**
* 充值成功
2020-08-13 08:12:57 +00:00
*/
export function openRechargeSubscribe() {
2021-02-06 09:25:18 +00:00
let tmplIds = uni.getStorageSync('tempID' + arrTemp[3]);
return subscribe(tmplIds);
2020-08-13 08:12:57 +00:00
}
/**
2021-02-06 09:25:18 +00:00
* 砍价成功
2020-08-13 08:12:57 +00:00
*/
2021-02-06 09:25:18 +00:00
export function openBargainSubscribe() {
let tmplIds = uni.getStorageSync('tempID' + arrTemp[4]);
return subscribe(tmplIds);
2020-08-13 08:12:57 +00:00
}
2021-02-06 09:25:18 +00:00
2020-08-13 08:12:57 +00:00
/**
2021-02-06 09:25:18 +00:00
* 拼团成功
2020-08-13 08:12:57 +00:00
*/
2021-02-06 09:25:18 +00:00
export function openPinkSubscribe() {
let tmplIds = uni.getStorageSync('tempID' + arrTemp[5]);
return subscribe(tmplIds);
2020-08-13 08:12:57 +00:00
}
// /**
// * 提现
// */
// export function openEextractSubscribe() {
// let tmplIds = JSON.parse(uni.getStorageSync('tempID' + paySubscribe));
// return subscribe(tmplIds);
// }
2020-08-13 08:12:57 +00:00
/**
* 调起订阅界面
* array tmplIds 模板id
*/
export function subscribe(tmplIds) {
let wecaht = wx;
return new Promise((reslove, reject) => {
wecaht.requestSubscribeMessage({
tmplIds: tmplIds,
success(res) {
return reslove(res);
},
fail(res) {
return reslove(res);
}
})
});
}