@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/dist/index.js CHANGED
@@ -12,6 +12,7 @@ var zhCN = require('antd/lib/locale/zh_CN');
12
12
  var lodash = require('lodash');
13
13
  var ahooks = require('ahooks');
14
14
  var pubsub = require('pubsub-js');
15
+ var BigNumber = require('bignumber.js');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -19,6 +20,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
20
  var request__default = /*#__PURE__*/_interopDefaultLegacy(request);
20
21
  var zhCN__default = /*#__PURE__*/_interopDefaultLegacy(zhCN);
21
22
  var pubsub__default = /*#__PURE__*/_interopDefaultLegacy(pubsub);
23
+ var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
22
24
 
23
25
  function _iterableToArrayLimit(arr, i) {
24
26
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
@@ -11673,9 +11675,34 @@ var GoodItem$1 = function GoodItem(props) {
11673
11675
  React.useEffect(function () {
11674
11676
  setSelectedRowKeys([]);
11675
11677
  }, [tableSelect, selectType]);
11676
- var updateHandle = function updateHandle(val, index, type) {
11678
+ var updateHandle = function updateHandle(val, index, columnType) {
11677
11679
  if (value === null || value === void 0 ? void 0 : value.length) {
11678
- value[index][type] = val;
11680
+ value[index][columnType] = val;
11681
+ if (type === 'WDT_RETURN_GOODS') {
11682
+ if (['sharePrice', 'num'].includes(columnType)) {
11683
+ var totalMoney = null;
11684
+ if (columnType === 'num') {
11685
+ totalMoney = new BigNumber__default['default'](value[index][columnType]).multipliedBy(new BigNumber__default['default'](value[index].sharePrice));
11686
+ } else {
11687
+ totalMoney = new BigNumber__default['default'](value[index][columnType]).multipliedBy(new BigNumber__default['default'](value[index].num));
11688
+ }
11689
+ if (totalMoney !== null) {
11690
+ value[index]['returnPrice'] = totalMoney.toString();
11691
+ }
11692
+ }
11693
+ } else if (type === 'WDT_EXCHANGE_GOODS') {
11694
+ if (['price', 'num'].includes(columnType)) {
11695
+ var _totalMoney = null;
11696
+ if (columnType === 'num') {
11697
+ _totalMoney = new BigNumber__default['default'](value[index][columnType]).multipliedBy(new BigNumber__default['default'](value[index].price));
11698
+ } else {
11699
+ _totalMoney = new BigNumber__default['default'](value[index][columnType]).multipliedBy(new BigNumber__default['default'](value[index].num));
11700
+ }
11701
+ if (_totalMoney !== null) {
11702
+ value[index]['exchangePrice'] = _totalMoney.toString();
11703
+ }
11704
+ }
11705
+ }
11679
11706
  onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(value));
11680
11707
  }
11681
11708
  };
@@ -11781,6 +11808,260 @@ var GoodItem$1 = function GoodItem(props) {
11781
11808
  }
11782
11809
  }];
11783
11810
  break;
