@kmkf-fe-packages/basic-components 0.7.15-alpha.7 → 0.7.15-alpha.70

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
@@ -1,8 +1,8 @@
1
1
  import React, { useRef, useState, useEffect, useMemo, forwardRef, useImperativeHandle, useCallback } from 'react';
2
- import { Cascader, DatePicker, Input, InputNumber, Select, Upload, Image, message, Radio, Space, Spin, Checkbox, Row, Col, Slider, Rate, Button, Form, Tabs, Modal, ConfigProvider, Pagination, Popover, Table } from 'antd';
2
+ import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Checkbox, Row, Col, Slider, Rate, Button, Form, Tabs, Modal, ConfigProvider, Pagination, Popover, Table } from 'antd';
3
3
  import { EyeOutlined, DeleteOutlined, InboxOutlined } from '@ant-design/icons';
4
4
  import request, { extend as extend$1 } from 'umi-request';
5
- import { AddressData, BsAddressData, request as request$1, LogisticsAddressData } from '@kmkf-fe-packages/kmkf-utils';
5
+ import { AddressData, BsAddressData, request as request$1, LogisticsAddressData, uuid } from '@kmkf-fe-packages/kmkf-utils';
6
6
  import zhCN from 'antd/lib/locale/zh_CN';
7
7
  import pubsub from 'pubsub-js';
8
8
  import { cloneDeep } from 'lodash';
@@ -505,7 +505,8 @@ function ApaasInput(props) {
505
505
  var isNumber = props.isNumber,
506
506
  replaceWarn = props.replaceWarn,
507
507
  other = _objectWithoutProperties(props, _excluded$1);
508
- return /*#__PURE__*/React.createElement(Input, _objectSpread2({}, other));
508
+ // @ts-ignore
509
+ return isNumber ? /*#__PURE__*/React.createElement(InputNumber, _objectSpread2({}, other)) : /*#__PURE__*/React.createElement(Input, _objectSpread2({}, other));
509
510
  }
510
511
 
511
512
  function ApaasInputNumber(props) {
@@ -819,21 +820,23 @@ function ApaasRadio(props) {
819
820
  var triggerChange = function triggerChange(changedValue) {
820
821
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), changedValue));
821
822
  };
822
- var onRadioChange = function onRadioChange(e) {
823
- var radioValue = e.target.value;
824
- triggerChange({
825
- value: radioValue
826
- });
827
- };
828
823
  var onOtherChange = function onOtherChange(e) {
829
824
  var other = e.target.value;
830
825
  triggerChange({
831
826
  other: other
832
827
  });
833
828
  };
