@conecli/cone-render 0.10.1-shop3.124 → 0.10.1-shop3.126

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
  isLanguageForEn,
3
2
  draBusinessCustomReport,
4
3
  isH5,
5
4
  console.warn('🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:', {
6
5
  type,
7
6
  data,
8
7
  text,
9
8
  });
10
9
  if (
11
10
  isH5 &&
12
11
  global?.info?.pageInfo?.dataType === BUSINESS_TYPE.ONLINE &&
13
12
  !global?.info?.pageInfo?.isScanPreview
14
13
  ) {
15
14
  draBusinessCustomReport({
16
15
  eventName: 'business',
17
16
  errorName: `jd_${SgmCustomCode.PRICE_RENDER}`,
18
17
  errorMessage: '[双价格组件]' + text,
19
18
  extraData: JSON.stringify({
20
19
  type,
21
20
  data,
22
21
  }),
23
22
  });
24
23
  }
25
24
  return rest.some((item) => item === undefined || item === '');
26
25
  const numPrice = Number(strPrice);
27
26
  if (isNaN(numPrice)) {
28
27
  reportException({
29
28
  type: 'isNotNumericType',
30
29
  data: props,
31
30
  text: `传入价格字段值“${strPrice}”转换数字报错`,
32
31
  });
33
32
  return false;
34
33
  }
35
34
  else if (numPrice <= 0) {
36
35
  reportException({
37
36
  type: 'isNotPositiveNumber',
38
37
  data: props,
39
38
  text: `传入价格字段值“${strPrice}”不是一个正数`,
40
39
  });
41
40
  return false;
42
41
  }
43
42
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
44
43
  if (result && result[3]?.length > 2) {
45
44
  reportException({
46
45
  type: 'decimalPlaceTooLong',
47
46
  data: props,
48
47
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
49
48
  });
50
49
  return false;
51
50
  }
52
51
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
53
52
  reportException({
54
53
  type: 'findScientificNotation',
55
54
  data: props,
56
55
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
57
56
  });
58
57
  }
59
58
  return true;
60
59
  const numPrice = Number(strPrice);
61
60
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
62
61
  if (result) {
63
62
  return {
64
63
  integerPrice: result[1],
65
64
  decimalPrice: (result[3] || '').replace(/0+$/, ''),
66
65
  };
67
66
  } else {
68
67
  reportException({
69
68
  type: 'deconstructException',
70
69
  data: props,
71
70
  text: `解构传入价格字段值“${strPrice}”解构发生异常`,
72
71
  });
73
72
  return null;
74
73
  }
75
74
  const {
76
75
  jdPrice,
77
76
  finalPrice,
78
77
  priceText = '',
79
78
  priceTextColor = '',
80
79
  subPriceTextColor = '',
81
80
  subPriceColor = '',
82
81
  priceUnit = '',
83
82
  priceType,
84
83
  hitUserIdentity = false,
85
84
  forceShowFinalPrice = false,
86
85
  hideSmallPrice = false,
87
86
  fallbackRender = null,
88
87
  className = null,
89
88
  style = {},
90
89
  childrenClassName = null,
91
90
  bigNoPriceClassName = null,
92
91
  bigSymbolClassName = null,
93
92
  bigIntegerClassName = null,
94
93
  bigDecimalClassName = null,
95
94
  priceDescClassName = null,
96
95
  smallPriceClassName = null,
97
96
  smallPriceDescClassName = null,
98
97
  lineNumber = 1,
99
98
  size = 'M',
100
99
  isDefaultRemoveSmallPrice = false,
101
100
  useFontV2 = false,
102
101
  useFontV2Bold = false,
103
102
  useSmallFontV2 = false,
104
103
  useSmallFontV2Bold = false,
105
104
  nativeProps,
106
105
  } = props;
107
106
  let useBackstop = false;
108
107
  const isShowPriceUnit = priceUnit && priceUnit !== '';
