@conecli/cone-render 0.10.1-shop3.107 → 0.10.1-shop3.109

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