829
+ var onRadioClick = function onRadioClick(e) {
830
+ var selectValue = e.target.value;
831
+ if (selectValue === radioValue) {
832
+ selectValue = '';
833
+ }
834
+ triggerChange({
835
+ value: selectValue
836
+ });
837
+ };
834
838
  return /*#__PURE__*/React.createElement(Radio.Group, _objectSpread2({
835
- value: radioValue,
836
- onChange: onRadioChange
839
+ value: radioValue
837
840
  }, otherProps), /*#__PURE__*/React.createElement(Space, {
838
841
  direction: horizontal ? 'horizontal' : 'vertical',
839
842
  wrap: true
@@ -841,11 +844,13 @@ function ApaasRadio(props) {
841
844
  return /*#__PURE__*/React.createElement(Radio, {
842
845
  value: item.value,
843
846
  key: item.label,
844
- disabled: disabled
847
+ disabled: disabled,
848
+ onClick: onRadioClick
845
849
  }, item.label);
846
850
  }), showOther && /*#__PURE__*/React.createElement(Radio, {
847
851
  value: "\u5176\u4ED6",
848
- disabled: disabled
852
+ disabled: disabled,
853
+ onClick: onRadioClick
849
854
  }, "\u5176\u4ED6", /*#__PURE__*/React.createElement(Input, {
850
855
  disabled: disabled,
851
856
  value: other,
@@ -6940,7 +6945,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
6940
6945
  var beforeUpload = function beforeUpload(file) {
6941
6946
  console.log('beforeUpload', file);
6942
6947
  var size = file.size / 1024 / 1024 < maxSize;
6943
- if (value.length > maxCount) {
6948
+ if (value.length >= maxCount) {
6944
6949
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u4E2A\u6587\u4EF6\uFF01"));
6945
6950
  return Upload.LIST_IGNORE;
6946
6951
  }
@@ -6963,7 +6968,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
6963
6968
  className: styles$2.tips
6964
6969
  }, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React.createElement(Dragger, _objectSpread2({
6965
6970
  disabled: disabled,
6966
- multiple: true,
6971
+ multiple: false,
6967
6972
  accept: accept,
6968
6973
  name: "file",
6969
6974
  maxCount: maxCount,
@@ -7152,7 +7157,8 @@ function ApaasRate(props) {
7152
7157
  var address = AddressData.getInstance();
7153
7158
  var bsAddress = BsAddressData.getInstance();
7154
7159
  var Province = function Province(props) {
7155
- var type = props.type;
7160
+ var _props$type = props.type,
7161
+ type = _props$type === void 0 ? 'workOrder' : _props$type;
7156
7162
  var _useState = useState([]),
7157
7163
  _useState2 = _slicedToArray(_useState, 2),
7158
7164
  option = _useState2[0],
@@ -7163,7 +7169,7 @@ var Province = function Province(props) {
7163
7169
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7164
7170
  while (1) switch (_context.prev = _context.next) {
7165
7171
  case 0:
7166
- setOptions(type === 'workOrder' ? address.addressOptions || [] : bsAddress.addressOptions || []);
7172
+ setOptions(type !== 'bs' ? address.addressOptions || [] : bsAddress.addressOptions || []);
7167
7173
  case 1:
7168
7174
  case "end":
7169
7175
  return _context.stop();
@@ -7182,6 +7188,9 @@ var Province = function Province(props) {
7182
7188
  }, []);
7183
7189
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, _objectSpread2(_objectSpread2({}, props), {}, {
7184
7190
  options: option,
7191
+ style: {
7192
+ minWidth: '100px'
7193
+ },
7185
7194
  placeholder: "\u8BF7\u9009\u62E9\u7701\u5E02\u533A"
7186
7195
  })));
7187
7196
  };
@@ -7211,7 +7220,7 @@ var ParseLogistics = function ParseLogistics(props) {
7211
7220
  });
7212
7221
  };
7213
7222
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextArea, {
7214
- placeholder: "\u590D\u5236\u7269\u6D41\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
7223
+ placeholder: "\u590D\u5236\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
7215
7224
  rows: 3,
7216
7225
  value: value,
7217
7226
  onChange: function onChange(e) {
@@ -7258,12 +7267,14 @@ var IdentifyAddress = function IdentifyAddress(props) {
7258
7267
  value: value.receiverName,
7259
7268
  disabled: disabled,
7260
7269
  placeholder: "\u6536\u4EF6\u4EBA\u59D3\u540D",
7270
+ allowClear: true,
7261
7271
  onChange: function onChange(e) {
7262
7272
  return changeHandle(e.target.value, 'receiverName');
7263
7273
  }
7264
7274
  }), /*#__PURE__*/React.createElement(Input, {
7265
7275
  value: value.receiverMobile,
7266
7276
  disabled: disabled,
7277
+ allowClear: true,
7267
7278
  placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
7268
7279
  onChange: function onChange(e) {
7269
7280
  return changeHandle(e.target.value, 'receiverMobile');
@@ -7280,6 +7291,7 @@ var IdentifyAddress = function IdentifyAddress(props) {
7280
7291
  value: value.detail,
7281
7292
  disabled: disabled,
7282
7293
  placeholder: "\u8BE6\u7EC6\u5730\u5740",
7294
+ allowClear: true,
7283
7295
  onChange: function onChange(e) {
7284
7296
  return changeHandle(e.target.value, 'detail');
7285
7297
  }
@@ -8947,31 +8959,43 @@ var Payment = function Payment(props) {
8947
8959
  name: 'enterprisePaymentTid',
8948
8960
  placeholder: '请输入订单编号',
8949
8961
  required: required,
8950
- show: true
8962
+ show: true,
8963
+ hidden: false
8951
8964
  }, {
8952
8965
  label: '打款金额',
8953
8966
  name: 'enterprisePaymentRefundFee',
8954
8967
  placeholder: '请输入打款金额',
8955
8968
  required: required,
8956
- show: true
8969
+ show: true,
8970
+ hidden: false
8957
8971
  }, {
8958
8972
  label: '买家昵称',
8959
8973
  name: 'enterprisePaymentBuyerNick',
8960
8974
  placeholder: '请输入买家昵称',
8961
8975
  required: false,
8962
- show: true
8976
+ show: true,
8977
+ hidden: false
8963
8978
  }, {
8964
8979
  label: '支付宝名称',
8965
8980
  name: 'enterprisePaymentAlipayNick',
8966
8981
  placeholder: '请输入支付宝名称',
8967
8982
  required: zhiFubaoRequired,
8968
- show: true
8983
+ show: true,
8984
+ hidden: false
8969
8985
  }, {
8970
8986
  label: '支付宝账号',
8971
8987
  name: 'enterprisePaymentAlipayNo',
8972
8988
  placeholder: '请输入支付宝账号',
8973
8989
  required: zhiFubaoRequired,
8974
- show: true
8990
+ show: true,
8991
+ hidden: false
8992
+ }, {
8993
+ label: '打款状态',
8994
+ name: 'enterprisePaymentStatus',
8995
+ placeholder: '',
8996
+ required: false,
8997
+ show: false,
8998
+ hidden: true
8975
8999
  }];
8976
9000
  return /*#__PURE__*/React.createElement(React.Fragment, null, PaymentList.map(function (item) {
8977
9001
  return item.show && /*#__PURE__*/React.createElement(Form.Item, {
@@ -9310,6 +9334,58 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9310
9334
  typeof onChange === 'function' && onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9311
9335
  trajectoryCompany: val
9312
9336
  }));
9337
+ handleSearchSnapshot(val);
9338
+ };
9339
+ var handleSearchSnapshot = function handleSearchSnapshot(company) {
9340
+ var trajectoryCompany = value.trajectoryCompany,
9341
+ trajectoryCode = value.trajectoryCode,
9342
+ trajectoryPhone = value.trajectoryPhone;
9343
+ var newCompany = company ? company : trajectoryCompany;
9344
+ //不展示拦截状态不请求
9345
+ if (!(showField && showField.includes('snapshot'))) {
9346
+ return;
9347
+ }
9348
+ if (disabled) {
9349
+ return;
9350
+ }
9351
+ if (newCompany === 'SF' && !(newCompany && trajectoryCode && trajectoryPhone)) {
9352
+ return;
9353
+ } else if (!(newCompany && trajectoryCode)) {
9354
+ return;
9355
+ }
9356
+ try {
9357
+ extendRequest('/qy/logistics/logisticsTraceSearch', {
9358
+ method: 'post',
9359
+ data: {
9360
+ mailNo: trajectoryCode,
9361
+ cpCode: newCompany,
9362
+ mobile: trajectoryPhone
9363
+ }
9364
+ }).then(function (res) {
9365
+ var result = res.result,
9366
+ success = res.success,
9367
+ data = res.data,
9368
+ msg = res.message;
9369
+ if (result === 100 || success) {
9370
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9371
+ trajectorySnapshot: data === null || data === void 0 ? void 0 : data.logisticsStatusDesc,
9372
+ trajectoryCompany: newCompany
9373
+ }));
9374
+ } else {
9375
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9376
+ trajectorySnapshot: '',
9377
+ trajectoryCompany: newCompany
9378
+ }));
9379
+ msg && message.error(msg);
9380
+ }
9381
+ });
9382
+ } catch (err) {
9383
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9384
+ trajectorySnapshot: '',
9385
+ trajectoryCompany: newCompany
9386
+ }));
9387
+ (err === null || err === void 0 ? void 0 : err.message) && message.error(err === null || err === void 0 ? void 0 : err.message);
9388
+ }
9313
9389
  };
9314
9390
  //物流公司
9315
9391
  var LogisticsCompany = function LogisticsCompany() {
@@ -9332,20 +9408,40 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9332
9408
  //物流单号
9333
9409
  var LogisticsCode = function LogisticsCode() {
9334
9410
  return /*#__PURE__*/React.createElement(Input, {
9335
- style: {
9336
- marginBottom: '8px'
9337
- },
9338
9411
  disabled: disabled,
9339
9412
  placeholder: "\u7269\u6D41\u5355\u53F7",
9340
9413
  onChange: function onChange(e) {
9341
9414
  return handleInputChange(e, 'trajectoryCode');
9342
9415
  },
9343
- value: value === null || value === void 0 ? void 0 : value.trajectoryCode
9416
+ value: value === null || value === void 0 ? void 0 : value.trajectoryCode,
9417
+ onBlur: function onBlur() {
9418
+ return handleSearchSnapshot();
9419
+ }
9420
+ });
9421
+ };
9422
+ //sf手机号
9423
+ var LogisticsPhone = function LogisticsPhone() {
9424
+ return /*#__PURE__*/React.createElement(Input, {
9425
+ disabled: disabled,
9426
+ style: {
9427
+ marginTop: '8px'
9428
+ },
9429
+ placeholder: "\u624B\u673A\u53F7",
9430
+ onChange: function onChange(e) {
9431
+ return handleInputChange(e, 'trajectoryPhone');
9432
+ },
9433
+ value: value === null || value === void 0 ? void 0 : value.trajectoryPhone,
9434
+ onBlur: function onBlur() {
9435
+ return handleSearchSnapshot();
9436
+ }
9344
9437
  });
9345
9438
  };
9346
9439
  //物流快照
9347
9440
  var LogisticsSnapshot = function LogisticsSnapshot() {
9348
9441
  return /*#__PURE__*/React.createElement(Input, {
9442
+ style: {
9443
+ marginTop: '8px'
9444
+ },
9349
9445
  disabled: true,
9350
9446
  placeholder: "\u7269\u6D41\u5FEB\u7167",
9351
9447
  onChange: function onChange(e) {
@@ -9354,7 +9450,7 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9354
9450
  value: value === null || value === void 0 ? void 0 : value.trajectorySnapshot
9355
9451
  });
9356
9452
  };
9357
- return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9453
+ return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), (value === null || value === void 0 ? void 0 : value.trajectoryCompany) === 'SF' ? LogisticsPhone() : null, showField && showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9358
9454
  };
9359
9455
 
9360
9456
  var jstGoods = function jstGoods(props) {
@@ -9368,7 +9464,7 @@ var jstGoods = function jstGoods(props) {
9368
9464
  _props$type = props.type,
9369
9465
  type = _props$type === void 0 ? 1 : _props$type,
9370
9466
  _props$showField = props.showField,
9371
- showField = _props$showField === void 0 ? 'all' : _props$showField;
9467
+ showField = _props$showField === void 0 ? '' : _props$showField;
9372
9468
  var _useState = useState(0),
9373
9469
  _useState2 = _slicedToArray(_useState, 2),
9374
9470
  changeIndex = _useState2[0],
@@ -9377,7 +9473,12 @@ var jstGoods = function jstGoods(props) {
9377
9473
  setChangeIndex(0);
9378
9474
  }, []);
9379
9475
  var content = function content(item, index) {
9380
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9476
+ return /*#__PURE__*/React.createElement("div", {
9477
+ style: {
9478
+ maxHeight: '300px',
9479
+ overflowY: 'auto'
9480
+ }
9481
+ }, /*#__PURE__*/React.createElement("div", {
9381
9482
  style: {
9382
9483
  textAlign: 'center'
9383
9484
  }
@@ -9418,7 +9519,7 @@ var jstGoods = function jstGoods(props) {
9418
9519
  return setChangeIndex(index);
9419
9520
  }
9420
9521
  }, "\u5305\u88F9".concat(index + 1)));
9421
- }))) : null, value.length ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 1 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
9522
+ }))) : null, value.length ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 1 ? /*#__PURE__*/React.createElement(Space, null, !showField || showField === 'logisticsCompany' ? /*#__PURE__*/React.createElement(Select, {
9422
9523
  disabled: disabled,
9423
9524
  placeholder: "\u7269\u6D41\u516C\u53F8",
9424
9525
  onChange: function onChange(val) {
@@ -9433,14 +9534,14 @@ var jstGoods = function jstGoods(props) {
9433
9534
  style: {
9434
9535
  minWidth: '100px'
9435
9536
  }
9436
- }), /*#__PURE__*/React.createElement(Input, {
9537
+ }) : null, !showField || showField === 'logisticsCode' ? /*#__PURE__*/React.createElement(Input, {
9437
9538
  disabled: disabled,
9438
9539
  placeholder: "\u7269\u6D41\u5355\u53F7",
9439
9540
  onChange: function onChange(e) {
9440
9541
  return changeInputHandle(e.target.value, 'logisticsCode');
9441
9542
  },
9442
9543
  value: (_value$changeIndex2 = value[changeIndex]) === null || _value$changeIndex2 === void 0 ? void 0 : _value$changeIndex2.logisticsCode
9443
- })) : null, type === 2 ? /*#__PURE__*/React.createElement(Space, null, ['supplyId', 'all'].includes(showField) && /*#__PURE__*/React.createElement(Input, {
9544
+ }) : null) : null, type === 2 ? /*#__PURE__*/React.createElement(Space, null, ['supplyId', 'all'].includes(showField) && /*#__PURE__*/React.createElement(Input, {
9444
9545
  disabled: disabled,
9445
9546
  placeholder: "\u8BF7\u8F93\u5165\u4F9B\u9500\u5546\u7F16\u7801",
9446
9547
  onChange: function onChange(e) {
@@ -9545,44 +9646,79 @@ var ItemList = function ItemList(props) {
9545
9646
  }, "\u6682\u4E0D\u652F\u6301\u6DFB\u52A0")) : null);
9546
9647
  };
9547
9648
 
9548
- var TabPane$1 = Tabs.TabPane;
9549
9649
  var columns = [{
9550
- dataIndex: 'picUrl',
9551
- title: '主图',
9552
- render: function render(val) {
9553
- return /*#__PURE__*/React.createElement(Image, {
9554
- width: 60,
9555
- src: val
9556
- });
9650
+ dataIndex: 'index',
9651
+ title: '序号',
9652
+ render: function render(val, record, index) {
9653
+ return /*#__PURE__*/React.createElement("div", {
9654
+ style: {
9655
+ width: '50px'
9656
+ }
9657
+ }, index + 1);
9557
9658
  }
9558
9659
  }, {
9559
- dataIndex: 'outerId',
9560
- title: '款式编码'
9660
+ dataIndex: 'name',
9661
+ title: '商品名称',
9662
+ with: 200,
9663
+ ellipsis: true
9561
9664
  }, {
9562
- dataIndex: 'numIid',
9563
- title: '商品编码'
9665
+ dataIndex: 'goodsId',
9666
+ title: '商品id',
9667
+ with: 200,
9668
+ ellipsis: true
9564
9669
  }, {
9565
- dataIndex: 'title',
9566
- title: '商品名称'
9670
+ dataIndex: 'skuName',
9671
+ title: '商品sku名称',
9672
+ with: 200,
9673
+ ellipsis: true
9567
9674
  }, {
9568
- dataIndex: 'skus',
9569
- title: '颜色及规格'
9675
+ dataIndex: 'code',
9676
+ title: '商品编码',
9677
+ with: 200,
9678
+ // ellipsis: true,
9679
+ render: function render(val) {
9680
+ return /*#__PURE__*/React.createElement("div", {
9681
+ style: {
9682
+ width: '100px'
9683
+ }
9684
+ }, val);
9685
+ }
9686
+ }, {
9687
+ dataIndex: 'skuCode',
9688
+ title: '商品sku编码',
9689
+ with: 200,
9690
+ ellipsis: true
9691
+ }, {
9692
+ dataIndex: 'marketPrice',
9693
+ title: '市场价',
9694
+ // with: 200,
9695
+ // ellipsis: true,
9696
+ render: function render(val) {
9697
+ return /*#__PURE__*/React.createElement("div", {
9698
+ style: {
9699
+ width: '70px'
9700
+ }
9701
+ }, val);
9702
+ }
9570
9703
  }];
9571
9704
  var GoodsModal$1 = function GoodsModal(props, ref) {
9572
9705
  useImperativeHandle(ref, function () {
9573
9706
  return {
9574
9707
  open: function open() {
9575
9708
  setVisible(true);
9709
+ setPageNo(1);
9576
9710
  setSelect([]);
9577
9711
  setSelectIds([]);
9578
9712
  queryItems();
9713
+ onReset();
9579
9714
  }
9580
9715
  };
9581
9716
  });
9582
9717
  var onSubmit = props.onSubmit,
9583
9718
  shopId = props.shopId,
9584
9719
  shopList = props.shopList,
9585
- width = props.width;
9720
+ width = props.width,
9721
+ shopCode = props.shopCode;
9586
9722
  var _useState = useState(false),
9587
9723
  _useState2 = _slicedToArray(_useState, 2),
9588
9724
  visible = _useState2[0],
@@ -9597,123 +9733,85 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9597
9733
  setSelectIds = _useState6[1];
9598
9734
  var _useState7 = useState([]),
9599
9735
  _useState8 = _slicedToArray(_useState7, 2),
9600
- goodList = _useState8[0],
9601
- setGoodList = _useState8[1];
9602
- var _useState9 = useState(false),
9736
+ allList = _useState8[0],
9737
+ setAllList = _useState8[1]; //获取到的所有数据
9738
+ var _useState9 = useState([]),
9603
9739
  _useState10 = _slicedToArray(_useState9, 2),
9604
- loading = _useState10[0],
9605
- setLoading = _useState10[1];
9606
- var _useState11 = useState({
9607
- apiName: 'queryItems',
9608
- desc: true,
9609
- numIids: '',
9610
- orderBy: 'list_time',
9611
- pageNo: 1,
9612
- pageSize: 10,
9613
- shopId: shopId,
9614
- type: 'onSale',
9615
- cids: '',
9616
- title: ''
9617
- }),
9740
+ filterList = _useState10[0],
9741
+ setFilterList = _useState10[1]; //获取到的筛选数据
9742
+ var _useState11 = useState(1),
9618
9743
  _useState12 = _slicedToArray(_useState11, 2),
9619
- searchParams = _useState12[0],
9620
- setSearch = _useState12[1];
9621
- var _useState13 = useState(0),
9622
- _useState14 = _slicedToArray(_useState13, 2),
9623
- total = _useState14[0],
9624
- setTotal = _useState14[1];
9625
- var _useState15 = useState(''),
9744
+ pageNo = _useState12[0],
9745
+ setPageNo = _useState12[1];
9746
+ var _useState13 = useState(20),
9747
+ _useState14 = _slicedToArray(_useState13, 1),
9748
+ pageSize = _useState14[0];
9749
+ var _useState15 = useState([]),
9626
9750
  _useState16 = _slicedToArray(_useState15, 2),
9627
- platform = _useState16[0],
9628
- setPlatform = _useState16[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9629
- var _useState17 = useState({}),
9751
+ goodList = _useState16[0],
9752
+ setGoodList = _useState16[1];
9753
+ var _useState17 = useState(false),
9630
9754
  _useState18 = _slicedToArray(_useState17, 2),
9631
- shopInfo = _useState18[0],
9632
- setShopInfo = _useState18[1]; //店铺信息
9633
- var _useState19 = useState([{
9634
- tab: '所选商品',
9635
- key: 'onSale'
9636
- }
9637
- // { tab: '已选商品', key: 'select' },
9638
- ]),
9639
- _useState20 = _slicedToArray(_useState19, 1),
9640
- tabs = _useState20[0];
9755
+ loading = _useState18[0],
9756
+ setLoading = _useState18[1];
9757
+ var _useState19 = useState(0),
9758
+ _useState20 = _slicedToArray(_useState19, 2),
9759
+ total = _useState20[0],
9760
+ setTotal = _useState20[1];
9761
+ var _useState21 = useState(''),
9762
+ _useState22 = _slicedToArray(_useState21, 2),
9763
+ platform = _useState22[0],
9764
+ setPlatform = _useState22[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9765
+ var _useState23 = useState({}),
9766
+ _useState24 = _slicedToArray(_useState23, 2),
9767
+ shopInfo = _useState24[0],
9768
+ setShopInfo = _useState24[1]; //店铺信息
9769
+ var _Form$useForm = Form.useForm(),
9770
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9771
+ form = _Form$useForm2[0];
9641
9772
  //选择页码
9642
- var pageChange = function pageChange(page, pageSize) {
9643
- setSearch(_objectSpread2(_objectSpread2({}, searchParams), {}, {
9644
- pageNo: page,
9645
- pageSize: pageSize
9646
- }));
9647
- };
9648
- /**
9649
- *
9650
- * @returns 获取查询参数
9651
- */
9652
- var queryPd = function queryPd() {
9653
- var params = {
9654
- apiName: 'queryItems',
9655
- desc: searchParams.desc,
9656
- productIds: searchParams.numIids,
9657
- orderBy: searchParams.orderBy,
9658
- pageNo: searchParams.pageNo,
9659
- pageSize: searchParams.pageSize,
9660
- shopId: shopId,
9661
- type: searchParams.type,
9662
- title: searchParams.title,
9663
- cids: searchParams.cids
9664
- };
9665
- return params;
9773
+ var pageChange = function pageChange(page) {
9774
+ setPageNo(page);
9775
+ setGoodList(_toConsumableArray(filterList).splice((page - 1) * pageSize, pageSize));
9666
9776
  };
9667
9777
  /**
9668
9778
  * 查询商品
9669
9779
  */
9670
- var queryItems = /*#__PURE__*/function () {
9671
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9672
- var params, res, _ref2, list, _total, nextKey, newList;
9673
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9674
- while (1) switch (_context.prev = _context.next) {
9675
- case 0:
9676
- _context.prev = 0;
9677
- setLoading(true);
9678
- params = _objectSpread2({}, queryPd());
9679
- params.shopName = shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.shopName;
9680
- params.platform = platform;
9681
- params.status = params.type === 'onSale' ? 1 : 0;
9682
- delete params.type;
9683
- _context.next = 9;
9684
- return extendRequest('/qy/gdfw/product/listProduct', {
9685
- method: 'post',
9686
- data: params
9687
- });
9688
- case 9:
9689
- res = _context.sent;
9690
- _ref2 = res.data || {
9691
- result: [],
9692
- total: 0
9693
- }, list = _ref2.result, _total = _ref2.total, nextKey = _ref2.nextKey;
9694
- newList = list || [];
9695
- newList.forEach(function (item) {
9696
- item.numIid = item.productId;
9697
- item.outerId = item.outId;
9698
- item.title = item.productName;
9699
- item.platform = platform;
9780
+ var queryItems = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9781
+ var params, res, products, newProducts;
9782
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9783
+ while (1) switch (_context.prev = _context.next) {
9784
+ case 0:
9785
+ _context.prev = 0;
9786
+ setLoading(true);
9787
+ params = {
9788
+ shopCode: shopCode
9789
+ };
9790
+ _context.next = 5;
9791
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9792
+ method: 'post',
9793
+ data: params
9794
+ });
9795
+ case 5:
9796
+ res = _context.sent;
9797
+ products = res.data.products;
9798
+ newProducts = products.map(function (item, index) {
9799
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9800
+ index: index + 1
9700
9801
  });
9701
- setGoodList(newList);
9702
- setTotal(_total);
9703
- case 15:
9704
- _context.prev = 15;
9705
- setLoading(false);
9706
- return _context.finish(15);
9707
- case 18:
9708
- case "end":
9709
- return _context.stop();
9710
- }
9711
- }, _callee, null, [[0,, 15, 18]]);
9712
- }));
9713
- return function queryItems() {
9714
- return _ref.apply(this, arguments);
9715
- };
9716
- }();
9802
+ });
9803
+ setAllList(_toConsumableArray(newProducts));
9804
+ initData(_toConsumableArray(newProducts));
9805
+ case 10:
9806
+ _context.prev = 10;
9807
+ setLoading(false);
9808
+ return _context.finish(10);
9809
+ case 13:
9810
+ case "end":
9811
+ return _context.stop();
9812
+ }
9813
+ }, _callee, null, [[0,, 10, 13]]);
9814
+ })), [shopCode]);
9717
9815
  useEffect(function () {
9718
9816
  var shopInfo = shopList.find(function (item) {
9719
9817
  return shopId === item.shopId || shopId === item.shopName;
@@ -9724,12 +9822,19 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9724
9822
  }, [shopId]);
9725
9823
  var rowSelection = {
9726
9824
  selectedRowKeys: selectIds,
9825
+ fixed: true,
9727
9826
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9728
9827
  console.log(selectedRowKeys, selectedRows, info);
9729
9828
  setSelectIds(selectedRowKeys);
9730
9829
  setSelect(_toConsumableArray(selectedRows));
9731
9830
  }
9732
9831
  };
9832
+ var initData = function initData(list) {
9833
+ setFilterList(_toConsumableArray(list));
9834
+ setGoodList(_toConsumableArray(list).splice(0, pageSize));
9835
+ setTotal(list.length);
9836
+ setPageNo(1);
9837
+ };
9733
9838
  var _onCancel = function onCancel() {
9734
9839
  setVisible(false);
9735
9840
  };
@@ -9737,8 +9842,23 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9737
9842
  onSubmit(selectList);
9738
9843
  _onCancel();
9739
9844
  };
