@kmkf-fe-packages/basic-components 0.7.15-alpha.6 → 0.7.15-alpha.61

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) {
@@ -6940,7 +6941,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
6940
6941
  var beforeUpload = function beforeUpload(file) {
6941
6942
  console.log('beforeUpload', file);
6942
6943
  var size = file.size / 1024 / 1024 < maxSize;
6943
- if (value.length > maxCount) {
6944
+ if (value.length >= maxCount) {
6944
6945
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u4E2A\u6587\u4EF6\uFF01"));
6945
6946
  return Upload.LIST_IGNORE;
6946
6947
  }
@@ -6963,7 +6964,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
6963
6964
  className: styles$2.tips
6964
6965
  }, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React.createElement(Dragger, _objectSpread2({
6965
6966
  disabled: disabled,
6966
- multiple: true,
6967
+ multiple: false,
6967
6968
  accept: accept,
6968
6969
  name: "file",
6969
6970
  maxCount: maxCount,
@@ -7152,7 +7153,8 @@ function ApaasRate(props) {
7152
7153
  var address = AddressData.getInstance();
7153
7154
  var bsAddress = BsAddressData.getInstance();
7154
7155
  var Province = function Province(props) {
7155
- var type = props.type;
7156
+ var _props$type = props.type,
7157
+ type = _props$type === void 0 ? 'workOrder' : _props$type;
7156
7158
  var _useState = useState([]),
7157
7159
  _useState2 = _slicedToArray(_useState, 2),
7158
7160
  option = _useState2[0],
@@ -7163,7 +7165,7 @@ var Province = function Province(props) {
7163
7165
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7164
7166
  while (1) switch (_context.prev = _context.next) {
7165
7167
  case 0:
7166
- setOptions(type === 'workOrder' ? address.addressOptions || [] : bsAddress.addressOptions || []);
7168
+ setOptions(type !== 'bs' ? address.addressOptions || [] : bsAddress.addressOptions || []);
7167
7169
  case 1:
7168
7170
  case "end":
7169
7171
  return _context.stop();
@@ -7182,6 +7184,9 @@ var Province = function Province(props) {
7182
7184
  }, []);
7183
7185
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, _objectSpread2(_objectSpread2({}, props), {}, {
7184
7186
  options: option,
7187
+ style: {
7188
+ minWidth: '100px'
7189
+ },
7185
7190
  placeholder: "\u8BF7\u9009\u62E9\u7701\u5E02\u533A"
7186
7191
  })));
7187
7192
  };
@@ -7211,7 +7216,7 @@ var ParseLogistics = function ParseLogistics(props) {
7211
7216
  });
7212
7217
  };
7213
7218
  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",
7219
+ placeholder: "\u590D\u5236\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
7215
7220
  rows: 3,
7216
7221
  value: value,
7217
7222
  onChange: function onChange(e) {
@@ -7258,12 +7263,14 @@ var IdentifyAddress = function IdentifyAddress(props) {
7258
7263
  value: value.receiverName,
7259
7264
  disabled: disabled,
7260
7265
  placeholder: "\u6536\u4EF6\u4EBA\u59D3\u540D",
7266
+ allowClear: true,
7261
7267
  onChange: function onChange(e) {
7262
7268
  return changeHandle(e.target.value, 'receiverName');
7263
7269
  }
7264
7270
  }), /*#__PURE__*/React.createElement(Input, {
7265
7271
  value: value.receiverMobile,
7266
7272
  disabled: disabled,
7273
+ allowClear: true,
7267
7274
  placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
7268
7275
  onChange: function onChange(e) {
7269
7276
  return changeHandle(e.target.value, 'receiverMobile');
@@ -7280,6 +7287,7 @@ var IdentifyAddress = function IdentifyAddress(props) {
7280
7287
  value: value.detail,
7281
7288
  disabled: disabled,
7282
7289
  placeholder: "\u8BE6\u7EC6\u5730\u5740",
7290
+ allowClear: true,
7283
7291
  onChange: function onChange(e) {
7284
7292
  return changeHandle(e.target.value, 'detail');
7285
7293
  }
@@ -8947,31 +8955,43 @@ var Payment = function Payment(props) {
8947
8955
  name: 'enterprisePaymentTid',
8948
8956
  placeholder: '请输入订单编号',
8949
8957
  required: required,
8950
- show: true
8958
+ show: true,
8959
+ hidden: false
8951
8960
  }, {
8952
8961
  label: '打款金额',
8953
8962
  name: 'enterprisePaymentRefundFee',
8954
8963
  placeholder: '请输入打款金额',
8955
8964
  required: required,
8956
- show: true
8965
+ show: true,
8966
+ hidden: false
8957
8967
  }, {
8958
8968
  label: '买家昵称',
8959
8969
  name: 'enterprisePaymentBuyerNick',
8960
8970
  placeholder: '请输入买家昵称',
8961
8971
  required: false,
8962
- show: true
8972
+ show: true,
8973
+ hidden: false
8963
8974
  }, {
8964
8975
  label: '支付宝名称',
8965
8976
  name: 'enterprisePaymentAlipayNick',
8966
8977
  placeholder: '请输入支付宝名称',
8967
8978
  required: zhiFubaoRequired,
8968
- show: true
8979
+ show: true,
8980
+ hidden: false
8969
8981
  }, {
8970
8982
  label: '支付宝账号',
8971
8983
  name: 'enterprisePaymentAlipayNo',
8972
8984
  placeholder: '请输入支付宝账号',
8973
8985
  required: zhiFubaoRequired,
8974
- show: true
8986
+ show: true,
8987
+ hidden: false
8988
+ }, {
8989
+ label: '打款状态',
8990
+ name: 'enterprisePaymentStatus',
8991
+ placeholder: '',
8992
+ required: false,
8993
+ show: false,
8994
+ hidden: true
8975
8995
  }];
8976
8996
  return /*#__PURE__*/React.createElement(React.Fragment, null, PaymentList.map(function (item) {
8977
8997
  return item.show && /*#__PURE__*/React.createElement(Form.Item, {
@@ -9310,6 +9330,58 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9310
9330
  typeof onChange === 'function' && onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9311
9331
  trajectoryCompany: val
9312
9332
  }));
9333
+ handleSearchSnapshot(val);
9334
+ };
9335
+ var handleSearchSnapshot = function handleSearchSnapshot(company) {
9336
+ var trajectoryCompany = value.trajectoryCompany,
9337
+ trajectoryCode = value.trajectoryCode,
9338
+ trajectoryPhone = value.trajectoryPhone;
9339
+ var newCompany = company ? company : trajectoryCompany;
9340
+ //不展示拦截状态不请求
9341
+ if (!(showField && showField.includes('snapshot'))) {
9342
+ return;
9343
+ }
9344
+ if (disabled) {
9345
+ return;
9346
+ }
9347
+ if (newCompany === 'SF' && !(newCompany && trajectoryCode && trajectoryPhone)) {
9348
+ return;
9349
+ } else if (!(newCompany && trajectoryCode)) {
9350
+ return;
9351
+ }
9352
+ try {
9353
+ extendRequest('/qy/logistics/logisticsTraceSearch', {
9354
+ method: 'post',
9355
+ data: {
9356
+ mailNo: trajectoryCode,
9357
+ cpCode: newCompany,
9358
+ mobile: trajectoryPhone
9359
+ }
9360
+ }).then(function (res) {
9361
+ var result = res.result,
9362
+ success = res.success,
9363
+ data = res.data,
9364
+ msg = res.message;
9365
+ if (result === 100 || success) {
9366
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9367
+ trajectorySnapshot: data === null || data === void 0 ? void 0 : data.logisticsStatusDesc,
9368
+ trajectoryCompany: newCompany
9369
+ }));
9370
+ } else {
9371
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9372
+ trajectorySnapshot: '',
9373
+ trajectoryCompany: newCompany
9374
+ }));
9375
+ msg && message.error(msg);
9376
+ }
9377
+ });
9378
+ } catch (err) {
9379
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9380
+ trajectorySnapshot: '',
9381
+ trajectoryCompany: newCompany
9382
+ }));
9383
+ (err === null || err === void 0 ? void 0 : err.message) && message.error(err === null || err === void 0 ? void 0 : err.message);
9384
+ }
9313
9385
  };
