|
|
|
@ -107,6 +107,42 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="delivery-card social-destination-card" v-if="useSocialDeliveryChoice"> |
|
|
|
<view class="delivery-head"> |
|
|
|
<view class="delivery-title"> |
|
|
|
配送方式 |
|
|
|
</view> |
|
|
|
<view class="delivery-desc"> |
|
|
|
送到宿舍由中转配送完成,送到大门由商家自配送完成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="delivery-options"> |
|
|
|
<view class="delivery-option" @tap="checkSocialDeliveryDestination('dorm')"> |
|
|
|
<view class="delivery-choice"> |
|
|
|
<view class="radio-check" v-if="socialDeliveryDestination === 'dorm'"> |
|
|
|
<uni-icons type="checkmarkempty" size="12"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="radio-no-check" v-else></view> |
|
|
|
送到宿舍 |
|
|
|
</view> |
|
|
|
<view class="worker-entry" @tap.stop> |
|
|
|
{{socialDormDeliveryText}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="delivery-option" @tap="checkSocialDeliveryDestination('gate')"> |
|
|
|
<view class="delivery-choice"> |
|
|
|
<view class="radio-check" v-if="socialDeliveryDestination === 'gate'"> |
|
|
|
<uni-icons type="checkmarkempty" size="12"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="radio-no-check" v-else></view> |
|
|
|
送到大门 |
|
|
|
</view> |
|
|
|
<view class="worker-entry" @tap.stop> |
|
|
|
{{socialGateDeliveryText}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="delivery-card" v-if="isPaotui && !isSocialArea"> |
|
|
|
<view class="delivery-head"> |
|
|
|
<view class="delivery-title"> |
|
|
|
@ -599,6 +635,7 @@ |
|
|
|
import addressList from '@/package1/address/addressList.vue' |
|
|
|
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js' |
|
|
|
import { buildGroupHomeSharePath } from '@/utils/sharePath.js' |
|
|
|
const TARGET_SOCIAL_DELIVERY_REGION_ID = '2110300467664916480' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -651,7 +688,8 @@ |
|
|
|
deliveryEnabled: 1, |
|
|
|
deliverySwitchChecked: false, |
|
|
|
deliverySwitchLoading: false, |
|
|
|
areaKind: 1 |
|
|
|
areaKind: 1, |
|
|
|
socialDeliveryDestination: 'dorm' |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
@ -709,6 +747,12 @@ |
|
|
|
isSocialArea() { |
|
|
|
return Number(this.areaKind) === 2; |
|
|
|
}, |
|
|
|
isTargetSocialDeliveryRegion() { |
|
|
|
return String(this.getCurrentRegionId()) === TARGET_SOCIAL_DELIVERY_REGION_ID && this.isSocialArea; |
|
|
|
}, |
|
|
|
useSocialDeliveryChoice() { |
|
|
|
return this.isPaotui && this.isTargetSocialDeliveryRegion && !this.isStoreGroupOrder; |
|
|
|
}, |
|
|
|
goodsAmountCalc() { |
|
|
|
if (this.isGroupBuy && this.groupItem) { |
|
|
|
if(this.groupItem.item.moreBuyData){ |
|
|
|
@ -765,7 +809,11 @@ |
|
|
|
if (isJoiningFaceToFace) |
|
|
|
return 0; // Front-end doesn't know exact fee, relies on backend after order creation |
|
|
|
let commission = 0; |
|
|
|
if (this.selected === 'shopDelivery') { |
|
|
|
if (this.useSocialDeliveryChoice) { |
|
|
|
commission = this.socialDeliveryDestination === 'gate' |
|
|
|
? parseFloat(this.shopItem.orderBkge || 0) |
|
|
|
: this.getMinimumCommissionAmount(); |
|
|
|
} else if (this.selected === 'shopDelivery') { |
|
|
|
commission = parseFloat(this.shopItem.orderBkge || 0); |
|
|
|
} else if (this.selected === 'zhiding') { |
|
|
|
if (!this.assignedWorker) return 0; |
|
|
|
@ -810,6 +858,10 @@ |
|
|
|
const transferTime = this.shopItem.supportTransferDelivery == 1 && !isNaN(transferDuration) && transferDuration > 0 ? transferDuration : 0; |
|
|
|
const cookingTime = Number(this.shopItem.shopTakeaway && this.shopItem.shopTakeaway.cookingTime ? this.shopItem.shopTakeaway.cookingTime : 0); |
|
|
|
const validCookingTime = isNaN(cookingTime) || cookingTime < 0 ? 0 : cookingTime; |
|
|
|
if (this.useSocialDeliveryChoice && this.socialDeliveryDestination === 'gate') { |
|
|
|
const selfDeliveryDuration = Number(this.shopItem.shopDeliveryDuration); |
|
|
|
return isNaN(selfDeliveryDuration) || selfDeliveryDuration <= 0 ? validCookingTime + 30 : validCookingTime + selfDeliveryDuration; |
|
|
|
} |
|
|
|
if (this.selected === 'shopDelivery') { |
|
|
|
const selfDeliveryDuration = Number(this.shopItem.shopDeliveryDuration); |
|
|
|
const baseTime = isNaN(selfDeliveryDuration) || selfDeliveryDuration <= 0 ? validCookingTime + 30 : validCookingTime + selfDeliveryDuration; |
|
|
|
@ -834,6 +886,18 @@ |
|
|
|
const workerText = this.shopItem.workerName ? ` ${this.shopItem.workerName}` : ''; |
|
|
|
return `${feeText} ${locationText}${workerText}`; |
|
|
|
}, |
|
|
|
socialDormDeliveryText() { |
|
|
|
const fee = this.getMinimumCommissionAmount(); |
|
|
|
const feeText = fee > 0 ? `¥${this.formatAmountText(fee)}` : '免配送费'; |
|
|
|
const transferName = this.shopItem.transferAddressName ? ` ${this.shopItem.transferAddressName}` : ''; |
|
|
|
return `${feeText} 中转配送${transferName}`; |
|
|
|
}, |
|
|
|
socialGateDeliveryText() { |
|
|
|
const fee = parseFloat(this.shopItem.orderBkge || 0); |
|
|
|
const feeText = fee > 0 ? `¥${this.formatAmountText(fee)}` : '免配送费'; |
|
|
|
const workerText = this.shopItem.workerName ? ` ${this.shopItem.workerName}` : ''; |
|
|
|
return `${feeText} 商家自配送${workerText}`; |
|
|
|
}, |
|
|
|
minimumCommissionText() { |
|
|
|
return this.formatAmountText(this.getMinimumCommissionAmount()); |
|
|
|
}, |
|
|
|
@ -1057,6 +1121,16 @@ |
|
|
|
applySocialDeliveryDefaults() { |
|
|
|
if (!this.isSocialArea || !this.isPaotui) return; |
|
|
|
this.assignedWorker = null; |
|
|
|
if (this.useSocialDeliveryChoice) { |
|
|
|
if (this.socialDeliveryDestination === 'gate') { |
|
|
|
this.selected = 'shopDelivery'; |
|
|
|
} else { |
|
|
|
this.selected = 'buzhiding'; |
|
|
|
const minFee = this.getMinimumCommissionAmount(); |
|
|
|
this.customCommission = this.formatCommissionValue(minFee); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
// 商家自配送:沿用商家配送费,不改成不指定 |
|
|
|
if (this.supportShopDelivery) { |
|
|
|
this.selected = 'shopDelivery'; |
|
|
|
@ -1198,6 +1272,7 @@ |
|
|
|
return; |
|
|
|
} |
|
|
|
this.isPaotui = true; |
|
|
|
this.applySocialDeliveryDefaults(); |
|
|
|
this.fetchCoupons(); |
|
|
|
}, |
|
|
|
switchToStoreMode() { |
|
|
|
@ -1411,6 +1486,17 @@ |
|
|
|
this.applySocialDeliveryDefaults(); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.useSocialDeliveryChoice && !isJoiningFaceToFace) { |
|
|
|
if (this.socialDeliveryDestination === 'dorm' && this.shopItem.supportTransferDelivery != 1) { |
|
|
|
this.tui.toast('中转配送配置不完整,请联系商家'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.socialDeliveryDestination === 'gate' && !this.supportShopDelivery) { |
|
|
|
this.tui.toast('商家自配送配置不完整,请联系商家'); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.isPaotui && this.selected === 'buzhiding' && !isJoiningFaceToFace) { |
|
|
|
let comm = parseFloat(this.customCommission); |
|
|
|
//没有输入佣金,直接弹出输入框 |
|
|
|
@ -1523,6 +1609,14 @@ |
|
|
|
} |
|
|
|
this.refreshDeliveryTimeByModeChange(); |
|
|
|
}, |
|
|
|
checkSocialDeliveryDestination(type) { |
|
|
|
if (type === this.socialDeliveryDestination) return; |
|
|
|
this.socialDeliveryDestination = type; |
|
|
|
this.assignedWorker = null; |
|
|
|
this.applySocialDeliveryDefaults(); |
|
|
|
this.refreshDeliveryTimeByModeChange(); |
|
|
|
this.fetchCoupons(); |
|
|
|
}, |
|
|
|
wxPayment() { |
|
|
|
let that = this; |
|
|
|
if (!this.currentOrderId || !this.backendTotalAmount) { |
|
|
|
@ -1688,6 +1782,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let currentRegionId = this.getCurrentRegionId(); |
|
|
|
let deliveryType = this.isStoreGroupOrder ? 2 : (this.isPaotui ? 1 : 2); |
|
|
|
let payload = { |
|
|
|
userId: uni.getStorageSync('id'), |
|
|
|
@ -1715,7 +1810,13 @@ |
|
|
|
payload.addressId = this.formData.address ? this.formData.address.id : null; |
|
|
|
payload.getAreaId = this.shopItem.shopArea || null; |
|
|
|
payload.putAreaId = this.formData.address ? (this.isSocialArea ? this.formData.address.id : this.formData.address.areaId) : null; |
|
|
|
if (this.shopItem.supportTransferDelivery == 1) { |
|
|
|
if (this.useSocialDeliveryChoice) { |
|
|
|
payload.transferDelivery = this.socialDeliveryDestination === 'dorm' ? 1 : 0; |
|
|
|
if (payload.transferDelivery == 1) { |
|
|
|
payload.transferAddressId = this.shopItem.transferAddressId; |
|
|
|
payload.transferAddressName = this.shopItem.transferAddressName; |
|
|
|
} |
|
|
|
} else if (this.shopItem.supportTransferDelivery == 1) { |
|
|
|
payload.transferDelivery = 1; |
|
|
|
payload.transferAddressId = this.shopItem.transferAddressId; |
|
|
|
payload.transferAddressName = this.shopItem.transferAddressName; |
|
|
|
@ -1730,18 +1831,41 @@ |
|
|
|
if (this.groupItem.groupId) { |
|
|
|
payload.groupId = this.groupItem.groupId; |
|
|
|
} else { |
|
|
|
let selfCommission = null; |
|
|
|
if (this.useSocialDeliveryChoice) { |
|
|
|
selfCommission = this.socialDeliveryDestination === 'gate' |
|
|
|
? parseFloat(this.shopItem.orderBkge || 0) |
|
|
|
: this.getMinimumCommissionAmount(); |
|
|
|
} else { |
|
|
|
selfCommission = this.selected === 'shopDelivery' ? parseFloat(this.shopItem.orderBkge || 0) : (this.selected === 'buzhiding' ? parseFloat(this.customCommission || 0) : null); |
|
|
|
} |
|
|
|
payload.groupParam = { |
|
|
|
targetMembers: parseInt(this.groupItem.groupRule.groupCount), |
|
|
|
isFaceToFace: this.groupItem.isFaceToFace ? 1 : 0, |
|
|
|
selfCommission: this.selected === 'shopDelivery' ? parseFloat(this.shopItem.orderBkge || 0) : (this.selected === 'buzhiding' ? parseFloat(this.customCommission || 0) : |
|
|
|
null |
|
|
|
) |
|
|
|
selfCommission: selfCommission |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.isPaotui && !isJoiningFaceToFace) { |
|
|
|
if (this.selected === 'shopDelivery') { |
|
|
|
if (this.useSocialDeliveryChoice) { |
|
|
|
if (this.socialDeliveryDestination === 'gate') { |
|
|
|
payload.shopDelivery = 1; |
|
|
|
payload.transferDelivery = 0; |
|
|
|
payload.workerParam = { |
|
|
|
workerId: this.shopItem.workerId, |
|
|
|
workerPhone: this.shopItem.workerPhone, |
|
|
|
workerName: this.shopItem.workerName, |
|
|
|
orderBkge: parseFloat(this.shopItem.orderBkge || 0) |
|
|
|
}; |
|
|
|
} else { |
|
|
|
payload.shopDelivery = 0; |
|
|
|
payload.transferDelivery = 1; |
|
|
|
payload.workerParam = { |
|
|
|
orderBkge: this.getMinimumCommissionAmount() |
|
|
|
}; |
|
|
|
} |
|
|
|
} else if (this.selected === 'shopDelivery') { |
|
|
|
payload.shopDelivery = 1; |
|
|
|
payload.workerParam = { |
|
|
|
workerId: this.shopItem.workerId, |
|
|
|
@ -1777,7 +1901,7 @@ |
|
|
|
if(this.isSeckillOrder){ |
|
|
|
payload.seckillOrder = 1 |
|
|
|
} |
|
|
|
payload.regionId = this.getCurrentRegionId() |
|
|
|
payload.regionId = currentRegionId |
|
|
|
this.tui.request("/mall/order/create", "POST", payload, false, false).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
this.isCreatingOrder = false; |
|
|
|
|