@conecli/cone-render 0.10.1-shop-beta.18 → 0.10.1-shop-beta.19

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
  let value = `${initValue}`;
3
2
  if (!cnPriceTextList.includes(value)) {
4
3
  if (value && !/^[0123456789-]*$/.test(value.substring(0, 1))) {
5
4
  symbol = value.substring(0, 1);
6
5
  value = value.substring(1);
7
6
  }
8
7
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(value)) {
9
8
  sgmCustomReport({
10
9
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
11
10
  msg: {
12
11
  price: value,
13
12
  originalPrice: initValue,
14
13
  msg: '当前价格为科学计数数据,上报关注该价格',
15
14
  },
16
15
  });
17
16
  }
18
17
  if (!decToIntegerState) {
19
18
  value = parseFloat(value).toFixed(decLength);
20
19
  } else {
21
20
  if (value.indexOf('.') !== -1) {
22
21
  value = parseFloat(value).toFixed(decLength);
23
22
  value = `${value}`.replace(/0+$/, '');
24
23
  }
25
24
  }
26
25
  if (value === 'NaN') {
27
26
  sgmCustomReport({
28
27
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
29
28
  msg: {
30
29
  price: value,
31
30
  originalPrice: initValue,
32
31
  msg: '价格转换异常,兜底展示暂无报价',
33
32
  },
34
33
  });
35
34
  value = '暂无报价';
36
35
  }
37
36
  }
38
37
  const [intVal, decimalVal] = `${value}`.split('.');
39
38
  return {
40
39
  currencySymbol: !cnPriceTextList.includes(intVal) ? symbol : '',
41
40
  intVal,
42
41
  decimalVal,
43
42
  };
44
43
  const {
45
44
  prefixCls = 'd-mini-price',
46
45
  symPos = 'sub',
47
46
  symbol = '¥',
48
47
  decPos = 'sub',
49
48
  status = '',
50
49
  className,
51
50
  style = {},
52
51
  symClassName,
53
52
  intClassName,
54
53
  decClassName,
55
54
  noPriceClassName,
56
55
  value,
57
56
  decLength = 2,
58
57
  decToIntegerState = false,
59
58
  isPlusPrice = false,
60
59
  isSamsPrice,
61
60
  isMemberPrice,
62
61
  isSfpPrice,
63
62
  memberPriceIcon,
64
63
  isShowPriceLabel = false,
65
64
  priceLabelText = '到手价',
66
65
  useFontV2 = false,
67
66
  useFontV2Bold = false,
68
67
  } = props;
69
68
  const cls = classNames(
70
69
  className ? `${className}` : '',
71
70
  prefixCls,
72
71
  'd-imag-rendering-crisp-edges',
73
72
  {
74
73
  del: status === 'del',
75
74
  },
76
75
  {
77
76
  'd-price-label': isShowPriceLabel,
78
77
  },
79
78
  );
80
79
  const symCls = classNames(symClassName ? `${symClassName}` : '', {
81
80
  'sym-sub': symPos === 'sub',
82
81
  'sym-sup': symPos === 'sup',
83
82
  'd-font-v2': useFontV2,
84
83
  'd-font-v2-bold': useFontV2Bold,
85
84
  });
86
85
  const intCls = classNames(intClassName ? `${intClassName}` : '',{
87
86
  'd-font-v2': useFontV2,
88
87
  'd-font-v2-bold': useFontV2Bold,
89
88
  });
90
89
  const decCls = classNames(decClassName ? `${decClassName}` : '', {
91
90
  'dec-sub': decPos === 'sub',
92
91
  'dec-sup': decPos === 'sup',
93
92
  'd-font-v2': useFontV2,
94
93
  'd-font-v2-bold': useFontV2Bold,
95
94
  });
96
95
  const noPriceCls = classNames(noPriceClassName ? `${noPriceClassName}` : '');
97
96
  const { currencySymbol, intVal, decimalVal } = dealPrice(
98
97
  value,
99
98
  decLength,
100
99
  symbol,
101
100
  decToIntegerState,
102
101
  );
