@conecli/cone-render 0.10.1-shop3.14 → 0.10.1-shop3.140

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 (121) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +1 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.ts +1 -1
  12. package/dist/common/jssdk.weapp.ts +1 -0
  13. package/dist/common/pageType.ts +1 -1
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/wxappApi.ascf.ts +1 -0
  17. package/dist/common/wxappApi.ts +1 -1
  18. package/dist/components/ErrorBoundary.tsx +1 -1
  19. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  20. package/dist/components/base/CountDown/index.tsx +1 -1
  21. package/dist/components/base/CountDownForApp/index.module.scss +52 -0
  22. package/dist/components/base/CountDownForApp/index.tsx +1 -0
  23. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  24. package/dist/components/base/CustomVideo/index.tsx +1 -1
  25. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  26. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  29. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  30. package/dist/components/base/InViewRender/index.tsx +1 -1
  31. package/dist/components/base/LazyLayoutLoad/index.module.scss +9 -9
  32. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  33. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  34. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  35. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  36. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  37. package/dist/components/base/NetworkDataError/const.ts +1 -1
  38. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  39. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  40. package/dist/components/base/Price/Base/index.module.scss +12 -0
  41. package/dist/components/base/Price/Base/index.tsx +1 -1
  42. package/dist/components/base/Price/Double/index.module.scss +26 -2
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  45. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  46. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  47. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  48. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  49. package/dist/components/floorItem.tsx +1 -1
  50. package/dist/components/isv/Floor/index.tsx +1 -1
  51. package/dist/components/remoteFloorItem.tsx +1 -1
  52. package/dist/config/env.ts +1 -1
  53. package/dist/interface/common.ts +1 -1
  54. package/dist/interface/component.ts +1 -1
  55. package/dist/interface/jumpEventReport.ts +1 -1
  56. package/dist/interface/service.ts +1 -1
  57. package/dist/jumpEventReport/base.ts +1 -1
  58. package/dist/jumpEventReport/const.ts +1 -1
  59. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  60. package/dist/jumpEventReport/index.h5.ts +1 -1
  61. package/dist/jumpEventReport/index.jd.ts +1 -1
  62. package/dist/jumpEventReport/index.weapp.ts +1 -1
  63. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  64. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  65. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  66. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  67. package/dist/jumpEventReport/web/report.ts +1 -1
  68. package/dist/jumpEventReport/web.base.ts +1 -1
  69. package/dist/jumpEventReport/web.jd.ts +1 -1
  70. package/dist/jumpEventReport/web.pc.ts +1 -1
  71. package/dist/jumpEventReport/web.tjm.ts +1 -1
  72. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  73. package/dist/language/en_US.json +398 -0
  74. package/dist/language/zh_CN.json +398 -0
  75. package/dist/language/zh_HK.json +398 -0
  76. package/dist/libs/openShopBridge.js +161 -0
  77. package/dist/libs/openShopBridge.min.js +1 -0
  78. package/dist/libs/taroAppReport.js +2 -2
  79. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  80. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  81. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  82. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  83. package/dist/open/api/environment.ts +1 -1
  84. package/dist/open/api/shopMember.ts +1 -1
  85. package/dist/open/api/shopMember.weapp.ts +1 -0
  86. package/dist/open/api/track.ts +1 -1
  87. package/dist/open/api/util.ts +1 -1
  88. package/dist/open/components/index.ts +1 -1
  89. package/dist/open/index.ts +1 -1
  90. package/dist/sass/app.h5.scss +12 -1
  91. package/dist/sass/base.scss +8 -4
  92. package/dist/service/fetchGateway.ts +1 -1
  93. package/dist/service/fetchGateway.weapp.ts +1 -1
  94. package/dist/service/fetchJsonp.weapp.ts +1 -0
  95. package/dist/service/http/const.ts +1 -1
  96. package/dist/service/http/h5Http.ts +1 -1
  97. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  98. package/dist/service/requestServer.h5.ts +1 -1
  99. package/dist/service/requestServer.ts +1 -1
  100. package/dist/service/requestServer.weapp.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/h5Utils.ts +1 -1
  104. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  105. package/dist/utils/harmonyCallRouter.ts +0 -0
  106. package/dist/utils/index.h5.ts +1 -1
  107. package/dist/utils/index.ts +1 -1
  108. package/dist/utils/index.weapp.ts +1 -1
  109. package/dist/utils/jumpExtMapUtil.ts +1 -0
  110. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  111. package/dist/utils/log.ts +1 -0
  112. package/dist/utils/sColor.weapp.ts +1 -0
  113. package/dist/utils/utils.ts +1 -1
  114. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  115. package/dist/wxapp/common/user_info.js +1 -1
  116. package/dist/wxapp/pages/shopx/prefetch.js +1 -0
  117. package/package.json +169 -141
  118. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  119. package/dist/utils/priceUtils.js +0 -1
  120. /package/dist/utils/{jumpExtMapUtil.js → jumpExtMapUtil.h5.ts} +0 -0
  121. /package/dist/utils/{sColor.js → sColor.ts} +0 -0
