@kmkf-fe-packages/basic-components 0.28.3-beta.0 → 0.29.0-beta.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/README.md CHANGED
@@ -17,4 +17,4 @@ yarn start
17
17
  - business 快麦工单业务组件
18
18
  - common 公共组件
19
19
  - config 公共方法
20
- - assets 静态资源
20
+ - assets 静态资源
package/dist/index.esm.js CHANGED
@@ -8,6 +8,7 @@ import zhCN from 'antd/lib/locale/zh_CN';
8
8
  import { cloneDeep, difference, differenceWith } from 'lodash';
9
9
  import { useDebounceEffect } from 'ahooks';
10
10
  import pubsub from 'pubsub-js';
11
+ import BigNumber from 'bignumber.js';
11
12
 
12
13
  function _iterableToArrayLimit(arr, i) {
13
14
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
@@ -11641,9 +11642,34 @@ var GoodItem$1 = function GoodItem(props) {
11641
11642
  useEffect(function () {
11642
11643
  setSelectedRowKeys([]);
11643
11644
  }, [tableSelect, selectType]);
11644
- var updateHandle = function updateHandle(val, index, type) {
11645
+ var updateHandle = function updateHandle(val, index, columnType) {
11645
11646
  if (value === null || value === void 0 ? void 0 : value.length) {
11646
- value[index][type] = val;
11647
+ value[index][columnType] = val;
11648
+ if (type === 'WDT_RETURN_GOODS') {
11649
+ if (['sharePrice', 'num'].includes(columnType)) {
11650
+ var totalMoney = null;
11651
+ if (columnType === 'num') {
11652
+ totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].sharePrice));
11653
+ } else {
11654
+ totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].num));
11655
+ }
11656
+ if (totalMoney !== null) {
11657
+ value[index]['returnPrice'] = totalMoney.toString();
11658
+ }
11659
+ }
11660
+ } else if (type === 'WDT_EXCHANGE_GOODS') {
11661
+ if (['price', 'num'].includes(columnType)) {
11662
+ var _totalMoney = null;
11663
+ if (columnType === 'num') {
11664
+ _totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].price));
11665
+ } else {
11666
+ _totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].num));
11667
+ }
11668
+ if (_totalMoney !== null) {
11669
+ value[index]['exchangePrice'] = _totalMoney.toString();
11670
+ }
11671
+ }
11672
+ }
11647
11673
  onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(value));
11648
11674
  }
11649
11675
  };
@@ -11749,6 +11775,260 @@ var GoodItem$1 = function GoodItem(props) {
11749
11775
  }
11750
11776
  }];
11751
11777
  break;
