wangfukang 1 month ago
parent
commit
d5c91061f4
  1. 33
      src/views/app/shop/dictManage.vue

33
src/views/app/shop/dictManage.vue

@ -208,11 +208,13 @@
<Col span="6">
<FormItem label="商品属性" class="form-noheight">
<div style="display: flex;flex-direction: column;">
<div v-for="(value,key) in Array.from(addGoodsForm.attributeList1)" style="display: flex;">
<div v-for="(value,key) in Array.from(addGoodsForm.attributeList1)" style="display: flex;align-items:center;margin-bottom:5px;">
{{value[0]}}:
<div v-for="(item,index) in value[1].title">
{{item}}
</div>
<span style="margin-left:8px;color:#888;">可选:</span>
<Input v-model="value[1].canbuy" type="number" style="width:60px;margin-left:4px;" placeholder="1" @on-change="onCanbuyChange(value[0], value[1].canbuy)" />
</div>
<div @click="checkSpec('shuxing')" style="width: 80px;height: 30px;text-align: center;line-height: 30px;background: #008ba0;color:#fff;">
选择属性
@ -611,6 +613,14 @@
};
},
methods: {
onCanbuyChange(categoryName, value){
// Mapcanbuy
let entry = this.addGoodsForm.attributeList1.get(categoryName)
if(entry){
entry.canbuy = parseInt(value) || 1
this.addGoodsForm.attributeList1.set(categoryName, entry)
}
},
init(v) {
this.shopId = v.id
this.searchForm.shopId = v.id
@ -777,7 +787,7 @@
if(this.attrValueArr.length>0){
let index1 = false
for (var m = 0; m < this.attrValueArr.length; m++) {
if(this.attrValueArr[m].title == this.categorySonData[i].title){
if(this.attrValueArr[m].title == this.categorySonData[i].title && this.attrValueArr[m].parentName == this.typeToAttrName){
index1 = true
this.categorySonData[i].checked = true
}
@ -857,20 +867,27 @@
},
guigeSubmit(){
if(this.modalclassType == 'shuxing'){
// canbuy
let oldCanbuyMap = {}
this.addGoodsForm.attributeList1.forEach((value, key) => {
oldCanbuyMap[key] = value.canbuy || 1
})
for(let i=0;i<this.attrValueArr.length;i++){
if(this.addGoodsForm.attributeList1.size == 0){
//set has get
let data = {
title:[]
title:[],
canbuy: oldCanbuyMap[this.attrValueArr[i].parentName] || 1
}
data.title.push(this.attrValueArr[i].title)
this.addGoodsForm.attributeList1.set(this.attrValueArr[i].parentName,data)
}else{
if(this.addGoodsForm.attributeList1.has(this.attrValueArr[i].parentName) && this.addGoodsForm.attributeList1.get(this.attrValueArr[i].parentName).title.indexOf(this.attrValueArr[i].title) == -1){
this.addGoodsForm.attributeList1.get(this.attrValueArr[i].parentName).title.push(this.attrValueArr[i].title)
}else{
}else if(!this.addGoodsForm.attributeList1.has(this.attrValueArr[i].parentName)){
let data = {
title:[]
title:[],
canbuy: oldCanbuyMap[this.attrValueArr[i].parentName] || 1
}
data.title.push(this.attrValueArr[i].title)
this.addGoodsForm.attributeList1.set(this.attrValueArr[i].parentName,data)
@ -1140,6 +1157,12 @@
}
this.addGoodsForm.attributeList1 = JSON.parse(this.addGoodsForm.attributeList)
this.addGoodsForm.attributeList1 = new Map(Object.entries(this.addGoodsForm.attributeList1));
// canbuy1
this.addGoodsForm.attributeList1.forEach((value, key) => {
if(value.canbuy === undefined || value.canbuy === null){
value.canbuy = 1
}
});
this.addGoodsForm.attributeListPrice = JSON.parse(this.addGoodsForm.attributeListPrice)
this.addGoodsForm.attributeList1.forEach((value, key) => {

Loading…
Cancel
Save