购物车商品添加商户名称

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 class="cart-item" v-for="(item, index) in list" :key="index">
<view class="item-radio" @click="handleCheckItem(item.id)">
<u-checkbox :modelValue="inArray(item.id, checkedIds)" shape="circle"
:activeColor="appTheme.mainBg" />
<view v-if="storeVersion == 1 && item.goods.merchant_id > 0 && item.goods.merchant" class="merchant-name" @click="toShop(item)">
<image :src="item.goods.merchant.logoImage && item.goods.merchant.logoImage[0].external_url" mode="aspectFill"></image>
<text>{{ '123456789' || item.goods.merchant.shop_name }}</text>
<image src="@/static/arrow-right.png" mode="aspectFill"></image>
</view>
<view class="goods-image" @click="onTargetGoods(item.goods_id)">
<image class="image" :src="item.goods.goods_image" mode="scaleToFill"></image>
</view>
<view class="item-content">
<view class="goods-title" @click="onTargetGoods(item.goods_id)">
<text class="twoline-hide">{{ item.goods.goods_name }}</text>
<view>
<view class="item-radio" @click="handleCheckItem(item.id)">
<u-checkbox :modelValue="inArray(item.id, checkedIds)" shape="circle"
:activeColor="appTheme.mainBg" />
</view>
<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 class="goods-image" @click="onTargetGoods(item.goods_id)">
<image class="image" :src="item.goods.goods_image" mode="scaleToFill"></image>
</view>
<view class="item-foot">
<view class="goods-price">
<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 class="item-content">
<view class="goods-title" @click="onTargetGoods(item.goods_id)">
<text class="twoline-hide">{{ item.goods.goods_name }}</text>
</view>
<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 class="stepper">
<u-number-box :min="1" class='countNumber' :modelValue="item.goods_num" :step="1"
@change="onChangeStepper($event, item)" />
<view class="item-foot">
<view class="goods-price">
<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>
@ -240,6 +247,13 @@
totalPrice: '0.00'
}
},
computed: {
storeVersion() {
const version = uni.getStorageSync('storeVersion') == 1 ? 1 : 0;
console.log(version);
return version;
}
},
watch: {
//
checkedIds: {
@ -449,7 +463,13 @@
app.getCartList()
app.handleToggleMode()
})
}
},
toShop(item) {
uni.navigateTo({
url: `/pages/shopList/shopPage?id=${item.goods.merchant_id}`,
})
},
}
}
@ -633,10 +653,34 @@
.cart-item {
background: #fff;
border-radius: 12rpx;
display: flex;
align-items: center;
padding: 30rpx 16rpx;
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 {
width: 56rpx;

@ -138,7 +138,7 @@
</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>
<view class="info-box">
<view class="info-name">

Loading…
Cancel
Save