11778
+ case 'WDT_RETURN_GOODS':
11779
+ {
11780
+ columns = [{
11781
+ dataIndex: 'goodId',
11782
+ title: "SPUID",
11783
+ align: 'center',
11784
+ ellipsis: true,
11785
+ width: 70
11786
+ }, {
11787
+ dataIndex: 'goodNo',
11788
+ title: "\u5546\u54C1SPU\u7F16\u7801",
11789
+ align: 'center',
11790
+ ellipsis: true,
11791
+ width: 180
11792
+ }, {
11793
+ dataIndex: 'goodName',
11794
+ title: "".concat(text, "\u5546\u54C1\u540D\u79F0"),
11795
+ align: 'center',
11796
+ ellipsis: true,
11797
+ width: 250
11798
+ }, {
11799
+ dataIndex: 'specId',
11800
+ title: "".concat(text, "SKUID"),
11801
+ align: 'center',
11802
+ ellipsis: true,
11803
+ width: 100
11804
+ }, {
11805
+ dataIndex: 'specNo',
11806
+ title: "".concat(text, "\u5546\u54C1SKU\u7F16\u7801"),
11807
+ align: 'center',
11808
+ ellipsis: true,
11809
+ width: 180
11810
+ }, {
11811
+ dataIndex: 'specName',
11812
+ title: "".concat(text, "\u5546\u54C1SKU\u540D\u79F0"),
11813
+ align: 'center',
11814
+ ellipsis: true,
11815
+ width: 250
11816
+ }, {
11817
+ dataIndex: 'num',
11818
+ title: "".concat(text, "\u9000\u8D27\u6570\u91CF"),
11819
+ align: 'center',
11820
+ ellipsis: true,
11821
+ width: 100,
11822
+ render: function render(val, record, index) {
11823
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11824
+ style: {
11825
+ width: 70
11826
+ },
11827
+ value: val,
11828
+ min: 0,
11829
+ precision: 0,
11830
+ onChange: function onChange(num) {
11831
+ return updateHandle(num, index, 'num');
11832
+ }
11833
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11834
+ }
11835
+ }, {
11836
+ dataIndex: 'sharePrice',
11837
+ title: "\u5206\u644A\u4EF7",
11838
+ align: 'center',
11839
+ ellipsis: true,
11840
+ width: 80,
11841
+ render: function render(val, record, index) {
11842
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11843
+ style: {
11844
+ width: 70
11845
+ },
11846
+ value: val,
11847
+ min: 0,
11848
+ onChange: function onChange(value) {
11849
+ return updateHandle(value, index, 'sharePrice');
11850
+ }
11851
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11852
+ }
11853
+ }, {
11854
+ dataIndex: 'returnPrice',
11855
+ title: "".concat(text, "\u9000\u8D27\u91D1\u989D"),
11856
+ align: 'center',
11857
+ ellipsis: true,
11858
+ width: 100
11859
+ }, {
11860
+ dataIndex: 'giftType',
11861
+ title: "\u8D60\u54C1\u65B9\u5F0F",
11862
+ align: 'center',
11863
+ ellipsis: true,
11864
+ width: 100,
11865
+ render: function render(val) {
11866
+ var giftTypeMap = {
11867
+ 0: '非赠品',
11868
+ 1: '自动赠送',
11869
+ 2: '手工赠送',
11870
+ 3: '回购自动送赠品',
11871
+ 4: '前N有礼送赠品',
11872
+ 6: '天猫优仓赠品',
11873
+ 7: '淘宝CRM会员送赠'
11874
+ };
11875
+ return /*#__PURE__*/React.createElement("span", null, giftTypeMap[val]);
11876
+ }
11877
+ }, {
11878
+ dataIndex: 'productType',
11879
+ title: "".concat(text, "\u5546\u54C1\u7C7B\u578B"),
11880
+ align: 'center',
11881
+ ellipsis: true,
11882
+ width: 100,
11883
+ render: function render(val, record, index) {
11884
+ var options = [{
11885
+ label: '单品',
11886
+ value: '1'
11887
+ }, {
11888
+ label: '组合装',
11889
+ value: '2'
11890
+ }];
11891
+ return !disabled ? /*#__PURE__*/React.createElement(Select, {
11892
+ style: {
11893
+ width: 70
11894
+ },
11895
+ options: options,
11896
+ value: val,
11897
+ onChange: function onChange(value) {
11898
+ return updateHandle(value, index, 'productType');
11899
+ }
11900
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11901
+ }
11902
+ }];
11903
+ }
11904
+ break;
11905
+ case 'WDT_EXCHANGE_GOODS':
11906
+ {
11907
+ columns = [{
11908
+ dataIndex: 'goodId',
11909
+ title: "SPUID",
11910
+ align: 'center',
11911
+ ellipsis: true,
11912
+ width: 70
11913
+ }, {
11914
+ dataIndex: 'goodNo',
11915
+ title: "\u5546\u54C1SPU\u7F16\u7801",
11916
+ align: 'center',
11917
+ ellipsis: true,
11918
+ width: 180
11919
+ }, {
11920
+ dataIndex: 'goodName',
11921
+ title: "".concat(text, "\u5546\u54C1\u540D\u79F0"),
11922
+ align: 'center',
11923
+ ellipsis: true,
11924
+ width: 250
11925
+ }, {
11926
+ dataIndex: 'specId',
11927
+ title: "".concat(text, "SKUID"),
11928
+ align: 'center',
11929
+ ellipsis: true,
11930
+ width: 100
11931
+ }, {
11932
+ dataIndex: 'specNo',
11933
+ title: "".concat(text, "\u5546\u54C1SKU\u7F16\u7801"),
11934
+ align: 'center',
11935
+ ellipsis: true,
11936
+ width: 180
11937
+ }, {
11938
+ dataIndex: 'specName',
11939
+ title: "".concat(text, "\u5546\u54C1SKU\u540D\u79F0"),
11940
+ align: 'center',
11941
+ ellipsis: true,
11942
+ width: 250
11943
+ }, {
11944
+ dataIndex: 'num',
11945
+ title: "".concat(text, "\u6362\u51FA\u6570\u91CF"),
11946
+ align: 'center',
11947
+ ellipsis: true,
11948
+ width: 100,
11949
+ render: function render(val, record, index) {
11950
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11951
+ style: {
11952
+ width: 70
11953
+ },
11954
+ value: val,
11955
+ min: 0,
11956
+ precision: 0,
11957
+ onChange: function onChange(num) {
11958
+ return updateHandle(num, index, 'num');
11959
+ }
11960
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11961
+ }
11962
+ }, {
11963
+ dataIndex: 'price',
11964
+ title: "".concat(text, "\u5546\u54C1\u5355\u4EF7"),
11965
+ align: 'center',
11966
+ ellipsis: true,
11967
+ width: 100,
11968
+ render: function render(val, record, index) {
11969
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11970
+ style: {
11971
+ width: 70
11972
+ },
11973
+ value: val,
11974
+ min: 0,
11975
+ onChange: function onChange(value) {
11976
+ return updateHandle(value, index, 'price');
11977
+ }
11978
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11979
+ }
11980
+ }, {
11981
+ dataIndex: 'exchangePrice',
11982
+ title: "".concat(text, "\u6362\u51FA\u91D1\u989D"),
11983
+ align: 'center',
11984
+ ellipsis: true,
11985
+ width: 100
11986
+ }, {
11987
+ dataIndex: 'giftType',
11988
+ title: "\u8D60\u54C1\u65B9\u5F0F",
11989
+ align: 'center',
11990
+ ellipsis: true,
11991
+ width: 100,
11992
+ render: function render(val) {
11993
+ var giftTypeMap = {
11994
+ 0: '非赠品',
11995
+ 1: '自动赠送',
11996
+ 2: '手工赠送',
11997
+ 3: '回购自动送赠品',
11998
+ 4: '前N有礼送赠品',
11999
+ 6: '天猫优仓赠品',
12000
+ 7: '淘宝CRM会员送赠'
12001
+ };
12002
+ return /*#__PURE__*/React.createElement("span", null, giftTypeMap[val]);
12003
+ }
12004
+ }, {
12005
+ dataIndex: 'productType',
12006
+ title: "".concat(text, "\u5546\u54C1\u7C7B\u578B"),
12007
+ align: 'center',
12008
+ ellipsis: true,
12009
+ width: 100,
12010
+ render: function render(val, record, index) {
12011
+ var options = [{
12012
+ label: '单品',
12013
+ value: '1'
12014
+ }, {
12015
+ label: '组合装',
12016
+ value: '2'
12017
+ }];
12018
+ return !disabled ? /*#__PURE__*/React.createElement(Select, {
12019
+ style: {
12020
+ width: 70
12021
+ },
12022
+ options: options,
12023
+ value: val,
12024
+ onChange: function onChange(value) {
12025
+ return updateHandle(value, index, 'productType');
12026
+ }
12027
+ }) : /*#__PURE__*/React.createElement("span", null, val);
12028
+ }
12029
+ }];
12030
+ }
12031
+ break;
11752
12032
  default:
11753
12033
  columns = [{
11754
12034
  dataIndex: 'mark',
@@ -11890,7 +12170,7 @@ var GoodItem$1 = function GoodItem(props) {
11890
12170
  }, [showHeader, value, disabled]);
11891
12171
  var onSubmit = function onSubmit(list) {
11892
12172
  var newList = [];
11893
- if (['WDT_REISSUE_GOODS', 'WDT_GOODS'].includes(type)) {
12173
+ if (['WDT_REISSUE_GOODS', 'WDT_GOODS', 'WDT_EXCHANGE_GOODS'].includes(type)) {
11894
12174
  newList = list.map(function (item) {
11895
12175
  item.uuid = uuid();
11896
12176
  item.canDelete = true;
@@ -11898,6 +12178,10 @@ var GoodItem$1 = function GoodItem(props) {
11898
12178
  item.orderPrice = 0;
11899
12179
  item.sharePrice = 0;
11900
12180
  item.canUpdateNumber = canUpdateNumber;
12181
+ if (type === 'WDT_EXCHANGE_GOODS') {
12182
+ item.price = item.retailPrice;
12183
+ item.productType = '1';
12184
+ }
11901
12185
  return item;
11902
12186
  });
11903
12187
  } else {
@@ -11968,7 +12252,7 @@ var GoodItem$1 = function GoodItem(props) {
11968
12252
  locale: {
11969
12253
  emptyText: '暂无数据'
11970
12254
  }
11971
- })), ['WDT_REISSUE_GOODS', 'WDT_GOODS'].includes(type) ? /*#__PURE__*/React.createElement(WdtGoodsModal, {
12255
+ })), ['WDT_REISSUE_GOODS', 'WDT_GOODS', 'WDT_EXCHANGE_GOODS'].includes(type) ? /*#__PURE__*/React.createElement(WdtGoodsModal, {
11972
12256
  ref: refModal,
11973
12257
  onSubmit: onSubmit,
11974
12258
  width: width,
@@ -12838,8 +13122,10 @@ var componentMap$1 = {
12838
13122
  reissueType: 'wdtReissueType',
12839
13123
  returnType: 'wdtReturnType',
12840
13124
  returnSelectListReturn: 'wdtReturnSelectListReturn',
13125
+ returnSelectList: 'wdtReturnSelectList',
12841
13126
  deleteGood: 'wdtDeleteGood',
12842
- returnDeleteGood: 'wdtReturnDeleteGood'
13127
+ returnDeleteGood: 'wdtReturnDeleteGood',
13128
+ exchangeDeleteGood: 'wdtExchangeDeleteGood'
12843
13129
  }
12844
13130
  }
12845
13131
  };
@@ -12906,7 +13192,7 @@ var CommonGoods = function CommonGoods(props) {
12906
13192
  setTableSelect(['2', '4'].includes(data.val));
12907
13193
  if (['1', '3'].includes(data.val)) {
12908
13194
  var _valueRef$current5, _valueRef$current6;
12909
- pubsub.publish(componentMap$1[type].eventNameMap.returnSelectListReturn, {
13195
+ pubsub.publish(componentMap$1[compType].eventNameMap.returnSelectListReturn, {
12910
13196
  list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current5 = valueRef.current) === null || _valueRef$current5 === void 0 ? void 0 : _valueRef$current5[componentMap$1[compType].key]) || []),
12911
13197
  shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current6 = valueRef.current) === null || _valueRef$current6 === void 0 ? void 0 : _valueRef$current6.shopCode,
12912
13198
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
@@ -12924,15 +13210,15 @@ var CommonGoods = function CommonGoods(props) {
12924
13210
  };
12925
13211
  }, [disabled]);
12926
13212
  var _onSelect = function onSelect(list) {
12927
- var _withInfo$current, _withInfo$current2, _valueRef$current7;
13213
+ var _typeMap, _withInfo$current, _withInfo$current2, _valueRef$current7;
12928
13214
  if (disabled) return;
12929
13215
  var newList = cloneDeep(list);
12930
- var typeMap = _defineProperty({
13216
+ var typeMap = (_typeMap = {
12931
13217
  // type: componentMap[compType].eventNameMap.selectList,
12932
13218
  // returnType: componentMap[compType].eventNameMap.returnSelectList,
12933
13219
  // reissueType: componentMap[compType].eventNameMap.reissueSelectList,
12934
13220
  type: componentMap$1[compType].eventNameMap.selectList
12935
- }, "".concat(componentMap$1[compType].type, "ReissueType"), componentMap$1[compType].eventNameMap.reissueSelectList);
13221
+ }, _defineProperty(_typeMap, "".concat(componentMap$1[compType].type, "ReissueType"), componentMap$1[compType].eventNameMap.reissueSelectList), _defineProperty(_typeMap, "".concat(componentMap$1[compType].type, "ReturnType"), componentMap$1[compType].eventNameMap.returnSelectList), _typeMap);
12936
13222
  var type = typeMap[(_withInfo$current = withInfo.current) === null || _withInfo$current === void 0 ? void 0 : _withInfo$current.type];
12937
13223
  // console.log('onSelect', type, withInfo.current, newList);
12938
13224
  pubsub.publish(type, {
@@ -12950,6 +13236,7 @@ var CommonGoods = function CommonGoods(props) {
12950
13236
  pubsub.publish(componentMap$1[compType].eventNameMap.deleteGood, deleteId);
12951
13237
  pubsub.publish(componentMap$1[compType].eventNameMap.reissueDeleteGood, deleteId);
12952
13238
  pubsub.publish(componentMap$1[compType].eventNameMap.returnDeleteGood, deleteId);
13239
+ pubsub.publish(componentMap$1[compType].eventNameMap.exchangeDeleteGood, deleteId);
12953
13240
  };
12954
13241
  var changeHandle = function changeHandle(list) {
12955
13242
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, componentMap$1[compType].key, list)));
@@ -12974,6 +13261,257 @@ var CommonGoods = function CommonGoods(props) {
12974
13261
  }));
12975
13262
  };
12976
13263
 
13264
+ var componentMap$2 = {
13265
+ 'WDT_RETURN_GOODS': {
13266
+ type: 'wdt',
13267
+ valueKey: 'wdtReturnGoods',
13268
+ returnTypeKey: 'wdtReturnType',
13269
+ name: '旺店通',
13270
+ eventNameMap: {
13271
+ changeShopCode: 'wdtChangeShopCode',
13272
+ returnType: 'wdtReturnType',
13273
+ returnSelectListReturn: 'wdtReturnSelectListReturn',
13274
+ returnDeleteGood: 'wdtReturnDeleteGood',
13275
+ returnSelectList: 'wdtReturnSelectList',
13276
+ exchangeCopyGood: 'wdtExchangeCopyGood',
13277
+ exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
13278
+ }
13279
+ }
13280
+ };
13281
+ var CommonReturnGoods = function CommonReturnGoods(props) {
13282
+ var value = props.value,
13283
+ onChange = props.onChange,
13284
+ _props$reasonList = props.reasonList,
13285
+ reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
13286
+ disabled = props.disabled,
13287
+ compType = props.type;
13288
+ var valueRef = useRef({});
13289
+ useEffect(function () {
13290
+ var subscription = pubsub.subscribe(componentMap$2[compType].eventNameMap.exchangeCopyGood, function () {
13291
+ var _valueRef$current, _valueRef$current2;
13292
+ pubsub.publish(componentMap$2[compType].eventNameMap.exchangeBackCopyGood, {
13293
+ list: cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current[componentMap$2[compType].valueKey]) || []),
13294
+ shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode
13295
+ });
13296
+ });
13297
+ return function () {
13298
+ pubsub.unsubscribe(subscription);
13299
+ };
13300
+ }, []);
13301
+ useEffect(function () {
13302
+ var subscription = pubsub.subscribe(componentMap$2[compType].eventNameMap.returnSelectList, function (_, data) {
13303
+ if (disabled) return;
13304
+ var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
13305
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13306
+ });
13307
+ if (compType === 'WDT_RETURN_GOODS') {
13308
+ newValue[componentMap$2[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13309
+ if (typeof item.productType === 'undefined') {
13310
+ item.productType = '1';
13311
+ }
13312
+ if (typeof item.returnPrice === 'undefined') {
13313
+ item.returnPrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.sharePrice)).toString();
13314
+ }
13315
+ return item;
13316
+ });
13317
+ } else {
13318
+ newValue[componentMap$2[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13319
+ }
13320
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13321
+ });
13322
+ return function () {
13323
+ pubsub.unsubscribe(subscription);
13324
+ };
13325
+ }, []);
13326
+ useEffect(function () {
13327
+ var subscription = pubsub.subscribe(componentMap$2[compType].eventNameMap.returnSelectListReturn, function (_, data) {
13328
+ if (disabled) return;
13329
+ var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
13330
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13331
+ });
13332
+ if (compType === 'WDT_RETURN_GOODS') {
13333
+ newValue[componentMap$2[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13334
+ if (typeof item.productType === 'undefined') {
13335
+ item.productType = '1';
13336
+ }
13337
+ if (typeof item.returnPrice === 'undefined') {
13338
+ item.returnPrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.sharePrice)).toString();
13339
+ }
13340
+ return item;
13341
+ });
13342
+ } else {
13343
+ newValue[componentMap$2[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13344
+ }
13345
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13346
+ });
13347
+ return function () {
13348
+ pubsub.unsubscribe(subscription);
13349
+ };
13350
+ }, []);
13351
+ useEffect(function () {
13352
+ valueRef.current = value;
13353
+ pubsub.subscribeOnce(componentMap$2[compType].eventNameMap.returnDeleteGood, function (_, data) {
13354
+ if (disabled) return;
13355
+ if (value) {
13356
+ var newValue = _objectSpread2({}, value);
13357
+ newValue[componentMap$2[compType].valueKey] = newValue[componentMap$2[compType].valueKey].filter(function (item) {
13358
+ return item.sku !== data;
13359
+ });
13360
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13361
+ }
13362
+ });
13363
+ pubsub.subscribeOnce(componentMap$2[compType].eventNameMap.changeShopCode, function (type, data) {
13364
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13365
+ shopCode: data.shopCode
13366
+ }));
13367
+ });
13368
+ }, [value, disabled]);
13369
+ var changeTypeHandle = function changeTypeHandle(val) {
13370
+ var newValue = _objectSpread2({}, value);
13371
+ newValue[componentMap$2[compType].returnTypeKey] = val;
13372
+ newValue[componentMap$2[compType].valueKey] = [];
13373
+ if (['2'].includes(val[0])) {
13374
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13375
+ valueRef.current = newValue;
13376
+ }
13377
+ pubsub.publish(componentMap$2[compType].eventNameMap.returnType, {
13378
+ val: val[0],
13379
+ goodValue: newValue
13380
+ });
13381
+ };
13382
+ var changeGoodHandle = function changeGoodHandle(val) {
13383
+ var newValue = _objectSpread2({}, value);
13384
+ newValue[componentMap$2[compType].valueKey] = val;
13385
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13386
+ };
13387
+ //显示选择商品按钮 原单换不显示选择商品
13388
+ // const showChangeBtn = useMemo(() => {
13389
+ // return ['2'].includes(value?.[componentMap[compType].returnTypeKey]?.[0]);
13390
+ // }, [value?.[componentMap[compType].returnTypeKey]]);
13391
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, {
13392
+ style: {
13393
+ marginBottom: '8px'
13394
+ },
13395
+ disabled: disabled,
13396
+ allowClear: false,
13397
+ options: reasonList,
13398
+ value: value === null || value === void 0 ? void 0 : value[componentMap$2[compType].returnTypeKey],
13399
+ onChange: function onChange(val) {
13400
+ return changeTypeHandle(val);
13401
+ }
13402
+ }), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
13403
+ key: componentMap$2[compType].type
13404
+ }, props), {}, {
13405
+ disabled: disabled,
13406
+ canUpdateNumber: true,
13407
+ showChangeBtn: false,
13408
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
13409
+ value: value === null || value === void 0 ? void 0 : value[componentMap$2[compType].valueKey],
13410
+ onChange: function onChange(val) {
13411
+ return changeGoodHandle(val);
13412
+ }
13413
+ })));
13414
+ };
13415
+
13416
+ var componentMap$3 = {
13417
+ 'WDT_EXCHANGE_GOODS': {
13418
+ type: 'wdt',
13419
+ valueKey: 'wdtExchangeGoods',
13420
+ returnTypeKey: 'wdtExchangeType',
13421
+ name: '旺店通',
13422
+ eventNameMap: {
13423
+ changeShopCode: 'wdtChangeShopCode',
13424
+ exchangeDeleteGood: 'wdtExchangeDeleteGood',
13425
+ exchangeCopyGood: 'wdtExchangeCopyGood',
13426
+ exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
13427
+ }
13428
+ }
13429
+ };
13430
+ var CommonExchangeGoods = function CommonExchangeGoods(props) {
13431
+ var value = props.value,
13432
+ onChange = props.onChange,
13433
+ disabled = props.disabled,
13434
+ compType = props.type;
13435
+ var valueRef = useRef({});
13436
+ useEffect(function () {
13437
+ var subscription = pubsub.subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
13438
+ if (disabled) return;
13439
+ var newValue = {
13440
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13441
+ };
13442
+ if (compType === 'WDT_EXCHANGE_GOODS') {
13443
+ newValue[componentMap$3[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13444
+ if (typeof item.productType === 'undefined') {
13445
+ item.productType = '1';
13446
+ }
13447
+ item.price = item.sharePrice;
13448
+ if (typeof item.exchangePrice === 'undefined') {
13449
+ item.exchangePrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.price)).toString();
13450
+ }
13451
+ return item;
13452
+ });
13453
+ } else {
13454
+ newValue[componentMap$3[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13455
+ }
13456
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13457
+ });
13458
+ return function () {
13459
+ pubsub.unsubscribe(subscription);
13460
+ };
13461
+ });
13462
+ useEffect(function () {
13463
+ valueRef.current = value;
13464
+ pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.exchangeDeleteGood, function (_, data) {
13465
+ if (disabled) return;
13466
+ if (value) {
13467
+ var newValue = _objectSpread2({}, value);
13468
+ newValue[componentMap$3[compType].valueKey] = newValue[componentMap$3[compType].valueKey].filter(function (item) {
13469
+ return item.sku !== data;
13470
+ });
13471
+ onChange(newValue);
13472
+ }
13473
+ });
13474
+ pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.changeShopCode, function (type, data) {
13475
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13476
+ shopCode: data.shopCode
13477
+ }));
13478
+ });
13479
+ }, [value]);
13480
+ var changeGoodHandle = function changeGoodHandle(val) {
13481
+ var newValue = _objectSpread2({}, value);
13482
+ if (compType === 'WDT_EXCHANGE_GOODS') {
13483
+ val = val.map(function (item) {
13484
+ item.exchangePrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.price)).toString();
13485
+ return item;
13486
+ });
13487
+ }
13488
+ newValue[componentMap$3[compType].valueKey] = val;
13489
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13490
+ };
13491
+ var copyGoods = function copyGoods() {
13492
+ var copyHandle = function copyHandle() {
13493
+ pubsub.publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, 'WDT_EXCHANGE_GOODS');
13494
+ };
13495
+ return /*#__PURE__*/React.createElement(Button, {
13496
+ type: "link",
13497
+ onClick: copyHandle
13498
+ }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
13499
+ };
13500
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
13501
+ key: componentMap$3[compType].type
13502
+ }, props), {}, {
13503
+ disabled: disabled,
13504
+ canUpdateNumber: true,
13505
+ showChangeBtn: true,
13506
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
13507
+ value: value === null || value === void 0 ? void 0 : value[componentMap$3[compType].valueKey],
13508
+ otherOperations: copyGoods(),
13509
+ onChange: function onChange(val) {
13510
+ return changeGoodHandle(val);
13511
+ }
13512
+ })));
13513
+ };
13514
+
12977
13515
  var _excluded$g = ["value", "onChange", "reasonList", "disabled", "type"];
