hy-app 0.6.4 → 0.6.6
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/attributes.json +1 -1
- package/components/hy-address-picker/hy-address-picker.vue +249 -249
- package/components/hy-address-picker/props.ts +103 -103
- package/components/hy-button/hy-button.vue +320 -289
- package/components/hy-button/props.ts +143 -143
- package/components/hy-button/typing.d.ts +43 -35
- package/components/hy-calendar/header.vue +58 -58
- package/components/hy-calendar/hy-calendar.vue +8 -6
- package/components/hy-calendar/month.vue +402 -402
- package/components/hy-calendar/props.ts +169 -169
- package/components/hy-calendar/typing.d.ts +47 -45
- package/components/hy-cell-item/hy-cell-item.vue +161 -161
- package/components/hy-cell-item/props.ts +59 -59
- package/components/hy-check-button/hy-check-button.vue +135 -135
- package/components/hy-code-input/hy-code-input.vue +231 -231
- package/components/hy-code-input/props.ts +90 -90
- package/components/hy-config-provider/hy-config-provider.vue +53 -53
- package/components/hy-config-provider/props.ts +30 -30
- package/components/hy-coupon/hy-coupon.vue +183 -183
- package/components/hy-coupon/props.ts +108 -108
- package/components/hy-datetime-picker/hy-datetime-picker.vue +41 -55
- package/components/hy-datetime-picker/props.ts +144 -144
- package/components/hy-datetime-picker/typing.d.ts +2 -0
- package/components/hy-divider/props.ts +83 -83
- package/components/hy-empty/icon.ts +72 -72
- package/components/hy-folding-panel/hy-folding-panel-group.vue +162 -162
- package/components/hy-form/hy-form.vue +220 -220
- package/components/hy-icon/hy-icon.vue +112 -112
- package/components/hy-index-bar/hy-index-bar.vue +185 -185
- package/components/hy-index-bar/index.scss +64 -64
- package/components/hy-index-bar/props.ts +94 -94
- package/components/hy-index-bar/typing.d.ts +36 -36
- package/components/hy-input/hy-input.vue +333 -333
- package/components/hy-input/props.ts +186 -186
- package/components/hy-modal/hy-modal.vue +211 -211
- package/components/hy-modal/props.ts +94 -94
- package/components/hy-modal/typing.d.ts +16 -16
- package/components/hy-notice-bar/hy-row-notice.vue +121 -121
- package/components/hy-notify/hy-notify.vue +174 -174
- package/components/hy-number-step/hy-number-step.vue +367 -367
- package/components/hy-overlay/hy-overlay.vue +61 -61
- package/components/hy-overlay/props.ts +38 -38
- package/components/hy-pagination/hy-pagination.vue +136 -136
- package/components/hy-pagination/props.ts +58 -58
- package/components/hy-parse/hy-parse.vue +550 -550
- package/components/hy-parse/node/node.vue +781 -781
- package/components/hy-parse/parser.js +1455 -1455
- package/components/hy-parse/props.ts +19 -19
- package/components/hy-parse/typing.d.ts +68 -68
- package/components/hy-picker/hy-picker.vue +435 -435
- package/components/hy-picker/props.ts +122 -122
- package/components/hy-picker/typing.d.ts +38 -38
- package/components/hy-qrcode/props.ts +72 -72
- package/components/hy-qrcode/qrcode.js.bak +1433 -1433
- package/components/hy-radio/props.ts +97 -97
- package/components/hy-read-more/props.ts +48 -48
- package/components/hy-search/props.ts +133 -133
- package/components/hy-signature/canvasHelper.ts +51 -51
- package/components/hy-signature/props.ts +121 -121
- package/components/hy-skeleton/hy-skeleton.vue +142 -142
- package/components/hy-skeleton/props.ts +46 -46
- package/components/hy-skeleton/typing.d.ts +31 -31
- package/components/hy-steps/hy-steps.vue +275 -275
- package/components/hy-steps/typing.d.ts +25 -25
- package/components/hy-swiper/hy-swiper.vue +3 -3
- package/components/hy-swiper/index.scss +5 -5
- package/components/hy-swiper/props.ts +0 -1
- package/components/hy-table/hy-table.vue +630 -630
- package/components/hy-table/props.ts +62 -62
- package/components/hy-table/typing.d.ts +29 -29
- package/components/hy-tabs/hy-tabs.vue +336 -335
- package/components/hy-tabs/props.ts +84 -77
- package/components/hy-tag/hy-tag.vue +173 -173
- package/components/hy-tag/props.ts +89 -89
- package/components/hy-text/hy-text.vue +237 -237
- package/components/hy-text/props.ts +115 -115
- package/components/hy-textarea/hy-textarea.vue +198 -198
- package/components/hy-toast/hy-toast.vue +200 -200
- package/components/hy-toast/props.ts +3 -3
- package/components/hy-transition/hy-transition.vue +157 -157
- package/components/hy-transition/props.ts +32 -32
- package/components/hy-upload/hy-upload.vue +384 -384
- package/components/hy-watermark/hy-watermark.vue +1058 -1058
- package/components/hy-watermark/props.ts +109 -109
- package/global.d.ts +94 -94
- package/libs/api/http.ts +119 -119
- package/libs/composables/index.ts +8 -8
- package/libs/composables/useMessage.ts +149 -149
- package/libs/composables/useToast.ts +45 -45
- package/libs/composables/useTranslate.ts +10 -10
- package/libs/css/_config.scss +5 -5
- package/libs/index.ts +8 -8
- package/libs/locale/index.ts +32 -32
- package/libs/locale/lang/en-US.ts +84 -84
- package/libs/locale/lang/zh-CN.ts +87 -87
- package/libs/typing/index.ts +2 -2
- package/libs/typing/modules/common.d.ts +139 -139
- package/libs/typing/modules/form.ts +176 -176
- package/libs/typing/modules/http.d.ts +19 -19
- package/libs/typing/modules/index.d.ts +12 -12
- package/libs/utils/inside.ts +340 -340
- package/libs/utils/inspect.ts +140 -140
- package/libs/utils/utils.ts +525 -525
- package/package.json +81 -81
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view :class="themeClass" :style="[themeStyle, { height: height ? addUnit(height) : '' }]">
|
|
3
|
-
<!-- @slot 默认插槽 -->
|
|
4
|
-
<slot />
|
|
5
|
-
</view>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
export default {
|
|
10
|
-
name: 'hy-config-provider',
|
|
11
|
-
options: {
|
|
12
|
-
addGlobalClass: true,
|
|
13
|
-
virtualHost: true,
|
|
14
|
-
styleIsolation: 'shared'
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { computed } from 'vue'
|
|
21
|
-
import { addUnit, colorGradient } from '../../libs'
|
|
22
|
-
import configProviderProps from './props'
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 将 ConfigProvider 组件的 theme 属性设置为 dark,可以开启深色模式。 深色模式会全局生效,使页面上的所有 Wot 组件变为深色风格。
|
|
26
|
-
* @displayName hy-config-provider
|
|
27
|
-
*/
|
|
28
|
-
defineOptions({})
|
|
29
|
-
|
|
30
|
-
const props = defineProps(configProviderProps)
|
|
31
|
-
|
|
32
|
-
const themeClass = computed(() => {
|
|
33
|
-
return [props.customClass, 'hy-config-provider', `hy-theme--${props.theme}`]
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const themeStyle = computed(() => {
|
|
37
|
-
return [
|
|
38
|
-
{
|
|
39
|
-
'--hy-theme-color': props.themeColor,
|
|
40
|
-
'--hy-theme--light':
|
|
41
|
-
props.theme === 'light'
|
|
42
|
-
? colorGradient(props.themeColor)[80]
|
|
43
|
-
: colorGradient(props.themeColor, '#000')[60],
|
|
44
|
-
padding: addUnit(props.padding)
|
|
45
|
-
},
|
|
46
|
-
props.customStyle
|
|
47
|
-
]
|
|
48
|
-
})
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<style scoped lang="scss">
|
|
52
|
-
@import './index.scss';
|
|
53
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="themeClass" :style="[themeStyle, { height: height ? addUnit(height) : '' }]">
|
|
3
|
+
<!-- @slot 默认插槽 -->
|
|
4
|
+
<slot />
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'hy-config-provider',
|
|
11
|
+
options: {
|
|
12
|
+
addGlobalClass: true,
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
styleIsolation: 'shared'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { computed } from 'vue'
|
|
21
|
+
import { addUnit, colorGradient } from '../../libs'
|
|
22
|
+
import configProviderProps from './props'
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 将 ConfigProvider 组件的 theme 属性设置为 dark,可以开启深色模式。 深色模式会全局生效,使页面上的所有 Wot 组件变为深色风格。
|
|
26
|
+
* @displayName hy-config-provider
|
|
27
|
+
*/
|
|
28
|
+
defineOptions({})
|
|
29
|
+
|
|
30
|
+
const props = defineProps(configProviderProps)
|
|
31
|
+
|
|
32
|
+
const themeClass = computed(() => {
|
|
33
|
+
return [props.customClass, 'hy-config-provider', `hy-theme--${props.theme}`]
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const themeStyle = computed(() => {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
'--hy-theme-color': props.themeColor,
|
|
40
|
+
'--hy-theme--light':
|
|
41
|
+
props.theme === 'light'
|
|
42
|
+
? colorGradient(props.themeColor)[80]
|
|
43
|
+
: colorGradient(props.themeColor, '#000')[60],
|
|
44
|
+
padding: addUnit(props.padding)
|
|
45
|
+
},
|
|
46
|
+
props.customStyle
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style scoped lang="scss">
|
|
52
|
+
@import './index.scss';
|
|
53
|
+
</style>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { ColorConfig } from '../../libs/config'
|
|
2
|
-
import type { CSSProperties, PropType } from 'vue'
|
|
3
|
-
|
|
4
|
-
const configProviderProps = {
|
|
5
|
-
/**
|
|
6
|
-
* 主题色,暗色或者默认白色
|
|
7
|
-
* @values dark,light
|
|
8
|
-
* */
|
|
9
|
-
theme: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: 'light'
|
|
12
|
-
},
|
|
13
|
-
/** 主题色 */
|
|
14
|
-
themeColor: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: ColorConfig.primary
|
|
17
|
-
},
|
|
18
|
-
/** 页面高度 */
|
|
19
|
-
height: [String, Number],
|
|
20
|
-
/** 内边距 */
|
|
21
|
-
padding: [String, Number],
|
|
22
|
-
/** 定义需要用到的主题类名 */
|
|
23
|
-
customClass: String,
|
|
24
|
-
/** 定义需要用到的外部样式 */
|
|
25
|
-
customStyle: {
|
|
26
|
-
type: [Object, Array] as PropType<CSSProperties | CSSProperties[]>
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default configProviderProps
|
|
1
|
+
import { ColorConfig } from '../../libs/config'
|
|
2
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
const configProviderProps = {
|
|
5
|
+
/**
|
|
6
|
+
* 主题色,暗色或者默认白色
|
|
7
|
+
* @values dark,light
|
|
8
|
+
* */
|
|
9
|
+
theme: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'light'
|
|
12
|
+
},
|
|
13
|
+
/** 主题色 */
|
|
14
|
+
themeColor: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ColorConfig.primary
|
|
17
|
+
},
|
|
18
|
+
/** 页面高度 */
|
|
19
|
+
height: [String, Number],
|
|
20
|
+
/** 内边距 */
|
|
21
|
+
padding: [String, Number],
|
|
22
|
+
/** 定义需要用到的主题类名 */
|
|
23
|
+
customClass: String,
|
|
24
|
+
/** 定义需要用到的外部样式 */
|
|
25
|
+
customStyle: {
|
|
26
|
+
type: [Object, Array] as PropType<CSSProperties | CSSProperties[]>
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default configProviderProps
|
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
<template>
|
|
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
|
|
58
|
-
:class="[
|
|
59
|
-
'hy-coupon__content--right__desc',
|
|
60
|
-
desEllipsis !== 'none' && 'is-ellipsis'
|
|
61
|
-
]"
|
|
62
|
-
>{{ description }}</view
|
|
63
|
-
>
|
|
64
|
-
<view class="hy-coupon__content--right__validity">
|
|
65
|
-
{{
|
|
66
|
-
dateDesc
|
|
67
|
-
? dateDesc
|
|
68
|
-
: `有效期: ${formatTime(startDate, format)} - ${formatTime(endDate, format)}`
|
|
69
|
-
}}
|
|
70
|
-
</view>
|
|
71
|
-
</template>
|
|
72
|
-
</view>
|
|
73
|
-
</view>
|
|
74
|
-
|
|
75
|
-
<!-- 右侧状态标签 -->
|
|
76
|
-
<view class="hy-coupon__btn">
|
|
77
|
-
<!-- 自定义按钮插槽 -->
|
|
78
|
-
<slot v-if="$slots.button" name="button"></slot>
|
|
79
|
-
<template v-else>
|
|
80
|
-
<view v-if="btnMode === 'text'" class="hy-coupon__tag">
|
|
81
|
-
<text class="hy-coupon__tag--btn" @tap.stop="onUsed">{{ btnText }}</text>
|
|
82
|
-
</view>
|
|
83
|
-
<hy-button
|
|
84
|
-
v-if="btnMode === 'button'"
|
|
85
|
-
:text="btnText"
|
|
86
|
-
plain
|
|
87
|
-
:disabled="isDisable"
|
|
88
|
-
:size="buttonProp?.size || 'small'"
|
|
89
|
-
:shape="buttonProp?.shape || 'circle'"
|
|
90
|
-
:color="buttonProp?.color || '#FFFFFF'"
|
|
91
|
-
:custom-style="{ marginRight: '10px' }"
|
|
92
|
-
@click="onUsed"
|
|
93
|
-
></hy-button>
|
|
94
|
-
</template>
|
|
95
|
-
</view>
|
|
96
|
-
</view>
|
|
97
|
-
</template>
|
|
98
|
-
|
|
99
|
-
<script lang="ts">
|
|
100
|
-
export default {
|
|
101
|
-
name: 'hy-coupon',
|
|
102
|
-
options: {
|
|
103
|
-
addGlobalClass: true,
|
|
104
|
-
virtualHost: true,
|
|
105
|
-
styleIsolation: 'shared'
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
</script>
|
|
109
|
-
|
|
110
|
-
<script setup lang="ts">
|
|
111
|
-
import { computed } from 'vue'
|
|
112
|
-
import type { ICouponEmits } from './typing'
|
|
113
|
-
import { formatTime } from '../../libs'
|
|
114
|
-
import couponProps from './props'
|
|
115
|
-
|
|
116
|
-
// 组件
|
|
117
|
-
import hyTag from '../hy-tag/hy-tag.vue'
|
|
118
|
-
import hyLine from '../hy-line/hy-line.vue'
|
|
119
|
-
import hyButton from '../hy-button/hy-button.vue'
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* 用于商品优惠券的业务组件
|
|
123
|
-
* @displayName hy-coupon
|
|
124
|
-
*/
|
|
125
|
-
defineOptions({})
|
|
126
|
-
|
|
127
|
-
const props = defineProps(couponProps)
|
|
128
|
-
const emit = defineEmits<ICouponEmits>()
|
|
129
|
-
|
|
130
|
-
// 禁用功能
|
|
131
|
-
const isDisable = computed(() => props.disabledStatus.includes(props.status))
|
|
132
|
-
|
|
133
|
-
const typeValue = computed(() => {
|
|
134
|
-
let text = ''
|
|
135
|
-
if (props.typeText) {
|
|
136
|
-
text = props.typeText
|
|
137
|
-
} else {
|
|
138
|
-
switch (props.type) {
|
|
139
|
-
case 'moneyOff':
|
|
140
|
-
text = '满减券'
|
|
141
|
-
break
|
|
142
|
-
case 'discount':
|
|
143
|
-
text = '折扣券'
|
|
144
|
-
break
|
|
145
|
-
case 'fixedAmount':
|
|
146
|
-
text = '无门槛券'
|
|
147
|
-
break
|
|
148
|
-
default:
|
|
149
|
-
text = '未知券'
|
|
150
|
-
break
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return text
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
const cardClass = computed(() => {
|
|
157
|
-
const baseClass = 'hy-coupon hy-coupon__card'
|
|
158
|
-
const typeClass = `hy-coupon--${props.type}`
|
|
159
|
-
const statusClass = isDisable.value && 'hy-coupon--disabled'
|
|
160
|
-
return `${baseClass} ${typeClass} ${statusClass} ${props.customClass}`
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
// 点击优惠券触发
|
|
164
|
-
const handleClick = () => {
|
|
165
|
-
emit('click')
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// 点击使用优惠券触发
|
|
169
|
-
const onUsed = () => {
|
|
170
|
-
if (!isDisable.value) {
|
|
171
|
-
emit('used')
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
</script>
|
|
175
|
-
|
|
176
|
-
<style scoped lang="scss">
|
|
177
|
-
@import './index.scss';
|
|
178
|
-
@import '../../libs/css/mixin.scss';
|
|
179
|
-
|
|
180
|
-
@include is(ellipsis) {
|
|
181
|
-
@include multiEllipsis(v-bind(desEllipsis));
|
|
182
|
-
}
|
|
183
|
-
</style>
|
|
1
|
+
<template>
|
|
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
|
|
58
|
+
:class="[
|
|
59
|
+
'hy-coupon__content--right__desc',
|
|
60
|
+
desEllipsis !== 'none' && 'is-ellipsis'
|
|
61
|
+
]"
|
|
62
|
+
>{{ description }}</view
|
|
63
|
+
>
|
|
64
|
+
<view class="hy-coupon__content--right__validity">
|
|
65
|
+
{{
|
|
66
|
+
dateDesc
|
|
67
|
+
? dateDesc
|
|
68
|
+
: `有效期: ${formatTime(startDate, format)} - ${formatTime(endDate, format)}`
|
|
69
|
+
}}
|
|
70
|
+
</view>
|
|
71
|
+
</template>
|
|
72
|
+
</view>
|
|
73
|
+
</view>
|
|
74
|
+
|
|
75
|
+
<!-- 右侧状态标签 -->
|
|
76
|
+
<view class="hy-coupon__btn">
|
|
77
|
+
<!-- 自定义按钮插槽 -->
|
|
78
|
+
<slot v-if="$slots.button" name="button"></slot>
|
|
79
|
+
<template v-else>
|
|
80
|
+
<view v-if="btnMode === 'text'" class="hy-coupon__tag">
|
|
81
|
+
<text class="hy-coupon__tag--btn" @tap.stop="onUsed">{{ btnText }}</text>
|
|
82
|
+
</view>
|
|
83
|
+
<hy-button
|
|
84
|
+
v-if="btnMode === 'button'"
|
|
85
|
+
:text="btnText"
|
|
86
|
+
plain
|
|
87
|
+
:disabled="isDisable"
|
|
88
|
+
:size="buttonProp?.size || 'small'"
|
|
89
|
+
:shape="buttonProp?.shape || 'circle'"
|
|
90
|
+
:color="buttonProp?.color || '#FFFFFF'"
|
|
91
|
+
:custom-style="{ marginRight: '10px' }"
|
|
92
|
+
@click="onUsed"
|
|
93
|
+
></hy-button>
|
|
94
|
+
</template>
|
|
95
|
+
</view>
|
|
96
|
+
</view>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script lang="ts">
|
|
100
|
+
export default {
|
|
101
|
+
name: 'hy-coupon',
|
|
102
|
+
options: {
|
|
103
|
+
addGlobalClass: true,
|
|
104
|
+
virtualHost: true,
|
|
105
|
+
styleIsolation: 'shared'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<script setup lang="ts">
|
|
111
|
+
import { computed } from 'vue'
|
|
112
|
+
import type { ICouponEmits } from './typing'
|
|
113
|
+
import { formatTime } from '../../libs'
|
|
114
|
+
import couponProps from './props'
|
|
115
|
+
|
|
116
|
+
// 组件
|
|
117
|
+
import hyTag from '../hy-tag/hy-tag.vue'
|
|
118
|
+
import hyLine from '../hy-line/hy-line.vue'
|
|
119
|
+
import hyButton from '../hy-button/hy-button.vue'
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 用于商品优惠券的业务组件
|
|
123
|
+
* @displayName hy-coupon
|
|
124
|
+
*/
|
|
125
|
+
defineOptions({})
|
|
126
|
+
|
|
127
|
+
const props = defineProps(couponProps)
|
|
128
|
+
const emit = defineEmits<ICouponEmits>()
|
|
129
|
+
|
|
130
|
+
// 禁用功能
|
|
131
|
+
const isDisable = computed(() => props.disabledStatus.includes(props.status))
|
|
132
|
+
|
|
133
|
+
const typeValue = computed(() => {
|
|
134
|
+
let text = ''
|
|
135
|
+
if (props.typeText) {
|
|
136
|
+
text = props.typeText
|
|
137
|
+
} else {
|
|
138
|
+
switch (props.type) {
|
|
139
|
+
case 'moneyOff':
|
|
140
|
+
text = '满减券'
|
|
141
|
+
break
|
|
142
|
+
case 'discount':
|
|
143
|
+
text = '折扣券'
|
|
144
|
+
break
|
|
145
|
+
case 'fixedAmount':
|
|
146
|
+
text = '无门槛券'
|
|
147
|
+
break
|
|
148
|
+
default:
|
|
149
|
+
text = '未知券'
|
|
150
|
+
break
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return text
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
const cardClass = computed(() => {
|
|
157
|
+
const baseClass = 'hy-coupon hy-coupon__card'
|
|
158
|
+
const typeClass = `hy-coupon--${props.type}`
|
|
159
|
+
const statusClass = isDisable.value && 'hy-coupon--disabled'
|
|
160
|
+
return `${baseClass} ${typeClass} ${statusClass} ${props.customClass}`
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
// 点击优惠券触发
|
|
164
|
+
const handleClick = () => {
|
|
165
|
+
emit('click')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 点击使用优惠券触发
|
|
169
|
+
const onUsed = () => {
|
|
170
|
+
if (!isDisable.value) {
|
|
171
|
+
emit('used')
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style scoped lang="scss">
|
|
177
|
+
@import './index.scss';
|
|
178
|
+
@import '../../libs/css/mixin.scss';
|
|
179
|
+
|
|
180
|
+
@include is(ellipsis) {
|
|
181
|
+
@include multiEllipsis(v-bind(desEllipsis));
|
|
182
|
+
}
|
|
183
|
+
</style>
|