feature(uniapp商品): 多规格新增
This commit is contained in:
parent
8ad1439fda
commit
edfe379848
@ -52,9 +52,8 @@
|
|||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
circle
|
circle
|
||||||
class="spec-delete"
|
class="spec-delete"
|
||||||
@click="dynamicSpec.splice(index, 1)"
|
@click="removeSpec(index)"
|
||||||
></el-button>
|
></el-button>
|
||||||
|
|
||||||
<div class="spec-header">
|
<div class="spec-header">
|
||||||
规格项:
|
规格项:
|
||||||
<el-select v-model="specs.specId" filterable placeholder="请选择" @change="changeSpec">
|
<el-select v-model="specs.specId" filterable placeholder="请选择" @change="changeSpec">
|
||||||
@ -286,10 +285,15 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
this.getListCategory();
|
this.getListCategory();
|
||||||
this.getPropertyPageList();
|
this.getPropertyPageList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
removeSpec(index){
|
||||||
|
this.dynamicSpec.splice(index, 1);
|
||||||
|
this.changeRadio()
|
||||||
|
},
|
||||||
async confirmLeave(active, old){
|
async confirmLeave(active, old){
|
||||||
await this.$refs[old].validate((valid) => {
|
await this.$refs[old].validate((valid) => {
|
||||||
console.log(valid)
|
console.log(valid)
|
||||||
@ -306,12 +310,13 @@ export default {
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
changeRadio() {
|
changeRadio() {
|
||||||
this.$refs.ratesTable.doLayout()
|
this.$refs.ratesTable.doLayout();
|
||||||
if (this.ratesForm.spec == 1) {
|
if (this.ratesForm.spec == 1) {
|
||||||
this.ratesForm.rates = [{}]
|
this.ratesForm.rates = [{}]
|
||||||
} else {
|
} else {
|
||||||
this.ratesForm.rates = []
|
this.ratesForm.rates = []
|
||||||
if (this.dynamicSpec.length > 0) {
|
if (this.dynamicSpec.length > 0) {
|
||||||
|
console.log( this.dynamicSpec)
|
||||||
this.buildRatesFormRates()
|
this.buildRatesFormRates()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,12 +365,16 @@ export default {
|
|||||||
if (this.ratesForm.spec == 2) {
|
if (this.ratesForm.spec == 2) {
|
||||||
rates.forEach(r => {
|
rates.forEach(r => {
|
||||||
let properties = []
|
let properties = []
|
||||||
Array.of(r.spec).forEach((v, i) => {
|
Array.of(r.spec).forEach(s => {
|
||||||
let specValue = this.dynamicSpec[i].specValue.find(o => o.name == v);
|
Array.of(s).forEach((v, i) => {
|
||||||
let propertie = {};
|
console.log(this.dynamicSpec, r, s, v, i)
|
||||||
propertie.propertyId = this.dynamicSpec[i].specId;
|
let specValue = this.dynamicSpec[i].specValue.find(o => o.name == v);
|
||||||
propertie.valueId = specValue.id;
|
console.log(specValue)
|
||||||
properties.push(propertie);
|
let propertie = {};
|
||||||
|
propertie.propertyId = this.dynamicSpec[i].specId;
|
||||||
|
propertie.valueId = specValue.id;
|
||||||
|
properties.push(propertie);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
r.properties = properties;
|
r.properties = properties;
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user