@conecli/cone-render 0.10.1-shop3.133 → 0.10.1-shop3.135

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
  if (
8
7
  isH5 &&
9
8
  global?.info?.pageInfo?.dataType === BUSINESS_TYPE.ONLINE &&
10
9
  !global?.info?.pageInfo?.isScanPreview
11
10
  ) {
12
11
  draBusinessCustomReport({
13
12
  eventName: 'business',
14
13
  errorName: `jd_${SgmCustomCode.PRICE_RENDER}`,
15
14
  errorMessage: '[双价格组件]' + text,
16
15
  extraData: JSON.stringify({
17
16
  type,
18
17
  data,
19
18
  }),
20
19
  });
21
20
  }
22
21
  return rest.some((item) => item === undefined || item === '');
23
22
  const numPrice = Number(strPrice);
24
23
  if (isNaN(numPrice)) {
25
24
  reportException({
26
25
  type: 'isNotNumericType',
27
26
  data: props,
28
27
  text: `传入价格字段值“${strPrice}”转换数字报错`,
29
28
  });
30
29
  return false;
31
30
  }
32
31
  else if (numPrice <= 0) {
33
32
  reportException({
34
33
  type: 'isNotPositiveNumber',
35
34
  data: props,
36
35
  text: `传入价格字段值“${strPrice}”不是一个正数`,
37
36
  });
38
37
  return false;
39
38
  }
40
39
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
41
40
  if (result && result[3]?.length > 2) {
42
41
  reportException({
43
42
  type: 'decimalPlaceTooLong',
44
43
  data: props,
45
44
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
46
45
  });
47
46
  return false;
48
47
  }
49
48
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
50
49
  reportException({
51
50
  type: 'findScientificNotation',
52
51
  data: props,
53
52
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
54
53
  });
55
54
  }
56
55
  return true;
57
56
  const numPrice = Number(strPrice);
58
57
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
59
58
  if (result) {
60
59
  return {
61
60
  integerPrice: result[1],
62
61
  decimalPrice: (result[3] || '').replace(/0+$/, ''),
63
62
  };
64
63
  } else {
65
64
  reportException({
66
65
  type: 'deconstructException',
67
66
  data: props,
68
67
  text: `解构传入价格字段值“${strPrice}”解构发生异常`,
69
68
  });
70
69
  return null;
71
70
  }
72
71
  const {
73
72
  jdPrice,
74
73
  finalPrice,
75
74
  priceText = '',
76
75
  priceTextColor = '',
77
76
  subPriceTextColor = '',
78
77
  subPriceColor = '',
79
78
  priceUnit = '',
80
79
  priceType,
81
80
  hitUserIdentity = false,
82
81
  forceShowFinalPrice = false,
83
82
  hideSmallPrice = false,
84
83
  fallbackRender = null,
85
84
  className = null,
86
85
  style = {},
87
86
  childrenClassName = null,
88
87
  bigNoPriceClassName = null,
89
88
  bigSymbolClassName = null,
90
89
  bigIntegerClassName = null,
91
90
  bigDecimalClassName = null,
92
91
  priceDescClassName = null,
93
92
  smallPriceClassName = null,
94
93
  smallPriceDescClassName = null,
95
94
  lineNumber = 1,
96
95
  size = 'M',
97
96
  isDefaultRemoveSmallPrice = false,
98
97
  useFontV2 = false,
99
98
  useFontV2Bold = false,
100
99
  useSmallFontV2 = false,
101
100
  useSmallFontV2Bold = false,
102
101
  nativeProps,
103
102
  } = props;
104
103
  let useBackstop = false;
105
104
  const isShowPriceUnit = priceUnit && priceUnit !== '';
106
105
  if (isNull(props.priceType)) {
107
106
  useBackstop = true;
108
107
  reportException({
109
108
  type: 'paramMiss',
110
109
  data: props,
111
110
  text: '缺少必要入参:priceType',
112
111
  });
113
112
  } else if (
114
113
  !allowedNoHitUserIdentityTypes.includes(props.priceType) &&
115
114
  props.hitUserIdentity === undefined
116
115
  ) {
117
116
  useBackstop = true;
118
117
  reportException({
119
118
  type: 'paramMiss',
120
119
  data: props,
121
120
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
122
121
  });
123
122
  }
124
123
  const especialHitStyleType = {
125
124
  7: 'plusStyle',
126
125
  9: 'samStyle',
127
126
  };