9314
9386
  //物流公司
9315
9387
  var LogisticsCompany = function LogisticsCompany() {
@@ -9332,20 +9404,40 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9332
9404
  //物流单号
9333
9405
  var LogisticsCode = function LogisticsCode() {
9334
9406
  return /*#__PURE__*/React.createElement(Input, {
9335
- style: {
9336
- marginBottom: '8px'
9337
- },
9338
9407
  disabled: disabled,
9339
9408
  placeholder: "\u7269\u6D41\u5355\u53F7",
9340
9409
  onChange: function onChange(e) {
9341
9410
  return handleInputChange(e, 'trajectoryCode');
9342
9411
  },
9343
- value: value === null || value === void 0 ? void 0 : value.trajectoryCode
9412
+ value: value === null || value === void 0 ? void 0 : value.trajectoryCode,
9413
+ onBlur: function onBlur() {
9414
+ return handleSearchSnapshot();
9415
+ }
9416
+ });
9417
+ };
9418
+ //sf手机号
9419
+ var LogisticsPhone = function LogisticsPhone() {
9420
+ return /*#__PURE__*/React.createElement(Input, {
9421
+ disabled: disabled,
9422
+ style: {
9423
+ marginTop: '8px'
9424
+ },
9425
+ placeholder: "\u624B\u673A\u53F7",
9426
+ onChange: function onChange(e) {
9427
+ return handleInputChange(e, 'trajectoryPhone');
9428
+ },
9429
+ value: value === null || value === void 0 ? void 0 : value.trajectoryPhone,
9430
+ onBlur: function onBlur() {
9431
+ return handleSearchSnapshot();
9432
+ }
9344
9433
  });
9345
9434
  };
9346
9435
  //物流快照
9347
9436
  var LogisticsSnapshot = function LogisticsSnapshot() {
9348
9437
  return /*#__PURE__*/React.createElement(Input, {
9438
+ style: {
9439
+ marginTop: '8px'
9440
+ },
9349
9441
  disabled: true,
9350
9442
  placeholder: "\u7269\u6D41\u5FEB\u7167",
9351
9443
  onChange: function onChange(e) {
@@ -9354,7 +9446,7 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9354
9446
  value: value === null || value === void 0 ? void 0 : value.trajectorySnapshot
9355
9447
  });
9356
9448
  };
9357
- return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9449
+ 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
9450
  };
9359
9451
 
9360
9452
  var jstGoods = function jstGoods(props) {
@@ -9368,7 +9460,7 @@ var jstGoods = function jstGoods(props) {
9368
9460
  _props$type = props.type,
9369
9461
  type = _props$type === void 0 ? 1 : _props$type,
9370
9462
  _props$showField = props.showField,
9371
- showField = _props$showField === void 0 ? 'all' : _props$showField;
9463
+ showField = _props$showField === void 0 ? '' : _props$showField;
9372
9464
  var _useState = useState(0),
9373
9465
  _useState2 = _slicedToArray(_useState, 2),
9374
9466
  changeIndex = _useState2[0],
@@ -9418,7 +9510,7 @@ var jstGoods = function jstGoods(props) {
9418
9510
  return setChangeIndex(index);
9419
9511
  }
9420
9512
  }, "\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, {
9513
+ }))) : null, value.length ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 1 ? /*#__PURE__*/React.createElement(Space, null, !showField || showField === 'logisticsCompany' ? /*#__PURE__*/React.createElement(Select, {
9422
9514
  disabled: disabled,
9423
9515
  placeholder: "\u7269\u6D41\u516C\u53F8",
9424
9516
  onChange: function onChange(val) {
@@ -9433,14 +9525,14 @@ var jstGoods = function jstGoods(props) {
9433
9525
  style: {
9434
9526
  minWidth: '100px'
9435
9527
  }
9436
- }), /*#__PURE__*/React.createElement(Input, {
9528
+ }) : null, !showField || showField === 'logisticsCode' ? /*#__PURE__*/React.createElement(Input, {
9437
9529
  disabled: disabled,
9438
9530
  placeholder: "\u7269\u6D41\u5355\u53F7",
9439
9531
  onChange: function onChange(e) {
9440
9532
  return changeInputHandle(e.target.value, 'logisticsCode');
9441
9533
  },
9442
9534
  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, {
9535
+ }) : null) : null, type === 2 ? /*#__PURE__*/React.createElement(Space, null, ['supplyId', 'all'].includes(showField) && /*#__PURE__*/React.createElement(Input, {
9444
9536
  disabled: disabled,
9445
9537
  placeholder: "\u8BF7\u8F93\u5165\u4F9B\u9500\u5546\u7F16\u7801",
9446
9538
  onChange: function onChange(e) {
@@ -9545,44 +9637,79 @@ var ItemList = function ItemList(props) {
9545
9637
  }, "\u6682\u4E0D\u652F\u6301\u6DFB\u52A0")) : null);
9546
9638
  };
9547
9639
 
9548
- var TabPane$1 = Tabs.TabPane;
9549
9640
  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
- });
9641
+ dataIndex: 'index',
9642
+ title: '序号',
9643
+ render: function render(val, record, index) {
9644
+ return /*#__PURE__*/React.createElement("div", {
9645
+ style: {
9646
+ width: '50px'
9647
+ }
9648
+ }, index + 1);
9557
9649
  }
9558
9650
  }, {
9559
- dataIndex: 'outerId',
9560
- title: '款式编码'
9651
+ dataIndex: 'name',
9652
+ title: '商品名称',
9653
+ with: 200,
9654
+ ellipsis: true
9655
+ }, {
9656
+ dataIndex: 'goodsId',
9657
+ title: '商品id',
9658
+ with: 200,
9659
+ ellipsis: true
9561
9660
  }, {
9562
- dataIndex: 'numIid',
9563
- title: '商品编码'
9661
+ dataIndex: 'skuName',
9662
+ title: '商品sku名称',
9663
+ with: 200,
9664
+ ellipsis: true
9665
+ }, {
9666
+ dataIndex: 'code',
9667
+ title: '商品编码',
9668
+ with: 200,
9669
+ // ellipsis: true,
9670
+ render: function render(val) {
9671
+ return /*#__PURE__*/React.createElement("div", {
9672
+ style: {
9673
+ width: '100px'
9674
+ }
9675
+ }, val);
9676
+ }
9564
9677
  }, {
9565
- dataIndex: 'title',
9566
- title: '商品名称'
9678
+ dataIndex: 'skuCode',
9679
+ title: '商品sku编码',
9680
+ with: 200,
9681
+ ellipsis: true
9567
9682
  }, {
9568
- dataIndex: 'skus',
9569
- title: '颜色及规格'
9683
+ dataIndex: 'marketPrice',
9684
+ title: '市场价',
9685
+ // with: 200,
9686
+ // ellipsis: true,
9687
+ render: function render(val) {
9688
+ return /*#__PURE__*/React.createElement("div", {
9689
+ style: {
9690
+ width: '70px'
9691
+ }
9692
+ }, val);
9693
+ }
9570
9694
  }];
