|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<view class="voucher"> |
|
|
|
<image class="voucher-bg" src="@/pages_order/static/voucher/voucher-bg.png" ></image> |
|
|
|
<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> |
|
|
@ -10,7 +10,7 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- status: 0-未使用 1-已使用 --> |
|
|
|
<template v-if="!readonly && data.status == 0"> |
|
|
|
<template v-if="!readonly && data.status == 0 && isValid"> |
|
|
|
<button plain class="btn" @click="onClick">立即使用</button> |
|
|
|
</template> |
|
|
|
</view> |
|
|
@ -18,6 +18,11 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
import dayjs from 'dayjs' |
|
|
|
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore' |
|
|
|
|
|
|
|
dayjs.extend(isSameOrBefore) |
|
|
|
|
|
|
|
export default { |
|
|
|
props: { |
|
|
|
data: { |
|
|
@ -40,6 +45,11 @@ export default { |
|
|
|
|
|
|
|
return `${startTime}-${endTime}` |
|
|
|
}, |
|
|
|
isValid() { |
|
|
|
const { validDate } = this.data || {} |
|
|
|
|
|
|
|
return dayjs().isSameOrBefore(dayjs(validDate), 'day') |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onClick() { |
|
|
|