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

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>
<view class="flex flex-wrap"> <view class="flex flex-wrap">
<text class="default font-color" v-if="state.addressInfo.defaultStatus">[]</text> <text class="default font-color" v-if="state.addressInfo.defaultStatus">[]</text>
<text class="line2" <text class="line2">
>{{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}</text {{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}
> </text>
</view> </view>
</view> </view>
<view class="addressCon" v-else> <view class="addressCon" v-else>
@ -44,7 +44,11 @@
</view> </view>
</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="addressCon" v-if="state.pickUpInfo.name">
<view class="name" <view class="name"
>{{ state.pickUpInfo.name }} >{{ state.pickUpInfo.name }}

View File

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

View File

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

View File

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