103
102
  return (
104
103
  <View className={cls} style={style}>
105
104
  {intVal === '-1' ? (
106
105
  <Text className={`${prefixCls}-txt int-txt off-shelf ${noPriceCls}`}>{`暂无报价`}</Text>
107
106
  ) : (
108
107
  <>
109
108
  <Text className={classNames(`${prefixCls}-sym`,`${symCls}`,"init-font-color",{
110
109
  "init-font-android-color": isAndroidDevice
111
110
  })}>{currencySymbol}</Text>
112
111
  <Text className={classNames(`${prefixCls}-txt`,`int-txt`,`${intCls}`,`init-font-color`,{
113
112
  "init-font-android-color": isAndroidDevice
114
113
  })}>{intVal}</Text>
115
114
  {!!decimalVal && (
116
115
  <Text className={classNames(`${prefixCls}-txt`,`dec-txt`,`${decCls}`,`init-font-color`,{
117
116
  "init-font-android-color": isAndroidDevice
118
117
  })}>.{decimalVal}</Text>
119
118
  )}
120
119
  {isShowPriceLabel && <Text className={classNames('d-price-label-text','init-font-color',{
121
120
  "init-font-android-color": isAndroidDevice
122
121
  })}>{priceLabelText}</Text>}
123
122
  </>
124
123
  )}
125
124
  </View>
126
125
  );
126
+ import React from 'react';
127
127
  let value = `${initValue}`;
128
128
  if (!cnPriceTextList.includes(value)) {
129
129
  if (value && !/^[0123456789-]*$/.test(value.substring(0, 1))) {
130
130
  symbol = value.substring(0, 1);
131
131
  value = value.substring(1);
132
132
  }
133
133
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(value)) {
134
134
  sgmCustomReport({
135
135
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
136
136
  msg: {
137
137
  price: value,
138
138
  originalPrice: initValue,
139
139
  msg: '当前价格为科学计数数据,上报关注该价格',
140
140
  },
141
141
  });
142
142
  }
143
143
  if (!decToIntegerState) {
144
144
  value = parseFloat(value).toFixed(decLength);
145
145
  } else {
146
146
  if (value.indexOf('.') !== -1) {
147
147
  value = parseFloat(value).toFixed(decLength);
148
148
  value = `${value}`.replace(/0+$/, '');
149
149
  }
150
150
  }
151
151
  if (value === 'NaN') {
152
152
  sgmCustomReport({
153
153
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
154
154
  msg: {
155
155
  price: value,
156
156
  originalPrice: initValue,
157
157
  msg: '价格转换异常,兜底展示暂无报价',
158
158
  },
159
159
  });
160
160
  value = '暂无报价';
161
161
  }
162
162
  }
163
163
  const [intVal, decimalVal] = `${value}`.split('.');
164
164
  return {
165
165
  currencySymbol: !cnPriceTextList.includes(intVal) ? symbol : '',
166
166
  intVal,
167
167
  decimalVal,
168
168
  };
169
169
  const {
170
170
  prefixCls = 'd-mini-price',
171
171
  symPos = 'sub',
172
172
  symbol = '¥',
173
173
  decPos = 'sub',
174
174
  status = '',
175
175
  className,
176
176
  style = {},
177
177
  symClassName,
178
178
  intClassName,
179
179
  decClassName,
180
180
  noPriceClassName,
181
181
  value,
182
182
  decLength = 2,
183
183
  decToIntegerState = false,
184
184
  isShowPriceLabel = false,
185
185
  priceLabelText = '到手价',
186
186
  priceTextColor = '',
187
187
  useFontV2 = false,
188
188
  useFontV2Bold = false,
189
189
  } = props;
190
190
  const cls = classNames(
191
191
  className ? `${className}` : '',
192
192
  prefixCls,
193
193
  'd-imag-rendering-crisp-edges',
194
194
  {
195
195
  del: status === 'del',
196
196
  },
197
197
  {
198
198
  'd-price-label': isShowPriceLabel,
199
199
  },
200
200
  );
201
201
  const symCls = classNames(symClassName ? `${symClassName}` : '', {
202
202
  'sym-sub': symPos === 'sub',
203
203
  'sym-sup': symPos === 'sup',
204
204
  'd-font-v2': useFontV2,
205
205
  'd-font-v2-bold': useFontV2Bold,
206
206
  });
207
207
  const intCls = classNames(intClassName ? `${intClassName}` : '', {
208
208
  'd-font-v2': useFontV2,
209
209
  'd-font-v2-bold': useFontV2Bold,
210
210
  });
211
211
  const decCls = classNames(decClassName ? `${decClassName}` : '', {
212
212
  'dec-sub': decPos === 'sub',
213
213
  'dec-sup': decPos === 'sup',
214
214
  'd-font-v2': useFontV2,
215
215
  'd-font-v2-bold': useFontV2Bold,
216
216
  });
