【新增】订阅消息:订单发货、充值退款消息订阅

pull/63/head
puhui999 2024-07-30 17:44:55 +08:00
parent a2b0942d88
commit 9add242540
3 changed files with 211 additions and 203 deletions

View File

@ -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,

View File

@ -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(() => {

View File

@ -59,7 +59,9 @@ export const TimeStatusEnum = {
// TODO 订阅模版枚举
export const SubscribeTemplate = {
ORDER_AFTERSALE_CHANGE: "售后进度通知",
MONEY_CHANGE: "充值成功通知"
WALLET_RECHARGER_PAID: "充值成功通知",
WALLET_RECHARGE_REFUNDED: "退款申请通知",
DELIVERY_ORDER: "订单发货通知",
}