12978
13516
  var typeMap$1 = {
12979
13517
  WDT_REISSUE_GOODS: {
@@ -13803,11 +14341,11 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
13803
14341
  },
13804
14342
  value: (_value$changeIndex2 = value[changeIndex]) === null || _value$changeIndex2 === void 0 ? void 0 : _value$changeIndex2.returnGoodsTradeId
13805
14343
  })) : null, type === 3 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
13806
- disabled: true,
14344
+ disabled: disabled,
13807
14345
  placeholder: "\u8BF7\u8F93\u5165\u8865\u53D1\u5355id",
13808
14346
  value: (_value$changeIndex3 = value[changeIndex]) === null || _value$changeIndex3 === void 0 ? void 0 : _value$changeIndex3.billNo
13809
14347
  })) : null, type === 4 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
13810
- disabled: true,
14348
+ disabled: disabled,
13811
14349
  placeholder: "\u8BF7\u8F93\u5165\u6362\u8D27\u5355id",
13812
14350
  value: (_value$changeIndex4 = value[changeIndex]) === null || _value$changeIndex4 === void 0 ? void 0 : _value$changeIndex4.billNo
13813
14351
  })) : null) : null);
@@ -13974,4 +14512,4 @@ var CalculationInput = function CalculationInput(props) {
13974
14512
  }, config === null || config === void 0 ? void 0 : config.unit));
13975
14513
  };
13976
14514
 
13977
- export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasLogistics, ApaasMultipleSelect, ApaasPosting, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, index as ApaasUploadAsync, ApaasUploadFile, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$1 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonGoods, CommonSystemOrder$1 as CommonMultiStatus, CommonStatus, CommonSystemOrder, ExpressLogistics, Goods, index$2 as GoodsTable, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, LogisticsMoreInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, ParseLogistics, Payment, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, Supplier, TBGoodId, TBGoodSerial, TradeId, WdtGoodList, wdtReissue as WdtReissue, WlnGoods };
14515
+ export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasLogistics, ApaasMultipleSelect, ApaasPosting, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, index as ApaasUploadAsync, ApaasUploadFile, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$1 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonExchangeGoods, CommonGoods, CommonSystemOrder$1 as CommonMultiStatus, CommonReturnGoods, CommonStatus, CommonSystemOrder, ExpressLogistics, Goods, index$2 as GoodsTable, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, LogisticsMoreInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, ParseLogistics, Payment, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, Supplier, TBGoodId, TBGoodSerial, TradeId, WdtGoodList, wdtReissue as WdtReissue, WlnGoods };