109
108
  if (isNull(props.priceType)) {
110
109
  useBackstop = true;
111
110
  reportException({
112
111
  type: 'paramMiss',
113
112
  data: props,
114
113
  text: '缺少必要入参: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 (jdPrice && !numericPriceValidate(jdPrice, props)) {
150
149
  useBackstop = true;
151
150
  }
152
151
  }
153
152
  const bigPriceObj =
154
153
  isTextPrice || useBackstop
155
154
  ? {}
156
155
  : getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
157
156
  const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
158
157
  const isPriceDescInFront = isEquivalentHit;
159
158
  const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
160
159
  const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
161
160
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
162
161
  const sizeLineHeight = {
163
162
  XS: 28,
164
163
  S: 34,
165
164
  M: 40,
166
165
  L: 46,
167
166
  XL: 52,
168
167
  };
169
168
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
170
169
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
171
170
  const computedHeightStyle = {
172
171
  height: wrapHeight,
173
172
  };
174
173
  const itemCommonStyle = {
175
174
  height: lineHeight,
176
175
  };
177
176
  const bigPriceTextStyle = priceTextColor ? { color: priceTextColor } : {};
178
177
  const smallPriceTextStyle = subPriceTextColor ? { color: subPriceTextColor } : {};
179
178
  const smallPriceStyle = subPriceColor ? { color: subPriceColor } : {};
180
179
  const needSizeStyles = [
181
180
  'bigNoPrice',
182
181
  'bigSymbol',
183
182
  'bigInteger',
184
183
  'bigDecimal',
185
184
  'priceDesc',
186
185
  'smallPrice',
187
186
  'priceUnit',
188
187
  ];
189
188
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
190
189
  acc[cur] = styles[cur + size];
191
190
  return acc;
192
191
  }, {});
193
192
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
194
193
  const noPriceShowText =
195
194
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
196
195
  if (useBackstop && fallbackRender) {
197
196
  return fallbackRender;
198
197
  }
199
198
  return (
200
199
  <View
201
200
  className={classNames(styles.wrap, className)}
202
201
  style={{ ...computedHeightStyle, ...style }}
203
202
  {...nativeProps}
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, ...bigPriceTextStyle }}
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
352
351
  ? false
353
352
  : useSmallFontV2Bold || useFontV2Bold,
354
353
  },
355
354
  )}
356
355
  key="smallPrice"
357
356
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
358
357
  >
359
358
  ¥{Number(smallPrice)}
360
359
  </Text>
361
360
  ) : null}
362
361
  {isShowPriceUnit && !isHideSmallPrice ? (
363
362
  <Text
364
363
  className={classNames(
365
364
  styles.childStyle,
366
365
  styles.priceUnit,
367
366
  sizeStyles['priceUnit'],
368
367
  styles.smallStyle,
369
368
  styles.missPriceDesc,
370
369
  missColorStyle,
371
370
  childrenClassName,
372
371
  smallPriceDescClassName || priceDescClassName,
373
372
  )}
374
373
  key="descFrontUnit"
375
374
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
376
375
  >
377
376
  {priceUnit}
378
377
  </Text>
379
378
  ) : null}
380
379
  {!isPriceDescInFront && !isHideSmallPrice && (
381
380
  <Text
382
381
  className={classNames(
383
382
  styles.childStyle,
384
383
  styles.priceDesc,
385
384
  {
386
385
  [styles['priceEnDesc']]: isLanguageForEn,
387
386
  },
388
387
  {
389
388
  [styles['priceHiddenDesc']]: priceText === '',
390
389
  },
391
390
  sizeStyles['priceDesc'],
392
391
  styles.smallStyle,
393
392
  styles.missPriceDesc,
394
393
  missColorStyle,
395
394
  childrenClassName,
396
395
  smallPriceDescClassName || priceDescClassName,
397
396
  )}
398
397
  key="descBack"
399
398
  style={{ ...itemCommonStyle, ...smallPriceTextStyle }}
400
399
  >
401
400
  {priceText === '' ? '_' : priceText}
402
401
  </Text>
403
402
  )}
404
403
  </View>,
405
404
  ],
406
405
  ]
407
406
  )}
408
407
  </View>
409
408
  );
409
+ import React from 'react';
410
410
  console.warn('🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:', {
411
411
  type,
412
412
  data,
413
413
  text,
414
414
  });
415
415
  if (
416
416
  isH5 &&
417
417
  global?.info?.pageInfo?.dataType === BUSINESS_TYPE.ONLINE &&
418
418
  !global?.info?.pageInfo?.isScanPreview
419
419
  ) {
420
420
  draBusinessCustomReport({
421
421
  eventName: 'business',
422
422
  errorName: `jd_${SgmCustomCode.PRICE_RENDER}`,
423
423
  errorMessage: '[双价格组件]' + text,
424
424
  extraData: JSON.stringify({
425
425
  type,
426
426
  data,
427
427
  }),
428
428
  });
429
429
  }
430
430
  return rest.some((item) => item === undefined || item === '');
431
431
  const numPrice = Number(strPrice);
432
432
  if (isNaN(numPrice)) {
433
433
  reportException({
434
434
  type: 'isNotNumericType',
435
435
  data: props,
436
436
  text: `传入价格字段值“${strPrice}”转换数字报错`,
437
437
  });
438
438
  return false;
439
439
  }
440
440
  else if (numPrice <= 0) {
441
441
  reportException({
442
442
  type: 'isNotPositiveNumber',
443
443
  data: props,
444
444
  text: `传入价格字段值“${strPrice}”不是一个正数`,
445
445
  });
446
446
  return false;
447
447
  }
