This commit is contained in:
ylj20011123 2025-05-30 09:13:59 +08:00
parent a4e5f926d2
commit 4f1b9bcbe7
60 changed files with 180 additions and 80 deletions

View File

@ -709,9 +709,10 @@ export default {
//
handleDeleteItem(obj) {
console.log('obj',obj)
console.log('this.shopList',this.shopList)
let list = [];
this.shopList.forEach((item) => {
if (item.COMMODITY_CODE !== obj.COMMODITY_CODE) {
if (item.COMMODITY_ID !== obj.COMMODITY_ID) {
list.push(item);
}else{
if(obj.RTCOMMODITY_MULTI_ID){
@ -722,7 +723,7 @@ export default {
list.push(item);
}
}else{
list.push(item);
// list.push(item);
}
}
});

View File

@ -627,9 +627,13 @@ export default {
this.$refs.shopPopup.close();
},
//
handleChangeSelectSKULIST(value) {
handleChangeSelectSKULIST(value, obj) {
console.log("value", value);
this.good.COMMODITY_RULE = value;
// this.good.COMMODITY_RULE = value;
this.good.COMMODITY_RULE = obj.COMMODITY_NAME;
this.good.RTCOMMODITY_MULTI_ID = value;
this.good.COMMODITY_MEMBERPRICE = obj.COMMODITY_MEMBERPRICE
this.good.COMMODITY_PURCHASEPRICE = obj.COMMODITY_PURCHASEPRICE
console.log("this.good", this.good);
},
//
@ -757,23 +761,67 @@ export default {
}
console.log("this.good", this.good);
console.log('this.shopCarList', this.shopCarList);
if (this.shopCarList && this.shopCarList.length > 0) {
let nowShopList = [];
//
let isSame = false;
let list = JSON.parse(JSON.stringify(this.shopCarList));
console.log('listlistlistlist', list);
this.shopCarList.forEach((item) => {
if (item.COMMODITY_BARCODE === this.good.COMMODITY_BARCODE) {
item.count += this.good.count;
item.COMMODITY_RULE = this.good.COMMODITY_RULE;
isSame = true;
// if (item.COMMODITY_BARCODE === this.good.COMMODITY_BARCODE) {
// item.count += this.good.count;
// item.COMMODITY_RULE = this.good.COMMODITY_RULE;
// isSame = true;
// }
// id
if (this.good.RTCOMMODITY_MULTI_ID) {
let filterRuleList = list.filter(
(item) => item.RTCOMMODITY_MULTI_ID === this.good.RTCOMMODITY_MULTI_ID
);
//
if (filterRuleList && filterRuleList.length > 0) {
if (item.COMMODITY_ID === this.good.COMMODITY_ID) {
item.count = this.good.count;
}
isSame = true;
} else {
list.push({ ...this.good });
// nowShopList.forEach((item) => {
// if (item.COMMODITY_ID === this.good.COMMODITY_ID) {
// item.count = this.good.count;
// }
// });
}
} else {
if (item.COMMODITY_ID === this.good.COMMODITY_ID) {
item.count = this.good.count;
isSame = true;
} else {
list.push({ ...this.good });
}
}
// nowShopList.forEach((item) => {
// if (item.COMMODITY_ID === this.good.COMMODITY_ID) {
// item.count = this.good.count;
// }
// });
});
if (isSame) {
nowShopList = this.shopCarList;
// nowShopList = this.shopCarList;
nowShopList = list
} else {
this.shopCarList.push(this.good);
nowShopList = this.shopCarList;
// this.shopCarList.push(this.good);
// list.push(this.good);
// nowShopList = this.shopCarList;
nowShopList = list;
}
console.log('nowShopListnowShopListnowShopList', nowShopList);
this.shopCarList = nowShopList
if (this.pageType === "UnionMall") {
this.$store.commit("unionMyShopCar", nowShopList);
} else {
@ -781,7 +829,9 @@ export default {
}
} else {
let nowShopList = [];
nowShopList.push(this.good);
let good = JSON.parse(JSON.stringify(this.good))
nowShopList.push(good);
this.shopCarList = [good]
if (this.pageType === "UnionMall") {
this.$store.commit("unionMyShopCar", nowShopList);
} else {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -676,9 +676,10 @@ var _default = {
// 左滑出现的删除
handleDeleteItem: function handleDeleteItem(obj) {
console.log('obj', obj);
console.log('this.shopList', this.shopList);
var list = [];
this.shopList.forEach(function (item) {
if (item.COMMODITY_CODE !== obj.COMMODITY_CODE) {
if (item.COMMODITY_ID !== obj.COMMODITY_ID) {
list.push(item);
} else {
if (obj.RTCOMMODITY_MULTI_ID) {
@ -687,7 +688,7 @@ var _default = {
list.push(item);
}
} else {
list.push(item);
// list.push(item);
}
}
});

View File

@ -417,9 +417,13 @@ var _default = {
this.$refs.shopPopup.close();
},
// 改变当前选中的规格
handleChangeSelectSKULIST: function handleChangeSelectSKULIST(value) {
handleChangeSelectSKULIST: function handleChangeSelectSKULIST(value, obj) {
console.log("value", value);
this.good.COMMODITY_RULE = value;
// this.good.COMMODITY_RULE = value;
this.good.COMMODITY_RULE = obj.COMMODITY_NAME;
this.good.RTCOMMODITY_MULTI_ID = value;
this.good.COMMODITY_MEMBERPRICE = obj.COMMODITY_MEMBERPRICE;
this.good.COMMODITY_PURCHASEPRICE = obj.COMMODITY_PURCHASEPRICE;
console.log("this.good", this.good);
},
// 点击的锚点
@ -542,23 +546,65 @@ var _default = {
return;
}
console.log("this.good", this.good);
console.log('this.shopCarList', this.shopCarList);
if (this.shopCarList && this.shopCarList.length > 0) {
var nowShopList = [];
// 判断有没有一样的
var isSame = false;
var list = JSON.parse(JSON.stringify(this.shopCarList));
console.log('listlistlistlist', list);
this.shopCarList.forEach(function (item) {
if (item.COMMODITY_BARCODE === _this4.good.COMMODITY_BARCODE) {
item.count += _this4.good.count;
item.COMMODITY_RULE = _this4.good.COMMODITY_RULE;
isSame = true;
// if (item.COMMODITY_BARCODE === this.good.COMMODITY_BARCODE) {
// item.count += this.good.count;
// item.COMMODITY_RULE = this.good.COMMODITY_RULE;
// isSame = true;
// }
// 先看看有没有规格id 如果选了规格 不一样规格 算不同的商品
if (_this4.good.RTCOMMODITY_MULTI_ID) {
var filterRuleList = list.filter(function (item) {
return item.RTCOMMODITY_MULTI_ID === _this4.good.RTCOMMODITY_MULTI_ID;
});
// 如果有一样规格的 就替换值 没有 就等于新增商品
if (filterRuleList && filterRuleList.length > 0) {
if (item.COMMODITY_ID === _this4.good.COMMODITY_ID) {
item.count = _this4.good.count;
}
isSame = true;
} else {
list.push(_objectSpread({}, _this4.good));
// nowShopList.forEach((item) => {
// if (item.COMMODITY_ID === this.good.COMMODITY_ID) {
// item.count = this.good.count;
// }
// });
}
} else {
if (item.COMMODITY_ID === _this4.good.COMMODITY_ID) {
item.count = _this4.good.count;
isSame = true;
} else {
list.push(_objectSpread({}, _this4.good));
}
}
// nowShopList.forEach((item) => {
// if (item.COMMODITY_ID === this.good.COMMODITY_ID) {
// item.count = this.good.count;
// }
// });
});
if (isSame) {
nowShopList = this.shopCarList;
// nowShopList = this.shopCarList;
nowShopList = list;
} else {
this.shopCarList.push(this.good);
nowShopList = this.shopCarList;
// this.shopCarList.push(this.good);
// list.push(this.good);
// nowShopList = this.shopCarList;
nowShopList = list;
}
console.log('nowShopListnowShopListnowShopList', nowShopList);
this.shopCarList = nowShopList;
if (this.pageType === "UnionMall") {
this.$store.commit("unionMyShopCar", nowShopList);
} else {
@ -566,7 +612,9 @@ var _default = {
}
} else {
var _nowShopList = [];
_nowShopList.push(this.good);
var good = JSON.parse(JSON.stringify(this.good));
_nowShopList.push(good);
this.shopCarList = [good];
if (this.pageType === "UnionMall") {
this.$store.commit("unionMyShopCar", _nowShopList);
} else {