128
127
  const especialMissStyleType = {
129
128
  7: 'plusStyle',
130
129
  8: 'fansStyle',
131
130
  9: 'samStyle',
132
131
  10: 'studentStyle',
133
132
  12: 'yhdStyle',
134
133
  13: 'memberStyle',
135
134
  };
136
135
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
137
136
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
138
137
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
139
138
  const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
140
139
  const isHideSmallPrice =
141
140
  hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
142
141
  const isTextPrice = priceType === 4;
143
142
  if (!isTextPrice && !useBackstop) {
144
143
  if (finalPrice && !numericPriceValidate(finalPrice, props)) {
145
144
  useBackstop = true;
146
145
  } else if (jdPrice && !numericPriceValidate(jdPrice, props)) {
147
146
  useBackstop = true;
148
147
  }
149
148
  }
150
149
  const bigPriceObj =
151
150
  isTextPrice || useBackstop
152
151
  ? {}
153
152
  : getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
154
153
  const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
155
154
  const isPriceDescInFront = isEquivalentHit;
156
155
  const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
157
156
  const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
158
157
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
159
158
  const sizeLineHeight = {
160
159
  XS: 28,
161
160
  S: 34,
162
161
  M: 40,
163
162
  L: 46,
164
163
  XL: 52,
165
164
  };
166
165
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
167
166
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
168
167
  const computedHeightStyle = {
169
168
  height: wrapHeight,
170
169
  };
171
170
  const itemCommonStyle = {
172
171
  height: lineHeight,
173
172
  };
174
173
  const bigPriceTextStyle = priceTextColor ? { color: priceTextColor } : {};
175
174
  const smallPriceTextStyle = subPriceTextColor ? { color: subPriceTextColor } : {};
176
175
  const smallPriceStyle = subPriceColor ? { color: subPriceColor } : {};
177
176
  const needSizeStyles = [
178
177
  'bigNoPrice',
179
178
  'bigSymbol',
180
179
  'bigInteger',
181
180
  'bigDecimal',
182
181
  'priceDesc',
183
182
  'smallPrice',
184
183
  'priceUnit',
185
184
  ];
186
185
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
187
186
  acc[cur] = styles[cur + size];
188
187
  return acc;
189
188
  }, {});
190
189
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
191
190
  const noPriceShowText =
192
191
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
193
192
  if (useBackstop && fallbackRender) {
194
193
  return fallbackRender;
195
194
  }
196
195
  return (
197
196
  <View
198
197
  className={classNames(styles.wrap, className)}
199
198
  style={{ ...computedHeightStyle, ...style }}
200
199
  {...nativeProps}
201
200
  >
202
201
  {isTextPrice || useBackstop ? (
203
202
  <Text
204
203
  className={classNames(
205
204
  styles.childStyle,
206
205
  styles.bigStyle,
207
206
  styles.bigNoPrice,
208
207
  sizeStyles['bigNoPrice'],
209
208
  childrenClassName,
210
209
  bigNoPriceClassName,
211
210
  )}
212
211
  style={{ ...itemCommonStyle }}
213
212
  >
214
213
  {useBackstop ? finalFallbackText : noPriceShowText}
215
214
  </Text>
216
215
  ) : (
217
216
  [
218
217
  <Text
219
218
  className={classNames(
220
219
  styles.childStyle,
221
220
  styles.bigStyle,
222
221
  styles.bigSymbol,
223
222
  sizeStyles['bigSymbol'],
224
223
  hitColorStyle,
225
224
  childrenClassName,
226
225
  bigSymbolClassName,
227
226
  {
228
227
  [styles.fontV2]: useFontV2,
229
228
  [styles.fontV2Bold]: useFontV2Bold,
230
229
  },
231
230
  )}
232
231
  key="bigSymbol"
233
232
  style={{ ...itemCommonStyle }}
234
233
  >
235
234
  ¥
236
235
  </Text>,
237
236
  <Text
238
237
  className={classNames(
239
238
  styles.childStyle,
240
239
  styles.bigStyle,
241
240
  styles.bigInteger,
242
241
  sizeStyles['bigInteger'],
243
242
  hitColorStyle,
244
243
  !isOnlyShowBigPrice &&
245
244
  !isBigPriceHasDecimal &&
246
245
  !isPriceDescInFront &&
247
246
  !isShowPriceUnit
248
247
  ? styles.rightMargin
249
248
  : null,
250
249
  childrenClassName,
251
250
  bigIntegerClassName,
252
251
  {
253
252
  [styles.fontV2]: useFontV2,
254
253
  [styles.fontV2Bold]: useFontV2Bold,
255
254
  },
256
255
  )}
257
256
  key="bigInteger"
258
257
  style={{ ...itemCommonStyle }}
259
258
  >
260
259
  {integerPrice}
261
260
  </Text>,
262
261
  isBigPriceHasDecimal ? (
263
262
  <Text
264
263
  className={classNames(
265
264
  styles.childStyle,
266
265
  styles.bigStyle,
267
266
  styles.bigDecimal,
268
267
  sizeStyles['bigDecimal'],
269
268
  hitColorStyle,
270
269
  isPriceDescInFront || priceText === '' || isShowPriceUnit
271
270
  ? null
272
271
  : styles.rightMargin,
273
272
  childrenClassName,
274
273
  bigDecimalClassName,
275
274
  {
276
275
  [styles.fontV2]: useFontV2,
277
276
  [styles.fontV2Bold]: useFontV2Bold,
278
277
  },
279
278
  )}
280
279
  key="bigDecimal"
281
280
  style={{ ...itemCommonStyle }}
282
281
  >
283
282
  .{decimalPrice}
284
283
  </Text>
285
284
  ) : null,
286
285
  isShowPriceUnit ? (
287
286
  <Text
288
287
  className={classNames(
289
288
  styles.childStyle,
290
289
  styles.priceUnit,
291
290
  styles.rightMargin,
292
291
  sizeStyles['priceUnit'],
293
292
  styles.bigStyle,
294
293
  hitColorStyle,
295
294
  childrenClassName,
296
295
  priceDescClassName,
297
296
  )}
298
297
  key="descFrontUnit"
299
298
  style={{ ...itemCommonStyle }}
300
299
  >
301
300
  {priceUnit}
302
301
  </Text>
303
302
  ) : null,
304
303
  !isOnlyShowBigPrice && [
305
304
  isPriceDescInFront && (
306
305
  <Text
307
306
  className={classNames(
308
307
  styles.childStyle,
309
308
  styles.priceDesc,
310
309
  {
311
310
  [styles['priceEnDesc']]: isLanguageForEn,
312
311
  },
313
312
  {
314
313
  [styles['priceHiddenDesc']]: priceText === '',
315
314
  },
316
315
  priceText === '' ? 'priceHiddenDesc' : '',
317
316
  sizeStyles['priceDesc'],
318
317
  styles.bigStyle,
319
318
  hitColorStyle,
320
319
  isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
321
320
  ? styles.rightMargin
322
321
  : null,
323
322
  childrenClassName,
324
323
  priceDescClassName,
325
324
  )}
326
325
  key="descFront"
327
326
  style={{ ...itemCommonStyle, ...bigPriceTextStyle }}
328
327
  >
329
328
  {priceText === '' ? '_' : priceText}
330
329
  </Text>
331
330
  ),
332
331
  <View
333
332
  style={{
334
333
  display: 'inline-flex',
335
334
  }}
336
335
  >
337
336
  {smallPrice && !isHideSmallPrice ? (
338
337
  <Text
339
338
  className={classNames(
340
339
  styles.childStyle,
341
340
  styles.smallPrice,
342
341
  sizeStyles['smallPrice'],
343
342
  styles.smallStyle,
344
343
  missColorStyle,
345
344
  childrenClassName,
346
345
  smallPriceClassName,
347
346
  {
348
347
  [styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
349
348
  [styles.fontV2Bold]: useSmallFontV2
350
349
  ? false
351
350
  : useSmallFontV2Bold || useFontV2Bold,
352
351
  },
353
352
  )}
354
353
  key="smallPrice"
355
354
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
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, ...smallPriceStyle }}
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
  priceText === '' ? 'priceHiddenDesc' : '',
390
389
  sizeStyles['priceDesc'],
391
390
  styles.smallStyle,
392
391
  styles.missPriceDesc,
393
392
  missColorStyle,
394
393
  childrenClassName,
395
394
  smallPriceDescClassName || priceDescClassName,
396
395
  )}
397
396
  key="descBack"
398
397
  style={{ ...itemCommonStyle, ...smallPriceTextStyle }}
399
398
  >
400
399
  {priceText === '' ? '_' : priceText}
401
400
  </Text>
402
401
  )}
403
402
  </View>,
404
403
  ],
405
404
  ]
406
405
  )}
407
406
  </View>
408
407
  );
408
+ import React from 'react';
409
409
  console.warn('🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:', {
410
410
  type,
411
411
  data,
412
412
  text,
413
413
  });
414
414
  if (
415
415
  isH5 &&
416
416
  global?.info?.pageInfo?.dataType === BUSINESS_TYPE.ONLINE &&
417
417
  !global?.info?.pageInfo?.isScanPreview
418
418
  ) {
419
419
  draBusinessCustomReport({
420
420
  eventName: 'business',
421
421
  errorName: `jd_${SgmCustomCode.PRICE_RENDER}`,
422
422
  errorMessage: '[双价格组件]' + text,
423
423
  extraData: JSON.stringify({
424
424
  type,
425
425
  data,
426
426
  }),
427
427
  });
428
428
  }
429
429
  return rest.some((item) => item === undefined || item === '');
430
430
  const numPrice = Number(strPrice);
431
431
  if (isNaN(numPrice)) {
432
432
  reportException({
433
433
  type: 'isNotNumericType',
434
434
  data: props,
435
435
  text: `传入价格字段值“${strPrice}”转换数字报错`,
436
436
  });
437
437
  return false;
438
438
  }
439
439
  else if (numPrice <= 0) {
440
440
  reportException({
441
441
  type: 'isNotPositiveNumber',
442
442
  data: props,
443
443
  text: `传入价格字段值“${strPrice}”不是一个正数`,
444
444
  });
445
445
  return false;
446
446
  }
447
447
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
448
448
  if (result && result[3]?.length > 2) {
449
449
  reportException({
450
450
  type: 'decimalPlaceTooLong',
451
451
  data: props,
452
452
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
453
453
  });
454
454
  return false;
455
455
  }
456
456
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
457
457
  reportException({
458
458
  type: 'findScientificNotation',
459
459
  data: props,
460
460
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
461
461
  });
462
462
  }
463
463
  return true;
464
464
  const numPrice = Number(strPrice);
465
465
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
466
466
  if (result) {
467
467
  return {
468
468
  integerPrice: result[1],
469
469
  decimalPrice: (result[3] || '').replace(/0+$/, ''),
470
470
  };
471
471
  } else {
472
472
  reportException({
473
473
  type: 'deconstructException',
474
474
  data: props,
475
475
  text: `解构传入价格字段值“${strPrice}”解构发生异常`,
476
476
  });
477
477
  return null;
478
478
  }
479
479
  const {
480
480
  jdPrice,
481
481
  finalPrice,
482
482
  priceText = '',
483
483
  priceTextColor = '',
484
484
  subPriceTextColor = '',
485
485
  subPriceColor = '',
486
486
  priceUnit = '',
487
487
  priceType,
488
488
  hitUserIdentity = false,
489
489
  forceShowFinalPrice = false,
490
490
  hideSmallPrice = false,
491
491
  fallbackRender = null,
492
492
  className = null,
493
493
  style = {},
494
494
  childrenClassName = null,
495
495
  bigNoPriceClassName = null,
496
496
  bigSymbolClassName = null,
497
497
  bigIntegerClassName = null,
498
498
  bigDecimalClassName = null,
499
499
  priceDescClassName = null,
500
500
  smallPriceClassName = null,
501
501
  smallPriceDescClassName = null,
502
502
  lineNumber = 1,
503
503
  size = 'M',
504
504
  isDefaultRemoveSmallPrice = false,
505
505
  useFontV2 = false,
506
506
  useFontV2Bold = false,
507
507
  useSmallFontV2 = false,
508
508
  useSmallFontV2Bold = false,
509
509
  renderPriceNumber,
510
510
  couponDiscountUpAmount,
511
511
  nativeProps,
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
  }
559
559
  const bigPriceObj =
560
560
  isTextPrice || useBackstop
561
561
  ? {}
562
562
  : getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
563
563
  const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
564
564
  const isPriceDescInFront = isEquivalentHit;
565
565
  const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
566
566
  const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
567
567
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
568
568
  const sizeLineHeight = {
569
569
  XS: 28,
570
570
  S: 34,
571
571
  M: 40,
572
572
  L: 46,
573
573
  XL: 52,
574
574
  };
575
575
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
576
576
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
577
577
  const computedHeightStyle = {
578
578
  height: wrapHeight,
579
579
  };
580
580
  const itemCommonStyle = {
581
581
  height: lineHeight,
582
582
  };
583
583
  const bigPriceTextStyle = priceTextColor ? { color: priceTextColor } : {};
584
584
  const smallPriceTextStyle = subPriceTextColor ? { color: subPriceTextColor } : {};
585
585
  const smallPriceStyle = subPriceColor ? { color: subPriceColor } : {};
586
586
  const needSizeStyles = [
587
587
  'bigNoPrice',
588
588
  'bigSymbol',
589
589
  'bigInteger',
590
590
  'bigDecimal',
591
591
  'priceDesc',
592
592
  'smallPrice',
593
593
  'priceUnit',
594
594
  ];
595
595
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
596
596
  acc[cur] = styles[cur + size];
597
597
  return acc;
598
598
  }, {});
599
599
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
600
600
  const noPriceShowText =
601
601
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
602
602
  if (useBackstop && fallbackRender) {
603
603
  return fallbackRender;
604
604
  }
605
605
  const TextRender = renderPriceNumber ? renderPriceNumber : Text;
606
606
  return (
607
607
  <View
608
608
  className={classNames(styles.wrap, className)}
609
609
  style={{ ...computedHeightStyle, ...style }}
610
610
  {...nativeProps}
611
611
  >
612
612
  {isTextPrice || useBackstop ? (
613
613
  <Text
614
614
  className={classNames(
615
615
  styles.childStyle,
616
616
  styles.bigStyle,
617
617
  styles.bigNoPrice,
618
618
  sizeStyles['bigNoPrice'],
619
619
  childrenClassName,
620
620
  bigNoPriceClassName,
621
621
  )}
622
622
  style={{ ...itemCommonStyle }}
623
623
  >
624
624
  {useBackstop ? finalFallbackText : noPriceShowText}
625
625
  </Text>
626
626
  ) : (
627
627
  [
628
628
  <Text
629
629
  className={classNames(
630
630
  styles.childStyle,
631
631
  styles.bigStyle,
632
632
  styles.bigSymbol,
633
633
  sizeStyles['bigSymbol'],
634
634
  hitColorStyle,
635
635
  childrenClassName,
636
636
  bigSymbolClassName,
637
637
  {
638
638
  [styles.fontV2]: useFontV2,
639
639
  [styles.fontV2Bold]: useFontV2Bold,
640
640
  },
641
641
  )}
642
642
  key="bigSymbol"
643
643
  style={{ ...itemCommonStyle }}
644
644
  >
645
645
  ¥
646
646
  </Text>,
647
647
  <TextRender
648
648
  className={classNames(
649
649
  styles.childStyle,
650
650
  styles.bigStyle,
651
651
  styles.bigInteger,
652
652
  sizeStyles['bigInteger'],
653
653
  hitColorStyle,
654
654
  !isOnlyShowBigPrice &&
655
655
  !isBigPriceHasDecimal &&
656
656
  !isPriceDescInFront &&
657
657
  !isShowPriceUnit
658
658
  ? styles.rightMargin
659
659
  : null,
660
660
  childrenClassName,
661
661
  bigIntegerClassName,
662
662
  {
663
663
  [styles.fontV2]: useFontV2,
664
664
  [styles.fontV2Bold]: useFontV2Bold,
665
665
  },
666
666
  )}
667
667
  key="bigInteger"
668
668
  style={{ ...itemCommonStyle }}
669
669
  couponDiscountUpAmount={couponDiscountUpAmount}
670
670
  >
671
671
  {integerPrice}
672
672
  </TextRender>,
673
673
  isBigPriceHasDecimal ? (
674
674
  <TextRender
675
675
  className={classNames(
676
676
  styles.childStyle,
677
677
  styles.bigStyle,
678
678
  styles.bigDecimal,
679
679
  sizeStyles['bigDecimal'],
680
680
  hitColorStyle,
681
681
  isPriceDescInFront || priceText === '' || isShowPriceUnit
682
682
  ? null
683
683
  : styles.rightMargin,
684
684
  childrenClassName,
685
685
  bigDecimalClassName,
686
686
  {
687
687
  [styles.fontV2]: useFontV2,
688
688
  [styles.fontV2Bold]: useFontV2Bold,
689
689
  },
690
690
  )}
691
691
  key="bigDecimal"
692
692
  style={{ ...itemCommonStyle }}
693
693
  couponDiscountUpAmount={couponDiscountUpAmount}
694
694
  >
695
695
  .{decimalPrice}
696
696
  </TextRender>
697
697
  ) : null,
698
698
  isShowPriceUnit ? (
699
699
  <Text
700
700
  className={classNames(
701
701
  styles.childStyle,
702
702
  styles.priceUnit,
703
703
  styles.rightMargin,
704
704
  sizeStyles['priceUnit'],
705
705
  styles.bigStyle,
706
706
  hitColorStyle,
707
707
  childrenClassName,
708
708
  priceDescClassName,
709
709
  )}
710
710
  key="descFrontUnit"
711
711
  style={{ ...itemCommonStyle }}
712
712
  >
713
713
  {priceUnit}
714
714
  </Text>
715
715
  ) : null,
716
716
  !isOnlyShowBigPrice && [
717
717
  isPriceDescInFront && (
718
718
  <Text
719
719
  className={classNames(
720
720
  styles.childStyle,
721
721
  styles.priceDesc,
722
722
  {
723
723
  [styles['priceEnDesc']]: isLanguageForEn,
724
724
  },
725
725
  {
726
726
  [styles['priceHiddenDesc']]: priceText === '',
727
727
  },
728
728
  priceText === '' ? 'priceHiddenDesc' : '',
729
729
  sizeStyles['priceDesc'],
730
730
  styles.bigStyle,
731
731
  hitColorStyle,
732
732
  isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
733
733
  ? styles.rightMargin
734
734
  : null,
735
735
  childrenClassName,
736
736
  priceDescClassName,
737
737
  )}
738
738
  key="descFront"
739
739
  style={{ ...itemCommonStyle, ...bigPriceTextStyle }}
740
740
  >
741
741
  {priceText === '' ? '_' : priceText}
742
742
  </Text>
743
743
  ),
744
744
  <View
745
745
  style={{
746
746
  display: 'inline-flex',
747
747
  }}
748
748
  >
749
749
  {smallPrice && !isHideSmallPrice ? (
750
750
  <Text
751
751
  className={classNames(
752
752
  styles.childStyle,
753
753
  styles.smallPrice,
754
754
  sizeStyles['smallPrice'],
755
755
  styles.smallStyle,
756
756
  missColorStyle,
757
757
  childrenClassName,
758
758
  smallPriceClassName,
759
759
  {
760
760
  [styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
761
761
  [styles.fontV2Bold]: useSmallFontV2
762
762
  ? false
763
763
  : useSmallFontV2Bold || useFontV2Bold,
764
764
  },
765
765
  )}
766
766
  key="smallPrice"
767
767
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
768
768
  >
769
769
  ¥{Number(smallPrice)}
770
770
  </Text>
771
771
  ) : null}
772
772
  {isShowPriceUnit && !isHideSmallPrice ? (
773
773
  <Text
774
774
  className={classNames(
775
775
  styles.childStyle,
776
776
  styles.priceUnit,
777
777
  sizeStyles['priceUnit'],
778
778
  styles.smallStyle,
779
779
  styles.missPriceDesc,
780
780
  missColorStyle,
781
781
  childrenClassName,
782
782
  smallPriceDescClassName || priceDescClassName,
783
783
  )}
784
784
  key="descFrontUnit"
785
785
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
786
786
  >
787
787
  {priceUnit}
788
788
  </Text>
789
789
  ) : null}
790
790
  {!isPriceDescInFront && !isHideSmallPrice && (
791
791
  <Text
792
792
  className={classNames(
793
793
  styles.childStyle,
794
794
  styles.priceDesc,
795
795
  {
796
796
  [styles['priceEnDesc']]: isLanguageForEn,
797
797
  },
798
798
  {
799
799
  [styles['priceHiddenDesc']]: priceText === '',
800
800
  },
801
801
  priceText === '' ? 'priceHiddenDesc' : '',
802
802
  sizeStyles['priceDesc'],
803
803
  styles.smallStyle,
804
804
  styles.missPriceDesc,
805
805
  missColorStyle,
806
806
  childrenClassName,
807
807
  smallPriceDescClassName || priceDescClassName,
808
808
  )}
809
809
  key="descBack"
810
810
  style={{ ...itemCommonStyle, ...smallPriceTextStyle }}
811
811
  >
812
812
  {priceText === '' ? '_' : priceText}
813
813
  </Text>
814
814
  )}
815
815
  </View>,
816
816
  ],
817
817
  ]
818
818
  )}
819
819
  </View>
820
820
  );