9571
9695
  var GoodsModal$1 = function GoodsModal(props, ref) {
9572
9696
  useImperativeHandle(ref, function () {
9573
9697
  return {
9574
9698
  open: function open() {
9575
9699
  setVisible(true);
9700
+ setPageNo(1);
9576
9701
  setSelect([]);
9577
9702
  setSelectIds([]);
9578
9703
  queryItems();
9704
+ onReset();
9579
9705
  }
9580
9706
  };
9581
9707
  });
9582
9708
  var onSubmit = props.onSubmit,
9583
9709
  shopId = props.shopId,
9584
9710
  shopList = props.shopList,
9585
- width = props.width;
9711
+ width = props.width,
9712
+ shopCode = props.shopCode;
9586
9713
  var _useState = useState(false),
9587
9714
  _useState2 = _slicedToArray(_useState, 2),
9588
9715
  visible = _useState2[0],
@@ -9597,123 +9724,85 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9597
9724
  setSelectIds = _useState6[1];
9598
9725
  var _useState7 = useState([]),
9599
9726
  _useState8 = _slicedToArray(_useState7, 2),
9600
- goodList = _useState8[0],
9601
- setGoodList = _useState8[1];
9602
- var _useState9 = useState(false),
9727
+ allList = _useState8[0],
9728
+ setAllList = _useState8[1]; //获取到的所有数据
9729
+ var _useState9 = useState([]),
9603
9730
  _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
- }),
9731
+ filterList = _useState10[0],
9732
+ setFilterList = _useState10[1]; //获取到的筛选数据
9733
+ var _useState11 = useState(1),
9618
9734
  _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(''),
9735
+ pageNo = _useState12[0],
9736
+ setPageNo = _useState12[1];
9737
+ var _useState13 = useState(20),
9738
+ _useState14 = _slicedToArray(_useState13, 1),
9739
+ pageSize = _useState14[0];
9740
+ var _useState15 = useState([]),
9626
9741
  _useState16 = _slicedToArray(_useState15, 2),
9627
- platform = _useState16[0],
9628
- setPlatform = _useState16[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9629
- var _useState17 = useState({}),
9742
+ goodList = _useState16[0],
9743
+ setGoodList = _useState16[1];
9744
+ var _useState17 = useState(false),
9630
9745
  _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];