11811
+ case 'WDT_RETURN_GOODS':
11812
+ {
11813
+ columns = [{
11814
+ dataIndex: 'goodId',
11815
+ title: "SPUID",
11816
+ align: 'center',
11817
+ ellipsis: true,
11818
+ width: 70
11819
+ }, {
11820
+ dataIndex: 'goodNo',
11821
+ title: "\u5546\u54C1SPU\u7F16\u7801",
11822
+ align: 'center',
11823
+ ellipsis: true,
11824
+ width: 180
11825
+ }, {
11826
+ dataIndex: 'goodName',
11827
+ title: "".concat(text, "\u5546\u54C1\u540D\u79F0"),
11828
+ align: 'center',
11829
+ ellipsis: true,
11830
+ width: 250
11831
+ }, {
11832
+ dataIndex: 'specId',
11833
+ title: "".concat(text, "SKUID"),
11834
+ align: 'center',
11835
+ ellipsis: true,
11836
+ width: 100
11837
+ }, {
11838
+ dataIndex: 'specNo',
11839
+ title: "".concat(text, "\u5546\u54C1SKU\u7F16\u7801"),
11840
+ align: 'center',
11841
+ ellipsis: true,
11842
+ width: 180
11843
+ }, {
11844
+ dataIndex: 'specName',
11845
+ title: "".concat(text, "\u5546\u54C1SKU\u540D\u79F0"),
11846
+ align: 'center',
11847
+ ellipsis: true,
11848
+ width: 250
11849
+ }, {
11850
+ dataIndex: 'num',
11851
+ title: "".concat(text, "\u9000\u8D27\u6570\u91CF"),
11852
+ align: 'center',
11853
+ ellipsis: true,
11854
+ width: 100,
11855
+ render: function render(val, record, index) {
11856
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
11857
+ style: {
11858
+ width: 70
11859
+ },
11860
+ value: val,
11861
+ min: 0,
11862
+ precision: 0,
11863
+ onChange: function onChange(num) {
11864
+ return updateHandle(num, index, 'num');
11865
+ }
11866
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
11867
+ }
11868
+ }, {
11869
+ dataIndex: 'sharePrice',
11870
+ title: "\u5206\u644A\u4EF7",
11871
+ align: 'center',
11872
+ ellipsis: true,
11873
+ width: 80,
11874
+ render: function render(val, record, index) {
11875
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
11876
+ style: {
11877
+ width: 70
11878
+ },
11879
+ value: val,
11880
+ min: 0,
11881
+ onChange: function onChange(value) {
11882
+ return updateHandle(value, index, 'sharePrice');
11883
+ }
11884
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
11885
+ }
11886
+ }, {
11887
+ dataIndex: 'returnPrice',
11888
+ title: "".concat(text, "\u9000\u8D27\u91D1\u989D"),
11889
+ align: 'center',
11890
+ ellipsis: true,
11891
+ width: 100
11892
+ }, {
11893
+ dataIndex: 'giftType',
11894
+ title: "\u8D60\u54C1\u65B9\u5F0F",
11895
+ align: 'center',
11896
+ ellipsis: true,
11897
+ width: 100,
11898
+ render: function render(val) {
11899
+ var giftTypeMap = {
11900
+ 0: '非赠品',
11901
+ 1: '自动赠送',
11902
+ 2: '手工赠送',
11903
+ 3: '回购自动送赠品',
11904
+ 4: '前N有礼送赠品',
11905
+ 6: '天猫优仓赠品',
11906
+ 7: '淘宝CRM会员送赠'
11907
+ };
11908
+ return /*#__PURE__*/React__default['default'].createElement("span", null, giftTypeMap[val]);
11909
+ }
11910
+ }, {
11911
+ dataIndex: 'productType',
11912
+ title: "".concat(text, "\u5546\u54C1\u7C7B\u578B"),
11913
+ align: 'center',
11914
+ ellipsis: true,
11915
+ width: 100,
11916
+ render: function render(val, record, index) {
11917
+ var options = [{
11918
+ label: '单品',
11919
+ value: '1'
11920
+ }, {
11921
+ label: '组合装',
11922
+ value: '2'
11923
+ }];
11924
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Select, {
11925
+ style: {
11926
+ width: 70
11927
+ },
11928
+ options: options,
11929
+ value: val,
11930
+ onChange: function onChange(value) {
11931
+ return updateHandle(value, index, 'productType');
11932
+ }
11933
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
11934
+ }
11935
+ }];
11936
+ }
11937
+ break;
11938
+ case 'WDT_EXCHANGE_GOODS':
11939
+ {
11940
+ columns = [{
11941
+ dataIndex: 'goodId',
11942
+ title: "SPUID",
11943
+ align: 'center',
11944
+ ellipsis: true,
11945
+ width: 70
11946
+ }, {
11947
+ dataIndex: 'goodNo',
11948
+ title: "\u5546\u54C1SPU\u7F16\u7801",
11949
+ align: 'center',
11950
+ ellipsis: true,
11951
+ width: 180
11952
+ }, {
11953
+ dataIndex: 'goodName',
11954
+ title: "".concat(text, "\u5546\u54C1\u540D\u79F0"),
11955
+ align: 'center',
11956
+ ellipsis: true,
11957
+ width: 250
11958
+ }, {
11959
+ dataIndex: 'specId',
11960
+ title: "".concat(text, "SKUID"),
11961
+ align: 'center',
11962
+ ellipsis: true,
11963
+ width: 100
11964
+ }, {
11965
+ dataIndex: 'specNo',
11966
+ title: "".concat(text, "\u5546\u54C1SKU\u7F16\u7801"),
11967
+ align: 'center',
11968
+ ellipsis: true,
11969
+ width: 180
11970
+ }, {
11971
+ dataIndex: 'specName',
11972
+ title: "".concat(text, "\u5546\u54C1SKU\u540D\u79F0"),
11973
+ align: 'center',
11974
+ ellipsis: true,
11975
+ width: 250
11976
+ }, {
11977
+ dataIndex: 'num',
11978
+ title: "".concat(text, "\u6362\u51FA\u6570\u91CF"),
11979
+ align: 'center',
11980
+ ellipsis: true,
11981
+ width: 100,
11982
+ render: function render(val, record, index) {
11983
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
11984
+ style: {
11985
+ width: 70
11986
+ },
11987
+ value: val,
11988
+ min: 0,
11989
+ precision: 0,
11990
+ onChange: function onChange(num) {
11991
+ return updateHandle(num, index, 'num');
11992
+ }
11993
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
11994
+ }
11995
+ }, {
11996
+ dataIndex: 'price',
11997
+ title: "".concat(text, "\u5546\u54C1\u5355\u4EF7"),
11998
+ align: 'center',
11999
+ ellipsis: true,
12000
+ width: 100,
12001
+ render: function render(val, record, index) {
12002
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
12003
+ style: {
12004
+ width: 70
12005
+ },
12006
+ value: val,
12007
+ min: 0,
12008
+ onChange: function onChange(value) {
12009
+ return updateHandle(value, index, 'price');
12010
+ }
12011
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
12012
+ }
12013
+ }, {
12014
+ dataIndex: 'exchangePrice',
12015
+ title: "".concat(text, "\u6362\u51FA\u91D1\u989D"),
12016
+ align: 'center',
12017
+ ellipsis: true,
12018
+ width: 100
12019
+ }, {
12020
+ dataIndex: 'giftType',
12021
+ title: "\u8D60\u54C1\u65B9\u5F0F",
12022
+ align: 'center',
12023
+ ellipsis: true,
12024
+ width: 100,
12025
+ render: function render(val) {
12026
+ var giftTypeMap = {
12027
+ 0: '非赠品',
12028
+ 1: '自动赠送',
12029
+ 2: '手工赠送',
12030
+ 3: '回购自动送赠品',
12031
+ 4: '前N有礼送赠品',
12032
+ 6: '天猫优仓赠品',
12033
+ 7: '淘宝CRM会员送赠'
12034
+ };
12035
+ return /*#__PURE__*/React__default['default'].createElement("span", null, giftTypeMap[val]);
12036
+ }
12037
+ }, {
12038
+ dataIndex: 'productType',
12039
+ title: "".concat(text, "\u5546\u54C1\u7C7B\u578B"),
12040
+ align: 'center',
12041
+ ellipsis: true,
12042
+ width: 100,
12043
+ render: function render(val, record, index) {
12044
+ var options = [{
12045
+ label: '单品',
12046
+ value: '1'
12047
+ }, {
12048
+ label: '组合装',
12049
+ value: '2'
12050
+ }];
12051
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Select, {
12052
+ style: {
12053
+ width: 70
12054
+ },
12055
+ options: options,
12056
+ value: val,
12057
+ onChange: function onChange(value) {
12058
+ return updateHandle(value, index, 'productType');
12059
+ }
12060
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
12061
+ }
12062
+ }];
12063
+ }
12064
+ break;
11784
12065
  default:
11785
12066
  columns = [{
11786
12067
  dataIndex: 'mark',
@@ -11922,7 +12203,7 @@ var GoodItem$1 = function GoodItem(props) {
11922
12203
  }, [showHeader, value, disabled]);
11923
12204
  var onSubmit = function onSubmit(list) {
11924
12205
  var newList = [];
11925
- if (['WDT_REISSUE_GOODS', 'WDT_GOODS'].includes(type)) {
12206
+ if (['WDT_REISSUE_GOODS', 'WDT_GOODS', 'WDT_EXCHANGE_GOODS'].includes(type)) {
11926
12207
  newList = list.map(function (item) {
11927
12208
  item.uuid = kmkfUtils.uuid();
11928
12209
  item.canDelete = true;
@@ -11930,6 +12211,10 @@ var GoodItem$1 = function GoodItem(props) {
11930
12211
  item.orderPrice = 0;
11931
12212
  item.sharePrice = 0;
11932
12213
  item.canUpdateNumber = canUpdateNumber;
12214
+ if (type === 'WDT_EXCHANGE_GOODS') {
12215
+ item.price = item.retailPrice;
12216
+ item.productType = '1';
12217
+ }
11933
12218
  return item;
11934
12219
  });
11935
12220
  } else {
@@ -12000,7 +12285,7 @@ var GoodItem$1 = function GoodItem(props) {
12000
12285
  locale: {
12001
12286
  emptyText: '暂无数据'
12002
12287
  }
12003
- })), ['WDT_REISSUE_GOODS', 'WDT_GOODS'].includes(type) ? /*#__PURE__*/React__default['default'].createElement(WdtGoodsModal, {
12288
+ })), ['WDT_REISSUE_GOODS', 'WDT_GOODS', 'WDT_EXCHANGE_GOODS'].includes(type) ? /*#__PURE__*/React__default['default'].createElement(WdtGoodsModal, {
12004
12289
  ref: refModal,
12005
12290
  onSubmit: onSubmit,
12006
12291
  width: width,
@@ -12870,8 +13155,10 @@ var componentMap$1 = {
12870
13155
  reissueType: 'wdtReissueType',
12871
13156
  returnType: 'wdtReturnType',
12872
13157
  returnSelectListReturn: 'wdtReturnSelectListReturn',
13158
+ returnSelectList: 'wdtReturnSelectList',
12873
13159
  deleteGood: 'wdtDeleteGood',
12874
- returnDeleteGood: 'wdtReturnDeleteGood'
13160
+ returnDeleteGood: 'wdtReturnDeleteGood',
13161
+ exchangeDeleteGood: 'wdtExchangeDeleteGood'
12875
13162
  }
12876
13163
  }
12877
13164
  };
@@ -12938,7 +13225,7 @@ var CommonGoods = function CommonGoods(props) {
12938
13225
  setTableSelect(['2', '4'].includes(data.val));
12939
13226
  if (['1', '3'].includes(data.val)) {
12940
13227
  var _valueRef$current5, _valueRef$current6;
12941
- pubsub__default['default'].publish(componentMap$1[type].eventNameMap.returnSelectListReturn, {
13228
+ pubsub__default['default'].publish(componentMap$1[compType].eventNameMap.returnSelectListReturn, {
12942
13229
  list: lodash.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]) || []),
12943
13230
  shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current6 = valueRef.current) === null || _valueRef$current6 === void 0 ? void 0 : _valueRef$current6.shopCode,
12944
13231
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
@@ -12956,15 +13243,15 @@ var CommonGoods = function CommonGoods(props) {
12956
13243
  };
12957
13244
  }, [disabled]);
12958
13245
  var _onSelect = function onSelect(list) {
12959
- var _withInfo$current, _withInfo$current2, _valueRef$current7;
13246
+ var _typeMap, _withInfo$current, _withInfo$current2, _valueRef$current7;
12960
13247
  if (disabled) return;
12961
13248
  var newList = lodash.cloneDeep(list);
12962
- var typeMap = _defineProperty({
13249
+ var typeMap = (_typeMap = {
12963
13250
  // type: componentMap[compType].eventNameMap.selectList,
12964
13251
  // returnType: componentMap[compType].eventNameMap.returnSelectList,
12965
13252
  // reissueType: componentMap[compType].eventNameMap.reissueSelectList,
12966
13253
  type: componentMap$1[compType].eventNameMap.selectList
12967
- }, "".concat(componentMap$1[compType].type, "ReissueType"), componentMap$1[compType].eventNameMap.reissueSelectList);
13254
+ }, _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);
12968
13255
  var type = typeMap[(_withInfo$current = withInfo.current) === null || _withInfo$current === void 0 ? void 0 : _withInfo$current.type];
12969
13256
  // console.log('onSelect', type, withInfo.current, newList);
12970
13257
  pubsub__default['default'].publish(type, {
@@ -12982,6 +13269,7 @@ var CommonGoods = function CommonGoods(props) {
12982
13269
  pubsub__default['default'].publish(componentMap$1[compType].eventNameMap.deleteGood, deleteId);
12983
13270
  pubsub__default['default'].publish(componentMap$1[compType].eventNameMap.reissueDeleteGood, deleteId);
12984
13271
  pubsub__default['default'].publish(componentMap$1[compType].eventNameMap.returnDeleteGood, deleteId);
13272
+ pubsub__default['default'].publish(componentMap$1[compType].eventNameMap.exchangeDeleteGood, deleteId);
12985
13273
  };
12986
13274
  var changeHandle = function changeHandle(list) {
12987
13275
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, componentMap$1[compType].key, list)));
@@ -13006,6 +13294,257 @@ var CommonGoods = function CommonGoods(props) {
13006
13294
  }));
13007
13295
  };
13008
13296
 
13297
+ var componentMap$2 = {
13298
+ 'WDT_RETURN_GOODS': {
13299
+ type: 'wdt',
13300
+ valueKey: 'wdtReturnGoods',
13301
+ returnTypeKey: 'wdtReturnType',
13302
+ name: '旺店通',
13303
+ eventNameMap: {
13304
+ changeShopCode: 'wdtChangeShopCode',
13305
+ returnType: 'wdtReturnType',
13306
+ returnSelectListReturn: 'wdtReturnSelectListReturn',
13307
+ returnDeleteGood: 'wdtReturnDeleteGood',
13308
+ returnSelectList: 'wdtReturnSelectList',
13309
+ exchangeCopyGood: 'wdtExchangeCopyGood',
13310
+ exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
13311
+ }
13312
+ }
13313
+ };
13314
+ var CommonReturnGoods = function CommonReturnGoods(props) {
13315
+ var value = props.value,
13316
+ onChange = props.onChange,
13317
+ _props$reasonList = props.reasonList,
13318
+ reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
13319
+ disabled = props.disabled,
13320
+ compType = props.type;
13321
+ var valueRef = React.useRef({});
13322
+ React.useEffect(function () {
13323
+ var subscription = pubsub__default['default'].subscribe(componentMap$2[compType].eventNameMap.exchangeCopyGood, function () {
13324
+ var _valueRef$current, _valueRef$current2;
13325
+ pubsub__default['default'].publish(componentMap$2[compType].eventNameMap.exchangeBackCopyGood, {
13326
+ list: lodash.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]) || []),
13327
+ shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode
13328
+ });
13329
+ });
13330
+ return function () {
13331
+ pubsub__default['default'].unsubscribe(subscription);
13332
+ };
13333
+ }, []);
13334
+ React.useEffect(function () {
13335
+ var subscription = pubsub__default['default'].subscribe(componentMap$2[compType].eventNameMap.returnSelectList, function (_, data) {
13336
+ if (disabled) return;
13337
+ var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
13338
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13339
+ });
13340
+ if (compType === 'WDT_RETURN_GOODS') {
13341
+ newValue[componentMap$2[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13342
+ if (typeof item.productType === 'undefined') {
13343
+ item.productType = '1';
13344
+ }
13345
+ if (typeof item.returnPrice === 'undefined') {
13346
+ item.returnPrice = new BigNumber__default['default'](item.num).multipliedBy(new BigNumber__default['default'](item.sharePrice)).toString();
13347
+ }
13348
+ return item;
13349
+ });
13350
+ } else {
13351
+ newValue[componentMap$2[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13352
+ }
13353
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13354
+ });
13355
+ return function () {
13356
+ pubsub__default['default'].unsubscribe(subscription);
13357
+ };
13358
+ }, []);
13359
+ React.useEffect(function () {
13360
+ var subscription = pubsub__default['default'].subscribe(componentMap$2[compType].eventNameMap.returnSelectListReturn, function (_, data) {
13361
+ if (disabled) return;
13362
+ var newValue = _objectSpread2(_objectSpread2({}, data.goodValue), {}, {
13363
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13364
+ });
13365
+ if (compType === 'WDT_RETURN_GOODS') {
13366
+ newValue[componentMap$2[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13367
+ if (typeof item.productType === 'undefined') {
13368
+ item.productType = '1';
13369
+ }
13370
+ if (typeof item.returnPrice === 'undefined') {
13371
+ item.returnPrice = new BigNumber__default['default'](item.num).multipliedBy(new BigNumber__default['default'](item.sharePrice)).toString();
13372
+ }
13373
+ return item;
13374
+ });
13375
+ } else {
13376
+ newValue[componentMap$2[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13377
+ }
13378
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13379
+ });
13380
+ return function () {
13381
+ pubsub__default['default'].unsubscribe(subscription);
13382
+ };
13383
+ }, []);
13384
+ React.useEffect(function () {
13385
+ valueRef.current = value;
13386
+ pubsub__default['default'].subscribeOnce(componentMap$2[compType].eventNameMap.returnDeleteGood, function (_, data) {
13387
+ if (disabled) return;
13388
+ if (value) {
13389
+ var newValue = _objectSpread2({}, value);
13390
+ newValue[componentMap$2[compType].valueKey] = newValue[componentMap$2[compType].valueKey].filter(function (item) {
13391
+ return item.sku !== data;
13392
+ });
13393
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13394
+ }
13395
+ });
13396
+ pubsub__default['default'].subscribeOnce(componentMap$2[compType].eventNameMap.changeShopCode, function (type, data) {
13397
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13398
+ shopCode: data.shopCode
13399
+ }));
13400
+ });
13401
+ }, [value, disabled]);
13402
+ var changeTypeHandle = function changeTypeHandle(val) {
13403
+ var newValue = _objectSpread2({}, value);
13404
+ newValue[componentMap$2[compType].returnTypeKey] = val;
13405
+ newValue[componentMap$2[compType].valueKey] = [];
13406
+ if (['2'].includes(val[0])) {
13407
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13408
+ valueRef.current = newValue;
13409
+ }
13410
+ pubsub__default['default'].publish(componentMap$2[compType].eventNameMap.returnType, {
13411
+ val: val[0],
13412
+ goodValue: newValue
13413
+ });
13414
+ };
13415
+ var changeGoodHandle = function changeGoodHandle(val) {
13416
+ var newValue = _objectSpread2({}, value);
13417
+ newValue[componentMap$2[compType].valueKey] = val;
13418
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13419
+ };
13420
+ //显示选择商品按钮 原单换不显示选择商品
13421
+ // const showChangeBtn = useMemo(() => {
13422
+ // return ['2'].includes(value?.[componentMap[compType].returnTypeKey]?.[0]);
13423
+ // }, [value?.[componentMap[compType].returnTypeKey]]);
13424
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Cascader, {
13425
+ style: {
13426
+ marginBottom: '8px'
13427
+ },
13428
+ disabled: disabled,
13429
+ allowClear: false,
13430
+ options: reasonList,
13431
+ value: value === null || value === void 0 ? void 0 : value[componentMap$2[compType].returnTypeKey],
13432
+ onChange: function onChange(val) {
13433
+ return changeTypeHandle(val);
13434
+ }
13435
+ }), /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
13436
+ key: componentMap$2[compType].type
13437
+ }, props), {}, {
13438
+ disabled: disabled,
13439
+ canUpdateNumber: true,
13440
+ showChangeBtn: false,
13441
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
13442
+ value: value === null || value === void 0 ? void 0 : value[componentMap$2[compType].valueKey],
13443
+ onChange: function onChange(val) {
13444
+ return changeGoodHandle(val);
13445
+ }
13446
+ })));
13447
+ };
13448
+
13449
+ var componentMap$3 = {
13450
+ 'WDT_EXCHANGE_GOODS': {
13451
+ type: 'wdt',
13452
+ valueKey: 'wdtExchangeGoods',
13453
+ returnTypeKey: 'wdtExchangeType',
13454
+ name: '旺店通',
13455
+ eventNameMap: {
13456
+ changeShopCode: 'wdtChangeShopCode',
13457
+ exchangeDeleteGood: 'wdtExchangeDeleteGood',
13458
+ exchangeCopyGood: 'wdtExchangeCopyGood',
13459
+ exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
13460
+ }
13461
+ }
13462
+ };
13463
+ var CommonExchangeGoods = function CommonExchangeGoods(props) {
13464
+ var value = props.value,
13465
+ onChange = props.onChange,
13466
+ disabled = props.disabled,
13467
+ compType = props.type;
13468
+ var valueRef = React.useRef({});
13469
+ React.useEffect(function () {
13470
+ var subscription = pubsub__default['default'].subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
13471
+ if (disabled) return;
13472
+ var newValue = {
13473
+ shopCode: data === null || data === void 0 ? void 0 : data.shopCode
13474
+ };
13475
+ if (compType === 'WDT_EXCHANGE_GOODS') {
13476
+ newValue[componentMap$3[compType].valueKey] = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
13477
+ if (typeof item.productType === 'undefined') {
13478
+ item.productType = '1';
13479
+ }
13480
+ item.price = item.sharePrice;
13481
+ if (typeof item.exchangePrice === 'undefined') {
13482
+ item.exchangePrice = new BigNumber__default['default'](item.num).multipliedBy(new BigNumber__default['default'](item.price)).toString();
13483
+ }
13484
+ return item;
13485
+ });
13486
+ } else {
13487
+ newValue[componentMap$3[compType].valueKey] = (data === null || data === void 0 ? void 0 : data.list) || [];
13488
+ }
13489
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13490
+ });
13491
+ return function () {
13492
+ pubsub__default['default'].unsubscribe(subscription);
13493
+ };
13494
+ });
13495
+ React.useEffect(function () {
13496
+ valueRef.current = value;
13497
+ pubsub__default['default'].subscribeOnce(componentMap$3[compType].eventNameMap.exchangeDeleteGood, function (_, data) {
13498
+ if (disabled) return;
13499
+ if (value) {
13500
+ var newValue = _objectSpread2({}, value);
13501
+ newValue[componentMap$3[compType].valueKey] = newValue[componentMap$3[compType].valueKey].filter(function (item) {
13502
+ return item.sku !== data;
13503
+ });
13504
+ onChange(newValue);
13505
+ }
13506
+ });
13507
+ pubsub__default['default'].subscribeOnce(componentMap$3[compType].eventNameMap.changeShopCode, function (type, data) {
13508
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
13509
+ shopCode: data.shopCode
13510
+ }));
13511
+ });
13512
+ }, [value]);
13513
+ var changeGoodHandle = function changeGoodHandle(val) {
13514
+ var newValue = _objectSpread2({}, value);
13515
+ if (compType === 'WDT_EXCHANGE_GOODS') {
13516
+ val = val.map(function (item) {
13517
+ item.exchangePrice = new BigNumber__default['default'](item.num).multipliedBy(new BigNumber__default['default'](item.price)).toString();
13518
+ return item;
13519
+ });
13520
+ }
13521
+ newValue[componentMap$3[compType].valueKey] = val;
13522
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
13523
+ };
13524
+ var copyGoods = function copyGoods() {
13525
+ var copyHandle = function copyHandle() {
13526
+ pubsub__default['default'].publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, 'WDT_EXCHANGE_GOODS');
13527
+ };
13528
+ return /*#__PURE__*/React__default['default'].createElement(antd.Button, {
13529
+ type: "link",
13530
+ onClick: copyHandle
13531
+ }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
13532
+ };
13533
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
13534
+ key: componentMap$3[compType].type
13535
+ }, props), {}, {
13536
+ disabled: disabled,
13537
+ canUpdateNumber: true,
13538
+ showChangeBtn: true,
13539
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
13540
+ value: value === null || value === void 0 ? void 0 : value[componentMap$3[compType].valueKey],
13541
+ otherOperations: copyGoods(),
13542
+ onChange: function onChange(val) {
13543
+ return changeGoodHandle(val);
13544
+ }
13545
+ })));
13546
+ };
13547
+
13009
13548
  var _excluded$g = ["value", "onChange", "reasonList", "disabled", "type"];
