@kmkf-fe-packages/basic-components 1.22.1-beta.0 → 1.22.1-beta.10

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.esm.js CHANGED
@@ -4,7 +4,7 @@ import { EyeOutlined, DeleteOutlined, CloseCircleOutlined, CaretUpOutlined } fro
4
4
  import request, { extend as extend$1 } from 'umi-request';
5
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
6
6
  import { AddressData, BsAddressData, WdtAddressData, request as request$1, ExpressData, uuid, LogisticsAddressData, SendDataCenter, BS_E3_BOOLEAN_STATUS_MAP, filterWdtOrders, WDT_ORDER_TYPE_MAP, filterBsE3Orders, filterKmOrders, KM_SYSTEM_ORDER_CONFIG, BS_E3_ORDER_STATUS_MAP, updateWdtGoodsHandle, updateBsE3GoodsHandle } from '@kmkf-fe-packages/kmkf-utils';
7
- import { debounce, isNaN as isNaN$1, isNumber as isNumber$1, cloneDeep, difference, differenceWith, takeRight, reject, isEmpty } from 'lodash';
7
+ import { debounce, isNaN as isNaN$1, isNumber as isNumber$1, cloneDeep, difference, differenceWith, takeRight, reject, isEmpty, intersection } from 'lodash';
8
8
  import { useUpdateEffect, useDebounceEffect, useAntdTable } from 'ahooks';
9
9
  import zhCN from 'antd/lib/locale/zh_CN';
10
10
  import pubsub from 'pubsub-js';
@@ -12576,6 +12576,104 @@ var getBsE3ReissueGoodColumns = function getBsE3ReissueGoodColumns(_ref4) {
12576
12576
  });
12577
12577
  };
12578
12578
 
12579
+ var columns$4 = [{
12580
+ dataIndex: 'goodId',
12581
+ title: "\u5546\u54C1ID",
12582
+ width: 70
12583
+ }, {
12584
+ dataIndex: 'goodNo',
12585
+ title: "\u5546\u54C1\u7F16\u7801",
12586
+ width: 180
12587
+ }, {
12588
+ dataIndex: 'goodName',
12589
+ title: "\u5546\u54C1\u540D\u79F0",
12590
+ width: 250
12591
+ }, {
12592
+ dataIndex: 'specId',
12593
+ title: "SKUID",
12594
+ width: 100
12595
+ }, {
12596
+ dataIndex: 'specNo',
12597
+ title: "\u5546\u54C1SKU\u7F16\u7801",
12598
+ width: 180
12599
+ }, {
12600
+ dataIndex: 'specName',
12601
+ title: "\u5546\u54C1SKU\u540D\u79F0",
12602
+ width: 250
12603
+ }, {
12604
+ dataIndex: 'orderPrice',
12605
+ title: "\u5B9E\u4ED8\u603B\u91D1\u989D",
12606
+ width: 100
12607
+ }, {
12608
+ dataIndex: 'num',
12609
+ title: "\u6570\u91CF",
12610
+ width: 100
12611
+ }, {
12612
+ dataIndex: 'sharePrice',
12613
+ title: "\u5206\u644A\u4EF7",
12614
+ width: 70
12615
+ }, {
12616
+ dataIndex: 'giftType',
12617
+ title: "\u8D60\u54C1\u65B9\u5F0F",
12618
+ width: 100
12619
+ }];
12620
+ var renderFieldMap$1 = {
12621
+ num: function num(_ref) {
12622
+ var disabled = _ref.disabled,
12623
+ updateHandle = _ref.updateHandle;
12624
+ return function (val, record, index) {
12625
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
12626
+ style: {
12627
+ width: 70
12628
+ },
12629
+ value: val,
12630
+ min: 1,
12631
+ precision: 0,
12632
+ onChange: function onChange(num) {
12633
+ return updateHandle(num, index, 'num');
12634
+ }
12635
+ }) : /*#__PURE__*/React.createElement("span", null, val);
12636
+ };
12637
+ },
12638
+ giftType: function giftType(_ref2) {
12639
+ var disabled = _ref2.disabled,
12640
+ updateHandle = _ref2.updateHandle;
12641
+ return function (val) {
12642
+ var giftTypeMap = {
12643
+ 0: '非赠品',
12644
+ 1: '自动赠送',
12645
+ 2: '手工赠送',
12646
+ 3: '回购自动送赠品',
12647
+ 4: '前N有礼送赠品',
12648
+ 6: '天猫优仓赠品',
12649
+ 7: '淘宝CRM会员送赠'
12650
+ };
12651
+ return /*#__PURE__*/React.createElement("span", null, giftTypeMap[val]);
12652
+ };
12653
+ }
12654
+ };
12655
+ var getWdtReissueGoodColumns = function getWdtReissueGoodColumns(_ref3) {
12656
+ var disabled = _ref3.disabled,
12657
+ updateHandle = _ref3.updateHandle,
12658
+ operate = _ref3.operate;
12659
+ return columns$4.map(function (item) {
12660
+ var newItem = _objectSpread2({
12661
+ align: 'center',
12662
+ ellipsis: true
12663
+ }, item);
12664
+ if (operate && (renderFieldMap$1 === null || renderFieldMap$1 === void 0 ? void 0 : renderFieldMap$1[item.dataIndex])) {
12665
+ return _objectSpread2(_objectSpread2({}, newItem), {}, {
12666
+ render: renderFieldMap$1 === null || renderFieldMap$1 === void 0 ? void 0 : renderFieldMap$1[item.dataIndex]({
12667
+ disabled: disabled,
12668
+ updateHandle: updateHandle
12669
+ })
12670
+ });
12671
+ }
12672
+ return newItem;
12673
+ });
12674
+ };
12675
+
12676
+ var MAIN_FIELD = 'id';
12579
12677
  var SelectTradeGoods = function SelectTradeGoods(_ref) {
12580
12678
  var columns = _ref.columns,
12581
12679
  dataSource = _ref.dataSource,
@@ -12591,11 +12689,20 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
12591
12689
  var closeModal = function closeModal() {
12592
12690
  return setTradeGoodsVisible(false);
12593
12691
  };
12692
+ var currentTradeOriginGoods = intersection(dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
12693
+ return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
12694
+ }), selectedRowKeys);
12695
+ var unCurrentTradeOriginGoods = difference(selectedRowKeys, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
12696
+ return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
12697
+ }));
12698
+ var handleChangeSelectedKeys = function handleChangeSelectedKeys(keys) {
12699
+ console.log('handleChangeSelectedKeys', keys, unCurrentTradeOriginGoods);
12700
+ onChangeSelectedKeys(keys.concat(unCurrentTradeOriginGoods));
12701
+ };
12594
12702
  var rowSelection = {
12595
12703
  selectedRowKeys: selectedRowKeys,
12596
- onChange: onChangeSelectedKeys
12704
+ onChange: handleChangeSelectedKeys
12597
12705
  };