448
448
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
449
449
  if (result && result[3]?.length > 2) {
450
450
  reportException({
451
451
  type: 'decimalPlaceTooLong',
452
452
  data: props,
453
453
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
454
454
  });
455
455
  return false;
456
456
  }
457
457
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
458
458
  reportException({
459
459
  type: 'findScientificNotation',
460
460
  data: props,
461
461
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
462
462
  });
463
463
  }
464
464
  return true;
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
  subPriceTextColor = '',
486
486
  subPriceColor = '',
487
487
  priceUnit = '',
488
488
  priceType,
489
489
  hitUserIdentity = false,
490
490
  forceShowFinalPrice = false,
491
491
  hideSmallPrice = false,
492
492
  fallbackRender = null,
493
493
  className = null,
494
494
  style = {},
495
495
  childrenClassName = null,
496
496
  bigNoPriceClassName = null,
497
497
  bigSymbolClassName = null,
498
498
  bigIntegerClassName = null,
499
499
  bigDecimalClassName = null,
500
500
  priceDescClassName = null,
501
501
  smallPriceClassName = null,
502
502
  smallPriceDescClassName = null,
503
503
  lineNumber = 1,
504
504
  size = 'M',
505
505
  isDefaultRemoveSmallPrice = false,
506
506
  useFontV2 = false,
507
507
  useFontV2Bold = false,
508
508
  useSmallFontV2 = false,
509
509
  useSmallFontV2Bold = false,
510
510
  nativeProps,
511
511
  } = props;
512
512
  let useBackstop = false;
513
513
  const isShowPriceUnit = priceUnit && priceUnit !== '';
514
514
  if (isNull(props.priceType)) {
515
515
  useBackstop = true;
516
516
  reportException({
517
517
  type: 'paramMiss',
518
518
  data: props,
519
519
  text: '缺少必要入参:priceType',
520
520
  });
521
521
  } else if (
522
522
  !allowedNoHitUserIdentityTypes.includes(props.priceType) &&
523
523
  props.hitUserIdentity === undefined
524
524
  ) {
525
525
  useBackstop = true;
526
526
  reportException({
527
527
  type: 'paramMiss',
528
528
  data: props,
529
529
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
530
530
  });
531
531
  }
532
532
  const especialHitStyleType = {
533
533
  7: 'plusStyle',
534
534
  9: 'samStyle',
535
535
  };
536
536
  const especialMissStyleType = {
537
537
  7: 'plusStyle',
538
538
  8: 'fansStyle',
539
539
  9: 'samStyle',
540
540
  10: 'studentStyle',
541
541
  12: 'yhdStyle',
542
542
  13: 'memberStyle',
543
543
  };
544
544
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
545
545
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
546
546
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
547
547
  const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
548
548
  const isHideSmallPrice =
549
549
  hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
550
550
  const isTextPrice = priceType === 4;
