修改活动商品的提交订单页面的金额等数据异常问题
This commit is contained in:
parent
a4a233f175
commit
61c15f5d67
@ -43,7 +43,7 @@
|
|||||||
<view class="group-price">
|
<view class="group-price">
|
||||||
<view>¥{{ item.commodity_goods_info.sales_price }}/{{
|
<view>¥{{ item.commodity_goods_info.sales_price }}/{{
|
||||||
item.commodity_goods_info.goods_unit
|
item.commodity_goods_info.goods_unit
|
||||||
}}</view>
|
}}</view>
|
||||||
<!-- 运费 -->
|
<!-- 运费 -->
|
||||||
<view class="goods-desc" style="margin-top: 10rpx;">运费 ¥{{
|
<view class="goods-desc" style="margin-top: 10rpx;">运费 ¥{{
|
||||||
item.commodity_goods_info.freight }}</view>
|
item.commodity_goods_info.freight }}</view>
|
||||||
@ -246,7 +246,8 @@
|
|||||||
<view class="wealBox">
|
<view class="wealBox">
|
||||||
<view class="wealBoxItem wealBoxItem1">
|
<view class="wealBoxItem wealBoxItem1">
|
||||||
<view class="wealBoxItemTop">
|
<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>
|
</image>
|
||||||
<view>石榴分</view>
|
<view>石榴分</view>
|
||||||
</view>
|
</view>
|
||||||
@ -259,7 +260,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="wealBoxItem wealBoxItem2">
|
<view class="wealBoxItem wealBoxItem2">
|
||||||
<view class="wealBoxItemTop">
|
<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>
|
</image>
|
||||||
<view>石榴籽</view>
|
<view>石榴籽</view>
|
||||||
</view>
|
</view>
|
||||||
@ -272,7 +274,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="wealBoxItem wealBoxItem3">
|
<view class="wealBoxItem wealBoxItem3">
|
||||||
<view class="wealBoxItemTop">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
@ -374,6 +377,7 @@ export default {
|
|||||||
|
|
||||||
// 核销码
|
// 核销码
|
||||||
verifyCode: '',
|
verifyCode: '',
|
||||||
|
totalPrice: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -520,8 +524,10 @@ export default {
|
|||||||
{
|
{
|
||||||
goods_id: item.goods_id,
|
goods_id: item.goods_id,
|
||||||
count: item.count,
|
count: item.count,
|
||||||
|
price: item.price,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
adver_id: item.adver_id,
|
||||||
}
|
}
|
||||||
request(apiArr.updateCar, "POST", params).then(res => {
|
request(apiArr.updateCar, "POST", params).then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -533,37 +539,20 @@ export default {
|
|||||||
|
|
||||||
// 计算总金额
|
// 计算总金额
|
||||||
calculateTotal(order) {
|
calculateTotal(order) {
|
||||||
const currentTime = new Date().getTime();
|
|
||||||
if (order === 'order1') {
|
if (order === 'order1') {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
this.orderList1.forEach(goods => {
|
this.orderList1.forEach(goods => {
|
||||||
// 团购活动时间判断
|
// 直接使用item.price进行计算
|
||||||
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
total += goods.price * goods.count;
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
// 加运费
|
// 加运费
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
} else {
|
} else {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
this.orderList2.forEach(goods => {
|
this.orderList2.forEach(goods => {
|
||||||
// // 团购活动时间判断
|
// 直接使用item.price进行计算
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
total += goods.price * goods.count;
|
total += goods.price * goods.count;
|
||||||
|
this.totalPrice = total.toFixed(2);
|
||||||
});
|
});
|
||||||
// 加运费
|
// 加运费
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
@ -654,7 +643,7 @@ export default {
|
|||||||
const params = {
|
const params = {
|
||||||
user_id: uni.getStorageSync('userId'),
|
user_id: uni.getStorageSync('userId'),
|
||||||
// 先判断shopCarList数据中是否包含isAdver且为true
|
// 先判断shopCarList数据中是否包含isAdver且为true
|
||||||
order_cate : this.carList.some(item => item.isAdver === true) ? 3 : (isGroupBuyValid ? 2 : 1),
|
order_cate: this.carList.some(item => item.isAdver === true) ? 3 : (isGroupBuyValid ? 2 : 1),
|
||||||
goods_list: Object.keys(this.supplierGroups).map(supplierId => {
|
goods_list: Object.keys(this.supplierGroups).map(supplierId => {
|
||||||
const group = this.supplierGroups[supplierId];
|
const group = this.supplierGroups[supplierId];
|
||||||
const firstItem = group[0];
|
const firstItem = group[0];
|
||||||
@ -675,14 +664,10 @@ export default {
|
|||||||
merchant_id: ztAddress.address_id,
|
merchant_id: ztAddress.address_id,
|
||||||
group_buy_activity_id: firstItem.commodity_goods_info.group_buy_activity_id,
|
group_buy_activity_id: firstItem.commodity_goods_info.group_buy_activity_id,
|
||||||
goods_and_count: group.map(item => {
|
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 {
|
return {
|
||||||
goods_id: item.goods_id,
|
goods_id: item.goods_id,
|
||||||
count: item.count,
|
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,
|
freight: item.commodity_goods_info.freight,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user