From 16502c504672662abc2f53971b9514bfeb417d19 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Sat, 29 Aug 2026 09:35:11 +0800 Subject: [PATCH] 1 --- package1/buyFood/buyFood.vue | 152 ++++++++++++++++++++++++++++++-- package1/tabbar/fishRelease.vue | 2 +- 2 files changed, 148 insertions(+), 6 deletions(-) diff --git a/package1/buyFood/buyFood.vue b/package1/buyFood/buyFood.vue index 8e4fc99..ecec7d8 100644 --- a/package1/buyFood/buyFood.vue +++ b/package1/buyFood/buyFood.vue @@ -36,7 +36,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -388,6 +388,16 @@ + + + + + + 当前校区暂未开启配送 + 本店目前只能选择到店消费,关闭提示后会为你自动切换到到店标签。 + 知道了 + + @@ -612,7 +622,11 @@ isSeckillOrder: false, payPopupVisible: false, commissionPopupVisible: false, - baseDeliveryFee: 0 + baseDeliveryFee: 0, + deliveryEnabled: 1, + deliverySwitchChecked: false, + deliverySwitchLoading: false, + deliveryClosedPopupVisible: false } }, components: { @@ -803,6 +817,7 @@ } this.updateImmediateTimeStr(); this.fetchBaseDeliveryFee(); + this.fetchDeliverySwitch(); let pendingWorker = uni.getStorageSync('pendingAssignWorker'); if (pendingWorker) { uni.removeStorageSync('pendingAssignWorker'); @@ -941,6 +956,83 @@ } }).catch(() => {}); }, + shouldCheckDeliverySwitch() { + return !this.isStoreGroupOrder; + }, + isDeliveryClosed() { + return this.shouldCheckDeliverySwitch() && Number(this.deliveryEnabled) === 0; + }, + fetchDeliverySwitch() { + if (!this.shouldCheckDeliverySwitch()) return Promise.resolve(true); + const regionId = this.getCurrentRegionId(); + if (!regionId) return Promise.resolve(true); + this.deliverySwitchLoading = true; + return this.tui.request('/app/shopArea/deliverySwitch/get', 'GET', { + regionId: regionId + }, false, true).then((res) => { + this.deliverySwitchLoading = false; + 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(); + return false; + } + } + return !this.isDeliveryClosed(); + }).catch(() => { + this.deliverySwitchLoading = false; + return true; + }); + }, + async ensureDeliveryAvailable() { + if (!this.shouldCheckDeliverySwitch() || !this.isPaotui) return true; + if (!this.deliverySwitchChecked) { + const available = await this.fetchDeliverySwitch(); + if (!available) return false; + } + if (this.isDeliveryClosed()) { + this.openDeliveryClosedPopup(); + return false; + } + return true; + }, + selectOrderMode(isDelivery) { + if (!isDelivery) { + this.switchToStoreMode(); + return; + } + if (this.isDeliveryClosed()) { + this.openDeliveryClosedPopup(); + return; + } + this.isPaotui = true; + this.fetchCoupons(); + }, + switchToStoreMode() { + this.isPaotui = false; + this.fetchCoupons(); + }, + openDeliveryClosedPopup() { + this.deliveryClosedPopupVisible = true; + this.$nextTick(() => { + if (this.$refs.deliveryClosedPopup) { + this.$refs.deliveryClosedPopup.open('center'); + } + }); + }, + closeDeliveryClosedPopup() { + this.switchToStoreMode(); + if (this.$refs.deliveryClosedPopup) { + this.$refs.deliveryClosedPopup.close(); + } + }, + onDeliveryClosedPopupChange(e) { + this.deliveryClosedPopupVisible = e.show; + if (!e.show && this.isDeliveryClosed()) { + this.switchToStoreMode(); + } + }, onPayPopupChange(e) { this.payPopupVisible = e.show; if (!e.show && this.currentOrderId && !this.navigatingFromPayPopup) { @@ -1089,7 +1181,7 @@ } return arr.join(','); }, - submitPay() { + async submitPay() { if (!requireLoginToCurrentPage()) return; if (this.currentOrderId) { uni.redirectTo({ @@ -1100,6 +1192,9 @@ if (this.isCreatingOrder) return; let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem .isFaceToFace; + if (this.isPaotui && !(await this.ensureDeliveryAvailable())) { + return; + } if (this.isPaotui && !this.formData.address && !isJoiningFaceToFace) { this.warnPopup = 'shdz'; this.$refs.warnPopup.open(); @@ -1463,7 +1558,7 @@ if(this.isSeckillOrder){ payload.seckillOrder = 1 } - payload.regionId = JSON.parse(uni.getStorageSync('area')).id + payload.regionId = this.getCurrentRegionId() this.tui.request("/mall/order/create", "POST", payload, false, false).then(res => { uni.hideLoading(); this.isCreatingOrder = false; @@ -2378,6 +2473,53 @@ 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/tabbar/fishRelease.vue b/package1/tabbar/fishRelease.vue index 0bbf195..27575e7 100644 --- a/package1/tabbar/fishRelease.vue +++ b/package1/tabbar/fishRelease.vue @@ -164,7 +164,7 @@ imageAuditMessage: '', auditTitle: '提交中,等待审核', officialAccountPopupVisible: false, - officialAccountQr: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/d23a9043a8c24731831ec4db909fe3b4.jpg', + officialAccountQr: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/ca2d31caab16467eac20b1711fa00a78.jpg', officialAccountResolve: null, editorIns: null, editorToolbarConfig: {