@fonixtree/magic-design 1.0.36 → 1.0.38

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.
Files changed (27) hide show
  1. package/es/assets/fonts/.DS_Store +0 -0
  2. package/es/common/LinkModal/FilteredProductModal/index.js +81 -105
  3. package/es/common/LinkModal/FilteredProductModal/index.less +1 -0
  4. package/es/common/LinkModal/ProductDetailPage/index.js +92 -57
  5. package/es/common/LinkModal/ProductDetailPage/index.less +6 -1
  6. package/es/common/ProductModal/index.js +124 -87
  7. package/es/common/ProductModal/index.less +7 -1
  8. package/es/common/ProductSource/index.js +65 -13
  9. package/es/composite-comp/dito/components/Recommend/mobile/index.js +26 -23
  10. package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +4 -2
  11. package/es/locale/en/en.json +10 -1
  12. package/es/locale/es/es.json +10 -1
  13. package/es/locale/id/id.json +10 -1
  14. package/lib/assets/fonts/.DS_Store +0 -0
  15. package/lib/common/LinkModal/FilteredProductModal/index.js +81 -105
  16. package/lib/common/LinkModal/FilteredProductModal/index.less +1 -0
  17. package/lib/common/LinkModal/ProductDetailPage/index.js +92 -57
  18. package/lib/common/LinkModal/ProductDetailPage/index.less +6 -1
  19. package/lib/common/ProductModal/index.js +124 -87
  20. package/lib/common/ProductModal/index.less +7 -1
  21. package/lib/common/ProductSource/index.js +65 -13
  22. package/lib/composite-comp/dito/components/Recommend/mobile/index.js +26 -23
  23. package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +4 -2
  24. package/lib/locale/en/en.json +10 -1
  25. package/lib/locale/es/es.json +10 -1
  26. package/lib/locale/id/id.json +10 -1
  27. package/package.json +1 -1
