<template>
|
|
<view class="flex card">
|
|
<view v-if="mode == 'edit'">
|
|
<uv-checkbox-group
|
|
v-model="checkboxValue"
|
|
shape="circle"
|
|
@change="onCheckChange"
|
|
>
|
|
<uv-checkbox
|
|
size="36rpx"
|
|
icon-size="36rpx"
|
|
activeColor="#7451DE"
|
|
:name="1"
|
|
></uv-checkbox>
|
|
</uv-checkbox-group>
|
|
</view>
|
|
<view class="flex right">
|
|
<view class="img-box">
|
|
<image class="img" :src="data.url" mode="aspectFit"></image>
|
|
</view>
|
|
<view class="info">
|
|
<view class="title">{{ data.name }}</view>
|
|
<view class="flex price-box">
|
|
<view class="flex price">¥<text class="highlight">{{ data.price.toFixed(2) }}</text></view>
|
|
</view>
|
|
<view class="flex tool">
|
|
<view class="flex count">
|
|
规格:<text class="highlight">{{ data.countDesc || data.count }}</text>
|
|
</view>
|
|
<view class="flex status">{{ statusDesc }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view v-if="data.customized" class="sup customized">
|
|
定制组合
|
|
</view>
|
|
<view v-else-if="data.free" class="sup free">
|
|
自定组合
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
const STATUS_AND_DESC_MAPPING = {
|
|
0: '待支付',
|
|
1: '待发货',
|
|
2: '待收货',
|
|
3: '待评价',
|
|
4: '已完成',
|
|
5: '售后',
|
|
}
|
|
|
|
export default {
|
|
props: {
|
|
data: {
|
|
type: Object,
|
|
default() {
|
|
return {}
|
|
}
|
|
},
|
|
mode: {
|
|
type: String,
|
|
default: 'read' // read | edit
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
checkboxValue : [],
|
|
}
|
|
},
|
|
computed: {
|
|
checked: {
|
|
set(val) {
|
|
this.checkboxValue = val ? [1] : []
|
|
|
|
if (this.data.selected == val) {
|
|
return
|
|
}
|
|
this.$emit('select', val)
|
|
},
|
|
get() {
|
|
return this.checkboxValue[0] == 1 ? true : false
|
|
}
|
|
},
|
|
statusDesc() {
|
|
return STATUS_AND_DESC_MAPPING[this.data.status]
|
|
},
|
|
},
|
|
watch: {
|
|
data: {
|
|
handler(val) {
|
|
this.checked = val.selected
|
|
},
|
|
immediate: true,
|
|
deep: true,
|
|
}
|
|
},
|
|
methods: {
|
|
onCheckChange(arr) {
|
|
this.checked = arr[0] == 1 ? true : false
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.card {
|
|
position: relative;
|
|
height: 240rpx;
|
|
padding: 0 32rpx;
|
|
background-image: linear-gradient(#FAFAFF, #F3F3F3);
|
|
border: 2rpx solid #FFFFFF;
|
|
border-radius: 32rpx;
|
|
box-sizing: border-box;
|
|
column-gap: 24rpx;
|
|
overflow: hidden;
|
|
|
|
/deep/ .uv-checkbox__label-wra {
|
|
padding: 0;
|
|
}
|
|
}
|
|
|
|
.right {
|
|
flex: 1;
|
|
column-gap: 24rpx;
|
|
}
|
|
|
|
.img {
|
|
&-box {
|
|
width: 144rpx;
|
|
height: 144rpx;
|
|
border-radius: 16rpx;
|
|
overflow: hidden;
|
|
}
|
|
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.info {
|
|
flex: 1;
|
|
font-family: PingFang SC;
|
|
font-weight: 400;
|
|
line-height: 1.4;
|
|
font-size: 26rpx;
|
|
color: #8B8B8B;
|
|
|
|
.title {
|
|
font-weight: 600;
|
|
font-size: 28rpx;
|
|
color: #000000;
|
|
}
|
|
|
|
.desc {
|
|
margin-top: 8rpx;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.price {
|
|
&-box {
|
|
margin-top: 8rpx;
|
|
justify-content: flex-start;
|
|
column-gap: 20rpx;
|
|
}
|
|
|
|
font-weight: 600;
|
|
font-size: 24rpx;
|
|
color: #7451DE;
|
|
|
|
.highlight {
|
|
margin: 0 8rpx;
|
|
font-size: 32rpx;
|
|
}
|
|
|
|
&-origin {
|
|
font-size: 28rpx;
|
|
line-height: 1;
|
|
text-decoration: line-through;
|
|
}
|
|
}
|
|
|
|
.tool {
|
|
margin-top: 8rpx;
|
|
justify-content: space-between;
|
|
|
|
.count {
|
|
.highlight {
|
|
margin: 0 8rpx;
|
|
color: #252545;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
padding: 8rpx 40rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 600;
|
|
font-size: 28rpx;
|
|
line-height: 1.5;
|
|
color: #FFFFFF;
|
|
background: #7451DE;
|
|
border-radius: 30rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.sup {
|
|
position: absolute;
|
|
top: 28rpx;
|
|
right: -60rpx;
|
|
padding: 5rpx 52rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
line-height: 1.5;
|
|
white-space: nowrap;
|
|
transform: rotate(45deg);
|
|
|
|
&.customized {
|
|
color: #FFFFFF;
|
|
background: #252545;
|
|
}
|
|
|
|
&.free {
|
|
color: #252545;
|
|
background: #D7D7FF;
|
|
}
|
|
}
|
|
</style>
|