修改点击选择规格没反应的bug

This commit is contained in:
赵毅 2025-09-02 14:57:45 +08:00
parent a3980c4470
commit 1a3fd2c137

View File

@ -369,8 +369,19 @@ export default {
this.topShow = !this.topShow; this.topShow = !this.topShow;
}, },
// //
chooseGG(e) { chooseGG(targetItems) {
e.isShow = !e.isShow; // tagList""1
for (let i = 1; i < this.tagList.length; i++) {
const tagItem = this.tagList[i];
const infoIndex = tagItem.commodity_info_list.findIndex(item => item.id === targetItems.id);
if (infoIndex > -1) {
//
const currentItem = tagItem.commodity_info_list[infoIndex];
this.$set(currentItem, 'isShow', !currentItem.isShow);
console.log("修改后数据源中的isShow:", currentItem.isShow);
break;
}
}
}, },
// //
searchPage() { searchPage() {
@ -378,7 +389,6 @@ export default {
}, },
// //
goods(e) { goods(e) {
console.log(`${JSON.stringify(e)}`);
NavgateTo(`../goods/index?item=${JSON.stringify(e)}`); NavgateTo(`../goods/index?item=${JSON.stringify(e)}`);
// NavgateTo("../goods/index"); // NavgateTo("../goods/index");
}, },
@ -418,26 +428,25 @@ export default {
user_id: uni.getStorageSync("userId"), user_id: uni.getStorageSync("userId"),
id: this.secondId, id: this.secondId,
}).then((res) => { }).then((res) => {
console.log(123); //
console.log(res) const commodityList = JSON.parse(JSON.stringify(res.commodity_list));
res.commodity_list.forEach((item) => { commodityList.forEach((tagItem) => { //
item.commodity_info_list.forEach((item) => { tagItem.commodity_info_list.forEach((infoItem) => { //
item.commodity_goods_info_list.forEach((param) => { // isShow
this.$set(infoItem, 'isShow', false);
infoItem.commodity_goods_info_list.forEach((param) => {
this.goodsDetail.forEach((goods) => { this.goodsDetail.forEach((goods) => {
if (goods.goods_id === param.id) { if (goods.goods_id === param.id) {
param.quantity = goods.count; this.$set(param, 'quantity', goods.count); // $set
} }
}); });
}); });
item.isShow = false;
}); });
}); });
// this.originalTagList = commodityList;
this.originalTagList = res.commodity_list; this.tagList1 = commodityList;
this.tagList1 = res.commodity_list; // tagList使
// "" this.tagList = [{ id: 'all', tag_name: '全部' }, ...commodityList];
this.tagList = [{ id: 'all', tag_name: '全部' }, ...res.commodity_list];
// ""
this.rightTopActive = 0; this.rightTopActive = 0;
this.selectedTagId = 'all'; this.selectedTagId = 'all';
}); });
@ -445,7 +454,6 @@ export default {
getShopCarList() { getShopCarList() {
request(apiArr.getCar, "POST").then((res) => { request(apiArr.getCar, "POST").then((res) => {
console.log(res);
this.carNum = res.total; this.carNum = res.total;
// //
this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list) this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list)