Merge branch 'main' of https://code.tiantongsl.com/bin/shop-many-admin-ui
This commit is contained in:
commit
bc2e2c02fe
|
@ -154,7 +154,7 @@
|
|||
<template v-if="manyTabDate">
|
||||
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
<span class="priceBox" v-text="scope.row[iii]" />
|
||||
<el-input @input="handleMany(scope.row,iii,manyTabTit[iii].title)" v-model="scope.row[iii]" type="text" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
@ -431,6 +431,8 @@ export default {
|
|||
],
|
||||
tableIndex: 0,
|
||||
attrInfo: {},
|
||||
fatAttrValue:[],
|
||||
detailStatus:true,
|
||||
oneFormBatch: [
|
||||
{
|
||||
image: '',
|
||||
|
@ -458,7 +460,7 @@ export default {
|
|||
watch: {
|
||||
'formValidate.attr': {
|
||||
handler: function(val) {
|
||||
if (this.formValidate.spec_type === 1) this.watCh(val)
|
||||
if (this.formValidate.spec_type === 1 && this.detailStatus) this.watCh(val)
|
||||
},
|
||||
immediate: false,
|
||||
deep: true
|
||||
|
@ -471,6 +473,47 @@ export default {
|
|||
|
||||
},
|
||||
methods: {
|
||||
handleMany(row,i,val){
|
||||
// row.detail[val] = row[i]
|
||||
// console.log('row',row);
|
||||
// console.log('i',i);
|
||||
// console.log(val);
|
||||
if(row[i]){
|
||||
this.detailStatus = false
|
||||
this.fatAttrValue.map((res,key)=>{
|
||||
console.log(row.detail[val])
|
||||
if(row.detail[val] == res.detail[val] && key!=0){
|
||||
//值
|
||||
res[i] = row[i]
|
||||
// detail的值
|
||||
res.detail[val] = row[i]
|
||||
//sku
|
||||
let skuValue = ''
|
||||
Object.keys(this.manyTabTit).map((res,i)=>{
|
||||
skuValue = skuValue?`${skuValue},${row[res]}`:`${skuValue}${row[res]}`
|
||||
})
|
||||
res['sku'] = skuValue
|
||||
}
|
||||
})
|
||||
this.ManyAttrValue = this.fatAttrValue
|
||||
row.detail[val] = row[i]
|
||||
row.detail[val] = row[i]
|
||||
let skuValue = ''
|
||||
Object.keys(this.manyTabTit).map((res,i)=>{
|
||||
skuValue = skuValue?`${skuValue},${row[res]}`:`${skuValue}${row[res]}`
|
||||
})
|
||||
row['sku'] = skuValue
|
||||
//处理attr
|
||||
let arrMode = []
|
||||
this.ManyAttrValue.forEach((res)=>{
|
||||
if(!arrMode.includes(res.detail[val])){
|
||||
arrMode.push(res.detail[val])
|
||||
}
|
||||
})
|
||||
this.formValidate.attr.find(res=>res.value == this.manyTabTit[i].title).detail = arrMode
|
||||
}
|
||||
|
||||
},
|
||||
// 占比值变化处理
|
||||
proportionChange(val,i,e){
|
||||
val.cost = toFixedNoRounding(val.price * e)
|
||||
|
@ -612,12 +655,17 @@ export default {
|
|||
tmpTab['value' + i] = ''
|
||||
})
|
||||
this.ManyAttrValue = this.attrFormat(val)
|
||||
console.log(this.ManyAttrValue)
|
||||
this.fatAttrValue = this.attrFormat(val)
|
||||
this.ManyAttrValue.forEach((val, index) => {
|
||||
const key = Object.values(val.detail).sort().join('/')
|
||||
if (this.attrInfo[key]) this.ManyAttrValue[index] = this.attrInfo[key]
|
||||
val.image = this.formValidate.image
|
||||
})
|
||||
this.fatAttrValue.forEach((val, index) => {
|
||||
const key = Object.values(val.detail).sort().join('/')
|
||||
if (this.attrInfo[key]) this.fatAttrValue[index] = this.attrInfo[key]
|
||||
val.image = this.formValidate.image
|
||||
})
|
||||
this.attrInfo = {}
|
||||
this.ManyAttrValue.forEach((val) => {
|
||||
if (val.detail !== 'undefined' && val.detail !== null) {
|
||||
|
@ -626,6 +674,7 @@ export default {
|
|||
})
|
||||
this.manyTabTit = tmp
|
||||
this.manyTabDate = tmpTab
|
||||
console.log(this.manyTabTit);
|
||||
this.formThead = Object.assign({}, this.formThead, tmp)
|
||||
},
|
||||
attrFormat(arr) {
|
||||
|
@ -739,7 +788,7 @@ export default {
|
|||
this.OneattrValue = info.attrValue
|
||||
} else {
|
||||
this.ManyAttrValue = info.attrValue
|
||||
console.log(this.ManyAttrValue);
|
||||
this.fatAttrValue = info.attrValue
|
||||
this.ManyAttrValue.forEach(val => {
|
||||
if (val.detail !== 'undefined' && val.detail !== null) {
|
||||
this.attrInfo[
|
||||
|
|
Loading…
Reference in New Issue