217
217
  const noPriceCls = classNames(noPriceClassName ? `${noPriceClassName}` : '');
218
218
  const { currencySymbol, intVal, decimalVal } = dealPrice(
219
219
  value,
220
220
  decLength,
221
221
  symbol,
222
222
  decToIntegerState,
223
223
  );
224
224
  return (
225
225
  <View className={cls} style={style}>
226
226
  {intVal === '-1' ? (
227
227
  <Text className={`${prefixCls}-txt int-txt off-shelf ${noPriceCls}`}>{`暂无报价`}</Text>
228
228
  ) : (
229
229
  <>
230
230
  <Text
231
231
  className={classNames(`${prefixCls}-sym`, `${symCls}`, 'init-font-color', {
232
232
  'init-font-android-color': isAndroidDevice,
233
233
  })}
234
234
  >
235
235
  {currencySymbol}
236
236
  </Text>
237
237
  <Text
238
238
  className={classNames(`${prefixCls}-txt`, `int-txt`, `${intCls}`, `init-font-color`, {
239
239
  'init-font-android-color': isAndroidDevice,
240
240
  })}
241
241
  >
242
242
  {intVal}
243
243
  </Text>
244
244
  {!!decimalVal && (
245
245
  <Text
246
246
  className={classNames(`${prefixCls}-txt`, `dec-txt`, `${decCls}`, `init-font-color`, {
247
247
  'init-font-android-color': isAndroidDevice,
248
248
  })}
249
249
  >
250
250
  .{decimalVal}
251
251
  </Text>
252
252
  )}
253
253
  {isShowPriceLabel && (
254
254
  <Text
255
255
  className={classNames('d-price-label-text', 'init-font-color', {
256
256
  'init-font-android-color': isAndroidDevice,
257
257
  })}
258
258
  style={ priceTextColor !== '' ? {
259
259
  color: priceTextColor,
260
260
  } : {}}
261
261
  >
262
262
  {priceLabelText}
263
263
  </Text>
264
264
  )}
265
265
  </>
266
266
  )}
267
267
  </View>
268
268
  );
@@ -1,6 +1,7 @@
1
1
 
2
2
  :global {
3
3
  .d-mini-price {
4
+ --after-ele-color: '';
4
5
  position: relative;
5
6
  color: #f23030;
6
7
  display: inline-block;
@@ -67,6 +68,11 @@
67
68
  margin-left: 8px;
68
69
  }
69
70
  }
71
+ &.d-price-text-clor {
72
+ &:after {
73
+ color: var(--after-ele-color) !important;
74
+ }
75
+ }
70
76
  &.d-plus-price {
71
77
  .int-txt,
72
78
  .sym-sub,
@@ -1 +1 @@
1
- import React from 'react';
2
1
  let value = `${initValue}`;
3
2
  if (!cnPriceTextList.includes(value)) {
4
3
  if (value && !/^[0123456789-]*$/.test(value.substring(0, 1))) {
5
4
  symbol = value.substring(0, 1);
6
5
  value = value.substring(1);
7
6
  }
8
7
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(value)) {
9
8
  sgmCustomReport({
10
9
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
11
10
  msg: {
12
11
  price: value,
13
12
  originalPrice: initValue,
14
13
  msg: '当前价格为科学计数数据,上报关注该价格',
15
14
  },
16
15
  });
17
16
  }
18
17
  if (!decToIntegerState) {
19
18
  value = parseFloat(value).toFixed(decLength);
20
19
  } else {
21
20
  if (value.indexOf('.') !== -1) {
22
21
  value = parseFloat(value).toFixed(decLength);
23
22
  value = `${value}`.replace(/0+$/, '');
24
23
  }
25
24
  }
26
25
  if (value === 'NaN') {
27
26
  sgmCustomReport({
28
27
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
29
28
  msg: {
30
29
  price: value,
31
30
  originalPrice: initValue,
32
31
  msg: '价格转换异常,兜底展示暂无报价',
33
32
  },
34
33
  });
35
34
  value = '暂无报价';
36
35
  }
37
36
  }
38
37
  const [intVal, decimalVal] = `${value}`.split('.');
39
38
  return {
40
39
  currencySymbol: !cnPriceTextList.includes(intVal) ? symbol : '',
41
40
  intVal,
42
41
  decimalVal,
43
42
  };
