|
@@ -306,11 +306,11 @@
|
|
|
|
|
|
// 提交订单
|
|
// 提交订单
|
|
function onConfirm() {
|
|
function onConfirm() {
|
|
- if (addressState.value.deliveryType === 1 && !addressState.value.addressInfo.id) {
|
|
|
|
|
|
+ if (spuType.value === '0' && addressState.value.deliveryType === 1 && !addressState.value.addressInfo.id) {
|
|
sheep.$helper.toast('请选择收货地址');
|
|
sheep.$helper.toast('请选择收货地址');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (addressState.value.deliveryType === 2) {
|
|
|
|
|
|
+ if (spuType.value === '0' && addressState.value.deliveryType === 2) {
|
|
if (!addressState.value.pickUpInfo.id) {
|
|
if (!addressState.value.pickUpInfo.id) {
|
|
sheep.$helper.toast('请选择自提门店地址');
|
|
sheep.$helper.toast('请选择自提门店地址');
|
|
return;
|
|
return;
|
|
@@ -328,9 +328,8 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- console.log(state.orderPayload, 'submit-order-pay', state);
|
|
|
|
|
|
|
|
- if (spuType.value !== '0' && !state.orderPayload?.email || !test.email(state.orderPayload.email)) {
|
|
|
|
|
|
+ if (spuType.value !== '0' && !state.orderPayload?.email && !test.email(state.orderPayload.email)) {
|
|
const title = !state.orderPayload.email ? '请填写接收邮箱!' : '邮箱格式不正确!'
|
|
const title = !state.orderPayload.email ? '请填写接收邮箱!' : '邮箱格式不正确!'
|
|
uni.showToast({ title, icon: 'none', duration: 2000 })
|
|
uni.showToast({ title, icon: 'none', duration: 2000 })
|
|
return
|
|
return
|
|
@@ -383,8 +382,8 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- const spuType = ref('')
|
|
|
|
- let salesLotterySpuId = ''
|
|
|
|
|
|
+ const spuType = ref('') // '0': 有物流的商品
|
|
|
|
+ let salesLotterySpuId = '' // 参与抽奖的id
|
|
// 检查库存 & 计算订单价格
|
|
// 检查库存 & 计算订单价格
|
|
async function getOrderInfo() {
|
|
async function getOrderInfo() {
|
|
// 计算价格
|
|
// 计算价格
|
|
@@ -407,7 +406,12 @@
|
|
}
|
|
}
|
|
state.orderInfo = data;
|
|
state.orderInfo = data;
|
|
spuType.value = state.orderInfo?.items?.length && state.orderInfo.items.every(k => k.spuType === '0') ? '0' : ''
|
|
spuType.value = state.orderInfo?.items?.length && state.orderInfo.items.every(k => k.spuType === '0') ? '0' : ''
|
|
- salesLotterySpuId = Boolean(!spuType.value) ? state.orderPayload?.spuId : ''
|
|
|
|
|
|
+
|
|
|
|
+ // 虚拟商品
|
|
|
|
+ if (!spuType.value) {
|
|
|
|
+ salesLotterySpuId = state.orderPayload?.spuId
|
|
|
|
+ addressState.value.deliveryType = undefined
|
|
|
|
+ }
|
|
|
|
|
|
state.couponInfo = data.coupons || [];
|
|
state.couponInfo = data.coupons || [];
|
|
// 设置收货地址
|
|
// 设置收货地址
|