优化购物车页面

This commit is contained in:
TOP糯米 2023-04-09 22:41:02 +08:00
parent 9a92cdf1f0
commit 68f0622384
1 changed files with 31 additions and 25 deletions

View File

@ -84,38 +84,44 @@ export default {
cart: (state) => state.cart.cart,
}),
},
onLoad() {},
async onShow() {
await this.$store.dispatch("cart/update");
this.list = [];
this.cart.list.forEach((item) => {
let goods = [];
item.good.forEach((v) => {
goods.push({
id: v.gid,
name: v.title,
times: v.post_hits,
cover: v.thumbnail,
price: v.money,
number: v.number,
checked: false,
});
});
this.list.push({
name: item.cate,
total: 0,
list: goods,
checked: false,
canUse: false,
});
});
onLoad() {
this.initPage();
},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
onShareTimeline() {},
onShareAppMessage() {},
methods: {
/**
* 初始化页面
*/
async initPage() {
await this.$store.dispatch("cart/update");
this.list = [];
this.cart.list.forEach((item) => {
let goods = [];
item.good.forEach((v) => {
goods.push({
id: v.gid,
name: v.title,
times: v.post_hits,
cover: v.thumbnail,
price: v.money,
number: v.number,
checked: false,
});
});
this.list.push({
name: item.cate,
total: 0,
list: goods,
checked: false,
canUse: false,
});
});
},
/**
* 选中组
*/