@kmkf-fe-packages/basic-components 1.0.5 → 1.0.6-rc.4

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,5 @@ yarn start
17
17
  - business 快麦工单业务组件
18
18
  - common 公共组件
19
19
  - config 公共方法
20
- - assets 静态资源
20
+ - assets 静态资源
21
+ -
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"];
@@ -11662,9 +11663,34 @@ var GoodItem$1 = function GoodItem(props) {
11662
11663
  useEffect(function () {
11663
11664
  setSelectedRowKeys([]);
11664
11665
  }, [tableSelect, selectType]);
11665
- var updateHandle = function updateHandle(val, index, type) {
11666
+ var updateHandle = function updateHandle(val, index, columnType) {
11666
11667
  if (value === null || value === void 0 ? void 0 : value.length) {
11667
- value[index][type] = val;
11668
+ value[index][columnType] = val;
11669
+ if (type === 'WDT_RETURN_GOODS') {
11670
+ if (['sharePrice', 'num'].includes(columnType)) {
11671
+ var totalMoney = null;
11672
+ if (columnType === 'num') {
11673
+ totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].sharePrice));
11674
+ } else {
11675
+ totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].num));
11676
+ }
11677
+ if (totalMoney !== null) {
11678
+ value[index]['returnPrice'] = totalMoney.toString();
11679
+ }
11680
+ }
11681
+ } else if (type === 'WDT_EXCHANGE_GOODS') {
11682
+ if (['price', 'num'].includes(columnType)) {
11683
+ var _totalMoney = null;
11684
+ if (columnType === 'num') {
11685
+ _totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].price));
11686
+ } else {
11687
+ _totalMoney = new BigNumber(value[index][columnType]).multipliedBy(new BigNumber(value[index].num));
11688
+ }
11689
+ if (_totalMoney !== null) {
11690
+ value[index]['exchangePrice'] = _totalMoney.toString();
11691
+ }
11692
+ }
11693
+ }
11668
11694
  onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(value));
11669
11695
  }
11670
11696
  };
@@ -11770,6 +11796,260 @@ var GoodItem$1 = function GoodItem(props) {
11770
11796
  }
11771
11797
  }];
11772
11798
  break;
