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 @@ - +