44
43
  const {
45
44
  prefixCls = 'd-mini-price',
46
45
  symPos = 'sub',
47
46
  symbol = '¥',
48
47
  decPos = 'sub',
49
48
  status = '',
50
49
  className,
51
50
  style = {},
52
51
  symClassName,
53
52
  intClassName,
54
53
  decClassName,
55
54
  noPriceClassName,
56
55
  value,
57
56
  decLength = 2,
58
57
  decToIntegerState = false,
59
58
  isPlusPrice = false,
60
59
  isSamsPrice,
61
60
  isMemberPrice,
62
61
  isSfpPrice,
63
62
  memberPriceIcon,
64
63
  isShowPriceLabel = false,
65
64
  priceLabelText = '到手价',
66
65
  useFontV2 = false,
67
66
  useFontV2Bold = false,
68
67
  } = props;
69
68
  const cls = classNames(
70
69
  className ? `${className}` : '',
71
70
  prefixCls,
72
71
  {
73
72
  'd-font-v2': useFontV2,
74
73
  'd-font-v2-bold': useFontV2Bold,
75
74
  },
76
75
  'd-imag-rendering-crisp-edges',
77
76
  {
78
77
  del: status === 'del',
79
78
  },
80
79
  {
81
80
  'd-plus-price': isPlusPrice,
82
81
  },
83
82
  {
84
83
  'd-sams-price': isSamsPrice,
85
84
  },
86
85
  {
87
86
  'd-sfp-price': isSfpPrice,
88
87
  },
89
88
  {
90
89
  'd-member-price': isMemberPrice,
91
90
  },
92
91
  {
93
92
  [`d-member-price-${memberPriceIcon}`]: memberPriceIcon,
94
93
  },
95
94
  {
96
95
  'd-price-label': isShowPriceLabel,
97
96
  },
98
97
  );
99
98
  const symCls = classNames(symClassName ? `${symClassName}` : '', {
100
99
  'sym-sub': symPos === 'sub',
101
100
  'sym-sup': symPos === 'sup',
102
101
  });
103
102
  const intCls = classNames(intClassName ? `${intClassName}` : '');
104
103
  const decCls = classNames(decClassName ? `${decClassName}` : '', {
105
104
  'dec-sub': decPos === 'sub',
106
105
  'dec-sup': decPos === 'sup',
107
106
  });
108
107
  const noPriceCls = classNames(noPriceClassName ? `${noPriceClassName}` : '');
109
108
  const { currencySymbol, intVal, decimalVal } = dealPrice(
110
109
  value,
111
110
  decLength,
112
111
  symbol,
113
112
  decToIntegerState,
114
113
  );
115
114
  return (
116
115
  <View className={cls} style={style} data-after={isShowPriceLabel ? priceLabelText : ''}>
117
116
  {intVal === '-1' ? (
118
117
  <Text className={`${prefixCls}-txt int-txt off-shelf ${noPriceCls}`}>{`暂无报价`}</Text>
119
118
  ) : (
120
119
  <>
121
120
  <Text className={`${prefixCls}-sym ${symCls}`}>{currencySymbol}</Text>
122
121
  <Text className={`${prefixCls}-txt int-txt ${intCls}`}>{intVal}</Text>
123
122
  {!!decimalVal && (
124
123
  <Text className={`${prefixCls}-txt dec-txt ${decCls}`}>.{decimalVal}</Text>
125
124
  )}
126
125
  </>
127
126
  )}
128
127
  </View>
129
128
  );
129
+ import React, { useEffect, useRef } from 'react';
130
130
  let value = `${initValue}`;
131
131
  if (!cnPriceTextList.includes(value)) {
132
132
  if (value && !/^[0123456789-]*$/.test(value.substring(0, 1))) {
133
133
  symbol = value.substring(0, 1);
134
134
  value = value.substring(1);
135
135
  }
136
136
  if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(value)) {
137
137
  sgmCustomReport({
138
138
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
139
139
  msg: {
140
140
  price: value,
141
141
  originalPrice: initValue,
142
142
  msg: '当前价格为科学计数数据,上报关注该价格',
143
143
  },
144
144
  });
145
145
  }
146
146
  if (!decToIntegerState) {
147
147
  value = parseFloat(value).toFixed(decLength);
148
148
  } else {
149
149
  if (value.indexOf('.') !== -1) {
150
150
  value = parseFloat(value).toFixed(decLength);
151
151
  value = `${value}`.replace(/0+$/, '');
152
152
  }
153
153
  }
154
154
  if (value === 'NaN') {
155
155
  sgmCustomReport({
156
156
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
157
157
  msg: {
158
158
  price: value,
159
159
  originalPrice: initValue,
160
160
  msg: '价格转换异常,兜底展示暂无报价',
161
161
  },
162
162
  });
163
163
  value = '暂无报价';
164
164
  }
