diff --git a/pages/order/addressSelection.vue b/pages/order/addressSelection.vue
index d54c68d3..d4789ea0 100644
--- a/pages/order/addressSelection.vue
+++ b/pages/order/addressSelection.vue
@@ -29,9 +29,9 @@
[默认]
- {{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}
+
+ {{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}
+
@@ -44,7 +44,11 @@
-
+
{{ state.pickUpInfo.name }}
diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue
index 426df6d9..5e8e2ba4 100644
--- a/pages/order/confirm.vue
+++ b/pages/order/confirm.vue
@@ -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 监听地址和配送方式的变化
diff --git a/sheep/api/trade/config.js b/sheep/api/trade/config.js
index 16806ed8..d49235e4 100644
--- a/sheep/api/trade/config.js
+++ b/sheep/api/trade/config.js
@@ -6,6 +6,9 @@ const TradeConfigApi = {
return request({
url: `/trade/config/get`,
method: 'GET',
+ custom: {
+ showLoading: false,
+ },
});
},
};
diff --git a/sheep/api/trade/order.js b/sheep/api/trade/order.js
index 4091c0dc..10cb6352 100644
--- a/sheep/api/trade/order.js
+++ b/sheep/api/trade/order.js
@@ -35,6 +35,9 @@ const OrderApi = {
if (!(data.pointActivityId > 0)) {
delete data2.pointActivityId;
}
+ if (!(data.deliveryType > 0)) {
+ delete data2.deliveryType;
+ }
// 解决 SpringMVC 接受 List- 参数的问题
delete data2.items;
for (let i = 0; i < data.items.length; i++) {