修改活动商品的提交订单页面的金额等数据异常问题
This commit is contained in:
parent
a4a233f175
commit
61c15f5d67
@ -246,7 +246,8 @@
|
||||
<view class="wealBox">
|
||||
<view class="wealBoxItem wealBoxItem1">
|
||||
<view class="wealBoxItemTop">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_fen.png" mode="aspectFit">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_fen.png"
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
<view>石榴分</view>
|
||||
</view>
|
||||
@ -259,7 +260,8 @@
|
||||
</view>
|
||||
<view class="wealBoxItem wealBoxItem2">
|
||||
<view class="wealBoxItemTop">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_zi.png" mode="aspectFit">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_zi.png"
|
||||
mode="aspectFit">
|
||||
</image>
|
||||
<view>石榴籽</view>
|
||||
</view>
|
||||
@ -272,7 +274,8 @@
|
||||
</view>
|
||||
<view class="wealBoxItem wealBoxItem3">
|
||||
<view class="wealBoxItemTop">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_jin.png" mode="aspectFit"/>
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_jin.png"
|
||||
mode="aspectFit" />
|
||||
<view>石榴金</view>
|
||||
</view>
|
||||
<view>
|
||||
@ -374,6 +377,7 @@ export default {
|
||||
|
||||
// 核销码
|
||||
verifyCode: '',
|
||||
totalPrice: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -520,8 +524,10 @@ export default {
|
||||
{
|
||||
goods_id: item.goods_id,
|
||||
count: item.count,
|
||||
price: item.price,
|
||||
},
|
||||
],
|
||||
adver_id: item.adver_id,
|
||||
}
|
||||
request(apiArr.updateCar, "POST", params).then(res => {
|
||||
uni.showToast({
|
||||
@ -533,37 +539,20 @@ export default {
|
||||
|
||||
// 计算总金额
|
||||
calculateTotal(order) {
|
||||
const currentTime = new Date().getTime();
|
||||
if (order === 'order1') {
|
||||
let total = 0;
|
||||
this.orderList1.forEach(goods => {
|
||||
// 团购活动时间判断
|
||||
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
||||
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
||||
if (currentTime >= startTime && currentTime <= endTime) {
|
||||
// total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
|
||||
total += goods.commodity_goods_info.group_buy_price * goods.count;
|
||||
} else {
|
||||
// total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
|
||||
total += goods.commodity_goods_info.sales_price * goods.count;
|
||||
}
|
||||
// 直接使用item.price进行计算
|
||||
total += goods.price * goods.count;
|
||||
});
|
||||
// 加运费
|
||||
return total.toFixed(2);
|
||||
} else {
|
||||
let total = 0;
|
||||
this.orderList2.forEach(goods => {
|
||||
// // 团购活动时间判断
|
||||
// const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
||||
// const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
||||
// if (currentTime >= startTime && currentTime <= endTime) {
|
||||
// // total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
|
||||
// total += goods.commodity_goods_info.group_buy_price * goods.count;
|
||||
// } else {
|
||||
// // total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
|
||||
// total += goods.commodity_goods_info.sales_price * goods.count;
|
||||
// }
|
||||
// 直接使用item.price进行计算
|
||||
total += goods.price * goods.count;
|
||||
this.totalPrice = total.toFixed(2);
|
||||
});
|
||||
// 加运费
|
||||
return total.toFixed(2);
|
||||
@ -675,14 +664,10 @@ export default {
|
||||
merchant_id: ztAddress.address_id,
|
||||
group_buy_activity_id: firstItem.commodity_goods_info.group_buy_activity_id,
|
||||
goods_and_count: group.map(item => {
|
||||
const activityInfo = item.commodity_goods_info.group_buy_activity_info;
|
||||
const isGroupBuy = activityInfo &&
|
||||
currentTime >= new Date(activityInfo.start_time).getTime() &&
|
||||
currentTime <= new Date(activityInfo.end_time).getTime();
|
||||
return {
|
||||
goods_id: item.goods_id,
|
||||
count: item.count,
|
||||
price: isGroupBuy ? item.commodity_goods_info.group_buy_price : item.commodity_goods_info.sales_price,
|
||||
price: item.price,
|
||||
freight: item.commodity_goods_info.freight,
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user