hy-app 0.5.11 → 0.5.13
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-button/hy-button.vue +289 -275
- package/components/hy-button/index.scss +24 -1
- package/components/hy-button/props.ts +143 -135
- package/components/hy-button/typing.d.ts +35 -30
- package/components/hy-coupon/hy-coupon.vue +183 -172
- package/components/hy-coupon/index.scss +20 -23
- package/components/hy-coupon/props.ts +108 -103
- package/components/hy-form/hy-form.vue +220 -220
- package/components/hy-input/hy-input.vue +333 -333
- package/components/hy-input/index.scss +1 -2
- package/components/hy-input/props.ts +186 -186
- package/components/hy-notice-bar/hy-row-notice.vue +121 -121
- package/components/hy-parse/node/node.vue +619 -422
- package/components/hy-parse/parser.js +1253 -1060
- package/components/hy-table/hy-table.vue +579 -358
- package/components/hy-table/index.scss +134 -159
- package/components/hy-table/props.ts +62 -47
- package/components/hy-table/typing.d.ts +29 -34
- package/components/hy-tabs/hy-tabs.vue +335 -335
- package/components/hy-tag/index.scss +1 -0
- 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 -197
- package/components/hy-textarea/index.scss +2 -3
- package/components/hy-toast/hy-toast.vue +190 -190
- package/libs/css/theme.scss +1 -0
- package/libs/css/vars.scss +2 -2
- package/libs/typing/modules/common.d.ts +139 -139
- package/libs/utils/inside.ts +336 -350
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -1,172 +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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
import
|
|
112
|
-
import
|
|
113
|
-
import
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
case '
|
|
140
|
-
text = '
|
|
141
|
-
break
|
|
142
|
-
|
|
143
|
-
text = '
|
|
144
|
-
break
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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,11 +1,14 @@
|
|
|
1
1
|
@use '../../libs/css/mixin' as *;
|
|
2
2
|
@use '../../libs/css/theme.scss' as *;
|
|
3
3
|
|
|
4
|
-
$hy-box-width: 180rpx;
|
|
4
|
+
$hy-coupon--box-width: 180rpx;
|
|
5
|
+
$hy-coupon--bg-height: 166rpx;
|
|
5
6
|
@include b(coupon) {
|
|
6
7
|
width: 100%;
|
|
7
8
|
min-height: 190rpx;
|
|
8
|
-
max-height:
|
|
9
|
+
max-height: 330rpx;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: row;
|
|
9
12
|
|
|
10
13
|
/* 已使用/过期状态的置灰效果 */
|
|
11
14
|
@include m(disabled) {
|
|
@@ -30,10 +33,10 @@ $hy-box-width: 180rpx;
|
|
|
30
33
|
/* 不同类型优惠券的背景色 */
|
|
31
34
|
@include m(moneyOff) {
|
|
32
35
|
background:
|
|
33
|
-
radial-gradient(circle at $hy-box-width top, transparent 15rpx, #ff7d00 0) top / 100%
|
|
36
|
+
radial-gradient(circle at $hy-coupon--box-width top, transparent 15rpx, #ff7d00 0) top / 100% $hy-coupon--bg-height
|
|
34
37
|
no-repeat,
|
|
35
|
-
radial-gradient(circle at $hy-box-width bottom, transparent 15rpx, #ff7d00 0) bottom / 100%
|
|
36
|
-
|
|
38
|
+
radial-gradient(circle at $hy-coupon--box-width bottom, transparent 15rpx, #ff7d00 0) bottom / 100%
|
|
39
|
+
$hy-coupon--bg-height no-repeat;
|
|
37
40
|
//background:
|
|
38
41
|
// radial-gradient(circle at left center, transparent 15rpx, #ff7d00 0) left center / 30rpx 100% no-repeat,
|
|
39
42
|
// radial-gradient(circle at right center, transparent 15rpx, #ff7d00 0) right center / 30rpx 100% no-repeat;
|
|
@@ -42,17 +45,17 @@ $hy-box-width: 180rpx;
|
|
|
42
45
|
}
|
|
43
46
|
@include m(discount) {
|
|
44
47
|
background:
|
|
45
|
-
radial-gradient(circle at $hy-box-width top, transparent 15rpx, #00c6ff 0) top / 100%
|
|
48
|
+
radial-gradient(circle at $hy-coupon--box-width top, transparent 15rpx, #00c6ff 0) top / 100% $hy-coupon--bg-height
|
|
46
49
|
no-repeat,
|
|
47
|
-
radial-gradient(circle at $hy-box-width bottom, transparent 15rpx, #00c6ff 0) bottom / 100%
|
|
48
|
-
|
|
50
|
+
radial-gradient(circle at $hy-coupon--box-width bottom, transparent 15rpx, #00c6ff 0) bottom / 100%
|
|
51
|
+
$hy-coupon--bg-height no-repeat;
|
|
49
52
|
}
|
|
50
53
|
@include m(fixedAmount) {
|
|
51
54
|
background:
|
|
52
|
-
radial-gradient(circle at $hy-box-width top, transparent 15rpx, $hy-error 0) top / 100%
|
|
55
|
+
radial-gradient(circle at $hy-coupon--box-width top, transparent 15rpx, $hy-error 0) top / 100% $hy-coupon--bg-height
|
|
53
56
|
no-repeat,
|
|
54
|
-
radial-gradient(circle at $hy-box-width bottom, transparent 15rpx, $hy-error 0) bottom / 100%
|
|
55
|
-
|
|
57
|
+
radial-gradient(circle at $hy-coupon--box-width bottom, transparent 15rpx, $hy-error 0) bottom / 100%
|
|
58
|
+
$hy-coupon--bg-height no-repeat;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
/* 优惠券内容区域 */
|
|
@@ -70,9 +73,10 @@ $hy-box-width: 180rpx;
|
|
|
70
73
|
justify-content: center;
|
|
71
74
|
align-items: center;
|
|
72
75
|
height: 100%;
|
|
73
|
-
width: $hy-box-width;
|
|
76
|
+
width: $hy-coupon--box-width;
|
|
74
77
|
padding: $hy-border-margin-padding-base;
|
|
75
78
|
box-sizing: border-box;
|
|
79
|
+
flex-shrink: 0;
|
|
76
80
|
|
|
77
81
|
@include e(block) {
|
|
78
82
|
display: flex;
|
|
@@ -97,25 +101,23 @@ $hy-box-width: 180rpx;
|
|
|
97
101
|
|
|
98
102
|
/* 右侧描述 */
|
|
99
103
|
@include m(right) {
|
|
100
|
-
flex: 1;
|
|
101
104
|
display: flex;
|
|
102
105
|
flex-direction: column;
|
|
103
|
-
|
|
104
|
-
text-align: start;
|
|
106
|
+
box-sizing: border-box;
|
|
105
107
|
padding: $hy-border-margin-padding-base;
|
|
106
108
|
|
|
107
109
|
@include e(name) {
|
|
108
110
|
font-size: 30rpx;
|
|
109
111
|
font-weight: 600;
|
|
110
112
|
margin-bottom: 8rpx;
|
|
111
|
-
@include lineEllipsis;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
@include e(desc) {
|
|
115
|
-
|
|
116
|
+
width: 100%;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
@include e(validity) {
|
|
120
|
+
width: 100%;
|
|
119
121
|
@include lineEllipsis;
|
|
120
122
|
}
|
|
121
123
|
|
|
@@ -123,24 +125,19 @@ $hy-box-width: 180rpx;
|
|
|
123
125
|
font-size: 22rpx;
|
|
124
126
|
opacity: 0.9;
|
|
125
127
|
line-height: 1.4;
|
|
126
|
-
@include lineEllipsis;
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
/* 右侧状态标签 */
|
|
132
133
|
@include e(btn) {
|
|
133
|
-
position: absolute;
|
|
134
|
-
bottom: 0;
|
|
135
|
-
right: 0;
|
|
136
|
-
height: 100%;
|
|
137
134
|
display: flex;
|
|
138
135
|
justify-content: flex-start;
|
|
139
136
|
align-items: center;
|
|
140
137
|
}
|
|
141
138
|
@include e(tag) {
|
|
142
139
|
height: 100%;
|
|
143
|
-
margin-left:
|
|
140
|
+
margin-left: 20rpx;
|
|
144
141
|
width: 120rpx;
|
|
145
142
|
display: flex;
|
|
146
143
|
align-items: center;
|