12598
- console.debug('选择订单商品-dataSource', dataSource, selectedRowKeys);
12599
12706
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
12600
12707
  type: "link",
12601
12708
  onClick: openModal
@@ -12605,7 +12712,7 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
12605
12712
  footer: null,
12606
12713
  onCancel: closeModal
12607
12714
  }, /*#__PURE__*/React.createElement(Table, {
12608
- rowKey: "id",
12715
+ rowKey: MAIN_FIELD,
12609
12716
  rowSelection: rowSelection,
12610
12717
  columns: columns,
12611
12718
  dataSource: dataSource,
@@ -12614,7 +12721,17 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
12614
12721
  x: 500,
12615
12722
  y: 500
12616
12723
  }
12617
- }), /*#__PURE__*/React.createElement("span", null, "\u5DF2\u9009\u62E9(", selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length, "/", dataSource === null || dataSource === void 0 ? void 0 : dataSource.length, ")")));
12724
+ }), /*#__PURE__*/React.createElement("span", null, "\u5DF2\u9009\u62E9(", currentTradeOriginGoods === null || currentTradeOriginGoods === void 0 ? void 0 : currentTradeOriginGoods.length, "/", dataSource === null || dataSource === void 0 ? void 0 : dataSource.length, ")")));
12725
+ };
12726
+ var getButtonText = function getButtonText() {
12727
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
12728
+ if (['BS_E3_GOODS', 'BS_E3_REISSUE_GOODS', 'BS_E3_EXCHANGE_GOODS'].includes(type)) {
12729
+ return '选择百胜ERP商品';
12730
+ }
12731
+ if (['WDT_REISSUE_GOODS'].includes(type)) {
12732
+ return '选择旺店通商品';
12733
+ }
12734
+ return '选择商品';
12618
12735
  };
