【新增】订阅消息:订单发货、充值退款消息订阅
parent
a2b0942d88
commit
9add242540
|
@ -166,6 +166,7 @@
|
|||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { SubscribeTemplate } from '@/sheep/util/const';
|
||||
|
||||
const state = reactive({
|
||||
orderPayload: {},
|
||||
|
@ -230,6 +231,11 @@
|
|||
if (state.orderPayload.items[0].cartId > 0) {
|
||||
sheep.$store('cart').getList();
|
||||
}
|
||||
|
||||
// #ifdef MP
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.DELIVERY_ORDER);
|
||||
// #endif
|
||||
|
||||
// 跳转到支付页面
|
||||
sheep.$router.redirect('/pages/pay/index', {
|
||||
id: data.payOrderId,
|
||||
|
|
|
@ -74,20 +74,20 @@
|
|||
|
||||
// 发起支付
|
||||
async function onConfirm() {
|
||||
// const { code, data } = await PayWalletApi.createWalletRecharge({
|
||||
// packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)?.id,
|
||||
// payPrice: state.recharge_money * 100
|
||||
// });
|
||||
// if (code !== 0) {
|
||||
// return;
|
||||
// }
|
||||
const { code, data } = await PayWalletApi.createWalletRecharge({
|
||||
packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)?.id,
|
||||
payPrice: state.recharge_money * 100,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// #ifdef MP
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.MONEY_CHANGE);
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage([SubscribeTemplate.WALLET_RECHARGER_PAID, SubscribeTemplate.WALLET_RECHARGE_REFUNDED]);
|
||||
// #endif
|
||||
// sheep.$router.go('/pages/pay/index', {
|
||||
// id: data.payOrderId,
|
||||
// orderType: 'recharge'
|
||||
// });
|
||||
sheep.$router.go('/pages/pay/index', {
|
||||
id: data.payOrderId,
|
||||
orderType: 'recharge',
|
||||
});
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
|
|
|
@ -59,7 +59,9 @@ export const TimeStatusEnum = {
|
|||
// TODO 订阅模版枚举
|
||||
export const SubscribeTemplate = {
|
||||
ORDER_AFTERSALE_CHANGE: "售后进度通知",
|
||||
MONEY_CHANGE: "充值成功通知"
|
||||
WALLET_RECHARGER_PAID: "充值成功通知",
|
||||
WALLET_RECHARGE_REFUNDED: "退款申请通知",
|
||||
DELIVERY_ORDER: "订单发货通知",
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue