@conecli/cone-render 0.10.1-shop-beta.30 → 0.10.1-shop-beta.32

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