From a0b97eb8e934ba28b9e51824d4cbbcc99cc70e17 Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期四, 18 七月 2024 23:08:00 +0800
Subject: [PATCH] fxi:解决发货bug
---
src/views/sales/salesDetails/shipmentsDialog.vue | 161 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 103 insertions(+), 58 deletions(-)
diff --git a/src/views/sales/salesDetails/shipmentsDialog.vue b/src/views/sales/salesDetails/shipmentsDialog.vue
index c6dc1d6..bd60295 100644
--- a/src/views/sales/salesDetails/shipmentsDialog.vue
+++ b/src/views/sales/salesDetails/shipmentsDialog.vue
@@ -35,8 +35,8 @@
<el-select
v-model="editConfig.infomation.projectId"
placeholder="璇烽�夋嫨"
+ disabled
size="mini"
- :disabled="true"
>
<el-option
v-for="item in projectList"
@@ -48,25 +48,26 @@
</el-select>
</el-form-item>
</el-col>
- <!-- <el-col :span="24">
+ <el-col :span="24">
<el-form-item label="鍙戣揣浠撳簱" prop="addressee">
- <el-select v-model="value" placeholder="璇烽�夋嫨">
+ <el-select v-model="value" placeholder="璇烽�夋嫨" @change="optionsChange">
<el-option
v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
+ :key="item.warehouseId"
+ :label="item.warehouseName"
+ :value="item">
</el-option>
</el-select>
</el-form-item>
- </el-col> -->
+ </el-col>
</el-row>
</div>
- <div class="product-view">
+ <div class="product-view" v-if="isCommonShow">
<CommonFormTableView
ref="commonFormTableView"
:detail-enter="isView ? true : false"
:selectBox="false"
+ :colOpenShow="true"
:addTypeIdMultiple="true"
pageName="quotation"
:isBorder="true"
@@ -87,7 +88,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
- <el-button type="primary" size="small" :disabled="dissatisfy" @click="saveClick('form')">纭畾鍙戣揣</el-button>
+ <el-button type="primary" size="small" :disabled="dissatisfy" @click.stop="saveClick('form')">纭畾鍙戣揣</el-button>
<el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
</div>
</el-dialog>
@@ -97,7 +98,7 @@
<script>
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
import { getAllData } from "@/api/client/client"
-import { getProjectList,getDeliveryPrepareInfo,confirmOutput } from "@/api/sales/salesDetails"
+import { getProjectList,getDeliveryPrepareInfo,confirmOutput,getDeliveryPrepareInfoByWarehouse } from "@/api/sales/salesDetails"
import codeMixin from "@/components/makepager/mixin/codeMixin"
import { getSaleChanceList } from "@/api/sales/salesOpportunity"
import { getDataByType } from "@/api/data"
@@ -128,14 +129,14 @@
data() {
// 浜у搧淇℃伅
const productColumn = [
- { label: "浜у搧缂栧彿", prop: "number", isShowColumn:true, },
- { label: "浜у搧鍚嶇О", prop: "name",isShowColumn:true, min: 110 },
- { label: "璁㈠崟鏁伴噺", prop: "orderAmount", isShowColumn:true,},
- { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount",isShowColumn:true, },
- { label: "鍙敤搴撳瓨", prop: "availableAmount",isShowColumn:true, },
- { label: "鏈彂璐ф暟閲�", prop: "leftAmount", isShowColumn:true, },
- { label: "鏈鍙戣揣鏁伴噺", prop: "outputAmount", inputFloat: true,isRequird:true,isShowColumn:true,},
- { label: "鍓╀綑鍙戣揣鏁伴噺", prop: "availableAmount",isShowColumn:true,},
+ { label: "浜у搧缂栧彿", prop: "number",},
+ { label: "浜у搧鍚嶇О", prop: "name", min: 110 },
+ { label: "璁㈠崟鏁伴噺", prop: "orderAmount",min:110,},
+ { label: "璁㈠崟瀹屾垚鏁伴噺", min:120,prop: "finishAmount",},
+ { label: "鍙敤搴撳瓨", prop: "availableAmount",},
+ { label: "鏈彂璐ф暟閲�", prop: "leftAmount", min:120, },
+ { label: "鏈鍙戣揣鏁伴噺", prop: "outputAmount", min:120,inputFloat: true},
+ { label: "鍓╀綑鍙戣揣鏁伴噺", prop: "availableAmount",min:120,},
]
return {
dialogWidth: "60%",
@@ -210,18 +211,14 @@
return time.getTime() > Date.now()
}
},
- options: [{
- value: '1',
- label: '浠撳簱1--搴撳瓨涓嶈冻鐨勬儏鍐�'
- }, {
- value: '2',
- label: '浠撳簱1--搴撳瓨鍏呰冻鐨勬儏鍐�'
- }],
+ options: [],
value:"",
shipmentsList:[],
shipmentsMsg:"",
dissatisfy:false, // 涓�娆″彂璐�-涓嶈冻
completely:false, // 澶氭鍙戣揣锛屽厖瓒�
+ isCommonShow:true,
+ warehouseId:null,
}
},
mounted(){
@@ -233,12 +230,16 @@
this.setTableForm()
this.handleRadioChange()
this.getCommonData()
- this.formInfo()
this.getUseSystemSet({ modeType: "xsmx" })
this.getProjectList()
this.getDeliveryPrepareInfo({
saleDetailID: this.editCommonConfig.infomation.saleDetailID,
saleDetailNumber: this.editCommonConfig.infomation.saleDetailNumber
+ })
+ this.getDeliveryPrepareInfoByWarehouse({
+ groupByWarehouse: true,
+ saleDetailID: this.editCommonConfig.infomation.saleDetailID,
+ saleDetailNumber: this.editCommonConfig.infomation.saleDetailNumber
})
},
watch: {
@@ -289,12 +290,11 @@
this.$refs[formName].validate((valid) => {
if (valid) {
const params = this.saveParams()
- console.log(params,"鍙傛暟")
let isShipments=false
let shipmentsNum=false
this.shipmentsList.map((item)=>{
if(this.editConfig.infomation.deliverType===1){
- if(item.leftAmount<item.availableAmount&&item.leftAmount>0){
+ if(item.leftAmount<=item.availableAmount&&item.leftAmount>0){
isShipments=false
}else if(item.leftAmount<=0){
shipmentsNum=true
@@ -306,20 +306,24 @@
isShipments=true
}else if(item.outputAmount===0){
shipmentsNum=true
- }else if(!item.outputAmount){
- shipmentsNum=true
}else if(item.leftAmount<=0){
isShipments=true
}else{
isShipments=false
}
}
- })
+ });
if(isShipments){
this.$message.warning("鍙戣揣鏁伴噺瓒呭嚭鏈彂璐ф暟閲忔垨瓒呭嚭褰撳墠鍙敤搴撳瓨")
- }else if(shipmentsNum){
+ }/*else if(shipmentsNum){
this.$message.warning("鍙戣揣鏁伴噺涓嶈兘涓�0")
- }else{
+ }*/else{
+ //杩囨护鎺変负绌虹殑鏁版嵁
+ params.products=params.products.filter(item=>item.outputAmount);
+ if(params.products.length===0){
+ this.$message.warning('娌℃湁婊¤冻鍙戣揣鏉′欢鐨勬槑缁嗭紝鏃犳硶鍙戣揣');
+ return;
+ }
confirmOutput(params).then((res)=>{
if(res&&res.code===200){
this.$message.success("鍙戣揣鎴愬姛!")
@@ -334,7 +338,8 @@
saveParams() {
let params = {
products:[],
- saleDetailNumber:this.editCommonConfig.infomation.saleDetailNumber
+ saleDetailNumber:this.editCommonConfig.infomation.saleDetailNumber,
+ warehouseId:this.warehouseId
}
this.shipmentsList.map((item)=>{
let obj={
@@ -342,7 +347,7 @@
outputAmount:this.editConfig.infomation.deliverType===1?item.leftAmount:item.outputAmount // 鏈鍙戣揣鏁伴噺
}
params.products.push(obj)
- })
+ });
return params
},
@@ -373,7 +378,6 @@
var restaurants = []
if (value === "client") {
restaurants = this.clientList
- console.log(restaurants, "瀹㈡埛鍗�")
} else if (value === "chance") {
restaurants = this.saleChancelist
} else if (value === "subbill") {
@@ -468,19 +472,19 @@
this.getQuotation(this.editConfig.infomation.saleChanceId, "鍏ㄩ儴浜у搧")
}
this.tableColumn=[
- { label: "浜у搧缂栧彿", prop: "number", isShowColumn:true, },
- { label: "浜у搧鍚嶇О", prop: "name",isShowColumn:true, min: 110 },
- { label: "璁㈠崟鏁伴噺", prop: "orderAmount", isShowColumn:true,},
- { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount",isShowColumn:true, }
+ { label: "浜у搧缂栧彿", prop: "number", },
+ { label: "浜у搧鍚嶇О", prop: "name", min: 110 },
+ { label: "璁㈠崟鏁伴噺", prop: "orderAmount",},
+ { label: "璁㈠崟瀹屾垚鏁伴噺", min:120, prop: "finishAmount", }
]
this.productTableList = {
tableData: this.tableData,
isReturn: true,
// tableColumn: [
- // { label: "浜у搧缂栧彿", prop: "number", isShowColumn:true, },
- // { label: "浜у搧鍚嶇О", prop: "name",isShowColumn:true, min: 110 },
- // { label: "璁㈠崟鏁伴噺", prop: "orderAmount", isShowColumn:true,},
- // { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount",isShowColumn:true, }
+ // { label: "浜у搧缂栧彿", prop: "number",},
+ // { label: "浜у搧鍚嶇О", prop: "name",min: 110 },
+ // { label: "璁㈠崟鏁伴噺", prop: "orderAmount",},
+ // { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount",}
// ],
tableColumn: this.setColumnVisible(this.productTableList.showcol, this.tableColumn)
}
@@ -584,15 +588,19 @@
this.shipmentsList=[]
this.dissatisfy=false
this.completely=false
+ this.isCommonShow=false;
+ this.$nextTick(()=>{
+ this.isCommonShow=true;
+ })
if(value==1){
this.productTableList.showcol= ['浜у搧缂栧彿','浜у搧鍚嶇О', "璁㈠崟鏁伴噺", "璁㈠崟瀹屾垚鏁伴噺","鍙敤搴撳瓨"]
this.productTableList.allcol= ["璁㈠崟鏁伴噺", "璁㈠崟瀹屾垚鏁伴噺","鍙敤搴撳瓨"]
this.tableColumn=[
- { label: "浜у搧缂栧彿", prop: "number",isShowColumn:true, },
- { label: "浜у搧鍚嶇О", prop: "name",isShowColumn:true, min: 110 },
- { label: "璁㈠崟鏁伴噺", prop: "orderAmount",isShowColumn:true, },
- { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount",isShowColumn:true, },
- { label: "鍙敤搴撳瓨", prop: "availableAmount",isShowColumn:true, },
+ { label: "浜у搧缂栧彿", prop: "number", },
+ { label: "浜у搧鍚嶇О", prop: "name",min: 110 },
+ { label: "璁㈠崟鏁伴噺", prop: "orderAmount",},
+ { label: "璁㈠崟瀹屾垚鏁伴噺", min:120, prop: "finishAmount", },
+ { label: "鍙敤搴撳瓨", prop: "availableAmount",},
]
this.productTableList.tableColumn=this.setColumnVisible(this.productTableList.showcol, this.tableColumn)
this.dissatisfy=false
@@ -642,14 +650,14 @@
this.productTableList.showcol= ['浜у搧缂栧彿','浜у搧鍚嶇О', "璁㈠崟鏁伴噺", "璁㈠崟瀹屾垚鏁伴噺","鍙敤搴撳瓨","鏈彂璐ф暟閲�", "鏈鍙戣揣鏁伴噺","鍓╀綑鍙戣揣鏁伴噺",]
this.productTableList.allcol= [ "璁㈠崟鏁伴噺", "璁㈠崟瀹屾垚鏁伴噺","鍙敤搴撳瓨","鏈彂璐ф暟閲�", "鍓╀綑鍙戣揣鏁伴噺",]
this.tableColumn= [
- { label: "浜у搧缂栧彿", prop: "number",isShowColumn:true, },
- { label: "浜у搧鍚嶇О", prop: "name", min: 110 ,isShowColumn:true,},
- { label: "璁㈠崟鏁伴噺", prop: "orderAmount",isShowColumn:true, },
- { label: "璁㈠崟瀹屾垚鏁伴噺", prop: "finishAmount" ,isShowColumn:true,},
- { label: "鍙敤搴撳瓨", prop: "availableAmount",isShowColumn:true, },
- { label: "鏈彂璐ф暟閲�", prop: "leftAmount", isShowColumn:true, },
- { label: "鏈鍙戣揣鏁伴噺", prop: "outputAmount", inputFloat: true,isRequird:true,isShowColumn:true,},
- { label: "鍓╀綑鍙戣揣鏁伴噺", prop: "availableAmount",isShowColumn:true,},
+ { label: "浜у搧缂栧彿", prop: "number", },
+ { label: "浜у搧鍚嶇О", prop: "name", min: 110 ,},
+ { label: "璁㈠崟鏁伴噺", prop: "orderAmount", },
+ { label: "璁㈠崟瀹屾垚鏁伴噺", min:120, prop: "finishAmount" ,},
+ { label: "鍙敤搴撳瓨", prop: "availableAmount",},
+ { label: "鏈彂璐ф暟閲�", prop: "leftAmount", min:120, },
+ { label: "鏈鍙戣揣鏁伴噺", prop: "outputAmount", min:120,inputFloat: true},
+ { label: "鍓╀綑鍙戣揣鏁伴噺", prop: "availableAmount", min:120,},
]
this.productTableList.tableColumn=this.setColumnVisible(this.productTableList.showcol, this.tableColumn)
let portion=0
@@ -696,7 +704,6 @@
this.shipmentsList.push(item)
}
})
- console.log(portion,"portion2")
if(portion===0){// 娌℃湁浜у搧婊¤冻鍙戣揣鏉′欢
this.completely=false
this.dissatisfy=true
@@ -714,6 +721,44 @@
}
}
})
+ },
+ // 鎸変粨搴撹繘琛屽彂璐�
+ async getDeliveryPrepareInfoByWarehouse(params){
+ await getDeliveryPrepareInfoByWarehouse(params).then((res)=>{
+ this.options=res.data
+ })
+ },
+ // 閫夋嫨浠撳簱
+ optionsChange(val){
+ this.warehouseId=val.warehouseId
+ this.productTableList.tableData=val.storeInfoList||[]
+ if(this.editConfig.infomation.deliverType===1){
+ let portion=0
+ this.productTableList.tableData.map((item)=>{
+ item.availableAmount=Number(item.availableAmount)
+ item.leftAmount=Number(item.leftAmount)
+ item.finishAmount=Number(item.finishAmount)
+ item.orderAmount=Number(item.orderAmount)
+ if(item.availableAmount>=item.leftAmount&&item.availableAmount>0&&item.leftAmount>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{
+ this.dissatisfy=false
+ this.completely=true
+ this.shipmentsMsg="鑳芥弧瓒冲彂璐ч渶姹傦紝鐩存帴鍙戣揣鍚�"
+ }
+ }
}
}
}
--
Gitblit v1.8.0