13010
13549
  var typeMap$1 = {
13011
13550
  WDT_REISSUE_GOODS: {
@@ -13848,11 +14387,11 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
13848
14387
  },
13849
14388
  value: (_value$changeIndex2 = value[changeIndex]) === null || _value$changeIndex2 === void 0 ? void 0 : _value$changeIndex2.returnGoodsTradeId
13850
14389
  })) : null, type === 3 ? /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
13851
- disabled: true,
14390
+ disabled: disabled,
13852
14391
  placeholder: "\u8BF7\u8F93\u5165\u8865\u53D1\u5355id",
13853
14392
  value: (_value$changeIndex3 = value[changeIndex]) === null || _value$changeIndex3 === void 0 ? void 0 : _value$changeIndex3.billNo
13854
14393
  })) : null, type === 4 ? /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
13855
- disabled: true,
14394
+ disabled: disabled,
13856
14395
  placeholder: "\u8BF7\u8F93\u5165\u6362\u8D27\u5355id",
13857
14396
  value: (_value$changeIndex4 = value[changeIndex]) === null || _value$changeIndex4 === void 0 ? void 0 : _value$changeIndex4.billNo
13858
14397
  })) : null) : null);
@@ -14047,8 +14586,10 @@ exports.BsSystemOrder = index$1;
14047
14586
  exports.BuyerNick = BuyerNick;
14048
14587
  exports.CalculationInput = CalculationInput;
14049
14588
  exports.ChooseBaby = ChooseBaby;
14589
+ exports.CommonExchangeGoods = CommonExchangeGoods;
14050
14590
  exports.CommonGoods = CommonGoods;
14051
14591
  exports.CommonMultiStatus = CommonSystemOrder$1;
14592
+ exports.CommonReturnGoods = CommonReturnGoods;
14052
14593
  exports.CommonStatus = CommonStatus;
14053
14594
  exports.CommonSystemOrder = CommonSystemOrder;
14054
14595
  exports.ExpressLogistics = ExpressLogistics;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const CommonExchangeGoods: (props: any) => React.JSX.Element;
3
+ export default CommonExchangeGoods;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const CommonReturnGoods: (props: any) => React.JSX.Element;
3
+ export default CommonReturnGoods;