Binary file
@@ -213,49 +213,45 @@ var FilteredProductModal = function FilteredProductModal(props) {
213
213
  labelData = _f[0],
214
214
  setLabelData = _f[1];
215
215
 
216
- var _g = (0, _react.useState)(''),
217
- storeName = _g[0],
218
- setStoreName = _g[1];
216
+ var _g = (0, _react.useState)(window.magicDesign.storeId || ''),
217
+ storeId = _g[0],
218
+ setStoreId = _g[1];
219
219
 
220
- var _h = (0, _react.useState)(window.magicDesign.storeId || ''),
221
- storeId = _h[0],
222
- setStoreId = _h[1];
220
+ var _h = (0, _react.useState)([]),
221
+ storeList = _h[0],
222
+ setStoreList = _h[1];
223
223
 
224
- var _j = (0, _react.useState)([]),
225
- storeList = _j[0],
226
- setStoreList = _j[1];
224
+ var _j = (0, _react.useState)(''),
225
+ productName = _j[0],
226
+ setProductName = _j[1];
227
227
 
228
228
  var _k = (0, _react.useState)(''),
229
- productName = _k[0],
230
- setProductName = _k[1];
229
+ minimum = _k[0],
230
+ setMinimum = _k[1];
231
231
 
232
232
  var _l = (0, _react.useState)(''),
233
- minimum = _l[0],
234
- setMinimum = _l[1];
233
+ maximum = _l[0],
234
+ setMaximum = _l[1];
235
235
 
236
- var _m = (0, _react.useState)(''),
237
- maximum = _m[0],
238
- setMaximum = _m[1];
236
+ var _m = (0, _react.useState)([]),
237
+ dataSource = _m[0],
238
+ setDataSource = _m[1];
239
239
 
240
- var _o = (0, _react.useState)([]),
241
- dataSource = _o[0],
242
- setDataSource = _o[1];
240
+ var _o = (0, _react.useState)({}),
241
+ promotions = _o[0],
242
+ setPromotions = _o[1];
243
243
 
244
- var _p = (0, _react.useState)({}),
245
- promotions = _p[0],
246
- setPromotions = _p[1];
244
+ var _p = (0, _react.useState)(false),
245
+ loading = _p[0],
246
+ setLoading = _p[1];
247
247
 
248
- var _q = (0, _react.useState)(false),
249
- loading = _q[0],
250
- setLoading = _q[1];
251
-
252
- var _r = (0, _react.useState)({
248
+ var _q = (0, _react.useState)({
253
249
  pageSize: 20,
254
250
  current: 1,
255
251
  total: 0
256
252
  }),
257
- paginationParams = _r[0],
258
- setPaginationParams = _r[1];
253
+ paginationParams = _q[0],
254
+ setPaginationParams = _q[1];
259
255
 
260
256
  var onChange = function onChange(value) {
261
257
  settVal(value);
@@ -282,7 +278,6 @@ var FilteredProductModal = function FilteredProductModal(props) {
282
278
  settBrandId([]);
283
279
  settLabelId({});
284
280
  setStoreId(window.magicDesign.storeId || '');
285
- setStoreName('');
286
281
  setProductName('');
287
282
  setMinimum('');
288
283
  setMaximum('');
@@ -293,7 +288,7 @@ var FilteredProductModal = function FilteredProductModal(props) {
293
288
 
294
289
  var columns = [{
295
290
  title: 'Image',
296
- dataIndex: 'imgUrl',
291
+ dataIndex: 'productImageUrl',
297
292
  key: 'imgUrl',
298
293
  width: 100,
299
294
  render: function render(imgUrl, record) {
@@ -309,13 +304,7 @@ var FilteredProductModal = function FilteredProductModal(props) {
309
304
  dataIndex: 'offerName',
310
305
  key: 'offerName',
311
306
  ellipsis: true
312
- }, // {
313
- // title: 'SKU',
314
- // dataIndex: 'attrValues',
315
- // key: 'attrValues',
316
- // ellipsis: true,
317
- // },
318
- {
307
+ }, {
319
308
  title: 'Price',
320
309
  dataIndex: 'salesPrice',
321
310
  key: 'salesPrice',
@@ -439,72 +428,57 @@ var FilteredProductModal = function FilteredProductModal(props) {
439
428
  };
440
429
 
441
430
  var loadGoods = function loadGoods() {
442
- setLoading(true);
443
- return new Promise(function (resolve, reject) {
444
- return __awaiter(void 0, void 0, void 0, function () {
445
- var precision, params, res;
446
- return __generator(this, function (_a) {
447
- switch (_a.label) {
448
- case 0:
449
- precision = Math.pow(10, (0, _commonUtil.ensure)(function () {
450
- return window.systemParams.precision;
451
- }, '0'));
452
- params = {
453
- catgIds: tValue.join(','),
454
- brandIds: brandId.map(function (v) {
455
- return v.key;
456
- }).join(','),
457
- labelIds: labelId.key,
458
- q: productName,
459
- // productName,
460
- storeId: storeId,
461
- startPrice: minimum * precision || '',
462
- endPrice: maximum * precision || '',
463
- // storeName:storeName,
464
- campaignType: promotions.key || '',
465
- pageSize: paginationParams.pageSize,
466
- pageIndex: paginationParams.current,
467
- state: 'A'
468
- };
469
- return [4
470
- /*yield*/
471
- , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/offers/es", params, 'POST')];
472
-
473
- case 1:
474
- res = _a.sent();
475
- setLoading(false);
476
- paginationParams.total = res.total;
477
-
478
- if (res && res.list && res.list.length > 0) {
479
- setDataSource(res.list);
480
- resolve({
481
- url: JsonToUrl({
482
- catgIds: tValue.join(',') || '',
483
- brandIds: brandId.map(function (v) {
484
- return v.key;
485
- }).join(',') || '',
486
- labelIds: labelId.key || '',
487
- q: productName || '',
488
- minPrice: minimum * precision || '',
489
- maxPrice: maximum * precision || '',
490
- storeId: storeId || '',
491
- campaignType: promotions.key || '',
492
- state: 'A'
493
- }),
494
- total: res.total
495
- });
496
- } else {
497
- setDataSource([]);
498
- resolve({
499
- total: 0
500
- });
501
- }
502
-
503
- return [2
504
- /*return*/
505
- ];
506
- }
507
- });
431
+ return __awaiter(void 0, void 0, void 0, function () {
432
+ var params, res, h5UrlStr;
433
+ return __generator(this, function (_a) {
434
+ switch (_a.label) {
435
+ case 0:
436
+ setLoading(true);
437
+ params = {
438
+ catgIds: tValue.join(','),
439
+ brandIds: brandId.map(function (v) {
440
+ return v.key;
441
+ }).join(','),
442
+ labelIds: labelId.key,
443
+ q: productName,
444
+ storeId: storeId,
445
+ startPrice: (0, _currencyUtil.formatBackendCurrency)(minimum),
446
+ endPrice: (0, _currencyUtil.formatBackendCurrency)(maximum),
447
+ campaignType: promotions.key || '',
448
+ state: 'A',
449
+ pageSize: paginationParams.pageSize,
450
+ pageIndex: paginationParams.current
451
+ };
452
+ return [4
453
+ /*yield*/
454
+ , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/offers/es", params, 'POST')];
455
+
456
+ case 1:
457
+ res = _a.sent();
458
+ setDataSource(res.list || []);
459
+ paginationParams.total = res.total;
460
+ setPaginationParams(__assign({}, paginationParams));
461
+ setLoading(false);
462
+ h5UrlStr = JsonToUrl({
463
+ catgIds: tValue.join(',') || '',
464
+ brandIds: brandId.map(function (v) {
465
+ return v.key;
466
+ }).join(',') || '',
467
+ labelIds: labelId.key || '',
468
+ q: productName || '',
469
+ storeId: storeId || '',
470
+ minPrice: (0, _currencyUtil.formatBackendCurrency)(minimum),
471
+ maxPrice: (0, _currencyUtil.formatBackendCurrency)(maximum),
472
+ campaignType: promotions.key || '',
473
+ state: 'A'
474
+ });
475
+ return [2
476
+ /*return*/
477
+ , {
478
+ url: h5UrlStr,
479
+ total: res.total
480
+ }];
481
+ }
508
482
  });
509
483
  });
510
484
  };
@@ -664,13 +638,15 @@ var FilteredProductModal = function FilteredProductModal(props) {
664
638
  onClick: function onClick() {
665
639
  paginationParams.current = 1;
666
640
  loadGoods().then(function (res) {
641
+ console.log('res', res);
642
+
667
643
  if (res.total !== 0) {
668
644
  onDataChange({
669
645
  value: res.url,
670
646
  name: res.url
671
647
  }, res.total);
672
648
  } else {
673
- onDataChange('', res.total); // message.warn('no goods!');
649
+ onDataChange('', res.total);
674
650
  }
675
651
  });
676
652
  },
@@ -1,5 +1,6 @@
1
1
  .mFilteredProductModal {
2
2
  height: 550px;
3
+
3
4
  .proModalWrap {
4
5
  .info {
5
6
  background: #ecf1fd;
@@ -17,6 +17,8 @@ var _commonUtil = require("../../../utils/commonUtil");
17
17
 
18
18
  var _businessUtil = require("../../../utils/businessUtil");
19
19
 
20
+ var _ProductModal = require("../../ProductModal");
21
+
20
22
  require("./index.less");
21
23
 
22
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -182,19 +184,6 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
182
184
  }
183
185
  };
184
186
 
185
- var __rest = void 0 && (void 0).__rest || function (s, e) {
186
- var t = {};
187
-
188
- for (var p in s) {
189
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
190
- }
191
-
192
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
193
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
194
- }
195
- return t;
196
- };
197
-
198
187
  var Option = _antd.Select.Option;
199
188
 
200
189
  var ProductDetailPage = function ProductDetailPage(props) {
@@ -232,12 +221,17 @@ var ProductDetailPage = function ProductDetailPage(props) {
232
221
  loading = _h[0],
233
222
  setLoading = _h[1];
234
223
 
235
- var _j = (0, _react.useState)({
224
+ var _j = (0, _react.useState)('sku'),
225
+ proType = _j[0],
226
+ setProType = _j[1];
227
+
228
+ var _k = (0, _react.useState)({
236
229
  pageSize: 20,
237
- pageIndex: 1
230
+ current: 1,
231
+ total: 0
238
232
  }),
239
- paginationParams = _j[0],
240
- setPaginationParams = _j[1];
233
+ paginationParams = _k[0],
234
+ setPaginationParams = _k[1];
241
235
 
242
236
  var columns = [{
243
237
  title: 'Image',
@@ -276,22 +270,68 @@ var ProductDetailPage = function ProductDetailPage(props) {
276
270
  type: 'radio'
277
271
  };
278
272
 
279
- var queryGoods = function queryGoods(params) {
273
+ var queryGoods = function queryGoods() {
280
274
  return __awaiter(void 0, void 0, void 0, function () {
281
- var res;
275
+ var _list, total, params, res, res_1;
276
+
282
277
  return __generator(this, function (_a) {
283
278
  switch (_a.label) {
284
279
  case 0:
280
+ _list = [];
281
+ total = 0;
282
+ params = {
283
+ productName: productName,
284
+ brandIds: brandId.map(function (v) {
285
+ return v.key;
286
+ }).join(',') || '',
287
+ storeId: storeId,
288
+ pageSize: paginationParams.pageSize,
289
+ pageIndex: paginationParams.current
290
+ };
291
+ if (!(proType === 'sku')) return [3
292
+ /*break*/
293
+ , 2];
285
294
  return [4
286
295
  /*yield*/
287
- , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/products", params, 'GET')];
296
+ , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/products", __assign(__assign({}, params), {
297
+ productCode: productCode
298
+ }), 'GET')];
288
299
 
289
300
  case 1:
290
301
  res = _a.sent();
302
+ _list = (0, _ProductModal.formatData)(res.list || []);
303
+ total = res.total;
304
+ return [3
305
+ /*break*/
306
+ , 4];
307
+
308
+ case 2:
309
+ return [4
310
+ /*yield*/
311
+ , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/offers", __assign(__assign({}, params), {
312
+ offerCode: productCode,
313
+ isDefaultCover: 'Y',
314
+ onlyQryPublishSku: true,
315
+ auditState: 'S',
316
+ crmFlag: 'on'
317
+ }), 'GET')];
318
+
319
+ case 3:
320
+ res_1 = _a.sent();
321
+ _list = (0, _ProductModal.formatData)((0, _commonUtil.ensure)(function () {
322
+ return res_1.list.map(function (m) {
323
+ return __assign(__assign({}, m.products[0]), m);
324
+ });
325
+ }, []), proType);
326
+ total = res_1.total;
327
+ _a.label = 4;
328
+
329
+ case 4:
330
+ setProductList(_list);
291
331
  setLoading(false);
292
- paginationParams.total = res.total;
293
- setProductList(res.list);
294
- window.MProductList = res.list;
332
+ window.MProductList = _list;
333
+ paginationParams.total = total;
334
+ setPaginationParams(__assign({}, paginationParams));
295
335
  return [2
296
336
  /*return*/
297
337
  ];
@@ -362,17 +402,20 @@ var ProductDetailPage = function ProductDetailPage(props) {
362
402
 
363
403
  (0, _react.useEffect)(function () {
364
404
  setLoading(true);
365
-
366
- var total = paginationParams.total,
367
- params = __rest(paginationParams, ["total"]);
368
-
369
- queryGoods(params);
405
+ queryGoods();
370
406
  queryBrand();
371
407
 
372
408
  if ((0, _businessUtil.isPlatform)()) {
373
409
  queryStore();
374
410
  }
375
411
  }, []);
412
+ var proTypeOption = [{
413
+ label: 'SKU',
414
+ value: 'sku'
415
+ }, {
416
+ label: 'SPU',
417
+ value: 'spu'
418
+ }];
376
419
  return /*#__PURE__*/_react["default"].createElement("div", {
377
420
  className: "productDetailPage"
378
421
  }, /*#__PURE__*/_react["default"].createElement(_antd.Form, {
@@ -382,6 +425,20 @@ var ProductDetailPage = function ProductDetailPage(props) {
382
425
  layout: "horizontal"
383
426
  }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
384
427
  gutter: 24
428
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
429
+ offset: 20,
430
+ span: 4
431
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Group, {
432
+ buttonStyle: "solid",
433
+ className: "btn-select-type",
434
+ onChange: function onChange(e) {
435
+ setProType(e.target.value);
436
+ },
437
+ options: proTypeOption,
438
+ optionType: "button",
439
+ value: proType
440
+ }))), /*#__PURE__*/_react["default"].createElement(_antd.Row, {
441
+ gutter: 24
385
442
  }, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
386
443
  span: 9
387
444
  }, /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
@@ -395,7 +452,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
395
452
  }))), /*#__PURE__*/_react["default"].createElement(_antd.Col, {
396
453
  span: 9
397
454
  }, /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
398
- label: "SKU Code"
455
+ label: proType === 'sku' ? 'SKU Code' : 'SPU Code'
399
456
  }, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
400
457
  onChange: function onChange(e) {
401
458
  return setProductCode(e.target.value);
@@ -444,19 +501,8 @@ var ProductDetailPage = function ProductDetailPage(props) {
444
501
  }, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
445
502
  onClick: function onClick() {
446
503
  setLoading(true);
447
- paginationParams.pageIndex = 1;
448
-
449
- var total = paginationParams.total,
450
- params = __rest(paginationParams, ["total"]);
451
-
452
- queryGoods(__assign({
453
- productName: productName,
454
- productCode: productCode,
455
- brandIds: brandId.map(function (v) {
456
- return v.key;
457
- }).join(',') || '',
458
- storeId: storeId
459
- }, params));
504
+ paginationParams.current = 1;
505
+ queryGoods();
460
506
  },
461
507
  size: "small",
462
508
  style: {
@@ -476,26 +522,15 @@ var ProductDetailPage = function ProductDetailPage(props) {
476
522
  pagination: __assign(__assign({}, paginationParams), {
477
523
  onChange: function onChange(page) {
478
524
  setLoading(true);
479
- paginationParams.pageIndex = page;
480
-
481
- var total = paginationParams.total,
482
- params = __rest(paginationParams, ["total"]);
483
-
484
- queryGoods(__assign({
485
- productName: productName,
486
- productCode: productCode,
487
- brandIds: brandId.map(function (v) {
488
- return v.key;
489
- }).join(',') || '',
490
- storeId: storeId
491
- }, params));
525
+ paginationParams.current = page;
526
+ queryGoods();
492
527
  },
493
528
  showSizeChanger: false
494
529
  }),
495
- rowKey: "productId",
530
+ rowKey: "id",
496
531
  rowSelection: rowSelection,
497
532
  scroll: {
498
- y: 340
533
+ y: 300
499
534
  }
500
535
  }));
501
536
  };
@@ -1,5 +1,10 @@
1
1
  .productDetailPage {
2
2
  height: 550px;
3
+
4
+ .btn-select-type {
5
+ margin-bottom: 10px;
6
+ }
7
+
3
8
  .prodImage {
4
9
  width: 36px;
5
10
  height: 36px;
@@ -7,4 +12,4 @@
7
12
  background-position: 50% 50%;
8
13
  background-size: contain;
9
14
  }
10
- }
15
+ }