|
@@ -1,11 +1,10 @@
|
|
|
<script setup lang="ts">
|
|
|
import Card from '@/components/card.vue'
|
|
|
-import { Coupon } from '../../../core/libs/models'
|
|
|
+import { Coupon, CouponStatus } from '../../../core/libs/models'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { useMessage } from 'wot-design-uni'
|
|
|
import used from '@designer-hub/assets/src/libs/assets/used'
|
|
|
-import invalid from '@designer-hub/assets/src/libs/assets/invalid'
|
|
|
import expired from '@designer-hub/assets/src/libs/assets/expired'
|
|
|
+import invalid from '@designer-hub/assets/src/libs/assets/invalid'
|
|
|
|
|
|
const props = withDefaults(
|
|
|
defineProps<{ options?: Coupon; canSelect?: boolean; selected?: boolean }>(),
|
|
@@ -18,7 +17,7 @@ const emits = defineEmits<{ select: [coupon: Coupon]; clickInstruction: [coupon:
|
|
|
</script>
|
|
|
<template>
|
|
|
<Card custom-class="mx-3.5">
|
|
|
- <div class="relative">
|
|
|
+ <div class="relative" @click="emits('select', options)">
|
|
|
<div class="flex gap-3">
|
|
|
<div class="w-[94px] h-[94px] bg-[#f6f6f6] rounded-2.5 overflow-hidden">
|
|
|
<template v-if="options.couponType === 1">
|
|
@@ -58,21 +57,31 @@ const emits = defineEmits<{ select: [coupon: Coupon]; clickInstruction: [coupon:
|
|
|
</div>
|
|
|
<div
|
|
|
class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal flex items-center"
|
|
|
- @click="emits('clickInstruction', options)"
|
|
|
+ @click.stop="emits('clickInstruction', options)"
|
|
|
>
|
|
|
使用说明
|
|
|
<wd-icon name="arrow-right" size="14"></wd-icon>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex items-center" v-if="canSelect" @click="emits('select', options)">
|
|
|
+ <div class="flex items-center" v-if="canSelect">
|
|
|
<div
|
|
|
class="w-4 h-4 rounded-full border border-black/60 border-solid"
|
|
|
:class="`${selected ? 'bg-black' : ''}`"
|
|
|
></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="absolute top--4 right--4">
|
|
|
- <wd-img width="58" height="58" :src="options.isUse ? used : options.isValid ? invalid : expired"></wd-img>
|
|
|
+ <div v-if="options.couponStatus !== CouponStatus.NOT_USE" class="absolute top--4 right--4">
|
|
|
+ <wd-img
|
|
|
+ width="58"
|
|
|
+ height="58"
|
|
|
+ :src="
|
|
|
+ {
|
|
|
+ [CouponStatus.HAVE_USE]: used,
|
|
|
+ [CouponStatus.EXPIRED]: expired,
|
|
|
+ [CouponStatus.BECAME_INVALID]: invalid,
|
|
|
+ }[options.couponStatus]
|
|
|
+ "
|
|
|
+ ></wd-img>
|
|
|
</div>
|
|
|
</div>
|
|
|
</Card>
|