@@ -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
  if (
341
341
  isH5 &&
342
342
  global?.info?.pageInfo?.dataType === BUSINESS_TYPE.ONLINE &&
343
343
  !global?.info?.pageInfo?.isScanPreview
344
344
  ) {
345
345
  draBusinessCustomReport({
346
346
  eventName: 'business',
347
347
  errorName: `jd_${SgmCustomCode.PRICE_RENDER}`,
348
348
  errorMessage: '[双价格组件]' + text,
349
349
  extraData: JSON.stringify({
350
350
  type,
351
351
  data,
352
352
  }),
353
353
  });
354
354
  }
355
355
  return rest.some((item) => item === undefined || item === '');
356
356
  const numPrice = Number(strPrice);
357
357
  if (isNaN(numPrice)) {
358
358
  reportException({
359
359
  type: 'isNotNumericType',
360
360
  data: props,
361
361
  text: `传入价格字段值“${strPrice}”转换数字报错`,
362
362
  });
363
363
  return false;
364
364
  }
365
365
  else if (numPrice <= 0) {
366
366
  reportException({
367
367
  type: 'isNotPositiveNumber',
368
368
  data: props,
369
369
  text: `传入价格字段值“${strPrice}”不是一个正数`,
370
370
  });
371
371
  return false;
372
372
  }
373
373
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
374
374
  if (result && result[3]?.length > 2) {
375
375
  reportException({
376
376
  type: 'decimalPlaceTooLong',
377
377
  data: props,
378
378
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`,
379
379
  });
380
380
  return false;
381
381
  }
382
382
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)) {
383
383
  reportException({
384
384
  type: 'findScientificNotation',
385
385
  data: props,
386
386
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`,
387
387
  });
388
388
  }
389
389
  return true;
390
390
  const numPrice = Number(strPrice);
391
391
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/);
392
392
  if (result) {
393
393
  return {
394
394
  integerPrice: result[1],
395
395
  decimalPrice: (result[3] || '').replace(/0+$/, ''),
396
396
  };
397
397
  } else {
398
398
  reportException({
399
399
  type: 'deconstructException',
400
400
  data: props,
401
401
  text: `解构传入价格字段值“${strPrice}”解构发生异常`,
402
402
  });
403
403
  return null;
404
404
  }
