@fonixtree/magic-design 2.0.71 → 2.0.73
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/es/common/AffiliateProductModal/index.js +1 -1
- package/es/common/AffiliateProductModal/index.less +1 -1
- package/es/common/Button/index.less +0 -1
- package/es/common/LinkModal/FilteredProductModal/index.js +154 -104
- package/es/common/LinkModal/FilteredProductModal/index.less +7 -0
- package/es/common/LinkModal/ProductDetailPage/index.js +92 -57
- package/es/common/LinkModal/ProductDetailPage/index.less +6 -1
- package/es/common/ProductModal/index.js +124 -87
- package/es/common/ProductModal/index.less +7 -1
- package/es/common/ProductSource/index.js +82 -21
- package/es/composite-comp/dito/components/HeadNavigation/defaultJSON.js +22 -17
- package/es/composite-comp/dito/components/HeadNavigation/mobile/index.js +2 -2
- package/es/composite-comp/dito/components/Recommend/mobile/index.js +26 -23
- package/es/composite-comp/dito/config-panels/HeadNavigationConfig/index.js +25 -27
- package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +4 -2
- package/es/constants/index.js +12 -3
- package/es/core/Designer/QuickMenuBar/index.js +9 -1
- package/es/core/Designer/index.js +11 -1
- package/es/locale/en/en.json +4 -1
- package/es/locale/es/es.json +4 -1
- package/es/locale/id/id.json +4 -1
- package/es/utils/commonUtil.js +14 -6
- package/lib/common/AffiliateProductModal/index.js +1 -1
- package/lib/common/AffiliateProductModal/index.less +1 -1
- package/lib/common/Button/index.less +0 -1
- package/lib/common/LinkModal/FilteredProductModal/index.js +154 -104
- package/lib/common/LinkModal/FilteredProductModal/index.less +7 -0
- package/lib/common/LinkModal/ProductDetailPage/index.js +92 -57
- package/lib/common/LinkModal/ProductDetailPage/index.less +6 -1
- package/lib/common/ProductModal/index.js +124 -87
- package/lib/common/ProductModal/index.less +7 -1
- package/lib/common/ProductSource/index.js +82 -21
- package/lib/composite-comp/dito/components/HeadNavigation/defaultJSON.js +22 -17
- package/lib/composite-comp/dito/components/HeadNavigation/mobile/index.js +2 -2
- package/lib/composite-comp/dito/components/Recommend/mobile/index.js +26 -23
- package/lib/composite-comp/dito/config-panels/HeadNavigationConfig/index.js +25 -27
- package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +4 -2
- package/lib/constants/index.js +12 -3
- package/lib/core/Designer/QuickMenuBar/index.js +9 -1
- package/lib/core/Designer/index.js +11 -1
- package/lib/locale/en/en.json +4 -1
- package/lib/locale/es/es.json +4 -1
- package/lib/locale/id/id.json +4 -1
- package/lib/utils/commonUtil.js +14 -6
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = void 0;
|
|
8
|
+
exports.formatData = exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var _antd = require("antd");
|
|
11
11
|
|
|
@@ -204,18 +204,26 @@ var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
|
|
|
204
204
|
return r;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
var
|
|
207
|
+
var promType = {
|
|
208
|
+
FLASH_SALE: '2',
|
|
209
|
+
GROUP_BUY: '4'
|
|
210
|
+
};
|
|
211
|
+
var proTypeOption = [{
|
|
212
|
+
label: 'SKU',
|
|
213
|
+
value: 'sku'
|
|
214
|
+
}, {
|
|
215
|
+
label: 'SPU',
|
|
216
|
+
value: 'spu'
|
|
217
|
+
}];
|
|
218
|
+
|
|
219
|
+
var formatData = function formatData(list, type) {
|
|
208
220
|
list.map(function (item) {
|
|
209
|
-
item.
|
|
210
|
-
item.preMarketPrice = (0, _currencyUtil.formatCurrencyWithSymbol)(item.marketPrice);
|
|
221
|
+
item.id = type === 'spu' ? item.offerId : item.productId;
|
|
211
222
|
});
|
|
212
223
|
return list;
|
|
213
224
|
};
|
|
214
225
|
|
|
215
|
-
|
|
216
|
-
FLASH_SALE: '2',
|
|
217
|
-
GROUP_BUY: '4'
|
|
218
|
-
};
|
|
226
|
+
exports.formatData = formatData;
|
|
219
227
|
var Option = _antd.Select.Option;
|
|
220
228
|
var InputGroup = _antd.Input.Group;
|
|
221
229
|
|
|
@@ -223,14 +231,12 @@ var ProductModal = function ProductModal(props) {
|
|
|
223
231
|
var handleModalSave = props.handleModalSave,
|
|
224
232
|
closeModal = props.closeModal,
|
|
225
233
|
visible = props.visible,
|
|
226
|
-
_a = props.
|
|
227
|
-
|
|
228
|
-
_b = props.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
selectedList = _c[0],
|
|
233
|
-
setSelectedList = _c[1];
|
|
234
|
+
_a = props.prodType,
|
|
235
|
+
prodType = _a === void 0 ? 'sku' : _a,
|
|
236
|
+
_b = props.defaultList,
|
|
237
|
+
defaultList = _b === void 0 ? [] : _b,
|
|
238
|
+
_c = props.maxSelect,
|
|
239
|
+
maxSelect = _c === void 0 ? 20 : _c;
|
|
234
240
|
|
|
235
241
|
var _d = (0, _react.useState)([]),
|
|
236
242
|
catgsList = _d[0],
|
|
@@ -292,15 +298,27 @@ var ProductModal = function ProductModal(props) {
|
|
|
292
298
|
loading = _t[0],
|
|
293
299
|
setLoading = _t[1];
|
|
294
300
|
|
|
295
|
-
var _u = (0, _react.useState)(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
301
|
+
var _u = (0, _react.useState)(prodType),
|
|
302
|
+
proType = _u[0],
|
|
303
|
+
setProType = _u[1];
|
|
304
|
+
|
|
305
|
+
var _v = (0, _react.useState)(defaultList),
|
|
306
|
+
selectedList = _v[0],
|
|
307
|
+
setSelectedList = _v[1];
|
|
308
|
+
|
|
309
|
+
var _w = (0, _react.useState)({
|
|
310
|
+
pageSize: 20,
|
|
311
|
+
current: 1,
|
|
312
|
+
total: 0
|
|
313
|
+
}),
|
|
314
|
+
paginationParams = _w[0],
|
|
315
|
+
setPaginationParams = _w[1];
|
|
300
316
|
|
|
301
317
|
var rowSelection = {
|
|
302
|
-
selectedRowKeys:
|
|
303
|
-
|
|
318
|
+
selectedRowKeys: selectedList.map(function (v) {
|
|
319
|
+
return v.id;
|
|
320
|
+
}),
|
|
321
|
+
onSelect: function onSelect(record, selected) {
|
|
304
322
|
if (selected) {
|
|
305
323
|
if (selectedList.length === maxSelect) {
|
|
306
324
|
_antd.message.warning("Max " + maxSelect);
|
|
@@ -309,17 +327,13 @@ var ProductModal = function ProductModal(props) {
|
|
|
309
327
|
}
|
|
310
328
|
|
|
311
329
|
if (selectedList.length < maxSelect) {
|
|
312
|
-
setSelectedList(__spreadArrays(selectedList,
|
|
330
|
+
setSelectedList(__spreadArrays(selectedList, [record]));
|
|
313
331
|
}
|
|
314
332
|
} else {
|
|
315
333
|
setSelectedList(selectedList.filter(function (v) {
|
|
316
|
-
return v.
|
|
334
|
+
return v.id !== record.id;
|
|
317
335
|
}));
|
|
318
336
|
}
|
|
319
|
-
|
|
320
|
-
setSelectedRowKeys(selectedRows.map(function (v) {
|
|
321
|
-
return v === null || v === void 0 ? void 0 : v.productId;
|
|
322
|
-
}));
|
|
323
337
|
},
|
|
324
338
|
getCheckboxProps: function getCheckboxProps(record) {
|
|
325
339
|
return {
|
|
@@ -328,41 +342,80 @@ var ProductModal = function ProductModal(props) {
|
|
|
328
342
|
}
|
|
329
343
|
};
|
|
330
344
|
|
|
331
|
-
var _v = (0, _react.useState)({
|
|
332
|
-
pageSize: 20,
|
|
333
|
-
current: 1,
|
|
334
|
-
total: 0
|
|
335
|
-
}),
|
|
336
|
-
paginationParams = _v[0],
|
|
337
|
-
setPaginationParams = _v[1];
|
|
338
|
-
|
|
339
345
|
var delSelectedItem = function delSelectedItem(index) {
|
|
340
|
-
console.log(selectedRowKeys, index, 2223);
|
|
341
|
-
var rowKeys = JSON.parse(JSON.stringify(selectedRowKeys));
|
|
342
|
-
rowKeys.splice(index, 1);
|
|
343
|
-
setSelectedRowKeys(rowKeys);
|
|
344
346
|
var rows = JSON.parse(JSON.stringify(selectedList));
|
|
345
347
|
rows.splice(index, 1);
|
|
346
348
|
setSelectedList(rows);
|
|
347
349
|
}; // 请求商品列表
|
|
348
350
|
|
|
349
351
|
|
|
350
|
-
var queryGoods = function queryGoods(
|
|
352
|
+
var queryGoods = function queryGoods() {
|
|
351
353
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
352
|
-
var res;
|
|
354
|
+
var _list, total, params, res, res_1;
|
|
355
|
+
|
|
353
356
|
return __generator(this, function (_a) {
|
|
354
357
|
switch (_a.label) {
|
|
355
358
|
case 0:
|
|
359
|
+
setLoading(true);
|
|
360
|
+
setGoodsList([]);
|
|
361
|
+
_list = [];
|
|
362
|
+
total = 0;
|
|
363
|
+
params = {
|
|
364
|
+
productName: productName,
|
|
365
|
+
storeId: storeId,
|
|
366
|
+
cmpTypeId: promotions || '',
|
|
367
|
+
minPrice: (0, _currencyUtil.formatBackendCurrency)(minPrice),
|
|
368
|
+
maxPrice: (0, _currencyUtil.formatBackendCurrency)(maxPrice),
|
|
369
|
+
catgIds: selCatgsList.join(','),
|
|
370
|
+
brandIds: selBrandsList.join(','),
|
|
371
|
+
labelIds: selLabelData.value || '',
|
|
372
|
+
pageSize: paginationParams.pageSize,
|
|
373
|
+
pageIndex: paginationParams.current,
|
|
374
|
+
state: 'A'
|
|
375
|
+
};
|
|
376
|
+
if (!(proType === 'sku')) return [3
|
|
377
|
+
/*break*/
|
|
378
|
+
, 2];
|
|
356
379
|
return [4
|
|
357
380
|
/*yield*/
|
|
358
|
-
, (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/products",
|
|
381
|
+
, (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/products", __assign(__assign({}, params), {
|
|
382
|
+
productCode: productCode
|
|
383
|
+
}), 'GET')];
|
|
359
384
|
|
|
360
385
|
case 1:
|
|
361
386
|
res = _a.sent();
|
|
387
|
+
_list = formatData(res.list || []);
|
|
388
|
+
total = res.total;
|
|
389
|
+
return [3
|
|
390
|
+
/*break*/
|
|
391
|
+
, 4];
|
|
392
|
+
|
|
393
|
+
case 2:
|
|
394
|
+
return [4
|
|
395
|
+
/*yield*/
|
|
396
|
+
, (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/offers", __assign(__assign({}, params), {
|
|
397
|
+
offerCode: productCode,
|
|
398
|
+
isDefaultCover: 'Y',
|
|
399
|
+
onlyQryPublishSku: true,
|
|
400
|
+
auditState: 'S',
|
|
401
|
+
crmFlag: 'on'
|
|
402
|
+
}), 'GET')];
|
|
403
|
+
|
|
404
|
+
case 3:
|
|
405
|
+
res_1 = _a.sent();
|
|
406
|
+
_list = formatData((0, _commonUtil.ensure)(function () {
|
|
407
|
+
return res_1.list.map(function (m) {
|
|
408
|
+
return __assign(__assign({}, m.products[0]), m);
|
|
409
|
+
});
|
|
410
|
+
}, []), proType);
|
|
411
|
+
total = res_1.total;
|
|
412
|
+
_a.label = 4;
|
|
413
|
+
|
|
414
|
+
case 4:
|
|
362
415
|
setLoading(false);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
416
|
+
setGoodsList(_list);
|
|
417
|
+
paginationParams.total = total;
|
|
418
|
+
setPaginationParams(__assign({}, paginationParams));
|
|
366
419
|
return [2
|
|
367
420
|
/*return*/
|
|
368
421
|
];
|
|
@@ -471,14 +524,15 @@ var ProductModal = function ProductModal(props) {
|
|
|
471
524
|
}, []);
|
|
472
525
|
(0, _react.useEffect)(function () {
|
|
473
526
|
setSelectedList(defaultList);
|
|
474
|
-
setSelectedRowKeys(defaultList.map(function (v) {
|
|
475
|
-
return v.productId;
|
|
476
|
-
}));
|
|
477
527
|
|
|
478
528
|
if (props.type === 'groupBuy') {
|
|
479
529
|
setPromotions(promType.GROUP_BUY);
|
|
480
530
|
}
|
|
481
531
|
}, [visible]);
|
|
532
|
+
(0, _react.useEffect)(function () {
|
|
533
|
+
paginationParams.current = 1;
|
|
534
|
+
queryGoods();
|
|
535
|
+
}, [proType]);
|
|
482
536
|
|
|
483
537
|
var reset = function reset() {
|
|
484
538
|
setSelBrandsList([]);
|
|
@@ -510,8 +564,8 @@ var ProductModal = function ProductModal(props) {
|
|
|
510
564
|
width: 120,
|
|
511
565
|
ellipsis: true
|
|
512
566
|
}, {
|
|
513
|
-
title: (0, _locale.i18n)('
|
|
514
|
-
dataIndex: 'productCode',
|
|
567
|
+
title: proType === 'sku' ? (0, _locale.i18n)('SKU_CODE') : (0, _locale.i18n)('SPU_CODE'),
|
|
568
|
+
dataIndex: proType === 'sku' ? 'productCode' : 'offerCode',
|
|
515
569
|
width: 120,
|
|
516
570
|
ellipsis: true
|
|
517
571
|
}, _defineProperty({
|
|
@@ -599,7 +653,7 @@ var ProductModal = function ProductModal(props) {
|
|
|
599
653
|
return setStoreId(value);
|
|
600
654
|
},
|
|
601
655
|
optionFilterProp: "children",
|
|
602
|
-
placeholder:
|
|
656
|
+
placeholder: (0, _locale.i18n)('PLEASE_SELECT'),
|
|
603
657
|
showSearch: true,
|
|
604
658
|
value: storeId
|
|
605
659
|
}, storeList && storeList.length > 0 && storeList.map(function (v) {
|
|
@@ -612,7 +666,6 @@ var ProductModal = function ProductModal(props) {
|
|
|
612
666
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Select, {
|
|
613
667
|
defaultValue: selLabelData.children || null,
|
|
614
668
|
onChange: function onChange(v, o) {
|
|
615
|
-
console.log(v, o, 33);
|
|
616
669
|
setSelLabelData(o);
|
|
617
670
|
},
|
|
618
671
|
placeholder: (0, _locale.i18n)('PLEASE_SELECT'),
|
|
@@ -659,7 +712,7 @@ var ProductModal = function ProductModal(props) {
|
|
|
659
712
|
size: "small",
|
|
660
713
|
value: productName
|
|
661
714
|
})), /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
|
|
662
|
-
label:
|
|
715
|
+
label: proType === 'sku' ? 'SKU Code' : 'SPU Code'
|
|
663
716
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
|
|
664
717
|
className: "inputStyle",
|
|
665
718
|
onChange: function onChange(e) {
|
|
@@ -693,20 +746,7 @@ var ProductModal = function ProductModal(props) {
|
|
|
693
746
|
onClick: function onClick() {
|
|
694
747
|
setLoading(true);
|
|
695
748
|
paginationParams.current = 1;
|
|
696
|
-
queryGoods(
|
|
697
|
-
productName: productName,
|
|
698
|
-
productCode: productCode,
|
|
699
|
-
storeId: storeId,
|
|
700
|
-
cmpTypeId: promotions || '',
|
|
701
|
-
minPrice: (0, _currencyUtil.formatBackendCurrency)(minPrice),
|
|
702
|
-
maxPrice: (0, _currencyUtil.formatBackendCurrency)(maxPrice),
|
|
703
|
-
catgIds: selCatgsList.join(','),
|
|
704
|
-
brandIds: selBrandsList.join(','),
|
|
705
|
-
labelIds: selLabelData.value || '',
|
|
706
|
-
pageSize: paginationParams.pageSize,
|
|
707
|
-
pageIndex: paginationParams.current,
|
|
708
|
-
state: 'A'
|
|
709
|
-
});
|
|
749
|
+
queryGoods();
|
|
710
750
|
},
|
|
711
751
|
size: "small",
|
|
712
752
|
style: {
|
|
@@ -715,7 +755,17 @@ var ProductModal = function ProductModal(props) {
|
|
|
715
755
|
type: "primary"
|
|
716
756
|
}, (0, _locale.i18n)('QUERY'))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
717
757
|
className: "rightCot"
|
|
718
|
-
}, /*#__PURE__*/_react["default"].createElement(_antd.
|
|
758
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Group, {
|
|
759
|
+
buttonStyle: "solid",
|
|
760
|
+
className: "btn-select-type",
|
|
761
|
+
onChange: function onChange(e) {
|
|
762
|
+
setProType(e.target.value);
|
|
763
|
+
setSelectedList([]);
|
|
764
|
+
},
|
|
765
|
+
options: proTypeOption,
|
|
766
|
+
optionType: "button",
|
|
767
|
+
value: proType
|
|
768
|
+
}), /*#__PURE__*/_react["default"].createElement(_antd.Table, {
|
|
719
769
|
columns: columns,
|
|
720
770
|
dataSource: goodsList,
|
|
721
771
|
loading: loading,
|
|
@@ -723,26 +773,13 @@ var ProductModal = function ProductModal(props) {
|
|
|
723
773
|
onChange: function onChange(page) {
|
|
724
774
|
setLoading(true);
|
|
725
775
|
paginationParams.current = page;
|
|
726
|
-
|
|
727
|
-
queryGoods({
|
|
728
|
-
productName: productName,
|
|
729
|
-
productCode: productCode,
|
|
730
|
-
cmpTypeId: promotions || '',
|
|
731
|
-
minPrice: (0, _currencyUtil.formatBackendCurrency)(minPrice),
|
|
732
|
-
maxPrice: (0, _currencyUtil.formatBackendCurrency)(maxPrice),
|
|
733
|
-
catgIds: selCatgsList.join(','),
|
|
734
|
-
brandIds: selBrandsList.join(','),
|
|
735
|
-
labelIds: selLabelData.value || '',
|
|
736
|
-
pageSize: paginationParams.pageSize,
|
|
737
|
-
pageIndex: paginationParams.current,
|
|
738
|
-
state: 'A'
|
|
739
|
-
});
|
|
776
|
+
queryGoods();
|
|
740
777
|
}
|
|
741
778
|
}),
|
|
742
|
-
rowKey: "
|
|
779
|
+
rowKey: "id",
|
|
743
780
|
rowSelection: rowSelection,
|
|
744
781
|
scroll: {
|
|
745
|
-
y:
|
|
782
|
+
y: 420
|
|
746
783
|
}
|
|
747
784
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
748
785
|
className: "selectedCot"
|
|
@@ -772,7 +809,7 @@ var ProductModal = function ProductModal(props) {
|
|
|
772
809
|
className: "totalNum"
|
|
773
810
|
}, selectedList.length, "/", maxSelect)), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
774
811
|
onClick: function onClick() {
|
|
775
|
-
handleModalSave && handleModalSave(selectedList);
|
|
812
|
+
handleModalSave && handleModalSave(selectedList, proType);
|
|
776
813
|
closeModal && closeModal();
|
|
777
814
|
},
|
|
778
815
|
style: {
|
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
margin-left: 16px;
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-direction: column;
|
|
20
|
-
justify-content:
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.btn-select-type {
|
|
24
|
+
text-align: right;
|
|
25
|
+
margin-bottom: 15px;
|
|
26
|
+
}
|
|
21
27
|
|
|
22
28
|
.prodImg {
|
|
23
29
|
display: inline-block;
|
|
@@ -15,7 +15,7 @@ var _commonUtil = require("../../utils/commonUtil");
|
|
|
15
15
|
|
|
16
16
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
17
17
|
|
|
18
|
-
var _ProductModal =
|
|
18
|
+
var _ProductModal = _interopRequireWildcard(require("../ProductModal"));
|
|
19
19
|
|
|
20
20
|
require("./index.less");
|
|
21
21
|
|
|
@@ -27,6 +27,22 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
|
|
30
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
31
|
+
__assign = Object.assign || function (t) {
|
|
32
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
33
|
+
s = arguments[i];
|
|
34
|
+
|
|
35
|
+
for (var p in s) {
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return t;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return __assign.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
|
|
30
46
|
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
31
47
|
function adopt(value) {
|
|
32
48
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -175,7 +191,8 @@ function ProductSource(_a) {
|
|
|
175
191
|
|
|
176
192
|
var value = _a.value,
|
|
177
193
|
onChange = _a.onChange,
|
|
178
|
-
isAffiliate = _a.isAffiliate
|
|
194
|
+
isAffiliate = _a.isAffiliate,
|
|
195
|
+
prodType = _a.prodType;
|
|
179
196
|
|
|
180
197
|
var _b = (0, _react.useState)([]),
|
|
181
198
|
selectedProds = _b[0],
|
|
@@ -187,27 +204,22 @@ function ProductSource(_a) {
|
|
|
187
204
|
|
|
188
205
|
var onSelectProduct = function onSelectProduct() {
|
|
189
206
|
return __awaiter(_this, void 0, void 0, function () {
|
|
190
|
-
var url, param, list;
|
|
207
|
+
var url, param, list, url, param, list, url, param, list_1;
|
|
191
208
|
return __generator(this, function (_a) {
|
|
192
209
|
switch (_a.label) {
|
|
193
210
|
case 0:
|
|
194
211
|
if (!(value && value.length > 0)) return [3
|
|
195
212
|
/*break*/
|
|
213
|
+
, 7];
|
|
214
|
+
if (!isAffiliate) return [3
|
|
215
|
+
/*break*/
|
|
196
216
|
, 2];
|
|
197
|
-
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/
|
|
217
|
+
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/distributor/product/list";
|
|
198
218
|
param = {
|
|
199
|
-
|
|
219
|
+
affiliateProductIds: value,
|
|
220
|
+
pageSize: value.length,
|
|
221
|
+
pageIndex: 1
|
|
200
222
|
};
|
|
201
|
-
|
|
202
|
-
if (isAffiliate) {
|
|
203
|
-
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/distributor/product/list";
|
|
204
|
-
param = {
|
|
205
|
-
affiliateProductIds: value,
|
|
206
|
-
pageSize: value.length,
|
|
207
|
-
pageIndex: 1
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
223
|
return [4
|
|
212
224
|
/*yield*/
|
|
213
225
|
, (0, _commonUtil.commonFetch)(url, param, 'GET')];
|
|
@@ -217,13 +229,61 @@ function ProductSource(_a) {
|
|
|
217
229
|
setSelectedProds(list || []);
|
|
218
230
|
return [3
|
|
219
231
|
/*break*/
|
|
220
|
-
,
|
|
232
|
+
, 6];
|
|
221
233
|
|
|
222
234
|
case 2:
|
|
223
|
-
|
|
224
|
-
|
|
235
|
+
if (!(prodType === 'sku')) return [3
|
|
236
|
+
/*break*/
|
|
237
|
+
, 4];
|
|
238
|
+
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/products";
|
|
239
|
+
param = {
|
|
240
|
+
products: value,
|
|
241
|
+
state: 'A'
|
|
242
|
+
};
|
|
243
|
+
return [4
|
|
244
|
+
/*yield*/
|
|
245
|
+
, (0, _commonUtil.commonFetch)(url, param, 'GET')];
|
|
225
246
|
|
|
226
247
|
case 3:
|
|
248
|
+
list = _a.sent().list;
|
|
249
|
+
setSelectedProds((0, _ProductModal.formatData)(list || []));
|
|
250
|
+
return [3
|
|
251
|
+
/*break*/
|
|
252
|
+
, 6];
|
|
253
|
+
|
|
254
|
+
case 4:
|
|
255
|
+
url = "/designer/v1/" + window.magicDesign.MBaseUrl + "/offers";
|
|
256
|
+
param = {
|
|
257
|
+
offers: value,
|
|
258
|
+
state: 'A',
|
|
259
|
+
isDefaultCover: 'Y',
|
|
260
|
+
onlyQryPublishSku: true,
|
|
261
|
+
auditState: 'S',
|
|
262
|
+
crmFlag: 'on'
|
|
263
|
+
};
|
|
264
|
+
return [4
|
|
265
|
+
/*yield*/
|
|
266
|
+
, (0, _commonUtil.commonFetch)(url, param, 'GET')];
|
|
267
|
+
|
|
268
|
+
case 5:
|
|
269
|
+
list_1 = _a.sent().list;
|
|
270
|
+
setSelectedProds((0, _ProductModal.formatData)((0, _commonUtil.ensure)(function () {
|
|
271
|
+
return list_1.map(function (m) {
|
|
272
|
+
return __assign(__assign({}, m.products[0]), m);
|
|
273
|
+
});
|
|
274
|
+
}, []), prodType));
|
|
275
|
+
_a.label = 6;
|
|
276
|
+
|
|
277
|
+
case 6:
|
|
278
|
+
return [3
|
|
279
|
+
/*break*/
|
|
280
|
+
, 8];
|
|
281
|
+
|
|
282
|
+
case 7:
|
|
283
|
+
setSelectedProds([]);
|
|
284
|
+
_a.label = 8;
|
|
285
|
+
|
|
286
|
+
case 8:
|
|
227
287
|
setVisbile(true);
|
|
228
288
|
return [2
|
|
229
289
|
/*return*/
|
|
@@ -233,7 +293,7 @@ function ProductSource(_a) {
|
|
|
233
293
|
});
|
|
234
294
|
};
|
|
235
295
|
|
|
236
|
-
var handleModalSave = function handleModalSave(list) {
|
|
296
|
+
var handleModalSave = function handleModalSave(list, type) {
|
|
237
297
|
var ids = '';
|
|
238
298
|
|
|
239
299
|
if (isAffiliate) {
|
|
@@ -242,11 +302,11 @@ function ProductSource(_a) {
|
|
|
242
302
|
}).join(',');
|
|
243
303
|
} else {
|
|
244
304
|
ids = list.map(function (prod) {
|
|
245
|
-
return prod.
|
|
305
|
+
return prod.id;
|
|
246
306
|
}).join(',');
|
|
247
307
|
}
|
|
248
308
|
|
|
249
|
-
onChange(ids);
|
|
309
|
+
onChange(ids, type);
|
|
250
310
|
};
|
|
251
311
|
|
|
252
312
|
var getLength = function getLength() {
|
|
@@ -281,6 +341,7 @@ function ProductSource(_a) {
|
|
|
281
341
|
defaultList: selectedProds,
|
|
282
342
|
handleModalSave: handleModalSave,
|
|
283
343
|
maxSelect: 100,
|
|
344
|
+
prodType: prodType,
|
|
284
345
|
visible: visible
|
|
285
346
|
})));
|
|
286
347
|
}
|
|
@@ -68,23 +68,28 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
68
68
|
groupSource: defaultHeadName.map(function (group) {
|
|
69
69
|
return groupSourceHeadJSON(group);
|
|
70
70
|
}),
|
|
71
|
-
displayPage: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
// displayPage: [
|
|
72
|
+
// {
|
|
73
|
+
// name: 'Store Home',
|
|
74
|
+
// type: '/store-home',
|
|
75
|
+
// state: true,
|
|
76
|
+
// },
|
|
77
|
+
// {
|
|
78
|
+
// name: 'Product Detail',
|
|
79
|
+
// type: '/product/list',
|
|
80
|
+
// state: true,
|
|
81
|
+
// },
|
|
82
|
+
// {
|
|
83
|
+
// name: 'Poster Page',
|
|
84
|
+
// type: '/poster',
|
|
85
|
+
// state: true,
|
|
86
|
+
// },
|
|
87
|
+
// {
|
|
88
|
+
// name: 'Community',
|
|
89
|
+
// type: '/main/community',
|
|
90
|
+
// state: true,
|
|
91
|
+
// },
|
|
92
|
+
// ],
|
|
88
93
|
background: {
|
|
89
94
|
opacity: 100,
|
|
90
95
|
color: '#fff',
|
|
@@ -62,8 +62,8 @@ function (_super) {
|
|
|
62
62
|
var _this = this;
|
|
63
63
|
|
|
64
64
|
var data = this.props.data;
|
|
65
|
-
var showNav = this.state.showNav;
|
|
66
|
-
|
|
65
|
+
var showNav = this.state.showNav; // console.log('---head data', data);
|
|
66
|
+
|
|
67
67
|
var GAData = (0, _commonUtil.getGAData)(data);
|
|
68
68
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
69
|
className: "m-head-navigation"
|