@conecli/cone-render 0.10.1-shop3.53 → 0.10.1-shop3.54
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/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
- package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
- package/dist/components/base/ShopLeGaoTag/index.module.scss +1 -0
- package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
- package/dist/modules/ContainerFloorList/index.h5.module.scss +2 -2
- package/dist/open/components/index.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
console.warn('🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:', {
|
|
3
2
|
type,
|
|
4
3
|
data,
|
|
5
4
|
text,
|
|
6
5
|
});
|
|
7
6
|
sgmCustomReport({
|
|
8
7
|
code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_${type}`),
|
|
9
8
|
msg: {
|
|
10
9
|
type,
|
|
11
10
|
data,
|
|
12
11
|
text: '[双价格组件]' + text,
|
|
13
12
|
},
|
|
14
13
|
});
|
|
15
14
|
return rest.some((item) => item === undefined || item === '');
|
|
16
15
|
const numPrice = Number(strPrice);
|
|
17
16
|
if (isNaN(numPrice)) {
|
|
18
17
|
reportException({
|
|
19
18
|
type: 'isNotNumericType',
|
|
20
19
|
data: props,
|
|
21
20
|
text: `传入价格字段值“${strPrice}”转换数字报错`,
|
|
22
21
|
});
|
|
23
22
|
return false;
|
|
24
23
|
}
|
|
25
24
|
else if (numPrice <= 0) {
|
|
26
25
|
reportException({
|
|
27
26
|
type: 'isNotPositiveNumber',
|
|
28
27
|
data: props,
|
|
29
28
|
text: `传入价格字段值“${strPrice}”不是一个正数`,
|
|
30
29
|
});
|
|
31
30
|
return false;
|
|
32
31
|
}
|
|
33
32
|
const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
|
|
34
33
|
if (result && result[3]?.length > 2) {
|
|
35
34
|
reportException({
|
|
36
35
|
type: 'decimalPlaceTooLong',
|
|
37
36
|
data: props,
|
|
38
37
|
text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
|
|
39
38
|
});
|
|
40
39
|
return false;
|
|
41
40
|
}
|
|
42
41
|
if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
|
|
43
42
|
reportException({
|
|
44
43
|
type: 'findScientificNotation',
|
|
45
44
|
data: props,
|
|
46
45
|
text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
return true;
|
|
50
49
|
const { jdPrice, finalPrice, forceShowFinalPrice } = props;
|
|
51
50
|
if (jdPrice && finalPrice) {
|
|
52
51
|
const getLastPassValidateState = forceShowFinalPrice || Number(finalPrice) < Number(jdPrice);
|
|
53
52
|
!getLastPassValidateState &&
|
|
54
53
|
reportException({
|
|
55
54
|
type: 'pricesCompareException',
|
|
56
55
|
data: props,
|
|
57
56
|
text: `身份/到手价必须小于松果价`,
|
|
58
57
|
});
|
|
59
58
|
return getLastPassValidateState;
|
|
60
59
|
} else {
|
|
61
60
|
return true;
|
|
62
61
|
}
|
|
63
62
|
const numPrice = Number(strPrice);
|
|
64
63
|
const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
|
|
65
64
|
if (result) {
|
|
66
65
|
return {
|
|
67
66
|
integerPrice: result[1],
|
|
68
67
|
decimalPrice: (result[3] || '').replace(/0+$/, ''),
|
|
69
68
|
};
|
|
70
69
|
} else {
|
|
71
70
|
reportException({
|
|
72
71
|
type: 'deconstructException',
|
|
73
72
|
data: props,
|
|
74
73
|
text: `解构传入价格字段值“${strPrice}”解构发生异常`,
|
|
75
74
|
});
|
|
76
75
|
return null;
|
|
77
76
|
}
|
|
78
77
|
const {
|
|
79
78
|
jdPrice,
|
|
80
79
|
finalPrice,
|
|
81
80
|
priceText = '',
|
|
82
81
|
priceTextColor = '',
|
|
83
82
|
priceUnit = '',
|
|
84
83
|
priceType,
|
|
85
84
|
hitUserIdentity = false,
|
|
86
85
|
forceShowFinalPrice = false,
|
|
87
86
|
hideSmallPrice = false,
|
|
88
87
|
fallbackRender = null,
|
|
89
88
|
className = null,
|
|
90
89
|
style = {},
|
|
91
90
|
childrenClassName = null,
|
|
92
91
|
bigNoPriceClassName = null,
|
|
93
92
|
bigSymbolClassName = null,
|
|
94
93
|
bigIntegerClassName = null,
|
|
95
94
|
bigDecimalClassName = null,
|
|
96
95
|
priceDescClassName = null,
|
|
97
96
|
smallPriceClassName = null,
|
|
98
97
|
smallPriceDescClassName = null,
|
|
99
98
|
lineNumber = 1,
|
|
100
99
|
size = 'M',
|
|
101
100
|
isDefaultRemoveSmallPrice = false,
|
|
102
101
|
useFontV2 = false,
|
|
103
102
|
useFontV2Bold = false,
|
|
104
103
|
useSmallFontV2 = false,
|
|
105
104
|
useSmallFontV2Bold = false,
|
|
106
105
|
} = props;
|
|
107
106
|
let useBackstop = false;
|
|
108
107
|
const isShowPriceUnit = priceUnit && priceUnit !== '';
|
|
109
108
|
if (isNull(props.jdPrice, props.priceType)) {
|
|
110
109
|
useBackstop = true;
|
|
111
110
|
reportException({
|
|
112
111
|
type: 'paramMiss',
|
|
113
112
|
data: props,
|
|
114
113
|
text: '缺少必要入参:jdPrice、priceType',
|
|
115
114
|
});
|
|
116
115
|
} else if (
|
|
117
116
|
!allowedNoHitUserIdentityTypes.includes(props.priceType) &&
|
|
118
117
|
props.hitUserIdentity === undefined
|
|
119
118
|
) {
|
|
120
119
|
useBackstop = true;
|
|
121
120
|
reportException({
|
|
122
121
|
type: 'paramMiss',
|
|
123
122
|
data: props,
|
|
124
123
|
text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
126
|
const especialHitStyleType = {
|
|
128
127
|
7: 'plusStyle',
|
|
129
128
|
9: 'samStyle',
|
|
130
129
|
};
|
|
131
130
|
const especialMissStyleType = {
|
|
132
131
|
7: 'plusStyle',
|
|
133
132
|
8: 'fansStyle',
|
|
134
133
|
9: 'samStyle',
|
|
135
134
|
10: 'studentStyle',
|
|
136
135
|
12: 'yhdStyle',
|
|
137
136
|
13: 'memberStyle',
|
|
138
137
|
};
|
|
139
138
|
const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
|
|
140
139
|
const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
|
|
141
140
|
const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
|
|
142
141
|
const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
|
|
143
142
|
const isHideSmallPrice =
|
|
144
143
|
hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
|
|
145
144
|
const isTextPrice = priceType === 4;
|
|
146
145
|
if (!isTextPrice && !useBackstop) {
|
|
147
146
|
if (finalPrice && !numericPriceValidate(finalPrice, props)) {
|
|
148
147
|
useBackstop = true;
|
|
149
148
|
} else if (!numericPriceValidate(jdPrice, props)) {
|
|
150
149
|
useBackstop = true;
|
|
151
150
|
}
|
|
152
151
|
if (!useBackstop && !isOnlyShowBigPrice && !isHideSmallPrice && !pricesCompareValidate(props)) {
|
|
153
152
|
useBackstop = true;
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
const bigPriceObj =
|
|
157
156
|
isTextPrice || useBackstop
|
|
158
157
|
? {}
|
|
159
158
|
: getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
|
|
160
159
|
const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
|
|
161
160
|
const isPriceDescInFront = isEquivalentHit;
|
|
162
161
|
const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
|
|
163
162
|
const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
|
|
164
163
|
const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
|
|
165
164
|
const sizeLineHeight = {
|
|
166
165
|
XS: 28,
|
|
167
166
|
S: 34,
|
|
168
167
|
M: 40,
|
|
169
168
|
L: 46,
|
|
170
169
|
XL: 52,
|
|
171
170
|
};
|
|
172
171
|
const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
|
|
173
172
|
const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
|
|
174
173
|
const computedHeightStyle = {
|
|
175
174
|
height: wrapHeight,
|
|
176
175
|
};
|
|
177
176
|
const itemCommonStyle = {
|
|
178
177
|
height: lineHeight,
|
|
179
178
|
};
|
|
180
179
|
const priceTextStyle = priceTextColor ? { color: priceTextColor } : {};
|
|
181
180
|
const needSizeStyles = [
|
|
182
181
|
'bigNoPrice',
|
|
183
182
|
'bigSymbol',
|
|
184
183
|
'bigInteger',
|
|
185
184
|
'bigDecimal',
|
|
186
185
|
'priceDesc',
|
|
187
186
|
'smallPrice',
|
|
188
187
|
'priceUnit',
|
|
189
188
|
];
|
|
190
189
|
const sizeStyles = needSizeStyles.reduce((acc, cur) => {
|
|
191
190
|
acc[cur] = styles[cur + size];
|
|
192
191
|
return acc;
|
|
193
192
|
}, {});
|
|
194
193
|
const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
|
|
195
194
|
const noPriceShowText =
|
|
196
195
|
priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
|
|
197
196
|
if (useBackstop && fallbackRender) {
|
|
198
197
|
return fallbackRender;
|
|
199
198
|
}
|
|
200
199
|
return (
|
|
201
200
|
<View
|
|
202
201
|
className={classNames(styles.wrap, className)}
|
|
203
202
|
style={{ ...computedHeightStyle, ...style }}
|
|
204
203
|
>
|
|
205
204
|
{isTextPrice || useBackstop ? (
|
|
206
205
|
<Text
|
|
207
206
|
className={classNames(
|
|
208
207
|
styles.childStyle,
|
|
209
208
|
styles.bigStyle,
|
|
210
209
|
styles.bigNoPrice,
|
|
211
210
|
sizeStyles['bigNoPrice'],
|
|
212
211
|
childrenClassName,
|
|
213
212
|
bigNoPriceClassName,
|
|
214
213
|
)}
|
|
215
214
|
style={{ ...itemCommonStyle }}
|
|
216
215
|
>
|
|
217
216
|
{useBackstop ? finalFallbackText : noPriceShowText}
|
|
218
217
|
</Text>
|
|
219
218
|
) : (
|
|
220
219
|
[
|
|
221
220
|
<Text
|
|
222
221
|
className={classNames(
|
|
223
222
|
styles.childStyle,
|
|
224
223
|
styles.bigStyle,
|
|
225
224
|
styles.bigSymbol,
|
|
226
225
|
sizeStyles['bigSymbol'],
|
|
227
226
|
hitColorStyle,
|
|
228
227
|
childrenClassName,
|
|
229
228
|
bigSymbolClassName,
|
|
230
229
|
{
|
|
231
230
|
[styles.fontV2]: useFontV2,
|
|
232
231
|
[styles.fontV2Bold]: useFontV2Bold,
|
|
233
232
|
},
|
|
234
233
|
)}
|
|
235
234
|
key="bigSymbol"
|
|
236
235
|
style={{ ...itemCommonStyle }}
|
|
237
236
|
>
|
|
238
237
|
¥
|
|
239
238
|
</Text>,
|
|
240
239
|
<Text
|
|
241
240
|
className={classNames(
|
|
242
241
|
styles.childStyle,
|
|
243
242
|
styles.bigStyle,
|
|
244
243
|
styles.bigInteger,
|
|
245
244
|
sizeStyles['bigInteger'],
|
|
246
245
|
hitColorStyle,
|
|
247
246
|
!isOnlyShowBigPrice &&
|
|
248
247
|
!isBigPriceHasDecimal &&
|
|
249
248
|
!isPriceDescInFront &&
|
|
250
249
|
!isShowPriceUnit
|
|
251
250
|
? styles.rightMargin
|
|
252
251
|
: null,
|
|
253
252
|
childrenClassName,
|
|
254
253
|
bigIntegerClassName,
|
|
255
254
|
{
|
|
256
255
|
[styles.fontV2]: useFontV2,
|
|
257
256
|
[styles.fontV2Bold]: useFontV2Bold,
|
|
258
257
|
},
|
|
259
258
|
)}
|
|
260
259
|
key="bigInteger"
|
|
261
260
|
style={{ ...itemCommonStyle }}
|
|
262
261
|
>
|
|
263
262
|
{integerPrice}
|
|
264
263
|
</Text>,
|
|
265
264
|
isBigPriceHasDecimal ? (
|
|
266
265
|
<Text
|
|
267
266
|
className={classNames(
|
|
268
267
|
styles.childStyle,
|
|
269
268
|
styles.bigStyle,
|
|
270
269
|
styles.bigDecimal,
|
|
271
270
|
sizeStyles['bigDecimal'],
|
|
272
271
|
hitColorStyle,
|
|
273
272
|
isPriceDescInFront || isShowPriceUnit ? null : styles.rightMargin,
|
|
274
273
|
childrenClassName,
|
|
275
274
|
bigDecimalClassName,
|
|
276
275
|
{
|
|
277
276
|
[styles.fontV2]: useFontV2,
|
|
278
277
|
[styles.fontV2Bold]: useFontV2Bold,
|
|
279
278
|
},
|
|
280
279
|
)}
|
|
281
280
|
key="bigDecimal"
|
|
282
281
|
style={{ ...itemCommonStyle }}
|
|
283
282
|
>
|
|
284
283
|
.{decimalPrice}
|
|
285
284
|
</Text>
|
|
286
285
|
) : null,
|
|
287
286
|
isShowPriceUnit ? (
|
|
288
287
|
<Text
|
|
289
288
|
className={classNames(
|
|
290
289
|
styles.childStyle,
|
|
291
290
|
styles.priceUnit,
|
|
292
291
|
styles.rightMargin,
|
|
293
292
|
sizeStyles['priceUnit'],
|
|
294
293
|
styles.bigStyle,
|
|
295
294
|
hitColorStyle,
|
|
296
295
|
childrenClassName,
|
|
297
296
|
priceDescClassName,
|
|
298
297
|
)}
|
|
299
298
|
key="descFrontUnit"
|
|
300
299
|
style={{ ...itemCommonStyle }}
|
|
301
300
|
>
|
|
302
301
|
{priceUnit}
|
|
303
302
|
</Text>
|
|
304
303
|
) : null,
|
|
305
304
|
!isOnlyShowBigPrice && [
|
|
306
305
|
isPriceDescInFront && (
|
|
307
306
|
<Text
|
|
308
307
|
className={classNames(
|
|
309
308
|
styles.childStyle,
|
|
310
309
|
styles.priceDesc,
|
|
311
310
|
{
|
|
312
311
|
[styles['priceEnDesc']]: isLanguageForEn,
|
|
313
312
|
},
|
|
314
313
|
{
|
|
315
314
|
[styles['priceHiddenDesc']]: priceText === '',
|
|
316
315
|
},
|
|
317
316
|
sizeStyles['priceDesc'],
|
|
318
317
|
styles.bigStyle,
|
|
319
318
|
hitColorStyle,
|
|
320
319
|
isPriceDescInFront && !isShowPriceUnit ? styles.rightMargin : null,
|
|
321
320
|
childrenClassName,
|
|
322
321
|
priceDescClassName,
|
|
323
322
|
)}
|
|
324
323
|
key="descFront"
|
|
325
324
|
style={{ ...itemCommonStyle, ...priceTextStyle }}
|
|
326
325
|
>
|
|
327
326
|
{priceText === '' ? '_' : priceText}
|
|
328
327
|
</Text>
|
|
329
328
|
),
|
|
330
329
|
<View
|
|
331
330
|
style={{
|
|
332
331
|
display: 'inline-flex',
|
|
333
332
|
}}
|
|
334
333
|
>
|
|
335
334
|
{smallPrice && !isHideSmallPrice ? (
|
|
336
335
|
<Text
|
|
337
336
|
className={classNames(
|
|
338
337
|
styles.childStyle,
|
|
339
338
|
styles.smallPrice,
|
|
340
339
|
sizeStyles['smallPrice'],
|
|
341
340
|
styles.smallStyle,
|
|
342
341
|
missColorStyle,
|
|
343
342
|
childrenClassName,
|
|
344
343
|
smallPriceClassName,
|
|
345
344
|
{
|
|
346
345
|
[styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
|
|
347
346
|
[styles.fontV2Bold]: useSmallFontV2 ? false : useSmallFontV2Bold || useFontV2Bold,
|
|
348
347
|
},
|
|
349
348
|
)}
|
|
350
349
|
key="smallPrice"
|
|
351
350
|
style={{ ...itemCommonStyle }}
|
|
352
351
|
>
|
|
353
352
|
¥{Number(smallPrice)}
|
|
354
353
|
</Text>
|
|
355
354
|
) : null}
|
|
356
355
|
{isShowPriceUnit && !isHideSmallPrice ? (
|
|
357
356
|
<Text
|
|
358
357
|
className={classNames(
|
|
359
358
|
styles.childStyle,
|
|
360
359
|
styles.priceUnit,
|
|
361
360
|
sizeStyles['priceUnit'],
|
|
362
361
|
styles.smallStyle,
|
|
363
362
|
styles.missPriceDesc,
|
|
364
363
|
missColorStyle,
|
|
365
364
|
childrenClassName,
|
|
366
365
|
smallPriceDescClassName || priceDescClassName,
|
|
367
366
|
)}
|
|
368
367
|
key="descFrontUnit"
|
|
369
368
|
style={{ ...itemCommonStyle }}
|
|
370
369
|
>
|
|
371
370
|
{priceUnit}
|
|
372
371
|
</Text>
|
|
373
372
|
) : null}
|
|
374
373
|
{!isPriceDescInFront && !isHideSmallPrice && (
|
|
375
374
|
<Text
|
|
376
375
|
className={classNames(
|
|
377
376
|
styles.childStyle,
|
|
378
377
|
styles.priceDesc,
|
|
379
378
|
{
|
|
380
379
|
[styles['priceEnDesc']]: isLanguageForEn,
|
|
381
380
|
},
|
|
382
381
|
{
|
|
383
382
|
[styles['priceHiddenDesc']]: priceText === '',
|
|
384
383
|
},
|
|
385
384
|
sizeStyles['priceDesc'],
|
|
386
385
|
styles.smallStyle,
|
|
387
386
|
styles.missPriceDesc,
|
|
388
387
|
missColorStyle,
|
|
389
388
|
childrenClassName,
|
|
390
389
|
smallPriceDescClassName || priceDescClassName,
|
|
391
390
|
)}
|
|
392
391
|
key="descBack"
|
|
393
392
|
style={{ ...itemCommonStyle }}
|
|
394
393
|
>
|
|
395
394
|
{priceText === '' ? '_' : priceText}
|
|
396
395
|
</Text>
|
|
397
396
|
)}
|
|
398
397
|
</View>,
|
|
399
398
|
],
|
|
400
399
|
]
|
|
401
400
|
)}
|
|
402
401
|
</View>
|
|
403
402
|
);
|
|
403
|
+
import React from 'react';
|
|
404
404
|
console.warn('🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:', {
|
|
405
405
|
type,
|
|
406
406
|
data,
|
|
407
407
|
text,
|
|
408
408
|
});
|
|
409
409
|
sgmCustomReport({
|
|
410
410
|
code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_${type}`),
|
|
411
411
|
msg: {
|
|
412
412
|
type,
|
|
413
413
|
data,
|
|
414
414
|
text: '[双价格组件]' + text,
|
|
415
415
|
},
|
|
416
416
|
});
|
|
417
417
|
return rest.some((item) => item === undefined || item === '');
|
|
418
418
|
const numPrice = Number(strPrice);
|
|
419
419
|
if (isNaN(numPrice)) {
|
|
420
420
|
reportException({
|
|
421
421
|
type: 'isNotNumericType',
|
|
422
422
|
data: props,
|
|
423
423
|
text: `传入价格字段值“${strPrice}”转换数字报错`,
|
|
424
424
|
});
|
|
425
425
|
return false;
|
|
426
426
|
}
|
|
427
427
|
else if (numPrice <= 0) {
|
|
428
428
|
reportException({
|
|
429
429
|
type: 'isNotPositiveNumber',
|
|
430
430
|
data: props,
|
|
431
431
|
text: `传入价格字段值“${strPrice}”不是一个正数`,
|
|
432
432
|
});
|
|
433
433
|
return false;
|
|
434
434
|
}
|
|
435
435
|
const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
|
|
436
436
|
if (result && result[3]?.length > 2) {
|
|
437
437
|
reportException({
|
|
438
438
|
type: 'decimalPlaceTooLong',
|
|
439
439
|
data: props,
|
|
440
440
|
text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
|
|
441
441
|
});
|
|
442
442
|
return false;
|
|
443
443
|
}
|
|
444
444
|
if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
|
|
445
445
|
reportException({
|
|
446
446
|
type: 'findScientificNotation',
|
|
447
447
|
data: props,
|
|
448
448
|
text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
return true;
|
|
452
452
|
const { jdPrice, finalPrice, forceShowFinalPrice } = props;
|
|
453
453
|
if (jdPrice && finalPrice) {
|
|
454
454
|
const getLastPassValidateState = forceShowFinalPrice || Number(finalPrice) < Number(jdPrice);
|
|
455
455
|
!getLastPassValidateState &&
|
|
456
456
|
reportException({
|
|
457
457
|
type: 'pricesCompareException',
|
|
458
458
|
data: props,
|
|
459
459
|
text: `身份/到手价必须小于松果价`,
|
|
460
460
|
});
|
|
461
461
|
return getLastPassValidateState;
|
|
462
462
|
} else {
|
|
463
463
|
return true;
|
|
464
464
|
}
|
|
465
465
|
const numPrice = Number(strPrice);
|
|
466
466
|
const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
|
|
467
467
|
if (result) {
|
|
468
468
|
return {
|
|
469
469
|
integerPrice: result[1],
|
|
470
470
|
decimalPrice: (result[3] || '').replace(/0+$/, ''),
|
|
471
471
|
};
|
|
472
472
|
} else {
|
|
473
473
|
reportException({
|
|
474
474
|
type: 'deconstructException',
|
|
475
475
|
data: props,
|
|
476
476
|
text: `解构传入价格字段值“${strPrice}”解构发生异常`,
|
|
477
477
|
});
|
|
478
478
|
return null;
|
|
479
479
|
}
|
|
480
480
|
const {
|
|
481
481
|
jdPrice,
|
|
482
482
|
finalPrice,
|
|
483
483
|
priceText = '',
|
|
484
484
|
priceTextColor = '',
|
|
485
485
|
priceUnit = '',
|
|
486
486
|
priceType,
|
|
487
487
|
hitUserIdentity = false,
|
|
488
488
|
forceShowFinalPrice = false,
|
|
489
489
|
hideSmallPrice = false,
|
|
490
490
|
fallbackRender = null,
|
|
491
491
|
className = null,
|
|
492
492
|
style = {},
|
|
493
493
|
childrenClassName = null,
|
|
494
494
|
bigNoPriceClassName = null,
|
|
495
495
|
bigSymbolClassName = null,
|
|
496
496
|
bigIntegerClassName = null,
|
|
497
497
|
bigDecimalClassName = null,
|
|
498
498
|
priceDescClassName = null,
|
|
499
499
|
smallPriceClassName = null,
|
|
500
500
|
smallPriceDescClassName = null,
|
|
501
501
|
lineNumber = 1,
|
|
502
502
|
size = 'M',
|
|
503
503
|
isDefaultRemoveSmallPrice = false,
|
|
504
504
|
useFontV2 = false,
|
|
505
505
|
useFontV2Bold = false,
|
|
506
506
|
useSmallFontV2 = false,
|
|
507
507
|
useSmallFontV2Bold = false,
|
|
508
508
|
} = props;
|
|
509
509
|
let useBackstop = false;
|
|
510
510
|
const isShowPriceUnit = priceUnit && priceUnit !== '';
|
|
511
511
|
if (isNull(props.jdPrice, props.priceType)) {
|
|
512
512
|
useBackstop = true;
|
|
513
513
|
reportException({
|
|
514
514
|
type: 'paramMiss',
|
|
515
515
|
data: props,
|
|
516
516
|
text: '缺少必要入参:jdPrice、priceType',
|
|
517
517
|
});
|
|
518
518
|
} else if (
|
|
519
519
|
!allowedNoHitUserIdentityTypes.includes(props.priceType) &&
|
|
520
520
|
props.hitUserIdentity === undefined
|
|
521
521
|
) {
|
|
522
522
|
useBackstop = true;
|
|
523
523
|
reportException({
|
|
524
524
|
type: 'paramMiss',
|
|
525
525
|
data: props,
|
|
526
526
|
text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
const especialHitStyleType = {
|
|
530
530
|
7: 'plusStyle',
|
|
531
531
|
9: 'samStyle',
|
|
532
532
|
};
|
|
533
533
|
const especialMissStyleType = {
|
|
534
534
|
7: 'plusStyle',
|
|
535
535
|
8: 'fansStyle',
|
|
536
536
|
9: 'samStyle',
|
|
537
537
|
10: 'studentStyle',
|
|
538
538
|
12: 'yhdStyle',
|
|
539
539
|
13: 'memberStyle',
|
|
540
540
|
};
|
|
541
541
|
const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
|
|
542
542
|
const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
|
|
543
543
|
const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
|
|
544
544
|
const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
|
|
545
545
|
const isHideSmallPrice =
|
|
546
546
|
hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
|
|
547
547
|
const isTextPrice = priceType === 4;
|
|
548
548
|
if (!isTextPrice && !useBackstop) {
|
|
549
549
|
if (finalPrice && !numericPriceValidate(finalPrice, props)) {
|
|
550
550
|
useBackstop = true;
|
|
551
551
|
} else if (!numericPriceValidate(jdPrice, props)) {
|
|
552
552
|
useBackstop = true;
|
|
553
553
|
}
|
|
554
554
|
if (!useBackstop && !isOnlyShowBigPrice && !isHideSmallPrice && !pricesCompareValidate(props)) {
|
|
555
555
|
useBackstop = true;
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
const bigPriceObj =
|
|
559
559
|
isTextPrice || useBackstop
|
|
560
560
|
? {}
|
|
561
561
|
: getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
|
|
562
562
|
const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
|
|
563
563
|
const isPriceDescInFront = isEquivalentHit;
|
|
564
564
|
const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
|
|
565
565
|
const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
|
|
566
566
|
const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
|
|
567
567
|
const sizeLineHeight = {
|
|
568
568
|
XS: 28,
|
|
569
569
|
S: 34,
|
|
570
570
|
M: 40,
|
|
571
571
|
L: 46,
|
|
572
572
|
XL: 52,
|
|
573
573
|
};
|
|
574
574
|
const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
|
|
575
575
|
const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
|
|
576
576
|
const computedHeightStyle = {
|
|
577
577
|
height: wrapHeight,
|
|
578
578
|
};
|
|
579
579
|
const itemCommonStyle = {
|
|
580
580
|
height: lineHeight,
|
|
581
581
|
};
|
|
582
582
|
const priceTextStyle = priceTextColor ? { color: priceTextColor } : {};
|
|
583
583
|
const needSizeStyles = [
|
|
584
584
|
'bigNoPrice',
|
|
585
585
|
'bigSymbol',
|
|
586
586
|
'bigInteger',
|
|
587
587
|
'bigDecimal',
|
|
588
588
|
'priceDesc',
|
|
589
589
|
'smallPrice',
|
|
590
590
|
'priceUnit',
|
|
591
591
|
];
|
|
592
592
|
const sizeStyles = needSizeStyles.reduce((acc, cur) => {
|
|
593
593
|
acc[cur] = styles[cur + size];
|
|
594
594
|
return acc;
|
|
595
595
|
}, {});
|
|
596
596
|
const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
|
|
597
597
|
const noPriceShowText =
|
|
598
598
|
priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
|
|
599
599
|
if (useBackstop && fallbackRender) {
|
|
600
600
|
return fallbackRender;
|
|
601
601
|
}
|
|
602
602
|
return (
|
|
603
603
|
<View
|
|
604
604
|
className={classNames(styles.wrap, className)}
|
|
605
605
|
style={{ ...computedHeightStyle, ...style }}
|
|
606
606
|
>
|
|
607
607
|
{isTextPrice || useBackstop ? (
|
|
608
608
|
<Text
|
|
609
609
|
className={classNames(
|
|
610
610
|
styles.childStyle,
|
|
611
611
|
styles.bigStyle,
|
|
612
612
|
styles.bigNoPrice,
|
|
613
613
|
sizeStyles['bigNoPrice'],
|
|
614
614
|
childrenClassName,
|
|
615
615
|
bigNoPriceClassName,
|
|
616
616
|
)}
|
|
617
617
|
style={{ ...itemCommonStyle }}
|
|
618
618
|
>
|
|
619
619
|
{useBackstop ? finalFallbackText : noPriceShowText}
|
|
620
620
|
</Text>
|
|
621
621
|
) : (
|
|
622
622
|
[
|
|
623
623
|
<Text
|
|
624
624
|
className={classNames(
|
|
625
625
|
styles.childStyle,
|
|
626
626
|
styles.bigStyle,
|
|
627
627
|
styles.bigSymbol,
|
|
628
628
|
sizeStyles['bigSymbol'],
|
|
629
629
|
hitColorStyle,
|
|
630
630
|
childrenClassName,
|
|
631
631
|
bigSymbolClassName,
|
|
632
632
|
{
|
|
633
633
|
[styles.fontV2]: useFontV2,
|
|
634
634
|
[styles.fontV2Bold]: useFontV2Bold,
|
|
635
635
|
},
|
|
636
636
|
)}
|
|
637
637
|
key="bigSymbol"
|
|
638
638
|
style={{ ...itemCommonStyle }}
|
|
639
639
|
>
|
|
640
640
|
¥
|
|
641
641
|
</Text>,
|
|
642
642
|
<Text
|
|
643
643
|
className={classNames(
|
|
644
644
|
styles.childStyle,
|
|
645
645
|
styles.bigStyle,
|
|
646
646
|
styles.bigInteger,
|
|
647
647
|
sizeStyles['bigInteger'],
|
|
648
648
|
hitColorStyle,
|
|
649
649
|
!isOnlyShowBigPrice &&
|
|
650
650
|
!isBigPriceHasDecimal &&
|
|
651
651
|
!isPriceDescInFront &&
|
|
652
652
|
!isShowPriceUnit
|
|
653
653
|
? styles.rightMargin
|
|
654
654
|
: null,
|
|
655
655
|
childrenClassName,
|
|
656
656
|
bigIntegerClassName,
|
|
657
657
|
{
|
|
658
658
|
[styles.fontV2]: useFontV2,
|
|
659
659
|
[styles.fontV2Bold]: useFontV2Bold,
|
|
660
660
|
},
|
|
661
661
|
)}
|
|
662
662
|
key="bigInteger"
|
|
663
663
|
style={{ ...itemCommonStyle }}
|
|
664
664
|
>
|
|
665
665
|
{integerPrice}
|
|
666
666
|
</Text>,
|
|
667
667
|
isBigPriceHasDecimal ? (
|
|
668
668
|
<Text
|
|
669
669
|
className={classNames(
|
|
670
670
|
styles.childStyle,
|
|
671
671
|
styles.bigStyle,
|
|
672
672
|
styles.bigDecimal,
|
|
673
673
|
sizeStyles['bigDecimal'],
|
|
674
674
|
hitColorStyle,
|
|
675
675
|
isPriceDescInFront || priceText === '' || isShowPriceUnit
|
|
676
676
|
? null
|
|
677
677
|
: styles.rightMargin,
|
|
678
678
|
childrenClassName,
|
|
679
679
|
bigDecimalClassName,
|
|
680
680
|
{
|
|
681
681
|
[styles.fontV2]: useFontV2,
|
|
682
682
|
[styles.fontV2Bold]: useFontV2Bold,
|
|
683
683
|
},
|
|
684
684
|
)}
|
|
685
685
|
key="bigDecimal"
|
|
686
686
|
style={{ ...itemCommonStyle }}
|
|
687
687
|
>
|
|
688
688
|
.{decimalPrice}
|
|
689
689
|
</Text>
|
|
690
690
|
) : null,
|
|
691
691
|
isShowPriceUnit ? (
|
|
692
692
|
<Text
|
|
693
693
|
className={classNames(
|
|
694
694
|
styles.childStyle,
|
|
695
695
|
styles.priceUnit,
|
|
696
696
|
styles.rightMargin,
|
|
697
697
|
sizeStyles['priceUnit'],
|
|
698
698
|
styles.bigStyle,
|
|
699
699
|
hitColorStyle,
|
|
700
700
|
childrenClassName,
|
|
701
701
|
priceDescClassName,
|
|
702
702
|
)}
|
|
703
703
|
key="descFrontUnit"
|
|
704
704
|
style={{ ...itemCommonStyle }}
|
|
705
705
|
>
|
|
706
706
|
{priceUnit}
|
|
707
707
|
</Text>
|
|
708
708
|
) : null,
|
|
709
709
|
!isOnlyShowBigPrice && [
|
|
710
710
|
isPriceDescInFront && (
|
|
711
711
|
<Text
|
|
712
712
|
className={classNames(
|
|
713
713
|
styles.childStyle,
|
|
714
714
|
styles.priceDesc,
|
|
715
715
|
{
|
|
716
716
|
[styles['priceEnDesc']]: isLanguageForEn,
|
|
717
717
|
},
|
|
718
718
|
{
|
|
719
719
|
[styles['priceHiddenDesc']]: priceText === '',
|
|
720
720
|
},
|
|
721
721
|
sizeStyles['priceDesc'],
|
|
722
722
|
styles.bigStyle,
|
|
723
723
|
hitColorStyle,
|
|
724
724
|
isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
|
|
725
725
|
? styles.rightMargin
|
|
726
726
|
: null,
|
|
727
727
|
childrenClassName,
|
|
728
728
|
priceDescClassName,
|
|
729
729
|
)}
|
|
730
730
|
key="descFront"
|
|
731
731
|
style={{ ...itemCommonStyle, ...priceTextStyle }}
|
|
732
732
|
>
|
|
733
733
|
{priceText === '' ? '_' : priceText}
|
|
734
734
|
</Text>
|
|
735
735
|
),
|
|
736
736
|
<View
|
|
737
737
|
style={{
|
|
738
738
|
display: 'inline-flex',
|
|
739
739
|
}}
|
|
740
740
|
>
|
|
741
741
|
{smallPrice && !isHideSmallPrice ? (
|
|
742
742
|
<Text
|
|
743
743
|
className={classNames(
|
|
744
744
|
styles.childStyle,
|
|
745
745
|
styles.smallPrice,
|
|
746
746
|
sizeStyles['smallPrice'],
|
|
747
747
|
styles.smallStyle,
|
|
748
748
|
missColorStyle,
|
|
749
749
|
childrenClassName,
|
|
750
750
|
smallPriceClassName,
|
|
751
751
|
{
|
|
752
752
|
[styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
|
|
753
753
|
[styles.fontV2Bold]: useSmallFontV2 ? false : useSmallFontV2Bold || useFontV2Bold,
|
|
754
754
|
},
|
|
755
755
|
)}
|
|
756
756
|
key="smallPrice"
|
|
757
757
|
style={{ ...itemCommonStyle }}
|
|
758
758
|
>
|
|
759
759
|
¥{Number(smallPrice)}
|
|
760
760
|
</Text>
|
|
761
761
|
) : null}
|
|
762
762
|
{isShowPriceUnit && !isHideSmallPrice ? (
|
|
763
763
|
<Text
|
|
764
764
|
className={classNames(
|
|
765
765
|
styles.childStyle,
|
|
766
766
|
styles.priceUnit,
|
|
767
767
|
sizeStyles['priceUnit'],
|
|
768
768
|
styles.smallStyle,
|
|
769
769
|
styles.missPriceDesc,
|
|
770
770
|
missColorStyle,
|
|
771
771
|
childrenClassName,
|
|
772
772
|
smallPriceDescClassName || priceDescClassName,
|
|
773
773
|
)}
|
|
774
774
|
key="descFrontUnit"
|
|
775
775
|
style={{ ...itemCommonStyle }}
|
|
776
776
|
>
|
|
777
777
|
{priceUnit}
|
|
778
778
|
</Text>
|
|
779
779
|
) : null}
|
|
780
780
|
{!isPriceDescInFront && !isHideSmallPrice && (
|
|
781
781
|
<Text
|
|
782
782
|
className={classNames(
|
|
783
783
|
styles.childStyle,
|
|
784
784
|
styles.priceDesc,
|
|
785
785
|
{
|
|
786
786
|
[styles['priceEnDesc']]: isLanguageForEn,
|
|
787
787
|
},
|
|
788
788
|
{
|
|
789
789
|
[styles['priceHiddenDesc']]: priceText === '',
|
|
790
790
|
},
|
|
791
791
|
sizeStyles['priceDesc'],
|
|
792
792
|
styles.smallStyle,
|
|
793
793
|
styles.missPriceDesc,
|
|
794
794
|
missColorStyle,
|
|
795
795
|
childrenClassName,
|
|
796
796
|
smallPriceDescClassName || priceDescClassName,
|
|
797
797
|
)}
|
|
798
798
|
key="descBack"
|
|
799
799
|
style={{ ...itemCommonStyle }}
|
|
800
800
|
>
|
|
801
801
|
{priceText === '' ? '_' : priceText}
|
|
802
802
|
</Text>
|
|
803
803
|
)}
|
|
804
804
|
</View>,
|
|
805
805
|
],
|
|
806
806
|
]
|
|
807
807
|
)}
|
|
808
808
|
</View>
|
|
809
809
|
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
// 默认标签高度14 部分特殊的16,因此设置最大高度16
|
|
3
|
+
|
|
4
|
+
.d-shop-tag-list {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
justify-content: flex-start;
|
|
9
|
+
align-content: flex-start;
|
|
10
|
+
align-items: center;
|
|
11
|
+
align-self: flex-start;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
font-size: 0;
|
|
14
|
+
line-height: 10px; // 解决换行后上下无间隙导致看到线条的问题
|
|
15
|
+
max-height: 16PX;
|
|
16
|
+
|
|
17
|
+
&.d-shop-sku-tag-list{
|
|
18
|
+
margin: -3PX 8px 0 0;
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
height: 14PX;
|
|
21
|
+
line-height: 14PX;
|
|
22
|
+
vertical-align: middle;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.d-tag-item{
|
|
26
|
+
margin-right: 8px;
|
|
27
|
+
&:last-child{
|
|
28
|
+
margin-right: 0;
|
|
29
|
+
}
|
|
30
|
+
.d-tag-item-canvas{
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
const { tagInfoList = [], className, itemClassName, isSkuBaseTag = false } = props;
|
|
1
3
|
const getTagInfoList = Array.isArray(tagInfoList) ? tagInfoList : [];
|
|
2
4
|
const getTagInfoListNum = getTagInfoList.length;
|
|
3
5
|
return getTagInfoListNum > 0 ? (
|
|
4
6
|
<View className={classNames(shopTagStyle['d-shop-tag-list'],{
|
|
5
7
|
[shopTagStyle['d-shop-sku-tag-list']]: isSkuBaseTag
|
|
6
8
|
}, className)}>
|
|
7
9
|
{}
|
|
8
10
|
<View style={{ width: '1px', height: '100%' }} />
|
|
9
11
|
{getTagInfoList.map((item, index) => {
|
|
10
12
|
const { tagId, tabIconId, tagText, type, tabIconType } = item;
|
|
11
13
|
const getTagId = tagId || tabIconId;
|
|
12
14
|
const getTagType = type || tabIconType;
|
|
13
15
|
return getTagId && getTagType ? (
|
|
14
16
|
<View
|
|
15
17
|
key={getTagId + getTagType + index}
|
|
16
18
|
className={classNames(shopTagStyle['d-tag-item'], itemClassName)}
|
|
17
19
|
>
|
|
18
20
|
<canvas-tag
|
|
19
21
|
className={classNames(shopTagStyle['d-tag-item-canvas'])}
|
|
20
22
|
tagId={getTagId}
|
|
21
23
|
text={tagText}
|
|
22
24
|
appVersion={getJdAppVersionStr}
|
|
23
25
|
lang={languageNowType}
|
|
24
26
|
/>
|
|
25
27
|
</View>
|
|
26
28
|
) : null;
|
|
27
29
|
})}
|
|
28
30
|
</View>
|
|
29
31
|
) : null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
border-top-left-radius: 40px;
|
|
50
50
|
border-top-right-radius: 40px;
|
|
51
51
|
width: 100%;
|
|
52
|
-
height:
|
|
52
|
+
height: 10px;
|
|
53
53
|
margin-top: -8px;
|
|
54
54
|
background-clip: padding-box;
|
|
55
55
|
position: relative;
|
|
56
56
|
z-index: 999;
|
|
57
|
-
background: #
|
|
57
|
+
background: #f7f8fc;
|
|
58
58
|
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
|
|
59
59
|
}
|
|
60
60
|
.d-luxury-header-black {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import CountDown from "../../components/base/CountDown";
|
|
2
1
|
Exposure,
|
|
3
2
|
ItemViewExposureSmart,
|
|
4
3
|
MobileCommonHeader,
|
|
5
4
|
NetworkDataError,
|
|
5
|
+
import CountDown from '../../components/base/CountDown';
|
|
6
6
|
CountDown,
|
|
7
7
|
CustomScrollView,
|
|
8
8
|
CustomImageLoadRealInfo,
|
|
9
9
|
LazyLayoutLoad,
|
|
10
10
|
LazyLoadImage,
|
|
11
11
|
Dialog,
|
|
12
12
|
Price,
|
|
13
13
|
Exposure,
|
|
14
14
|
ExposureSmart,
|
|
15
15
|
ItemViewExposureSmart,
|
|
16
16
|
InViewRender,
|
|
17
17
|
InOrOutViewObserver,
|
|
18
18
|
CustomVideo,
|
|
19
19
|
MobileCommonHeader,
|
|
20
20
|
NetworkDataError,
|
|
21
21
|
ShopLeGaoTag,
|