From 111ae98115b2e3ff1a0f3bf8c71ad9eba1795ac7 Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Tue, 29 Sep 2026 19:42:52 +0800
Subject: [PATCH] 1
---
package1/buyFood/buyFood.vue | 209 ++++++++++++++++++-------------
package1/runErrand/runErrand.vue | 25 +++-
2 files changed, 143 insertions(+), 91 deletions(-)
diff --git a/package1/buyFood/buyFood.vue b/package1/buyFood/buyFood.vue
index e325f29..82e3f05 100644
--- a/package1/buyFood/buyFood.vue
+++ b/package1/buyFood/buyFood.vue
@@ -392,16 +392,6 @@
-
-
-
@@ -572,6 +562,9 @@
未支付免单资格会传递给下一个小伙伴
+
+ {{pageToastText}}
+
@@ -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;
diff --git a/package1/runErrand/runErrand.vue b/package1/runErrand/runErrand.vue
index 753e714..6283b98 100644
--- a/package1/runErrand/runErrand.vue
+++ b/package1/runErrand/runErrand.vue
@@ -443,7 +443,8 @@
availableCoupons: [],
selectedCoupon: null,
navigatingFromPayPopup: false,
- baseDeliveryFee: 0
+ baseDeliveryFee: 0,
+ areaKind: 1
}
},
components: {
@@ -481,14 +482,19 @@
},
minimumCommissionText() {
return this.formatAmountText(this.getMinimumCommissionAmount());
+ },
+ isSocialArea() {
+ return Number(this.areaKind) === 2;
}
},
watch: {},
onLoad() {
+ this.syncAreaKind()
this.enableShareMenu()
//this.getShopArea()
},
onShow() {
+ this.syncAreaKind()
this.enableShareMenu()
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
const keepAddressBookOpen = uni.getStorageSync('keepAddressBookOpen') === '1';
@@ -560,6 +566,19 @@
imageUrl: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f7227759d693497a8beab87ff437a875.png'
}
},
+ syncAreaKind(areaObj) {
+ let area = areaObj;
+ if (!area) {
+ try {
+ const cached = uni.getStorageSync('area');
+ area = cached ? (typeof cached === 'string' ? JSON.parse(cached) : cached) : null;
+ } catch (e) {
+ area = null;
+ }
+ }
+ const kind = area ? Number(area.areaKind) : 1;
+ this.areaKind = kind === 2 ? 2 : 1;
+ },
backHome() {
uni.switchTab({
url: '/pages/index/index',
@@ -1127,7 +1146,7 @@
shopAddressStr = (this.formData.pickupAddress.areaName || '') + (this.formData.pickupAddress.floor ? this.formData.pickupAddress.floor + '层' : '') + (this.formData.pickupAddress.roomNum || '');
shopName = this.formData.pickupAddress.receiverName || '个人寄件';
shopPhone = this.formData.pickupAddress.receiverPhone || '';
- getAreaId = this.formData.pickupAddress.areaId;
+ getAreaId = this.isSocialArea ? this.formData.pickupAddress.id : this.formData.pickupAddress.areaId;
}
let codes = this.addFormData.codeList.map(c => c.code).filter(c => c).join(',');
@@ -1135,7 +1154,7 @@
let payload = {
getAreaId: getAreaId,
- putAreaId: this.formData.address.areaId,
+ putAreaId: this.isSocialArea ? this.formData.address.id : this.formData.address.areaId,
deliveryType: deliveryType,
receiverName: this.formData.address.receiverName,
receiverPhone: this.formData.address.receiverPhone,