|
|
|
@ -25,24 +25,33 @@
|
|
|
|
|
<!-- 购物车商品列表 -->
|
|
|
|
|
<template v-else >
|
|
|
|
|
<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"
|
|
|
|
|
:checked="checkedIds.length ? checkedIds.includes(item.id) : false" />
|
|
|
|
|
:checked="checkedIds.length ? checkedIds.includes(item.id) : false"
|
|
|
|
|
:disabled="item.status !== 'normal'"/>
|
|
|
|
|
</label>
|
|
|
|
|
<image class="cart-item--image" :src="item.product.mainPicture" mode="scaleToFill"
|
|
|
|
|
@click="$Router.push(`/goodsDetail?id=${item.productId}`)"></image>
|
|
|
|
|
<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--props">{{ item.productSku.name }}</view>
|
|
|
|
|
<view class="cart-item--footer">
|
|
|
|
|
<UiMoney class="cart-item--price" :money="item.productSku.sellPrice" prefix></UiMoney>
|
|
|
|
|
<view class="cart-item--stepper">
|
|
|
|
|
<u-number-box :min="1" button-size="40rpx" bgColor="#F5F6FA"
|
|
|
|
|
:value="item.number" :max="item.maxBuyNum" @change="onChangeStepper($event, item)" >
|
|
|
|
|
<text slot="minus" class="cart-item--stepper-icon">-</text>
|
|
|
|
|
<text slot="plus" class="cart-item--stepper-icon">+</text>
|
|
|
|
|
</u-number-box>
|
|
|
|
|
<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--footer">
|
|
|
|
|
<UiMoney class="cart-item--price" :money="item.productSku.sellPrice" prefix></UiMoney>
|
|
|
|
|
<view class="cart-item--stepper">
|
|
|
|
|
<u-number-box :min="1" button-size="40rpx" bgColor="#F5F6FA"
|
|
|
|
|
:value="item.number" :max="item.maxBuyNum" @change="onChangeStepper($event, item)" >
|
|
|
|
|
<text slot="minus" class="cart-item--stepper-icon">-</text>
|
|
|
|
|
<text slot="plus" class="cart-item--stepper-icon">+</text>
|
|
|
|
|
</u-number-box>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<view>
|
|
|
|
|
<UiButton size="small" class="cart-item--reset-btn" type="line">重新选择</UiButton>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</UiWhiteBox>
|
|
|
|
@ -170,6 +179,9 @@ export default {
|
|
|
|
|
const maxBuyNum = singleBuyLimit ? Math.min(singleBuyLimit, stock || 1) : stock
|
|
|
|
|
return {
|
|
|
|
|
...item,
|
|
|
|
|
status : item.product.isEnable ?
|
|
|
|
|
(!item.productSku || item.productSku.stock == 0) ? 'notSku': 'normal' :
|
|
|
|
|
'isDisable',
|
|
|
|
|
maxBuyNum
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -236,7 +248,10 @@ export default {
|
|
|
|
|
/**
|
|
|
|
|
* 选中商品
|
|
|
|
|
*/
|
|
|
|
|
handleCheckItem(cartId) {
|
|
|
|
|
handleCheckItem(cartId, status) {
|
|
|
|
|
if(status !== 'normal'){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const { checkedIds } = this
|
|
|
|
|
const index = checkedIds.findIndex(id => id === cartId)
|
|
|
|
|
index < 0 ? checkedIds.push(cartId) : checkedIds.splice(index, 1)
|
|
|
|
@ -246,8 +261,9 @@ export default {
|
|
|
|
|
* 全选事件
|
|
|
|
|
*/
|
|
|
|
|
handleCheckAll() {
|
|
|
|
|
const { checkedIds, list } = this
|
|
|
|
|
this.checkedIds = checkedIds.length === list.length ? [] : list.map(item => item.id)
|
|
|
|
|
const { checkedIds, list } = this;
|
|
|
|
|
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;
|
|
|
|
|
-webkit-box-orient:vertical;
|
|
|
|
|
-webkit-line-clamp:2;
|
|
|
|
|
&__disabled{
|
|
|
|
|
color: $color-grey3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -404,6 +423,10 @@ export default {
|
|
|
|
|
height:40rpx;
|
|
|
|
|
margin: 0 14rpx;
|
|
|
|
|
}
|
|
|
|
|
&--reset-btn{
|
|
|
|
|
margin-top: 22rpx;
|
|
|
|
|
float: right;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 空数据按钮
|
|
|
|
|