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

优化细粒度价格操作功能

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