9845
+ var onFinish = function onFinish(value) {
9846
+ var newFilterList = [];
9847
+ Object.keys(value).forEach(function (key) {
9848
+ if (value[key]) {
9849
+ newFilterList = allList.filter(function (item) {
9850
+ return item[key].indexOf(value[key]) > -1;
9851
+ });
9852
+ }
9853
+ });
9854
+ initData(newFilterList);
9855
+ };
9856
+ var onReset = function onReset() {
9857
+ form.resetFields();
9858
+ initData(_toConsumableArray(allList));
9859
+ };
9740
9860
  return /*#__PURE__*/React.createElement(Modal, {
9741
- title: '选择商品编码',
9861
+ title: '选择商品',
9742
9862
  okText: '确认',
9743
9863
  cancelText: '取消',
9744
9864
  visible: visible,
@@ -9748,52 +9868,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9748
9868
  },
9749
9869
  onOk: onOk,
9750
9870
  wrapClassName: "goodModal"
9751
- }, /*#__PURE__*/React.createElement(Tabs, {
9752
- type: "card",
9753
- activeKey: searchParams.type,
9754
- onChange: function onChange(e) {
9755
- var params = _objectSpread2(_objectSpread2({}, searchParams), {}, {
9756
- type: e,
9757
- pageNo: 1
9758
- });
9759
- setSearch(params);
9871
+ }, /*#__PURE__*/React.createElement(Form, {
9872
+ layout: "inline",
9873
+ form: form,
9874
+ onFinish: onFinish
9875
+ }, /*#__PURE__*/React.createElement(Form.Item, {
9876
+ name: "name"
9877
+ }, /*#__PURE__*/React.createElement(Input, {
9878
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",
9879
+ style: {
9880
+ width: 150
9760
9881
  }
9761
- }, tabs.map(function (tab) {
9762
- return /*#__PURE__*/React.createElement(TabPane$1, {
9763
- tab: tab.tab + (tab.key === 'select' ? "(".concat(selectList.length, ")") : ''),
9764
- key: tab.key
9765
- });
9766
- })), /*#__PURE__*/React.createElement("div", {
9767
- className: "searchBox",
9882
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9883
+ name: "code"
9884
+ }, /*#__PURE__*/React.createElement(Input, {
9885
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u7F16\u7801",
9768
9886
  style: {
9769
- display: searchParams.type === 'select' ? 'none' : ''
9887
+ width: 150
9888
+ }
9889
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9890
+ name: "skuCode"
9891
+ }, /*#__PURE__*/React.createElement(Input, {
9892
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1sku\u7F16\u7801",
9893
+ style: {
9894
+ width: 150
9770
9895
  }
9771
- }, /*#__PURE__*/React.createElement(Form, {
9772
- layout: "inline"
9773
- }, /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Input, {
9774
- placeholder: "\u6B3E\u5F0F\u7F16\u7801"
9775
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Input, {
9776
- placeholder: "\u5546\u54C1\u7F16\u7801"
9777
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Input, {
9778
- placeholder: "\u5546\u54C1\u540D\u79F0"
9779
9896
  })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
9780
9897
  type: "primary",
9781
9898
  htmlType: "submit"
9782
- }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, null, "\u91CD\u7F6E")))), /*#__PURE__*/React.createElement(Spin, {
9899
+ }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
9900
+ onClick: onReset
9901
+ }, "\u91CD\u7F6E"))), /*#__PURE__*/React.createElement(Spin, {
9783
9902
  spinning: loading
9784
9903
  }, /*#__PURE__*/React.createElement(Table, {
9785
9904
  rowSelection: rowSelection,
9786
9905
  columns: columns,
9787
- rowKey: 'numIid',
9788
- dataSource: searchParams.type == 'select' ? selectList : goodList,
9906
+ rowKey: 'skuCode',
9907
+ dataSource: goodList,
9789
9908
  scroll: {
9909
+ x: true,
9790
9910
  y: 300
9791
9911
  },
9792
9912
  pagination: {
9793
9913
  size: 'small',
9794
9914
  total: total,
9795
- current: searchParams.pageNo,
9796
- pageSize: searchParams.pageSize,
9915
+ current: pageNo,
9916
+ pageSize: pageSize,
9917
+ pageSizeOptions: [],
9797
9918
  onChange: pageChange
9798
9919
  }
9799
9920
  })));
