【功能优化】订单确认页,增加按照顺序自动选择物流方式,替代原有只选择“快递配送”的方式

pull/124/head^2
YunaiV 2024-10-13 21:30:14 +08:00
parent 4dd6e82309
commit 789ec69933
4 changed files with 38 additions and 7 deletions

View File

@ -29,9 +29,9 @@
</view>
<view class="flex flex-wrap">
<text class="default font-color" v-if="state.addressInfo.defaultStatus">[]</text>
<text class="line2"
>{{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}</text
>
<text class="line2">
{{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}
</text>
</view>
</view>
<view class="addressCon" v-else>
@ -44,7 +44,11 @@
</view>
</view>
<!-- 情况二门店的选择 -->
<view class="address flex flex-wrap flex-center ss-row-between" v-else @tap="onSelectAddress">
<view
class="address flex flex-wrap flex-center ss-row-between"
v-if="state.deliveryType === 2"
@tap="onSelectAddress"
>
<view class="addressCon" v-if="state.pickUpInfo.name">
<view class="name"
>{{ state.pickUpInfo.name }}

View File

@ -244,7 +244,7 @@
const addressState = ref({
addressInfo: {}, //
deliveryType: 1, // 1-2-
deliveryType: undefined, // 1-2-
isPickUp: true, //
pickUpInfo: {}, //
receiverName: '', //
@ -349,7 +349,7 @@
pointActivityId: state.orderPayload.pointActivityId,
});
if (code !== 0) {
return;
return code;
}
state.orderInfo = data;
state.couponInfo = data.coupons || [];
@ -357,20 +357,41 @@
if (state.orderInfo.address) {
addressState.value.addressInfo = state.orderInfo.address;
}
return code;
}
onLoad(async (options) => {
//
if (!options.data) {
sheep.$helper.toast('参数不正确,请检查!');
return;
}
state.orderPayload = JSON.parse(options.data);
await getOrderInfo();
//
const { data, code } = await TradeConfigApi.getTradeConfig();
if (code === 0) {
addressState.value.isPickUp = data.deliveryPickUpEnabled;
}
//
//
addressState.value.deliveryType = 1;
let orderCode = await getOrderInfo();
if (orderCode === 0) {
return;
}
//
if (addressState.value.isPickUp) {
addressState.value.deliveryType = 2;
let orderCode = await getOrderInfo();
if (orderCode === 0) {
return;
}
}
//
addressState.value.deliveryType = undefined;
await getOrderInfo();
});
// 使 watch

View File

@ -6,6 +6,9 @@ const TradeConfigApi = {
return request({
url: `/trade/config/get`,
method: 'GET',
custom: {
showLoading: false,
},
});
},
};

View File

@ -35,6 +35,9 @@ const OrderApi = {
if (!(data.pointActivityId > 0)) {
delete data2.pointActivityId;
}
if (!(data.deliveryType > 0)) {
delete data2.deliveryType;
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items;
for (let i = 0; i < data.items.length; i++) {