Commit bb370a2f authored by zhengke's avatar zhengke

修改

parent 859ed366
......@@ -64,8 +64,7 @@
<div class="app-attr">
<div class="box">
<el-form label-width="180px">
<el-checkbox v-model="attrBatch" @change="selectClick" style="position:absolute">全选
</el-checkbox>
<el-checkbox v-model="attrBatch" @change="selectClick">全选</el-checkbox>
<el-form-item label="批量设置" size="small" style="margin-bottom:0;padding:18px 0;display:inline-block;">
<el-input @keyup.enter.native="batchAttr()" size="small" type="number" v-model="batchNum">
<el-select v-model="selectData" slot="prepend">
......@@ -103,7 +102,7 @@
<tbody>
<tr v-for="(rootItem,rootIndex) in groupPriceList" :key="rootIndex">
<td>
<el-checkbox v-model="rootItem.isChecked" @change="getCheck()"></el-checkbox>
<el-checkbox v-model="rootItem.isChecked" @change="getCheck(rootItem)"></el-checkbox>
</td>
<template v-for="(attrItem, attrIndex) in attrGroups">
<td v-if="attrIndex == index2" v-for="(item2, index2) in rootItem.AttrList" :key="index2">
......@@ -136,22 +135,27 @@
}],
selectData: '',
//批量设置价格
batchNum: ''
batchNum: '',
number:0
};
},
created() {
if(this.groupPriceList&&this.groupPriceList.length>0){
this.groupPriceList.forEach(x => {
x.isChecked=false;
});
}
},
methods: {
//单选
getCheck(item){
var num=0;
this.groupPriceList.forEach(x => {
if(x.isChecked=true){
num++;
}
});
if(num==this.groupPriceList.length){
this.$forceUpdate();
if(item.isChecked){
this.number++
}else{
this.number--
}
if(this.number==this.groupPriceList.length){
this.attrBatch=true;
}else{
this.attrBatch=false;
......@@ -159,9 +163,11 @@
},
//点击全选
selectClick() {
this.number=0;
if(this.attrBatch){
this.groupPriceList.forEach(x => {
x.isChecked=true;
this.number++;
});
}else{
this.groupPriceList.forEach(x => {
......@@ -171,24 +177,23 @@
},
//点击批量设置确定
batchAttr() {
this.groupPriceList.forEach(x=>{
if(x.isChecked){
if(this.selectData==0){
x.PinTuanPrice=this.batchNum;
}
if(this.selectData==1){
x.PinTuanStock=this.batchNum;
if(this.number==0){
this.Error('请选择需要设置的项');
}else{
this.groupPriceList.forEach(x=>{
if(x.isChecked){
if(this.selectData==0){
x.PinTuanPrice=this.batchNum;
}
if(this.selectData==1){
x.PinTuanStock=this.batchNum;
}
}
}
})
})
}
}
},
mounted() {
if(this.groupPriceList&&this.groupPriceList.length>0){
this.groupPriceList.forEach(x => {
x.isChecked=false;
});
}
},
computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment