diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue index ac5171e..9aac80f 100644 --- a/pagesOrder/settle/settle.vue +++ b/pagesOrder/settle/settle.vue @@ -262,80 +262,80 @@ submitOrder(); } - // 提交订单 - const submitOrder = () => { - if (!isAddress.value) return toastAddressShow.value = true; - createOrder(); - } - // 订单相关 - const cartList = ref([]); - const orderInfo = ref({}); - const checkOrder = () => { - checkOrderApi({ - cart_id: cartStore.cartList - }).then(res => { - cartList.value = res.data.cart_list; - orderInfo.value = res.data.order; - }) - } - const createOrder = () => { - createOrderApi({ - cart_id: cartStore.cartList, - address_id: addressInfo.value.address_id, - mer_id: shopInfo.value.mer_id, - pay_type: 1 - }).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, - success: (e) => { - if (e.errMsg == 'requestPayment:ok') { - uni.showModal({ - title: '订单支付成功', - confirmText: '查看订单', - cancelText: '继续购买', - success: (e) => { - if (e.confirm) uni.navigateTo({ - url: '/pagesOrder/order/order' - }) - else uni.navigateBack(); - } - }) - } else uni.$u.toast('支付失败') - }, - fail: (e) => { - uni.$u.toast('用户取消支付') - } - }) - // uni.showModal({ - // title: '订单支付成功', - // confirmText: '查看订单', - // cancelText: '继续购买', - // success: (e) => { - // if(e.confirm) uni.navigateTo({ - // url: '/pagesOrder/order/order' - // }) - // else uni.navigateBack(); - // } - // }) - }) - } - - const c_price = (price, index = 0) => { - price = price + ''; - return price.split('.')[index] || (index ? '00' : '0'); - } - - onLoad(options => { - checkOrder(); - }) - onShow(() => { - getAddressList(); - }) + // 提交订单 + const submitOrder = () => { + if (!isAddress.value) return toastAddressShow.value = true; + createOrder(); + } + // 订单相关 + const cartList = ref([]); + const orderInfo = ref({}); + const checkOrder = ()=>{ + checkOrderApi({ + cart_id: cartStore.cartList + }).then(res=>{ + cartList.value = res.data.cart_list; + orderInfo.value = res.data.order; + }) + } + const createOrder = ()=>{ + createOrderApi({ + cart_id: cartStore.cartList, + address_id: addressInfo.value.address_id, + mer_id: shopInfo.value.mer_id, + pay_type: 1 + }).then(res=>{ + uni.requestPayment({ + provider: 'wxpay', + 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'){ + uni.showModal({ + title: '订单支付成功', + confirmText: '查看订单', + cancelText: '继续购买', + success: (e) => { + if(e.confirm) uni.navigateTo({ + url: '/pagesOrder/order/order' + }) + else uni.navigateBack(); + } + }) + }else uni.$u.toast('支付失败') + }, + fail: (e) => { + uni.$u.toast('用户取消支付') + } + }) + // uni.showModal({ + // title: '订单支付成功', + // confirmText: '查看订单', + // cancelText: '继续购买', + // success: (e) => { + // if(e.confirm) uni.navigateTo({ + // url: '/pagesOrder/order/order' + // }) + // else uni.navigateBack(); + // } + // }) + }) + } + + const c_price = (price, index=0)=>{ + price = price + ''; + return price.split('.')[index] || (index ? '00' : '0'); + } + + onLoad(options=>{ + checkOrder(); + }) + onShow(()=>{ + getAddressList(); + })