9746
+ loading = _useState18[0],
9747
+ setLoading = _useState18[1];
9748
+ var _useState19 = useState(0),
9749
+ _useState20 = _slicedToArray(_useState19, 2),
9750
+ total = _useState20[0],
9751
+ setTotal = _useState20[1];
9752
+ var _useState21 = useState(''),
9753
+ _useState22 = _slicedToArray(_useState21, 2),
9754
+ platform = _useState22[0],
9755
+ setPlatform = _useState22[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9756
+ var _useState23 = useState({}),
9757
+ _useState24 = _slicedToArray(_useState23, 2),
9758
+ shopInfo = _useState24[0],
9759
+ setShopInfo = _useState24[1]; //店铺信息
9760
+ var _Form$useForm = Form.useForm(),
9761
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9762
+ form = _Form$useForm2[0];
9641
9763
  //选择页码
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;
9764
+ var pageChange = function pageChange(page) {
9765
+ setPageNo(page);
9766
+ setGoodList(_toConsumableArray(filterList).splice((page - 1) * pageSize, pageSize));
9666
9767
  };
9667
9768
  /**
9668
9769
  * 查询商品
9669
9770
  */
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;
9771
+ var queryItems = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9772
+ var params, res, products, newProducts;
9773
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9774
+ while (1) switch (_context.prev = _context.next) {
9775
+ case 0:
9776
+ _context.prev = 0;
9777
+ setLoading(true);
9778
+ params = {
9779
+ shopCode: shopCode
9780
+ };
9781
+ _context.next = 5;
9782
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9783
+ method: 'post',
9784
+ data: params
9785
+ });
9786
+ case 5:
9787
+ res = _context.sent;
9788
+ products = res.data.products;
9789
+ newProducts = products.map(function (item, index) {
9790
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9791
+ index: index + 1
9700
9792
  });
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
- }();
9793
+ });
9794
+ setAllList(_toConsumableArray(newProducts));
9795
+ initData(_toConsumableArray(newProducts));
9796
+ case 10:
9797
+ _context.prev = 10;
9798
+ setLoading(false);
9799
+ return _context.finish(10);
9800
+ case 13:
9801
+ case "end":
9802
+ return _context.stop();
9803
+ }
9804
+ }, _callee, null, [[0,, 10, 13]]);
9805
+ })), [shopCode]);
9717
9806
  useEffect(function () {
9718
9807
  var shopInfo = shopList.find(function (item) {
9719
9808
  return shopId === item.shopId || shopId === item.shopName;
@@ -9724,12 +9813,19 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9724
9813
  }, [shopId]);
9725
9814
  var rowSelection = {
9726
9815
  selectedRowKeys: selectIds,
9816
+ fixed: true,
9727
9817
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9728
9818
  console.log(selectedRowKeys, selectedRows, info);
9729
9819
  setSelectIds(selectedRowKeys);
9730
9820
  setSelect(_toConsumableArray(selectedRows));
9731
9821
  }
9732
9822
  };
9823
+ var initData = function initData(list) {
9824
+ setFilterList(_toConsumableArray(list));
9825
+ setGoodList(_toConsumableArray(list).splice(0, pageSize));
9826
+ setTotal(list.length);
9827
+ setPageNo(1);
9828
+ };
9733
9829
  var _onCancel = function onCancel() {
9734
9830
  setVisible(false);
9735
9831
  };
@@ -9737,8 +9833,23 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9737
9833
  onSubmit(selectList);
9738
9834
  _onCancel();
9739
9835
  };
9836
+ var onFinish = function onFinish(value) {
9837
+ var newFilterList = [];
9838
+ Object.keys(value).forEach(function (key) {
9839
+ if (value[key]) {
9840
+ newFilterList = allList.filter(function (item) {
9841
+ return item[key].indexOf(value[key]) > -1;
9842
+ });
9843
+ }
9844
+ });
9845
+ initData(newFilterList);
9846
+ };
9847
+ var onReset = function onReset() {
9848
+ form.resetFields();
9849
+ initData(_toConsumableArray(allList));
9850
+ };
9740
9851
  return /*#__PURE__*/React.createElement(Modal, {
9741
- title: '选择商品编码',
9852
+ title: '选择商品',
9742
9853
  okText: '确认',
9743
9854
  cancelText: '取消',
9744
9855
  visible: visible,
@@ -9748,52 +9859,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9748
9859
  },
9749
9860
  onOk: onOk,
9750
9861
  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);
9862
+ }, /*#__PURE__*/React.createElement(Form, {
9863
+ layout: "inline",
9864
+ form: form,
9865
+ onFinish: onFinish
9866
+ }, /*#__PURE__*/React.createElement(Form.Item, {
9867
+ name: "name"
9868
+ }, /*#__PURE__*/React.createElement(Input, {
9869
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",
9870
+ style: {
9871
+ width: 150
9760
9872
  }
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",
9873
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9874
+ name: "code"
9875
+ }, /*#__PURE__*/React.createElement(Input, {
9876
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u7F16\u7801",
9768
9877
  style: {
9769
- display: searchParams.type === 'select' ? 'none' : ''
9878
+ width: 150
9879
+ }
9880
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9881
+ name: "skuCode"
9882
+ }, /*#__PURE__*/React.createElement(Input, {
9883
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1sku\u7F16\u7801",
9884
+ style: {
9885
+ width: 150
9770
9886
  }
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
9887
  })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
9780
9888
  type: "primary",
9781
9889
  htmlType: "submit"
9782
- }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, null, "\u91CD\u7F6E")))), /*#__PURE__*/React.createElement(Spin, {
9890
+ }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
9891
+ onClick: onReset
9892
+ }, "\u91CD\u7F6E"))), /*#__PURE__*/React.createElement(Spin, {
9783
9893
  spinning: loading
9784
9894
  }, /*#__PURE__*/React.createElement(Table, {
9785
9895
  rowSelection: rowSelection,
9786
9896
  columns: columns,
9787
- rowKey: 'numIid',
9788
- dataSource: searchParams.type == 'select' ? selectList : goodList,
9897
+ rowKey: 'skuCode',
9898
+ dataSource: goodList,
9789
9899
  scroll: {
9900
+ x: true,
9790
9901
  y: 300
9791
9902
  },
9792
9903
  pagination: {
9793
9904
  size: 'small',
9794
9905
  total: total,
9795
- current: searchParams.pageNo,
9796
- pageSize: searchParams.pageSize,
9906
+ current: pageNo,
9907
+ pageSize: pageSize,
9908
+ pageSizeOptions: [],
9797
9909
  onChange: pageChange
9798
9910
  }
9799
9911
  })));