11799
+ case 'WDT_RETURN_GOODS':
11800
+ {
11801
+ columns = [{
11802
+ dataIndex: 'goodId',
11803
+ title: "SPUID",
11804
+ align: 'center',
11805
+ ellipsis: true,
11806
+ width: 70
11807
+ }, {
11808
+ dataIndex: 'goodNo',
11809
+ title: "\u5546\u54C1SPU\u7F16\u7801",
11810
+ align: 'center',
11811
+ ellipsis: true,
11812
+ width: 180
11813
+ }, {
11814
+ dataIndex: 'goodName',
11815
+ title: "".concat(text, "\u5546\u54C1\u540D\u79F0"),
11816
+ align: 'center',
11817
+ ellipsis: true,
11818
+ width: 250
11819
+ }, {
11820
+ dataIndex: 'specId',
11821
+ title: "".concat(text, "SKUID"),
11822
+ align: 'center',
11823
+ ellipsis: true,
11824
+ width: 100
11825
+ }, {
11826
+ dataIndex: 'specNo',
11827
+ title: "".concat(text, "\u5546\u54C1SKU\u7F16\u7801"),
11828
+ align: 'center',
11829
+ ellipsis: true,
11830
+ width: 180
11831
+ }, {
11832
+ dataIndex: 'specName',
11833
+ title: "".concat(text, "\u5546\u54C1SKU\u540D\u79F0"),
11834
+ align: 'center',
11835
+ ellipsis: true,
11836
+ width: 250
11837
+ }, {
11838
+ dataIndex: 'num',
11839
+ title: "".concat(text, "\u9000\u8D27\u6570\u91CF"),
11840
+ align: 'center',
11841
+ ellipsis: true,
11842
+ width: 100,
11843
+ render: function render(val, record, index) {
11844
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11845
+ style: {
11846
+ width: 70
11847
+ },
11848
+ value: val,
11849
+ min: 0,
11850
+ precision: 0,
11851
+ onChange: function onChange(num) {
11852
+ return updateHandle(num, index, 'num');
11853
+ }
11854
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11855
+ }
11856
+ }, {
11857
+ dataIndex: 'sharePrice',
11858
+ title: "\u5206\u644A\u4EF7",
11859
+ align: 'center',
11860
+ ellipsis: true,
11861
+ width: 80,
11862
+ render: function render(val, record, index) {
11863
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11864
+ style: {
11865
+ width: 70
11866
+ },
11867
+ value: val,
11868
+ min: 0,
11869
+ onChange: function onChange(value) {
11870
+ return updateHandle(value, index, 'sharePrice');
11871
+ }
11872
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11873
+ }
11874
+ }, {
11875
+ dataIndex: 'returnPrice',
11876
+ title: "".concat(text, "\u9000\u8D27\u91D1\u989D"),
11877
+ align: 'center',
11878
+ ellipsis: true,
11879
+ width: 100
11880
+ }, {
11881
+ dataIndex: 'giftType',
11882
+ title: "\u8D60\u54C1\u65B9\u5F0F",
11883
+ align: 'center',
11884
+ ellipsis: true,
11885
+ width: 100,
11886
+ render: function render(val) {
11887
+ var giftTypeMap = {
11888
+ 0: '非赠品',
11889
+ 1: '自动赠送',
11890
+ 2: '手工赠送',
11891
+ 3: '回购自动送赠品',
11892
+ 4: '前N有礼送赠品',
11893
+ 6: '天猫优仓赠品',
11894
+ 7: '淘宝CRM会员送赠'
11895
+ };
11896
+ return /*#__PURE__*/React.createElement("span", null, giftTypeMap[val]);
11897
+ }
11898
+ }, {
11899
+ dataIndex: 'productType',
11900
+ title: "".concat(text, "\u5546\u54C1\u7C7B\u578B"),
11901
+ align: 'center',
11902
+ ellipsis: true,
11903
+ width: 100,
11904
+ render: function render(val, record, index) {
11905
+ var options = [{
11906
+ label: '单品',
11907
+ value: '1'
11908
+ }, {
11909
+ label: '组合装',
11910
+ value: '2'
11911
+ }];
11912
+ return !disabled ? /*#__PURE__*/React.createElement(Select, {
11913
+ style: {
11914
+ width: 70
11915
+ },
11916
+ options: options,
11917
+ value: val,
11918
+ onChange: function onChange(value) {
11919
+ return updateHandle(value, index, 'productType');
11920
+ }
11921
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11922
+ }
11923
+ }];
11924
+ }
11925
+ break;
11926
+ case 'WDT_EXCHANGE_GOODS':
11927
+ {
11928
+ columns = [{
11929
+ dataIndex: 'goodId',
11930
+ title: "SPUID",
11931
+ align: 'center',
11932
+ ellipsis: true,
11933
+ width: 70
11934
+ }, {
11935
+ dataIndex: 'goodNo',
11936
+ title: "\u5546\u54C1SPU\u7F16\u7801",
11937
+ align: 'center',
11938
+ ellipsis: true,
11939
+ width: 180
11940
+ }, {
11941
+ dataIndex: 'goodName',
11942
+ title: "".concat(text, "\u5546\u54C1\u540D\u79F0"),
11943
+ align: 'center',
11944
+ ellipsis: true,
11945
+ width: 250
11946
+ }, {
11947
+ dataIndex: 'specId',
11948
+ title: "".concat(text, "SKUID"),
11949
+ align: 'center',
11950
+ ellipsis: true,
11951
+ width: 100
11952
+ }, {
11953
+ dataIndex: 'specNo',
11954
+ title: "".concat(text, "\u5546\u54C1SKU\u7F16\u7801"),
11955
+ align: 'center',
11956
+ ellipsis: true,
11957
+ width: 180
11958
+ }, {
11959
+ dataIndex: 'specName',
11960
+ title: "".concat(text, "\u5546\u54C1SKU\u540D\u79F0"),
11961
+ align: 'center',
11962
+ ellipsis: true,
11963
+ width: 250
11964
+ }, {
11965
+ dataIndex: 'num',
11966
+ title: "".concat(text, "\u6362\u51FA\u6570\u91CF"),
11967
+ align: 'center',
11968
+ ellipsis: true,
11969
+ width: 100,
11970
+ render: function render(val, record, index) {
11971
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11972
+ style: {
11973
+ width: 70
11974
+ },
11975
+ value: val,
11976
+ min: 0,
11977
+ precision: 0,
11978
+ onChange: function onChange(num) {
11979
+ return updateHandle(num, index, 'num');
11980
+ }
11981
+ }) : /*#__PURE__*/React.createElement("span", null, val);
11982
+ }
11983
+ }, {
11984
+ dataIndex: 'price',
11985
+ title: "".concat(text, "\u5546\u54C1\u5355\u4EF7"),
11986
+ align: 'center',
11987
+ ellipsis: true,
11988
+ width: 100,
11989
+ render: function render(val, record, index) {
11990
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
11991
+ style: {
11992
+ width: 70
11993
+ },
11994
+ value: val,
11995
+ min: 0,
11996
+ onChange: function onChange(value) {
11997
+ return updateHandle(value, index, 'price');
11998
+ }
11999
+ }) : /*#__PURE__*/React.createElement("span", null, val);
12000
+ }
12001
+ }, {
12002
+ dataIndex: 'exchangePrice',
12003
+ title: "".concat(text, "\u6362\u51FA\u91D1\u989D"),
12004
+ align: 'center',
12005
+ ellipsis: true,
12006
+ width: 100
12007
+ }, {
12008
+ dataIndex: 'giftType',
12009
+ title: "\u8D60\u54C1\u65B9\u5F0F",
12010
+ align: 'center',
12011
+ ellipsis: true,
12012
+ width: 100,
12013
+ render: function render(val) {
12014
+ var giftTypeMap = {
12015
+ 0: '非赠品',
12016
+ 1: '自动赠送',
12017
+ 2: '手工赠送',
12018
+ 3: '回购自动送赠品',
12019
+ 4: '前N有礼送赠品',
12020
+ 6: '天猫优仓赠品',
12021
+ 7: '淘宝CRM会员送赠'
12022
+ };
12023
+ return /*#__PURE__*/React.createElement("span", null, giftTypeMap[val]);
12024
+ }
12025
+ }, {
12026
+ dataIndex: 'productType',
12027
+ title: "".concat(text, "\u5546\u54C1\u7C7B\u578B"),
12028
+ align: 'center',
12029
+ ellipsis: true,
12030
+ width: 100,
12031
+ render: function render(val, record, index) {
12032
+ var options = [{
12033
+ label: '单品',
12034
+ value: '1'
12035
+ }, {
12036
+ label: '组合装',
12037
+ value: '2'
12038
+ }];
12039
+ return !disabled ? /*#__PURE__*/React.createElement(Select, {
12040
+ style: {
12041
+ width: 70
12042
+ },
12043
+ options: options,
12044
+ value: val,
12045
+ onChange: function onChange(value) {
12046
+ return updateHandle(value, index, 'productType');
12047
+ }
12048
+ }) : /*#__PURE__*/React.createElement("span", null, val);
12049
+ }
12050
+ }];
12051
+ }
12052
+ break;
11773
12053
  default:
11774
12054
  columns = [{
11775
12055
  dataIndex: 'mark',
@@ -11911,7 +12191,7 @@ var GoodItem$1 = function GoodItem(props) {
11911
12191
  }, [showHeader, value, disabled]);
11912
12192
  var onSubmit = function onSubmit(list) {
11913
12193
  var newList = [];
11914
- if (['WDT_REISSUE_GOODS', 'WDT_GOODS'].includes(type)) {
12194
+ if (['WDT_REISSUE_GOODS', 'WDT_GOODS', 'WDT_EXCHANGE_GOODS'].includes(type)) {
11915
12195
  newList = list.map(function (item) {
11916
12196
  item.uuid = uuid();
11917
12197
  item.canDelete = true;
@@ -11919,6 +12199,10 @@ var GoodItem$1 = function GoodItem(props) {
11919
12199
  item.orderPrice = 0;
11920
12200
  item.sharePrice = 0;
11921
12201
  item.canUpdateNumber = canUpdateNumber;
12202
+ if (type === 'WDT_EXCHANGE_GOODS') {
12203
+ item.price = item.retailPrice;
12204
+ item.productType = '1';
12205
+ }
11922
12206
  return item;
11923
12207
  });
11924
12208
  } else {
@@ -11989,7 +12273,7 @@ var GoodItem$1 = function GoodItem(props) {
11989
12273
  locale: {
11990
12274
  emptyText: '暂无数据'
11991
12275
  }
11992
- })), ['WDT_REISSUE_GOODS', 'WDT_GOODS'].includes(type) ? /*#__PURE__*/React.createElement(WdtGoodsModal, {
12276
+ })), ['WDT_REISSUE_GOODS', 'WDT_GOODS', 'WDT_EXCHANGE_GOODS'].includes(type) ? /*#__PURE__*/React.createElement(WdtGoodsModal, {
11993
12277
  ref: refModal,
11994
12278
  onSubmit: onSubmit,
11995
12279
  width: width,
@@ -12859,8 +13143,10 @@ var componentMap$1 = {
12859
13143
  reissueType: 'wdtReissueType',
12860
13144
  returnType: 'wdtReturnType',
12861
13145
  returnSelectListReturn: 'wdtReturnSelectListReturn',
13146
+ returnSelectList: 'wdtReturnSelectList',
12862
13147
  deleteGood: 'wdtDeleteGood',
12863
- returnDeleteGood: 'wdtReturnDeleteGood'
13148
+ returnDeleteGood: 'wdtReturnDeleteGood',
13149
+ exchangeDeleteGood: 'wdtExchangeDeleteGood'
12864
13150
  }
12865
13151
  }
12866
13152
  };
@@ -12927,7 +13213,7 @@ var CommonGoods = function CommonGoods(props) {
12927
13213
  setTableSelect(['2', '4'].includes(data.val));
12928
13214
  if (['1', '3'].includes(data.val)) {
12929
13215
  var _valueRef$current5, _valueRef$current6;
12930
- pubsub.publish(componentMap$1[type].eventNameMap.returnSelectListReturn, {
13216
+ pubsub.publish(componentMap$1[compType].eventNameMap.returnSelectListReturn, {
12931
13217
  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]) || []),
12932
13218
  shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current6 = valueRef.current) === null || _valueRef$current6 === void 0 ? void 0 : _valueRef$current6.shopCode,
12933
13219
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
@@ -12945,15 +13231,15 @@ var CommonGoods = function CommonGoods(props) {
12945
13231
  };
12946
13232
  }, [disabled]);
12947
13233
  var _onSelect = function onSelect(list) {
12948
- var _withInfo$current, _withInfo$current2, _valueRef$current7;
13234
+ var _typeMap, _withInfo$current, _withInfo$current2, _valueRef$current7;
12949
13235
  if (disabled) return;
12950
13236
  var newList = cloneDeep(list);
12951
- var typeMap = _defineProperty({
13237
+ var typeMap = (_typeMap = {
12952
13238
  // type: componentMap[compType].eventNameMap.selectList,
12953
13239
  // returnType: componentMap[compType].eventNameMap.returnSelectList,
12954
13240
  // reissueType: componentMap[compType].eventNameMap.reissueSelectList,
12955
13241
  type: componentMap$1[compType].eventNameMap.selectList
12956
- }, "".concat(componentMap$1[compType].type, "ReissueType"), componentMap$1[compType].eventNameMap.reissueSelectList);
13242
+ }, _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);
12957
13243
  var type = typeMap[(_withInfo$current = withInfo.current) === null || _withInfo$current === void 0 ? void 0 : _withInfo$current.type];
12958
13244
  // console.log('onSelect', type, withInfo.current, newList);
12959
13245
  pubsub.publish(type, {
@@ -12971,6 +13257,7 @@ var CommonGoods = function CommonGoods(props) {
12971
13257
  pubsub.publish(componentMap$1[compType].eventNameMap.deleteGood, deleteId);
12972
13258
  pubsub.publish(componentMap$1[compType].eventNameMap.reissueDeleteGood, deleteId);
12973
13259
  pubsub.publish(componentMap$1[compType].eventNameMap.returnDeleteGood, deleteId);
13260
+ pubsub.publish(componentMap$1[compType].eventNameMap.exchangeDeleteGood, deleteId);
12974
13261
  };
12975
13262
  var changeHandle = function changeHandle(list) {
12976
13263
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, componentMap$1[compType].key, list)));
@@ -12995,6 +13282,257 @@ var CommonGoods = function CommonGoods(props) {
12995
13282
  }));
12996
13283
  };
