From 45489cd0c4e8b4f26a6c9d237e330590da64a61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=8C=E5=85=88=E8=88=9C?= <2499071264@qq.com> Date: Mon, 27 Jul 2026 18:31:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=85=A5=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supplied-h5/src/store/cart.js | 9 +- .../components/JoyfulSkuPopup.vue | 178 ++++++++++++++++++ .../joyful-selection/product-detail/index.vue | 27 ++- .../view/joyful-selection/products/index.vue | 117 +----------- 4 files changed, 216 insertions(+), 115 deletions(-) create mode 100644 supplied-h5/src/view/joyful-selection/components/JoyfulSkuPopup.vue diff --git a/supplied-h5/src/store/cart.js b/supplied-h5/src/store/cart.js index 68ce8fc..4e9dc8b 100644 --- a/supplied-h5/src/store/cart.js +++ b/supplied-h5/src/store/cart.js @@ -16,7 +16,8 @@ const saveCartItems = items => { export const useCartStore = defineStore('joyfulSelectionCart', { state: () => ({ - items: [] + items: [], + loaded: false }), getters: { totalCount: state => state.items.reduce((total, item) => total + Number(item.count || 0), 0), @@ -25,11 +26,17 @@ export const useCartStore = defineStore('joyfulSelectionCart', { actions: { loadCart() { this.items = readCartItems() + this.loaded = true }, persistCart() { saveCartItems(this.items) + this.loaded = true }, addItem(item) { + if (!this.loaded) { + this.loadCart() + } + const index = this.items.findIndex(cartItem => cartItem.cartId === item.cartId) if (index > -1) { diff --git a/supplied-h5/src/view/joyful-selection/components/JoyfulSkuPopup.vue b/supplied-h5/src/view/joyful-selection/components/JoyfulSkuPopup.vue new file mode 100644 index 0000000..b85b859 --- /dev/null +++ b/supplied-h5/src/view/joyful-selection/components/JoyfulSkuPopup.vue @@ -0,0 +1,178 @@ + + + + + diff --git a/supplied-h5/src/view/joyful-selection/product-detail/index.vue b/supplied-h5/src/view/joyful-selection/product-detail/index.vue index e3ff7da..9b28095 100644 --- a/supplied-h5/src/view/joyful-selection/product-detail/index.vue +++ b/supplied-h5/src/view/joyful-selection/product-detail/index.vue @@ -59,19 +59,27 @@ - + - - + + + + diff --git a/supplied-h5/src/view/joyful-selection/products/index.vue b/supplied-h5/src/view/joyful-selection/products/index.vue index fb41dc1..91b80c4 100644 --- a/supplied-h5/src/view/joyful-selection/products/index.vue +++ b/supplied-h5/src/view/joyful-selection/products/index.vue @@ -47,25 +47,13 @@ - +