Compare commits
No commits in common. "47f1eaaa09b595f9e4d2b5cf6c7731b4e42b9552" and "3fb80ce105f577fd1ee3afacdabcd4038d970207" have entirely different histories.
47f1eaaa09
...
3fb80ce105
@ -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>
|
||||||
@ -97,41 +97,30 @@
|
|||||||
暂无商品数据
|
暂无商品数据
|
||||||
</view>
|
</view>
|
||||||
<view v-if="activeTab === 'pickup' && orderList2.length > 0">
|
<view v-if="activeTab === 'pickup' && orderList2.length > 0">
|
||||||
<!-- 按供应商分组 -->
|
<view class="goods-list" v-for="(item, index) in orderList2" :key="index">
|
||||||
<view v-for="(group, supplierId) in supplierGroups" :key="supplierId">
|
<view class="info-section">
|
||||||
<view class="goods-list">
|
<view class="address-section">
|
||||||
<view class="info-section">
|
<view class="section-title">自提点</view>
|
||||||
<view class="address-section">
|
<view @click="editAddress(item)">
|
||||||
<view class="section-title">自提点</view>
|
<view v-if="defZTAddress.length > 0">
|
||||||
<view @click="editAddress(group[0])">
|
<view v-for="(adItem, adIndex) in defZTAddress" :key="adIndex">
|
||||||
<view v-if="defZTAddress.length > 0">
|
<view class="address-info" v-if="adItem.id === item.goods_id">
|
||||||
<view v-for="(adItem, adIndex) in defZTAddress" :key="adIndex">
|
|
||||||
<view class="address-info" v-if="adItem.id == supplierId">
|
|
||||||
<view class="address-main">
|
|
||||||
<view class="address-name-phone">
|
|
||||||
<text class="name">{{ adItem.name }}</text>
|
|
||||||
<text class="phone">{{ adItem.phone }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="address-detail">
|
|
||||||
{{ adItem.address }}
|
|
||||||
<view class="copy-icon" @click.stop="copyZTAddress" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="address-info"
|
|
||||||
v-if="!defZTAddress.some(adItem => adItem.id == supplierId)">
|
|
||||||
<view class="address-main">
|
<view class="address-main">
|
||||||
<view class="address-name-phone">
|
<view class="address-name-phone">
|
||||||
<text class="name">请选择自提点</text>
|
<text class="name">{{ adItem.name }}</text>
|
||||||
|
<text class="phone">{{ adItem.phone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="address-detail">
|
||||||
|
{{ adItem.address }}
|
||||||
|
<view class="copy-icon" @click.stop="copyZTAddress" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="address-info" v-else>
|
<view class="address-info"
|
||||||
|
v-if="!defZTAddress.some(adItem => adItem.id === item.goods_id)">
|
||||||
<view class="address-main">
|
<view class="address-main">
|
||||||
<view class="address-name-phone">
|
<view class="address-name-phone">
|
||||||
<text class="name">请选择自提点</text>
|
<text class="name">请选择自提点</text>
|
||||||
@ -140,11 +129,18 @@
|
|||||||
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="address-info" v-else>
|
||||||
|
<view class="address-main">
|
||||||
|
<view class="address-name-phone">
|
||||||
|
<text class="name">请选择自提点</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 该供应商下的所有商品 -->
|
<view class="goods-item">
|
||||||
<view class="goods-item" v-for="(item, index) in group" :key="index">
|
|
||||||
<view class="goods-image">
|
<view class="goods-image">
|
||||||
<image :src="item.commodity_goods_info.commodity_pic" mode="aspectFill"></image>
|
<image :src="item.commodity_goods_info.commodity_pic" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -317,20 +313,6 @@ export default {
|
|||||||
group_buy_activity_id: 0,
|
group_buy_activity_id: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
// 按供应商id分组商品
|
|
||||||
supplierGroups() {
|
|
||||||
const groups = {};
|
|
||||||
this.orderList2.forEach(item => {
|
|
||||||
const supplierId = item.commodity_goods_info.group_buy_activity_info?.supplier_id || 'default';
|
|
||||||
if (!groups[supplierId]) {
|
|
||||||
groups[supplierId] = [];
|
|
||||||
}
|
|
||||||
groups[supplierId].push(item);
|
|
||||||
});
|
|
||||||
return groups;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.carList = JSON.parse(options.shopCarList)
|
this.carList = JSON.parse(options.shopCarList)
|
||||||
},
|
},
|
||||||
@ -479,7 +461,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 加运费
|
// 加运费
|
||||||
return total.toFixed(2);
|
return total;
|
||||||
} else {
|
} else {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
this.orderList2.forEach(goods => {
|
this.orderList2.forEach(goods => {
|
||||||
@ -493,22 +475,18 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 加运费
|
// 加运费
|
||||||
return total.toFixed(2);
|
return total;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectPayment(payment) {
|
selectPayment(payment) {
|
||||||
this.selectedPayment = payment;
|
this.selectedPayment = payment;
|
||||||
},
|
},
|
||||||
submitPayment() {
|
submitPayment() {
|
||||||
// 检查所有供应商是否都选择了自提点
|
// 检查所有商品是否都选择了自提点
|
||||||
const supplierIds = [...new Set(this.orderList2.map(item =>
|
const allHaveZTAddress = this.orderList2.every(item => {
|
||||||
item.commodity_goods_info.group_buy_activity_info?.supplier_id || 'default'
|
const ztAddress = this.defZTAddress.find(adItem => adItem.id === item.goods_id);
|
||||||
))];
|
return ztAddress && ztAddress.id;
|
||||||
|
});
|
||||||
const allHaveZTAddress = supplierIds.every(supplierId => {
|
|
||||||
const ztAddress = this.defZTAddress.find(adItem => adItem.id == supplierId);
|
|
||||||
return !!ztAddress;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!allHaveZTAddress) {
|
if (!allHaveZTAddress) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -520,39 +498,26 @@ export default {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
user_id: uni.getStorageSync('userId'),
|
user_id: uni.getStorageSync('userId'),
|
||||||
|
// TODO 应该判断是否为团购
|
||||||
is_group_buy: true,
|
is_group_buy: true,
|
||||||
goods_list: Object.keys(this.supplierGroups).map(supplierId => {
|
goods_list: this.orderList2.map(item => {
|
||||||
const group = this.supplierGroups[supplierId];
|
|
||||||
const firstItem = group[0];
|
|
||||||
|
|
||||||
// 团购活动id
|
// 团购活动id
|
||||||
this.group_buy_activity_id = firstItem.commodity_goods_info.group_buy_activity_id;
|
this.group_buy_activity_id = item.commodity_goods_info.group_buy_activity_id
|
||||||
|
const ztAddress = this.defZTAddress.find(adItem => adItem.id === item.goods_id) || {};
|
||||||
// 根据供应商id获取自提点信息
|
|
||||||
const ztAddress = this.defZTAddress.find(adItem => adItem.id == supplierId) || {};
|
|
||||||
|
|
||||||
// 团购活动时间判断
|
|
||||||
const currentTime = new Date().getTime();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
supplier_id: firstItem.commodity_goods_info.group_buy_activity_info.supplier_id,
|
supplier_id: item.commodity_goods_info.group_buy_activity_info.supplier_id,
|
||||||
supplier_name: firstItem.supplier_name || '',
|
supplier_name: item.supplier_name || '',
|
||||||
is_same_day: firstItem.commodity_goods_info.is_same_day,
|
is_same_day: item.commodity_goods_info.is_same_day,
|
||||||
receiving_name: ztAddress.name || '',
|
receiving_name: ztAddress.name || '',
|
||||||
receiving_phone: ztAddress.phone || '',
|
receiving_phone: ztAddress.phone || '',
|
||||||
receiving_address: ztAddress.address || '',
|
receiving_address: ztAddress.address || '',
|
||||||
group_buy_activity_id: firstItem.commodity_goods_info.group_buy_activity_id,
|
group_buy_activity_id: item.commodity_goods_info.group_buy_activity_id,
|
||||||
goods_and_count: group.map(item => {
|
goods_and_count: [{
|
||||||
const startTime = new Date(item.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
goods_id: item.commodity_goods_info.goods_id,
|
||||||
const endTime = new Date(item.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
count: item.count,
|
||||||
const isGroupBuy = currentTime >= startTime && currentTime <= endTime;
|
price: item.commodity_goods_info.group_buy_price
|
||||||
return {
|
}]
|
||||||
goods_id: item.commodity_goods_info.goods_id,
|
|
||||||
count: item.count,
|
|
||||||
price: isGroupBuy ? item.commodity_goods_info.group_buy_price : item.commodity_goods_info.sales_price,
|
|
||||||
freight: item.commodity_goods_info.freight,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -493,7 +493,7 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.shopMoney = total.toFixed(2);
|
this.shopMoney = total;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 减少数量
|
// 减少数量
|
||||||
@ -717,11 +717,6 @@ export default {
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getShopCar();
|
this.getShopCar();
|
||||||
// 取消所有选中状态并重置金额
|
|
||||||
this.isAllchecked = false;
|
|
||||||
this.isDaychecked = false;
|
|
||||||
this.isParcelPostchecked = false;
|
|
||||||
this.shopMoney = 0.00;
|
|
||||||
},
|
},
|
||||||
onReachBottom() { },
|
onReachBottom() { },
|
||||||
|
|
||||||
|
|||||||
@ -34,10 +34,10 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const item = JSON.parse(options.item)
|
const item = JSON.parse(options.item)
|
||||||
this.getLocationList(item.goods_id, item.supplier_id)
|
this.getLocationList(item.goods_id)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getLocationList(id, supplier_id) {
|
async getLocationList(id) {
|
||||||
const params = {
|
const params = {
|
||||||
goods_ids: id,
|
goods_ids: id,
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ export default {
|
|||||||
res.self_pickup_address_list[0].address.forEach(item => {
|
res.self_pickup_address_list[0].address.forEach(item => {
|
||||||
const [address, phone, name] = item.split(' ');
|
const [address, phone, name] = item.split(' ');
|
||||||
this.locationList.push({
|
this.locationList.push({
|
||||||
id: supplier_id,
|
id: id,
|
||||||
name: name || '',
|
name: name || '',
|
||||||
phone: phone || '',
|
phone: phone || '',
|
||||||
address: address || ''
|
address: address || ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user