|
|
@ -25,14 +25,18 @@
|
|
|
|
<!-- 购物车商品列表 -->
|
|
|
|
<!-- 购物车商品列表 -->
|
|
|
|
<template v-else >
|
|
|
|
<template v-else >
|
|
|
|
<UiWhiteBox class="cart-item" v-for="(item, index) in list" :key="index" >
|
|
|
|
<UiWhiteBox class="cart-item" v-for="(item, index) in list" :key="index" >
|
|
|
|
<label class="cart-item--radio" @click.stop="handleCheckItem(item.id)">
|
|
|
|
<label class="cart-item--radio" @click.stop="handleCheckItem(item.id, item.status)">
|
|
|
|
<radio class="radio" color="#FF875B"
|
|
|
|
<radio class="radio" color="#FF875B"
|
|
|
|
:checked="checkedIds.length ? checkedIds.includes(item.id) : false" />
|
|
|
|
:checked="checkedIds.length ? checkedIds.includes(item.id) : false"
|
|
|
|
|
|
|
|
:disabled="item.status !== 'normal'"/>
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
<image class="cart-item--image" :src="item.product.mainPicture" mode="scaleToFill"
|
|
|
|
<image class="cart-item--image" :src="item.product.mainPicture" mode="scaleToFill"
|
|
|
|
@click="$Router.push(`/goodsDetail?id=${item.productId}`)"></image>
|
|
|
|
@click="$Router.push(`/goodsDetail?id=${item.productId}`)"></image>
|
|
|
|
<view class="cart-item--content" @click="$Router.push(`/goodsDetail?id=${item.productId}`)">
|
|
|
|
<view class="cart-item--content" @click="$Router.push(`/goodsDetail?id=${item.productId}`)">
|
|
|
|
<view class="cart-item--title">{{ item.product.name }}</view>
|
|
|
|
<view class="cart-item--title" :class="item.status !== 'normal' && 'cart-item--title__disabled'">{{ item.product.name }}</view>
|
|
|
|
|
|
|
|
<view v-if="item.status === 'notSku'" class="cart-item--props">请重新选择商品规格</view>
|
|
|
|
|
|
|
|
<view v-if="item.status === 'isDisable'" class="cart-item--props">宝贝已失效,暂时无法购买</view>
|
|
|
|
|
|
|
|
<template v-if="item.status === 'normal'">
|
|
|
|
<view class="cart-item--props">{{ item.productSku.name }}</view>
|
|
|
|
<view class="cart-item--props">{{ item.productSku.name }}</view>
|
|
|
|
<view class="cart-item--footer">
|
|
|
|
<view class="cart-item--footer">
|
|
|
|
<UiMoney class="cart-item--price" :money="item.productSku.sellPrice" prefix></UiMoney>
|
|
|
|
<UiMoney class="cart-item--price" :money="item.productSku.sellPrice" prefix></UiMoney>
|
|
|
@ -44,6 +48,11 @@
|
|
|
|
</u-number-box>
|
|
|
|
</u-number-box>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<view>
|
|
|
|
|
|
|
|
<UiButton size="small" class="cart-item--reset-btn" type="line">重新选择</UiButton>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</UiWhiteBox>
|
|
|
|
</UiWhiteBox>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -170,6 +179,9 @@ export default {
|
|
|
|
const maxBuyNum = singleBuyLimit ? Math.min(singleBuyLimit, stock || 1) : stock
|
|
|
|
const maxBuyNum = singleBuyLimit ? Math.min(singleBuyLimit, stock || 1) : stock
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
...item,
|
|
|
|
|
|
|
|
status : item.product.isEnable ?
|
|
|
|
|
|
|
|
(!item.productSku || item.productSku.stock == 0) ? 'notSku': 'normal' :
|
|
|
|
|
|
|
|
'isDisable',
|
|
|
|
maxBuyNum
|
|
|
|
maxBuyNum
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -236,7 +248,10 @@ export default {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 选中商品
|
|
|
|
* 选中商品
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
handleCheckItem(cartId) {
|
|
|
|
handleCheckItem(cartId, status) {
|
|
|
|
|
|
|
|
if(status !== 'normal'){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
const { checkedIds } = this
|
|
|
|
const { checkedIds } = this
|
|
|
|
const index = checkedIds.findIndex(id => id === cartId)
|
|
|
|
const index = checkedIds.findIndex(id => id === cartId)
|
|
|
|
index < 0 ? checkedIds.push(cartId) : checkedIds.splice(index, 1)
|
|
|
|
index < 0 ? checkedIds.push(cartId) : checkedIds.splice(index, 1)
|
|
|
@ -246,8 +261,9 @@ export default {
|
|
|
|
* 全选事件
|
|
|
|
* 全选事件
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
handleCheckAll() {
|
|
|
|
handleCheckAll() {
|
|
|
|
const { checkedIds, list } = this
|
|
|
|
const { checkedIds, list } = this;
|
|
|
|
this.checkedIds = checkedIds.length === list.length ? [] : list.map(item => item.id)
|
|
|
|
this.checkedIds = checkedIds.length === list.length ? [] :
|
|
|
|
|
|
|
|
list.filter(i => i.status == 'normal').map(item => item.id);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -374,6 +390,9 @@ export default {
|
|
|
|
display:-webkit-box;
|
|
|
|
display:-webkit-box;
|
|
|
|
-webkit-box-orient:vertical;
|
|
|
|
-webkit-box-orient:vertical;
|
|
|
|
-webkit-line-clamp:2;
|
|
|
|
-webkit-line-clamp:2;
|
|
|
|
|
|
|
|
&__disabled{
|
|
|
|
|
|
|
|
color: $color-grey3;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -404,6 +423,10 @@ export default {
|
|
|
|
height:40rpx;
|
|
|
|
height:40rpx;
|
|
|
|
margin: 0 14rpx;
|
|
|
|
margin: 0 14rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&--reset-btn{
|
|
|
|
|
|
|
|
margin-top: 22rpx;
|
|
|
|
|
|
|
|
float: right;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 空数据按钮
|
|
|
|
// 空数据按钮
|
|
|
|