165
165
  }
166
166
  const [intVal, decimalVal] = `${value}`.split('.');
167
167
  return {
168
168
  currencySymbol: !cnPriceTextList.includes(intVal) ? symbol : '',
169
169
  intVal,
170
170
  decimalVal,
171
171
  };
172
172
  const {
173
173
  prefixCls = 'd-mini-price',
174
174
  symPos = 'sub',
175
175
  symbol = '¥',
176
176
  decPos = 'sub',
177
177
  status = '',
178
178
  className,
179
179
  style = {},
180
180
  symClassName,
181
181
  intClassName,
182
182
  decClassName,
183
183
  noPriceClassName,
184
184
  value,
185
185
  decLength = 2,
186
186
  decToIntegerState = false,
187
187
  isPlusPrice = false,
188
188
  isSamsPrice,
189
189
  isMemberPrice,
190
190
  isSfpPrice,
191
191
  memberPriceIcon,
192
192
  isShowPriceLabel = false,
193
193
  priceLabelText = '到手价',
194
194
  priceTextColor = '',
195
195
  useFontV2 = false,
196
196
  useFontV2Bold = false,
197
197
  } = props;
198
198
  const cRef = useRef<any>(null);
199
199
  useEffect(() => {
200
200
  if (isShowPriceLabel && priceTextColor && cRef.current) {
201
201
  cRef.current?.style?.setProperty('--after-ele-color', priceTextColor);
202
202
  }
203
203
  }, [isShowPriceLabel, priceTextColor]);
204
204
  const cls = classNames(
205
205
  className ? `${className}` : '',
206
206
  prefixCls,
207
207
  {
208
208
  'd-font-v2': useFontV2,
209
209
  'd-font-v2-bold': useFontV2Bold,
210
210
  },
211
211
  'd-imag-rendering-crisp-edges',
212
212
  {
213
213
  del: status === 'del',
214
214
  },
215
215
  {
216
216
  'd-plus-price': isPlusPrice,
217
217
  },
218
218
  {
219
219
  'd-sams-price': isSamsPrice,
220
220
  },
221
221
  {
222
222
  'd-sfp-price': isSfpPrice,
223
223
  },
224
224
  {
225
225
  'd-member-price': isMemberPrice,
226
226
  },
227
227
  {
228
228
  [`d-member-price-${memberPriceIcon}`]: memberPriceIcon,
229
229
  },
230
230
  {
231
231
  'd-price-label': isShowPriceLabel,
232
232
  },
233
233
  {
234
234
  'd-price-text-clor': isShowPriceLabel && priceTextColor,
235
235
  },
236
236
  );
237
237
  const symCls = classNames(symClassName ? `${symClassName}` : '', {
238
238
  'sym-sub': symPos === 'sub',
239
239
  'sym-sup': symPos === 'sup',
240
240
  });
241
241
  const intCls = classNames(intClassName ? `${intClassName}` : '');
242
242
  const decCls = classNames(decClassName ? `${decClassName}` : '', {
243
243
  'dec-sub': decPos === 'sub',
244
244
  'dec-sup': decPos === 'sup',
245
245
  });
246
246
  const noPriceCls = classNames(noPriceClassName ? `${noPriceClassName}` : '');
247
247
  const { currencySymbol, intVal, decimalVal } = dealPrice(
248
248
  value,
249
249
  decLength,
250
250
  symbol,
251
251
  decToIntegerState,
252
252
  );
253
253
  return (
254
254
  <View
255
255
  ref={cRef}
256
256
  className={cls}
257
257
  style={style}
258
258
  data-after={isShowPriceLabel ? priceLabelText : ''}
259
259
  >
260
260
  {intVal === '-1' ? (
261
261
  <Text className={`${prefixCls}-txt int-txt off-shelf ${noPriceCls}`}>{`暂无报价`}</Text>
262
262
  ) : (
263
263
  <>
264
264
  <Text className={`${prefixCls}-sym ${symCls}`}>{currencySymbol}</Text>
265
265
  <Text className={`${prefixCls}-txt int-txt ${intCls}`}>{intVal}</Text>
266
266
  {!!decimalVal && (
267
267
  <Text className={`${prefixCls}-txt dec-txt ${decCls}`}>.{decimalVal}</Text>
268
268
  )}
269
269
  </>
270
270
  )}
271
271
  </View>
272
272
  );