<template>
|
|
<view class="voucher">
|
|
<image class="voucher-bg" src="@/pages_order/static/voucher/voucher-bg.png" ></image>
|
|
|
|
<view class="voucher-info">
|
|
<view class="voucher-row voucher-title">{{ data.vouchersId_dictText }}</view>
|
|
<!-- todo -->
|
|
<view class="voucher-row voucher-time">{{ validRange }}</view>
|
|
<view class="voucher-row voucher-desc">{{ data.desc ||'' }}</view>
|
|
</view>
|
|
|
|
<!-- status: 0-未使用 1-已使用 -->
|
|
<template v-if="!readonly && data.status == 0">
|
|
<button plain class="btn" @click="onClick">立即使用</button>
|
|
</template>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
props: {
|
|
data: {
|
|
type: Object,
|
|
default() {
|
|
return {}
|
|
}
|
|
},
|
|
readonly: {
|
|
type: Boolean,
|
|
default: false,
|
|
}
|
|
},
|
|
computed: {
|
|
validRange() {
|
|
const { createTime, validDate } = this.data || {}
|
|
|
|
let startTime = createTime ? this.$dayjs(createTime).format('YYYY.MM.DD') : '-'
|
|
let endTime = validDate ? this.$dayjs(validDate).format('YYYY.MM.DD') : '-'
|
|
|
|
return `${startTime}-${endTime}`
|
|
},
|
|
},
|
|
methods: {
|
|
onClick() {
|
|
this.$utils.navigateTo(`/pages_order/mine/verifyVoucher?id=${this.data.id}`)
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.voucher {
|
|
width: 100%;
|
|
height: 202rpx;
|
|
position: relative;
|
|
|
|
&-bg {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
&-info {
|
|
position: absolute;
|
|
top: 49rpx;
|
|
left: 253rpx;
|
|
|
|
color: $uni-color-light;
|
|
font-size: 18rpx;
|
|
}
|
|
|
|
&-row {
|
|
& + & {
|
|
margin-top: 6rpx;
|
|
}
|
|
}
|
|
|
|
&-title {
|
|
font-size: 28rpx;
|
|
font-weight: 900;
|
|
}
|
|
|
|
|
|
.btn {
|
|
position: absolute;
|
|
bottom: 39rpx;
|
|
right: 39rpx;
|
|
|
|
width: auto;
|
|
padding: 12rpx 29rpx;
|
|
color: $uni-text-color-inverse;
|
|
font-size: 18rpx;
|
|
line-height: 25rpx;
|
|
border-radius: 25rpx;
|
|
border: none;
|
|
background-image: linear-gradient(to right, #84A73F, #D8FF8F);
|
|
}
|
|
}
|
|
</style>
|