<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.name }}</view>
|
|
<view class="voucher-row voucher-time">{{ `${data.startTime}-${data.endTime}` }}</view>
|
|
<view class="voucher-row voucher-desc">{{ data.desc }}</view>
|
|
</view>
|
|
|
|
<template v-if="!readonly">
|
|
<button palin class="btn" @click="onClick">立即使用</button>
|
|
</template>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
const TEST_DATA = {
|
|
id: '001',
|
|
name: '【会员礼】50元代金券',
|
|
startTime: '2025.03.12',
|
|
endTime: '2025.09.12',
|
|
desc: '只可在线下门店使用',
|
|
}
|
|
|
|
export default {
|
|
props: {
|
|
data: {
|
|
type: Object,
|
|
default() {
|
|
return TEST_DATA
|
|
}
|
|
},
|
|
readonly: {
|
|
type: Boolean,
|
|
default: false,
|
|
}
|
|
},
|
|
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>
|