@@ -9812,8 +9924,8 @@ var GoodItem = function GoodItem(props) {
9812
9924
  value = _props$value === void 0 ? [] : _props$value,
9813
9925
  onChange = props.onChange,
9814
9926
  disabled = props.disabled,
9815
- _props$showField = props.showField,
9816
- showField = _props$showField === void 0 ? [] : _props$showField,
9927
+ _props$showHeader = props.showHeader,
9928
+ showHeader = _props$showHeader === void 0 ? [] : _props$showHeader,
9817
9929
  width = props.width,
9818
9930
  _props$shopList = props.shopList,
9819
9931
  shopList = _props$shopList === void 0 ? [] : _props$shopList,
@@ -9825,16 +9937,19 @@ var GoodItem = function GoodItem(props) {
9825
9937
  showChangeBtn = _props$showChangeBtn === void 0 ? true : _props$showChangeBtn,
9826
9938
  _props$tableSelect = props.tableSelect,
9827
9939
  tableSelect = _props$tableSelect === void 0 ? false : _props$tableSelect,
9940
+ _props$selectType = props.selectType,
9941
+ selectType = _props$selectType === void 0 ? '' : _props$selectType,
9828
9942
  _props$otherOperation = props.otherOperations,
9829
9943
  otherOperations = _props$otherOperation === void 0 ? null : _props$otherOperation,
9830
9944
  _props$canUpdateNumbe = props.canUpdateNumber,
9831
9945
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
9946
+ shopCode = props.shopCode,
9832
9947
  onSelect = props.onSelect,
9833
9948
  onDelete = props.onDelete;
9834
9949
  var refModal = useRef();
9835
- var handleDelete = function handleDelete(index) {
9950
+ var handleDelete = function handleDelete(record, index) {
9836
9951
  onDelete === null || onDelete === void 0 ? void 0 : onDelete(value[index]);
9837
- var newList = value.filter(function (item, i) {
9952
+ var newList = _toConsumableArray(value).filter(function (item, i) {
9838
9953
  return index !== i;
9839
9954
  });
9840
9955
  onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(newList));
@@ -9844,10 +9959,8 @@ var GoodItem = function GoodItem(props) {
9844
9959
  selectedRowKeys = _useState2[0],
9845
9960
  setSelectedRowKeys = _useState2[1];
9846
9961
  useEffect(function () {
9847
- if (!tableSelect) {
9848
- setSelectedRowKeys([]);
9849
- }
9850
- }, [tableSelect]);
9962
+ setSelectedRowKeys([]);
9963
+ }, [tableSelect, selectType]);
9851
9964
  var updateHandle = function updateHandle(val, index, type) {
9852
9965
  if (value === null || value === void 0 ? void 0 : value.length) {
9853
9966
  value[index][type] = val;
@@ -9858,6 +9971,18 @@ var GoodItem = function GoodItem(props) {
9858
9971
  var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
9859
9972
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
9860
9973
  return [{
9974
+ dataIndex: 'pic',
9975
+ title: "\u56FE\u7247",
9976
+ align: 'center',
9977
+ ellipsis: true,
9978
+ width: 100,
9979
+ render: function render(val) {
9980
+ return /*#__PURE__*/React.createElement(Image, {
9981
+ width: 60,
9982
+ src: val
9983
+ });
9984
+ }
9985
+ }, {
9861
9986
  dataIndex: 'name',
9862
9987
  title: "".concat(text, "\u540D\u79F0"),
9863
9988
  align: 'center',
@@ -9890,6 +10015,8 @@ var GoodItem = function GoodItem(props) {
9890
10015
  render: function render(val, record, index) {
9891
10016
  return record.canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
9892
10017
  value: val,
10018
+ min: 0,
10019
+ precision: 0,
9893
10020
  onChange: function onChange(num) {
9894
10021
  return updateHandle(num, index, 'number');
9895
10022
  }
@@ -9919,20 +10046,8 @@ var GoodItem = function GoodItem(props) {
9919
10046
  render: function render(val, record, index) {
9920
10047
  return /*#__PURE__*/React.createElement("span", null, index + 1);
9921
10048
  }
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
10049
  }].concat(_toConsumableArray(GOODS_INFO_COLUMNS().filter(function (t) {
9935
- return showField.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
10050
+ return showHeader.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9936
10051
  })));
9937
10052
  if (!disabled) {
9938
10053
  columnList.push({
@@ -9945,30 +10060,32 @@ var GoodItem = function GoodItem(props) {
9945
10060
  return record.canDelete ? /*#__PURE__*/React.createElement(Button, {
9946
10061
  type: "link",
9947
10062
  onClick: function onClick() {
9948
- return handleDelete(index);
10063
+ return handleDelete(record, index);
9949
10064
  }
9950
10065
  }, "\u5220\u9664") : null;
9951
10066
  }
9952
10067
  });
9953
10068
  }
9954
10069
  return columnList;
9955
- }, [showField, value, disabled]);
10070
+ }, [showHeader, value, disabled]);
9956
10071
  var onSubmit = function onSubmit(list) {
9957
10072
  var newList = list.map(function (item) {
9958
- var picUrl = item.picUrl,
9959
- title = item.title,
9960
- price = item.price,
9961
- numIid = item.numIid;
10073
+ var goodsId = item.goodsId,
10074
+ name = item.name,
10075
+ code = item.code,
10076
+ skuCode = item.skuCode,
10077
+ marketPrice = item.marketPrice;
9962
10078
  return {
9963
- id: numIid,
9964
- pic: picUrl,
9965
- name: title,
9966
- code: '',
9967
- sku: '',
9968
- money: price,
9969
- share: '',
10079
+ id: goodsId,
10080
+ pic: '',
10081
+ name: name,
10082
+ code: code,
10083
+ sku: skuCode,
10084
+ money: marketPrice || 0,
10085
+ share: marketPrice || 0,
9970
10086
  number: 1,
9971
10087
  type: '',
10088
+ uuid: uuid(),
9972
10089
  canDelete: true,
9973
10090
  canUpdateNumber: canUpdateNumber
9974
10091
  };
@@ -9978,7 +10095,7 @@ var GoodItem = function GoodItem(props) {
9978
10095
  var onSelectChange = function onSelectChange(newSelectedRowKeys) {
9979
10096
  setSelectedRowKeys(newSelectedRowKeys);
9980
10097
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(value.filter(function (t) {
9981
- return newSelectedRowKeys.includes(t.id);
10098
+ return newSelectedRowKeys.includes(t.uuid);
9982
10099
  }));
9983
10100
  };
9984
10101
  var handleChangeGoods = function handleChangeGoods() {
@@ -10006,7 +10123,7 @@ var GoodItem = function GoodItem(props) {
10006
10123
  }, "\u9009\u62E9\u5546\u54C1"), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
10007
10124
  columns: newColumns,
10008
10125
  dataSource: value,
10009
- rowKey: 'id',
10126
+ rowKey: 'uuid',
10010
10127
  size: "small",
10011
10128
  pagination: false,
10012
10129
  scroll: {
@@ -10021,96 +10138,91 @@ var GoodItem = function GoodItem(props) {
10021
10138
  width: width,
10022
10139
  shopList: shopList,
10023
10140
  shopId: shopId,
10024
- maxLength: maxLength
10141
+ maxLength: maxLength,
10142
+ shopCode: shopCode
10025
10143
  }));
10026
10144
  };
10027
10145
 
10028
10146
  var BsGoods = function BsGoods(props) {
10147
+ var _withInfo$current3, _withInfo$current4;
10029
10148
  var value = props.value,
10030
- disabled = props.disabled;
10149
+ disabled = props.disabled,
10150
+ onChange = props.onChange;
10031
10151
  var _useState = useState(false),
10032
10152
  _useState2 = _slicedToArray(_useState, 2),
10033
10153
  tableSelect = _useState2[0],
10034
10154
  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();
10155
+ // const [withInfo, setWithInfo] = useState({ type: '', val: '' });
10156
+ // const [withType, setWithType] = useState('');
10157
+ // const [withValue, setWithValue] = useState('');
10158
+ var withInfo = useRef(null);
10044
10159
  useEffect(function () {
10045
- ref.current = pubsub.subscribeOnce('type', function (type, val) {
10046
- console.log('goods', type, val, value);
10160
+ pubsub.subscribe('type', function (type, val) {
10047
10161
  if (disabled) return;
10048
- setWithInfo({
10162
+ console.log('type', type, val);
10163
+ withInfo.current = {
10049
10164
  type: type,
10050
10165
  val: val
10051
- });
10166
+ };
10052
10167
  setTableSelect(['2', '4'].includes(val));
10053
- if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : value.length)) {
10054
- pubsub.publish('selectList', {
10055
- type: val,
10056
- list: _toConsumableArray(value).map(function (item) {
10057
- item.canDelete = false;
10058
- return item;
10059
- })
10060
- });
10061
- }
10062
10168
  });
10063
10169
  //补发
10064
- reissueRef.current = pubsub.subscribeOnce('reissueType', function (type, val) {
10170
+ pubsub.subscribe('reissueType', function (type, val) {
10065
10171
  if (disabled) return;
10066
- console.log('reissueType', type, val, value);
10067
- setWithInfo({
10172
+ console.log('reissueType', type, val);
10173
+ withInfo.current = {
10068
10174
  type: type,
10069
10175
  val: val
10070
- });
10176
+ };
10071
10177
  setTableSelect(['2', '4'].includes(val));
10072
- if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : value.length)) {
10073
- pubsub.publish('reissueSelectList', {
10074
- type: val,
10075
- list: (value || []).map(function (item) {
10076
- item.canDelete = false;
10077
- return item;
10078
- })
10079
- });
10080
- }
10081
10178
  });
10082
- return function () {
10083
- pubsub.unsubscribe(ref.current);
10084
- pubsub.unsubscribe(reissueRef.current);
10085
- };
10086
- }, [value, withInfo, disabled]);
10087
- var _onSelect = useCallback(function (list) {
10179
+ }, [disabled]);
10180
+ useEffect(function () {
10181
+ if (!disabled) {
10182
+ pubsub.publish('goodList', {
10183
+ list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10184
+ });
10185
+ }
10186
+ }, [value, disabled]);
10187
+ var _onSelect = function onSelect(list) {
10188
+ var _withInfo$current, _withInfo$current2;
10088
10189
  if (disabled) return;
10089
- console.log('withInfo', withInfo, list);
10090
10190
  var newList = cloneDeep(list);
10091
- pubsub.publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
10092
- type: withInfo.val,
10191
+ var type = ((_withInfo$current = withInfo.current) === null || _withInfo$current === void 0 ? void 0 : _withInfo$current.type) === 'reissueType' ? 'reissueSelectList' : 'selectList';
10192
+ pubsub.publish(type, {
10193
+ type: (_withInfo$current2 = withInfo.current) === null || _withInfo$current2 === void 0 ? void 0 : _withInfo$current2.val,
10093
10194
  list: newList.map(function (item) {
10094
10195
  item.canDelete = true;
10095
10196
  return item;
10096
10197
  })
10097
10198
  });
10098
- }, [withInfo]);
10199
+ };
10099
10200
  var _onDelete = function onDelete(item) {
10100
- var deleteId = item === null || item === void 0 ? void 0 : item.id;
10201
+ var deleteId = item === null || item === void 0 ? void 0 : item.sku;
10101
10202
  pubsub.publish('deleteGood', deleteId);
10102
10203
  pubsub.publish('reissueDeleteGood', deleteId);
10103
10204
  };
10205
+ var changeHandle = function changeHandle(list) {
10206
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10207
+ bsGoods: list
10208
+ }));
10209
+ };
10104
10210
  return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10105
- key: 'bsGoods',
10106
- disabled: disabled
10211
+ key: 'bsGoods'
10107
10212
  }, props), {}, {
10108
- tableSelect: tableSelect,
10213
+ disabled: disabled,
10214
+ value: value === null || value === void 0 ? void 0 : value.bsGoods,
10215
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10216
+ 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),
10217
+ selectType: withInfo === null || withInfo === void 0 ? void 0 : (_withInfo$current4 = withInfo.current) === null || _withInfo$current4 === void 0 ? void 0 : _withInfo$current4.type,
10109
10218
  onSelect: function onSelect(list) {
10110
10219
  return _onSelect(list);
10111
10220
  },
10112
10221
  onDelete: function onDelete(item) {
10113
10222
  return _onDelete(item);
10223
+ },
10224
+ onChange: function onChange(val) {
10225
+ return changeHandle(val);
10114
10226
  }
10115
10227
  }));