405
405
  const {
406
406
  jdPrice,
407
407
  finalPrice,
408
408
  priceText = '',
409
409
  priceTextColor = '',
410
410
  subPriceTextColor = '',
411
411
  subPriceColor = '',
412
412
  priceUnit = '',
413
413
  priceType,
414
414
  hitUserIdentity = false,
415
415
  forceShowFinalPrice = false,
416
416
  hideSmallPrice = false,
417
417
  fallbackRender = null,
418
418
  className = null,
419
419
  style = {},
420
420
  childrenClassName = null,
421
421
  bigNoPriceClassName = null,
422
422
  bigSymbolClassName = null,
423
423
  bigIntegerClassName = null,
424
424
  bigDecimalClassName = null,
425
425
  priceDescClassName = null,
426
426
  smallPriceClassName = null,
427
427
  smallPriceDescClassName = null,
428
428
  lineNumber = 1,
429
429
  size = 'M',
430
430
  isDefaultRemoveSmallPrice = false,
431
431
  isDefaultRemoveBigPrice = false,
432
432
  useFontV2 = false,
433
433
  useFontV2Bold = false,
434
434
  useSmallFontV2 = false,
435
435
  useSmallFontV2Bold = false,
436
436
  renderPriceNumber,
437
437
  couponDiscountUpAmount,
438
438
  nativeProps,
439
439
  } = props;
440
440
  let useBackstop = false;
441
441
  const isShowPriceUnit = priceUnit && priceUnit !== '';
