@conecli/cone-render 0.10.1-shop-beta.55 → 0.10.1-shop-beta.56

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
  priceUnit = '',
496
496
  priceType,
497
497
  hitUserIdentity = false,
498
498
  forceShowFinalPrice = false,
499
499
  hideSmallPrice = false,
500
500
  fallbackRender = null,
501
501
  className = null,
502
502
  style = {},
503
503
  childrenClassName = null,
504
504
  bigNoPriceClassName = null,
505
505
  bigSymbolClassName = null,
506
506
  bigIntegerClassName = null,
507
507
  bigDecimalClassName = null,
508
508
  priceDescClassName = null,
509
509
  smallPriceClassName = null,
510
510
  smallPriceDescClassName = null,
511
511
  lineNumber = 1,
512
512
  size = 'M',
513
513
  isDefaultRemoveSmallPrice = false,
514
514
  useFontV2 = false,
515
515
  useFontV2Bold = false,
516
516
  useSmallFontV2 = false,
517
517
  useSmallFontV2Bold = false,
518
518
  nativeProps,
519
519
  } = props;
520
520
  let useBackstop = false;
521
521
  const isShowPriceUnit = priceUnit && priceUnit !== '';
522
522
  if (isNull(props.priceType)) {
523
523
  useBackstop = true;
524
524
  reportException({
525
525
  type: 'paramMiss',
526
526
  data: props,
527
527
  text: '缺少必要入参:priceType',
528
528
  });
529
529
  } else if (
530
530
  !allowedNoHitUserIdentityTypes.includes(props.priceType) &&
531
531
  props.hitUserIdentity === undefined
532
532
  ) {
533
533
  useBackstop = true;
534
534
  reportException({
535
535
  type: 'paramMiss',
536
536
  data: props,
537
537
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
538
538
  });
539
539
  }
540
540
  const especialHitStyleType = {
541
541
  7: 'plusStyle',
542
542
  9: 'samStyle',
543
543
  };
544
544
  const especialMissStyleType = {
545
545
  7: 'plusStyle',
546
546
  8: 'fansStyle',
547
547
  9: 'samStyle',
548
548
  10: 'studentStyle',
549
549
  12: 'yhdStyle',
550
550
  13: 'memberStyle',
551
551
  };
552
552
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
553
553
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
554
554
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
555
555
  const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
556
556
  const isHideSmallPrice =
557
557
  hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
558
558
  const isTextPrice = priceType === 4;
559
559
  if (!isTextPrice && !useBackstop) {
560
560
  if (finalPrice && !numericPriceValidate(finalPrice, props)) {
561
561
  useBackstop = true;
562
562
  } else if (jdPrice && !numericPriceValidate(jdPrice, props)) {
563
563
  useBackstop = true;
564
564
  }
565
565
  if (!useBackstop && !isOnlyShowBigPrice && !isHideSmallPrice && !pricesCompareValidate(props)) {
566
566
  useBackstop = true;
567
567
  }
568
568
  }
569
569
  const bigPriceObj =
570
570
  isTextPrice || useBackstop
571
571
  ? {}
572
572
  : getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
573
573
  const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
574
574
  const isPriceDescInFront = isEquivalentHit;
575
575
  const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
576
576
  const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
577
577
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
578
578
  const sizeLineHeight = {
579
579
  XS: 28,
580
580
  S: 34,
581
581
  M: 40,
582
582
  L: 46,
583
583
  XL: 52,
584
584
  };
585
585
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
586
586
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
587
587
  const computedHeightStyle = {
588
588
  height: wrapHeight,
589
589
  };
590
590
  const itemCommonStyle = {
591
591
  height: lineHeight,
592
592
  };
593
593
  const priceTextStyle = priceTextColor ? { color: priceTextColor } : {};
594
594
  const needSizeStyles = [
595
595
  'bigNoPrice',
596
596
  'bigSymbol',
597
597
  'bigInteger',
598
598
  'bigDecimal',
599
599
  'priceDesc',
600
600
  'smallPrice',
601
601
  'priceUnit',
602
602
  ];