12619
12736
  var GoodItem$1 = function GoodItem(props) {
12620
12737
  var _props$value = props.value,
@@ -12671,7 +12788,7 @@ var GoodItem$1 = function GoodItem(props) {
12671
12788
  // TODO: 商品订单中以选中商品
12672
12789
  var selectedGoods = useMemo(function () {
12673
12790
  return value === null || value === void 0 ? void 0 : value.map(function (v) {
12674
- return v.id;
12791
+ return v === null || v === void 0 ? void 0 : v[MAIN_FIELD];
12675
12792
  });
12676
12793
  }, [value]);
12677
12794
  var updateHandle = function updateHandle(val, index, columnType) {
@@ -12712,6 +12829,14 @@ var GoodItem$1 = function GoodItem(props) {
12712
12829
  var columns = [];
12713
12830
  switch (type) {
12714
12831
  case 'WDT_REISSUE_GOODS':
12832
+ {
12833
+ columns = getWdtReissueGoodColumns({
12834
+ disabled: disabled,
12835
+ updateHandle: updateHandle,
12836
+ operate: operate
12837
+ });
12838
+ }
12839
+ break;
12715
12840
  case 'WDT_GOODS':
12716
12841
  columns = [{
12717
12842
  dataIndex: 'goodId',
@@ -13217,6 +13342,116 @@ var GoodItem$1 = function GoodItem(props) {
13217
13342
  });
13218
13343
  }
13219
13344
  break;
13345
+ case 'BS_GOODS':
13346
+ columns = [{
13347
+ dataIndex: 'mark',
13348
+ title: "\u5546\u54C1\u6807\u8BB0",
13349
+ align: 'center',
13350
+ ellipsis: true,
13351
+ width: 70,
13352
+ render: function render(val, record, index) {
13353
+ return /*#__PURE__*/React.createElement(Select, {
13354
+ options: [{
13355
+ label: '是',
13356
+ value: '是'
13357
+ }, {
13358
+ label: '否',
13359
+ value: '否'
13360
+ }],
13361
+ disabled: disabled,
13362
+ value: val,
13363
+ onChange: function onChange(val) {
13364
+ return updateHandle(val, index, 'mark');
13365
+ }
13366
+ });
13367
+ }
13368
+ }, {
13369
+ dataIndex: 'skuName',
13370
+ title: "".concat(text, "sku\u540D\u79F0"),
13371
+ align: 'center',
13372
+ ellipsis: true,
13373
+ width: 250
13374
+ }, {
13375
+ dataIndex: 'sku',
13376
+ title: "".concat(text, "sku\u7F16\u7801"),
13377
+ align: 'center',
13378
+ ellipsis: true,
13379
+ width: 100
13380
+ }, {
13381
+ dataIndex: 'name',
13382
+ title: "".concat(text, "\u540D\u79F0"),
13383
+ align: 'center',
13384
+ ellipsis: true,
13385
+ width: 250
13386
+ }, {
13387
+ dataIndex: 'pic',
13388
+ title: "\u56FE\u7247",
13389
+ align: 'center',
13390
+ ellipsis: true,
13391
+ width: 100,
13392
+ render: function render(val) {
13393
+ return /*#__PURE__*/React.createElement(Image, {
13394
+ width: 60,
13395
+ src: val
13396
+ });
13397
+ }
13398
+ }, {
13399
+ dataIndex: 'code',
13400
+ title: "".concat(text, "\u7F16\u7801"),
13401
+ align: 'center',
13402
+ ellipsis: true,
13403
+ width: 100
13404
+ }, {
13405
+ dataIndex: 'money',
13406
+ title: "\u5B9E\u4ED8\u91D1\u989D",
13407
+ align: 'center',
13408
+ ellipsis: true,
13409
+ width: 100
13410
+ }, {
13411
+ dataIndex: 'number',
13412
+ title: "".concat(text, "\u6570\u91CF"),
13413
+ align: 'center',
13414
+ ellipsis: true,
13415
+ width: 100,
13416
+ render: function render(val, record, index) {
13417
+ return record.canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
13418
+ style: {
13419
+ width: 70
13420
+ },
13421
+ value: val,
13422
+ min: 1,
13423
+ precision: 0,
13424
+ onChange: function onChange(num) {
13425
+ return updateHandle(num, index, 'number');
13426
+ }
13427
+ }) : /*#__PURE__*/React.createElement("span", null, val);
13428
+ }
13429
+ }, {
13430
+ dataIndex: 'share',
13431
+ title: "\u5206\u644A\u4EF7",
13432
+ align: 'center',
13433
+ ellipsis: true,
13434
+ width: 70
13435
+ }, {
13436
+ dataIndex: 'type',
13437
+ title: "\u8D60\u54C1\u7C7B\u578B",
13438
+ align: 'center',
13439
+ ellipsis: true,
13440
+ width: 100
13441
+ }, {
13442
+ dataIndex: 'batch',
13443
+ title: "\u6279\u6B21\u53F7",
13444
+ align: 'center',
13445
+ ellipsis: true,
13446
+ width: 100
13447
+ }, {
13448
+ dataIndex: 'expireDate',
13449
+ title: "\u6709\u6548\u671F",
13450
+ align: 'center',
13451
+ ellipsis: true,
13452
+ width: 100
13453
+ }];
13454
+ break;
13220
13455
  default:
13221
13456
  columns = [{
13222
13457
  dataIndex: 'mark',
@@ -13485,7 +13720,7 @@ var GoodItem$1 = function GoodItem(props) {
13485
13720
  }), /*#__PURE__*/React.createElement(Button, {
13486
13721
  type: "link",
13487
13722
  onClick: handleChangeGoods
13488
- }, ['BS_E3_GOODS', 'BS_E3_REISSUE_GOODS', 'BS_E3_EXCHANGE_GOODS'].includes(type) ? '选择百胜ERP商品' : '选择商品'), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
13723
+ }, getButtonText(type)), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
13489
13724
  columns: newColumns,
13490
13725
  dataSource: value,
13491
13726
  rowKey: 'uuid',
@@ -15164,7 +15399,7 @@ var typeMap$1 = {
15164
15399
  }
15165
15400
  };
15166
15401
  var wdtReissue = function wdtReissue(props) {
15167
- var _value$wdtSystemOrder, _typeMap$type24, _typeMap$type25, _value$typeMap$type$s5, _typeMap$type26, _typeMap$type27, _typeMap$type28;
15402
+ var _value$wdtSystemOrder, _typeMap$type25, _typeMap$type27, _typeMap$type28, _value$typeMap$type$s5, _typeMap$type29, _typeMap$type30, _typeMap$type31;
15168
15403
  var value = props.value,
15169
15404
  onChange = props.onChange,
15170
15405
  _props$reasonList = props.reasonList,
@@ -15324,11 +15559,20 @@ var wdtReissue = function wdtReissue(props) {
15324
15559
  }
15325
15560
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
15326
15561
  };
15562
+ var selectedGoodsChange = useCallback(function (skuList) {
15563
+ var _typeMap$type23, _value, _typeMap$type24;
15564
+ var newValue = _objectSpread2({}, value);
15565
+ newValue["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type23 = typeMap$1[type]) === null || _typeMap$type23 === void 0 ? void 0 : _typeMap$type23.key)] = value === null || value === void 0 ? void 0 : (_value = value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type24 = typeMap$1[type]) === null || _typeMap$type24 === void 0 ? void 0 : _typeMap$type24.key)]) === null || _value === void 0 ? void 0 : _value.filter(function (item) {
15566
+ return skuList.includes(item.id);
15567
+ });
15568
+ console.log('newValue', newValue);
15569
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
15570
+ }, [value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type25 = typeMap$1[type]) === null || _typeMap$type25 === void 0 ? void 0 : _typeMap$type25.key)]]);
15327
15571
  //显示选择商品按钮 原单换不显示选择商品