@@ -9812,8 +9933,8 @@ var GoodItem = function GoodItem(props) {
9812
9933
  value = _props$value === void 0 ? [] : _props$value,
9813
9934
  onChange = props.onChange,
9814
9935
  disabled = props.disabled,
9815
- _props$showField = props.showField,
9816
- showField = _props$showField === void 0 ? [] : _props$showField,
9936
+ _props$showHeader = props.showHeader,
9937
+ showHeader = _props$showHeader === void 0 ? [] : _props$showHeader,
9817
9938
  width = props.width,
9818
9939
  _props$shopList = props.shopList,
9819
9940
  shopList = _props$shopList === void 0 ? [] : _props$shopList,
@@ -9825,16 +9946,19 @@ var GoodItem = function GoodItem(props) {
9825
9946
  showChangeBtn = _props$showChangeBtn === void 0 ? true : _props$showChangeBtn,
9826
9947
  _props$tableSelect = props.tableSelect,
9827
9948
  tableSelect = _props$tableSelect === void 0 ? false : _props$tableSelect,
9949
+ _props$selectType = props.selectType,
9950
+ selectType = _props$selectType === void 0 ? '' : _props$selectType,
9828
9951
  _props$otherOperation = props.otherOperations,
9829
9952
  otherOperations = _props$otherOperation === void 0 ? null : _props$otherOperation,
9830
9953
  _props$canUpdateNumbe = props.canUpdateNumber,
9831
9954
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
9955
+ shopCode = props.shopCode,
9832
9956
  onSelect = props.onSelect,
9833
9957
  onDelete = props.onDelete;
9834
9958
  var refModal = useRef();
9835
- var handleDelete = function handleDelete(index) {
9959
+ var handleDelete = function handleDelete(record, index) {
9836
9960
  onDelete === null || onDelete === void 0 ? void 0 : onDelete(value[index]);
9837
- var newList = value.filter(function (item, i) {
9961
+ var newList = _toConsumableArray(value).filter(function (item, i) {
9838
9962
  return index !== i;
9839
9963
  });
9840
9964
  onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(newList));
@@ -9844,10 +9968,8 @@ var GoodItem = function GoodItem(props) {
9844
9968
  selectedRowKeys = _useState2[0],
9845
9969
  setSelectedRowKeys = _useState2[1];
9846
9970
  useEffect(function () {
9847
- if (!tableSelect) {
9848
- setSelectedRowKeys([]);
9849
- }
9850
- }, [tableSelect]);
9971
+ setSelectedRowKeys([]);
9972
+ }, [tableSelect, selectType]);
9851
9973
  var updateHandle = function updateHandle(val, index, type) {
9852
9974
  if (value === null || value === void 0 ? void 0 : value.length) {
9853
9975
  value[index][type] = val;
@@ -9858,6 +9980,18 @@ var GoodItem = function GoodItem(props) {
9858
9980
  var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
9859
9981
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
9860
9982
  return [{
9983
+ dataIndex: 'pic',
9984
+ title: "\u56FE\u7247",
9985
+ align: 'center',
9986
+ ellipsis: true,
9987
+ width: 100,
9988
+ render: function render(val) {
9989
+ return /*#__PURE__*/React.createElement(Image, {
9990
+ width: 60,
9991
+ src: val
9992
+ });
9993
+ }
9994
+ }, {
9861
9995
  dataIndex: 'name',
9862
9996
  title: "".concat(text, "\u540D\u79F0"),
9863
9997
  align: 'center',
@@ -9890,6 +10024,8 @@ var GoodItem = function GoodItem(props) {
9890
10024
  render: function render(val, record, index) {
9891
10025
  return record.canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
9892
10026
  value: val,
10027
+ min: 0,
10028
+ precision: 0,
9893
10029
  onChange: function onChange(num) {
9894
10030
  return updateHandle(num, index, 'number');
9895
10031
  }
@@ -9919,20 +10055,8 @@ var GoodItem = function GoodItem(props) {
9919
10055
  render: function render(val, record, index) {
9920
10056
  return /*#__PURE__*/React.createElement("span", null, index + 1);
9921
10057
  }
9922
- }, {
9923
- dataIndex: 'pic',
9924
- title: "\u56FE\u7247",
9925
- align: 'center',
9926
- ellipsis: true,
9927
- width: 100,
9928
- render: function render(val) {
9929
- return /*#__PURE__*/React.createElement(Image, {
9930
- width: 60,
9931
- src: val
9932
- });
9933
- }
9934
10058
  }].concat(_toConsumableArray(GOODS_INFO_COLUMNS().filter(function (t) {
9935
- return showField.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
10059
+ return showHeader.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9936
10060
  })));
9937
10061
  if (!disabled) {
9938
10062
  columnList.push({
@@ -9945,30 +10069,32 @@ var GoodItem = function GoodItem(props) {
9945
10069
  return record.canDelete ? /*#__PURE__*/React.createElement(Button, {
9946
10070
  type: "link",
9947
10071
  onClick: function onClick() {
9948
- return handleDelete(index);
10072
+ return handleDelete(record, index);
9949
10073
  }
9950
10074
  }, "\u5220\u9664") : null;
9951
10075
  }
9952
10076
  });
9953
10077
  }
9954
10078
  return columnList;
9955
- }, [showField, value, disabled]);
10079
+ }, [showHeader, value, disabled]);
9956
10080
  var onSubmit = function onSubmit(list) {
9957
10081
  var newList = list.map(function (item) {
9958
- var picUrl = item.picUrl,
9959
- title = item.title,
9960
- price = item.price,
9961
- numIid = item.numIid;
10082
+ var goodsId = item.goodsId,
10083
+ name = item.name,
10084
+ code = item.code,
10085
+ skuCode = item.skuCode,
10086
+ marketPrice = item.marketPrice;
9962
10087
  return {
9963
- id: numIid,
9964
- pic: picUrl,
9965
- name: title,
9966
- code: '',
9967
- sku: '',
9968
- money: price,
9969
- share: '',
10088
+ id: goodsId,
10089
+ pic: '',
10090
+ name: name,
10091
+ code: code,
10092
+ sku: skuCode,
10093
+ money: marketPrice || 0,
10094
+ share: marketPrice || 0,
9970
10095
  number: 1,
9971
10096
  type: '',
10097
+ uuid: uuid(),
9972
10098
  canDelete: true,
9973
10099
  canUpdateNumber: canUpdateNumber
9974
10100
  };
@@ -9978,7 +10104,7 @@ var GoodItem = function GoodItem(props) {
9978
10104
  var onSelectChange = function onSelectChange(newSelectedRowKeys) {
9979
10105
  setSelectedRowKeys(newSelectedRowKeys);
9980
10106
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(value.filter(function (t) {
9981
- return newSelectedRowKeys.includes(t.id);
10107
+ return newSelectedRowKeys.includes(t.uuid);
9982
10108
  }));
9983
10109
  };
9984
10110
  var handleChangeGoods = function handleChangeGoods() {
@@ -10006,7 +10132,7 @@ var GoodItem = function GoodItem(props) {
10006
10132
  }, "\u9009\u62E9\u5546\u54C1"), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
10007
10133
  columns: newColumns,
10008
10134
  dataSource: value,
10009
- rowKey: 'id',
10135
+ rowKey: 'uuid',
10010
10136
  size: "small",
10011
10137
  pagination: false,
10012
10138
  scroll: {
@@ -10021,96 +10147,98 @@ var GoodItem = function GoodItem(props) {
10021
10147
  width: width,
10022
10148
  shopList: shopList,
10023
10149
  shopId: shopId,
10024
- maxLength: maxLength
10150
+ maxLength: maxLength,
10151
+ shopCode: shopCode
10025
10152
  }));
10026
10153
  };
10027
10154
 
10028
10155
  var BsGoods = function BsGoods(props) {
10156
+ var _withInfo$current3, _withInfo$current4;
10029
10157
  var value = props.value,
10030
- disabled = props.disabled;
10158
+ disabled = props.disabled,
10159
+ onChange = props.onChange;
10031
10160
  var _useState = useState(false),
10032
10161
  _useState2 = _slicedToArray(_useState, 2),
10033
10162
  tableSelect = _useState2[0],
10034
10163
  setTableSelect = _useState2[1];
10035
- var _useState3 = useState({
10036
- type: '',
10037
- val: ''
10038
- }),
10039
- _useState4 = _slicedToArray(_useState3, 2),
10040
- withInfo = _useState4[0],
10041
- setWithInfo = _useState4[1];
10042
- var ref = useRef();
10043
- var reissueRef = useRef();
10164
+ var withInfo = useRef(null);
10165
+ var valueRef = useRef(null);
10044
10166
  useEffect(function () {
10045
- ref.current = pubsub.subscribeOnce('type', function (type, val) {
10046
- console.log('goods', type, val, value);
10167
+ valueRef.current = value;
10168
+ pubsub.subscribe('type', function (type, val) {
10047
10169
  if (disabled) return;
10048
- setWithInfo({
10170
+ withInfo.current = {
10049
10171
  type: type,
10050
10172
  val: val
10051
- });
10173
+ };
10052
10174
  setTableSelect(['2', '4'].includes(val));
10053
- if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : value.length)) {
10175
+ if (['1', '3'].includes(val)) {
10054
10176
  pubsub.publish('selectList', {
10055
- type: val,
10056
- list: _toConsumableArray(value).map(function (item) {
10057
- item.canDelete = false;
10058
- return item;
10059
- })
10177
+ list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10060
10178
  });
10061
10179
  }
10062
10180
  });
10063
10181
  //补发
10064
- reissueRef.current = pubsub.subscribeOnce('reissueType', function (type, val) {
10182
+ pubsub.subscribe('reissueType', function (type, val) {
10065
10183
  if (disabled) return;
10066
- console.log('reissueType', type, val, value);
10067
- setWithInfo({
10184
+ withInfo.current = {
10068
10185
  type: type,
10069
10186
  val: val
10070
- });
10187
+ };
10071
10188
  setTableSelect(['2', '4'].includes(val));
10072
- if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : value.length)) {
10189
+ if (['1', '3'].includes(val)) {
10073
10190
  pubsub.publish('reissueSelectList', {
10074
- type: val,
10075
- list: (value || []).map(function (item) {
10076
- item.canDelete = false;
10077
- return item;
10078
- })
10191
+ list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10079
10192
  });
10080
10193
  }
10081
10194
  });
10082
- return function () {
10083
- pubsub.unsubscribe(ref.current);
10084
- pubsub.unsubscribe(reissueRef.current);
10085
- };
10086
- }, [value, withInfo, disabled]);
10087
- var _onSelect = useCallback(function (list) {
10195
+ }, [disabled, value]);
10196
+ // useEffect(() => {
10197
+ // if (!disabled) {
10198
+ // pubsub.publish('goodList', {
10199
+ // list: cloneDeep(value?.bsGoods || []),
10200
+ // });
10201
+ // }
10202
+ // }, [value, disabled]);
10203
+ var _onSelect = function onSelect(list) {
10204
+ var _withInfo$current, _withInfo$current2;
10088
10205
  if (disabled) return;
10089
- console.log('withInfo', withInfo, list);
10090
10206
  var newList = cloneDeep(list);
10091
- pubsub.publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
10092
- type: withInfo.val,
10207
+ var type = ((_withInfo$current = withInfo.current) === null || _withInfo$current === void 0 ? void 0 : _withInfo$current.type) === 'reissueType' ? 'reissueSelectList' : 'selectList';
10208
+ pubsub.publish(type, {
10209
+ type: (_withInfo$current2 = withInfo.current) === null || _withInfo$current2 === void 0 ? void 0 : _withInfo$current2.val,
10093
10210
  list: newList.map(function (item) {
10094
10211
  item.canDelete = true;
10095
10212
  return item;
10096
10213
  })
10097
10214
  });
10098
- }, [withInfo]);
10215
+ };
10099
10216
  var _onDelete = function onDelete(item) {
10100
- var deleteId = item === null || item === void 0 ? void 0 : item.id;
10217
+ var deleteId = item === null || item === void 0 ? void 0 : item.sku;
10101
10218
  pubsub.publish('deleteGood', deleteId);
10102
10219
  pubsub.publish('reissueDeleteGood', deleteId);
10103
10220
  };
10221
+ var changeHandle = function changeHandle(list) {
10222
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10223
+ bsGoods: list
10224
+ }));
10225
+ };
10104
10226
  return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10105
- key: 'bsGoods',
10106
- disabled: disabled
10227
+ key: 'bsGoods'
10107
10228
  }, props), {}, {
10108
- tableSelect: tableSelect,
10229
+ disabled: disabled,
10230
+ value: value === null || value === void 0 ? void 0 : value.bsGoods,
10231
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10232
+ tableSelect: ['2', '4'].includes(withInfo === null || withInfo === void 0 ? void 0 : (_withInfo$current3 = withInfo.current) === null || _withInfo$current3 === void 0 ? void 0 : _withInfo$current3.val),
10233
+ selectType: withInfo === null || withInfo === void 0 ? void 0 : (_withInfo$current4 = withInfo.current) === null || _withInfo$current4 === void 0 ? void 0 : _withInfo$current4.type,
10109
10234
  onSelect: function onSelect(list) {
10110
10235
  return _onSelect(list);
10111
10236
  },
10112
10237
  onDelete: function onDelete(item) {
10113
10238
  return _onDelete(item);
10239
+ },
10240
+ onChange: function onChange(val) {
10241
+ return changeHandle(val);
10114
10242
  }
10115
10243
  }));
10116
10244
  };
@@ -10124,17 +10252,18 @@ var BsExchange = function BsExchange(props) {
10124
10252
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10125
10253
  disabled = props.disabled,
10126
10254
  other = _objectWithoutProperties(props, _excluded$b);
10255
+ var _useState = useState([]),
10256
+ _useState2 = _slicedToArray(_useState, 2),
10257
+ bsGoods = _useState2[0],
10258
+ setBsGoods = _useState2[1];
10259
+ var valueRef = useRef({});
10260
+ // useEffect(() => {
10261
+ // pubsub.subscribe('goodList', (_: any, data: any) => {
10262
+ // setBsGoods(data.list);
10263
+ // });
10264
+ // }, []);
10127
10265
  useEffect(function () {
10128
- pubsub.subscribeOnce('selectList', function (_, data) {
10129
- if (disabled) return;
10130
- if (value) {
10131
- var newData = cloneDeep(data);
10132
- console.log('BsExchange', 'getListHandle', data, value, getListHandle(_toConsumableArray(newData.list), value));
10133
- onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10134
- bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10135
- }));
10136
- }
10137
- });
10266
+ valueRef.current = value;
10138
10267
  pubsub.subscribeOnce('deleteGood', function (_, data) {
10139
10268
  if (disabled) return;
10140
10269
  if (value) {
@@ -10143,48 +10272,75 @@ var BsExchange = function BsExchange(props) {
10143
10272
  if (['2', '4'].includes((_value$bsExchangeType = value.bsExchangeType) === null || _value$bsExchangeType === void 0 ? void 0 : _value$bsExchangeType[0])) {
10144
10273
  newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.map(function (item) {
10145
10274
  item.bsExchangeReturnGoods = item.bsExchangeReturnGoods.filter(function (t) {
10146
- return t.id !== data;
10275
+ return t.sku !== data;
10147
10276
  });
10148
10277
  return item;
10149
10278
  });
10150
10279
  } else if (['1', '3'].includes((_value$bsExchangeType2 = value.bsExchangeType) === null || _value$bsExchangeType2 === void 0 ? void 0 : _value$bsExchangeType2[0])) {
10151
10280
  newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.filter(function (item) {
10152
- return item.id !== data;
10281
+ return item.sku !== data;
10153
10282
  });
10154
10283
  }
10155
10284
  onChange(newValue);
10156
10285
  }
10157
10286
  });
10287
+ // pubsub.subscribeOnce('selectList', (_: any, data: any) => {
10288
+ // if (disabled) return;
10289
+ // if (value) {
10290
+ // const newData = cloneDeep(data);
10291
+ // onChange({
10292
+ // ...value,
10293
+ // bsExchangeReturnGoods: getListHandle([...newData.list], value),
10294
+ // });
10295
+ // }
10296
+ // });
10158
10297
  }, [value]);
