提交 3ae861da authored 作者: 吴德鹏's avatar 吴德鹏

修改sku bug

上级 dd176d68
...@@ -95,43 +95,44 @@ let vm = new Vue({ ...@@ -95,43 +95,44 @@ let vm = new Vue({
//2020年5月20日 商品参数 //2020年5月20日 商品参数
paramster: [], paramster: [],
show_paste_btn:false,// 粘贴按钮 show_paste_btn: false,// 粘贴按钮
paste_modal:false, paste_modal: false,
showQuitHint:false, showQuitHint: false,
// 细粒度价格控制, // 细粒度价格控制,
handleProductAttr_Batch:[], handleProductAttr_Batch: [],
}, },
methods: { methods: {
//保存批量操作价格的数据 //保存批量操作价格的数据
saveBatchDataPrice(e) { saveBatchDataPrice(e) {
if(this.batchAmount&&this.batchCount){ if (this.batchAmount && this.batchCount) {
let _this = this; let _this = this;
function handlePrice(){
let arr = [],combinationArr=[],attr_first=''; function handlePrice() {
_this.handleProductAttr_Batch.map( item => { let arr = [], combinationArr = [], attr_first = '';
item.categoryDescArr.map( _item => { _this.handleProductAttr_Batch.map(item => {
_item.isSelected?arr.push(_item.name):void(0); item.categoryDescArr.map(_item => {
_item.isSelected ? arr.push(_item.name) : void (0);
}) })
}) })
if(_this.handleProductAttr_Batch.length === 2){ if (_this.handleProductAttr_Batch.length === 2) {
attr_first = arr.shift(); attr_first = arr.shift();
} }
arr.forEach( item => { arr.forEach(item => {
if(_this.handleProductAttr_Batch.length === 2){ if (_this.handleProductAttr_Batch.length === 2) {
combinationArr.push(attr_first + '/' + item); combinationArr.push(attr_first + '/' + item);
}else{ } else {
combinationArr.push(item); combinationArr.push(item);
} }
}); });
let str = combinationArr.join('/'); let str = combinationArr.join('/');
if(_this.handleProductAttr_Batch.length === 3){ if (_this.handleProductAttr_Batch.length === 3) {
combinationArr = []; combinationArr = [];
combinationArr.push(str); combinationArr.push(str);
} }
_this.prevItem.map( item => { _this.prevItem.map(item => {
combinationArr.map( _item => { combinationArr.map(_item => {
if(item.skuDesc === _item){ if (item.skuDesc === _item) {
item.skuCount = _this.batchCount; item.skuCount = _this.batchCount;
item.skuPrice = _this.batchAmount; item.skuPrice = _this.batchAmount;
_this.$forceUpdate(); _this.$forceUpdate();
...@@ -140,37 +141,38 @@ let vm = new Vue({ ...@@ -140,37 +141,38 @@ let vm = new Vue({
}) })
_this.$Message.info('应用成功'); _this.$Message.info('应用成功');
} }
if(e === 'use'){
if (e === 'use') {
handlePrice(); handlePrice();
}else{ } else {
handlePrice(); handlePrice();
this.showBatch = false; this.showBatch = false;
} }
}else{ } else {
alert('请先设置价格和库存'); alert('请先设置价格和库存');
} }
}, },
handleClickProductAttr_Batch(e,index,parent_index){ handleClickProductAttr_Batch(e, index, parent_index) {
if(this.handleProductAttr_Batch.length === 2){ if (this.handleProductAttr_Batch.length === 2) {
if( parent_index === 0 ){ if (parent_index === 0) {
this.handleProductAttr_Batch[parent_index].categoryDescArr.map( item => item.isSelected = false) this.handleProductAttr_Batch[parent_index].categoryDescArr.map(item => item.isSelected = false)
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true; this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true;
this.$forceUpdate(); this.$forceUpdate();
}else{ } else {
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = !this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected; this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = !this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected;
this.$forceUpdate(); this.$forceUpdate();
} }
}else{ } else {
this.handleProductAttr_Batch[parent_index].categoryDescArr.map( item => item.isSelected = false) this.handleProductAttr_Batch[parent_index].categoryDescArr.map(item => item.isSelected = false)
this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true; this.handleProductAttr_Batch[parent_index].categoryDescArr[index].isSelected = true;
this.$forceUpdate(); this.$forceUpdate();
} }
}, },
//预览 //预览
preview(e,to) { preview(e, to) {
if(to === 'pc'){ if (to === 'pc') {
window.open(`https://www.afrieshop.com/product_detail?pid=${e}&from=backstage management system&from_fullPath=${window.location.herf}`, '_blank'); window.open(`https://www.afrieshop.com/product_detail?pid=${e}&from=backstage management system&from_fullPath=${window.location.herf}`, '_blank');
}else{ } else {
window.open(`https://m.afrieshop.com/#/home/product?id=${e}`, '_blank'); window.open(`https://m.afrieshop.com/#/home/product?id=${e}`, '_blank');
} }
}, },
...@@ -192,6 +194,9 @@ let vm = new Vue({ ...@@ -192,6 +194,9 @@ let vm = new Vue({
item.isSelected ? activeImgPath = item.img_path : null; item.isSelected ? activeImgPath = item.img_path : null;
}); });
this.allAttributes.forEach(item => { this.allAttributes.forEach(item => {
console.log('456789', item.isSelected)
console.log('amount', this.batchAmount)
console.log('count', this.batchCount)
if (item.isSelected) { if (item.isSelected) {
item.amount = this.batchAmount; item.amount = this.batchAmount;
item.count = this.batchCount; item.count = this.batchCount;
...@@ -228,8 +233,8 @@ let vm = new Vue({ ...@@ -228,8 +233,8 @@ let vm = new Vue({
}, },
//显示批量处理模态框 //显示批量处理模态框
showBatchModel() { showBatchModel() {
this.$refs.amount.$el.children[1].value = this.batchAmount = null; // this.$refs.amount.$el.children[1].value = this.batchAmount = null;
this.$refs.count.$el.children[1].value = this.batchCount = null; // this.$refs.count.$el.children[1].value = this.batchCount = null;
this.showBatch = true; this.showBatch = true;
//获取所有具体属性 //获取所有具体属性
this.allAttributes = []; this.allAttributes = [];
...@@ -241,18 +246,18 @@ let vm = new Vue({ ...@@ -241,18 +246,18 @@ let vm = new Vue({
skuImg: null skuImg: null
})); }));
this.handleProductAttr_Batch = []; this.handleProductAttr_Batch = [];
this.attrItem.forEach( item => { this.attrItem.forEach(item => {
this.handleProductAttr_Batch.push({ this.handleProductAttr_Batch.push({
categoryDesc : item.categoryDesc, categoryDesc: item.categoryDesc,
categoryName : item.categoryName categoryName: item.categoryName
}); });
}) })
this.handleProductAttr_Batch.forEach( item => { this.handleProductAttr_Batch.forEach(item => {
item.categoryDesc = item.categoryDesc.split(','); item.categoryDesc = item.categoryDesc.split(',');
item.categoryDescArr = []; item.categoryDescArr = [];
item.categoryDesc.forEach( _item => { item.categoryDesc.forEach(_item => {
item.categoryDescArr.push({ item.categoryDescArr.push({
name:_item, name: _item,
isSelected: false isSelected: false
}) })
}) })
...@@ -329,7 +334,9 @@ let vm = new Vue({ ...@@ -329,7 +334,9 @@ let vm = new Vue({
successCallback: function (r) { successCallback: function (r) {
if (r.code === 0) { if (r.code === 0) {
that.Goodstype2 = r.list that.Goodstype2 = r.list
e?setTimeout(()=>{that.changeGoodstype2()},0):void(0); e ? setTimeout(() => {
that.changeGoodstype2()
}, 0) : void (0);
if (r.list.length === 0) { if (r.list.length === 0) {
that.tbCfStationItem.itemCategorytwo = null that.tbCfStationItem.itemCategorytwo = null
} }
...@@ -358,7 +365,7 @@ let vm = new Vue({ ...@@ -358,7 +365,7 @@ let vm = new Vue({
vm.reload(); vm.reload();
}, },
add: function () { add: function () {
window.sessionStorage.getItem('_copy_product_info') ? this.show_paste_btn = true : void(0); window.sessionStorage.getItem('_copy_product_info') ? this.show_paste_btn = true : void (0);
this.AttributeImgArr.length = 0; this.AttributeImgArr.length = 0;
this.paramster.length = 0; this.paramster.length = 0;
this.paramster.push( this.paramster.push(
...@@ -385,7 +392,7 @@ let vm = new Vue({ ...@@ -385,7 +392,7 @@ let vm = new Vue({
UE.getEditor('itemDesc').setContent(""); UE.getEditor('itemDesc').setContent("");
}, },
update: function (event) { update: function (event) {
window.sessionStorage.getItem('_copy_product_info') ? this.show_paste_btn = true : void(0); window.sessionStorage.getItem('_copy_product_info') ? this.show_paste_btn = true : void (0);
this.disabledChangeAttribute = true; this.disabledChangeAttribute = true;
this.prevItem = []; this.prevItem = [];
let itemId = getSelectedRow("#jqGrid"); let itemId = getSelectedRow("#jqGrid");
...@@ -424,7 +431,7 @@ let vm = new Vue({ ...@@ -424,7 +431,7 @@ let vm = new Vue({
this.$set(vm.tbCfStationItem, 'tree', this.attrItem) this.$set(vm.tbCfStationItem, 'tree', this.attrItem)
let _this = this; let _this = this;
let _temArr = []; let _temArr = [];
$('#imgWrapper').children().each((item,element)=>{ $('#imgWrapper').children().each((item, element) => {
_temArr.push($(element).attr('data-img-path')) _temArr.push($(element).attr('data-img-path'))
}) })
vm.uploadList = _temArr; vm.uploadList = _temArr;
...@@ -932,27 +939,27 @@ let vm = new Vue({ ...@@ -932,27 +939,27 @@ let vm = new Vue({
this.paramster = arr; this.paramster = arr;
}, },
//复制 //复制
copy(){ copy() {
window.sessionStorage.setItem('_copy_product_info', window.sessionStorage.setItem('_copy_product_info',
JSON.stringify({ JSON.stringify({
search_keyword:this.tbCfStationItem.itemTags, search_keyword: this.tbCfStationItem.itemTags,
tags:this.isSelectedArr, tags: this.isSelectedArr,
spe:this.tbCfStationItem.supplier, spe: this.tbCfStationItem.supplier,
catagory:{ catagory: {
level_one:this.tbCfStationItem.itemCategory, level_one: this.tbCfStationItem.itemCategory,
level_two:this.tbCfStationItem.itemCategorytwo, level_two: this.tbCfStationItem.itemCategorytwo,
level_three:this.tbCfStationItem.itemDescritionId, level_three: this.tbCfStationItem.itemDescritionId,
}, },
product_paramster:this.paramster product_paramster: this.paramster
}) })
) )
this.$Message.success('复制成功 0.0'); this.$Message.success('复制成功 0.0');
}, },
paste(){ paste() {
this.paste_modal = true; this.paste_modal = true;
}, },
comfirmPaste(){ comfirmPaste() {
this.paste_modal = false; this.paste_modal = false;
this.$Message.success('粘贴成功 0.0'); this.$Message.success('粘贴成功 0.0');
let _paste_data = null; let _paste_data = null;
...@@ -966,7 +973,7 @@ let vm = new Vue({ ...@@ -966,7 +973,7 @@ let vm = new Vue({
this.tbCfStationItem.itemDescritionId = _paste_data.catagory.level_three || null; this.tbCfStationItem.itemDescritionId = _paste_data.catagory.level_three || null;
this.paramster = _paste_data.product_paramster; this.paramster = _paste_data.product_paramster;
}, },
quit(){ quit() {
//清除未保存商品的图片 //清除未保存商品的图片
if (!vm.tbCfStationItem.itemId) { if (!vm.tbCfStationItem.itemId) {
this.AttributeImgArr.map((item, index) => { this.AttributeImgArr.map((item, index) => {
...@@ -1004,8 +1011,8 @@ let vm = new Vue({ ...@@ -1004,8 +1011,8 @@ let vm = new Vue({
}) })
}) })
}, },
mounted(){ mounted() {
this.$nextTick(()=>{ this.$nextTick(() => {
new Sortable(imgWrapper, { new Sortable(imgWrapper, {
swapThreshold: 1, swapThreshold: 1,
animation: 150, animation: 150,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论