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