10298
+ useEffect(function () {
10299
+ pubsub.subscribe('selectList', function (_, data) {
10300
+ if (disabled) return;
10301
+ // console.log('selectList', valueRef.current, data);
10302
+ if (valueRef.current) {
10303
+ var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10304
+ onChange(_objectSpread2(_objectSpread2({}, valueRef.current), {}, {
10305
+ bsExchangeReturnGoods: getListHandle(newDataList, valueRef.current)
10306
+ }));
10307
+ }
10308
+ });
10309
+ }, []);
10159
10310
  var getListHandle = function getListHandle(list, val) {
10160
- var _val$bsExchangeType;
10311
+ var _val$bsExchangeType, _val$bsExchangeType2;
10161
10312
  //如果是原单换
10162
10313
  if (['1', '3'].includes(val === null || val === void 0 ? void 0 : (_val$bsExchangeType = val.bsExchangeType) === null || _val$bsExchangeType === void 0 ? void 0 : _val$bsExchangeType[0])) {
10163
10314
  return list.reduce(function (prv, next) {
10164
- var _val$bsExchangeType2;
10165
10315
  next.canDelete = false;
10166
10316
  //数量大于1 拆开
10167
10317
  if (next.number > 1) {
10168
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10169
- t.number = 1;
10170
- return t;
10318
+ var newList = Array(next.number).fill({}).map(function () {
10319
+ var newNext = _objectSpread2({}, next);
10320
+ newNext.money = newNext.share;
10321
+ newNext.number = 1;
10322
+ newNext.uuid = uuid();
10323
+ return newNext;
10171
10324
  });
10172
10325
  prv.push.apply(prv, _toConsumableArray(newList));
10173
- } else if (['2', '4'].includes(val === null || val === void 0 ? void 0 : (_val$bsExchangeType2 = val.bsExchangeType) === null || _val$bsExchangeType2 === void 0 ? void 0 : _val$bsExchangeType2[0])) {
10326
+ } else {
10174
10327
  prv.push(_objectSpread2({}, next));
10175
10328
  }
10176
10329
  return prv;
10177
10330
  }, []);
10178
- } else {
10331
+ } else if (['2', '4'].includes(val === null || val === void 0 ? void 0 : (_val$bsExchangeType2 = val.bsExchangeType) === null || _val$bsExchangeType2 === void 0 ? void 0 : _val$bsExchangeType2[0])) {
10179
10332
  //补发换货
10180
10333
  return list.reduce(function (prv, next, index) {
10181
10334
  next.canDelete = true;
10182
10335
  next.index = index;
10183
10336
  //数量大于1 拆开
10184
10337
  if (next.number > 1) {
10185
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10186
- t.number = 1;
10187
- return t;
10338
+ var newList = Array(next.number).fill({}).map(function () {
10339
+ var newNext = _objectSpread2({}, next);
10340
+ newNext.money = newNext.share;
10341
+ newNext.number = 1;
10342
+ newNext.uuid = uuid();
10343
+ return newNext;
10188
10344
  });
10189
10345
  prv.push({
10190
10346
  bsExchangeReturnGoods: _toConsumableArray(newList),
@@ -10205,11 +10361,20 @@ var BsExchange = function BsExchange(props) {
10205
10361
  newValue.bsExchangeType = val;
10206
10362
  newValue.bsExchangeReturnGoods = [];
10207
10363
  newValue.bsExchangeGiftGoods = [];
10364
+ // if (['1', '3'].includes(val[0])) {
10365
+ // newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10366
+ // }
10208
10367
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10209
10368
  pubsub.publish('type', val[0]);
10210
10369
  };
10211
10370
  var changeHandle = function changeHandle(val, key) {
10212
10371
  var newValue = _objectSpread2({}, value);
10372
+ if (key === 'bsExchangeGiftGoods') {
10373
+ val = cloneDeep(val).map(function (t) {
10374
+ t.money = 0;
10375
+ return t;
10376
+ });
10377
+ }
10213
10378
  newValue[key] = val;
10214
10379
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10215
10380
  if (key === 'bsExchangeType') {
@@ -10218,7 +10383,7 @@ var BsExchange = function BsExchange(props) {
10218
10383
  }
10219
10384
  };
10220
10385
  var changeReturnHandle = function changeReturnHandle(val, index, key) {
10221
- // console.log('changeReturnHandle', val, index, key);
10386
+ console.log('changeReturnHandle', val, index, key);
10222
10387
  var newValue = _objectSpread2({}, value);
10223
10388
  newValue.bsExchangeReturnGoods[index][key] = (val || []).map(function (t) {
10224
10389
  t.index = index;
@@ -10267,15 +10432,22 @@ var BsExchange = function BsExchange(props) {
10267
10432
  disabled: disabled,
10268
10433
  showChangeBtn: false,
10269
10434
  value: value === null || value === void 0 ? void 0 : value.bsExchangeReturnGoods,
10435
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10270
10436
  onChange: function onChange(val) {
10271
10437
  return changeHandle(val, 'bsExchangeReturnGoods');
10272
10438
  }
10273
10439
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, ((value === null || value === void 0 ? void 0 : value.bsExchangeReturnGoods) || []).map(function (item, index) {
10274
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10440
+ return /*#__PURE__*/React.createElement("div", {
10441
+ style: {
10442
+ border: '1px dashed',
10443
+ marginBottom: '8px'
10444
+ }
10445
+ }, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10275
10446
  key: 'bsReturnGoods'
10276
10447
  }, other), {}, {
10277
10448
  disabled: disabled,
10278
10449
  showChangeBtn: showChangeBtn,
10450
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10279
10451
  value: item === null || item === void 0 ? void 0 : item.bsExchangeReturnGoods,
10280
10452
  onChange: function onChange(val) {
10281
10453
  return changeReturnHandle(val, index, 'bsExchangeReturnGoods');
@@ -10287,6 +10459,7 @@ var BsExchange = function BsExchange(props) {
10287
10459
  showChangeBtn: showChangeBtn,
10288
10460
  otherOperations: copyGoods(index),
10289
10461
  value: item === null || item === void 0 ? void 0 : item.bsExchangeSwapOutGoods,
10462
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10290
10463
  onChange: function onChange(val) {
10291
10464
  return changeReturnHandle(val, index, 'bsExchangeSwapOutGoods');
10292
10465
  }
@@ -10294,7 +10467,8 @@ var BsExchange = function BsExchange(props) {
10294
10467
  })), ['3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType6 = value.bsExchangeType) === null || _value$bsExchangeType6 === void 0 ? void 0 : _value$bsExchangeType6[0]) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "\u8D60\u54C1\u4FE1\u606F"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10295
10468
  headerText: "\u8D60\u54C1",
10296
10469
  key: 'bsGiftGoods',
10297
- disabled: disabled
10470
+ disabled: disabled,
10471
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode
10298
10472
  }, other), {}, {
10299
10473
  value: value === null || value === void 0 ? void 0 : value.bsExchangeGiftGoods,
10300
10474
  onChange: function onChange(val) {
@@ -10311,48 +10485,80 @@ var BsReissue = function BsReissue(props) {
10311
10485
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10312
10486
  disabled = props.disabled,
10313
10487
  other = _objectWithoutProperties(props, _excluded$c);
10488
+ var _useState = useState([]),
10489
+ _useState2 = _slicedToArray(_useState, 2),
10490
+ bsGoods = _useState2[0],
10491
+ setBsGoods = _useState2[1];
10492
+ var valueRef = useRef({});
10493
+ // useEffect(() => {
10494
+ // pubsub.subscribe('goodList', (_: any, data: any) => {
10495
+ // setBsGoods(data.list);
10496
+ // });
10497
+ // }, []);
10314
10498
  useEffect(function () {
10315
- pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10499
+ pubsub.subscribe('reissueSelectList', function (_, data) {
10316
10500
  if (disabled) return;
10317
- console.log(data, value);
10318
- if (value) {
10319
- var newData = cloneDeep(data);
10320
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10321
- bsReissueGoods: ((newData === null || newData === void 0 ? void 0 : newData.list) || []).map(function (item) {
10322
- item.money = 0;
10323
- item.canUpdateNumber = ['2', '4'].includes(newData === null || newData === void 0 ? void 0 : newData.type);
10324
- return item;
10325
- })
10326
- }));
10501
+ if (valueRef.current) {
10502
+ var newValue = _objectSpread2({}, valueRef.current);
10503
+ newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10504
+ item.money = 0;
10505
+ item.share = 0;
10506
+ item.canUpdateNumber = true;
10507
+ return item;
10508
+ });
10509
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10327
10510
  }
10328
10511
  });
10512
+ }, []);
10513
+ useEffect(function () {
10514
+ valueRef.current = value;
10329
10515
  pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10330
10516
  if (disabled) return;
10331
10517
  if (value) {
10332
10518
  var newValue = _objectSpread2({}, value);
10333
10519
  newValue.bsReissueGoods = newValue.bsReissueGoods.filter(function (item) {
10334
- return item.id !== data;
10520
+ return item.sku !== data;
10335
10521
  });
10336
10522
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10337
10523
  }
10338
10524
  });
10525
+ // pubsub.subscribeOnce('reissueSelectList', (_: any, data: any) => {
10526
+ // if (disabled) return;
10527
+ // if (value) {
10528
+ // const newValue = { ...value };
10529
+ // newValue.bsReissueGoods = data?.list.map((item: any) => {
10530
+ // item.money = 0;
10531
+ // item.share = 0;
10532
+ // item.canUpdateNumber = true;
10533
+ // return item;
10534
+ // });
10535
+ // onChange?.(newValue);
10536
+ // }
10537
+ // });
10339
10538
  }, [value, disabled]);
10340
10539
  var changeHandle = function changeHandle(val, key) {
10341
10540
  var newValue = _objectSpread2({}, value);
10342
10541
  if (key === 'bsReissueGoods') {
10343
10542
  val = (val || []).map(function (item) {
10344
10543
  item.money = 0;
10544
+ item.share = 0;
10345
10545
  return item;
10346
10546
  });
10347
10547
  }
10348
10548
  newValue[key] = val;
10349
- if (key === 'bsReissueType') {
10350
- newValue.bsReissueGoods = [];
10351
- }
10549
+ // if (key === 'bsReissueType') {
10550
+ // newValue.bsReissueGoods = [];
10551
+ // if (['1', '3'].includes(val[0])) {
10552
+ // newValue.bsReissueGoods = (bsGoods || []).map((item: any) => {
10553
+ // item.money = 0;
10554
+ // item.share = 0;
10555
+ // item.canUpdateNumber = false;
10556
+ // return item;
10557
+ // });
10558
+ // }
10559
+ // }
10352
10560
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10353
- if (key === 'bsReissueType') {
10354
- pubsub.publish('reissueType', val[0]);
10355
- }
10561
+ pubsub.publish('reissueType', val[0]);
10356
10562
  };
10357
10563
  //显示选择商品按钮 原单换不显示选择商品
10358
10564
  var showChangeBtn = useMemo(function () {
@@ -10370,12 +10576,13 @@ var BsReissue = function BsReissue(props) {
10370
10576
  onChange: function onChange(val) {
10371
10577
  return changeHandle(val, 'bsReissueType');
10372
10578
  }
10373
- }), /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10579
+ }), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10374
10580
  key: 'reissueGoods'
10375
10581
  }, other), {}, {
10376
10582
  disabled: disabled,
10377
10583
  canUpdateNumber: showChangeBtn,
10378
10584
  showChangeBtn: showChangeBtn,
10585
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10379
10586
  value: value === null || value === void 0 ? void 0 : value.bsReissueGoods,
10380
10587
  onChange: function onChange(val) {
10381
10588
  return changeHandle(val, 'bsReissueGoods');
@@ -10386,7 +10593,7 @@ var BsReissue = function BsReissue(props) {
10386
10593
  var css_248z$9 = ".goodsBox {\n display: flex;\n flex-wrap: wrap;\n}\n.goods-imgBox {\n position: relative;\n width: 80px;\n height: 80px;\n border: 1px solid #F2F3F5;\n margin: 0 10px 10px 0;\n text-align: center;\n}\n.icon-close {\n position: absolute;\n top: -5px;\n right: -5px;\n width: 13px;\n height: 13px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n z-index: 3;\n background-color: #fff;\n cursor: pointer;\n}\n.img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n.goods-title {\n margin: 0 0 10px 5px;\n color: #4E5969;\n}\n.deg90 {\n transform: rotate(90deg);\n}\n.goodMain {\n display: flex;\n flex-wrap: wrap;\n height: 265px;\n overflow-y: auto;\n margin-bottom: 10px;\n}\n.goodMain .goodItem {\n width: 140px;\n height: 175px;\n padding: 11px 10px 0;\n text-align: center;\n display: inline-block;\n vertical-align: top;\n margin-bottom: 10px;\n margin-right: 30px;\n border: 1px solid #e6e6e6;\n cursor: pointer;\n transition: border 0.3s;\n}\n.goodMain .goodItem .goodImg {\n width: 120px;\n height: 120px;\n}\n.goodMain .goodItem .goodText {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.goodMain .goodItem.active {\n border: 1px solid #3089dc;\n}\n.right-context {\n display: flex;\n flex-direction: column;\n}\n";
10387
10594
  styleInject(css_248z$9);
10388
10595
 
10389
- var TabPane$2 = Tabs.TabPane;
10596
+ var TabPane$1 = Tabs.TabPane;
10390
10597
  var Option$2 = Select.Option;
10391
10598
  var Search$1 = Input.Search;
10392
10599
  var GoodsModal$3 = function GoodsModal(props) {
@@ -10702,7 +10909,7 @@ var GoodsModal$3 = function GoodsModal(props) {
10702
10909
  }));
10703
10910
  }
10704
10911
  }, tabs.map(function (tab) {
10705
- return /*#__PURE__*/React.createElement(TabPane$2, {
10912
+ return /*#__PURE__*/React.createElement(TabPane$1, {
10706
10913
  tab: tab.tab + (tab.key === 'all' ? "(".concat(selectList.length, ")") : ''),
10707
10914
  key: tab.key
10708
10915
  });