@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.50

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