This commit is contained in:
zmj 2024-05-07 13:38:27 +08:00
commit 8c03b3eafc
2 changed files with 87 additions and 87 deletions

View File

@ -270,42 +270,42 @@
//
const cartList = ref([]);
const orderInfo = ref({});
const checkOrder = () => {
const checkOrder = ()=>{
checkOrderApi({
cart_id: cartStore.cartList
}).then(res => {
}).then(res=>{
cartList.value = res.data.cart_list;
orderInfo.value = res.data.order;
})
}
const createOrder = () => {
const createOrder = ()=>{
createOrderApi({
cart_id: cartStore.cartList,
address_id: addressInfo.value.address_id,
mer_id: shopInfo.value.mer_id,
pay_type: 1
}).then(res => {
}).then(res=>{
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.config.timeStamp,
nonceStr: res.data.config.nonceStr,
package: res.data.config.package,
signType: res.data.config.signType,
paySign: res.data.config.paySign,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: (e) => {
if (e.errMsg == 'requestPayment:ok') {
if(e.errMsg == 'requestPayment:ok'){
uni.showModal({
title: '订单支付成功',
confirmText: '查看订单',
cancelText: '继续购买',
success: (e) => {
if (e.confirm) uni.navigateTo({
if(e.confirm) uni.navigateTo({
url: '/pagesOrder/order/order'
})
else uni.navigateBack();
}
})
} else uni.$u.toast('支付失败')
}else uni.$u.toast('支付失败')
},
fail: (e) => {
uni.$u.toast('用户取消支付')
@ -325,15 +325,15 @@
})
}
const c_price = (price, index = 0) => {
const c_price = (price, index=0)=>{
price = price + '';
return price.split('.')[index] || (index ? '00' : '0');
}
onLoad(options => {
onLoad(options=>{
checkOrder();
})
onShow(() => {
onShow(()=>{
getAddressList();
})
</script>

View File

@ -33,7 +33,7 @@ const useUserStore = defineStore("user", () => {
mobile: "19330904744",
nickname: "用户1714964250",
supplier: null,
token: "31f74a72e2d05673ec14d2a6408718ef"
token: "33bb1ca5e6c98a6f948ad56b75471fb8"
}
// #endif