hy-app 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/hy-action-sheet/index.scss +0 -5
- package/components/hy-avatar/hy-avatar.vue +4 -3
- package/components/hy-back-top/hy-back-top.vue +10 -9
- package/components/hy-back-top/props.ts +5 -3
- package/components/hy-badge/hy-badge.vue +5 -4
- package/components/hy-badge/index.scss +0 -1
- package/components/hy-badge/props.ts +11 -4
- package/components/hy-button/hy-button.vue +5 -5
- package/components/hy-button/index.scss +9 -0
- package/components/hy-button/props.ts +11 -6
- package/components/hy-coupon/hy-coupon.vue +159 -167
- package/components/hy-coupon/index.scss +135 -516
- package/components/hy-coupon/props.ts +101 -127
- package/components/hy-coupon/typing.d.ts +147 -146
- package/components/hy-datetime-picker/props.ts +1 -3
- package/components/hy-folding-panel/props.ts +1 -1
- package/components/hy-folding-panel/typing.d.ts +0 -38
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -5
- package/components/hy-folding-panel-item/index.scss +0 -8
- package/components/hy-folding-panel-item/typing.d.ts +14 -0
- package/components/hy-form-group/hy-form-group.vue +308 -511
- package/components/hy-form-group/index.scss +0 -33
- package/components/hy-form-group/props.ts +103 -13
- package/components/hy-form-group/typing.d.ts +0 -77
- package/components/hy-form-item/hy-form-item.vue +3 -3
- package/components/hy-icon/hy-icon.vue +3 -8
- package/components/hy-input/hy-input.vue +16 -10
- package/components/hy-input/index.scss +4 -0
- package/components/hy-input/props.ts +2 -2
- package/components/hy-list/props.ts +1 -1
- package/components/hy-notice-bar/hy-column-notice.vue +63 -70
- package/components/hy-notice-bar/hy-row-notice.vue +92 -110
- package/components/hy-notice-bar/index.scss +2 -4
- package/components/hy-notice-bar/props.ts +4 -1
- package/components/hy-notice-bar/typing.d.ts +2 -0
- package/components/hy-popup/hy-popup.vue +0 -1
- package/components/hy-qrcode/hy-qrcode.vue +69 -3
- package/components/hy-qrcode/index.scss +3 -3
- package/components/hy-qrcode/qrcode.js +1344 -1400
- package/components/hy-rate/hy-rate.vue +0 -1
- package/components/hy-read-more/hy-read-more.vue +1 -1
- package/components/hy-signature/hy-signature.vue +25 -22
- package/components/hy-signature/index.scss +0 -4
- package/components/hy-tabbar/hy-tabbar.vue +137 -0
- package/components/{hy-tabBar → hy-tabbar}/index.scss +30 -30
- package/components/hy-tabbar/props.ts +59 -0
- package/components/hy-tabbar/typing.d.ts +61 -0
- package/components/hy-tabbar-group/README.md +326 -0
- package/components/hy-tabbar-group/hy-tabbar-group.vue +87 -0
- package/components/hy-tabbar-group/index.scss +57 -0
- package/components/hy-tabbar-group/props.ts +78 -0
- package/components/hy-tabbar-group/typing.ts +16 -0
- package/components/hy-tabbar-item/hy-tabbar-item.vue +103 -0
- package/components/hy-tabbar-item/index.scss +43 -0
- package/components/hy-tabbar-item/props.ts +24 -0
- package/components/hy-tabbar-item/typing.ts +22 -0
- package/components/hy-tag/props.ts +8 -2
- package/components/hy-text/props.ts +8 -2
- package/components/hy-textarea/hy-textarea.vue +1 -1
- package/components/hy-textarea/index.scss +8 -7
- package/components/hy-textarea/props.ts +4 -1
- package/components/hy-toast/index.scss +2 -7
- package/components/hy-tooltip/props.ts +1 -3
- package/components/hy-upload/props.ts +1 -1
- package/components/index.ts +177 -177
- package/global.d.ts +87 -85
- package/libs/css/common.scss +0 -5
- package/libs/typing/modules/form.ts +159 -163
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-coupon/README.md +0 -133
- package/components/hy-tabBar/hy-tabBar.vue +0 -109
- package/components/hy-tabBar/props.ts +0 -13
- package/components/hy-tabBar/typing.d.ts +0 -54
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="hy-avatar" :class="avatarClass" :style="avatarStyle" @tap="clickHandler">
|
|
3
|
-
<slot>
|
|
3
|
+
<slot v-if="$slots.default"></slot>
|
|
4
|
+
<template v-else>
|
|
4
5
|
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
|
|
5
6
|
<open-data
|
|
6
7
|
v-if="mpAvatar && allowMp"
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
<!-- #ifndef MP-WEIXIN && MP-QQ && MP-BAIDU -->
|
|
17
18
|
<template v-if="mpAvatar && allowMp"></template>
|
|
18
19
|
<!-- #endif -->
|
|
19
|
-
<
|
|
20
|
+
<hy-icon v-else-if="icon" :name="icon" :size="fontSize" :color="color"></hy-icon>
|
|
20
21
|
<text
|
|
21
22
|
v-else-if="text"
|
|
22
23
|
:style="{
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
:mode="mode"
|
|
37
38
|
@error="errorHandler"
|
|
38
39
|
></image>
|
|
39
|
-
</
|
|
40
|
+
</template>
|
|
40
41
|
</view>
|
|
41
42
|
</template>
|
|
42
43
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
2
|
+
<hy-transition mode="fade" :customStyle="backTopStyle" :show="show">
|
|
3
|
+
<view class="hy-back-top" :style="contentStyle" @click="backToTop">
|
|
4
|
+
<!-- @slot 默认插槽 -->
|
|
5
|
+
<slot v-if="$slots.default"></slot>
|
|
6
|
+
<template v-else>
|
|
7
|
+
<hy-icon
|
|
7
8
|
:name="icon?.name || IconConfig.DOWNLOAD"
|
|
8
9
|
:color="icon?.color"
|
|
9
10
|
:size="icon?.size"
|
|
@@ -16,11 +17,11 @@
|
|
|
16
17
|
:stop="icon?.stop"
|
|
17
18
|
:round="icon?.round"
|
|
18
19
|
:customStyle="icon?.customStyle"
|
|
19
|
-
></
|
|
20
|
+
></hy-icon>
|
|
20
21
|
<text v-if="text" class="hy-back-top__text">{{ text }}</text>
|
|
21
|
-
</
|
|
22
|
-
</
|
|
23
|
-
</
|
|
22
|
+
</template>
|
|
23
|
+
</view>
|
|
24
|
+
</hy-transition>
|
|
24
25
|
</template>
|
|
25
26
|
|
|
26
27
|
<script lang="ts">
|
|
@@ -50,10 +50,12 @@ const backTopProps = {
|
|
|
50
50
|
/** 定义需要用到的外部样式 */
|
|
51
51
|
customStyle: {
|
|
52
52
|
type: Object as PropType<CSSProperties>,
|
|
53
|
-
default: {
|
|
53
|
+
default: () => ({
|
|
54
54
|
transform: 'rotate(180deg)'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
/** 自定义外部类名 */
|
|
58
|
+
customClass: String,
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
export default backTopProps
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
isDot ? 'hy-badge--dot' : 'hy-badge--not-dot',
|
|
7
7
|
inverted && 'hy-badge--inverted',
|
|
8
8
|
shape === 'horn' && 'hy-badge--horn',
|
|
9
|
-
`hy-badge--${type}${inverted ? '--inverted' : ''}
|
|
9
|
+
`hy-badge--${type}${inverted ? '--inverted' : ''}`,
|
|
10
|
+
customClass
|
|
10
11
|
]"
|
|
11
12
|
:style="[customStyle, badgeStyle]"
|
|
12
13
|
@tap="onClick"
|
|
@@ -46,9 +47,9 @@ const emit = defineEmits<IBadgeEmit>()
|
|
|
46
47
|
* @description 整个组件的样式
|
|
47
48
|
* */
|
|
48
49
|
const badgeStyle = computed<CSSProperties>(() => {
|
|
49
|
-
const style: CSSProperties = {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const style: CSSProperties = {
|
|
51
|
+
zIndex: props.zIndex,
|
|
52
|
+
color: props.color
|
|
52
53
|
}
|
|
53
54
|
if (props.bgColor && !props.inverted) {
|
|
54
55
|
style.backgroundColor = props.bgColor
|
|
@@ -8,7 +8,7 @@ const badgeProps = {
|
|
|
8
8
|
},
|
|
9
9
|
/** 显示的内容 */
|
|
10
10
|
value: {
|
|
11
|
-
type: Number,
|
|
11
|
+
type: [String, Number],
|
|
12
12
|
default: 0
|
|
13
13
|
},
|
|
14
14
|
/** 是否显示 */
|
|
@@ -21,6 +21,11 @@ const badgeProps = {
|
|
|
21
21
|
type: Number,
|
|
22
22
|
default: 999
|
|
23
23
|
},
|
|
24
|
+
/** 层级 */
|
|
25
|
+
zIndex: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 999
|
|
28
|
+
},
|
|
24
29
|
/**
|
|
25
30
|
* 主题类型
|
|
26
31
|
* @values error,warning,success,primary,info
|
|
@@ -54,8 +59,8 @@ const badgeProps = {
|
|
|
54
59
|
type: String,
|
|
55
60
|
default: 'overflow'
|
|
56
61
|
},
|
|
57
|
-
/**
|
|
58
|
-
offset: Array
|
|
62
|
+
/** 设置badge的位置偏移,格式为 \[x, y\],也即设置的为top和right的值,absolute为true时有效 */
|
|
63
|
+
offset: Array,
|
|
59
64
|
/** 是否反转背景和字体颜色 */
|
|
60
65
|
inverted: {
|
|
61
66
|
type: Boolean,
|
|
@@ -69,7 +74,9 @@ const badgeProps = {
|
|
|
69
74
|
/** 自定义输入框外部样式 */
|
|
70
75
|
customStyle: {
|
|
71
76
|
type: Object as PropType<CSSProperties>
|
|
72
|
-
}
|
|
77
|
+
},
|
|
78
|
+
/** 自定义外部类名 */
|
|
79
|
+
customClass: String
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
export default badgeProps
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
:hover-class="!disabled && !loading ? 'hy-button--active' : ''"
|
|
24
24
|
:style="[baseColor, customStyle]"
|
|
25
25
|
@click="clickHandler"
|
|
26
|
-
:class="['hy-button', 'hy-
|
|
26
|
+
:class="['hy-button', border ? '' : 'hy-button__no-border', bemClass, customClass]"
|
|
27
27
|
>
|
|
28
28
|
<template v-if="loading">
|
|
29
29
|
<HyLoading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></HyLoading>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</text>
|
|
33
33
|
</template>
|
|
34
34
|
<template v-else>
|
|
35
|
-
<
|
|
35
|
+
<hy-icon
|
|
36
36
|
v-if="icon?.name"
|
|
37
37
|
:name="icon?.name"
|
|
38
38
|
:color="iconColorCom"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
:stop="icon?.stop"
|
|
47
47
|
:round="icon?.round"
|
|
48
48
|
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
49
|
-
></
|
|
49
|
+
></hy-icon>
|
|
50
50
|
<!-- @slot 插入默认的值 -->
|
|
51
51
|
<slot v-if="$slots.default"></slot>
|
|
52
52
|
<text v-else class="hy-button__text" :style="[{ fontSize: textSize + 'px' }]">{{
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
</text>
|
|
84
84
|
</template>
|
|
85
85
|
<template v-else>
|
|
86
|
-
<
|
|
86
|
+
<hy-icon
|
|
87
87
|
v-if="icon?.name"
|
|
88
88
|
:name="icon?.name"
|
|
89
89
|
:color="iconColorCom"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
:stop="icon?.stop"
|
|
98
98
|
:round="icon?.round"
|
|
99
99
|
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
100
|
-
></
|
|
100
|
+
></hy-icon>
|
|
101
101
|
<text
|
|
102
102
|
class="hy-button__text"
|
|
103
103
|
:style="[
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
/* #endif */
|
|
16
16
|
flex-direction: row;
|
|
17
17
|
|
|
18
|
+
/* 去除原生按钮边框 */
|
|
19
|
+
&:after {
|
|
20
|
+
border: none !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
@include e(text) {
|
|
19
24
|
font-size: 15px;
|
|
20
25
|
}
|
|
@@ -59,6 +64,10 @@
|
|
|
59
64
|
opacity: 0.5;
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
@include e(no-border) {
|
|
68
|
+
border: none !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
@include themeColor(info, $hy-info, $hy-info);
|
|
63
72
|
@include themeColor(success, $hy-success, $hy-success);
|
|
64
73
|
@include themeColor(primary, $hy-primary, $hy-primary);
|
|
@@ -5,7 +5,12 @@ const buttonProps = {
|
|
|
5
5
|
/** 是否显示按钮的细边框 */
|
|
6
6
|
hairline: {
|
|
7
7
|
type: Boolean,
|
|
8
|
-
default:
|
|
8
|
+
default: true
|
|
9
|
+
},
|
|
10
|
+
/** 是否显示按钮的边框 */
|
|
11
|
+
border: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: true
|
|
9
14
|
},
|
|
10
15
|
/**
|
|
11
16
|
* 按钮的预置样式
|
|
@@ -116,15 +121,15 @@ const buttonProps = {
|
|
|
116
121
|
icon: Object as PropType<HyIconProps>,
|
|
117
122
|
/** 按钮颜色,支持传入linear-gradient渐变色 */
|
|
118
123
|
color: String,
|
|
124
|
+
/** 定义需要用到的外部样式 */
|
|
125
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
126
|
+
/** 自定义外部类名 */
|
|
127
|
+
customClass: String,
|
|
119
128
|
/** 阻止事件冒泡 */
|
|
120
129
|
stop: {
|
|
121
130
|
type: Boolean,
|
|
122
131
|
default: true
|
|
123
|
-
}
|
|
124
|
-
/** 定义需要用到的外部样式 */
|
|
125
|
-
customStyle: Object as PropType<CSSProperties>,
|
|
126
|
-
/** 自定义外部类名 */
|
|
127
|
-
customClass: String
|
|
132
|
+
}
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
export default buttonProps
|
|
@@ -1,180 +1,172 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
<view
|
|
3
|
+
:class="cardClass"
|
|
4
|
+
@click="handleClick"
|
|
5
|
+
:style="[
|
|
6
|
+
{
|
|
7
|
+
background: bgColor,
|
|
8
|
+
filter: boxShadow ? 'drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.2))' : ''
|
|
9
|
+
},
|
|
10
|
+
customStyle
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
<!-- 优惠券主体 -->
|
|
14
|
+
<view class="hy-coupon__content">
|
|
15
|
+
<!-- 左侧金额/折扣信息 -->
|
|
16
|
+
<view class="hy-coupon__content--left">
|
|
17
|
+
<!-- @slot 自定义金额插槽 -->
|
|
18
|
+
<slot v-if="$slots.left" name="left"></slot>
|
|
19
|
+
<template v-else>
|
|
20
|
+
<view class="hy-coupon__content--left__block">
|
|
21
|
+
<view class="hy-coupon__content--left__value">
|
|
22
|
+
<text>
|
|
23
|
+
{{ amount || 0 }}
|
|
24
|
+
</text>
|
|
25
|
+
</view>
|
|
26
|
+
<view class="hy-coupon__content--left__suffix">
|
|
27
|
+
<text v-if="unit">{{ unit }}</text>
|
|
28
|
+
<text v-else-if="type === 'discount'">折</text>
|
|
29
|
+
<text v-else>元</text>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
|
|
33
|
+
<hy-tag
|
|
34
|
+
:text="typeValue"
|
|
35
|
+
size="mini"
|
|
36
|
+
plain
|
|
37
|
+
shape="circle"
|
|
38
|
+
color="#FFFFFF"
|
|
39
|
+
></hy-tag>
|
|
40
|
+
</template>
|
|
41
|
+
</view>
|
|
42
|
+
|
|
43
|
+
<hy-line
|
|
44
|
+
:hairline="false"
|
|
45
|
+
direction="column"
|
|
46
|
+
dashed
|
|
47
|
+
color="#FFFFFF"
|
|
48
|
+
length="70%"
|
|
49
|
+
></hy-line>
|
|
50
|
+
|
|
51
|
+
<!-- 右侧描述信息 -->
|
|
52
|
+
<view class="hy-coupon__content--right">
|
|
53
|
+
<!-- 自定义详情插槽 -->
|
|
54
|
+
<slot v-if="$slots.right" name="right"></slot>
|
|
55
|
+
<template v-else>
|
|
56
|
+
<view class="hy-coupon__content--right__name">{{ title }}</view>
|
|
57
|
+
<view class="hy-coupon__content--right__desc">{{ description }}</view>
|
|
58
|
+
<view class="hy-coupon__content--right__validity">
|
|
59
|
+
{{
|
|
60
|
+
dateDesc
|
|
61
|
+
? dateDesc
|
|
62
|
+
: `有效期: ${formatTime(startDate, format)} - ${formatTime(endDate, format)}`
|
|
63
|
+
}}
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
</view>
|
|
67
|
+
</view>
|
|
68
|
+
|
|
69
|
+
<!-- 右侧状态标签 -->
|
|
70
|
+
<view class="hy-coupon__btn">
|
|
71
|
+
<!-- 自定义按钮插槽 -->
|
|
72
|
+
<slot v-if="$slots.button" name="button"></slot>
|
|
73
|
+
<template v-else>
|
|
74
|
+
<view v-if="btnMode === 'text'" class="hy-coupon__tag">
|
|
75
|
+
<text class="hy-coupon__tag--btn" @tap.stop="onUsed">{{ btnText }}</text>
|
|
76
|
+
</view>
|
|
77
|
+
<hy-button
|
|
78
|
+
v-if="btnMode === 'button'"
|
|
79
|
+
:text="btnText"
|
|
80
|
+
plain
|
|
81
|
+
:disabled="isDisable"
|
|
82
|
+
:size="buttonProp?.size || 'small'"
|
|
83
|
+
:shape="buttonProp?.shape || 'circle'"
|
|
84
|
+
:color="buttonProp?.color || '#FFFFFF'"
|
|
85
|
+
:custom-style="{ marginRight: '10px' }"
|
|
86
|
+
@click="onUsed"
|
|
87
|
+
></hy-button>
|
|
88
|
+
</template>
|
|
89
|
+
</view>
|
|
46
90
|
</view>
|
|
47
|
-
|
|
48
|
-
<!-- 优惠券右侧边框装饰 -->
|
|
49
|
-
<view v-if="showRightBorder" class="coupon-border-right"></view>
|
|
50
|
-
|
|
51
|
-
<!-- 悬浮提示 -->
|
|
52
|
-
<view v-if="tooltip" class="coupon-tooltip" :class="{ show: showTooltip }">
|
|
53
|
-
{{ tooltip }}
|
|
54
|
-
</view>
|
|
55
|
-
</view>
|
|
56
91
|
</template>
|
|
57
92
|
|
|
58
93
|
<script lang="ts">
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
94
|
+
export default {
|
|
95
|
+
name: 'hy-coupon',
|
|
96
|
+
options: {
|
|
97
|
+
addGlobalClass: true,
|
|
98
|
+
virtualHost: true,
|
|
99
|
+
styleIsolation: 'shared'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<script setup lang="ts">
|
|
105
|
+
import { computed } from 'vue'
|
|
106
|
+
import type { ICouponEmits } from './typing'
|
|
107
|
+
import { formatTime } from '../../libs'
|
|
108
|
+
import couponProps from './props'
|
|
109
|
+
|
|
110
|
+
// 组件
|
|
111
|
+
import hyTag from '../hy-tag/hy-tag.vue'
|
|
112
|
+
import hyLine from '../hy-line/hy-line.vue'
|
|
113
|
+
import hyButton from '../hy-button/hy-button.vue'
|
|
62
114
|
|
|
63
115
|
/**
|
|
64
|
-
*
|
|
116
|
+
* 用于商品优惠券的业务组件
|
|
65
117
|
* @displayName hy-coupon
|
|
66
118
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// 计算限制标签
|
|
94
|
-
const limitTags = computed(() => {
|
|
95
|
-
const tags: string[] = [];
|
|
96
|
-
|
|
97
|
-
// 根据属性添加不同的标签
|
|
98
|
-
if (props.isExclusive) {
|
|
99
|
-
tags.push("专属");
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (props.limitPerUser > 0) {
|
|
103
|
-
tags.push(`限领${props.limitPerUser}张`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (props.minSpend > 0 && props.minSpend <= 1000) {
|
|
107
|
-
// 小额满减可以显示在标签中
|
|
108
|
-
tags.push(`满${props.minSpend}可用`);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return tags;
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// 按钮文本
|
|
115
|
-
const buttonText = computed(() => {
|
|
116
|
-
return (
|
|
117
|
-
props.customButtonText || (props.status === "normal" ? "立即领取" : "")
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// 是否显示操作按钮
|
|
122
|
-
const showActionButton = computed(() => {
|
|
123
|
-
return props.showActionButton && props.status === "normal";
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// 是否显示左侧边框装饰
|
|
127
|
-
const showLeftBorder = computed(() => {
|
|
128
|
-
return true; // 默认显示左侧边框装饰
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// 是否显示右侧边框装饰
|
|
132
|
-
const showRightBorder = computed(() => {
|
|
133
|
-
return true; // 默认显示右侧边框装饰
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// 处理点击事件
|
|
137
|
-
const handleClick = () => {
|
|
138
|
-
if (props.status === "normal") {
|
|
139
|
-
emit("click", { status: props.status });
|
|
140
|
-
|
|
141
|
-
// 如果需要,可以同时触发receive事件
|
|
142
|
-
if (props.triggerReceiveOnClick) {
|
|
143
|
-
emit("receive");
|
|
119
|
+
defineOptions({})
|
|
120
|
+
|
|
121
|
+
const props = defineProps(couponProps)
|
|
122
|
+
const emit = defineEmits<ICouponEmits>()
|
|
123
|
+
|
|
124
|
+
// 禁用功能
|
|
125
|
+
const isDisable = computed(() => props.disabledStatus.includes(props.status))
|
|
126
|
+
|
|
127
|
+
const typeValue = computed(() => {
|
|
128
|
+
let text = ''
|
|
129
|
+
if (props.typeText) {
|
|
130
|
+
text = props.typeText
|
|
131
|
+
} else {
|
|
132
|
+
switch (props.type) {
|
|
133
|
+
case 'moneyOff':
|
|
134
|
+
text = '满减券'
|
|
135
|
+
break
|
|
136
|
+
case 'discount':
|
|
137
|
+
text = '折扣券'
|
|
138
|
+
break
|
|
139
|
+
case 'fixedAmount':
|
|
140
|
+
text = '无门槛券'
|
|
141
|
+
break
|
|
142
|
+
default:
|
|
143
|
+
text = '未知券'
|
|
144
|
+
break
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
showActionButton,
|
|
168
|
-
showLeftBorder,
|
|
169
|
-
showRightBorder,
|
|
170
|
-
handleClick,
|
|
171
|
-
handleMouseEnter,
|
|
172
|
-
handleMouseLeave,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
});
|
|
146
|
+
}
|
|
147
|
+
return text
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
const cardClass = computed(() => {
|
|
151
|
+
const baseClass = 'hy-coupon hy-coupon__card'
|
|
152
|
+
const typeClass = `hy-coupon--${props.type}`
|
|
153
|
+
const statusClass = isDisable.value && 'hy-coupon--disabled'
|
|
154
|
+
return `${baseClass} ${typeClass} ${statusClass} ${props.customClass}`
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
// 点击优惠券触发
|
|
158
|
+
const handleClick = () => {
|
|
159
|
+
emit('click')
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 点击使用优惠券触发
|
|
163
|
+
const onUsed = () => {
|
|
164
|
+
if (!isDisable.value) {
|
|
165
|
+
emit('used')
|
|
166
|
+
}
|
|
167
|
+
}
|
|
176
168
|
</script>
|
|
177
169
|
|
|
178
|
-
<style lang="scss"
|
|
179
|
-
@import
|
|
170
|
+
<style scoped lang="scss">
|
|
171
|
+
@import './index.scss';
|
|
180
172
|
</style>
|