442
442
  if (isNull(props.priceType)) {
443
443
  useBackstop = true;
444
444
  reportException({
445
445
  type: 'paramMiss',
446
446
  data: props,
447
447
  text: '缺少必要入参:priceType',
448
448
  });
449
449
  } else if (
450
450
  !allowedNoHitUserIdentityTypes.includes(props.priceType) &&
451
451
  props.hitUserIdentity === undefined
452
452
  ) {
453
453
  useBackstop = true;
454
454
  reportException({
455
455
  type: 'paramMiss',
456
456
  data: props,
457
457
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`,
458
458
  });
459
459
  }
460
460
  const especialHitStyleType = {
461
461
  7: 'plusStyle',
462
462
  9: 'samStyle',
463
463
  };
464
464
  const especialMissStyleType = {
465
465
  7: 'plusStyle',
466
466
  8: 'fansStyle',
467
467
  9: 'samStyle',
468
468
  10: 'studentStyle',
469
469
  12: 'yhdStyle',
470
470
  13: 'memberStyle',
471
471
  };
472
472
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType);
473
473
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity;
474
474
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice);
475
475
  const smallPrice = isEquivalentHit ? jdPrice : finalPrice;
476
476
  const isHideSmallPrice =
477
477
  hideSmallPrice || priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice));
478
478
  const isTextPrice = priceType === 4;
479
479
  if (!isTextPrice && !useBackstop) {
480
480
  if (finalPrice && !numericPriceValidate(finalPrice, props)) {
481
481
  useBackstop = true;
482
482
  } else if (jdPrice && !numericPriceValidate(jdPrice, 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 bigPriceTextStyle = priceTextColor ? { color: priceTextColor } : {};
511
511
  const smallPriceTextStyle = subPriceTextColor ? { color: subPriceTextColor } : {};
512
512
  const smallPriceStyle = subPriceColor ? { color: subPriceColor } : {};
513
513
  const needSizeStyles = [
514
514
  'bigNoPrice',
515
515
  'bigSymbol',
516
516
  'bigInteger',
517
517
  'bigDecimal',
518
518
  'priceDesc',
519
519
  'smallPrice',
520
520
  'priceUnit',
521
521
  ];
522
522
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
523
523
  acc[cur] = styles[cur + size];
524
524
  return acc;
525
525
  }, {});
526
526
  const finalFallbackText = global?.languageJsonData?.noPriceTip || '暂无报价';
527
527
  const noPriceShowText =
528
528
  priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice) ? jdPrice : finalFallbackText);
529
529
  if (useBackstop && fallbackRender) {
530
530
  return fallbackRender;
531
531
  }
532
532
  const TextRender = renderPriceNumber ? renderPriceNumber : Text;
533
533
  return (
534
534
  <View
535
535
  className={classNames(styles.wrap, className)}
536
536
  style={{ ...computedHeightStyle, ...style }}
537
537
  {...nativeProps}
538
538
  >
539
539
  {isTextPrice || useBackstop ? (
540
540
  <Text
541
541
  className={classNames(
542
542
  styles.childStyle,
543
543
  styles.bigStyle,
544
544
  styles.bigNoPrice,
545
545
  sizeStyles['bigNoPrice'],
546
546
  childrenClassName,
547
547
  bigNoPriceClassName,
548
548
  )}
549
549
  style={{ ...itemCommonStyle }}
550
550
  >
551
551
  {useBackstop ? finalFallbackText : noPriceShowText}
552
552
  </Text>
553
553
  ) : (
554
554
  [
555
555
  <Text
556
556
  className={classNames(
557
557
  styles.childStyle,
558
558
  styles.bigStyle,
559
559
  styles.bigSymbol,
560
560
  sizeStyles['bigSymbol'],
561
561
  hitColorStyle,
562
562
  childrenClassName,
563
563
  bigSymbolClassName,
564
564
  {
565
565
  [styles.fontV2]: useFontV2,
566
566
  [styles.fontV2Bold]: useFontV2Bold,
567
567
  },
568
568
  isDefaultRemoveBigPrice ? 'display-none' : '',
569
569
  )}
570
570
  key="bigSymbol"
571
571
  style={{ ...itemCommonStyle }}
572
572
  >
573
573
  ¥
574
574
  </Text>,
575
575
  <TextRender
576
576
  className={classNames(
577
577
  styles.childStyle,
578
578
  styles.bigStyle,
579
579
  styles.bigInteger,
580
580
  sizeStyles['bigInteger'],
581
581
  hitColorStyle,
582
582
  !isOnlyShowBigPrice &&
583
583
  !isBigPriceHasDecimal &&
584
584
  !isPriceDescInFront &&
585
585
  !isShowPriceUnit
586
586
  ? styles.rightMargin
587
587
  : null,
588
588
  childrenClassName,
589
589
  bigIntegerClassName,
590
590
  {
591
591
  [styles.fontV2]: useFontV2,
592
592
  [styles.fontV2Bold]: useFontV2Bold,
593
593
  },
594
594
  isDefaultRemoveBigPrice ? 'display-none' : '',
595
595
  )}
596
596
  key="bigInteger"
597
597
  style={{ ...itemCommonStyle }}
598
598
  couponDiscountUpAmount={couponDiscountUpAmount}
599
599
  >
600
600
  {integerPrice}
601
601
  </TextRender>,
602
602
  isBigPriceHasDecimal ? (
603
603
  <TextRender
604
604
  className={classNames(
605
605
  styles.childStyle,
606
606
  styles.bigStyle,
607
607
  styles.bigDecimal,
608
608
  sizeStyles['bigDecimal'],
609
609
  hitColorStyle,
610
610
  isPriceDescInFront || priceText === '' || isShowPriceUnit
611
611
  ? null
612
612
  : styles.rightMargin,
613
613
  childrenClassName,
614
614
  bigDecimalClassName,
615
615
  {
616
616
  [styles.fontV2]: useFontV2,
617
617
  [styles.fontV2Bold]: useFontV2Bold,
618
618
  },
619
619
  isDefaultRemoveBigPrice ? 'display-none' : '',
620
620
  )}
621
621
  key="bigDecimal"
622
622
  style={{ ...itemCommonStyle }}
623
623
  couponDiscountUpAmount={couponDiscountUpAmount}
624
624
  >
625
625
  .{decimalPrice}
626
626
  </TextRender>
627
627
  ) : null,
628
628
  isShowPriceUnit ? (
629
629
  <Text
630
630
  className={classNames(
631
631
  styles.childStyle,
632
632
  styles.priceUnit,
633
633
  styles.rightMargin,
634
634
  sizeStyles['priceUnit'],
635
635
  styles.bigStyle,
636
636
  hitColorStyle,
637
637
  childrenClassName,
638
638
  priceDescClassName,
639
639
  )}
640
640
  key="descFrontUnit"
641
641
  style={{ ...itemCommonStyle }}
642
642
  >
643
643
  {priceUnit}
644
644
  </Text>
645
645
  ) : null,
646
646
  !isOnlyShowBigPrice && [
647
647
  isPriceDescInFront && (
648
648
  <Text
649
649
  className={classNames(
650
650
  styles.childStyle,
651
651
  styles.priceDesc,
652
652
  {
653
653
  [styles['priceEnDesc']]: isLanguageForEn,
654
654
  },
655
655
  {
656
656
  [styles['priceHiddenDesc']]: priceText === '',
657
657
  },
658
658
  priceText === '' ? 'priceHiddenDesc' : '',
659
659
  sizeStyles['priceDesc'],
660
660
  styles.bigStyle,
661
661
  hitColorStyle,
662
662
  isPriceDescInFront && !isShowPriceUnit && !isHideSmallPrice
663
663
  ? styles.rightMargin
664
664
  : null,
665
665
  childrenClassName,
666
666
  priceDescClassName,
667
667
  )}
668
668
  key="descFront"
669
669
  style={{ ...itemCommonStyle, ...bigPriceTextStyle }}
670
670
  >
671
671
  {priceText === '' ? '_' : priceText}
672
672
  </Text>
673
673
  ),
674
674
  <View
675
675
  style={{
676
676
  display: 'inline-flex',
677
677
  }}
678
678
  >
679
679
  {smallPrice && !isHideSmallPrice ? (
680
680
  <Text
681
681
  className={classNames(
682
682
  styles.childStyle,
683
683
  styles.smallPrice,
684
684
  sizeStyles['smallPrice'],
685
685
  styles.smallStyle,
686
686
  missColorStyle,
687
687
  childrenClassName,
688
688
  smallPriceClassName,
689
689
  {
690
690
  [styles.fontV2]: useSmallFontV2Bold ? false : useSmallFontV2 || useFontV2,
691
691
  [styles.fontV2Bold]: useSmallFontV2
692
692
  ? false
693
693
  : useSmallFontV2Bold || useFontV2Bold,
694
694
  },
695
695
  )}
696
696
  key="smallPrice"
697
697
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
698
698
  >
699
699
  ¥{Number(smallPrice)}
700
700
  </Text>
701
701
  ) : null}
702
702
  {isShowPriceUnit && !isHideSmallPrice ? (
703
703
  <Text
704
704
  className={classNames(
705
705
  styles.childStyle,
706
706
  styles.priceUnit,
707
707
  sizeStyles['priceUnit'],
708
708
  styles.smallStyle,
709
709
  styles.missPriceDesc,
710
710
  missColorStyle,
711
711
  childrenClassName,
712
712
  smallPriceDescClassName || priceDescClassName,
713
713
  )}
714
714
  key="descFrontUnit"
715
715
  style={{ ...itemCommonStyle, ...smallPriceStyle }}
716
716
  >
717
717
  {priceUnit}
718
718
  </Text>
719
719
  ) : null}
720
720
  {!isPriceDescInFront && !isHideSmallPrice && (
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
  priceText === '' ? 'priceHiddenDesc' : '',
732
732
  sizeStyles['priceDesc'],
733
733
  styles.smallStyle,
734
734
  styles.missPriceDesc,
735
735
  missColorStyle,
736
736
  childrenClassName,
737
737
  smallPriceDescClassName || priceDescClassName,
738
738
  )}
739
739
  key="descBack"
740
740
  style={{ ...itemCommonStyle, ...smallPriceTextStyle }}
741
741
  >
742
742
  {priceText === '' ? '_' : priceText}
743
743
  </Text>
744
744
  )}
745
745
  </View>,
746
746
  ],
747
747
  ]
748
748
  )}
749
749
  </View>
750
750
  );