15328
15572
  var showChangeBtn = useMemo(function () {
15329
- var _typeMap$type23;
15330
- return !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type23 = typeMap$1[type]) === null || _typeMap$type23 === void 0 ? void 0 : _typeMap$type23.systemOrderNo]);
15331
- }, [value === null || value === void 0 ? void 0 : value[(_typeMap$type24 = typeMap$1[type]) === null || _typeMap$type24 === void 0 ? void 0 : _typeMap$type24.systemOrderNo]]);
15573
+ var _typeMap$type26;
15574
+ return !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type26 = typeMap$1[type]) === null || _typeMap$type26 === void 0 ? void 0 : _typeMap$type26.systemOrderNo]);
15575
+ }, [value === null || value === void 0 ? void 0 : value[(_typeMap$type27 = typeMap$1[type]) === null || _typeMap$type27 === void 0 ? void 0 : _typeMap$type27.systemOrderNo]]);
15332
15576
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Row, {
15333
15577
  gutter: 8,
15334
15578
  wrap: true
@@ -15346,12 +15590,12 @@ var wdtReissue = function wdtReissue(props) {
15346
15590
  },
15347
15591
  disabled: disabled,
15348
15592
  allowClear: false,
15349
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type25 = typeMap$1[type]) === null || _typeMap$type25 === void 0 ? void 0 : _typeMap$type25.systemOrderNo)],
15593
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type28 = typeMap$1[type]) === null || _typeMap$type28 === void 0 ? void 0 : _typeMap$type28.systemOrderNo)],
15350
15594
  onChange: function onChange(val) {
15351
15595
  return changeSystemOrderHandle(val);
15352
15596
  },
15353
15597
  placeholder: "\u9009\u62E9\u8865\u53D1\u7CFB\u7EDF\u5355"
15354
- }, ((value === null || value === void 0 ? void 0 : (_value$typeMap$type$s5 = value[(_typeMap$type26 = typeMap$1[type]) === null || _typeMap$type26 === void 0 ? void 0 : _typeMap$type26.systemOrder]) === null || _value$typeMap$type$s5 === void 0 ? void 0 : _value$typeMap$type$s5.showOrderInfo) || []).map(function (item) {
15598
+ }, ((value === null || value === void 0 ? void 0 : (_value$typeMap$type$s5 = value[(_typeMap$type29 = typeMap$1[type]) === null || _typeMap$type29 === void 0 ? void 0 : _typeMap$type29.systemOrder]) === null || _value$typeMap$type$s5 === void 0 ? void 0 : _value$typeMap$type$s5.showOrderInfo) || []).map(function (item) {
15355
15599
  return /*#__PURE__*/React.createElement(Select.Option, {
15356
15600
  key: item.billNo,
15357
15601
  value: item.billNo,
@@ -15372,7 +15616,7 @@ var wdtReissue = function wdtReissue(props) {
15372
15616
  disabled: disabled,
15373
15617
  allowClear: false,
15374
15618
  options: reasonList,
15375
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type27 = typeMap$1[type]) === null || _typeMap$type27 === void 0 ? void 0 : _typeMap$type27.typeName)],
15619
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type30 = typeMap$1[type]) === null || _typeMap$type30 === void 0 ? void 0 : _typeMap$type30.typeName)],
15376
15620
  onChange: function onChange(val) {
15377
15621
  return changeTypeHandle(val);
15378
15622
  }
@@ -15384,13 +15628,19 @@ var wdtReissue = function wdtReissue(props) {
15384
15628
  canUpdateNumber: showChangeBtn,
15385
15629
  showChangeBtn: showChangeBtn,
15386
15630
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
15387
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type28 = typeMap$1[type]) === null || _typeMap$type28 === void 0 ? void 0 : _typeMap$type28.key)],
15631
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type31 = typeMap$1[type]) === null || _typeMap$type31 === void 0 ? void 0 : _typeMap$type31.key)],
15388
15632
  onChange: function onChange(val) {
15389
15633
  return changeGoodHandle(val);
15390
15634
  },
15391
15635
  onModeChange: handleModeChange,
15392
15636
  showModeBtn: showModeBtn,
15393
- isStrict: isStrict
15637
+ isStrict: isStrict,
15638
+ tradeGoods: {
15639
+ originDataSource: getGoodDetails({
15640
+ mode: isStrict
15641
+ }),
15642
+ selectedGoodsChange: selectedGoodsChange
15643
+ }
15394
15644
  })));
15395
15645
  };
15396
15646
 
package/dist/index.js CHANGED
@@ -12588,6 +12588,104 @@ var getBsE3ReissueGoodColumns = function getBsE3ReissueGoodColumns(_ref4) {
12588
12588
  });