603
603
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
604
604
  acc[cur] = styles[cur + size];
605
605
  return acc;
606
606
  }, {});
607
607
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
608
608
  const noPriceShowText =
609
609
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
610
610
  if (useBackstop && fallbackRender) {
611
611
  return fallbackRender;
612
612
  }
613
613
  return (
614
614
  <View
615
615
  className={classNames(styles.wrap, className)}
616
616
  style={{ ...computedHeightStyle, ...style }}
617
617
  {...nativeProps}
618
618
  >
619
619
  {isTextPrice || useBackstop ? (
620
620
  <Text
621
621
  className={classNames(
622
622
  styles.childStyle,
623
623
  styles.bigStyle,
624
624
  styles.bigNoPrice,
625
625
  sizeStyles['bigNoPrice'],
626
626
  childrenClassName,
627
627
  bigNoPriceClassName,
628
628
  )}
629
629
  style={{ ...itemCommonStyle }}
630
630
  >
631
631
  {useBackstop ? finalFallbackText : noPriceShowText}
632
632
  </Text>
633
633
  ) : (
634
634
  [
635
635
  <Text
636
636
  className={classNames(
637
637
  styles.childStyle,
638
638
  styles.bigStyle,
639
639
  styles.bigSymbol,
640
640
  sizeStyles['bigSymbol'],
641
641
  hitColorStyle,
642
642
  childrenClassName,
643
643
  bigSymbolClassName,
644
644
  {
645
645
  [styles.fontV2]: useFontV2,
646
646
  [styles.fontV2Bold]: useFontV2Bold,
647
647
  },
648
648
  )}
649
649
  key="bigSymbol"
650
650
  style={{ ...itemCommonStyle }}
651
651
  >
652
652
  ¥
653
653
  </Text>,
654
654
  <Text
655
655
  className={classNames(
656
656
  styles.childStyle,
657
657
  styles.bigStyle,
658
658
  styles.bigInteger,
659
659
  sizeStyles['bigInteger'],
660
660
  hitColorStyle,
661
661
  !isOnlyShowBigPrice &&
662
662
  !isBigPriceHasDecimal &&
663
663
  !isPriceDescInFront &&
664
664
  !isShowPriceUnit
665
665
  ? styles.rightMargin
666
666
  : null,
667
667
  childrenClassName,
668
668
  bigIntegerClassName,
669
669
  {
670
670
  [styles.fontV2]: useFontV2,
671
671
  [styles.fontV2Bold]: useFontV2Bold,
672
672
  },
673
673
  )}
674
674
  key="bigInteger"
675
675
  style={{ ...itemCommonStyle }}
676
676
  >
677
677
  {integerPrice}
678
678
  </Text>,
679
679
  isBigPriceHasDecimal ? (
680
680
  <Text
681
681
  className={classNames(
682
682
  styles.childStyle,
683
683
  styles.bigStyle,
684
684
  styles.bigDecimal,
685
685
  sizeStyles['bigDecimal'],
686
686
  hitColorStyle,
687
687
  isPriceDescInFront || priceText === '' || isShowPriceUnit
688
688
  ? null
689
689
  : styles.rightMargin,
690
690
  childrenClassName,
691
691
  bigDecimalClassName,
692
692
  {
693
693
  [styles.fontV2]: useFontV2,
694
694
  [styles.fontV2Bold]: useFontV2Bold,
695
695
  },
696
696
  )}
697
697
  key="bigDecimal"
698
698
  style={{ ...itemCommonStyle }}
699
699
  >
700
700
  .{decimalPrice}
701
701
  </Text>
702
702
  ) : null,
703
703
  isShowPriceUnit ? (
704
704
  <Text
705
705
  className={classNames(
706
706
  styles.childStyle,
707
707
  styles.priceUnit,
708
708
  styles.rightMargin,
709
709
  sizeStyles['priceUnit'],
710
710
  styles.bigStyle,
711
711
  hitColorStyle,
712
712
  childrenClassName,
713
713
  priceDescClassName,
714
714
  )}
715
715
  key="descFrontUnit"
716
716
  style={{ ...itemCommonStyle }}
717
717
  >
718
718
  {priceUnit}
719
719
  </Text>
720
720
  ) : null,
721
721
  !isOnlyShowBigPrice && [
722
722
  isPriceDescInFront && (
723
723
  <Text
724
724
  className={classNames(
725
725
  styles.childStyle,
726
726
  styles.priceDesc,
727
727
  {
728
728
  [styles['priceEnDesc']]: isLanguageForEn,
729
729
  },
730
730
  {
731
731
  [styles['priceHiddenDesc']]: priceText === '',
732
732
  },
733
733
  sizeStyles['priceDesc'],
734
734
  styles.bigStyle,
735
735
  hitColorStyle,
736
736
  isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
737
737
  ? styles.rightMargin
738
738
  : null,
739
739
  childrenClassName,
740
740
  priceDescClassName,
741
741
  )}
742
742
  key="descFront"
743
743
  style={{ ...itemCommonStyle, ...priceTextStyle }}
744
744
  >
745
745
  {priceText === '' ? '_' : priceText}
746
746
  </Text>
747
747
  ),
748
748
  <View
749
749
  style={{
750
750
  display: 'inline-flex',
751
751
  }}
752
752
  >
753
753
  {smallPrice && !isHideSmallPrice ? (
754
754
  <Text
755
755
  className={classNames(
756
756
  styles.childStyle,
757
757
  styles.smallPrice,
758
758
  sizeStyles['smallPrice'],
759
759
  styles.smallStyle,
760
760
  missColorStyle,
761
761
  childrenClassName,
762
762
  smallPriceClassName,
763
763
  {
764
764
  [styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
765
765
  [styles.fontV2Bold]: useSmallFontV2
766
766
  ? false
767
767
  : useSmallFontV2Bold || useFontV2Bold,
768
768
  },
769
769
  )}
770
770
  key="smallPrice"
771
771
  style={{ ...itemCommonStyle }}
772
772
  >
773
773
  ¥{Number(smallPrice)}
774
774
  </Text>
775
775
  ) : null}
776
776
  {isShowPriceUnit && !isHideSmallPrice ? (
777
777
  <Text
778
778
  className={classNames(
779
779
  styles.childStyle,
780
780
  styles.priceUnit,
781
781
  sizeStyles['priceUnit'],
782
782
  styles.smallStyle,
783
783
  styles.missPriceDesc,
784
784
  missColorStyle,
785
785
  childrenClassName,
786
786
  smallPriceDescClassName || priceDescClassName,
787
787
  )}
788
788
  key="descFrontUnit"
789
789
  style={{ ...itemCommonStyle }}
790
790
  >
791
791
  {priceUnit}
792
792
  </Text>
793
793
  ) : null}
794
794
  {!isPriceDescInFront && !isHideSmallPrice && (
795
795
  <Text
796
796
  className={classNames(
797
797
  styles.childStyle,
798
798
  styles.priceDesc,
799
799
  {
800
800
  [styles['priceEnDesc']]: isLanguageForEn,
801
801
  },
802
802
  {
803
803
  [styles['priceHiddenDesc']]: priceText === '',
804
804
  },
805
805
  sizeStyles['priceDesc'],
806
806
  styles.smallStyle,
807
807
  styles.missPriceDesc,
808
808
  missColorStyle,
809
809
  childrenClassName,
810
810
  smallPriceDescClassName || priceDescClassName,
811
811
  )}
812
812
  key="descBack"
813
813
  style={{ ...itemCommonStyle }}
814
814
  >
815
815
  {priceText === '' ? '_' : priceText}
816
816
  </Text>
817
817
  )}
818
818
  </View>,
819
819
  ],
820
820
  ]
821
821
  )}
822
822
  </View>
823
823
  );