pb-sxp-ui 1.4.4 → 1.5.0
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/index.cjs +163 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +163 -125
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +163 -125
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/WaterFall/List.js +7 -15
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +7 -15
- package/es/core/components/SxpPageRender/index.d.ts +6 -0
- package/es/core/components/SxpPageRender/index.js +2 -0
- package/es/core/context/SxpDataSourceProvider.js +2 -0
- package/es/core/utils/materials.d.ts +7 -0
- package/es/core/utils/materials.js +47 -0
- package/es/materials/sxp/HashTag/settingRender.d.ts +5 -0
- package/es/materials/sxp/HashTag/settingRender.js +2 -1
- package/es/materials/sxp/cta/AniLink/interactionRender.d.ts +1 -0
- package/es/materials/sxp/cta/AniLink/interactionRender.js +2 -1
- package/es/materials/sxp/cta/AniLinkPopup/interactionRender.d.ts +1 -0
- package/es/materials/sxp/cta/AniLinkPopup/interactionRender.js +2 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +7 -15
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +7 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +2 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +7 -15
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +6 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +2 -1
- package/es/materials/sxp/popup/CommodityList/index.js +9 -15
- package/es/materials/sxp/popup/CommodityList/settingRender.d.ts +5 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +2 -1
- package/es/materials/sxp/template/Appoint/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/Appoint/interactionRender.js +2 -1
- package/es/materials/sxp/template/Commodity/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/Commodity/interactionRender.js +2 -1
- package/es/materials/sxp/template/CommodityDiro/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/CommodityDiro/interactionRender.js +2 -1
- package/es/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/CommodityDiroNew/interactionRender.js +2 -1
- package/es/materials/sxp/template/Link/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/Link/interactionRender.js +2 -1
- package/es/materials/sxp/template/Link/material.js +1 -1
- package/es/materials/sxp/template/MultiCommodity/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/MultiCommodity/interactionRender.js +2 -1
- package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.js +2 -1
- package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +1 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +2 -1
- package/lib/core/components/SxpPageRender/WaterFall/List.js +7 -15
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +7 -15
- package/lib/core/components/SxpPageRender/index.d.ts +6 -0
- package/lib/core/components/SxpPageRender/index.js +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +2 -0
- package/lib/core/utils/materials.d.ts +7 -0
- package/lib/core/utils/materials.js +49 -1
- package/lib/materials/sxp/HashTag/settingRender.d.ts +5 -0
- package/lib/materials/sxp/HashTag/settingRender.js +2 -1
- package/lib/materials/sxp/cta/AniLink/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/cta/AniLink/interactionRender.js +2 -1
- package/lib/materials/sxp/cta/AniLinkPopup/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/cta/AniLinkPopup/interactionRender.js +2 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +7 -15
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +7 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +2 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +7 -15
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +6 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +2 -1
- package/lib/materials/sxp/popup/CommodityList/index.js +9 -15
- package/lib/materials/sxp/popup/CommodityList/settingRender.d.ts +5 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +2 -1
- package/lib/materials/sxp/template/Appoint/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/Appoint/interactionRender.js +2 -1
- package/lib/materials/sxp/template/Commodity/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/Commodity/interactionRender.js +2 -1
- package/lib/materials/sxp/template/CommodityDiro/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/CommodityDiro/interactionRender.js +2 -1
- package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.js +2 -1
- package/lib/materials/sxp/template/Link/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/Link/interactionRender.js +2 -1
- package/lib/materials/sxp/template/Link/material.js +1 -1
- package/lib/materials/sxp/template/MultiCommodity/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/MultiCommodity/interactionRender.js +2 -1
- package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.js +2 -1
- package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +1 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +2 -1
- package/package.json +1 -1
@@ -7,10 +7,11 @@ import { useSxpDataSource } from '../../../../core/hooks';
|
|
7
7
|
import { css } from '@emotion/css';
|
8
8
|
import { setFontForText } from '../../../../core/utils/tool';
|
9
9
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
10
|
+
import { getPriceText } from '../../../../core/utils/materials';
|
10
11
|
const WaterfallFlowItem = (props) => {
|
11
12
|
var _a;
|
12
13
|
const { rec, index, list, reportTagsView, textStyles, space } = props;
|
13
|
-
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
|
14
|
+
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = useSxpDataSource();
|
14
15
|
const [showVideo, setShowVideo] = useState(false);
|
15
16
|
const imgDom = useRef(null);
|
16
17
|
const ref = useRef(null);
|
@@ -36,20 +37,11 @@ const WaterfallFlowItem = (props) => {
|
|
36
37
|
var _a, _b;
|
37
38
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
|
38
39
|
}, [rec]);
|
39
|
-
const priceText =
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
? (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k.toLocaleString('zh', {
|
45
|
-
minimumFractionDigits: 0
|
46
|
-
})) !== null && _l !== void 0 ? _l : ''
|
47
|
-
: (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
return null;
|
51
|
-
}
|
52
|
-
}, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
|
40
|
+
const priceText = getPriceText({
|
41
|
+
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
42
|
+
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
43
|
+
globalConfig
|
44
|
+
});
|
53
45
|
useEffect(() => {
|
54
46
|
const observer = new IntersectionObserver((entries) => {
|
55
47
|
entries.forEach((entry) => {
|
@@ -7,10 +7,11 @@ import FormatImage from '../FormatImage';
|
|
7
7
|
import { css } from '@emotion/css';
|
8
8
|
import { setFontForText } from '../../../../core/utils/tool';
|
9
9
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
10
|
+
import { getPriceText } from '../../../../core/utils/materials';
|
10
11
|
const WaterfallFlowItem = (props) => {
|
11
12
|
var _a;
|
12
13
|
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
13
|
-
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
|
14
|
+
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = useSxpDataSource();
|
14
15
|
const [showVideo, setShowVideo] = useState(false);
|
15
16
|
const [isLoading, setIsLoading] = useState(false);
|
16
17
|
const [imgInfo, setImgInfo] = useState({
|
@@ -59,20 +60,11 @@ const WaterfallFlowItem = (props) => {
|
|
59
60
|
return false;
|
60
61
|
}
|
61
62
|
}, [top, showBorder]);
|
62
|
-
const priceText =
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
? (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k.toLocaleString('zh', {
|
68
|
-
minimumFractionDigits: 0
|
69
|
-
})) !== null && _l !== void 0 ? _l : ''
|
70
|
-
: (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
return null;
|
74
|
-
}
|
75
|
-
}, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
|
63
|
+
const priceText = getPriceText({
|
64
|
+
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
65
|
+
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
66
|
+
globalConfig
|
67
|
+
});
|
76
68
|
useEffect(() => {
|
77
69
|
if (imgDom.current === null || src === '') {
|
78
70
|
return;
|
@@ -51,6 +51,12 @@ export interface ISxpPageRenderProps {
|
|
51
51
|
enableSwiperTip?: boolean;
|
52
52
|
logoBar?: any;
|
53
53
|
textUnderlineOffset?: number;
|
54
|
+
priceSymbol?: {
|
55
|
+
millesimalSymbol?: string;
|
56
|
+
decimalPoint?: string;
|
57
|
+
currencyPosition?: string;
|
58
|
+
showTwoDecimalPoint?: boolean;
|
59
|
+
};
|
54
60
|
};
|
55
61
|
descStyle?: CSSProperties;
|
56
62
|
tipText?: {
|
@@ -192,6 +192,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
192
192
|
return null;
|
193
193
|
}
|
194
194
|
});
|
195
|
+
if (!(list === null || list === void 0 ? void 0 : list.length))
|
196
|
+
return [];
|
195
197
|
return !waterFallData && !isNoMoreData ? list.concat([{ loading: true }]) : list;
|
196
198
|
}, [data, activeIndex, waterFallData, isEditor, isNoMoreData]);
|
197
199
|
const renderLogo = useMemo(() => {
|
@@ -122,6 +122,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
122
122
|
}
|
123
123
|
setLoading(false);
|
124
124
|
list = list.concat((_w = (_v = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.filter) === null || _v === void 0 ? void 0 : _v.call(_u, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _w !== void 0 ? _w : []);
|
125
|
+
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
|
126
|
+
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
|
125
127
|
const isNotNullList = (_y = (_x = result === null || result === void 0 ? void 0 : result.data) === null || _x === void 0 ? void 0 : _x.recList) === null || _y === void 0 ? void 0 : _y.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
126
128
|
if (isNotNullList) {
|
127
129
|
pageNum = pageNum + 1;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { ISxpPageRenderProps } from '../components/SxpPageRender';
|
2
|
+
import { ProductInfoType } from '../components/SxpPageRender/typing';
|
1
3
|
export declare const getMediaValueByMode: (obj?: Record<string, any>) => any;
|
2
4
|
export declare const getBgStyle: (imgSrc: string) => "" | {
|
3
5
|
backgroundImage: string;
|
@@ -9,3 +11,8 @@ export declare const getBgStyleByImg: (data: any) => "" | {
|
|
9
11
|
backgroundRepeat: string;
|
10
12
|
backgroundSize: string;
|
11
13
|
};
|
14
|
+
export declare const getPriceText: ({ product, enableFormattedPrice, globalConfig }: {
|
15
|
+
product: ProductInfoType | undefined | null;
|
16
|
+
enableFormattedPrice: boolean | undefined;
|
17
|
+
globalConfig: ISxpPageRenderProps['globalConfig'];
|
18
|
+
}) => string;
|
@@ -29,3 +29,50 @@ export const getBgStyleByImg = (data) => {
|
|
29
29
|
const imgSrc = typeof bgImg === 'string' ? bgImg : getMediaValueByMode(bgImg);
|
30
30
|
return getBgStyle(imgSrc);
|
31
31
|
};
|
32
|
+
export const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
|
33
|
+
var _a, _b, _c, _d, _e;
|
34
|
+
let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
|
35
|
+
let text = '';
|
36
|
+
let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
|
37
|
+
let currency = (product === null || product === void 0 ? void 0 : product.currency) ? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : '' : '$';
|
38
|
+
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice || (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) !== 'none';
|
39
|
+
let decPic = price.toString();
|
40
|
+
if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
|
41
|
+
decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
|
42
|
+
}
|
43
|
+
let decInd = (_d = decPic === null || decPic === void 0 ? void 0 : decPic.indexOf('.')) !== null && _d !== void 0 ? _d : -1;
|
44
|
+
if (isToLocStr) {
|
45
|
+
text =
|
46
|
+
(_e = price === null || price === void 0 ? void 0 : price.toLocaleString('zh', {
|
47
|
+
minimumFractionDigits: (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? 2 : 0
|
48
|
+
})) !== null && _e !== void 0 ? _e : '';
|
49
|
+
let startIndex = 0;
|
50
|
+
let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
|
51
|
+
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
|
52
|
+
text = text === null || text === void 0 ? void 0 : text.replace(/,/g, function (match, index) {
|
53
|
+
if (index >= startIndex && index < endIndex) {
|
54
|
+
return '.';
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
return match;
|
58
|
+
}
|
59
|
+
});
|
60
|
+
}
|
61
|
+
else if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === ' ') {
|
62
|
+
text = text === null || text === void 0 ? void 0 : text.replace(',', ' ');
|
63
|
+
}
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
text = `${(priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? price === null || price === void 0 ? void 0 : price.toFixed(2) : price}`;
|
67
|
+
}
|
68
|
+
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0 && decInd + 1 < (text === null || text === void 0 ? void 0 : text.length)) {
|
69
|
+
text = text.slice(0, decInd + 1) + ',' + text.slice(decInd + 2);
|
70
|
+
}
|
71
|
+
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
|
72
|
+
text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
|
73
|
+
}
|
74
|
+
else if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
|
75
|
+
text = currency + text;
|
76
|
+
}
|
77
|
+
return text;
|
78
|
+
};
|
@@ -28,6 +28,7 @@ declare const _default: ({
|
|
28
28
|
name: string[];
|
29
29
|
initialValue: string;
|
30
30
|
child?: undefined;
|
31
|
+
belong?: undefined;
|
31
32
|
} | {
|
32
33
|
type: string;
|
33
34
|
label: string;
|
@@ -39,6 +40,7 @@ declare const _default: ({
|
|
39
40
|
options?: undefined;
|
40
41
|
name?: undefined;
|
41
42
|
initialValue?: undefined;
|
43
|
+
belong?: undefined;
|
42
44
|
} | {
|
43
45
|
type: string;
|
44
46
|
label: string;
|
@@ -54,6 +56,7 @@ declare const _default: ({
|
|
54
56
|
options?: undefined;
|
55
57
|
name?: undefined;
|
56
58
|
initialValue?: undefined;
|
59
|
+
belong?: undefined;
|
57
60
|
} | {
|
58
61
|
label: string;
|
59
62
|
type: string;
|
@@ -61,11 +64,13 @@ declare const _default: ({
|
|
61
64
|
name?: undefined;
|
62
65
|
initialValue?: undefined;
|
63
66
|
child?: undefined;
|
67
|
+
belong?: undefined;
|
64
68
|
} | {
|
65
69
|
label: string;
|
66
70
|
type: string;
|
67
71
|
name: string[];
|
68
72
|
initialValue: boolean;
|
73
|
+
belong: string;
|
69
74
|
options?: undefined;
|
70
75
|
child?: undefined;
|
71
76
|
})[];
|
@@ -11,10 +11,11 @@ import ExpandableText from '../../../../core/components/SxpPageRender/Expandable
|
|
11
11
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
12
12
|
import { setFontForText } from '../../../../core/utils/tool';
|
13
13
|
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
|
+
import { getPriceText } from '../../../../core/utils/materials';
|
14
15
|
const CommodityDetail = (_a) => {
|
15
16
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
16
17
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
|
17
|
-
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
|
18
|
+
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig } = useSxpDataSource();
|
18
19
|
const { jumpToWeb, productView } = useEventReport();
|
19
20
|
const curTimeRef = useRef(null);
|
20
21
|
const [showModal, setShowModal] = useState(false);
|
@@ -59,20 +60,11 @@ const CommodityDetail = (_a) => {
|
|
59
60
|
window.removeEventListener('pageshow', initTime);
|
60
61
|
};
|
61
62
|
}, []);
|
62
|
-
const priceText =
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
|
68
|
-
minimumFractionDigits: 0
|
69
|
-
})) !== null && _g !== void 0 ? _g : ''
|
70
|
-
: product === null || product === void 0 ? void 0 : product.price}`;
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
return '$7,000';
|
74
|
-
}
|
75
|
-
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency, (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice]);
|
63
|
+
const priceText = getPriceText({
|
64
|
+
product: product,
|
65
|
+
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
66
|
+
globalConfig
|
67
|
+
});
|
76
68
|
const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
|
77
69
|
const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
|
78
70
|
const renderContent = ({ isPost }) => {
|
@@ -95,6 +95,7 @@ declare const _default: ({
|
|
95
95
|
name: string[];
|
96
96
|
initialValue: string;
|
97
97
|
child?: undefined;
|
98
|
+
belong?: undefined;
|
98
99
|
} | {
|
99
100
|
type: string;
|
100
101
|
child: {
|
@@ -107,6 +108,7 @@ declare const _default: ({
|
|
107
108
|
options?: undefined;
|
108
109
|
name?: undefined;
|
109
110
|
initialValue?: undefined;
|
111
|
+
belong?: undefined;
|
110
112
|
} | {
|
111
113
|
type: string;
|
112
114
|
label: string;
|
@@ -118,6 +120,7 @@ declare const _default: ({
|
|
118
120
|
options?: undefined;
|
119
121
|
name?: undefined;
|
120
122
|
initialValue?: undefined;
|
123
|
+
belong?: undefined;
|
121
124
|
} | {
|
122
125
|
type: string;
|
123
126
|
label: string;
|
@@ -133,6 +136,7 @@ declare const _default: ({
|
|
133
136
|
options?: undefined;
|
134
137
|
name?: undefined;
|
135
138
|
initialValue?: undefined;
|
139
|
+
belong?: undefined;
|
136
140
|
} | {
|
137
141
|
label: string;
|
138
142
|
type: string;
|
@@ -140,6 +144,7 @@ declare const _default: ({
|
|
140
144
|
name?: undefined;
|
141
145
|
initialValue?: undefined;
|
142
146
|
child?: undefined;
|
147
|
+
belong?: undefined;
|
143
148
|
} | {
|
144
149
|
label: string;
|
145
150
|
type: string;
|
@@ -147,11 +152,13 @@ declare const _default: ({
|
|
147
152
|
options?: undefined;
|
148
153
|
initialValue?: undefined;
|
149
154
|
child?: undefined;
|
155
|
+
belong?: undefined;
|
150
156
|
} | {
|
151
157
|
label: string;
|
152
158
|
type: string;
|
153
159
|
name: string[];
|
154
160
|
initialValue: boolean;
|
161
|
+
belong: string;
|
155
162
|
options?: undefined;
|
156
163
|
child?: undefined;
|
157
164
|
})[];
|
@@ -11,11 +11,12 @@ import { useEventReport } from '../../../../core/hooks/useEventReport';
|
|
11
11
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
12
12
|
import { setFontForText } from '../../../../core/utils/tool';
|
13
13
|
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
|
+
import { getPriceText } from '../../../../core/utils/materials';
|
14
15
|
const CommodityDetailDiroNew = (_a) => {
|
15
16
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
16
17
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
|
17
18
|
const [spread, setSpread] = useState(true);
|
18
|
-
const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef } = useSxpDataSource();
|
19
|
+
const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef, globalConfig } = useSxpDataSource();
|
19
20
|
const { jumpToWeb, productView } = useEventReport();
|
20
21
|
const [stopSlide, setStopSlide] = useState(false);
|
21
22
|
const [isBottom, setIsBottom] = useState(false);
|
@@ -63,20 +64,11 @@ const CommodityDetailDiroNew = (_a) => {
|
|
63
64
|
window.removeEventListener('pageshow', initTime);
|
64
65
|
};
|
65
66
|
}, []);
|
66
|
-
const priceText =
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
|
72
|
-
minimumFractionDigits: 0
|
73
|
-
})) !== null && _g !== void 0 ? _g : ''
|
74
|
-
: product === null || product === void 0 ? void 0 : product.price}`;
|
75
|
-
}
|
76
|
-
else {
|
77
|
-
return '£102,300.00';
|
78
|
-
}
|
79
|
-
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency, (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice]);
|
67
|
+
const priceText = getPriceText({
|
68
|
+
product,
|
69
|
+
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
70
|
+
globalConfig
|
71
|
+
});
|
80
72
|
const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
|
81
73
|
const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
|
82
74
|
const handleClickCollapse = () => {
|
@@ -95,6 +95,7 @@ declare const _default: ({
|
|
95
95
|
name: string[];
|
96
96
|
initialValue: string;
|
97
97
|
child?: undefined;
|
98
|
+
belong?: undefined;
|
98
99
|
} | {
|
99
100
|
type: string;
|
100
101
|
label: string;
|
@@ -106,6 +107,7 @@ declare const _default: ({
|
|
106
107
|
options?: undefined;
|
107
108
|
name?: undefined;
|
108
109
|
initialValue?: undefined;
|
110
|
+
belong?: undefined;
|
109
111
|
} | {
|
110
112
|
type: string;
|
111
113
|
label: string;
|
@@ -121,6 +123,7 @@ declare const _default: ({
|
|
121
123
|
options?: undefined;
|
122
124
|
name?: undefined;
|
123
125
|
initialValue?: undefined;
|
126
|
+
belong?: undefined;
|
124
127
|
} | {
|
125
128
|
label: string;
|
126
129
|
type: string;
|
@@ -128,6 +131,7 @@ declare const _default: ({
|
|
128
131
|
name?: undefined;
|
129
132
|
initialValue?: undefined;
|
130
133
|
child?: undefined;
|
134
|
+
belong?: undefined;
|
131
135
|
} | {
|
132
136
|
label: string;
|
133
137
|
type: string;
|
@@ -135,11 +139,13 @@ declare const _default: ({
|
|
135
139
|
options?: undefined;
|
136
140
|
initialValue?: undefined;
|
137
141
|
child?: undefined;
|
142
|
+
belong?: undefined;
|
138
143
|
} | {
|
139
144
|
label: string;
|
140
145
|
type: string;
|
141
146
|
name: string[];
|
142
147
|
initialValue: boolean;
|
148
|
+
belong: string;
|
143
149
|
options?: undefined;
|
144
150
|
child?: undefined;
|
145
151
|
})[];
|
@@ -7,30 +7,24 @@ import { useEventReport } from '../../../../core/hooks/useEventReport';
|
|
7
7
|
import { setFontForText } from '../../../../core/utils/tool';
|
8
8
|
import Img from '../../template/components/Img';
|
9
9
|
import { throttle } from 'lodash';
|
10
|
+
import { getPriceText } from '../../../../core/utils/materials';
|
10
11
|
const CommodityList = (_a) => {
|
11
12
|
var _b, _c, _d;
|
12
13
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
|
13
|
-
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = useSxpDataSource();
|
14
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig } = useSxpDataSource();
|
14
15
|
const { jumpToWeb } = useEventReport();
|
15
16
|
const { popup } = useEditor();
|
16
17
|
const recData = isPost ? rec : popupDetailData;
|
17
18
|
const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
|
18
19
|
const index = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
19
20
|
const priceText = useCallback((product) => {
|
20
|
-
var _a
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
: product === null || product === void 0 ? void 0 : product.price}`;
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
const p = 7000;
|
31
|
-
return `$${isToLocStr ? p === null || p === void 0 ? void 0 : p.toLocaleString() : p}`;
|
32
|
-
}
|
33
|
-
}, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice]);
|
21
|
+
var _a;
|
22
|
+
return getPriceText({
|
23
|
+
product,
|
24
|
+
enableFormattedPrice: (_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
25
|
+
globalConfig
|
26
|
+
});
|
27
|
+
}, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice, globalConfig]);
|
34
28
|
const handleClick = throttle((item, multiCheckIndex) => {
|
35
29
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
36
30
|
eventSubject: 'clickCta',
|
@@ -62,6 +62,7 @@ declare const _default: ({
|
|
62
62
|
name: string[];
|
63
63
|
initialValue: string;
|
64
64
|
child?: undefined;
|
65
|
+
belong?: undefined;
|
65
66
|
} | {
|
66
67
|
type: string;
|
67
68
|
label: string;
|
@@ -73,6 +74,7 @@ declare const _default: ({
|
|
73
74
|
options?: undefined;
|
74
75
|
name?: undefined;
|
75
76
|
initialValue?: undefined;
|
77
|
+
belong?: undefined;
|
76
78
|
} | {
|
77
79
|
type: string;
|
78
80
|
label: string;
|
@@ -88,6 +90,7 @@ declare const _default: ({
|
|
88
90
|
options?: undefined;
|
89
91
|
name?: undefined;
|
90
92
|
initialValue?: undefined;
|
93
|
+
belong?: undefined;
|
91
94
|
} | {
|
92
95
|
label: string;
|
93
96
|
type: string;
|
@@ -95,11 +98,13 @@ declare const _default: ({
|
|
95
98
|
name?: undefined;
|
96
99
|
initialValue?: undefined;
|
97
100
|
child?: undefined;
|
101
|
+
belong?: undefined;
|
98
102
|
} | {
|
99
103
|
label: string;
|
100
104
|
type: string;
|
101
105
|
name: string[];
|
102
106
|
initialValue: boolean;
|
107
|
+
belong: string;
|
103
108
|
options?: undefined;
|
104
109
|
child?: undefined;
|
105
110
|
})[];
|