12589
12589
  };
12590
12590
 
12591
+ var columns$4 = [{
12592
+ dataIndex: 'goodId',
12593
+ title: "\u5546\u54C1ID",
12594
+ width: 70
12595
+ }, {
12596
+ dataIndex: 'goodNo',
12597
+ title: "\u5546\u54C1\u7F16\u7801",
12598
+ width: 180
12599
+ }, {
12600
+ dataIndex: 'goodName',
12601
+ title: "\u5546\u54C1\u540D\u79F0",
12602
+ width: 250
12603
+ }, {
12604
+ dataIndex: 'specId',
12605
+ title: "SKUID",
12606
+ width: 100
12607
+ }, {
12608
+ dataIndex: 'specNo',
12609
+ title: "\u5546\u54C1SKU\u7F16\u7801",
12610
+ width: 180
12611
+ }, {
12612
+ dataIndex: 'specName',
12613
+ title: "\u5546\u54C1SKU\u540D\u79F0",
12614
+ width: 250
12615
+ }, {
12616
+ dataIndex: 'orderPrice',
12617
+ title: "\u5B9E\u4ED8\u603B\u91D1\u989D",
12618
+ width: 100
12619
+ }, {
12620
+ dataIndex: 'num',
12621
+ title: "\u6570\u91CF",
12622
+ width: 100
12623
+ }, {
12624
+ dataIndex: 'sharePrice',
12625
+ title: "\u5206\u644A\u4EF7",
12626
+ width: 70
12627
+ }, {
12628
+ dataIndex: 'giftType',
12629
+ title: "\u8D60\u54C1\u65B9\u5F0F",
12630
+ width: 100
12631
+ }];
12632
+ var renderFieldMap$1 = {
12633
+ num: function num(_ref) {
12634
+ var disabled = _ref.disabled,
12635
+ updateHandle = _ref.updateHandle;
12636
+ return function (val, record, index) {
12637
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
12638
+ style: {
12639
+ width: 70
12640
+ },
12641
+ value: val,
12642
+ min: 1,
12643
+ precision: 0,
12644
+ onChange: function onChange(num) {
12645
+ return updateHandle(num, index, 'num');
12646
+ }
12647
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
12648
+ };
12649
+ },
12650
+ giftType: function giftType(_ref2) {
12651
+ var disabled = _ref2.disabled,
12652
+ updateHandle = _ref2.updateHandle;
12653
+ return function (val) {
12654
+ var giftTypeMap = {
12655
+ 0: '非赠品',
12656
+ 1: '自动赠送',
12657
+ 2: '手工赠送',
12658
+ 3: '回购自动送赠品',
12659
+ 4: '前N有礼送赠品',
12660
+ 6: '天猫优仓赠品',
12661
+ 7: '淘宝CRM会员送赠'
12662
+ };
12663
+ return /*#__PURE__*/React__default['default'].createElement("span", null, giftTypeMap[val]);
12664
+ };
12665
+ }
12666
+ };
12667
+ var getWdtReissueGoodColumns = function getWdtReissueGoodColumns(_ref3) {
12668
+ var disabled = _ref3.disabled,
12669
+ updateHandle = _ref3.updateHandle,
12670
+ operate = _ref3.operate;
12671
+ return columns$4.map(function (item) {
12672
+ var newItem = _objectSpread2({
12673
+ align: 'center',
12674
+ ellipsis: true
12675
+ }, item);
12676
+ if (operate && (renderFieldMap$1 === null || renderFieldMap$1 === void 0 ? void 0 : renderFieldMap$1[item.dataIndex])) {
12677
+ return _objectSpread2(_objectSpread2({}, newItem), {}, {
12678
+ render: renderFieldMap$1 === null || renderFieldMap$1 === void 0 ? void 0 : renderFieldMap$1[item.dataIndex]({
12679
+ disabled: disabled,
12680
+ updateHandle: updateHandle
12681
+ })
12682
+ });
12683
+ }
12684
+ return newItem;
12685
+ });
12686
+ };
12687
+
12688
+ var MAIN_FIELD = 'id';
12591
12689
  var SelectTradeGoods = function SelectTradeGoods(_ref) {
12592
12690
  var columns = _ref.columns,
12593
12691
  dataSource = _ref.dataSource,
@@ -12603,11 +12701,20 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
12603
12701
  var closeModal = function closeModal() {
12604
12702
  return setTradeGoodsVisible(false);
12605
12703
  };
12704
+ var currentTradeOriginGoods = lodash.intersection(dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
12705
+ return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
12706
+ }), selectedRowKeys);
12707
+ var unCurrentTradeOriginGoods = lodash.difference(selectedRowKeys, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
12708
+ return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
12709
+ }));
12710
+ var handleChangeSelectedKeys = function handleChangeSelectedKeys(keys) {
12711
+ console.log('handleChangeSelectedKeys', keys, unCurrentTradeOriginGoods);
12712
+ onChangeSelectedKeys(keys.concat(unCurrentTradeOriginGoods));
12713
+ };
12606
12714
  var rowSelection = {
12607
12715
  selectedRowKeys: selectedRowKeys,
12608
- onChange: onChangeSelectedKeys
12716
+ onChange: handleChangeSelectedKeys
12609
12717
  };
12610
- console.debug('选择订单商品-dataSource', dataSource, selectedRowKeys);
12611
12718
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
12612
12719
  type: "link",