10116
10228
  };
@@ -10124,17 +10236,16 @@ var BsExchange = function BsExchange(props) {
10124
10236
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10125
10237
  disabled = props.disabled,
10126
10238
  other = _objectWithoutProperties(props, _excluded$b);
10239
+ var _useState = useState([]),
10240
+ _useState2 = _slicedToArray(_useState, 2),
10241
+ bsGoods = _useState2[0],
10242
+ setBsGoods = _useState2[1];
10127
10243
  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
- }
10244
+ pubsub.subscribe('goodList', function (_, data) {
10245
+ setBsGoods(data.list);
10137
10246
  });
10247
+ }, []);
10248
+ useEffect(function () {
10138
10249
  pubsub.subscribeOnce('deleteGood', function (_, data) {
10139
10250
  if (disabled) return;
10140
10251
  if (value) {
@@ -10143,48 +10254,63 @@ var BsExchange = function BsExchange(props) {
10143
10254
  if (['2', '4'].includes((_value$bsExchangeType = value.bsExchangeType) === null || _value$bsExchangeType === void 0 ? void 0 : _value$bsExchangeType[0])) {
10144
10255
  newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.map(function (item) {
10145
10256
  item.bsExchangeReturnGoods = item.bsExchangeReturnGoods.filter(function (t) {
10146
- return t.id !== data;
10257
+ return t.sku !== data;
10147
10258
  });
10148
10259
  return item;
10149
10260
  });
10150
10261
  } else if (['1', '3'].includes((_value$bsExchangeType2 = value.bsExchangeType) === null || _value$bsExchangeType2 === void 0 ? void 0 : _value$bsExchangeType2[0])) {
10151
10262
  newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.filter(function (item) {
10152
- return item.id !== data;
10263
+ return item.sku !== data;
10153
10264
  });
10154
10265
  }
10155
10266
  onChange(newValue);
10156
10267
  }
10157
10268
  });
10269
+ pubsub.subscribeOnce('selectList', function (_, data) {
10270
+ if (disabled) return;
10271
+ if (value) {
10272
+ var newData = cloneDeep(data);
10273
+ console.log(getListHandle(_toConsumableArray(newData.list), value));
10274
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10275
+ bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10276
+ }));
10277
+ }
10278
+ });
10158
10279
  }, [value]);
