stellar-ui-v2 1.40.8 → 1.40.10
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.
|
@@ -46,11 +46,12 @@ export default {
|
|
|
46
46
|
#### Props
|
|
47
47
|
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
48
48
|
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
49
|
-
| `clientId` | 应用编码 | `string` |
|
|
50
|
-
| `clientSecret` | 应用密钥 | `string` |
|
|
49
|
+
| `clientId` | 应用编码 | `string` | - | - | - |
|
|
50
|
+
| `clientSecret` | 应用密钥 | `string` | - | - | - |
|
|
51
51
|
| `apiUrl` | 更新API地址 | `string` | `https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail` | - | - |
|
|
52
|
-
| `appType` | APP环境,版本号的最后一位为环境标识 | `string` |
|
|
52
|
+
| `appType` | APP环境,版本号的最后一位为环境标识 | `string` | - | - | - |
|
|
53
53
|
| `btnText` | 立即体验按钮文本 | `string` | `立即体验` | - | - |
|
|
54
|
+
| `appVersion` | 应用当前版本 | `string` | - | - | `1.40.9` |
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
#### Events
|
|
@@ -58,6 +58,9 @@ export default {
|
|
|
58
58
|
type: String,
|
|
59
59
|
default: '立即体验',
|
|
60
60
|
},
|
|
61
|
+
appVersion: {
|
|
62
|
+
type: String,
|
|
63
|
+
},
|
|
61
64
|
},
|
|
62
65
|
data() {
|
|
63
66
|
return {
|
|
@@ -137,10 +140,16 @@ export default {
|
|
|
137
140
|
// #ifdef APP-PLUS
|
|
138
141
|
plus.runtime.getProperty(plus.runtime.appid || '', (inf) => {
|
|
139
142
|
this.version = inf.version || '';
|
|
143
|
+
if (this.appVersion) {
|
|
144
|
+
this.version = this.appVersion;
|
|
145
|
+
}
|
|
140
146
|
this.getData(callback);
|
|
141
147
|
});
|
|
142
148
|
// #endif
|
|
143
149
|
// #ifndef APP-PLUS
|
|
150
|
+
if (this.appVersion) {
|
|
151
|
+
this.version = this.appVersion;
|
|
152
|
+
}
|
|
144
153
|
this.getData(callback);
|
|
145
154
|
// #endif
|
|
146
155
|
},
|
|
@@ -1,258 +1,256 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="ste-price-root">
|
|
3
|
-
<view class="content" :style="[cmpPriceStyle]">
|
|
4
|
-
<text v-if="showUnit" class="unit" :style="[cmpUnitStyle]">{{ unitSymbol }}</text>
|
|
5
|
-
<text class="yuan-price" :style="[cmpYuanPriceStyle]">{{ cmpYuanValue }}</text>
|
|
6
|
-
<text v-if="valueUnit === 'fen'" class="fen-price" :style="[cmpFenPriceStyle]">
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* ste-price
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
* @property {
|
|
24
|
-
* @
|
|
25
|
-
* @
|
|
26
|
-
* @value
|
|
27
|
-
* @value
|
|
28
|
-
* @
|
|
29
|
-
* @
|
|
30
|
-
* @property {
|
|
31
|
-
* @property {String}
|
|
32
|
-
* @property {
|
|
33
|
-
* @property {Number|String}
|
|
34
|
-
* @property {
|
|
35
|
-
* @property {Number|String}
|
|
36
|
-
* @property {Number|String}
|
|
37
|
-
* @property {Number
|
|
38
|
-
* @property {
|
|
39
|
-
* @property {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
value = Number
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return this.cmpValue
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return '';
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
style.fontSize =
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fontSize = this.
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
size = utils.formatPx(20);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
} else
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (this.fontSize >
|
|
234
|
-
size = utils.formatPx(20);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-price-root">
|
|
3
|
+
<view class="content" :style="[cmpPriceStyle]">
|
|
4
|
+
<text v-if="showUnit" class="unit" :style="[cmpUnitStyle]">{{ unitSymbol }}</text>
|
|
5
|
+
<text class="yuan-price" :style="[cmpYuanPriceStyle]">{{ cmpYuanValue }}</text>
|
|
6
|
+
<text v-if="valueUnit === 'fen'" class="fen-price" :style="[cmpFenPriceStyle]">{{ cmpFenValue }}</text>
|
|
7
|
+
</view>
|
|
8
|
+
</view>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import utils from '../../utils/utils.js';
|
|
13
|
+
/**
|
|
14
|
+
* ste-price 价格
|
|
15
|
+
* @description 金额组件
|
|
16
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui&menu=%E7%BB%84%E4%BB%B6&active=ste-price
|
|
17
|
+
* @property {Number|String} value 金额 默认值 0
|
|
18
|
+
* @property {String} valueUnit 金额单位
|
|
19
|
+
* @value fen 分(默认值){String}
|
|
20
|
+
* @value yuan 元{String}
|
|
21
|
+
* @property {Boolean} showUnit 是否显示符号
|
|
22
|
+
* @property {String} unitSymbol 符号标记,默认值 ¥
|
|
23
|
+
* @property {Number} digits 精度 默认值 -1
|
|
24
|
+
* @value -1 不处理(默认值){Number}
|
|
25
|
+
* @value 0 取整(四舍五入){Number}
|
|
26
|
+
* @value 1 保留1位小数(四舍五入){Number}
|
|
27
|
+
* @value 2 保留2位小数(四舍五入){Number}
|
|
28
|
+
* @property {Number|String} fontSize 金额文字尺寸 默认值 30
|
|
29
|
+
* @property {String} color 文字颜色 默认值 #ff1e19
|
|
30
|
+
* @property {String} linePriceColor 划线价文字颜色 默认值 #999999
|
|
31
|
+
* @property {Number|String} lineHeight 行高,Number,单位rpx,String,同原生 默认值 1
|
|
32
|
+
* @property {Boolean} isSuggestPrice 是否划线价 默认值 false
|
|
33
|
+
* @property {Number|String} marginLeft 左边距 默认值 0
|
|
34
|
+
* @property {Number|String} marginRight 右边距 默认值 0
|
|
35
|
+
* @property {Number|String} marginTop 上边距 默认值 0
|
|
36
|
+
* @property {Number|String} marginBottom 下边距 默认值 0
|
|
37
|
+
* @property {Number} styleType 金额样式 默认值 2
|
|
38
|
+
* @property {Boolean} bold 是否加粗 默认值 false
|
|
39
|
+
* @property {Function(value)} formatter 用来格式化内容
|
|
40
|
+
*/
|
|
41
|
+
export default {
|
|
42
|
+
group: '电商组件',
|
|
43
|
+
title: 'Price 价格',
|
|
44
|
+
name: 'ste-price',
|
|
45
|
+
props: {
|
|
46
|
+
// 金额
|
|
47
|
+
value: {
|
|
48
|
+
type: [Number, String, null],
|
|
49
|
+
default: 0
|
|
50
|
+
},
|
|
51
|
+
// 金额单位,fen | yuan,当为fen(分)时,值除以100
|
|
52
|
+
valueUnit: {
|
|
53
|
+
type: [String, null],
|
|
54
|
+
default: 'fen'
|
|
55
|
+
},
|
|
56
|
+
// 精度 -1 不使用精度 0 保留0位小数 1 保留1位小数 2保留2位小数
|
|
57
|
+
digits: {
|
|
58
|
+
type: [Number, null],
|
|
59
|
+
default: -1
|
|
60
|
+
},
|
|
61
|
+
// 是否显示单位符号
|
|
62
|
+
showUnit: {
|
|
63
|
+
type: [Boolean, null],
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
// 单位符号
|
|
67
|
+
unitSymbol: {
|
|
68
|
+
type: [String, null],
|
|
69
|
+
default: '¥'
|
|
70
|
+
},
|
|
71
|
+
// 金额文字尺寸
|
|
72
|
+
fontSize: {
|
|
73
|
+
type: [Number, String, null],
|
|
74
|
+
default: 30
|
|
75
|
+
},
|
|
76
|
+
// 金额文字颜
|
|
77
|
+
color: {
|
|
78
|
+
type: [String, null, null],
|
|
79
|
+
default: '#FF1E19'
|
|
80
|
+
},
|
|
81
|
+
// 划线价颜色
|
|
82
|
+
linePriceColor: {
|
|
83
|
+
type: [String, null, null],
|
|
84
|
+
default: '#999999'
|
|
85
|
+
},
|
|
86
|
+
// 行高,默认值为-1,当为-1是,line-height:1
|
|
87
|
+
lineHeight: {
|
|
88
|
+
type: [Number, String, null],
|
|
89
|
+
default: -1
|
|
90
|
+
},
|
|
91
|
+
// 是否是划线价
|
|
92
|
+
isSuggestPrice: {
|
|
93
|
+
type: [Boolean, null],
|
|
94
|
+
default: false
|
|
95
|
+
},
|
|
96
|
+
// 左margin
|
|
97
|
+
marginLeft: {
|
|
98
|
+
type: [Number, String, null],
|
|
99
|
+
default: 0
|
|
100
|
+
}, // 右margin
|
|
101
|
+
marginRight: {
|
|
102
|
+
type: [Number, String, null],
|
|
103
|
+
default: 0
|
|
104
|
+
},
|
|
105
|
+
// 上margin
|
|
106
|
+
marginTop: {
|
|
107
|
+
type: [Number, String, null],
|
|
108
|
+
default: 0
|
|
109
|
+
}, // 下margin
|
|
110
|
+
marginBottom: {
|
|
111
|
+
type: [Number, String, null],
|
|
112
|
+
default: 0
|
|
113
|
+
},
|
|
114
|
+
// 金额样式 1 元和角分大小相等(特殊价格) 2 角分小于元(常规价格)3 价格符号和角,分相等
|
|
115
|
+
styleType: {
|
|
116
|
+
type: [Number, null],
|
|
117
|
+
default: 2
|
|
118
|
+
},
|
|
119
|
+
bold: {
|
|
120
|
+
type: [Boolean, null],
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
123
|
+
// 过滤器
|
|
124
|
+
formatter: {
|
|
125
|
+
type: [Function, null],
|
|
126
|
+
default: undefined
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
data() {
|
|
130
|
+
return {};
|
|
131
|
+
},
|
|
132
|
+
computed: {
|
|
133
|
+
cmpValue() {
|
|
134
|
+
if (this.formatter && typeof this.formatter === 'function') {
|
|
135
|
+
return this.formatter(this.value);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let value = this.value;
|
|
139
|
+
if (this.valueUnit == 'fen') {
|
|
140
|
+
value = utils.fenToYuan(this.value, -1, '', 0);
|
|
141
|
+
}
|
|
142
|
+
if (this.digits == -1) {
|
|
143
|
+
value = Number.parseFloat(Number(value)).toString();
|
|
144
|
+
} else {
|
|
145
|
+
value = Number(value).toFixed(this.digits).toString();
|
|
146
|
+
}
|
|
147
|
+
return value;
|
|
148
|
+
},
|
|
149
|
+
cmpYuanValue() {
|
|
150
|
+
if (this.cmpValue) {
|
|
151
|
+
if (this.cmpValue.indexOf('.') > -1) {
|
|
152
|
+
return this.cmpValue.split('.')[0];
|
|
153
|
+
} else {
|
|
154
|
+
return this.cmpValue;
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
return utils.fenToYuan(this.value, -1, '', 1);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
cmpFenValue() {
|
|
161
|
+
if (this.cmpValue) {
|
|
162
|
+
if (this.cmpValue.indexOf('.') > -1) {
|
|
163
|
+
return '.' + this.cmpValue.split('.')[1];
|
|
164
|
+
}
|
|
165
|
+
return '';
|
|
166
|
+
} else {
|
|
167
|
+
return utils.fenToYuan(this.value, -1, '', 2);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
cmpPriceStyle() {
|
|
171
|
+
return {
|
|
172
|
+
lineHeight: this.lineHeight === -1 ? 0.8 : utils.formatPx(this.lineHeight),
|
|
173
|
+
color: (this.isSuggestPrice ? this.linePriceColor : this.color) + ' !important',
|
|
174
|
+
marginLeft: utils.formatPx(this.marginLeft),
|
|
175
|
+
marginRight: utils.formatPx(this.marginRight),
|
|
176
|
+
marginTop: utils.formatPx(this.marginTop),
|
|
177
|
+
marginBottom: utils.formatPx(this.marginBottom),
|
|
178
|
+
fontWeight: this.bold ? 'bold' : 'normal'
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
cmpUnitStyle() {
|
|
182
|
+
let style = {
|
|
183
|
+
textDecoration: this.isSuggestPrice ? 'line-through' : 'none',
|
|
184
|
+
color: (this.isSuggestPrice ? this.linePriceColor : this.color) + ' !important'
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
if (this.isSuggestPrice) {
|
|
188
|
+
style.color = this.linePriceColor;
|
|
189
|
+
style.fontSize = utils.formatPx(this.fontSize);
|
|
190
|
+
} else {
|
|
191
|
+
style.fontSize = this.calcFontSize();
|
|
192
|
+
}
|
|
193
|
+
return style;
|
|
194
|
+
},
|
|
195
|
+
cmpYuanPriceStyle() {
|
|
196
|
+
return {
|
|
197
|
+
fontSize: utils.formatPx(this.fontSize),
|
|
198
|
+
textDecoration: this.isSuggestPrice ? 'line-through' : 'none'
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
cmpFenPriceStyle() {
|
|
202
|
+
let fontSize = 0;
|
|
203
|
+
if (this.isSuggestPrice) {
|
|
204
|
+
fontSize = utils.formatPx(this.fontSize);
|
|
205
|
+
} else {
|
|
206
|
+
if (this.styleType == 2) {
|
|
207
|
+
fontSize = this.calcFontSize();
|
|
208
|
+
} else {
|
|
209
|
+
fontSize = utils.formatPx(this.fontSize);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
fontSize,
|
|
214
|
+
textDecoration: this.isSuggestPrice ? 'line-through' : 'none'
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
methods: {
|
|
219
|
+
calcFontSize() {
|
|
220
|
+
let size = utils.formatPx(this.fontSize);
|
|
221
|
+
if (this.styleType == 1) {
|
|
222
|
+
if (this.fontSize <= 40) {
|
|
223
|
+
size = utils.formatPx(20);
|
|
224
|
+
} else {
|
|
225
|
+
size = utils.formatPx(this.fontSize - 20);
|
|
226
|
+
}
|
|
227
|
+
} else if (this.styleType == 3) {
|
|
228
|
+
size = utils.formatPx(this.fontSize);
|
|
229
|
+
} else {
|
|
230
|
+
// 常规 - 分元不一致
|
|
231
|
+
if (this.fontSize > 28 && this.fontSize <= 40) {
|
|
232
|
+
size = utils.formatPx(20);
|
|
233
|
+
} else if (this.fontSize > 40) {
|
|
234
|
+
size = utils.formatPx(this.fontSize - 20);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return size;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
</script>
|
|
242
|
+
|
|
243
|
+
<style lang="scss" scoped>
|
|
244
|
+
.ste-price-root {
|
|
245
|
+
display: inline-flex;
|
|
246
|
+
.content {
|
|
247
|
+
display: inline-block;
|
|
248
|
+
vertical-align: bottom;
|
|
249
|
+
}
|
|
250
|
+
.unit {
|
|
251
|
+
vertical-align: baseline;
|
|
252
|
+
}
|
|
253
|
+
.yuan-price {
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
</style>
|