12613
12720
  onClick: openModal
@@ -12617,7 +12724,7 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
12617
12724
  footer: null,
12618
12725
  onCancel: closeModal
12619
12726
  }, /*#__PURE__*/React__default['default'].createElement(antd.Table, {
12620
- rowKey: "id",
12727
+ rowKey: MAIN_FIELD,
12621
12728
  rowSelection: rowSelection,
12622
12729
  columns: columns,
12623
12730
  dataSource: dataSource,
@@ -12626,7 +12733,17 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
12626
12733
  x: 500,
12627
12734
  y: 500
12628
12735
  }
12629
- }), /*#__PURE__*/React__default['default'].createElement("span", null, "\u5DF2\u9009\u62E9(", selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length, "/", dataSource === null || dataSource === void 0 ? void 0 : dataSource.length, ")")));
12736
+ }), /*#__PURE__*/React__default['default'].createElement("span", null, "\u5DF2\u9009\u62E9(", currentTradeOriginGoods === null || currentTradeOriginGoods === void 0 ? void 0 : currentTradeOriginGoods.length, "/", dataSource === null || dataSource === void 0 ? void 0 : dataSource.length, ")")));
12737
+ };
12738
+ var getButtonText = function getButtonText() {
12739
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
12740
+ if (['BS_E3_GOODS', 'BS_E3_REISSUE_GOODS', 'BS_E3_EXCHANGE_GOODS'].includes(type)) {
12741
+ return '选择百胜ERP商品';
12742
+ }
12743
+ if (['WDT_REISSUE_GOODS'].includes(type)) {
12744
+ return '选择旺店通商品';
12745
+ }
12746
+ return '选择商品';
12630
12747
  };
