This commit is contained in:
zmj 2024-06-26 14:21:00 +08:00
parent 03657673fb
commit 317ad7c192
2 changed files with 12 additions and 10 deletions

View File

@ -34,13 +34,12 @@
<view class="title"> <view class="title">
<view class="name u-line-2">{{item.goods_name}}</view> <view class="name u-line-2">{{item.goods_name}}</view>
<view class="tip u-line-1">{{item.unit_name}}</view> <view class="tip u-line-1">{{item.unit_name}}</view>
<view class="tip u-line-1">原价<text <view v-if="priceKey.off_activity==1" class="tip u-line-1">原价<text
style="text-decoration: line-through;">{{item.unit_name}}</text> style="text-decoration: line-through;">{{item[priceKey.op_price]}}</text>
</view> </view>
</view> </view>
<view class="price-btn"> <view class="price-btn">
<view class="price">{{item.sell}}</view> <view class="price">{{item[priceKey.price]}}</view>
<view class="btn"> <view class="btn">
<view class="num">{{item.cart_num}}</view> <view class="num">{{item.cart_num}}</view>
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon> <u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
@ -54,7 +53,6 @@
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png"> icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty> </up-empty>
</view> </view>
{{priceKey}}
<view style="width: 100%;height: 200rpx;"></view> <view style="width: 100%;height: 200rpx;"></view>
</view> </view>
</scroll-view> </scroll-view>
@ -337,10 +335,13 @@
getcartList(); getcartList();
}) })
let priceKey = ref({}) let priceKey = ref({})
onLoad(opt => { onLoad(() => {
if (opt.priceKey) { if (uni.getStorageSync('PRICE_KEY')) {
priceKey.value = JSON.parse(opt.priceKey) priceKey.value = JSON.parse(uni.getStorageSync('PRICE_KEY'));
} else {
priceKey.value = {};
} }
}) })
</script> </script>

View File

@ -44,7 +44,7 @@
<up-search placeholder="请输入商品" @search="searchKeyword" @clear="searchKeyword" v-model="keyword" <up-search placeholder="请输入商品" @search="searchKeyword" @clear="searchKeyword" v-model="keyword"
:showAction="false"></up-search> :showAction="false"></up-search>
</view> </view>
<view class="nav-item" @click="navTo(`/pages/cart/cart?priceKey=${JSON.stringify(priceKey) }`)"> <view class="nav-item" @click="navTo(`/pages/cart/cart`)">
<image src="@/static/tab/ba.png"></image> <image src="@/static/tab/ba.png"></image>
<text>购物车</text> <text>购物车</text>
</view> </view>
@ -222,7 +222,7 @@
<view class="btn"> <view class="btn">
<up-button color="#20b128" :disabled="cartInfo.pay_price<=0" @click="settleAccounts"> 结算</up-button> <up-button color="#20b128" :disabled="cartInfo.pay_price<=0" @click="settleAccounts"> 结算</up-button>
</view> </view>
<view class="cart" @click="navTo(`/pages/cart/cart?priceKey=${JSON.stringify(priceKey)}`)"> <view class="cart" @click="navTo(`/pages/cart/cart`)">
<image src="@/static/icon/cart.png"></image> <image src="@/static/icon/cart.png"></image>
<view class="badge">{{ cartInfo.count }}</view> <view class="badge">{{ cartInfo.count }}</view>
</view> </view>
@ -465,6 +465,7 @@
for (let key in res.data.extend) { for (let key in res.data.extend) {
priceKey[key] = res.data.extend[key] priceKey[key] = res.data.extend[key]
} }
uni.setStorageSync("PRICE_KEY", JSON.stringify(priceKey))
console.log(priceKey) console.log(priceKey)
if (loadmore) goodList.value.push(...res.data.lists); if (loadmore) goodList.value.push(...res.data.lists);
else goodList.value = res.data.lists; else goodList.value = res.data.lists;