551
551
  if (!isTextPrice && !useBackstop) {
552
552
  if (finalPrice && !numericPriceValidate(finalPrice, props)) {
553
553
  useBackstop = true;
554
554
  } else if (jdPrice && !numericPriceValidate(jdPrice, 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 bigPriceTextStyle = priceTextColor ? { color: priceTextColor } : {};
583
583
  const smallPriceTextStyle = subPriceTextColor ? { color: subPriceTextColor } : {};
584
584
  const smallPriceStyle = subPriceColor ? { color: subPriceColor } : {};
585
585
  const needSizeStyles = [
586
586
  'bigNoPrice',
587
587
  'bigSymbol',
588
588
  'bigInteger',
589
589
  'bigDecimal',
590
590
  'priceDesc',
591
591
  'smallPrice',
592
592
  'priceUnit',
593
593
  ];
594
594
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
595
595
  acc[cur] = styles[cur + size];
596
596
  return acc;
597
597
  }, {});
598
598
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
599
599
  const noPriceShowText =
600
600
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
601
601
  if (useBackstop && fallbackRender) {
602
602
  return fallbackRender;
603
603
  }
604
604
  return (
605
605
  <View
606
606
  className={classNames(styles.wrap, className)}
607
607
  style={{ ...computedHeightStyle, ...style }}
608
608
  {...nativeProps}
609
609
  >
610
610
  {isTextPrice || useBackstop ? (
611
611
  <Text
612
612
  className={classNames(
613
613
  styles.childStyle,
614
614
  styles.bigStyle,
615
615
  styles.bigNoPrice,
616
616
  sizeStyles['bigNoPrice'],
617
617
  childrenClassName,
618
618
  bigNoPriceClassName,
619
619
  )}
620
620
  style={{ ...itemCommonStyle }}
621
621
  >
622
622
  {useBackstop ? finalFallbackText : noPriceShowText}
623
623
  </Text>
624
624
  ) : (
625
625
  [
626
626
  <Text
627
627
  className={classNames(
628
628
  styles.childStyle,
629
629
  styles.bigStyle,
630
630
  styles.bigSymbol,
631
631
  sizeStyles['bigSymbol'],
632
632
  hitColorStyle,
633
633
  childrenClassName,
634
634
  bigSymbolClassName,
635
635
  {
636
636
  [styles.fontV2]: useFontV2,
637
637
  [styles.fontV2Bold]: useFontV2Bold,
638
638
  },
639
639
  )}
640
640
  key="bigSymbol"
641
641
  style={{ ...itemCommonStyle }}
642
642
  >
643
643
  ¥
644
644
  </Text>,
645
645
  <Text
646
646
  className={classNames(
647
647
  styles.childStyle,
648
648
  styles.bigStyle,
649
649
  styles.bigInteger,
650
650
  sizeStyles['bigInteger'],
651
651
  hitColorStyle,
652
652
  !isOnlyShowBigPrice &&
653
653
  !isBigPriceHasDecimal &&
654
654
  !isPriceDescInFront &&
655
655
  !isShowPriceUnit
656
656
  ? styles.rightMargin
657
657
  : null,
658
658
  childrenClassName,
659
659
  bigIntegerClassName,
660
660
  {
661
661
  [styles.fontV2]: useFontV2,
662
662
  [styles.fontV2Bold]: useFontV2Bold,
663
663
  },
664
664
  )}
665
665
  key="bigInteger"
666
666
  style={{ ...itemCommonStyle }}
667
667
  >
668
668
  {integerPrice}
669
669
  </Text>,
670
670
  isBigPriceHasDecimal ? (
671
671
  <Text
672
672
  className={classNames(
673
673
  styles.childStyle,
674
674
  styles.bigStyle,
675
675
  styles.bigDecimal,
676
676
  sizeStyles['bigDecimal'],
677
677
  hitColorStyle,
678
678
  isPriceDescInFront || priceText === '' || isShowPriceUnit
679
679
  ? null
680
680
  : styles.rightMargin,
681
681
  childrenClassName,
682
682
  bigDecimalClassName,
683
683
  {
684
684
  [styles.fontV2]: useFontV2,
685
685
  [styles.fontV2Bold]: useFontV2Bold,
686
686
  },
687
687
  )}
688
688
  key="bigDecimal"
689
689
  style={{ ...itemCommonStyle }}
690
690
  >
691
691
  .{decimalPrice}
692
692
  </Text>
693
693
  ) : null,
694
694
  isShowPriceUnit ? (
695
695
  <Text
696
696
  className={classNames(
697
697
  styles.childStyle,
698
698
  styles.priceUnit,
699
699
  styles.rightMargin,
700
700
  sizeStyles['priceUnit'],
701
701
  styles.bigStyle,
702
702
  hitColorStyle,
703
703
  childrenClassName,
704
704
  priceDescClassName,
705
705
  )}
706
706
  key="descFrontUnit"
707
707
  style={{ ...itemCommonStyle }}
708
708
  >
709
709
  {priceUnit}
710
710
  </Text>
711
711
  ) : null,
712
712
  !isOnlyShowBigPrice && [
713
713
  isPriceDescInFront && (
714
714
  <Text
715
715
  className={classNames(
716
716
  styles.childStyle,
717
717
  styles.priceDesc,
718
718
  {
719
719
  [styles['priceEnDesc']]: isLanguageForEn,
720
720
  },
721
721
  {
722
722
  [styles['priceHiddenDesc']]: priceText === '',
723
723
  },
724
724
  priceText === '' ? 'priceHiddenDesc' : '',
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, ...bigPriceTextStyle }}
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, ...smallPriceStyle }}
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, ...smallPriceStyle }}
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
  priceText === '' ? 'priceHiddenDesc' : '',
798
798
  sizeStyles['priceDesc'],
799
799
  styles.smallStyle,
800
800
  styles.missPriceDesc,
801
801
  missColorStyle,
802
802
  childrenClassName,
803
803
  smallPriceDescClassName || priceDescClassName,
804
804
  )}
805
805
  key="descBack"
806
806
  style={{ ...itemCommonStyle, ...smallPriceTextStyle }}
807
807
  >
808
808
  {priceText === '' ? '_' : priceText}
809
809
  </Text>
810
810
  )}
811
811
  </View>,
812
812
  ],
813
813
  ]
814
814
  )}
815
815
  </View>
816
816
  );