@conecli/cone-render 0.10.1-shop-beta.18 → 0.10.1-shop-beta.20
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/common/index.h5.ts +1 -1
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +2 -2
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.dynamic.tsx +1 -1
- package/dist/components/base/Price/Base/index.module.scss +6 -0
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.dynamic.tsx +1 -1
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/language/en_US.json +176 -0
- package/dist/language/zh_CN.json +15 -1
- package/dist/language/zh_HK.json +176 -0
- package/dist/utils/h5Utils.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]: '网络连接已断开',
|
|
3
2
|
[NETWORK_DATA_TYPE.DATA_ERROR]: '数据加载失败',
|
|
4
3
|
[NETWORK_DATA_TYPE.NO_DATA]: '你访问的内容飞到太空了',
|
|
5
4
|
[NETWORK_DATA_TYPE.RISK]: '活动太火爆',
|
|
6
5
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: '请检查您的网络设置',
|
|
7
6
|
[NETWORK_DATA_TYPE.DATA_ERROR]: '请稍后重试',
|
|
8
7
|
[NETWORK_DATA_TYPE.NO_DATA]: '',
|
|
9
8
|
[NETWORK_DATA_TYPE.RISK]: '页面加载失败,请稍后再试',
|
|
10
9
|
NETWORK_DATA_TYPE.NO_NET_WORK,
|
|
11
10
|
NETWORK_DATA_TYPE.DATA_ERROR,
|
|
12
11
|
NETWORK_DATA_TYPE.NO_DATA,
|
|
13
12
|
NETWORK_DATA_TYPE.RISK,
|
|
14
13
|
PART: 'part',
|
|
15
14
|
FULL: 'full',
|
|
16
15
|
No_Data_Default_Tip: 'no-data-default-tip',
|
|
17
16
|
No_Data_Tip_1: 'no-data-tip-1',
|
|
18
17
|
No_Data_Tip_2: 'no-data-tip-2',
|
|
19
18
|
No_Network_Err_Tip: 'no-network',
|
|
20
19
|
No_Data_Bmall: 'no-data-bmall',
|
|
21
20
|
noData: 'no-data-empty',
|
|
22
21
|
netWorkErr: 'network-err',
|
|
23
22
|
searchEmpty: 'search-empty',
|
|
24
23
|
shopClose: 'shop-close',
|
|
25
24
|
OLD: 'old',
|
|
26
25
|
NEW: 'new',
|
|
26
|
+
import { NETWORK_DATA_TYPE } from '../../../common/const';
|
|
27
27
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.loseNetwork || '网络连接已断开',
|
|
28
28
|
[NETWORK_DATA_TYPE.DATA_ERROR]: global?.languageJsonData?.loadDataFailed || '数据加载失败',
|
|
29
29
|
[NETWORK_DATA_TYPE.NO_DATA]:
|
|
30
30
|
global?.languageJsonData?.contentUnavailable || '你访问的内容飞到太空了',
|
|
31
31
|
[NETWORK_DATA_TYPE.RISK]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
32
32
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.checkNetwork || '请检查您的网络设置',
|
|
33
33
|
[NETWORK_DATA_TYPE.DATA_ERROR]: global?.languageJsonData?.pleaseTryAgainLater || '请稍后重试',
|
|
34
34
|
[NETWORK_DATA_TYPE.NO_DATA]: '',
|
|
35
35
|
[NETWORK_DATA_TYPE.RISK]: global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
36
36
|
NETWORK_DATA_TYPE.NO_NET_WORK,
|
|
37
37
|
NETWORK_DATA_TYPE.DATA_ERROR,
|
|
38
38
|
NETWORK_DATA_TYPE.NO_DATA,
|
|
39
39
|
NETWORK_DATA_TYPE.RISK,
|
|
40
40
|
PART: 'part',
|
|
41
41
|
FULL: 'full',
|
|
42
42
|
No_Data_Default_Tip: 'no-data-default-tip',
|
|
43
43
|
No_Data_Tip_1: 'no-data-tip-1',
|
|
44
44
|
No_Data_Tip_2: 'no-data-tip-2',
|
|
45
45
|
No_Network_Err_Tip: 'no-network',
|
|
46
46
|
No_Data_Bmall: 'no-data-bmall',
|
|
47
47
|
noData: 'no-data-empty',
|
|
48
48
|
netWorkErr: 'network-err',
|
|
49
49
|
searchEmpty: 'search-empty',
|
|
50
50
|
shopClose: 'shop-close',
|
|
51
51
|
OLD: 'old',
|
|
52
52
|
NEW: 'new',
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
font-size: 28px;
|
|
65
65
|
font-weight: bold;
|
|
66
66
|
line-height: 28px;
|
|
67
|
-
color: #
|
|
67
|
+
color: #1a1a1a;
|
|
68
68
|
}
|
|
69
69
|
.d-error-sub-tip {
|
|
70
70
|
margin-top: 16px;
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
background-image: url('https://m.360buyimg.com/imagetools/jfs/t1/106708/34/36128/37234/64896f52Fed1530e0/7b403e068aae316c.png');
|
|
90
90
|
}
|
|
91
91
|
.d-risk {
|
|
92
|
-
background-image: url('https://
|
|
92
|
+
background-image: url('https://img11.360buyimg.com/imagetools/jfs/t1/256437/5/21857/22576/67b438adFed8a2665/7df7277fec7e3e8e.png');
|
|
93
93
|
}
|
|
94
94
|
.d-no-data {
|
|
95
95
|
background-image: url('https://img11.360buyimg.com/imagetools/jfs/t1/190994/19/325/42717/6088fed0Ec4b502d5/0e8de7593fb0d06c.png');
|
|
@@ -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 = '重新加载',
|
|
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 ? subMessage : NetWorkErrorSubTip[netWorkDataType];
|
|
27
26
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
|
|
28
27
|
const maxHeight = latestRes.displayHeight || 546;
|
|
29
28
|
return NetWorkErrorList.includes(netWorkDataType as NETWORK_DATA_TYPE) ? (
|
|
30
29
|
<View
|
|
31
30
|
style={{
|
|
32
31
|
maxHeight: viewMaxHeight !== '' ? viewMaxHeight : isMemberPage ? '100vh' : maxHeight,
|
|
33
32
|
}}
|
|
34
33
|
className={classNames(
|
|
35
34
|
netWorkErrorStyle['d-shop-network'],
|
|
36
35
|
{
|
|
37
36
|
[netWorkErrorStyle['d-shop-network-white']]: backgroundColorWhite,
|
|
38
37
|
},
|
|
39
38
|
{
|
|
40
39
|
[netWorkErrorStyle['d-shop-network-part']]: netWorkShowType === NetWorkShowType.PART,
|
|
41
40
|
},
|
|
42
41
|
{
|
|
43
42
|
[netWorkErrorStyle['d-network-jd-shop-view']]: isH5AndJdShopView,
|
|
44
43
|
},
|
|
45
44
|
{
|
|
46
45
|
[netWorkErrorStyle['d-shop-network-no-position']]: noPosition,
|
|
47
46
|
},
|
|
48
47
|
'flexible-center-box',
|
|
49
48
|
className,
|
|
50
49
|
)}
|
|
51
50
|
>
|
|
52
51
|
<View
|
|
53
52
|
className={classNames(
|
|
54
53
|
netWorkErrorStyle['d-error-content'],
|
|
55
54
|
netWorkErrorStyle[`d-${netWorkStyleType}-style-content`],
|
|
56
55
|
'd-error-content',
|
|
57
56
|
)}
|
|
58
57
|
>
|
|
59
58
|
<View
|
|
60
59
|
className={classNames(
|
|
61
60
|
netWorkErrorStyle['d-error-type'],
|
|
62
61
|
netWorkErrorStyle[`d-${netWorkDataType}`],
|
|
63
62
|
netWorkErrorStyle[`d-${netWorkImageType}`],
|
|
64
63
|
'd-error-type',
|
|
65
64
|
)}
|
|
66
65
|
/>
|
|
67
66
|
<View
|
|
68
67
|
className={classNames(
|
|
69
68
|
netWorkErrorStyle['d-error-tip'],
|
|
70
69
|
netWorkErrorStyle[`d-${netWorkDataType}-tip`],
|
|
71
70
|
'd-error-tip',
|
|
72
71
|
)}
|
|
73
72
|
>
|
|
74
73
|
{useErrorTip}
|
|
75
74
|
</View>
|
|
76
75
|
{useErrorSubTip ? (
|
|
77
76
|
<View
|
|
78
77
|
className={classNames(
|
|
79
78
|
netWorkErrorStyle['d-error-sub-tip'],
|
|
80
79
|
netWorkErrorStyle[`d-${netWorkDataType}-sub-tip`],
|
|
81
80
|
'd-error-sub-tip',
|
|
82
81
|
)}
|
|
83
82
|
>
|
|
84
83
|
{useErrorSubTip}
|
|
85
84
|
</View>
|
|
86
85
|
) : null}
|
|
87
86
|
<View className={'flexible-horizontal-center-box'}>
|
|
88
87
|
{refreshCallBackFn && (
|
|
89
88
|
<Button
|
|
90
89
|
onClick={refershInitData}
|
|
91
90
|
className={classNames(
|
|
92
91
|
netWorkErrorStyle['d-opt-btn'],
|
|
93
92
|
'd-button-no-border',
|
|
94
93
|
'd-opt-btn',
|
|
95
94
|
)}
|
|
96
95
|
plain
|
|
97
96
|
size="mini"
|
|
98
97
|
>
|
|
99
98
|
{btnLabel}
|
|
100
99
|
</Button>
|
|
101
100
|
)}
|
|
102
101
|
</View>
|
|
103
102
|
</View>
|
|
104
103
|
</View>
|
|
105
104
|
) : null;
|
|
105
|
+
import { Button, View } from '@tarojs/components';
|
|
106
106
|
NetWorkErrorList,
|
|
107
107
|
NetWorkErrorTip,
|
|
108
108
|
NetWorkErrorSubTip,
|
|
109
109
|
NetWorkShowType,
|
|
110
110
|
NetWork_Image_Type,
|
|
111
111
|
NetWorkStyleType,
|
|
112
112
|
const {
|
|
113
113
|
className = '',
|
|
114
114
|
message = '',
|
|
115
115
|
subMessage = '',
|
|
116
116
|
btnLabel = global?.languageJsonData?.reload || '重新加载',
|
|
117
117
|
backgroundColorWhite = false,
|
|
118
118
|
netWorkDataType = NETWORK_DATA_TYPE.NORMAL,
|
|
119
119
|
netWorkShowType = NetWorkShowType.FULL,
|
|
120
120
|
netWorkImageType = NetWork_Image_Type.No_Data_Default_Tip,
|
|
121
121
|
netWorkStyleType = NetWorkStyleType.OLD,
|
|
122
122
|
refreshCallBackFn = null,
|
|
123
123
|
viewMaxHeight = '',
|
|
124
124
|
noPosition = false,
|
|
125
125
|
} = props;
|
|
126
126
|
const refershInitData = useCallback(() => {
|
|
127
127
|
refreshCallBackFn && refreshCallBackFn(true);
|
|
128
128
|
}, []);
|
|
129
129
|
const useErrorTip = message != '' ? message : NetWorkErrorTip[netWorkDataType];
|
|
130
130
|
const useErrorSubTip = subMessage ? subMessage : NetWorkErrorSubTip[netWorkDataType];
|
|
131
131
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
|
|
132
132
|
const maxHeight = latestRes.displayHeight || 546;
|
|
133
133
|
return NetWorkErrorList.includes(netWorkDataType as NETWORK_DATA_TYPE) ? (
|
|
134
134
|
<View
|
|
135
135
|
style={{
|
|
136
136
|
maxHeight: viewMaxHeight !== '' ? viewMaxHeight : isMemberPage ? '100vh' : maxHeight,
|
|
137
137
|
}}
|
|
138
138
|
className={classNames(
|
|
139
139
|
netWorkErrorStyle['d-shop-network'],
|
|
140
140
|
{
|
|
141
141
|
[netWorkErrorStyle['d-shop-network-white']]: backgroundColorWhite,
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
[netWorkErrorStyle['d-shop-network-part']]: netWorkShowType === NetWorkShowType.PART,
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
[netWorkErrorStyle['d-network-jd-shop-view']]: isH5AndJdShopView,
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
[netWorkErrorStyle['d-shop-network-no-position']]: noPosition,
|
|
151
151
|
},
|
|
152
152
|
'flexible-center-box',
|
|
153
153
|
className,
|
|
154
154
|
)}
|
|
155
155
|
>
|
|
156
156
|
<View
|
|
157
157
|
className={classNames(
|
|
158
158
|
netWorkErrorStyle['d-error-content'],
|
|
159
159
|
netWorkErrorStyle[`d-${netWorkStyleType}-style-content`],
|
|
160
160
|
'd-error-content',
|
|
161
161
|
)}
|
|
162
162
|
>
|
|
163
163
|
<View
|
|
164
164
|
className={classNames(
|
|
165
165
|
netWorkErrorStyle['d-error-type'],
|
|
166
166
|
netWorkErrorStyle[`d-${netWorkDataType}`],
|
|
167
167
|
netWorkErrorStyle[`d-${netWorkImageType}`],
|
|
168
168
|
'd-error-type',
|
|
169
169
|
)}
|
|
170
170
|
/>
|
|
171
171
|
<View
|
|
172
172
|
className={classNames(
|
|
173
173
|
netWorkErrorStyle['d-error-tip'],
|
|
174
174
|
netWorkErrorStyle[`d-${netWorkDataType}-tip`],
|
|
175
175
|
'd-error-tip',
|
|
176
176
|
)}
|
|
177
177
|
>
|
|
178
178
|
{useErrorTip}
|
|
179
179
|
</View>
|
|
180
180
|
{useErrorSubTip ? (
|
|
181
181
|
<View
|
|
182
182
|
className={classNames(
|
|
183
183
|
netWorkErrorStyle['d-error-sub-tip'],
|
|
184
184
|
netWorkErrorStyle[`d-${netWorkDataType}-sub-tip`],
|
|
185
185
|
'd-error-sub-tip',
|
|
186
186
|
)}
|
|
187
187
|
>
|
|
188
188
|
{useErrorSubTip}
|
|
189
189
|
</View>
|
|
190
190
|
) : null}
|
|
191
191
|
<View className={'flexible-horizontal-center-box'}>
|
|
192
192
|
{refreshCallBackFn && (
|
|
193
193
|
<Button
|
|
194
194
|
onClick={refershInitData}
|
|
195
195
|
className={classNames(
|
|
196
196
|
netWorkErrorStyle['d-opt-btn'],
|
|
197
197
|
'd-button-no-border',
|
|
198
198
|
'd-opt-btn',
|
|
199
199
|
)}
|
|
200
200
|
plain
|
|
201
201
|
size="mini"
|
|
202
202
|
>
|
|
203
203
|
{btnLabel}
|
|
204
204
|
</Button>
|
|
205
205
|
)}
|
|
206
206
|
</View>
|
|
207
207
|
</View>
|
|
208
208
|
</View>
|
|
209
209
|
) : null;
|
|
@@ -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,
|