完成订单详情
This commit is contained in:
@@ -44,10 +44,10 @@ export const useCartStore = defineStore('cart', () => {
|
||||
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
|
||||
.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.num);
|
||||
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.price) * parseFloat(item.num);
|
||||
return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
|
||||
}
|
||||
}, 0);
|
||||
// 向上取整并保留两位小数
|
||||
@@ -94,7 +94,7 @@ export const useCartStore = defineStore('cart', () => {
|
||||
// 计算购物车总打包费用(向下取整并保留两位小数)
|
||||
const getTotalPackFee = (cartList) => computed(() => {
|
||||
const total = cartList.reduce((sum, item) => {
|
||||
return sum + item.packAmount * (item.packNumber || (item.num - item.returnNum));
|
||||
return sum + (item.packAmount * (item.packNumber || (item.num - item.returnNum)));
|
||||
}, 0);
|
||||
return Math.floor(total * 100) / 100;
|
||||
});
|
||||
|
||||
@@ -26,6 +26,7 @@ export const Memberpay = defineStore('memberpay', {
|
||||
shopId: data.shopId,
|
||||
shopUserId: data.shopUserId,
|
||||
amount: data.amount,
|
||||
activateId: data.activateId,
|
||||
// #ifdef MP-WEIXIN
|
||||
payType: 'wechatPay',
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
@@ -110,7 +111,12 @@ export const Memberpay = defineStore('memberpay', {
|
||||
try {
|
||||
let res = await APIpayltPayOrder({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
checkOrderPay: data.checkOrderPay,
|
||||
checkOrderPay: {
|
||||
...data.checkOrderPay,
|
||||
...{
|
||||
userId: uni.cache.get('userInfo').id
|
||||
}
|
||||
},
|
||||
// #ifdef MP-WEIXIN
|
||||
payType: 'wechatPay',
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
@@ -121,6 +127,7 @@ export const Memberpay = defineStore('memberpay', {
|
||||
// #endif
|
||||
returnUrl: data.returnUrl,
|
||||
buyerRemark: data.buyerRemark,
|
||||
userId: uni.cache.get('userInfo').id || ''
|
||||
})
|
||||
if (res) {
|
||||
uni.showLoading({
|
||||
@@ -189,19 +196,20 @@ export const Memberpay = defineStore('memberpay', {
|
||||
try {
|
||||
let res = await APIrefundVip({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
checkOrderPay: data.checkOrderPay,
|
||||
checkOrderPay: {
|
||||
...data.checkOrderPay,
|
||||
...{
|
||||
userId: uni.cache.get('userInfo').id
|
||||
}
|
||||
},
|
||||
pwd: data.pwd,
|
||||
payType: 'accountPay',
|
||||
payType: data.payType,
|
||||
returnUrl: data.returnUrl,
|
||||
buyerRemark: data.buyerRemark,
|
||||
shopUserId: data.shopUserId,
|
||||
userId: uni.cache.get('userInfo').id || '' //
|
||||
})
|
||||
if (res) {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
resolve(true)
|
||||
} catch (e) {
|
||||
uni.showToast({
|
||||
title: "支付失败"
|
||||
|
||||
Reference in New Issue
Block a user