From fe18ba4a270b39f9d5ee149ed12e75bfab4a332e Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Wed, 24 Jun 2026 17:53:43 +0800 Subject: [PATCH] 1 --- components/tab-bar/delivery.vue | 220 +++++++++++++++++++++++++++----- 1 file changed, 188 insertions(+), 32 deletions(-) diff --git a/components/tab-bar/delivery.vue b/components/tab-bar/delivery.vue index 478afa9..6def9e8 100644 --- a/components/tab-bar/delivery.vue +++ b/components/tab-bar/delivery.vue @@ -245,11 +245,12 @@ - 已送达 + {{completingDeliveryIds[item.id] ? '提交中...' : '已送达'}} @@ -258,7 +259,7 @@ - + 选择参与自动派单的接单范围 @@ -380,6 +381,23 @@ + + + 输入取餐码 + 请输入4位取餐码 + + + 取消 + + {{pickupCodeSubmitting ? '提交中...' : '确认'}} + + + + + @@ -469,6 +487,11 @@ refreshLoading: false, refreshLoadingStartTime: 0, refreshLoadingTimer: null, + pickupCode: '', + pickupCodeContext: null, + pickupCodeSubmitting: false, + pickupCodeInputFocus: false, + completingDeliveryIds: {}, lineStatus: [{ title: '上线', value: 0 @@ -732,6 +755,7 @@ that.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false that.$forceUpdate() if (openAfterLoad) { + that.setHomeTabBarVisible(false) that.$refs.carPopup.open() } } else { @@ -890,6 +914,12 @@ this.goPartTimeRegister() }, + handleDispatchPopupChange(e) { + this.setHomeTabBarVisible(!(e && e.show)) + }, + setHomeTabBarVisible(visible) { + this.$emit('tabbar-visible-change', visible) + }, selectRule(item) { //TODO 这里应该改成 复选,选中的遍历再放进来 // let rule = { @@ -980,39 +1010,86 @@ checkArea() { this.isArea = !this.isArea }, + openPickupCodePopup(index, item, regionId) { + this.pickupCode = '' + this.pickupCodeInputFocus = false + this.pickupCodeContext = { + index, + item, + regionId + } + this.$refs.pickupCodePopup.open() + this.$nextTick(() => { + setTimeout(() => { + this.pickupCodeInputFocus = true + }, 300) + }) + }, + closePickupCodePopup() { + if (this.pickupCodeSubmitting) return + this.$refs.pickupCodePopup.close() + this.pickupCode = '' + this.pickupCodeContext = null + this.pickupCodeInputFocus = false + }, + handlePickupCodeInput(e) { + const value = String(e.detail.value || '').replace(/\D/g, '').slice(0, 4) + this.pickupCode = value + return value + }, + submitPickupCode() { + if (this.pickupCodeSubmitting) return + const context = this.pickupCodeContext + if (!context) return + if (!this.pickupCode) { + uni.showToast({ + title: '请输入取餐码', + icon: 'none' + }) + return + } + this.pickupCodeSubmitting = true + this.tui.request('/mall/delivery/transferPickup', 'POST', { + regionId: context.regionId, + deliveryId: context.item.id, + workerId: context.item.workerId, + pickupCode: this.pickupCode + }, false, true).then((res) => { + if (res.code == 200) { + this.pageData.splice(context.index, 1) + this.decreaseDeliveryStatusCount(2) + this.tui.toast(res.message, 200) + this.$refs.pickupCodePopup.close() + this.pickupCode = '' + this.pickupCodeContext = null + this.pickupCodeInputFocus = false + this.$forceUpdate() + } else { + uni.showToast({ + title: res.message || '取餐码错误', + icon: 'none', + duration: 2500 + }) + } + this.pickupCodeSubmitting = false + }).catch(() => { + this.pickupCodeSubmitting = false + }) + }, changeStatus(index, item, status) { if (!this.ensureLogin()) return + if (status == 3) { + if (this.completingDeliveryIds[item.id]) { + this.tui.toast('送达处理中,请勿重复提交') + return + } + this.$set(this.completingDeliveryIds, item.id, true) + } let regionId = JSON.parse(uni.getStorageSync('area')).id let url = '' if (status == 2) { if (item.transferDelivery == 1) { - uni.showModal({ - title: '输入取餐码', - editable: true, - placeholderText: '请输入4位取餐码', - success: (modalRes) => { - if (!modalRes.confirm) return - this.tui.request('/mall/delivery/transferPickup', 'POST', { - regionId: regionId, - deliveryId: item.id, - workerId: item.workerId, - pickupCode: modalRes.content - }, false, true).then((res) => { - if (res.code == 200) { - this.pageData.splice(index, 1) - this.decreaseDeliveryStatusCount(2) - this.tui.toast(res.message, 200) - this.$forceUpdate() - } else { - uni.showToast({ - title: res.message || '取餐码错误', - icon: 'none', - duration: 2500 - }) - } - }) - } - }) + this.openPickupCodePopup(index, item, regionId) return } url = "/mall/delivery/pickup" @@ -1029,6 +1106,9 @@ deliveryId: item.id, workerId: item.workerId }, false, true).then((res) => { + if (status == 3) { + that.$delete(that.completingDeliveryIds, item.id) + } if (res.code == 200) { if (status == 2 || status == 3) { that.pageData.splice(index, 1) @@ -1045,7 +1125,11 @@ return; } uni.hideLoading(); - }).catch((res) => {}); + }).catch((res) => { + if (status == 3) { + that.$delete(that.completingDeliveryIds, item.id) + } + }); }, checkTab1(type) { if (!this.ensureWorkerRegistered()) return @@ -1637,6 +1721,11 @@ box-sizing: border-box; } + .dispatch-popup { + position: relative; + z-index: 1001; + } + .dispatch-popup-title { line-height: 48rpx; font-size: 34rpx; @@ -1717,8 +1806,9 @@ .dispatch-actions { display: flex; gap: 18rpx; - padding: 18rpx 0 calc(132rpx + constant(safe-area-inset-bottom)); - padding: 18rpx 0 calc(132rpx + env(safe-area-inset-bottom)); + padding: 18rpx 0 24rpx; + padding: 18rpx 0 calc(24rpx + constant(safe-area-inset-bottom)); + padding: 18rpx 0 calc(24rpx + env(safe-area-inset-bottom)); background: #fff; flex-shrink: 0; z-index: 2; @@ -1852,6 +1942,72 @@ height: 500rpx; } + .pickup-code-popup { + width: 640rpx; + padding: 42rpx 34rpx 30rpx; + box-sizing: border-box; + border-radius: 32rpx; + background: #fff; + box-shadow: 0 24rpx 56rpx rgba(0, 35, 28, 0.18); + } + + .pickup-code-title { + color: #00231C; + font-size: 34rpx; + font-weight: 900; + line-height: 46rpx; + text-align: center; + } + + .pickup-code-desc { + margin-top: 10rpx; + color: #7b8a85; + font-size: 24rpx; + line-height: 34rpx; + text-align: center; + } + + .pickup-code-input { + width: 100%; + height: 92rpx; + margin-top: 34rpx; + padding: 0 26rpx; + box-sizing: border-box; + border: 2rpx solid rgba(166, 255, 234, 0.88); + border-radius: 22rpx; + background: rgba(247, 255, 251, 0.96); + color: #00231C; + font-size: 34rpx; + font-weight: 800; + text-align: center; + } + + .pickup-code-actions { + display: flex; + gap: 18rpx; + margin-top: 34rpx; + } + + .pickup-code-action { + flex: 1; + height: 78rpx; + line-height: 78rpx; + border-radius: 78rpx; + text-align: center; + font-size: 28rpx; + font-weight: 900; + } + + .pickup-code-action--cancel { + background: rgba(247, 248, 248, 0.96); + color: #526964; + } + + .pickup-code-action--confirm { + background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); + color: #00231C; + } + .chaoda { height: 30rpx; line-height: 30rpx;