购物车商品添加商户名称

h5
wangdong 6 months ago
parent 0295d655ac
commit a6ae7f39b1
  1. 94
      pages/cart/index.vue
  2. 2
      pages/goods/detail.vue

@ -20,33 +20,40 @@
<!-- 购物车商品列表 --> <!-- 购物车商品列表 -->
<view v-if="list.length" class="cart-list"> <view v-if="list.length" class="cart-list">
<view class="cart-item" v-for="(item, index) in list" :key="index"> <view class="cart-item" v-for="(item, index) in list" :key="index">
<view class="item-radio" @click="handleCheckItem(item.id)"> <view v-if="storeVersion == 1 && item.goods.merchant_id > 0 && item.goods.merchant" class="merchant-name" @click="toShop(item)">
<u-checkbox :modelValue="inArray(item.id, checkedIds)" shape="circle" <image :src="item.goods.merchant.logoImage && item.goods.merchant.logoImage[0].external_url" mode="aspectFill"></image>
:activeColor="appTheme.mainBg" /> <text>{{ '123456789' || item.goods.merchant.shop_name }}</text>
<image src="@/static/arrow-right.png" mode="aspectFill"></image>
</view> </view>
<view class="goods-image" @click="onTargetGoods(item.goods_id)"> <view>
<image class="image" :src="item.goods.goods_image" mode="scaleToFill"></image> <view class="item-radio" @click="handleCheckItem(item.id)">
</view> <u-checkbox :modelValue="inArray(item.id, checkedIds)" shape="circle"
<view class="item-content"> :activeColor="appTheme.mainBg" />
<view class="goods-title" @click="onTargetGoods(item.goods_id)">
<text class="twoline-hide">{{ item.goods.goods_name }}</text>
</view> </view>
<view class="goods-props clearfix"> <view class="goods-image" @click="onTargetGoods(item.goods_id)">
<view class="goods-props-item" v-for="(props, idx) in item.goods.skuInfo.goods_props" <image class="image" :src="item.goods.goods_image" mode="scaleToFill"></image>
:key="idx">
<text>{{ props.value.name }}</text>
</view>
</view> </view>
<view class="item-foot"> <view class="item-content">
<view class="goods-price"> <view class="goods-title" @click="onTargetGoods(item.goods_id)">
<text class="unit"></text> <text class="twoline-hide">{{ item.goods.goods_name }}</text>
<text </view>
class="value">{{ item.goods.skuInfo.goods_price?Number(item.goods.skuInfo.goods_price):item.goods.skuInfo.goods_price }}</text> <view class="goods-props clearfix">
<view class="goods-props-item" v-for="(props, idx) in item.goods.skuInfo.goods_props"
:key="idx">
<text>{{ props.value.name }}</text>
</view>
</view> </view>
<view class="stepper"> <view class="item-foot">
<u-number-box :min="1" class='countNumber' :modelValue="item.goods_num" :step="1" <view class="goods-price">
@change="onChangeStepper($event, item)" /> <text class="unit"></text>
<text
class="value">{{ item.goods.skuInfo.goods_price?Number(item.goods.skuInfo.goods_price):item.goods.skuInfo.goods_price }}</text>
</view>
<view class="stepper">
<u-number-box :min="1" class='countNumber' :modelValue="item.goods_num" :step="1"
@change="onChangeStepper($event, item)" />
</view>
</view> </view>
</view> </view>
</view> </view>
@ -240,6 +247,13 @@
totalPrice: '0.00' totalPrice: '0.00'
} }
}, },
computed: {
storeVersion() {
const version = uni.getStorageSync('storeVersion') == 1 ? 1 : 0;
console.log(version);
return version;
}
},
watch: { watch: {
// //
checkedIds: { checkedIds: {
@ -449,7 +463,13 @@
app.getCartList() app.getCartList()
app.handleToggleMode() app.handleToggleMode()
}) })
} },
toShop(item) {
uni.navigateTo({
url: `/pages/shopList/shopPage?id=${item.goods.merchant_id}`,
})
},
} }
} }
@ -633,10 +653,34 @@
.cart-item { .cart-item {
background: #fff; background: #fff;
border-radius: 12rpx; border-radius: 12rpx;
display: flex;
align-items: center;
padding: 30rpx 16rpx; padding: 30rpx 16rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
.merchant-name {
font-size: 30rpx;
color: #333;
font-weight: bold;
>text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: calc(100% - 73rpx);
}
>image {
margin-left: 10rpx;
width: 13rpx;
height: 24rpx;
flex-shrink: 0;
&:first-child {
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
}
}
}
>view {
display: flex;
align-items: center;
}
.item-radio { .item-radio {
width: 56rpx; width: 56rpx;

@ -138,7 +138,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-if="storeVersion == 1 && goods.merchant_id > 0" class="merchant-info" @click="toShop()"> <view v-if="storeVersion == 1 && goods.merchant_id > 0 && goods.merchant" class="merchant-info" @click="toShop()">
<image :src="goods.merchant.logoImage && goods.merchant.logoImage[0].external_url" mode="aspectFill"></image> <image :src="goods.merchant.logoImage && goods.merchant.logoImage[0].external_url" mode="aspectFill"></image>
<view class="info-box"> <view class="info-box">
<view class="info-name"> <view class="info-name">

Loading…
Cancel
Save