12997
13284
 
13285
+ var componentMap$2 = {
13286
+ 'WDT_RETURN_GOODS': {
13287
+ type: 'wdt',
13288
+ valueKey: 'wdtReturnGoods',
13289
+ returnTypeKey: 'wdtReturnType',
13290
+ name: '旺店通',
13291
+ eventNameMap: {
13292
+ changeShopCode: 'wdtChangeShopCode',
13293
+ returnType: 'wdtReturnType',
13294
+ returnSelectListReturn: 'wdtReturnSelectListReturn',
13295
+ returnDeleteGood: 'wdtReturnDeleteGood',
13296
+ returnSelectList: 'wdtReturnSelectList',
13297
+ exchangeCopyGood: 'wdtExchangeCopyGood',
13298
+ exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
13299
+ }
13300
+ }
13301
+ };
13302
+ var CommonReturnGoods = function CommonReturnGoods(props) {
13303
+ var value = props.value,
13304
+ onChange = props.onChange,
13305
+ _props$reasonList = props.reasonList,
13306
+ reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
13307
+ disabled = props.disabled,
13308
+ compType = props.type;
13309
+ var valueRef = useRef({});
13310
+ useEffect(function () {
13311
+ var subscription = pubsub.subscribe(componentMap$2[compType].eventNameMap.exchangeCopyGood, function () {
13312
+ var _valueRef$current, _valueRef$current2;
13313
+ pubsub.publish(componentMap$2[compType].eventNameMap.exchangeBackCopyGood, {
13314
+ 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]) || []),
13315
+ shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode
13316
+ });
13317
+ });
13318
+ return function () {
13319
+ pubsub.unsubscribe(subscription);
13320
+ };
13321
+ }, []);
13322
+ useEffect(function () {
13323
+ var subscription = pubsub.subscribe(componentMap$2[compType].eventNameMap.returnSelectList, function (_, data) {
13324
+ if (disabled) return;
13325
+ var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
13326
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13327
+ });
13328
+ if (compType === 'WDT_RETURN_GOODS') {
13329
+ newValue[componentMap$2[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13330
+ if (typeof item.productType === 'undefined') {
13331
+ item.productType = '1';
13332
+ }
13333
+ if (typeof item.returnPrice === 'undefined') {
13334
+ item.returnPrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.sharePrice)).toString();
13335
+ }
13336
+ return item;
13337
+ });
13338
+ } else {
13339
+ newValue[componentMap$2[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13340
+ }
13341
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13342
+ });
13343
+ return function () {
13344
+ pubsub.unsubscribe(subscription);
13345
+ };
13346
+ }, []);
13347
+ useEffect(function () {
13348
+ var subscription = pubsub.subscribe(componentMap$2[compType].eventNameMap.returnSelectListReturn, function (_, data) {
13349
+ if (disabled) return;
13350
+ var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
13351
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13352
+ });
13353
+ if (compType === 'WDT_RETURN_GOODS') {
13354
+ newValue[componentMap$2[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13355
+ if (typeof item.productType === 'undefined') {
13356
+ item.productType = '1';
13357
+ }
13358
+ if (typeof item.returnPrice === 'undefined') {
13359
+ item.returnPrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.sharePrice)).toString();
13360
+ }
13361
+ return item;
13362
+ });
13363
+ } else {
13364
+ newValue[componentMap$2[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13365
+ }
13366
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13367
+ });
13368
+ return function () {
13369
+ pubsub.unsubscribe(subscription);
13370
+ };
13371
+ }, []);
13372
+ useEffect(function () {
13373
+ valueRef.current = value;
13374
+ pubsub.subscribeOnce(componentMap$2[compType].eventNameMap.returnDeleteGood, function (_, data) {
13375
+ if (disabled) return;
13376
+ if (value) {
13377
+ var newValue = _objectSpread2({}, value);
13378
+ newValue[componentMap$2[compType].valueKey] = newValue[componentMap$2[compType].valueKey].filter(function (item) {
13379
+ return item.sku !== data;
13380
+ });
13381
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13382
+ }
13383
+ });
13384
+ pubsub.subscribeOnce(componentMap$2[compType].eventNameMap.changeShopCode, function (type, data) {
13385
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13386
+ shopCode: data.shopCode
13387
+ }));
13388
+ });
13389
+ }, [value, disabled]);
13390
+ var changeTypeHandle = function changeTypeHandle(val) {
13391
+ var newValue = _objectSpread2({}, value);
13392
+ newValue[componentMap$2[compType].returnTypeKey] = val;
13393
+ newValue[componentMap$2[compType].valueKey] = [];
13394
+ if (['2'].includes(val[0])) {
13395
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13396
+ valueRef.current = newValue;
13397
+ }
13398
+ pubsub.publish(componentMap$2[compType].eventNameMap.returnType, {
13399
+ val: val[0],
13400
+ goodValue: newValue
13401
+ });
13402
+ };
13403
+ var changeGoodHandle = function changeGoodHandle(val) {
13404
+ var newValue = _objectSpread2({}, value);
13405
+ newValue[componentMap$2[compType].valueKey] = val;
13406
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13407
+ };
13408
+ //显示选择商品按钮 原单换不显示选择商品
13409
+ // const showChangeBtn = useMemo(() => {
13410
+ // return ['2'].includes(value?.[componentMap[compType].returnTypeKey]?.[0]);
13411
+ // }, [value?.[componentMap[compType].returnTypeKey]]);
13412
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, {
13413
+ style: {
13414
+ marginBottom: '8px'
13415
+ },
13416
+ disabled: disabled,
13417
+ allowClear: false,
13418
+ options: reasonList,
13419
+ value: value === null || value === void 0 ? void 0 : value[componentMap$2[compType].returnTypeKey],
13420
+ onChange: function onChange(val) {
13421
+ return changeTypeHandle(val);
13422
+ }
13423
+ }), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
13424
+ key: componentMap$2[compType].type
13425
+ }, props), {}, {
13426
+ disabled: disabled,
13427
+ canUpdateNumber: true,
13428
+ showChangeBtn: false,
13429
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
13430
+ value: value === null || value === void 0 ? void 0 : value[componentMap$2[compType].valueKey],
13431
+ onChange: function onChange(val) {
13432
+ return changeGoodHandle(val);
13433
+ }
13434
+ })));
13435
+ };
13436
+
13437
+ var componentMap$3 = {
13438
+ 'WDT_EXCHANGE_GOODS': {
13439
+ type: 'wdt',
13440
+ valueKey: 'wdtExchangeGoods',
13441
+ returnTypeKey: 'wdtExchangeType',
13442
+ name: '旺店通',
13443
+ eventNameMap: {
13444
+ changeShopCode: 'wdtChangeShopCode',
13445
+ exchangeDeleteGood: 'wdtExchangeDeleteGood',
13446
+ exchangeCopyGood: 'wdtExchangeCopyGood',
13447
+ exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
13448
+ }
13449
+ }
13450
+ };
13451
+ var CommonExchangeGoods = function CommonExchangeGoods(props) {
13452
+ var value = props.value,
13453
+ onChange = props.onChange,
13454
+ disabled = props.disabled,
13455
+ compType = props.type;
13456
+ var valueRef = useRef({});
13457
+ useEffect(function () {
13458
+ var subscription = pubsub.subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
13459
+ if (disabled) return;
13460
+ var newValue = {
13461
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13462
+ };
13463
+ if (compType === 'WDT_EXCHANGE_GOODS') {
13464
+ newValue[componentMap$3[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13465
+ if (typeof item.productType === 'undefined') {
13466
+ item.productType = '1';
13467
+ }
13468
+ item.price = item.sharePrice;
13469
+ if (typeof item.exchangePrice === 'undefined') {
13470
+ item.exchangePrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.price)).toString();
13471
+ }
13472
+ return item;
13473
+ });
13474
+ } else {
13475
+ newValue[componentMap$3[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13476
+ }
13477
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13478
+ });
13479
+ return function () {
13480
+ pubsub.unsubscribe(subscription);
13481
+ };
13482
+ });
13483
+ useEffect(function () {
13484
+ valueRef.current = value;
13485
+ pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.exchangeDeleteGood, function (_, data) {
13486
+ if (disabled) return;
13487
+ if (value) {
13488
+ var newValue = _objectSpread2({}, value);
13489
+ newValue[componentMap$3[compType].valueKey] = newValue[componentMap$3[compType].valueKey].filter(function (item) {
13490
+ return item.sku !== data;
13491
+ });
13492
+ onChange(newValue);
13493
+ }
13494
+ });
13495
+ pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.changeShopCode, function (type, data) {
13496
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13497
+ shopCode: data.shopCode
13498
+ }));
13499
+ });
13500
+ }, [value]);
13501
+ var changeGoodHandle = function changeGoodHandle(val) {
13502
+ var newValue = _objectSpread2({}, value);
13503
+ if (compType === 'WDT_EXCHANGE_GOODS') {
13504
+ val = val.map(function (item) {
13505
+ item.exchangePrice = new BigNumber(item.num).multipliedBy(new BigNumber(item.price)).toString();
13506
+ return item;
13507
+ });
13508
+ }
13509
+ newValue[componentMap$3[compType].valueKey] = val;
13510
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13511
+ };
13512
+ var copyGoods = function copyGoods() {
13513
+ var copyHandle = function copyHandle() {
13514
+ pubsub.publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, 'WDT_EXCHANGE_GOODS');
13515
+ };
13516
+ return /*#__PURE__*/React.createElement(Button, {
13517
+ type: "link",
13518
+ onClick: copyHandle
13519
+ }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
13520
+ };
13521
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
13522
+ key: componentMap$3[compType].type
13523
+ }, props), {}, {
13524
+ disabled: disabled,
13525
+ canUpdateNumber: true,
13526
+ showChangeBtn: true,
13527
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
13528
+ value: value === null || value === void 0 ? void 0 : value[componentMap$3[compType].valueKey],
13529
+ otherOperations: copyGoods(),
13530
+ onChange: function onChange(val) {
13531
+ return changeGoodHandle(val);
13532
+ }
13533
+ })));
13534
+ };
13535
+
12998
13536
  var _excluded$g = ["value", "onChange", "reasonList", "disabled", "type"];
