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

修改sku bug

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