diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue index e1881db..471900a 100644 --- a/pages/cart/cart.vue +++ b/pages/cart/cart.vue @@ -34,13 +34,12 @@ {{item.goods_name}} {{item.unit_name}} - 原价:¥{{item.unit_name}} + 原价:¥{{item[priceKey.op_price]}} - - ¥{{item.sell}} + ¥{{item[priceKey.price]}} {{item.cart_num}} @@ -54,7 +53,6 @@ icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png"> - {{priceKey}} @@ -337,10 +335,13 @@ getcartList(); }) let priceKey = ref({}) - onLoad(opt => { - if (opt.priceKey) { - priceKey.value = JSON.parse(opt.priceKey) + onLoad(() => { + if (uni.getStorageSync('PRICE_KEY')) { + priceKey.value = JSON.parse(uni.getStorageSync('PRICE_KEY')); + } else { + priceKey.value = {}; } + }) diff --git a/pages/index/index.vue b/pages/index/index.vue index 529337b..4e0e4fa 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -44,7 +44,7 @@ - + 购物车 @@ -222,7 +222,7 @@ 结算 - + {{ cartInfo.count }} @@ -465,6 +465,7 @@ for (let key in res.data.extend) { priceKey[key] = res.data.extend[key] } + uni.setStorageSync("PRICE_KEY", JSON.stringify(priceKey)) console.log(priceKey) if (loadmore) goodList.value.push(...res.data.lists); else goodList.value = res.data.lists;