@conecli/cone-render 0.10.1-shop3.57 → 0.10.1-shop3.59

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.
@@ -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 || priceText === '' || isShowPriceUnit
274
273
  ? null
275
274
  : styles.rightMargin,
276
275
  childrenClassName,
277
276
  bigDecimalClassName,
278
277
  {
279
278
  [styles.fontV2]: useFontV2,
280
279
  [styles.fontV2Bold]: useFontV2Bold,
281
280
  },
282
281
  )}
283
282
  key="bigDecimal"
284
283
  style={{ ...itemCommonStyle }}
285
284
  >
286
285
  .{decimalPrice}
287
286
  </Text>
288
287
  ) : null,
289
288
  isShowPriceUnit ? (
290
289
  <Text
291
290
  className={classNames(
292
291
  styles.childStyle,
293
292
  styles.priceUnit,
294
293
  styles.rightMargin,
295
294
  sizeStyles['priceUnit'],
296
295
  styles.bigStyle,
297
296
  hitColorStyle,
298
297
  childrenClassName,
299
298
  priceDescClassName,
300
299
  )}
301
300
  key="descFrontUnit"
302
301
  style={{ ...itemCommonStyle }}
303
302
  >
304
303
  {priceUnit}
305
304
  </Text>
306
305
  ) : null,
307
306
  !isOnlyShowBigPrice && [
308
307
  isPriceDescInFront && (
309
308
  <Text
310
309
  className={classNames(
311
310
  styles.childStyle,
312
311
  styles.priceDesc,
313
312
  {
314
313
  [styles['priceEnDesc']]: isLanguageForEn,
315
314
  },
316
315
  {
317
316
  [styles['priceHiddenDesc']]: priceText === '',
318
317
  },
319
318
  sizeStyles['priceDesc'],
320
319
  styles.bigStyle,
321
320
  hitColorStyle,
322
321
  isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
323
322
  ? styles.rightMargin
324
323
  : null,
325
324
  childrenClassName,
326
325
  priceDescClassName,
327
326
  )}
328
327
  key="descFront"
329
328
  style={{ ...itemCommonStyle, ...priceTextStyle }}
330
329
  >
331
330
  {priceText === '' ? '_' : priceText}
332
331
  </Text>
333
332
  ),
334
333
  <View
335
334
  style={{
336
335
  display: 'inline-flex',
337
336
  }}
338
337
  >
339
338
  {smallPrice && !isHideSmallPrice ? (
340
339
  <Text
341
340
  className={classNames(
342
341
  styles.childStyle,
343
342
  styles.smallPrice,
344
343
  sizeStyles['smallPrice'],
345
344
  styles.smallStyle,
346
345
  missColorStyle,
347
346
  childrenClassName,
348
347
  smallPriceClassName,
349
348
  {
350
349
  [styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
351
350
  [styles.fontV2Bold]: useSmallFontV2 ? false : useSmallFontV2Bold || useFontV2Bold,
352
351
  },
353
352
  )}
354
353
  key="smallPrice"
355
354
  style={{ ...itemCommonStyle }}
356
355
  >
357
356
  ¥{Number(smallPrice)}
358
357
  </Text>
359
358
  ) : null}
360
359
  {isShowPriceUnit && !isHideSmallPrice ? (
361
360
  <Text
362
361
  className={classNames(
363
362
  styles.childStyle,
364
363
  styles.priceUnit,
365
364
  sizeStyles['priceUnit'],
366
365
  styles.smallStyle,
367
366
  styles.missPriceDesc,
368
367
  missColorStyle,
369
368
  childrenClassName,
370
369
  smallPriceDescClassName || priceDescClassName,
371
370
  )}
372
371
  key="descFrontUnit"
373
372
  style={{ ...itemCommonStyle }}
374
373
  >
375
374
  {priceUnit}
376
375
  </Text>
377
376
  ) : null}
378
377
  {!isPriceDescInFront && !isHideSmallPrice && (
379
378
  <Text
380
379
  className={classNames(
381
380
  styles.childStyle,
382
381
  styles.priceDesc,
383
382
  {
384
383
  [styles['priceEnDesc']]: isLanguageForEn,
385
384
  },
386
385
  {
387
386
  [styles['priceHiddenDesc']]: priceText === '',
388
387
  },
389
388
  sizeStyles['priceDesc'],
390
389
  styles.smallStyle,
391
390
  styles.missPriceDesc,
392
391
  missColorStyle,
393
392
  childrenClassName,
394
393
  smallPriceDescClassName || priceDescClassName,
395
394
  )}
396
395
  key="descBack"
397
396
  style={{ ...itemCommonStyle }}
398
397
  >
399
398
  {priceText === '' ? '_' : priceText}
400
399
  </Text>
401
400
  )}
402
401
  </View>,
403
402
  ],
404
403
  ]
