|
@@ -1,8 +1,67 @@
|
|
import { defineComponent } from 'vue'
|
|
import { defineComponent } from 'vue'
|
|
|
|
+import styles from './index.module.less'
|
|
|
|
+import dayjs from 'dayjs'
|
|
|
|
+import { Checkbox } from 'vant'
|
|
|
|
+import activeIcon from './images/activeIcon.png'
|
|
|
|
+import inactiveIcon from './images/inactiveIcon.png'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'coupon-item',
|
|
name: 'coupon-item',
|
|
|
|
+ props: {
|
|
|
|
+ item: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default: {}
|
|
|
|
+ },
|
|
|
|
+ isSelect: {
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: false
|
|
|
|
+ },
|
|
|
|
+ onClick: {
|
|
|
|
+ type: Function,
|
|
|
|
+ default: (item: any) => {}
|
|
|
|
+ }
|
|
|
|
+ },
|
|
render() {
|
|
render() {
|
|
- return <>优惠券</>
|
|
|
|
|
|
+ const item: any = this.item
|
|
|
|
+ return (
|
|
|
|
+ <div
|
|
|
|
+ class={[
|
|
|
|
+ styles.item,
|
|
|
|
+ styles[item.useState],
|
|
|
|
+ this.isSelect && styles.select,
|
|
|
|
+ item.disabled && styles.disabled
|
|
|
|
+ ]}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ if (item.disabled) return
|
|
|
|
+ this.onClick(item)
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <img
|
|
|
|
+ class={styles['img-icon']}
|
|
|
|
+ src={item.checked ? activeIcon : inactiveIcon}
|
|
|
|
+ />
|
|
|
|
+ <div class={styles.top}>
|
|
|
|
+ <div class={styles.price}>
|
|
|
|
+ <span class={styles.suffix}>¥</span>
|
|
|
|
+ <span>{item.discountPrice}</span>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class={styles.type}>{item.name}</div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class={styles.bottom}>
|
|
|
|
+ <div class={styles.condition}>
|
|
|
|
+ <span class={styles.conditionTag}>满{item.useLimit}可用</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div class={styles.useTime}>
|
|
|
|
+ 有效期:{dayjs(item.startTime).format('YYYY.MM.DD')}~
|
|
|
|
+ {dayjs(item.endTime).format('YYYY.MM.DD')}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ {item.useState === 'USED' && <div class={styles.iconUsed}></div>}
|
|
|
|
+ {item.useState === 'EXPIRED' && <div class={styles.iconExpired}></div>}
|
|
|
|
+ </div>
|
|
|
|
+ )
|
|
}
|
|
}
|
|
})
|
|
})
|