From ea2b5a4a2779a2a94c4846b110c5507a248ffeb5 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期三, 20 三月 2024 19:50:25 +0800 Subject: [PATCH] 销售明细发货添加确认完成,格式化列表状态展示 --- src/views/sales/salesDetails/shipmentsDialog.vue | 153 +++++++++++++++++++++++++++---------- src/api/sales/salesDetails.js | 8 ++ src/views/sales/salesDetails/index.vue | 43 +++++++--- 3 files changed, 146 insertions(+), 58 deletions(-) diff --git a/src/api/sales/salesDetails.js b/src/api/sales/salesDetails.js index a6e50c0..65faa26 100644 --- a/src/api/sales/salesDetails.js +++ b/src/api/sales/salesDetails.js @@ -88,4 +88,12 @@ data }) } +// 纭鍙戣揣瀹屾垚 +export function confirmOutputOver(data) { + return request({ + url: "/api/salesDetails/confirmOutputOver", + method: "post", + data + }) +} diff --git a/src/views/sales/salesDetails/index.vue b/src/views/sales/salesDetails/index.vue index 719169e..82b47e0 100644 --- a/src/views/sales/salesDetails/index.vue +++ b/src/views/sales/salesDetails/index.vue @@ -50,6 +50,9 @@ <template v-if="scope.row.status === 3||scope.row.status === 4"> <el-button @click.stop="shipmentsClick(scope.row)" type="text" size="small">鍙戣揣</el-button> </template> + <template v-if="scope.row.status === 3||scope.row.status === 4"> + <el-button @click.stop="confirmClick(scope.row)" type="text" size="small">纭瀹屾垚</el-button> + </template> </template> </el-table-column> </template> @@ -176,7 +179,8 @@ getProductOrderInfo, updateStatus, getProjectList, - sendSalesDetailsToOtherSystem + sendSalesDetailsToOtherSystem, + confirmOutputOver } from "@/api/sales/salesDetails" import pageMixin from "@/components/makepager/pager/mixin/pageMixin" import DetailSpecification from "@/views/sales/salesDetails/DetailSpecification" @@ -241,7 +245,7 @@ { label: "鎵胯繍鍟�", prop: "carrier" }, { label: "杩愬崟鍙�", prop: "waybill" }, { label: "鍒涘缓鏃堕棿", prop: "warehouse" }, - { label: "鐘舵��", prop: "status" }, + { label: "鐘舵��", prop: "status",isCallMethod: true,getCallMethod: this.getStatusFive }, ] // 鍒堕�犱俊鎭� const makeColumn = [ @@ -318,57 +322,47 @@ { label: "濮斿璁㈠崟", prop: "outsourcingId", - default: true }, { label: "浜у搧缂栧彿", prop: "productId", - default: true }, { label: "浜у搧鍚嶇О", prop: "productName", - default: true }, { label: "浜у搧瑙勬牸", prop: "specs", - default: true }, { label: "浜у搧鍗曚綅", prop: "unit", - default: true }, { label: "濮斿鏁伴噺", prop: "amount", - default: true }, { label: "瀹屾垚鏁伴噺", prop: "finishAmount", - default: true }, { label: "璁㈠崟鐘舵��", prop: "status", - default: true + default: true, isCallMethod: true, getCallMethod: this.getStatus }, { label: "濮斿渚涘簲鍟�", prop: "supplierName", - default: true }, { label: "绛剧害鏃ユ湡", prop: "startTime", - default: true }, { label: "浜や粯鏃ユ湡", prop: "endTime", - default: true }, ] return { @@ -736,6 +730,15 @@ this.editShipmentsConfig.infomation.saleDetailNumber=row.number this.editShipmentsConfig.infomation.projectId=row.projectId }, + // 纭鍙戣揣瀹屾垚 + async confirmClick(row){ + await confirmOutputOver({saleDetailNumber:row.number}).then((res)=>{ + if(res&&res.code===200){ + this.$message.success("纭鍙戣揣瀹屾垚") + this.getData() + } + }) + }, // 鍏抽棴 closeClick(row) { console.log(row, "鍏抽棴") @@ -850,7 +853,7 @@ }, // 鐘舵�� getStatus(val) { - return val === 1 ? "寰呯‘璁�" : val === 2 ? "寰呭嚭搴�" : val === 3 ? "澶囪揣涓�" : val === 4 ? "寰呭嚭搴�" : val === 5 ? "鍑哄簱瀹屾垚" : val=== 6 ? "宸插叧闂�": "--" + return val === 1 ? "寰呯‘璁�" : val === 2 ? "寰呭垎瑙�" : val === 3 ? "澶囪揣涓�" : val === 4 ? "寰呭嚭搴�" : val === 5 ? "鍑哄簱瀹屾垚" : val=== 6 ? "宸插叧闂�": "--" }, // top 琛岀偣鍑� tableRowClick(row) { @@ -867,6 +870,9 @@ this.getProductOrderInfo(this.selectRow.number) } else if (this.TabsIndex == 3) { // 閲囪喘淇℃伅 + this.getProductOrderInfo(this.selectRow.number) + }else if(this.TabsIndex == 4){ + // 濮斿淇℃伅 this.getProductOrderInfo(this.selectRow.number) } }, @@ -927,7 +933,14 @@ }) } }) - } + }, + getStatusFive(val) { + if (val) { + return val==0?'灏辩华':'瀹屾垚' + } else { + return "--"; + } + }, } } </script> diff --git a/src/views/sales/salesDetails/shipmentsDialog.vue b/src/views/sales/salesDetails/shipmentsDialog.vue index 99cadd4..99b4e18 100644 --- a/src/views/sales/salesDetails/shipmentsDialog.vue +++ b/src/views/sales/salesDetails/shipmentsDialog.vue @@ -85,9 +85,8 @@ @clearupProduct="clearupProduct" ></CommonFormTableView> </div> - <p class="tips" v-if="completely"><i class="el-icon-warning-outline">褰撳墠浠撳簱鑳芥弧瓒冲彂璐ч渶姹傦紝鐩存帴鍙戣揣鍚�</i></p> - <p class="tips" v-if="satisfyPartly"><i class="el-icon-warning-outline"></i>褰撳墠浠撳簱鍙兘閮ㄥ垎婊¤冻鍙戣揣闇�姹傦紝鏄惁纭鍙戣揣</p> - <p class="tips" v-if="dissatisfy"><i class="el-icon-warning-outline"></i>褰撳墠浠撳簱搴撳瓨涓嶈冻锛屼笉鑳藉畬鎴愪竴娆″彂璐э紝璇烽�夋嫨鍏朵粬浠撳簱鍚�</p> + <p class="tips tips_success" v-if="completely"><i class="el-icon-warning-outline"></i>{{ shipmentsMsg }}</p> + <p class="tips tips_insufficient" v-if="dissatisfy"><i class="el-icon-warning-outline"></i>{{shipmentsMsg}}</p> </div> </el-form> @@ -205,9 +204,10 @@ label: '浠撳簱1--搴撳瓨鍏呰冻鐨勬儏鍐�' }], value:"", + shipmentsList:[], + shipmentsMsg:"", dissatisfy:false, // 涓�娆″彂璐�-涓嶈冻 completely:false, // 澶氭鍙戣揣锛屽厖瓒� - satisfyPartly:false, //澶氭鍙戣揣锛岄儴鍒嗘弧瓒� } }, mounted(){ @@ -272,14 +272,41 @@ this.$refs[formName].validate((valid) => { if (valid) { const params = this.saveParams() - confirmOutput(params).then((res)=>{ - console.log(res,"res") - if(res&&res.code===200){ - this.$message.success("鍙戣揣鎴愬姛!") - this.$parent.getData() - this.editConfig.visible=false + console.log(params,"鍙傛暟") + let isShipments=false + let shipmentsNum=false + this.shipmentsList.map((item)=>{ + if(this.shipmentsType===1){ + if(item.leftAmount<item.availableAmount){ + isShipments=false + }else{ + isShipments=true + } + }else{ + if(item.outputAmount>item.availableAmount||item.outputAmount>item.leftAmount){ + isShipments=true + }else if(item.outputAmount===0){ + shipmentsNum=true + }else if(!item.outputAmount){ + shipmentsNum=true + }else{ + isShipments=false + } } }) + if(isShipments){ + this.$message.warning("鍙戣揣鏁伴噺瓒呭嚭鏈彂璐ф暟閲忔垨瓒呭嚭褰撳墠鍙敤搴撳瓨") + }else if(shipmentsNum){ + this.$message.warning("鍙戣揣鏁伴噺涓嶈兘涓�0") + }else{ + confirmOutput(params).then((res)=>{ + if(res&&res.code===200){ + this.$message.success("鍙戣揣鎴愬姛!") + this.$parent.getData() + this.editConfig.visible=false + } + }) + } } }) }, @@ -288,10 +315,10 @@ products:[], saleDetailNumber:this.editCommonConfig.infomation.saleDetailNumber } - this.productTableList.tableData.map((item)=>{ + this.shipmentsList.map((item)=>{ let obj={ number:item.number, - outputAmount:item.outputAmount||'' + outputAmount:this.shipmentsType===1?item.leftAmount:item.outputAmount // 鏈鍙戣揣鏁伴噺 } params.products.push(obj) }) @@ -425,20 +452,20 @@ tableColumn: [ { label: "浜у搧缂栧彿", prop: "number" }, { label: "浜у搧鍚嶇О", prop: "name", min: 110 }, - { label: "璁㈠崟鏁伴噺", prop: "specs" }, - { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "type" }, + { label: "璁㈠崟鏁伴噺", prop: "orderAmount" }, + { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount" }, // { label: "鍙敤搴撳瓨", prop: "unit" }, ] } }, // 浜у搧鍒楄〃杈撳叆 inputContent(val, prop, row) { - // this.productId = row.productId - this.tableData.map((item) => { - if (item.number === row.number) { - item[prop] = val - } - }) + console.log(val,prop,row,) + // this.productTableList.tableData.map((item) => { + // if (item.number === row.number) { + // item[prop] = val + // } + // }) }, // 浜у搧鏂板 addProductClick() { @@ -504,9 +531,10 @@ }, // 閫夋嫨鍙戣揣鏂瑰紡 handleRadioChange(value) { + this.shipmentsList=[] + this.dissatisfy=false + this.completely=false if(value===1){ - this.completely=false - this.satisfyPartly=false this.productTableList.tableColumn=[ { label: "浜у搧缂栧彿", prop: "number" }, { label: "浜у搧鍚嶇О", prop: "name", min: 110 }, @@ -517,20 +545,31 @@ this.dissatisfy=false let portion=0 this.productTableList.tableData.map((item)=>{ - if(item.availableAmount-item.leftAmount<0){ - this.dissatisfy=true - return this.dissatisfy - }else{ + if(item.availableAmount>=item.leftAmount&&item.availableAmount>0){ portion++ + this.shipmentsList.push(item) + } + if(portion===0){// 娌℃湁浜у搧婊¤冻鍙戣揣鏉′欢 + this.completely=false + this.dissatisfy=true + this.shipmentsMsg="褰撳墠浠撳簱搴撳瓨涓嶈冻,涓嶈兘瀹屾垚涓�娆″彂璐�" + }else if(portion>0&&portion<this.productTableList.tableData.length){// 閮ㄥ垎浜у搧婊¤冻鍙戣揣鏉′欢 + this.dissatisfy=false + this.completely=true + this.shipmentsMsg="鍙兘婊¤冻閮ㄥ垎鍙戣揣闇�姹傦紝鏄惁纭鍙戣揣" + + }else if(portion===this.productTableList.tableData.length){// 鍏呭垎婊¤冻 + this.dissatisfy=false + this.completely=true + this.shipmentsMsg="鑳芥弧瓒冲彂璐ч渶姹傦紝鐩存帴鍙戣揣鍚�" } }) - if(portion===this.productTableList.tableData.length){ + if(portion===this.productTableList.tableData.length){ // 鍏ㄩ儴婊¤冻鍙戣揣鏉′欢 this.dissatisfy=false this.completely=false this.completely=true } }else if(value===2){ - this.dissatisfy=false this.productTableList.tableColumn= [ { label: "浜у搧缂栧彿", prop: "number" }, { label: "浜у搧鍚嶇О", prop: "name", min: 110 }, @@ -538,37 +577,57 @@ { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount" }, { label: "鍙敤搴撳瓨", prop: "availableAmount" }, { label: "鏈彂璐ф暟閲�", prop: "leftAmount", }, - { label: "鏈鍙戣揣鏁伴噺", prop: "outputAmount", inputFloat: true,isRequird: true }, + { label: "鏈鍙戣揣鏁伴噺", prop: "outputAmount", inputFloat: true,isRequird:true }, { label: "鍓╀綑鍙戣揣鏁伴噺", prop: "availableAmount",}, ] let portion=0 this.productTableList.tableData.map((item)=>{ - if(item.availableAmount-item.leftAmount>=0){ + if(item.availableAmount>0){ portion++ + this.shipmentsList.push(item) + } + if(portion===0){ // 娌℃湁涓�浠朵骇鍝佽兘婊¤冻鍙戣揣鏉′欢 + this.completely=false + this.dissatisfy=true + this.shipmentsMsg="褰撳墠浠撳簱搴撳瓨涓�0,鏃犳硶鍙戣揣" + }else if(portion>0&&portion<this.productTableList.tableData.length){ + this.dissatisfy=false + this.completely=true + this.shipmentsMsg="鍙兘婊¤冻閮ㄥ垎鍙戣揣闇�姹傦紝鏄惁纭鍙戣揣" + }else if(portion===this.productTableList.tableData.length){ + this.dissatisfy=false + this.completely=true + this.shipmentsMsg="鑳芥弧瓒冲彂璐ч渶姹傦紝鐩存帴鍙戣揣鍚�" } }) - if(0<portion<this.productTableList.tableData.length){ - this.satisfyPartly=true - }else if(portion===this.productTableList.tableData.length){ - this.completely=true - this.dissatisfy=fasle - }else if(portion===0){ - this.dissatisfy=true - this.completely=false - - } } }, // 浜у搧鍏ュ簱淇℃伅 async getDeliveryPrepareInfo(params){ await getDeliveryPrepareInfo(params).then((res)=>{ + this.shipmentsList=[] if(res&&res.code===200){ this.productTableList.tableData=res.data||[] if(this.shipmentsType===1){ + let portion=0 this.productTableList.tableData.map((item)=>{ - if(item.availableAmount-item.leftAmount<0){ + if(item.availableAmount>=item.leftAmount&&item.availableAmount>0){ + portion++ + this.shipmentsList.push(item) + } + if(portion===0){// 娌℃湁浜у搧婊¤冻鍙戣揣鏉′欢 + this.completely=false this.dissatisfy=true - return this.dissatisfy + this.shipmentsMsg="褰撳墠浜у搧鍙敤搴撳瓨涓�0,鏃犳硶鍙戣揣" + }else if(portion>0&&portion<this.productTableList.tableData.length){ + this.dissatisfy=false + this.completely=true + this.shipmentsMsg="鍙兘婊¤冻閮ㄥ垎鍙戣揣闇�姹傦紝鏄惁纭鍙戣揣" + // 閮ㄥ垎浜у搧婊¤冻鍙戣揣鏉′欢 + }else if(portion===this.productTableList.tableData.length){ + this.dissatisfy=false + this.completely=true + this.shipmentsMsg="鑳芥弧瓒冲彂璐ч渶姹傦紝鐩存帴鍙戣揣鍚�" } }) } @@ -623,7 +682,6 @@ } .tips{ font-size: 16px; - color: #FF9C49; display: flex; margin-left: 20px; i{ @@ -631,6 +689,15 @@ margin-right: 10px; } } + .tips_success{ + color: #5299FF; + } + .tips_portion{ + color: #FF9C49; + } + .tips_insufficient{ + color: #FF9C49; + } } .unflod-collapse { display: flex; -- Gitblit v1.8.0