12631
12748
  var GoodItem$1 = function GoodItem(props) {
12632
12749
  var _props$value = props.value,
@@ -12683,7 +12800,7 @@ var GoodItem$1 = function GoodItem(props) {
12683
12800
  // TODO: 商品订单中以选中商品
12684
12801
  var selectedGoods = React.useMemo(function () {
12685
12802
  return value === null || value === void 0 ? void 0 : value.map(function (v) {
12686
- return v.id;
12803
+ return v === null || v === void 0 ? void 0 : v[MAIN_FIELD];
12687
12804
  });
12688
12805
  }, [value]);
12689
12806
  var updateHandle = function updateHandle(val, index, columnType) {
@@ -12724,6 +12841,14 @@ var GoodItem$1 = function GoodItem(props) {
12724
12841
  var columns = [];
12725
12842
  switch (type) {
12726
12843
  case 'WDT_REISSUE_GOODS':
12844
+ {
12845
+ columns = getWdtReissueGoodColumns({
12846
+ disabled: disabled,
12847
+ updateHandle: updateHandle,
12848
+ operate: operate
12849
+ });
12850
+ }
12851
+ break;
12727
12852
  case 'WDT_GOODS':
12728
12853
  columns = [{
12729
12854
  dataIndex: 'goodId',
@@ -13229,6 +13354,116 @@ var GoodItem$1 = function GoodItem(props) {
13229
13354
  });
13230
13355
  }
13231
13356
  break;
13357
+ case 'BS_GOODS':
13358
+ columns = [{
13359
+ dataIndex: 'mark',
13360
+ title: "\u5546\u54C1\u6807\u8BB0",
13361
+ align: 'center',
13362
+ ellipsis: true,
13363
+ width: 70,
13364
+ render: function render(val, record, index) {
13365
+ return /*#__PURE__*/React__default['default'].createElement(antd.Select, {
13366
+ options: [{
13367
+ label: '是',
13368
+ value: '是'
13369
+ }, {
13370
+ label: '否',
13371
+ value: '否'
13372
+ }],
13373
+ disabled: disabled,
13374
+ value: val,
13375
+ onChange: function onChange(val) {
13376
+ return updateHandle(val, index, 'mark');
13377
+ }
13378
+ });
13379
+ }
13380
+ }, {
13381
+ dataIndex: 'skuName',
13382
+ title: "".concat(text, "sku\u540D\u79F0"),
13383
+ align: 'center',
13384
+ ellipsis: true,
13385
+ width: 250
13386
+ }, {
13387
+ dataIndex: 'sku',
13388
+ title: "".concat(text, "sku\u7F16\u7801"),
13389
+ align: 'center',
13390
+ ellipsis: true,
13391
+ width: 100
13392
+ }, {
13393
+ dataIndex: 'name',
13394
+ title: "".concat(text, "\u540D\u79F0"),
13395
+ align: 'center',
13396
+ ellipsis: true,
13397
+ width: 250
13398
+ }, {
13399
+ dataIndex: 'pic',
13400
+ title: "\u56FE\u7247",
13401
+ align: 'center',
13402
+ ellipsis: true,
13403
+ width: 100,
13404
+ render: function render(val) {
13405
+ return /*#__PURE__*/React__default['default'].createElement(antd.Image, {
13406
+ width: 60,
13407
+ src: val
13408
+ });
13409
+ }
13410
+ }, {
13411
+ dataIndex: 'code',
13412
+ title: "".concat(text, "\u7F16\u7801"),
13413
+ align: 'center',
13414
+ ellipsis: true,
13415
+ width: 100
13416
+ }, {
13417
+ dataIndex: 'money',
13418
+ title: "\u5B9E\u4ED8\u91D1\u989D",
13419
+ align: 'center',
13420
+ ellipsis: true,
13421
+ width: 100
13422
+ }, {
13423
+ dataIndex: 'number',
13424
+ title: "".concat(text, "\u6570\u91CF"),
13425
+ align: 'center',
13426
+ ellipsis: true,
13427
+ width: 100,
13428
+ render: function render(val, record, index) {
13429
+ return record.canUpdateNumber && !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
13430
+ style: {
13431
+ width: 70
13432
+ },
13433
+ value: val,
13434
+ min: 1,
13435
+ precision: 0,
13436
+ onChange: function onChange(num) {
13437
+ return updateHandle(num, index, 'number');
13438
+ }
13439
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
13440
+ }
13441
+ }, {
13442
+ dataIndex: 'share',
13443
+ title: "\u5206\u644A\u4EF7",
13444
+ align: 'center',
13445
+ ellipsis: true,
13446
+ width: 70
13447
+ }, {
13448
+ dataIndex: 'type',
13449
+ title: "\u8D60\u54C1\u7C7B\u578B",
13450
+ align: 'center',
13451
+ ellipsis: true,
13452
+ width: 100
13453
+ }, {
13454
+ dataIndex: 'batch',
13455
+ title: "\u6279\u6B21\u53F7",
13456
+ align: 'center',
13457
+ ellipsis: true,
13458
+ width: 100
13459
+ }, {
13460
+ dataIndex: 'expireDate',
13461
+ title: "\u6709\u6548\u671F",
13462
+ align: 'center',
13463
+ ellipsis: true,
13464
+ width: 100
13465
+ }];
13466
+ break;
13232
13467
  default:
13233
13468
  columns = [{
13234
13469
  dataIndex: 'mark',
@@ -13497,7 +13732,7 @@ var GoodItem$1 = function GoodItem(props) {
13497
13732
  }), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
13498
13733
  type: "link",
13499
13734
  onClick: handleChangeGoods
13500
- }, ['BS_E3_GOODS', 'BS_E3_REISSUE_GOODS', 'BS_E3_EXCHANGE_GOODS'].includes(type) ? '选择百胜ERP商品' : '选择商品'), otherOperations), /*#__PURE__*/React__default['default'].createElement(antd.Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
13735
+ }, getButtonText(type)), otherOperations), /*#__PURE__*/React__default['default'].createElement(antd.Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
13501
13736
  columns: newColumns,
13502
13737
  dataSource: value,
13503
13738
  rowKey: 'uuid',
@@ -15176,7 +15411,7 @@ var typeMap$1 = {
15176
15411
  }
15177
15412
  };
15178
15413
  var wdtReissue = function wdtReissue(props) {
15179
- var _value$wdtSystemOrder, _typeMap$type24, _typeMap$type25, _value$typeMap$type$s5, _typeMap$type26, _typeMap$type27, _typeMap$type28;
15414
+ var _value$wdtSystemOrder, _typeMap$type25, _typeMap$type27, _typeMap$type28, _value$typeMap$type$s5, _typeMap$type29, _typeMap$type30, _typeMap$type31;
15180
15415
  var value = props.value,
15181
15416
  onChange = props.onChange,
15182
15417
  _props$reasonList = props.reasonList,
@@ -15336,11 +15571,20 @@ var wdtReissue = function wdtReissue(props) {
15336
15571
  }
15337
15572
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
15338
15573
  };
15574
+ var selectedGoodsChange = React.useCallback(function (skuList) {
15575
+ var _typeMap$type23, _value, _typeMap$type24;
15576
+ var newValue = _objectSpread2({}, value);
15577
+ newValue["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type23 = typeMap$1[type]) === null || _typeMap$type23 === void 0 ? void 0 : _typeMap$type23.key)] = value === null || value === void 0 ? void 0 : (_value = value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type24 = typeMap$1[type]) === null || _typeMap$type24 === void 0 ? void 0 : _typeMap$type24.key)]) === null || _value === void 0 ? void 0 : _value.filter(function (item) {
15578
+ return skuList.includes(item.id);
15579
+ });
15580
+ console.log('newValue', newValue);
15581
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
15582
+ }, [value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type25 = typeMap$1[type]) === null || _typeMap$type25 === void 0 ? void 0 : _typeMap$type25.key)]]);
15339
15583
  //显示选择商品按钮 原单换不显示选择商品
15340
15584
  var showChangeBtn = React.useMemo(function () {
15341
- var _typeMap$type23;
15342
- return !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type23 = typeMap$1[type]) === null || _typeMap$type23 === void 0 ? void 0 : _typeMap$type23.systemOrderNo]);
15343
- }, [value === null || value === void 0 ? void 0 : value[(_typeMap$type24 = typeMap$1[type]) === null || _typeMap$type24 === void 0 ? void 0 : _typeMap$type24.systemOrderNo]]);
15585
+ var _typeMap$type26;
15586
+ return !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type26 = typeMap$1[type]) === null || _typeMap$type26 === void 0 ? void 0 : _typeMap$type26.systemOrderNo]);
15587
+ }, [value === null || value === void 0 ? void 0 : value[(_typeMap$type27 = typeMap$1[type]) === null || _typeMap$type27 === void 0 ? void 0 : _typeMap$type27.systemOrderNo]]);
15344
15588
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Row, {
15345
15589
  gutter: 8,
15346
15590
  wrap: true
@@ -15358,12 +15602,12 @@ var wdtReissue = function wdtReissue(props) {
15358
15602
  },
15359
15603
  disabled: disabled,
15360
15604
  allowClear: false,
15361
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type25 = typeMap$1[type]) === null || _typeMap$type25 === void 0 ? void 0 : _typeMap$type25.systemOrderNo)],
15605
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type28 = typeMap$1[type]) === null || _typeMap$type28 === void 0 ? void 0 : _typeMap$type28.systemOrderNo)],
15362
15606
  onChange: function onChange(val) {
15363
15607
  return changeSystemOrderHandle(val);
15364
15608
  },