405
404
  )}
406
405
  </View>
407
406
  );
407
+ import React from 'react';
408
408
  console.warn('🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:', {
409
409
  type,
410
410
  data,
411
411
  text,
412
412
  });
413
413
  sgmCustomReport({
414
414
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_${type}`),
415
415
  msg: {
416
416
  type,
417
417
  data,
418
418
  text: '[双价格组件]' + text,
419
419
  },
420
420
  });
421
421
  return rest.some((item) => item === undefined || item === '');
422
422
  const numPrice = Number(strPrice);
423
423
  if (isNaN(numPrice)) {
424
424
  reportException({
425
425
  type: 'isNotNumericType',
426
426
  data: props,
427
427
  text: `传入价格字段值“${strPrice}”转换数字报错`,
428
428
  });
429
429
  return false;
430
430
  }
431
431
  else if (numPrice <= 0) {
432
432
  reportException({
433
433
  type: 'isNotPositiveNumber',
434
434
  data: props,
435
435
  text: `传入价格字段值“${strPrice}”不是一个正数`,
436
436
  });
437
437
  return false;
438
438
  }
439
439
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
440
440
  if (result && result[3]?.length > 2) {
441
441
  reportException({
442
442
  type: 'decimalPlaceTooLong',
443
443
  data: props,
444
444
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
445
445
  });
446
446
  return false;
447
447
  }
448
448
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
449
449
  reportException({
450
450
  type: 'findScientificNotation',
451
451
  data: props,
452
452
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
453
453
  });
454
454
  }
455
455
  return true;
456
456
  const { jdPrice, finalPrice, forceShowFinalPrice } = props;
457
457
  if (jdPrice && finalPrice) {
458
458
  const getLastPassValidateState = forceShowFinalPrice || Number(finalPrice) < Number(jdPrice);
459
459
  !getLastPassValidateState &&
460
460
  reportException({
461
461
  type: 'pricesCompareException',
462
462
  data: props,
463
463
  text: `身份/到手价必须小于松果价`,
464
464
  });
465
465
  return getLastPassValidateState;
466
466
  } else {
467
467
  return true;
468
468
  }
469
469
  const numPrice = Number(strPrice);
470
470
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
471
471
  if (result) {
472
472
  return {
473
473
  integerPrice: result[1],
474
474
  decimalPrice: (result[3] || '').replace(/0+$/, ''),
475
475
  };
476
476
  } else {
477
477
  reportException({
478
478
  type: 'deconstructException',
479
479
  data: props,
480
480
  text: `解构传入价格字段值“${strPrice}”解构发生异常`,
481
481
  });
482
482
  return null;
483
483
  }
484
484
  const {
485
485
  jdPrice,
486
486
  finalPrice,
487
487
  priceText = '',
488
488
  priceTextColor = '',
489
489
  priceUnit = '',
490
490
  priceType,
491
491
  hitUserIdentity = false,
492
492
  forceShowFinalPrice = false,
493
493
  hideSmallPrice = false,
494
494
  fallbackRender = null,
495
495
  className = null,
496
496
  style = {},
497
497
  childrenClassName = null,
498
498
  bigNoPriceClassName = null,
499
499
  bigSymbolClassName = null,
500
500
  bigIntegerClassName = null,
501
501
  bigDecimalClassName = null,
502
502
  priceDescClassName = null,
503
503
  smallPriceClassName = null,
504
504
  smallPriceDescClassName = null,
505
505
  lineNumber = 1,
506
506
  size = 'M',
507
507
  isDefaultRemoveSmallPrice = false,
508
508
  useFontV2 = false,
509
509
  useFontV2Bold = false,
510
510
  useSmallFontV2 = false,
511
511
  useSmallFontV2Bold = false,
512
512
  } = props;
513
513
  let useBackstop = false;
514
514
  const isShowPriceUnit = priceUnit && priceUnit !== '';
515
515
  if (isNull(props.priceType)) {
516
516
  useBackstop = true;
517
517
  reportException({
518
518
  type: 'paramMiss',
519
519
  data: props,
520
520
  text: '缺少必要入参:priceType',
521
521
  });
522
522
  } else if (
523
523
  !allowedNoHitUserIdentityTypes.includes(props.priceType) &&
524
524
  props.hitUserIdentity === undefined
525
525
  ) {
526
526
  useBackstop = true;
527
527
  reportException({
528
528
  type: 'paramMiss',
529
529
  data: props,
530
530
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
531
531
  });
532
532
  }
533
533
  const especialHitStyleType = {
534
534
  7: 'plusStyle',
535
535
  9: 'samStyle',
536
536
  };
537
537
  const especialMissStyleType = {
538
538
  7: 'plusStyle',
539
539
  8: 'fansStyle',
540
540
  9: 'samStyle',
541
541
  10: 'studentStyle',
542
542
  12: 'yhdStyle',
543
543
  13: 'memberStyle',
544
544
  };
545
545
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
546
546
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
547
547
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
548
548
  const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
549
549
  const isHideSmallPrice =
550
550
  hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
551
551
  const isTextPrice = priceType === 4;
552
552
  if (!isTextPrice && !useBackstop) {
553
553
  if (finalPrice && !numericPriceValidate(finalPrice, props)) {
554
554
  useBackstop = true;
555
555
  } else if (jdPrice && !numericPriceValidate(jdPrice, props)) {
556
556
  useBackstop = true;
557
557
  }
558
558
  if (!useBackstop && !isOnlyShowBigPrice && !isHideSmallPrice && !pricesCompareValidate(props)) {
559
559
  useBackstop = true;
560
560
  }
561
561
  }
562
562
  const bigPriceObj =
563
563
  isTextPrice || useBackstop
564
564
  ? {}
565
565
  : getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
566
566
  const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
567
567
  const isPriceDescInFront = isEquivalentHit;
568
568
  const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
569
569
  const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
570
570
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
571
571
  const sizeLineHeight = {
572
572
  XS: 28,
573
573
  S: 34,
574
574
  M: 40,
575
575
  L: 46,
576
576
  XL: 52,
577
577
  };
578
578
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
579
579
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
580
580
  const computedHeightStyle = {
581
581
  height: wrapHeight,
582
582
  };
583
583
  const itemCommonStyle = {
584
584
  height: lineHeight,
585
585
  };
586
586
  const priceTextStyle = priceTextColor ? { color: priceTextColor } : {};
587
587
  const needSizeStyles = [
588
588
  'bigNoPrice',
589
589
  'bigSymbol',
590
590
  'bigInteger',
591
591
  'bigDecimal',
592
592
  'priceDesc',
593
593
  'smallPrice',
594
594
  'priceUnit',
595
595
  ];
596
596
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
597
597
  acc[cur] = styles[cur + size];
598
598
  return acc;
599
599
  }, {});
600
600
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
601
601
  const noPriceShowText =
602
602
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
603
603
  if (useBackstop && fallbackRender) {
604
604
  return fallbackRender;
605
605
  }
606
606
  return (
607
607
  <View
608
608
  className={classNames(styles.wrap, className)}
609
609
  style={{ ...computedHeightStyle, ...style }}
610
610
  >
611
611
  {isTextPrice || useBackstop ? (
612
612
  <Text
613
613
  className={classNames(
614
614
  styles.childStyle,
615
615
  styles.bigStyle,
616
616
  styles.bigNoPrice,
617
617
  sizeStyles['bigNoPrice'],
618
618
  childrenClassName,
619
619
  bigNoPriceClassName,
620
620
  )}
621
621
  style={{ ...itemCommonStyle }}
622
622
  >
623
623
  {useBackstop ? finalFallbackText : noPriceShowText}
624
624
  </Text>
625
625
  ) : (
626
626
  [
627
627
  <Text
628
628
  className={classNames(
629
629
  styles.childStyle,
630
630
  styles.bigStyle,
631
631
  styles.bigSymbol,
632
632
  sizeStyles['bigSymbol'],
633
633
  hitColorStyle,
634
634
  childrenClassName,
635
635
  bigSymbolClassName,
636
636
  {
637
637
  [styles.fontV2]: useFontV2,
638
638
  [styles.fontV2Bold]: useFontV2Bold,
639
639
  },
640
640
  )}
641
641
  key="bigSymbol"
642
642
  style={{ ...itemCommonStyle }}
643
643
  >
644
644
  ¥
645
645
  </Text>,
646
646
  <Text
647
647
  className={classNames(
648
648
  styles.childStyle,
649
649
  styles.bigStyle,
650
650
  styles.bigInteger,
651
651
  sizeStyles['bigInteger'],
652
652
  hitColorStyle,
653
653
  !isOnlyShowBigPrice &&
654
654
  !isBigPriceHasDecimal &&
655
655
  !isPriceDescInFront &&
656
656
  !isShowPriceUnit
657
657
  ? styles.rightMargin
658
658
  : null,
659
659
  childrenClassName,
660
660
  bigIntegerClassName,
661
661
  {
662
662
  [styles.fontV2]: useFontV2,
663
663
  [styles.fontV2Bold]: useFontV2Bold,
664
664
  },
665
665
  )}
666
666
  key="bigInteger"
667
667
  style={{ ...itemCommonStyle }}
668
668
  >
669
669
  {integerPrice}
670
670
  </Text>,
671
671
  isBigPriceHasDecimal ? (
672
672
  <Text
673
673
  className={classNames(
674
674
  styles.childStyle,
675
675
  styles.bigStyle,
676
676
  styles.bigDecimal,
677
677
  sizeStyles['bigDecimal'],
678
678
  hitColorStyle,
679
679
  isPriceDescInFront || priceText === '' || isShowPriceUnit
680
680
  ? null
681
681
  : styles.rightMargin,
682
682
  childrenClassName,
683
683
  bigDecimalClassName,
684
684
  {
685
685
  [styles.fontV2]: useFontV2,
686
686
  [styles.fontV2Bold]: useFontV2Bold,
687
687
  },
688
688
  )}
689
689
  key="bigDecimal"
690
690
  style={{ ...itemCommonStyle }}
691
691
  >
692
692
  .{decimalPrice}
693
693
  </Text>
694
694
  ) : null,
695
695
  isShowPriceUnit ? (
696
696
  <Text
697
697
  className={classNames(
698
698
  styles.childStyle,
699
699
  styles.priceUnit,
700
700
  styles.rightMargin,
701
701
  sizeStyles['priceUnit'],
702
702
  styles.bigStyle,
703
703
  hitColorStyle,
704
704
  childrenClassName,
705
705
  priceDescClassName,
706
706
  )}
707
707
  key="descFrontUnit"
708
708
  style={{ ...itemCommonStyle }}
709
709
  >
710
710
  {priceUnit}
711
711
  </Text>
712
712
  ) : null,
713
713
  !isOnlyShowBigPrice && [
714
714
  isPriceDescInFront && (
715
715
  <Text
716
716
  className={classNames(
717
717
  styles.childStyle,
718
718
  styles.priceDesc,
719
719
  {
720
720
  [styles['priceEnDesc']]: isLanguageForEn,
721
721
  },
722
722
  {
723
723
  [styles['priceHiddenDesc']]: priceText === '',
724
724
  },
725
725
  sizeStyles['priceDesc'],
726
726
  styles.bigStyle,
727
727
  hitColorStyle,
728
728
  isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
729
729
  ? styles.rightMargin
730
730
  : null,
731
731
  childrenClassName,
732
732
  priceDescClassName,
733
733
  )}
734
734
  key="descFront"
735
735
  style={{ ...itemCommonStyle, ...priceTextStyle }}
736
736
  >
737
737
  {priceText === '' ? '_' : priceText}
738
738
  </Text>
739
739
  ),
740
740
  <View
741
741
  style={{
742
742
  display: 'inline-flex',
743
743
  }}
744
744
  >
745
745
  {smallPrice && !isHideSmallPrice ? (
746
746
  <Text
747
747
  className={classNames(
748
748
  styles.childStyle,
749
749
  styles.smallPrice,
750
750
  sizeStyles['smallPrice'],
751
751
  styles.smallStyle,
752
752
  missColorStyle,
753
753
  childrenClassName,
754
754
  smallPriceClassName,
755
755
  {
756
756
  [styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
757
757
  [styles.fontV2Bold]: useSmallFontV2
758
758
  ? false
759
759
  : useSmallFontV2Bold || useFontV2Bold,
760
760
  },
761
761
  )}
762
762
  key="smallPrice"
763
763
  style={{ ...itemCommonStyle }}
764
764
  >
765
765
  ¥{Number(smallPrice)}
766
766
  </Text>
767
767
  ) : null}
768
768
  {isShowPriceUnit && !isHideSmallPrice ? (
769
769
  <Text
770
770
  className={classNames(
771
771
  styles.childStyle,
772
772
  styles.priceUnit,
773
773
  sizeStyles['priceUnit'],
774
774
  styles.smallStyle,
775
775
  styles.missPriceDesc,
776
776
  missColorStyle,
777
777
  childrenClassName,
778
778
  smallPriceDescClassName || priceDescClassName,
779
779
  )}
780
780
  key="descFrontUnit"
781
781
  style={{ ...itemCommonStyle }}
782
782
  >
783
783
  {priceUnit}
784
784
  </Text>
785
785
  ) : null}
786
786
  {!isPriceDescInFront && !isHideSmallPrice && (
787
787
  <Text
788
788
  className={classNames(
789
789
  styles.childStyle,
790
790
  styles.priceDesc,
791
791
  {
792
792
  [styles['priceEnDesc']]: isLanguageForEn,
793
793
  },
794
794
  {
795
795
  [styles['priceHiddenDesc']]: priceText === '',
796
796
  },
797
797
  sizeStyles['priceDesc'],
798
798
  styles.smallStyle,
799
799
  styles.missPriceDesc,
800
800
  missColorStyle,
801
801
  childrenClassName,
802
802
  smallPriceDescClassName || priceDescClassName,
803
803
  )}
804
804
  key="descBack"
805
805
  style={{ ...itemCommonStyle }}
806
806
  >
807
807
  {priceText === '' ? '_' : priceText}
808
808
  </Text>
809
809
  )}
810
810
  </View>,
811
811
  ],
812
812
  ]
813
813
  )}
814
814
  </View>
815
815
  );