10159
10280
  var getListHandle = function getListHandle(list, val) {
10160
- var _val$bsExchangeType;
10281
+ var _val$bsExchangeType, _val$bsExchangeType2;
10161
10282
  //如果是原单换
10162
10283
  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
10284
  return list.reduce(function (prv, next) {
10164
- var _val$bsExchangeType2;
10165
10285
  next.canDelete = false;
10166
10286
  //数量大于1 拆开
10167
10287
  if (next.number > 1) {
10168
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10169
- t.number = 1;
10170
- return t;
10288
+ var newList = Array(next.number).fill({}).map(function () {
10289
+ var newNext = _objectSpread2({}, next);
10290
+ newNext.money = newNext.share;
10291
+ newNext.number = 1;
10292
+ newNext.uuid = uuid();
10293
+ return newNext;
10171
10294
  });
10172
10295
  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])) {
10296
+ } else {
10174
10297
  prv.push(_objectSpread2({}, next));
10175
10298
  }
10176
10299
  return prv;
10177
10300
  }, []);
10178
- } else {
10301
+ } 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
10302
  //补发换货
10180
10303
  return list.reduce(function (prv, next, index) {
10181
10304
  next.canDelete = true;
10182
10305
  next.index = index;
10183
10306
  //数量大于1 拆开
10184
10307
  if (next.number > 1) {
10185
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10186
- t.number = 1;
10187
- return t;
10308
+ var newList = Array(next.number).fill({}).map(function () {
10309
+ var newNext = _objectSpread2({}, next);
10310
+ newNext.money = newNext.share;
10311
+ newNext.number = 1;
10312
+ newNext.uuid = uuid();
10313
+ return newNext;
10188
10314
  });
10189
10315
  prv.push({
10190
10316
  bsExchangeReturnGoods: _toConsumableArray(newList),
@@ -10205,11 +10331,20 @@ var BsExchange = function BsExchange(props) {
10205
10331
  newValue.bsExchangeType = val;
10206
10332
  newValue.bsExchangeReturnGoods = [];
10207
10333
  newValue.bsExchangeGiftGoods = [];
10334
+ if (['1', '3'].includes(val[0])) {
10335
+ newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10336
+ }
10208
10337
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10209
10338
  pubsub.publish('type', val[0]);
10210
10339
  };
10211
10340
  var changeHandle = function changeHandle(val, key) {
10212
10341
  var newValue = _objectSpread2({}, value);
10342
+ if (key === 'bsExchangeGiftGoods') {
10343
+ val = cloneDeep(val).map(function (t) {
10344
+ t.money = 0;
10345
+ return t;
10346
+ });
10347
+ }
10213
10348
  newValue[key] = val;
10214
10349
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10215
10350
  if (key === 'bsExchangeType') {
@@ -10218,7 +10353,7 @@ var BsExchange = function BsExchange(props) {
10218
10353
  }
10219
10354
  };
10220
10355
  var changeReturnHandle = function changeReturnHandle(val, index, key) {
10221
- // console.log('changeReturnHandle', val, index, key);
10356
+ console.log('changeReturnHandle', val, index, key);
10222
10357
  var newValue = _objectSpread2({}, value);
10223
10358
  newValue.bsExchangeReturnGoods[index][key] = (val || []).map(function (t) {
10224
10359
  t.index = index;
@@ -10267,15 +10402,22 @@ var BsExchange = function BsExchange(props) {
10267
10402
  disabled: disabled,
10268
10403
  showChangeBtn: false,
10269
10404
  value: value === null || value === void 0 ? void 0 : value.bsExchangeReturnGoods,
10405
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10270
10406
  onChange: function onChange(val) {
10271
10407
  return changeHandle(val, 'bsExchangeReturnGoods');
10272
10408
  }
10273
10409
  })) : /*#__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({
10410
+ return /*#__PURE__*/React.createElement("div", {
10411
+ style: {
10412
+ border: '1px dashed',
10413
+ marginBottom: '8px'
10414
+ }
10415
+ }, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10275
10416
  key: 'bsReturnGoods'
10276
10417
  }, other), {}, {
10277
10418
  disabled: disabled,
10278
10419
  showChangeBtn: showChangeBtn,
10420
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10279
10421
  value: item === null || item === void 0 ? void 0 : item.bsExchangeReturnGoods,
10280
10422
  onChange: function onChange(val) {
10281
10423
  return changeReturnHandle(val, index, 'bsExchangeReturnGoods');
@@ -10287,6 +10429,7 @@ var BsExchange = function BsExchange(props) {
10287
10429
  showChangeBtn: showChangeBtn,
10288
10430
  otherOperations: copyGoods(index),
10289
10431
  value: item === null || item === void 0 ? void 0 : item.bsExchangeSwapOutGoods,
10432
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10290
10433
  onChange: function onChange(val) {
10291
10434
  return changeReturnHandle(val, index, 'bsExchangeSwapOutGoods');
10292
10435
  }
@@ -10294,7 +10437,8 @@ var BsExchange = function BsExchange(props) {
10294
10437
  })), ['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
10438
  headerText: "\u8D60\u54C1",
10296
10439
  key: 'bsGiftGoods',
10297
- disabled: disabled
10440
+ disabled: disabled,
10441
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode
10298
10442
  }, other), {}, {
10299
10443
  value: value === null || value === void 0 ? void 0 : value.bsExchangeGiftGoods,
10300
10444
  onChange: function onChange(val) {
@@ -10311,27 +10455,35 @@ var BsReissue = function BsReissue(props) {
10311
10455
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10312
10456
  disabled = props.disabled,
10313
10457
  other = _objectWithoutProperties(props, _excluded$c);
10458
+ var _useState = useState([]),
10459
+ _useState2 = _slicedToArray(_useState, 2),
10460
+ bsGoods = _useState2[0],
10461
+ setBsGoods = _useState2[1];
10314
10462
  useEffect(function () {
10315
- pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10463
+ pubsub.subscribe('goodList', function (_, data) {
10464
+ setBsGoods(data.list);
10465
+ });
10466
+ }, []);
10467
+ useEffect(function () {
10468
+ pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10316
10469
  if (disabled) return;
10317
- console.log(data, value);
10318
10470
  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
- }));
10471
+ var newValue = _objectSpread2({}, value);
10472
+ newValue.bsReissueGoods = newValue.bsReissueGoods.filter(function (item) {
10473
+ return item.sku !== data;
10474
+ });
10475
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10327
10476
  }
10328
10477
  });
10329
- pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10478
+ pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10330
10479
  if (disabled) return;
10331
10480
  if (value) {
10332
10481
  var newValue = _objectSpread2({}, value);
10333
- newValue.bsReissueGoods = newValue.bsReissueGoods.filter(function (item) {
10334
- return item.id !== data;
10482
+ newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10483
+ item.money = 0;
10484
+ item.share = 0;
10485
+ item.canUpdateNumber = true;
10486
+ return item;
10335
10487
  });
10336
10488
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10337
10489
  }
@@ -10342,17 +10494,24 @@ var BsReissue = function BsReissue(props) {
10342
10494
  if (key === 'bsReissueGoods') {
10343
10495
  val = (val || []).map(function (item) {
10344
10496
  item.money = 0;
10497
+ item.share = 0;
10345
10498
  return item;
10346
10499
  });
10347
10500
  }
10348
10501
  newValue[key] = val;
10349
10502
  if (key === 'bsReissueType') {
10350
10503
  newValue.bsReissueGoods = [];
10504
+ if (['1', '3'].includes(val[0])) {
10505
+ newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
10506
+ item.money = 0;
10507
+ item.share = 0;
10508
+ item.canUpdateNumber = false;
10509
+ return item;
10510
+ });
10511
+ }
10351
10512
  }
10352
10513
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10353
- if (key === 'bsReissueType') {
10354
- pubsub.publish('reissueType', val[0]);
10355
- }
10514
+ pubsub.publish('reissueType', val[0]);
10356
10515
  };
10357
10516
  //显示选择商品按钮 原单换不显示选择商品
10358
10517
  var showChangeBtn = useMemo(function () {
@@ -10370,12 +10529,13 @@ var BsReissue = function BsReissue(props) {
10370
10529
  onChange: function onChange(val) {
10371
10530
  return changeHandle(val, 'bsReissueType');
10372
10531
  }
10373
- }), /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10532
+ }), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10374
10533
  key: 'reissueGoods'
10375
10534
  }, other), {}, {
10376
10535
  disabled: disabled,
10377
10536
  canUpdateNumber: showChangeBtn,
10378
10537
  showChangeBtn: showChangeBtn,
10538
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10379
10539
  value: value === null || value === void 0 ? void 0 : value.bsReissueGoods,
10380
10540
  onChange: function onChange(val) {
10381
10541
  return changeHandle(val, 'bsReissueGoods');
@@ -10386,7 +10546,7 @@ var BsReissue = function BsReissue(props) {
10386
10546
  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
10547
  styleInject(css_248z$9);
10388
10548
 
10389
- var TabPane$2 = Tabs.TabPane;
10549
+ var TabPane$1 = Tabs.TabPane;
10390
10550
  var Option$2 = Select.Option;
10391
10551
  var Search$1 = Input.Search;
10392
10552
  var GoodsModal$3 = function GoodsModal(props) {
@@ -10702,7 +10862,7 @@ var GoodsModal$3 = function GoodsModal(props) {
10702
10862
  }));
10703
10863
  }
10704
10864
  }, tabs.map(function (tab) {
10705
- return /*#__PURE__*/React.createElement(TabPane$2, {
10865
+ return /*#__PURE__*/React.createElement(TabPane$1, {
10706
10866
  tab: tab.tab + (tab.key === 'all' ? "(".concat(selectList.length, ")") : ''),
10707
10867
  key: tab.key
10708
10868
  });