【新增】接入微信订阅消息

This commit is contained in:
puhui999
2024-07-24 17:17:44 +08:00
parent 2ea027a6e0
commit 8977504147
5 changed files with 42 additions and 30 deletions
+14 -13
View File
@@ -47,6 +47,7 @@
import { onLoad } from '@dcloudio/uni-app';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import PayWalletApi from '@/sheep/api/pay/wallet';
import { SubscribeTemplate } from '@/sheep/util/const';
const userWallet = computed(() => sheep.$store('user').userWallet);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
@@ -73,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('money_change');
sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.MONEY_CHANGE);
// #endif
sheep.$router.go('/pages/pay/index', {
id: data.payOrderId,
orderType: 'recharge'
});
// sheep.$router.go('/pages/pay/index', {
// id: data.payOrderId,
// orderType: 'recharge'
// });
}
onLoad(() => {
@@ -256,4 +257,4 @@
}
}
}
</style>
</style>