@conecli/cone-render 0.10.1-shop-beta.35 → 0.10.1-shop-beta.36

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
  } = props;
519
519
  let useBackstop = false;
520
520
  const isShowPriceUnit = priceUnit && priceUnit !== '';
521
521
  if (isNull(props.priceType)) {
522
522
  useBackstop = true;
523
523
  reportException({
524
524
  type: 'paramMiss',
525
525
  data: props,
526
526
  text: '缺少必要入参:priceType',
527
527
  });
528
528
  } else if (
529
529
  !allowedNoHitUserIdentityTypes.includes(props.priceType) &&
530
530
  props.hitUserIdentity === undefined
531
531
  ) {
532
532
  useBackstop = true;
533
533
  reportException({
534
534
  type: 'paramMiss',
535
535
  data: props,
536
536
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
537
537
  });
538
538
  }
539
539
  const especialHitStyleType = {
540
540
  7: 'plusStyle',
541
541
  9: 'samStyle',
542
542
  };
543
543
  const especialMissStyleType = {
544
544
  7: 'plusStyle',
545
545
  8: 'fansStyle',
546
546
  9: 'samStyle',
547
547
  10: 'studentStyle',
548
548
  12: 'yhdStyle',
549
549
  13: 'memberStyle',
550
550
  };
551
551
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
552
552
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
553
553
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
554
554
  const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
555
555
  const isHideSmallPrice =
556
556
  hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
557
557
  const isTextPrice = priceType === 4;
558
558
  if (!isTextPrice && !useBackstop) {
559
559
  if (finalPrice && !numericPriceValidate(finalPrice, props)) {
560
560
  useBackstop = true;
561
561
  } else if (jdPrice && !numericPriceValidate(jdPrice, props)) {
562
562
  useBackstop = true;
563
563
  }
564
564
  if (!useBackstop && !isOnlyShowBigPrice && !isHideSmallPrice && !pricesCompareValidate(props)) {
565
565
  useBackstop = true;
566
566
  }
567
567
  }
568
568
  const bigPriceObj =
569
569
  isTextPrice || useBackstop
570
570
  ? {}
571
571
  : getDeconstructPrice(isEquivalentHit && !isNull(finalPrice) ? finalPrice : jdPrice, props);
572
572
  const { integerPrice = '', decimalPrice = '' } = bigPriceObj || {};
573
573
  const isPriceDescInFront = isEquivalentHit;
574
574
  const hitColorStyle = isEquivalentHit ? styles[especialHitStyleType[priceType]] : null;
575
575
  const missColorStyle = isEquivalentHit ? null : styles[especialMissStyleType[priceType]];
576
576
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice);
577
577
  const sizeLineHeight = {
578
578
  XS: 28,
579
579
  S: 34,
580
580
  M: 40,
581
581
  L: 46,
582
582
  XL: 52,
583
583
  };
584
584
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25);
585
585
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber);
586
586
  const computedHeightStyle = {
587
587
  height: wrapHeight,
588
588
  };
589
589
  const itemCommonStyle = {
590
590
  height: lineHeight,
591
591
  };
592
592
  const priceTextStyle = priceTextColor ? { color: priceTextColor } : {};
593
593
  const needSizeStyles = [
594
594
  'bigNoPrice',
595
595
  'bigSymbol',
596
596
  'bigInteger',
597
597
  'bigDecimal',
598
598
  'priceDesc',
599
599
  'smallPrice',
600
600
  'priceUnit',
601
601
  ];
602
602
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
603
603
  acc[cur] = styles[cur + size];
604
604
  return acc;
605
605
  }, {});
606
606
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
607
607
  const noPriceShowText =
608
608
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
609
609
  if (useBackstop && fallbackRender) {
610
610
  return fallbackRender;
611
611
  }
612
612
  return (
613
613
  <View
614
614
  className={classNames(styles.wrap, className)}
615
615
  style={{ ...computedHeightStyle, ...style }}
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
  );