15365
15609
  placeholder: "\u9009\u62E9\u8865\u53D1\u7CFB\u7EDF\u5355"
15366
- }, ((value === null || value === void 0 ? void 0 : (_value$typeMap$type$s5 = value[(_typeMap$type26 = typeMap$1[type]) === null || _typeMap$type26 === void 0 ? void 0 : _typeMap$type26.systemOrder]) === null || _value$typeMap$type$s5 === void 0 ? void 0 : _value$typeMap$type$s5.showOrderInfo) || []).map(function (item) {
15610
+ }, ((value === null || value === void 0 ? void 0 : (_value$typeMap$type$s5 = value[(_typeMap$type29 = typeMap$1[type]) === null || _typeMap$type29 === void 0 ? void 0 : _typeMap$type29.systemOrder]) === null || _value$typeMap$type$s5 === void 0 ? void 0 : _value$typeMap$type$s5.showOrderInfo) || []).map(function (item) {
15367
15611
  return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
15368
15612
  key: item.billNo,
15369
15613
  value: item.billNo,
@@ -15384,7 +15628,7 @@ var wdtReissue = function wdtReissue(props) {
15384
15628
  disabled: disabled,
15385
15629
  allowClear: false,
15386
15630
  options: reasonList,
15387
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type27 = typeMap$1[type]) === null || _typeMap$type27 === void 0 ? void 0 : _typeMap$type27.typeName)],
15631
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type30 = typeMap$1[type]) === null || _typeMap$type30 === void 0 ? void 0 : _typeMap$type30.typeName)],
15388
15632
  onChange: function onChange(val) {
15389
15633
  return changeTypeHandle(val);
15390
15634
  }
@@ -15396,13 +15640,19 @@ var wdtReissue = function wdtReissue(props) {
15396
15640
  canUpdateNumber: showChangeBtn,
15397
15641
  showChangeBtn: showChangeBtn,
15398
15642
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
15399
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type28 = typeMap$1[type]) === null || _typeMap$type28 === void 0 ? void 0 : _typeMap$type28.key)],
15643
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$1 === null || typeMap$1 === void 0 ? void 0 : (_typeMap$type31 = typeMap$1[type]) === null || _typeMap$type31 === void 0 ? void 0 : _typeMap$type31.key)],
15400
15644
  onChange: function onChange(val) {
15401
15645
  return changeGoodHandle(val);
15402
15646
  },
15403
15647
  onModeChange: handleModeChange,
15404
15648
  showModeBtn: showModeBtn,
15405
- isStrict: isStrict
15649
+ isStrict: isStrict,
15650
+ tradeGoods: {
15651
+ originDataSource: getGoodDetails({
15652
+ mode: isStrict
15653
+ }),
15654
+ selectedGoodsChange: selectedGoodsChange
15655
+ }
15406
15656
  })));
15407
15657
  };
15408
15658
 
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ type P = {
3
+ disabled: boolean | undefined;
4
+ updateHandle: (v: any, index: number, key: string) => void;
5
+ operate?: boolean;
6
+ };
7
+ export declare const getWdtReissueGoodColumns: ({ disabled, updateHandle, operate }: P) => ({
8
+ dataIndex: string;
9
+ title: string;
10
+ width: number;
11
+ align: string;
12
+ ellipsis: boolean;
13
+ } | {
14
+ render: (val: any, record: any, index: number) => React.JSX.Element;
15
+ dataIndex: string;
16
+ title: string;
17
+ width: number;
18
+ align: string;
19
+ ellipsis: boolean;
20
+ })[];
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "1.22.1-beta.0",
3
+ "version": "1.22.1-beta.10",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -11,16 +11,16 @@
11
11
  "dist"
12
12
  ],
13
13
  "scripts": {
14
- "sync": "yarn build && yalc push",
15
14
  "build": "yarn lint && father-build",
16
15
  "lint": "eslint '**/*.{ts,tsx}'",
17
16
  "lint:fix": "eslint --fix '**/*.{ts,tsx}'",
18
17
  "start": "dumi dev",
18
+ "sync": "yarn build && yalc push",
19
19
  "test": "jest",
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "1.22.1-beta.0",
23
+ "@kmkf-fe-packages/kmkf-utils": "1.22.1-beta.10",
24
24
  "ahooks": "^3.7.4",
25
25
  "bignumber.js": "^9.1.2",
26
26
  "kmkf-monitor": "^0.8.9",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "0fe6eb2f00f1a864386cb87e5a1494cb6564fcae"
68
+ "gitHead": "143523e8020568c583dfb07a1044dc12ade967ee"
69
69
  }