From b6eaf843294b8a438dad42efda2be6bd24d2e926 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期四, 16 三月 2023 19:56:16 +0800 Subject: [PATCH] 客户,货代订单转发数量的判断 --- pages/public-page/forward/forward.vue | 34 +++++++++++++++++++++++----------- pages/customer-page/customer-index/customer-index.vue | 2 +- pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue | 6 +++--- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue index a90caf0..cc34f45 100644 --- a/pages/customer-page/customer-index/customer-index.vue +++ b/pages/customer-page/customer-index/customer-index.vue @@ -154,7 +154,7 @@ // 杞彂 forwardClick(obj) { uni.navigateTo({ - url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNum=${obj.cars2}` + url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNumSurplus1=${obj.carNumSurplus1}` }); } } diff --git a/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue b/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue index 63b5d9d..06b9046 100644 --- a/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue +++ b/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue @@ -8,7 +8,7 @@ <text>{{ item.carNum }}</text> 寮� </view> - <view class="card-left__utils"><u-button text="杞彂" type="primary" @tap.stop="forwardClick(item.id)" shape="circle"></u-button></view> + <view class="card-left__utils"><u-button text="杞彂" type="primary" @tap.stop="forwardClick(item)" shape="circle"></u-button></view> </template> <template v-slot:right-top> <view class="right-top"> @@ -62,9 +62,9 @@ }); }, // 杞彂 - forwardClick(id) { + forwardClick(value) { uni.navigateTo({ - url: `/pages/public-page/forward/forward?orderPlanId=${id}` + url: `/pages/public-page/forward/forward?orderPlanId=${value.id}&carNumSurplusHuodai=${value.carNumSurplusHuodai}` }); } } diff --git a/pages/public-page/forward/forward.vue b/pages/public-page/forward/forward.vue index 52e564a..a8f43a6 100644 --- a/pages/public-page/forward/forward.vue +++ b/pages/public-page/forward/forward.vue @@ -48,15 +48,21 @@ export default { onLoad(params) { console.log('杞彂鐨勬彁鐓ゅ崟id', params.orderPlanId, params.carNum); + if (params.carNumSurplus1 || params.carNumSurplusHuodai) { + if (params.carNumSurplus1 != 0) { + this.forwardSurplus = params.carNumSurplus1; + } else if (params.carNumSurplusHuodai != 0) { + this.forwardSurplus = params.carNumSurplusHuodai; + } + } this.forwardForm.orderPlanId = params.orderPlanId; - this.carNumTatal = params.carNum; }, data() { return { + forwardSurplus: 0, paramsName: {}, huoDaiData: [], fleetData: [], - carNumTatal: null, name: '', forwardForm: { orderPlanId: null, @@ -107,7 +113,7 @@ checkboxChange(value) { console.log('澶嶉�夋鍙樺寲', value); if (value.length != 0) { - this.forwardForm.nums = this.carNumTatal; + this.forwardForm.nums = this.forwardSurplus; } else { this.forwardForm.nums = null; } @@ -156,14 +162,20 @@ }, // 鎻愪氦 submitForm() { - this.$reqPost('forward', this.forwardForm, 'params').then(res => { - if (res.code == 0) { - this.$u.toast('鎻愪氦鎴愬姛'); - setTimeout(() => { - uni.navigateBack({ delta: 1 }); - }, 1000); - } - }); + if (isNaN(Number(this.forwardForm.nums)) || Number(this.forwardForm.nums) <= 0) { + this.$u.toast('璇疯緭鍏ュ悎娉曟暟瀛�'); + } else if (Number(this.forwardForm.nums) > Number(this.forwardSurplus)) { + this.$u.toast('瓒呰繃鏈�澶ц鍗曞墿浣欓噺'); + } else { + this.$reqPost('forward', this.forwardForm, 'params').then(res => { + if (res.code == 0) { + this.$u.toast('鎻愪氦鎴愬姛'); + setTimeout(() => { + uni.navigateBack({ delta: 1 }); + }, 1000); + } + }); + } }, tabClick(item) { console.log('tab鐐瑰嚮', item); -- Gitblit v1.9.1