提交 bbfe8ff7 authored 作者: 潘鹏's avatar 潘鹏

优化细粒度价格操作功能

上级 120d40a3
...@@ -106,37 +106,44 @@ let vm = new Vue({ ...@@ -106,37 +106,44 @@ let vm = new Vue({
//保存批量操作价格的数据 //保存批量操作价格的数据
saveBatchDataPrice(e) { saveBatchDataPrice(e) {
if(this.batchAmount&&this.batchCount){ if(this.batchAmount&&this.batchCount){
if(e === 'use'){ let _this = this;
let arr = []; function handlePrice(){
this.handleProductAttr_Batch.map( item => { let arr = [],combinationArr=[],attr_first='';
_this.handleProductAttr_Batch.map( item => {
item.categoryDescArr.map( _item => { item.categoryDescArr.map( _item => {
_item.isSelected?arr.push(_item.name):void(0); _item.isSelected?arr.push(_item.name):void(0);
}) })
}) })
let str = arr.join('/'); if(_this.handleProductAttr_Batch.length === 2){
this.prevItem.map( item => { attr_first = arr.shift();
if(item.skuDesc === str){ }
item.skuCount = this.batchCount; arr.forEach( item => {
item.skuPrice = this.batchAmount; if(_this.handleProductAttr_Batch.length === 2){
this.$forceUpdate(); combinationArr.push(attr_first + '/' + item);
this.$Message.info('应用成功'); }else{
combinationArr.push(item);
} }
}) });
}else{ let str = combinationArr.join('/');
let arr = []; if(_this.handleProductAttr_Batch.length === 3){
this.handleProductAttr_Batch.map( item => { combinationArr = [];
item.categoryDescArr.map( _item => { combinationArr.push(str);
_item.isSelected?arr.push(_item.name):void(0); }
_this.prevItem.map( item => {
combinationArr.map( _item => {
if(item.skuDesc === _item){
item.skuCount = _this.batchCount;
item.skuPrice = _this.batchAmount;
_this.$forceUpdate();
}
}) })
}) })
let str = arr.join('/'); _this.$Message.info('应用成功');
this.prevItem.map( item => { }
if(item.skuDesc === str){ if(e === 'use'){
item.skuCount = this.batchCount; handlePrice();
item.skuPrice = this.batchAmount; }else{
this.$forceUpdate(); handlePrice();
}
})
this.showBatch = false; this.showBatch = false;
} }
}else{ }else{
...@@ -144,9 +151,20 @@ let vm = new Vue({ ...@@ -144,9 +151,20 @@ let vm = new Vue({
} }
}, },
handleClickProductAttr_Batch(e,index,parent_index){ handleClickProductAttr_Batch(e,index,parent_index){
this.handleProductAttr_Batch[parent_index].categoryDescArr.map( item => item.isSelected = false) if(this.handleProductAttr_Batch.length === 2){
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true; if( parent_index === 0 ){
this.$forceUpdate(); this.handleProductAttr_Batch[parent_index].categoryDescArr.map( item => item.isSelected = false)
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true;
this.$forceUpdate();
}else{
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = !this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected;
this.$forceUpdate();
}
}else{
this.handleProductAttr_Batch[parent_index].categoryDescArr.map( item => item.isSelected = false)
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true;
this.$forceUpdate();
}
}, },
//预览 //预览
preview(e,to) { preview(e,to) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论