Commit bb370a2f authored by zhengke's avatar zhengke

修改

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