|
|
|
@ -392,16 +392,6 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<uni-popup ref="deliveryClosedPopup" type="center" background-color="transparent" @change="onDeliveryClosedPopupChange"> |
|
|
|
<view class="delivery-closed-popup" @tap.stop> |
|
|
|
<view class="delivery-closed-icon"> |
|
|
|
<uni-icons type="info-filled" size="28" color="#0b9b73"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="delivery-closed-title">当前区域暂未开启配送</view> |
|
|
|
<view class="delivery-closed-desc">本店目前只能选择到店消费,关闭提示后会为你自动切换到到店标签。</view> |
|
|
|
<view class="delivery-closed-btn" @tap="closeDeliveryClosedPopup">知道了</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<!-- 警告弹出层 --> |
|
|
|
<uni-popup ref="warnPopup" background-color="#fff"> |
|
|
|
<view class="warnImg"> |
|
|
|
@ -572,6 +562,9 @@ |
|
|
|
<view class="free-order-subtitle">未支付免单资格会传递给下一个小伙伴</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="page-toast" v-if="pageToastText"> |
|
|
|
<view class="page-toast-inner">{{pageToastText}}</view> |
|
|
|
</view> |
|
|
|
<common-loading /> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
@ -581,6 +574,7 @@ |
|
|
|
import addressList from '@/package1/address/addressList.vue' |
|
|
|
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js' |
|
|
|
import { buildGroupHomeSharePath } from '@/utils/sharePath.js' |
|
|
|
const NOW_MAKE_GUIDE_CACHE_KEY = 'buyFoodNowMakeGuideShown' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -595,6 +589,9 @@ |
|
|
|
peisongyuan: '' |
|
|
|
}, |
|
|
|
nowMake:true, |
|
|
|
nowMakeGuideShownInPage: false, |
|
|
|
pageToastText: '', |
|
|
|
pageToastTimer: null, |
|
|
|
content: [], |
|
|
|
remark:'', |
|
|
|
remarkInputValue: '', |
|
|
|
@ -631,7 +628,6 @@ |
|
|
|
deliveryEnabled: 1, |
|
|
|
deliverySwitchChecked: false, |
|
|
|
deliverySwitchLoading: false, |
|
|
|
deliveryClosedPopupVisible: false, |
|
|
|
areaKind: 1 |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -677,6 +673,9 @@ |
|
|
|
this.nowMake = false; |
|
|
|
this.isPack = 0; |
|
|
|
} |
|
|
|
if (this.isStoreConsumeOnly) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
} |
|
|
|
if (this.supportShopDelivery) { |
|
|
|
this.selected = 'shopDelivery'; |
|
|
|
} |
|
|
|
@ -705,6 +704,12 @@ |
|
|
|
isStoreGroupOrder() { |
|
|
|
return this.orderScene === 'storeGroup' || (this.groupItem && this.groupItem.orderScene === 'storeGroup') || this.shopItem.merchantType == 2; |
|
|
|
}, |
|
|
|
isStoreConsumeOnly() { |
|
|
|
return this.shopItem && this.shopItem.storeConsumeOnly == 1; |
|
|
|
}, |
|
|
|
shouldShowNowMakeGuide() { |
|
|
|
return Number(this.shopItem.merchantType) === 1 && this.isPaotui == false && !this.isStoreGroupOrder && this.nowMake; |
|
|
|
}, |
|
|
|
highFloorFeeCalc() { |
|
|
|
if (this.selected === 'shopDelivery') return 0; |
|
|
|
if (this.selected === 'zhiding' && this.assignedWorker) { |
|
|
|
@ -836,6 +841,9 @@ |
|
|
|
this.syncAreaKind(); |
|
|
|
this.isNavigatingToWorkerList = false; |
|
|
|
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() |
|
|
|
if (this.isStoreConsumeOnly) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
} |
|
|
|
const keepAddressBookOpen = uni.getStorageSync('keepAddressBookOpen') === '1'; |
|
|
|
const needsAddressListRefresh = uni.getStorageSync('addressListNeedsRefresh') === '1'; |
|
|
|
if (keepAddressBookOpen) { |
|
|
|
@ -899,11 +907,27 @@ |
|
|
|
onUnload() { |
|
|
|
uni.$off('updateDeliveryWorker'); |
|
|
|
uni.removeStorageSync('pendingAssignWorker'); |
|
|
|
if (this.pageToastTimer) { |
|
|
|
clearTimeout(this.pageToastTimer); |
|
|
|
this.pageToastTimer = null; |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
nowMakeMethod(){ |
|
|
|
this.nowMake = !this.nowMake |
|
|
|
}, |
|
|
|
maybeShowNowMakeGuide() { |
|
|
|
if (this.nowMakeGuideShownInPage || !this.shouldShowNowMakeGuide) return; |
|
|
|
if (uni.getStorageSync(NOW_MAKE_GUIDE_CACHE_KEY) === '1') return; |
|
|
|
this.nowMakeGuideShownInPage = true; |
|
|
|
uni.setStorageSync(NOW_MAKE_GUIDE_CACHE_KEY, '1'); |
|
|
|
uni.showModal({ |
|
|
|
title: '温馨提示', |
|
|
|
content: '如不需要商家立即出餐,可取消勾选“立即出餐”。', |
|
|
|
showCancel: false, |
|
|
|
confirmText: '知道了' |
|
|
|
}); |
|
|
|
}, |
|
|
|
checkPack(type) { |
|
|
|
if (this.isPack === type) return; |
|
|
|
this.isPack = type; |
|
|
|
@ -1060,10 +1084,41 @@ |
|
|
|
isDeliveryClosed() { |
|
|
|
return this.shouldCheckDeliverySwitch() && Number(this.deliveryEnabled) === 0; |
|
|
|
}, |
|
|
|
isDeliveryUnavailable() { |
|
|
|
return this.shouldCheckDeliverySwitch() && (this.isStoreConsumeOnly || this.isDeliveryClosed()); |
|
|
|
}, |
|
|
|
showPageToast(text, duration = 1500) { |
|
|
|
if (!text) return; |
|
|
|
this.pageToastText = text; |
|
|
|
if (this.pageToastTimer) { |
|
|
|
clearTimeout(this.pageToastTimer); |
|
|
|
} |
|
|
|
this.pageToastTimer = setTimeout(() => { |
|
|
|
this.pageToastText = ''; |
|
|
|
this.pageToastTimer = null; |
|
|
|
}, duration); |
|
|
|
}, |
|
|
|
showDeliveryUnavailableTip() { |
|
|
|
if (this.isDeliveryClosed()) { |
|
|
|
this.showPageToast('当前区域关闭了外卖配送', 1500); |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (this.isStoreConsumeOnly) { |
|
|
|
this.showPageToast('当前商家暂不支持外卖配送', 1500); |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
}, |
|
|
|
fetchDeliverySwitch() { |
|
|
|
if (!this.shouldCheckDeliverySwitch()) return Promise.resolve(true); |
|
|
|
const regionId = this.getCurrentRegionId(); |
|
|
|
if (!regionId) return Promise.resolve(true); |
|
|
|
if (!regionId) { |
|
|
|
if (this.isStoreConsumeOnly) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
return Promise.resolve(false); |
|
|
|
} |
|
|
|
return Promise.resolve(true); |
|
|
|
} |
|
|
|
this.deliverySwitchLoading = true; |
|
|
|
return this.tui.request('/app/shopArea/deliverySwitch/get', 'GET', { |
|
|
|
regionId: regionId |
|
|
|
@ -1072,36 +1127,53 @@ |
|
|
|
if (res.code == 200 || res.success) { |
|
|
|
this.deliveryEnabled = res.result == null ? 1 : Number(res.result); |
|
|
|
this.deliverySwitchChecked = true; |
|
|
|
if (this.isDeliveryClosed() && this.isPaotui && !this.deliveryClosedPopupVisible) { |
|
|
|
this.openDeliveryClosedPopup(); |
|
|
|
if (this.isDeliveryUnavailable() && this.isPaotui) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return !this.isDeliveryClosed(); |
|
|
|
return !this.isDeliveryUnavailable(); |
|
|
|
}).catch(() => { |
|
|
|
this.deliverySwitchLoading = false; |
|
|
|
if (this.isStoreConsumeOnly) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}); |
|
|
|
}, |
|
|
|
async ensureDeliveryAvailable() { |
|
|
|
if (!this.shouldCheckDeliverySwitch() || !this.isPaotui) return true; |
|
|
|
if (this.isDeliveryUnavailable()) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (!this.deliverySwitchChecked) { |
|
|
|
const available = await this.fetchDeliverySwitch(); |
|
|
|
if (!available) return false; |
|
|
|
} |
|
|
|
if (this.isDeliveryClosed()) { |
|
|
|
this.openDeliveryClosedPopup(); |
|
|
|
if (this.isDeliveryUnavailable()) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}, |
|
|
|
selectOrderMode(isDelivery) { |
|
|
|
async selectOrderMode(isDelivery) { |
|
|
|
if (!isDelivery) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.isDeliveryClosed()) { |
|
|
|
this.openDeliveryClosedPopup(); |
|
|
|
if (!this.deliverySwitchChecked && this.shouldCheckDeliverySwitch()) { |
|
|
|
const available = await this.fetchDeliverySwitch(); |
|
|
|
if (!available) { |
|
|
|
this.showDeliveryUnavailableTip(); |
|
|
|
this.switchToStoreMode(); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.isDeliveryUnavailable()) { |
|
|
|
this.showDeliveryUnavailableTip(); |
|
|
|
this.switchToStoreMode(); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.isPaotui = true; |
|
|
|
@ -1109,27 +1181,10 @@ |
|
|
|
}, |
|
|
|
switchToStoreMode() { |
|
|
|
this.isPaotui = false; |
|
|
|
this.fetchCoupons(); |
|
|
|
}, |
|
|
|
openDeliveryClosedPopup() { |
|
|
|
this.deliveryClosedPopupVisible = true; |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.deliveryClosedPopup) { |
|
|
|
this.$refs.deliveryClosedPopup.open('center'); |
|
|
|
} |
|
|
|
this.maybeShowNowMakeGuide(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
closeDeliveryClosedPopup() { |
|
|
|
this.switchToStoreMode(); |
|
|
|
if (this.$refs.deliveryClosedPopup) { |
|
|
|
this.$refs.deliveryClosedPopup.close(); |
|
|
|
} |
|
|
|
}, |
|
|
|
onDeliveryClosedPopupChange(e) { |
|
|
|
this.deliveryClosedPopupVisible = e.show; |
|
|
|
if (!e.show && this.isDeliveryClosed()) { |
|
|
|
this.switchToStoreMode(); |
|
|
|
} |
|
|
|
this.fetchCoupons(true); |
|
|
|
}, |
|
|
|
onPayPopupChange(e) { |
|
|
|
this.payPopupVisible = e.show; |
|
|
|
@ -1390,7 +1445,7 @@ |
|
|
|
this.fetchCoupons(); |
|
|
|
this.$refs.couponPopup.open('bottom'); |
|
|
|
}, |
|
|
|
fetchCoupons() { |
|
|
|
fetchCoupons(hideLoading) { |
|
|
|
let userId = uni.getStorageSync('id'); |
|
|
|
if (!userId) return; |
|
|
|
let amount = this.preDiscountTotal; |
|
|
|
@ -1400,7 +1455,7 @@ |
|
|
|
applyScene: this.isStoreGroupOrder ? 4 : 1, |
|
|
|
amount: amount, |
|
|
|
merchantId: this.shopItem.id || this.shopItem.shopId || '0' |
|
|
|
}, false, true).then((res) => { |
|
|
|
}, false, true, hideLoading).then((res) => { |
|
|
|
if (res.code == 200 && res.result) { |
|
|
|
this.availableCoupons = res.result; |
|
|
|
if (this.selectedCoupon) { |
|
|
|
@ -1846,6 +1901,31 @@ |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
|
|
|
|
.page-toast { |
|
|
|
position: fixed; |
|
|
|
left: 0; |
|
|
|
top: 0; |
|
|
|
right: 0; |
|
|
|
bottom: 0; |
|
|
|
z-index: 100000; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
pointer-events: none; |
|
|
|
} |
|
|
|
|
|
|
|
.page-toast-inner { |
|
|
|
max-width: 520rpx; |
|
|
|
padding: 24rpx 36rpx; |
|
|
|
border-radius: 16rpx; |
|
|
|
background: rgba(0, 0, 0, 0.72); |
|
|
|
color: #fff; |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 700; |
|
|
|
line-height: 40rpx; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
|
|
|
|
.checkout-fixed-header { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
|
@ -2620,53 +2700,6 @@ |
|
|
|
box-shadow: 0 12rpx 26rpx rgba(11, 155, 115, 0.2); |
|
|
|
} |
|
|
|
|
|
|
|
.delivery-closed-popup { |
|
|
|
width: 620rpx; |
|
|
|
padding: 48rpx 38rpx 36rpx; |
|
|
|
background: linear-gradient(180deg, #ffffff 0%, #f2fff9 100%); |
|
|
|
border-radius: 34rpx; |
|
|
|
box-sizing: border-box; |
|
|
|
text-align: center; |
|
|
|
box-shadow: 0 24rpx 70rpx rgba(0, 35, 28, 0.18); |
|
|
|
} |
|
|
|
|
|
|
|
.delivery-closed-icon { |
|
|
|
width: 92rpx; |
|
|
|
height: 92rpx; |
|
|
|
margin: 0 auto 24rpx; |
|
|
|
border-radius: 50%; |
|
|
|
background: rgba(11, 155, 115, 0.12); |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
|
|
|
|
.delivery-closed-title { |
|
|
|
color: $primary; |
|
|
|
font-size: 34rpx; |
|
|
|
font-weight: 700; |
|
|
|
line-height: 1.4; |
|
|
|
} |
|
|
|
|
|
|
|
.delivery-closed-desc { |
|
|
|
margin-top: 18rpx; |
|
|
|
color: $muted; |
|
|
|
font-size: 26rpx; |
|
|
|
line-height: 42rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.delivery-closed-btn { |
|
|
|
margin-top: 38rpx; |
|
|
|
height: 80rpx; |
|
|
|
line-height: 80rpx; |
|
|
|
border-radius: 999rpx; |
|
|
|
color: #fff; |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 700; |
|
|
|
background: linear-gradient(135deg, #0b9b73, #20d6a4); |
|
|
|
box-shadow: 0 12rpx 26rpx rgba(11, 155, 115, 0.2); |
|
|
|
} |
|
|
|
|
|
|
|
.coupon-row { |
|
|
|
border-top: 1rpx solid #f0f3f2; |
|
|
|
font-size: 28rpx; |
|
|
|
|