From c39b32c833edff89e00e0eef690d2817c3c7c938 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Sat, 18 Jul 2026 08:59:07 +0800 Subject: [PATCH] 1 --- package2/myCenter/partTimeJobRegister.vue | 464 +++++++++++++++++++++- 1 file changed, 443 insertions(+), 21 deletions(-) diff --git a/package2/myCenter/partTimeJobRegister.vue b/package2/myCenter/partTimeJobRegister.vue index 2ac42fb..669e47f 100644 --- a/package2/myCenter/partTimeJobRegister.vue +++ b/package2/myCenter/partTimeJobRegister.vue @@ -1,6 +1,6 @@ @@ -340,7 +415,11 @@ currentConfigType: '', defaultRoutePrice: '1', defaultRouteRemark: '', - routePopupVisible: false + routePopupVisible: false, + dispatchPopupVisible: false, + dispatchSaving: false, + zhipaiCheck: false, + pendingNewDispatchRuleKeys: [] } }, components: { @@ -364,6 +443,9 @@ orderRange: lowOrders + '-' + highOrders, incomeRange: '¥' + this.formatDisplayMoney(lowIncome) + '-' + this.formatDisplayMoney(highIncome) } + }, + totalRuleCount() { + return (this.waimaRuleList ? this.waimaRuleList.length : 0) + (this.paotuiRuleList ? this.paotuiRuleList.length : 0) } }, onLoad() { @@ -424,6 +506,9 @@ const minFee = this.getMinFee(list) return '已覆盖 ' + list.length + ' 条路线' + (minFee > 0 ? ',最低¥' + this.formatDisplayMoney(minFee) + '起' : '') }, + getRuleKey(item) { + return [item.orderType, item.getAreaId, item.putAreaId].join('_') + }, showOnboardingOnce() { this.$nextTick(() => { if (uni.getStorageSync('part_time_rule_onboarding_seen')) return @@ -482,9 +567,11 @@ item.orderBkge = value; return value; }, - getWorkerMessage() { + getWorkerMessage(openDispatchAfterLoad, enablePushOrderAfterLoad) { + const worker = uni.getStorageSync('worker') + if (!worker || !worker.workerId) return let that = this - that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=" + uni.getStorageSync('worker').workerId, + that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=" + worker.workerId, "GET", {}, false, true).then((res) => { if (res.code == 200) { if (res.result != null) { @@ -498,8 +585,10 @@ .deliveryLocation = data.deliveryLocation; let list = (data.workerRelaPriceList || []).map(item => { + const isNewRule = enablePushOrderAfterLoad && that.pendingNewDispatchRuleKeys.indexOf(that.getRuleKey(item)) !== -1 return Object.assign({}, item, { - remark: that.limitText(item.remark, 20) + remark: that.limitText(item.remark, 20), + isChecked: item.getPushOrder == 1 || isNewRule }); }); let waimaList = list.filter(item => item.orderType == 0); @@ -507,13 +596,24 @@ if (waimaList.length > 0) { that.formData.waima = true; - that.waimaRuleList = waimaList; } if (paotuiList.length > 0) { that.formData.paotui = true; - that.paotuiRuleList = paotuiList; } + that.waimaRuleList = waimaList; + that.paotuiRuleList = paotuiList; + const workerInfo = uni.getStorageSync('worker') || {}; + const pushOrder = data.getPushOrder !== undefined && data.getPushOrder !== null + ? data.getPushOrder + : workerInfo.getPushOrder; + that.zhipaiCheck = enablePushOrderAfterLoad ? true : pushOrder == 1; that.$forceUpdate(); + if (openDispatchAfterLoad) { + that.$nextTick(() => { + that.openDispatchPopup() + }) + } + that.pendingNewDispatchRuleKeys = [] } } else { that.tui.toast(res.message) @@ -611,7 +711,9 @@ putAreaName: s.title, orderBkge: this.formatMoneyInput(this.defaultRoutePrice), orderType: this.currentConfigType == 'waima' ? 0 : 1, - remark: this.limitText(this.defaultRouteRemark, 20) + remark: this.limitText(this.defaultRouteRemark, 20), + getPushOrder: 1, + isChecked: true }); } }); @@ -631,12 +733,106 @@ }, changePopup(e){ if(e.show == false){ - uni.navigateBack() + this.openDispatchPopup() } }, onRoutePopupChange(e) { this.routePopupVisible = !!e.show }, + onDispatchPopupChange(e) { + this.dispatchPopupVisible = !!e.show + }, + openDispatchPopup() { + if (this.$refs.dispatchPopup) { + this.$refs.dispatchPopup.open() + } + }, + closeDispatchPopup() { + if (this.$refs.dispatchPopup) { + this.$refs.dispatchPopup.close() + } + }, + zhipaiChange(e) { + this.zhipaiCheck = e.detail.value + }, + checkDispatchRule(index, type) { + if (!this.zhipaiCheck) return + if (type == 'waima') { + this.waimaRuleList[index].isChecked = !this.waimaRuleList[index].isChecked + } else { + this.paotuiRuleList[index].isChecked = !this.paotuiRuleList[index].isChecked + } + this.$forceUpdate() + }, + allCheck(type) { + const list = type == 'waima' ? this.waimaRuleList : this.paotuiRuleList + list.forEach(item => { + item.isChecked = true + }) + this.$forceUpdate() + }, + saveDispatchRule() { + if (this.dispatchSaving) return + let selectRuleList = [] + let waimaiData = [] + let kuaidiData = [] + this.waimaRuleList.forEach(item => { + if (!item.id) return + const isChecked = this.zhipaiCheck && item.isChecked + item.getPushOrder = isChecked ? 1 : 0 + selectRuleList.push({ + id: item.id, + getPushOrder: isChecked ? 1 : 0 + }) + if (isChecked) waimaiData.push(item) + }) + this.paotuiRuleList.forEach(item => { + if (!item.id) return + const isChecked = this.zhipaiCheck && item.isChecked + item.getPushOrder = isChecked ? 1 : 0 + selectRuleList.push({ + id: item.id, + getPushOrder: isChecked ? 1 : 0 + }) + if (isChecked) kuaidiData.push(item) + }) + if (selectRuleList.length == 0) { + return uni.showToast({ + title: '暂无可保存的接单范围', + icon: 'none' + }) + } + this.dispatchSaving = true + this.tui.request('/app/workerRelaPrice/batchUpdate', 'post', { + userId: uni.getStorageSync('id'), + workerRelaPriceList: selectRuleList, + getPushOrder: this.zhipaiCheck ? 1 : 0 + }).then(res => { + this.dispatchSaving = false + if (res.code == 200) { + let worker = uni.getStorageSync('worker') || {} + worker.getPushOrder = this.zhipaiCheck ? 1 : 0 + uni.setStorageSync('worker', worker) + uni.setStorageSync('waimaiData', waimaiData) + uni.setStorageSync('kuaidiData', kuaidiData) + if (!this.zhipaiCheck) { + uni.removeStorageSync('waimaiData') + uni.removeStorageSync('kuaidiData') + } + uni.showToast({ + title: '设置成功' + }) + this.closeDispatchPopup() + } else { + uni.showToast({ + title: res.message, + icon: 'none' + }) + } + }).catch(() => { + this.dispatchSaving = false + }) + }, checkAddress(type) { let that = this this.currentConfigType = type; @@ -729,6 +925,10 @@ mobile: this.formData.mobile, workerRelaPriceList: workerRelaPriceList }; + const hasNewRule = workerRelaPriceList.some(item => !item.id) + this.pendingNewDispatchRuleKeys = workerRelaPriceList + .filter(item => !item.id) + .map(item => this.getRuleKey(item)) uni.showLoading({ title: '提交中...', @@ -739,20 +939,15 @@ if (res.code == 200) { let user = res.result; uni.setStorageSync('officialAccountOpenid', user.officialAccountOpenid) - if (user.officialAccountOpenid == null || user.officialAccountOpenid == '' || user - .officialAccountOpenid == undefined) { - this.$refs.lianggePopup.open() - } else { - uni.showToast({ - title: '提交成功' - }); - } + uni.showToast({ + title: '提交成功' + }); let worker1 = uni.getStorageSync('worker') + worker1 = worker1 || {} worker1.workerName = this.formData.name + if (hasNewRule) worker1.getPushOrder = 1 uni.setStorageSync('worker', worker1) - uni.reLaunch({ - url: '/pages/index/index?tabIndex=1&deliveryRuleEdited=1' - }) + this.getWorkerMessage(true, hasNewRule) } else { uni.showToast({ title: res.message, @@ -1468,4 +1663,231 @@ background: rgba(247, 248, 248, 0.9); text-align: center; } + + .dispatch-popup-content { + width: 100%; + height: 76vh; + padding: 30rpx 28rpx 0; + border-radius: 36rpx 36rpx 0 0; + background: #fff; + display: flex; + flex-direction: column; + box-sizing: border-box; + } + + .dispatch-popup-title { + line-height: 48rpx; + font-size: 34rpx; + font-weight: 900; + text-align: center; + color: #00231C; + } + + .dispatch-popup-desc { + margin: 12rpx 0 8rpx; + padding: 18rpx 20rpx; + border-radius: 18rpx; + background: rgba(166, 255, 234, 0.22); + color: #526964; + font-size: 24rpx; + line-height: 36rpx; + } + + .zhipai-box { + display: flex; + height: 100rpx; + line-height: 100rpx; + font-size: 32rpx; + font-weight: 700; + border-bottom: 1px solid #eee; + } + + .zhipai { + flex: 1; + text-align: right; + } + + .dispatch-empty { + margin: 20rpx 0; + padding: 34rpx 20rpx; + border-radius: 22rpx; + background: rgba(247, 248, 248, 0.9); + text-align: center; + } + + .dispatch-empty-title { + font-size: 30rpx; + font-weight: 900; + color: #00231C; + } + + .dispatch-empty-desc { + margin-top: 10rpx; + color: #7b8a85; + font-size: 24rpx; + line-height: 36rpx; + } + + .dispatch-rule-scroll { + flex: 1; + min-height: 0; + height: auto; + overflow-y: scroll; + } + + .dispatch-section-title { + height: 58rpx; + line-height: 58rpx; + display: flex; + font-weight: 900; + color: #00231C; + } + + .dispatch-section-title view { + flex: 1; + padding-right: 20rpx; + color: #1E90FF; + text-align: right; + font-weight: 800; + } + + .dispatch-rule-card { + position: relative; + padding-bottom: 20rpx; + border-bottom: 1px solid #ddd; + } + + .dispatch-rule-main { + display: flex; + width: 100%; + } + + .dispatch-rule-disabled { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(255, 255, 255, 0.5); + z-index: 2; + } + + .dispatch-route-point { + display: flex; + flex: 1; + padding-top: 20rpx; + min-width: 0; + } + + .dispatch-route-badge { + width: 40rpx; + height: 40rpx; + line-height: 40rpx; + border-radius: 40rpx; + background: rgba(0, 35, 28, 1); + color: #fff; + font-size: 20rpx; + text-align: center; + z-index: 1; + flex-shrink: 0; + } + + .dispatch-route-badge--send { + background: #005849; + } + + .dispatch-route-name { + height: 40rpx; + line-height: 38rpx; + margin-left: -10rpx; + padding: 0 20rpx; + border-top-right-radius: 40rpx; + border-bottom-right-radius: 40rpx; + background: rgba(166, 255, 234, 0.5); + font-size: 24rpx; + font-weight: 700; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .dispatch-route-name--send { + background: rgba(209, 206, 255, 1); + } + + .dispatch-rule-fee { + height: 40rpx; + line-height: 40rpx; + margin: 20rpx 16rpx 0 0; + padding: 0 12rpx; + border-radius: 40rpx; + background: rgba(255, 233, 89, 0.32); + color: #8a5a00; + font-size: 20rpx; + font-weight: 800; + flex-shrink: 0; + } + + .radio-check { + width: 48rpx; + height: 48rpx; + line-height: 48rpx; + margin: 16rpx 20rpx 0 0; + border-radius: 48rpx; + background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); + text-align: center; + flex-shrink: 0; + } + + .radio-no-check { + width: 48rpx; + height: 48rpx; + margin: 16rpx 20rpx 0 0; + border-radius: 48rpx; + border: 1px solid #eee; + box-sizing: border-box; + flex-shrink: 0; + } + + .dispatch-scroll-bottom { + width: 100%; + height: 60rpx; + line-height: 60rpx; + color: #9ca6a2; + text-align: center; + } + + .dispatch-actions { + display: flex; + gap: 18rpx; + 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: 3; + } + + .dispatch-action-btn { + flex: 1; + height: 78rpx; + line-height: 78rpx; + border-radius: 78rpx; + text-align: center; + font-size: 28rpx; + font-weight: 900; + box-sizing: border-box; + } + + .dispatch-action-btn--secondary { + background: rgba(166, 255, 234, 0.28); + color: #00624f; + border: 2rpx solid rgba(166, 255, 234, 0.88); + } + + .dispatch-action-btn--primary { + background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); + color: #00231C; + box-shadow: 0 10rpx 22rpx rgba(0, 112, 91, 0.14); + } \ No newline at end of file