@conecli/cone-render 0.10.1-shop3.133 → 0.10.1-shop3.135
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.
- package/dist/common/const.ts +1 -1
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.h5.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import { NETWORK_DATA_TYPE } from '../../../common/const';
|
|
2
1
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.loseNetwork || '网络连接已断开',
|
|
3
2
|
[NETWORK_DATA_TYPE.DATA_ERROR]:
|
|
4
3
|
global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
5
4
|
[NETWORK_DATA_TYPE.NO_DATA]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
6
5
|
[NETWORK_DATA_TYPE.RISK]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
7
6
|
[NETWORK_DATA_TYPE.NOT_LOGIN]: global?.languageJsonData?.notLogin || '登录后,购物更轻松~',
|
|
8
7
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.checkNetwork || '请检查您的网络设置',
|
|
9
8
|
[NETWORK_DATA_TYPE.DATA_ERROR]:
|
|
10
9
|
global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
11
10
|
[NETWORK_DATA_TYPE.NO_DATA]: global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
12
11
|
[NETWORK_DATA_TYPE.RISK]: `${global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试'
|
|
13
12
|
}。`,
|
|
14
13
|
[NETWORK_DATA_TYPE.NOT_LOGIN]: '',
|
|
15
14
|
NETWORK_DATA_TYPE.NO_NET_WORK,
|
|
16
15
|
NETWORK_DATA_TYPE.DATA_ERROR,
|
|
17
16
|
NETWORK_DATA_TYPE.NO_DATA,
|
|
18
17
|
NETWORK_DATA_TYPE.RISK,
|
|
19
18
|
NETWORK_DATA_TYPE.NOT_LOGIN,
|
|
20
19
|
PART: 'part',
|
|
21
20
|
FULL: 'full',
|
|
22
21
|
No_Data_Default_Tip: 'no-data-default-tip',
|
|
23
22
|
No_Data_Tip_1: 'no-data-tip-1',
|
|
24
23
|
No_Data_Tip_2: 'no-data-tip-2',
|
|
25
24
|
No_Network_Err_Tip: 'no-network',
|
|
26
25
|
No_Data_Bmall: 'no-data-bmall',
|
|
27
26
|
OLD: 'old',
|
|
28
27
|
NEW: 'new',
|
|
28
|
+
import { NETWORK_DATA_TYPE } from '../../../common/const';
|
|
29
29
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.loseNetwork || '网络连接已断开',
|
|
30
30
|
[NETWORK_DATA_TYPE.DATA_ERROR]:
|
|
31
31
|
global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
32
32
|
[NETWORK_DATA_TYPE.NO_DATA]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
33
33
|
[NETWORK_DATA_TYPE.RISK]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
34
34
|
[NETWORK_DATA_TYPE.NOT_LOGIN]: global?.languageJsonData?.notLogin || '登录后,购物更轻松~',
|
|
35
35
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.checkNetwork || '请检查您的网络设置',
|
|
36
36
|
[NETWORK_DATA_TYPE.DATA_ERROR]:
|
|
37
37
|
global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
38
38
|
[NETWORK_DATA_TYPE.NO_DATA]: global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
39
39
|
[NETWORK_DATA_TYPE.RISK]: `${global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试'
|
|
40
40
|
}。`,
|
|
41
41
|
[NETWORK_DATA_TYPE.NOT_LOGIN]: '',
|
|
42
42
|
NETWORK_DATA_TYPE.NO_NET_WORK,
|
|
43
43
|
NETWORK_DATA_TYPE.DATA_ERROR,
|
|
44
44
|
NETWORK_DATA_TYPE.NO_DATA,
|
|
45
45
|
NETWORK_DATA_TYPE.RISK,
|
|
46
46
|
NETWORK_DATA_TYPE.NOT_LOGIN,
|
|
47
47
|
PART: 'part',
|
|
48
48
|
FULL: 'full',
|
|
49
49
|
No_Data_Default_Tip: 'no-data-default-tip',
|
|
50
50
|
No_Data_Tip_1: 'no-data-tip-1',
|
|
51
51
|
No_Data_Tip_2: 'no-data-tip-2',
|
|
52
52
|
No_Network_Err_Tip: 'no-network',
|
|
53
53
|
No_Data_Bmall: 'no-data-bmall',
|
|
54
54
|
OLD: 'old',
|
|
55
55
|
NEW: 'new',
|
|
56
56
|
[NETWORK_DATA_TYPE.DATA_ERROR]: 'h5_network_interface_error',
|
|
57
57
|
[NETWORK_DATA_TYPE.NO_DATA]: 'h5_network_interface_nodata',
|
|
58
58
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: 'h5_network_network_error',
|
|
59
59
|
[NETWORK_DATA_TYPE.RISK]: 'h5_network_risk_error',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { Button, View } from '@tarojs/components';
|
|
2
1
|
NetWorkErrorList,
|
|
3
2
|
NetWorkErrorTip,
|
|
4
3
|
NetWorkErrorSubTip,
|
|
5
4
|
NetWorkShowType,
|
|
6
5
|
NetWork_Image_Type,
|
|
7
6
|
NetWorkStyleType,
|
|
8
7
|
const {
|
|
9
8
|
className = '',
|
|
10
9
|
message = '',
|
|
11
10
|
subMessage = '',
|
|
12
11
|
btnLabel = global?.languageJsonData?.reload || '重新加载',
|
|
13
12
|
backgroundColorWhite = false,
|
|
14
13
|
netWorkDataType = NETWORK_DATA_TYPE.NORMAL,
|
|
15
14
|
netWorkShowType = NetWorkShowType.FULL,
|
|
16
15
|
netWorkImageType = NetWork_Image_Type.No_Data_Default_Tip,
|
|
17
16
|
netWorkStyleType = NetWorkStyleType.OLD,
|
|
18
17
|
refreshCallBackFn = null,
|
|
19
18
|
viewMaxHeight = '',
|
|
20
19
|
noPosition = false,
|
|
21
20
|
} = props;
|
|
22
21
|
const refershInitData = useCallback(() => {
|
|
23
22
|
refreshCallBackFn && refreshCallBackFn(true);
|
|
24
23
|
}, []);
|
|
25
24
|
const useErrorTip = message != '' ? message : NetWorkErrorTip[netWorkDataType];
|
|
26
25
|
const useErrorSubTip = subMessage
|
|
27
26
|
? subMessage
|
|
28
27
|
: message != ''
|
|
29
28
|
? ''
|
|
30
29
|
: NetWorkErrorSubTip[netWorkDataType];
|
|
31
30
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
|
|
32
31
|
const onePlusOneBottomPlaceHeight = global.info?.sysInfo?.onePlusOneBottomPlaceHeight
|
|
33
32
|
? global.info?.sysInfo?.onePlusOneBottomPlaceHeight + 20
|
|
34
33
|
: 0;
|
|
35
34
|
const maxHeight = latestRes.displayHeight || onePlusOneBottomPlaceHeight + 546;
|
|
36
35
|
return NetWorkErrorList.includes(netWorkDataType as NETWORK_DATA_TYPE) ? (
|
|
37
36
|
<View
|
|
38
37
|
style={{
|
|
39
38
|
maxHeight: viewMaxHeight !== '' ? viewMaxHeight : isMemberPage ? '100vh' : maxHeight,
|
|
40
39
|
}}
|
|
41
40
|
className={classNames(
|
|
42
41
|
netWorkErrorStyle['d-shop-network'],
|
|
43
42
|
{
|
|
44
43
|
[netWorkErrorStyle['d-shop-network-white']]: backgroundColorWhite,
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
[netWorkErrorStyle['d-shop-network-part']]: netWorkShowType === NetWorkShowType.PART,
|
|
48
47
|
},
|
|
49
48
|
{
|
|
50
49
|
[netWorkErrorStyle['d-network-jd-shop-view']]: isH5AndJdShopView,
|
|
51
50
|
},
|
|
52
51
|
{
|
|
53
52
|
[netWorkErrorStyle['d-shop-network-no-position']]: noPosition,
|
|
54
53
|
},
|
|
55
54
|
'flexible-center-box',
|
|
56
55
|
'J_shopNetwork',
|
|
57
56
|
className,
|
|
58
57
|
)}
|
|
59
58
|
>
|
|
60
59
|
<View
|
|
61
60
|
className={classNames(
|
|
62
61
|
netWorkErrorStyle['d-error-content'],
|
|
63
62
|
netWorkErrorStyle[`d-${netWorkStyleType}-style-content`],
|
|
64
63
|
'd-error-content',
|
|
65
64
|
)}
|
|
66
65
|
>
|
|
67
66
|
<View
|
|
68
67
|
className={classNames(
|
|
69
68
|
netWorkErrorStyle['d-error-type'],
|
|
70
69
|
netWorkErrorStyle[`d-${netWorkDataType}`],
|
|
71
70
|
netWorkErrorStyle[`d-${netWorkImageType}`],
|
|
72
71
|
`d-${netWorkDataType}`,
|
|
73
72
|
`d-${netWorkImageType}`,
|
|
74
73
|
'd-error-type',
|
|
75
74
|
)}
|
|
76
75
|
/>
|
|
77
76
|
<View
|
|
78
77
|
className={classNames(
|
|
79
78
|
netWorkErrorStyle['d-error-tip'],
|
|
80
79
|
netWorkErrorStyle[`d-${netWorkDataType}-tip`],
|
|
81
80
|
`d-${netWorkDataType}-tip`,
|
|
82
81
|
'd-error-tip',
|
|
83
82
|
)}
|
|
84
83
|
>
|
|
85
84
|
{useErrorTip}
|
|
86
85
|
</View>
|
|
87
86
|
{useErrorSubTip ? (
|
|
88
87
|
<View
|
|
89
88
|
className={classNames(
|
|
90
89
|
netWorkErrorStyle['d-error-sub-tip'],
|
|
91
90
|
netWorkErrorStyle[`d-${netWorkDataType}-sub-tip`],
|
|
92
91
|
`d-${netWorkDataType}-sub-tip`,
|
|
93
92
|
'd-error-sub-tip',
|
|
94
93
|
)}
|
|
95
94
|
>
|
|
96
95
|
{useErrorSubTip}
|
|
97
96
|
</View>
|
|
98
97
|
) : null}
|
|
99
98
|
<View className={'flexible-horizontal-center-box'}>
|
|
100
99
|
{refreshCallBackFn && (
|
|
101
100
|
<Button
|
|
102
101
|
onClick={refershInitData}
|
|
103
102
|
className={classNames(
|
|
104
103
|
netWorkErrorStyle['d-opt-btn'],
|
|
105
104
|
'd-button-no-border',
|
|
106
105
|
'd-opt-btn',
|
|
107
106
|
)}
|
|
108
107
|
plain
|
|
109
108
|
size="mini"
|
|
110
109
|
>
|
|
111
110
|
{btnLabel}
|
|
112
111
|
</Button>
|
|
113
112
|
)}
|
|
114
113
|
</View>
|
|
115
114
|
</View>
|
|
116
115
|
</View>
|
|
117
116
|
) : null;
|
|
117
|
+
import { Button, View } from '@tarojs/components';
|
|
118
118
|
NetWorkErrorList,
|
|
119
119
|
NetWorkErrorTip,
|
|
120
120
|
NetWorkErrorSubTip,
|
|
121
121
|
NetWorkShowType,
|
|
122
122
|
NetWork_Image_Type,
|
|
123
123
|
NetWorkStyleType,
|
|
124
124
|
netWorkDataDraType,
|
|
125
125
|
const {
|
|
126
126
|
className = '',
|
|
127
127
|
message = '',
|
|
128
128
|
subMessage = '',
|
|
129
129
|
btnLabel = global?.languageJsonData?.reload || '重新加载',
|
|
130
130
|
backgroundColorWhite = false,
|
|
131
131
|
netWorkDataType = NETWORK_DATA_TYPE.NORMAL,
|
|
132
132
|
netWorkShowType = NetWorkShowType.FULL,
|
|
133
133
|
netWorkImageType = NetWork_Image_Type.No_Data_Default_Tip,
|
|
134
134
|
netWorkStyleType = NetWorkStyleType.OLD,
|
|
135
135
|
refreshCallBackFn = null,
|
|
136
136
|
viewMaxHeight = '',
|
|
137
137
|
noPosition = false,
|
|
138
138
|
} = props;
|
|
139
139
|
const refershInitData = useCallback(() => {
|
|
140
140
|
refreshCallBackFn && refreshCallBackFn(true);
|
|
141
141
|
}, []);
|
|
142
142
|
const useErrorTip = message != '' ? message : NetWorkErrorTip[netWorkDataType];
|
|
143
143
|
const useErrorSubTip = subMessage
|
|
144
144
|
? subMessage
|
|
145
145
|
: message != ''
|
|
146
146
|
? ''
|
|
147
147
|
: NetWorkErrorSubTip[netWorkDataType];
|
|
148
148
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
|
|
149
149
|
const onePlusOneBottomPlaceHeight = global.info?.sysInfo?.onePlusOneBottomPlaceHeight
|
|
150
150
|
? global.info?.sysInfo?.onePlusOneBottomPlaceHeight + 20
|
|
151
151
|
: 0;
|
|
152
152
|
const maxHeight = latestRes.displayHeight || onePlusOneBottomPlaceHeight + 546;
|
|
153
153
|
useEffect(() => {
|
|
154
154
|
if (netWorkDataType && netWorkDataDraType[netWorkDataType]) {
|
|
155
155
|
draBusinessCustomReport({
|
|
156
156
|
eventName: 'business',
|
|
157
157
|
errorName: netWorkDataDraType[netWorkDataType],
|
|
158
158
|
errorMessage: '业务由于各类数据或者网络异常等走到兜底netWorkDataError组件,具体请看详细数据',
|
|
159
159
|
extraData: JSON.stringify({
|
|
160
160
|
message: useErrorTip,
|
|
161
161
|
subMessage: useErrorSubTip,
|
|
162
162
|
netWorkDataType,
|
|
163
163
|
netWorkImageType,
|
|
164
164
|
btnLabel,
|
|
165
165
|
}),
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}, [netWorkDataType])
|
|
169
169
|
return NetWorkErrorList.includes(netWorkDataType as NETWORK_DATA_TYPE) ? (
|
|
170
170
|
<View
|
|
171
171
|
style={{
|
|
172
172
|
maxHeight: viewMaxHeight !== '' ? viewMaxHeight : isMemberPage ? '100vh' : maxHeight,
|
|
173
173
|
}}
|
|
174
174
|
className={classNames(
|
|
175
175
|
netWorkErrorStyle['d-shop-network'],
|
|
176
176
|
{
|
|
177
177
|
[netWorkErrorStyle['d-shop-network-white']]: backgroundColorWhite,
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
[netWorkErrorStyle['d-shop-network-part']]: netWorkShowType === NetWorkShowType.PART,
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
183
|
[netWorkErrorStyle['d-network-jd-shop-view']]: isH5AndJdShopView,
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
[netWorkErrorStyle['d-shop-network-no-position']]: noPosition,
|
|
187
187
|
},
|
|
188
188
|
'flexible-center-box',
|
|
189
189
|
'J_shopNetwork',
|
|
190
190
|
className,
|
|
191
191
|
)}
|
|
192
192
|
>
|
|
193
193
|
<View
|
|
194
194
|
className={classNames(
|
|
195
195
|
netWorkErrorStyle['d-error-content'],
|
|
196
196
|
netWorkErrorStyle[`d-${netWorkStyleType}-style-content`],
|
|
197
197
|
'd-error-content',
|
|
198
198
|
)}
|
|
199
199
|
>
|
|
200
200
|
<View
|
|
201
201
|
className={classNames(
|
|
202
202
|
netWorkErrorStyle['d-error-type'],
|
|
203
203
|
netWorkErrorStyle[`d-${netWorkDataType}`],
|
|
204
204
|
netWorkErrorStyle[`d-${netWorkImageType}`],
|
|
205
205
|
`d-${netWorkDataType}`,
|
|
206
206
|
`d-${netWorkImageType}`,
|
|
207
207
|
'd-error-type',
|
|
208
208
|
)}
|
|
209
209
|
/>
|
|
210
210
|
<View
|
|
211
211
|
className={classNames(
|
|
212
212
|
netWorkErrorStyle['d-error-tip'],
|
|
213
213
|
netWorkErrorStyle[`d-${netWorkDataType}-tip`],
|
|
214
214
|
`d-${netWorkDataType}-tip`,
|
|
215
215
|
'd-error-tip',
|
|
216
216
|
)}
|
|
217
217
|
>
|
|
218
218
|
{useErrorTip}
|
|
219
219
|
</View>
|
|
220
220
|
{useErrorSubTip ? (
|
|
221
221
|
<View
|
|
222
222
|
className={classNames(
|
|
223
223
|
netWorkErrorStyle['d-error-sub-tip'],
|
|
224
224
|
netWorkErrorStyle[`d-${netWorkDataType}-sub-tip`],
|
|
225
225
|
`d-${netWorkDataType}-sub-tip`,
|
|
226
226
|
'd-error-sub-tip',
|
|
227
227
|
)}
|
|
228
228
|
>
|
|
229
229
|
{useErrorSubTip}
|
|
230
230
|
</View>
|
|
231
231
|
) : null}
|
|
232
232
|
<View className={'flexible-horizontal-center-box'}>
|
|
233
233
|
{refreshCallBackFn && (
|
|
234
234
|
<Button
|
|
235
235
|
onClick={refershInitData}
|
|
236
236
|
className={classNames(
|
|
237
237
|
netWorkErrorStyle['d-opt-btn'],
|
|
238
238
|
'd-button-no-border',
|
|
239
239
|
'd-opt-btn',
|
|
240
240
|
)}
|
|
241
241
|
plain
|
|
242
242
|
size="mini"
|
|
243
243
|
>
|
|
244
244
|
{btnLabel}
|
|
245
245
|
</Button>
|
|
246
246
|
)}
|
|
247
247
|
</View>
|
|
248
248
|
</View>
|
|
249
249
|
</View>
|
|
250
250
|
) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useEffect, useRef } 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
|
draBusinessCustomReport({
|
|
10
9
|
eventName: 'business',
|
|
11
10
|
errorName: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
|
|
12
11
|
errorMessage: '当前价格为科学计数数据,上报关注该价格',
|
|
13
12
|
extraData: JSON.stringify({
|
|
14
13
|
price: value,
|
|
15
14
|
originalPrice: initValue,
|
|
16
15
|
}),
|
|
17
16
|
});
|
|
18
17
|
}
|
|
19
18
|
if (!decToIntegerState) {
|
|
20
19
|
value = parseFloat(value).toFixed(decLength);
|
|
21
20
|
} else {
|
|
22
21
|
if (value.indexOf('.') !== -1) {
|
|
23
22
|
value = parseFloat(value).toFixed(decLength);
|
|
24
23
|
value = `${value}`.replace(/0+$/, '');
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
if (value === 'NaN') {
|
|
28
27
|
draBusinessCustomReport({
|
|
29
28
|
eventName: 'business',
|
|
30
29
|
errorName: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
|
|
31
30
|
errorMessage: '价格转换异常,兜底展示暂无报价',
|
|
32
31
|
extraData: JSON.stringify({
|
|
33
32
|
price: value,
|
|
34
33
|
originalPrice: initValue,
|
|
35
34
|
}),
|
|
36
35
|
});
|
|
37
36
|
value = '暂无报价';
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
const [intVal, decimalVal] = `${value}`.split('.');
|
|
41
40
|
return {
|
|
42
41
|
currencySymbol: !cnPriceTextList.includes(intVal) ? symbol : '',
|
|
43
42
|
intVal,
|
|
44
43
|
decimalVal,
|
|
45
44
|
};
|
|
46
45
|
const {
|
|
47
46
|
prefixCls,
|
|
48
47
|
symPos,
|
|
49
48
|
symbol,
|
|
50
49
|
decPos,
|
|
51
50
|
status,
|
|
52
51
|
className,
|
|
53
52
|
style,
|
|
54
53
|
symClassName,
|
|
55
54
|
intClassName,
|
|
56
55
|
decClassName,
|
|
57
56
|
noPriceClassName,
|
|
58
57
|
value,
|
|
59
58
|
decLength,
|
|
60
59
|
decToIntegerState,
|
|
61
60
|
isPlusPrice,
|
|
62
61
|
isSamsPrice,
|
|
63
62
|
isMemberPrice,
|
|
64
63
|
isSfpPrice,
|
|
65
64
|
memberPriceIcon,
|
|
66
65
|
isShowPriceLabel,
|
|
67
66
|
priceLabelText,
|
|
68
67
|
priceTextColor,
|
|
69
68
|
useFontV2 = false,
|
|
70
69
|
useFontV2Bold = false,
|
|
71
70
|
nativeProps,
|
|
72
71
|
} = props;
|
|
73
72
|
const cRef = useRef<any>(null);
|
|
74
73
|
useEffect(() => {
|
|
75
74
|
if (isShowPriceLabel && priceTextColor && cRef.current) {
|
|
76
75
|
cRef.current?.style?.setProperty('--after-ele-color', priceTextColor);
|
|
77
76
|
}
|
|
78
77
|
}, [isShowPriceLabel, priceTextColor]);
|
|
79
78
|
const cls = classNames(
|
|
80
79
|
className ? `${className}` : '',
|
|
81
80
|
prefixCls,
|
|
82
81
|
{
|
|
83
82
|
'd-font-v2': useFontV2,
|
|
84
83
|
'd-font-v2-bold': useFontV2Bold,
|
|
85
84
|
},
|
|
86
85
|
'd-imag-rendering-crisp-edges',
|
|
87
86
|
{
|
|
88
87
|
del: status === 'del',
|
|
89
88
|
},
|
|
90
89
|
{
|
|
91
90
|
'd-plus-price': isPlusPrice,
|
|
92
91
|
},
|
|
93
92
|
{
|
|
94
93
|
'd-sams-price': isSamsPrice,
|
|
95
94
|
},
|
|
96
95
|
{
|
|
97
96
|
'd-sfp-price': isSfpPrice,
|
|
98
97
|
},
|
|
99
98
|
{
|
|
100
99
|
'd-member-price': isMemberPrice,
|
|
101
100
|
},
|
|
102
101
|
{
|
|
103
102
|
[`d-member-price-${memberPriceIcon}`]: memberPriceIcon,
|
|
104
103
|
},
|
|
105
104
|
{
|
|
106
105
|
'd-price-label': isShowPriceLabel,
|
|
107
106
|
},
|
|
108
107
|
{
|
|
109
108
|
'd-price-text-clor': isShowPriceLabel && priceTextColor,
|
|
110
109
|
},
|
|
111
110
|
);
|
|
112
111
|
const symCls = classNames(symClassName ? `${symClassName}` : '', {
|
|
113
112
|
'sym-sub': symPos === 'sub',
|
|
114
113
|
'sym-sup': symPos === 'sup',
|
|
115
114
|
});
|
|
116
115
|
const intCls = classNames(intClassName ? `${intClassName}` : '');
|
|
117
116
|
const decCls = classNames(decClassName ? `${decClassName}` : '', {
|
|
118
117
|
'dec-sub': decPos === 'sub',
|
|
119
118
|
'dec-sup': decPos === 'sup',
|
|
120
119
|
});
|
|
121
120
|
const noPriceCls = classNames(noPriceClassName ? `${noPriceClassName}` : '');
|
|
122
121
|
const { currencySymbol, intVal, decimalVal } = dealPrice(
|
|
123
122
|
value,
|
|
124
123
|
decLength,
|
|
125
124
|
symbol,
|
|
126
125
|
decToIntegerState,
|
|
127
126
|
);
|
|
128
127
|
return (
|
|
129
128
|
<View
|
|
130
129
|
ref={cRef}
|
|
131
130
|
className={cls}
|
|
132
131
|
style={style}
|
|
133
132
|
data-after={isShowPriceLabel ? priceLabelText : ''}
|
|
134
133
|
{...nativeProps}
|
|
135
134
|
>
|
|
136
135
|
{intVal === '-1' ? (
|
|
137
136
|
<Text className={`${prefixCls}-txt int-txt off-shelf ${noPriceCls}`}>{`暂无报价`}</Text>
|
|
138
137
|
) : (
|
|
139
138
|
<>
|
|
140
139
|
<Text className={`${prefixCls}-sym ${symCls}`}>{currencySymbol}</Text>
|
|
141
140
|
<Text className={`${prefixCls}-txt int-txt ${intCls}`}>{intVal}</Text>
|
|
142
141
|
{!!decimalVal && (
|
|
143
142
|
<Text className={`${prefixCls}-txt dec-txt ${decCls}`}>.{decimalVal}</Text>
|
|
144
143
|
)}
|
|
145
144
|
</>
|
|
146
145
|
)}
|
|
147
146
|
</View>
|
|
148
147
|
);
|
|
149
148
|
prefixCls: 'd-mini-price',
|
|
150
149
|
style: {},
|
|
151
150
|
status: '',
|
|
152
151
|
symbol: '¥',
|
|
153
152
|
symPos: 'sub',
|
|
154
153
|
decLength: 2,
|
|
155
154
|
decPos: 'sub',
|
|
156
155
|
decToIntegerState: false,
|
|
157
156
|
isPlusPrice: false,
|
|
158
157
|
isShowPriceLabel: false,
|
|
159
158
|
priceLabelText: '到手价',
|
|
160
159
|
priceTextColor: '',
|
|
161
160
|
useFontV2: false,
|
|
162
161
|
useFontV2Bold: false,
|
|
162
|
+
import React, { useEffect, useRef } from 'react';
|
|
163
163
|
let value = `${initValue}`;
|
|
164
164
|
if (!cnPriceTextList.includes(value)) {
|
|
165
165
|
if (value && !/^[0123456789-]*$/.test(value.substring(0, 1))) {
|
|
166
166
|
symbol = value.substring(0, 1);
|
|
167
167
|
value = value.substring(1);
|
|
168
168
|
}
|
|
169
169
|
if (/^\d+(\.\d+)?[eE][+-]?\d+$/.test(value)) {
|
|
170
170
|
draBusinessCustomReport({
|
|
171
171
|
eventName: 'business',
|
|
172
172
|
errorName: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
|
|
173
173
|
errorMessage: '当前价格为科学计数数据,上报关注该价格',
|
|
174
174
|
extraData: JSON.stringify({
|
|
175
175
|
price: value,
|
|
176
176
|
originalPrice: initValue,
|
|
177
177
|
}),
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
if (!decToIntegerState) {
|
|
181
181
|
value = parseFloat(value).toFixed(decLength);
|
|
182
182
|
} else {
|
|
183
183
|
if (value.indexOf('.') !== -1) {
|
|
184
184
|
value = parseFloat(value).toFixed(decLength);
|
|
185
185
|
value = `${value}`.replace(/0+$/, '');
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
if (value === 'NaN') {
|
|
189
189
|
draBusinessCustomReport({
|
|
190
190
|
eventName: 'business',
|
|
191
191
|
errorName: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
|
|
192
192
|
errorMessage: '价格转换异常,兜底展示暂无报价',
|
|
193
193
|
extraData: JSON.stringify({
|
|
194
194
|
price: value,
|
|
195
195
|
originalPrice: initValue,
|
|
196
196
|
}),
|
|
197
197
|
});
|
|
198
198
|
value = '暂无报价';
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
const [intVal, decimalVal] = `${value}`.split('.');
|
|
202
202
|
return {
|
|
203
203
|
currencySymbol: !cnPriceTextList.includes(intVal) ? symbol : '',
|
|
204
204
|
intVal,
|
|
205
205
|
decimalVal,
|
|
206
206
|
};
|
|
207
207
|
const {
|
|
208
208
|
prefixCls,
|
|
209
209
|
symPos,
|
|
210
210
|
symbol,
|
|
211
211
|
decPos,
|
|
212
212
|
status,
|
|
213
213
|
className,
|
|
214
214
|
style,
|
|
215
215
|
symClassName,
|
|
216
216
|
intClassName,
|
|
217
217
|
decClassName,
|
|
218
218
|
noPriceClassName,
|
|
219
219
|
value,
|
|
220
220
|
decLength,
|
|
221
221
|
decToIntegerState,
|
|
222
222
|
isPlusPrice,
|
|
223
223
|
isSamsPrice,
|
|
224
224
|
isMemberPrice,
|
|
225
225
|
isSfpPrice,
|
|
226
226
|
memberPriceIcon,
|
|
227
227
|
isShowPriceLabel,
|
|
228
228
|
priceLabelText,
|
|
229
229
|
priceTextColor,
|
|
230
230
|
useFontV2 = false,
|
|
231
231
|
useFontV2Bold = false,
|
|
232
232
|
renderPriceNumber,
|
|
233
233
|
couponDiscountUpAmount,
|
|
234
234
|
nativeProps,
|
|
235
235
|
} = props;
|
|
236
236
|
const cRef = useRef<any>(null);
|
|
237
237
|
useEffect(() => {
|
|
238
238
|
if (isShowPriceLabel && priceTextColor && cRef.current) {
|
|
239
239
|
cRef.current?.style?.setProperty('--after-ele-color', priceTextColor);
|
|
240
240
|
}
|
|
241
241
|
}, [isShowPriceLabel, priceTextColor]);
|
|
242
242
|
const cls = classNames(
|
|
243
243
|
className ? `${className}` : '',
|
|
244
244
|
prefixCls,
|
|
245
245
|
{
|
|
246
246
|
'd-font-v2': useFontV2,
|
|
247
247
|
'd-font-v2-bold': useFontV2Bold,
|
|
248
248
|
},
|
|
249
249
|
'd-imag-rendering-crisp-edges',
|
|
250
250
|
{
|
|
251
251
|
del: status === 'del',
|
|
252
252
|
},
|
|
253
253
|
{
|
|
254
254
|
'd-plus-price': isPlusPrice,
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
'd-sams-price': isSamsPrice,
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
'd-sfp-price': isSfpPrice,
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
263
|
'd-member-price': isMemberPrice,
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
[`d-member-price-${memberPriceIcon}`]: memberPriceIcon,
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
'd-price-label': isShowPriceLabel,
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
'd-price-text-clor': isShowPriceLabel && priceTextColor,
|
|
273
273
|
},
|
|
274
274
|
);
|
|
275
275
|
const symCls = classNames(symClassName ? `${symClassName}` : '', {
|
|
276
276
|
'sym-sub': symPos === 'sub',
|
|
277
277
|
'sym-sup': symPos === 'sup',
|
|
278
278
|
});
|
|
279
279
|
const intCls = classNames(intClassName ? `${intClassName}` : '');
|
|
280
280
|
const decCls = classNames(decClassName ? `${decClassName}` : '', {
|
|
281
281
|
'dec-sub': decPos === 'sub',
|
|
282
282
|
'dec-sup': decPos === 'sup',
|
|
283
283
|
});
|
|
284
284
|
const noPriceCls = classNames(noPriceClassName ? `${noPriceClassName}` : '');
|
|
285
285
|
const { currencySymbol, intVal, decimalVal } = dealPrice(
|
|
286
286
|
value,
|
|
287
287
|
decLength,
|
|
288
288
|
symbol,
|
|
289
289
|
decToIntegerState,
|
|
290
290
|
);
|
|
291
291
|
const TextRender = renderPriceNumber ? renderPriceNumber : Text;
|
|
292
292
|
return (
|
|
293
293
|
<View
|
|
294
294
|
ref={cRef}
|
|
295
295
|
className={cls}
|
|
296
296
|
style={style}
|
|
297
297
|
data-after={isShowPriceLabel ? priceLabelText : ''}
|
|
298
298
|
{...nativeProps}
|
|
299
299
|
>
|
|
300
300
|
{intVal === '-1' ? (
|
|
301
301
|
<Text className={`${prefixCls}-txt int-txt off-shelf ${noPriceCls}`}>{`暂无报价`}</Text>
|
|
302
302
|
) : (
|
|
303
303
|
<>
|
|
304
304
|
<Text className={`${prefixCls}-sym ${symCls}`}>{currencySymbol}</Text>
|
|
305
305
|
<TextRender className={`${prefixCls}-txt int-txt ${intCls}`} couponDiscountUpAmount={couponDiscountUpAmount}>{intVal}</TextRender>
|
|
306
306
|
{!!decimalVal && (
|
|
307
307
|
<TextRender className={`${prefixCls}-txt dec-txt ${decCls}`} couponDiscountUpAmount={couponDiscountUpAmount}>.{decimalVal}</TextRender>
|
|
308
308
|
)}
|
|
309
309
|
</>
|
|
310
310
|
)}
|
|
311
311
|
</View>
|
|
312
312
|
);
|
|
313
313
|
prefixCls: 'd-mini-price',
|
|
314
314
|
style: {},
|
|
315
315
|
status: '',
|
|
316
316
|
symbol: '¥',
|
|
317
317
|
symPos: 'sub',
|
|
318
318
|
decLength: 2,
|
|
319
319
|
decPos: 'sub',
|
|
320
320
|
decToIntegerState: false,
|
|
321
321
|
isPlusPrice: false,
|
|
322
322
|
isShowPriceLabel: false,
|
|
323
323
|
priceLabelText: '到手价',
|
|
324
324
|
priceTextColor: '',
|
|
325
325
|
useFontV2: false,
|
|
326
326
|
useFontV2Bold: false,
|