更改购物车

This commit is contained in:
wwz
2025-03-25 10:05:16 +08:00
parent 429336c736
commit 1169e300df
8 changed files with 47 additions and 29 deletions

View File

@@ -272,7 +272,7 @@
shopUserId: Orderinfo.shopUserId,
})
if (Orderinfo.typeOrder == 2) {
if (Orderinfo.typeOrder == 2 && res.length>0) {
res.forEach((item) => {
item.Selected = false
})

View File

@@ -119,6 +119,7 @@
import rechargeFree from './components/rechargeFree.vue'
import paymentMethodes from '@/components/paymentMethod.vue'; //支付方式
import {
onShow,
onBackPress
} from '@dcloudio/uni-app';
@@ -221,8 +222,7 @@
// 打包费packFeess 计算购物车商品费用totalPrices 餐位费Seatcharge
try {
let sum = (is_type.value != 0 ? listinfo.packFeess : 0) + listinfo.totalPrices + (is_type
.value ==
0 ? listinfo.Seatcharge : 0);
.value == 0 ? listinfo.Seatcharge : 0);
listinfo.originAmount = Math.round(sum * 100) / 100;
// 打包费packFeess 计算购物车商品费用totalPrices 餐位费Seatcharge 商品卷Productroll 优惠卷coupondiscountAmount 积分listinfo.pointsDiscountAmount
@@ -232,11 +232,15 @@
.coupondiscountAmount || 0) - (listinfo.pointsDiscountAmount || 0);
listinfo.totalCost = Math.round(sums * 100) / 100;
// 霸王餐
console.log(orderVIP.value.freeDineConfig.enable, changeFreeenable.value)
if (orderVIP.value.freeDineConfig.enable && changeFreeenable.value) {
listinfo.totalCost = (parseFloat(listinfo.totalCost) * parseFloat(orderVIP.value
.freeDineConfig
.rechargeTimes)).toFixed(2)
try {
console.log(orderVIP.value.freeDineConfig.enable, changeFreeenable.value)
if (orderVIP.value.freeDineConfig.enable && changeFreeenable.value) {
listinfo.totalCost = (parseFloat(listinfo.totalCost) * parseFloat(orderVIP.value
.freeDineConfig
.rechargeTimes)).toFixed(2)
}
} catch (error) {
//TODO handle the exception
}
// 积分
if (listinfo.totalCost && listinfo.status == 'unpaid') {
@@ -258,7 +262,6 @@
orderInfoAfterRef.value.bwcclear()
uniqueIds.value = [] // 筛选出商品卷的id
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
listinfo.Productroll = 0 // 商品卷总价价格
listinfo.pointsNum = 0 // 商品卷总价价格
// 支付方式切换
// #ifdef MP-WEIXIN
@@ -330,23 +333,28 @@
}
} else {
// 筛选出商品卷的id
uniqueIds.value = [...uniqueIds.value, ...new Set(data.map(item => item.id))]
// 商品卷总价价格
listinfo.Productroll = await cartStore.getTotalProductroll(data)
// uniqueIds.value = [...uniqueIds.value, ...new Set(data.map(item => item.id))]
uniqueIds.value = [...uniqueIds.value, ...data.map(item => item.id)]
listinfo.Productroll = cartStore.getTotalProductroll(data).value
// TODO handle the exception
let res = {
Productroll: listinfo.Productroll,
uniqueIds: uniqueIds.value.length
}
orderInfoAfterRef.value.dataprocessing(res)
}
};
const learcoupons = (data) => {
if (data == 'product') {
console.log(listinfo)
uniqueIds.value = [] // 筛选出商品卷的id
listinfo.coupondiscountAmount = 0 // 优惠卷减去的金额
listinfo.Productroll = 0 // 商品卷总价价格
listinfo.pointsNum = 0 // 积分总价格
} else {
// 每次点击优惠卷删除优惠卷里的id
if (listinfo.coupondiscountAmount != 0) {
@@ -539,6 +547,16 @@
uni.$off('returnData', handleReturnData);
});
onShow(() => {
console.log(uni.cache.get('orderVIP'))
try {
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
} catch (error) {
//TODO handle the exception
}
});
// 监听页面返回事件
onMounted(async () => {
// 获取当前页面栈
@@ -552,13 +570,6 @@
// 每次进来全局更新shopId
uni.cache.set('shopId', options.shopId, 30)
uni.$on('returnData', handleReturnData);
// let res = await APIshopUserInfo({
// shopId: options.shopId
// })
// uni.cache.set('orderVIP', res)
// uni.cache.set('ordershopUserInfo', res.shopInfo)
// orderVIP.value = res
// ordershopUserInfo.value = res.shopInfo
}
try {
// * 获取会员信息