fix: 更新 API 请求参数格式及优化组件样式

- 将 addEvaluation API 的参数从 params 修改为 data,以符合标准请求格式
- 在多个组件中调整样式,提升响应式布局和用户体验
- 优化商品详情页的倒计时显示,增强视觉效果
- 更新购物车操作按钮样式,提升一致性和可用性
This commit is contained in:
田香琪
2026-06-23 14:13:25 +08:00
parent 8a60e23214
commit 1b2e980fb6
26 changed files with 481 additions and 401 deletions

View File

@@ -82,6 +82,7 @@ export default {
data() {
return {
type: "multiple",
selectedList: [],
skuList: [],
total: 0,
goodsParams: {
@@ -106,8 +107,8 @@ export default {
this.goodsParams.categoryPath = val && val.length ? val.join(",") : "";
},
selectedWay: {
handler() {
this.$emit("selected", this.selectedWay);
handler(val) {
this.selectedList = Array.isArray(val) ? val.slice() : [];
},
deep: true,
immediate: true,
@@ -145,24 +146,29 @@ export default {
});
},
initGoods(res) {
if (res.result.records.length != 0) {
res.result.records.forEach((item) => {
const records = res?.result?.records || [];
if (records.length) {
records.forEach((item) => {
item.selected = false;
item.___type = "goods";
this.selectedWay.forEach((e) => {
this.selectedList.forEach((e) => {
if (e.id && e.id === item.id) {
item.selected = true;
}
});
});
this.total = res.result.total;
this.goodsData = res.result.records;
this.total = res.result.total || 0;
this.goodsData = records;
this.empty = false;
} else {
this.goodsData = [];
this.empty = true;
}
},
emitSelected(list) {
this.selectedList = list;
this.$emit("selected", this.selectedList);
},
init() {
API_Goods.getGoodsSkuData(this.goodsParams).then((res) => {
this.initGoods(res);
@@ -201,26 +207,20 @@ export default {
});
},
checkedGoods(val) {
if (this.type != "multiple") {
if (this.type !== "multiple") {
this.goodsData.forEach((item) => {
item.selected = false;
});
this.selectedWay = [];
val.selected = true;
this.selectedWay.push(val);
return false;
this.emitSelected([val]);
return;
}
if (val.selected == false) {
if (!val.selected) {
val.selected = true;
this.selectedWay.push(val);
this.emitSelected([...this.selectedList, val]);
} else {
val.selected = false;
for (let i = 0; i < this.selectedWay.length; i++) {
if (this.selectedWay[i].id === val.id) {
this.selectedWay.splice(i, 1);
break;
}
}
this.emitSelected(this.selectedList.filter((item) => item.id !== val.id));
}
},
},