|
@@ -21,14 +21,14 @@
|
|
|
<el-button type="primary" v-if="tableData.length == 0 " @click="addTable()">添加</el-button>
|
|
|
<div v-for="(item,index) in tableData" :key="index" :style="{display: 'flex',marginBottom: '10px',alignItems:tableId ? 'flex-start' : 'center'}">
|
|
|
<div :style="{display: 'flex',minWidth: '150px',justifyContent: 'flex-end',padding: tableId ? '8px 0 0 0' : '0px'}">
|
|
|
- <dict-tag v-if="useStock == 1" :options="dict.type.order_form_type" :value="item.source"/>
|
|
|
+ <dict-tag v-if="useStock == 1 || !tableId" :options="dict.type.order_form_type" :value="item.source"/>
|
|
|
<el-select
|
|
|
v-model="tableData[index].source"
|
|
|
placeholder="请选择渠道"
|
|
|
- clearable
|
|
|
style="width: 100%"
|
|
|
- v-if="useStock == 0"
|
|
|
- @click="(value)=>selectSource(value,index)"
|
|
|
+ clearable
|
|
|
+ v-if="useStock == 0 && tableId"
|
|
|
+ @change="(value)=>selectSource(value,index)"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="dict in dict.type.order_form_type"
|
|
@@ -112,7 +112,7 @@
|
|
|
this.stock = JSON.parse(JSON.stringify(data))
|
|
|
this.tableData = JSON.parse(JSON.stringify(data.chennelStock))
|
|
|
this.chennelStock = JSON.parse(JSON.stringify(data.chennelStock))
|
|
|
- this.sourceList = []
|
|
|
+ this.sourceList = [];
|
|
|
this.stockAllNum = 0
|
|
|
let stockAllNum = 0
|
|
|
this.chennelStock.forEach(item=>{
|
|
@@ -153,12 +153,12 @@
|
|
|
let flog = false
|
|
|
this.tableData.forEach((item,index)=>{
|
|
|
count = count + (item.stock?item.stock:0) // + (item.soldNum?item.soldNum:0)
|
|
|
- if((!item.source && item.source !=0) || (!item.stock && item.stock !=0)) {
|
|
|
+ if((!item.source && item.source !== 0) || (!item.stock && item.stock !=0)) {
|
|
|
flog = true
|
|
|
}
|
|
|
})
|
|
|
if( flog ) {
|
|
|
- this.$message.error("渠道和售库存不能为空!");
|
|
|
+ this.$message.error("渠道和在售库存不能为空!");
|
|
|
return
|
|
|
}
|
|
|
console.log("count====",count)
|
|
@@ -207,6 +207,7 @@
|
|
|
// this.loading = false;
|
|
|
// }
|
|
|
},
|
|
|
+ // 在售 已售
|
|
|
changeRadio(value,index) {
|
|
|
if(value == 1){
|
|
|
this.$set(this.tableData[index],'stock',0)
|
|
@@ -221,28 +222,36 @@
|
|
|
"soldNum": 0,
|
|
|
"status": 0
|
|
|
})
|
|
|
+ this.sourceList.push('')
|
|
|
+ console.log("value===",this.sourceList)
|
|
|
},
|
|
|
/** 谁是我 */
|
|
|
clearTable(index){
|
|
|
let list = JSON.parse(JSON.stringify(this.sourceList))
|
|
|
- list.forEach((item,i)=>{
|
|
|
- if(this.tableData[index].source == item) {
|
|
|
- this.sourceList.splice(i,1)
|
|
|
- }
|
|
|
- })
|
|
|
- console.log("this.sourceList===",this.sourceList)
|
|
|
+ // list.forEach((item,i)=>{
|
|
|
+ // if(this.tableData[index].source == item) {
|
|
|
+ // this.sourceList.splice(i,1)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
this.tableData.splice(index,1)
|
|
|
+ this.sourceList.splice(index,1)
|
|
|
+ console.log("value===",index,this.sourceList)
|
|
|
this.$forceUpdate()
|
|
|
},
|
|
|
/** */
|
|
|
selectSource(value,i) {
|
|
|
- this.sourceList.push(value)
|
|
|
+ console.log("value===",value,i,this.sourceList)
|
|
|
+ this.$set(this.sourceList,i,value)
|
|
|
+ //this.sourceList.push(value)
|
|
|
this.$set(this.tableData[i],'soldNum',0)
|
|
|
- this.chennelStock.forEach((item,index)=>{
|
|
|
- if(value == item.source) {
|
|
|
- this.$set(this.tableData[i],'soldNum',item.soldNum)
|
|
|
- }
|
|
|
- })
|
|
|
+ if(value || value === 0){
|
|
|
+ this.chennelStock.forEach((item,index)=>{
|
|
|
+ if(value == item.source) {
|
|
|
+ this.$set(this.tableData[i],'soldNum',item.soldNum)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.$forceUpdate()
|
|
|
}
|
|
|
},
|
|
|
};
|