From 68f06223848989213cd80fb256dc52298d6b3578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Sun, 9 Apr 2023 22:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/service/cart.vue | 56 +++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/pages/service/cart.vue b/src/pages/service/cart.vue index a5869f4..4a2ecdd 100644 --- a/src/pages/service/cart.vue +++ b/src/pages/service/cart.vue @@ -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, + }); + }); + }, /** * 选中组 */