12999
13537
  var typeMap$1 = {
13000
13538
  WDT_REISSUE_GOODS: {
@@ -13837,11 +14375,11 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
13837
14375
  },
13838
14376
  value: (_value$changeIndex2 = value[changeIndex]) === null || _value$changeIndex2 === void 0 ? void 0 : _value$changeIndex2.returnGoodsTradeId
13839
14377
  })) : null, type === 3 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
13840
- disabled: true,
14378
+ disabled: disabled,
13841
14379
  placeholder: "\u8BF7\u8F93\u5165\u8865\u53D1\u5355id",
13842
14380
  value: (_value$changeIndex3 = value[changeIndex]) === null || _value$changeIndex3 === void 0 ? void 0 : _value$changeIndex3.billNo
13843
14381
  })) : null, type === 4 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
13844
- disabled: true,
14382
+ disabled: disabled,
13845
14383
  placeholder: "\u8BF7\u8F93\u5165\u6362\u8D27\u5355id",
13846
14384
  value: (_value$changeIndex4 = value[changeIndex]) === null || _value$changeIndex4 === void 0 ? void 0 : _value$changeIndex4.billNo
13847
14385
  })) : null) : null);
@@ -14008,4 +14546,4 @@ var CalculationInput = function CalculationInput(props) {
14008
14546
  }, config === null || config === void 0 ? void 0 : config.unit));
14009
14547
  };
14010
14548
 
14011
- 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 };
14549
+ 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 };