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

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,51 @@ 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
+ if (newCompany === 'SF' && !(newCompany && trajectoryCode && trajectoryPhone)) {
9341
+ return;
9342
+ } else if (!(newCompany && trajectoryCode)) {
9343
+ return;
9344
+ }
9345
+ try {
9346
+ extendRequest('/qy/logistics/logisticsTraceSearch', {
9347
+ method: 'post',
9348
+ data: {
9349
+ mailNo: trajectoryCode,
9350
+ cpCode: newCompany,
9351
+ mobile: trajectoryPhone
9352
+ }
9353
+ }).then(function (res) {
9354
+ var result = res.result,
9355
+ success = res.success,
9356
+ data = res.data,
9357
+ msg = res.message;
9358
+ if (result === 100 || success) {
9359
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9360
+ trajectorySnapshot: data === null || data === void 0 ? void 0 : data.logisticsStatusDesc,
9361
+ trajectoryCompany: newCompany
9362
+ }));
9363
+ } else {
9364
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9365
+ trajectorySnapshot: '',
9366
+ trajectoryCompany: newCompany
9367
+ }));
9368
+ msg && message.error(msg);
9369
+ }
9370
+ });
9371
+ } catch (err) {
9372
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9373
+ trajectorySnapshot: '',
9374
+ trajectoryCompany: newCompany
9375
+ }));
9376
+ (err === null || err === void 0 ? void 0 : err.message) && message.error(err === null || err === void 0 ? void 0 : err.message);
9377
+ }
9313
9378
  };
9314
9379
  //物流公司
9315
9380
  var LogisticsCompany = function LogisticsCompany() {
@@ -9332,20 +9397,40 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9332
9397
  //物流单号
9333
9398
  var LogisticsCode = function LogisticsCode() {
9334
9399
  return /*#__PURE__*/React.createElement(Input, {
9335
- style: {
9336
- marginBottom: '8px'
9337
- },
9338
9400
  disabled: disabled,
9339
9401
  placeholder: "\u7269\u6D41\u5355\u53F7",
9340
9402
  onChange: function onChange(e) {
9341
9403
  return handleInputChange(e, 'trajectoryCode');
9342
9404
  },
9343
- value: value === null || value === void 0 ? void 0 : value.trajectoryCode
9405
+ value: value === null || value === void 0 ? void 0 : value.trajectoryCode,
9406
+ onBlur: function onBlur() {
9407
+ return handleSearchSnapshot();
9408
+ }
9409
+ });
9410
+ };
9411
+ //sf手机号
9412
+ var LogisticsPhone = function LogisticsPhone() {
9413
+ return /*#__PURE__*/React.createElement(Input, {
9414
+ disabled: disabled,
9415
+ style: {
9416
+ marginTop: '8px'
9417
+ },
9418
+ placeholder: "\u624B\u673A\u53F7",
9419
+ onChange: function onChange(e) {
9420
+ return handleInputChange(e, 'trajectoryPhone');
9421
+ },
9422
+ value: value === null || value === void 0 ? void 0 : value.trajectoryPhone,
9423
+ onBlur: function onBlur() {
9424
+ return handleSearchSnapshot();
9425
+ }
9344
9426
  });
9345
9427
  };
9346
9428
  //物流快照
9347
9429
  var LogisticsSnapshot = function LogisticsSnapshot() {
9348
9430
  return /*#__PURE__*/React.createElement(Input, {
9431
+ style: {
9432
+ marginTop: '8px'
9433
+ },
9349
9434
  disabled: true,
9350
9435
  placeholder: "\u7269\u6D41\u5FEB\u7167",
9351
9436
  onChange: function onChange(e) {
@@ -9354,7 +9439,7 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9354
9439
  value: value === null || value === void 0 ? void 0 : value.trajectorySnapshot
9355
9440
  });
9356
9441
  };
9357
- return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9442
+ 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
9443
  };
9359
9444
 
9360
9445
  var jstGoods = function jstGoods(props) {
@@ -9368,7 +9453,7 @@ var jstGoods = function jstGoods(props) {
9368
9453
  _props$type = props.type,
9369
9454
  type = _props$type === void 0 ? 1 : _props$type,
9370
9455
  _props$showField = props.showField,
9371
- showField = _props$showField === void 0 ? 'all' : _props$showField;
9456
+ showField = _props$showField === void 0 ? '' : _props$showField;
9372
9457
  var _useState = useState(0),
9373
9458
  _useState2 = _slicedToArray(_useState, 2),
9374
9459
  changeIndex = _useState2[0],
@@ -9418,7 +9503,7 @@ var jstGoods = function jstGoods(props) {
9418
9503
  return setChangeIndex(index);
9419
9504
  }
9420
9505
  }, "\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, {
9506
+ }))) : null, value.length ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 1 ? /*#__PURE__*/React.createElement(Space, null, !showField || showField === 'logisticsCompany' ? /*#__PURE__*/React.createElement(Select, {
9422
9507
  disabled: disabled,
9423
9508
  placeholder: "\u7269\u6D41\u516C\u53F8",
9424
9509
  onChange: function onChange(val) {
@@ -9433,14 +9518,14 @@ var jstGoods = function jstGoods(props) {
9433
9518
  style: {
9434
9519
  minWidth: '100px'
9435
9520
  }
9436
- }), /*#__PURE__*/React.createElement(Input, {
9521
+ }) : null, !showField || showField === 'logisticsCode' ? /*#__PURE__*/React.createElement(Input, {
9437
9522
  disabled: disabled,
9438
9523
  placeholder: "\u7269\u6D41\u5355\u53F7",
9439
9524
  onChange: function onChange(e) {
9440
9525
  return changeInputHandle(e.target.value, 'logisticsCode');
9441
9526
  },
9442
9527
  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, {
9528
+ }) : null) : null, type === 2 ? /*#__PURE__*/React.createElement(Space, null, ['supplyId', 'all'].includes(showField) && /*#__PURE__*/React.createElement(Input, {
9444
9529
  disabled: disabled,
9445
9530
  placeholder: "\u8BF7\u8F93\u5165\u4F9B\u9500\u5546\u7F16\u7801",
9446
9531
  onChange: function onChange(e) {
@@ -9545,44 +9630,79 @@ var ItemList = function ItemList(props) {
9545
9630
  }, "\u6682\u4E0D\u652F\u6301\u6DFB\u52A0")) : null);
9546
9631
  };
9547
9632
 
9548
- var TabPane$1 = Tabs.TabPane;
9549
9633
  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
- });
9634
+ dataIndex: 'index',
9635
+ title: '序号',
9636
+ render: function render(val, record, index) {
9637
+ return /*#__PURE__*/React.createElement("div", {
9638
+ style: {
9639
+ width: '50px'
9640
+ }
9641
+ }, index + 1);
9557
9642
  }
9558
9643
  }, {
9559
- dataIndex: 'outerId',
9560
- title: '款式编码'
9644
+ dataIndex: 'name',
9645
+ title: '商品名称',
9646
+ with: 200,
9647
+ ellipsis: true
9561
9648
  }, {
9562
- dataIndex: 'numIid',
9563
- title: '商品编码'
9649
+ dataIndex: 'goodsId',
9650
+ title: '商品id',
9651
+ with: 200,
9652
+ ellipsis: true
9564
9653
  }, {
9565
- dataIndex: 'title',
9566
- title: '商品名称'
9654
+ dataIndex: 'skuName',
9655
+ title: '商品sku名称',
9656
+ with: 200,
9657
+ ellipsis: true
9567
9658
  }, {
9568
- dataIndex: 'skus',
9569
- title: '颜色及规格'
9659
+ dataIndex: 'code',
9660
+ title: '商品编码',
9661
+ with: 200,
9662
+ // ellipsis: true,
9663
+ render: function render(val) {
9664
+ return /*#__PURE__*/React.createElement("div", {
9665
+ style: {
9666
+ width: '100px'
9667
+ }
9668
+ }, val);
9669
+ }
9670
+ }, {
9671
+ dataIndex: 'skuCode',
9672
+ title: '商品sku编码',
9673
+ with: 200,
9674
+ ellipsis: true
9675
+ }, {
9676
+ dataIndex: 'marketPrice',
9677
+ title: '市场价',
9678
+ // with: 200,
9679
+ // ellipsis: true,
9680
+ render: function render(val) {
9681
+ return /*#__PURE__*/React.createElement("div", {
9682
+ style: {
9683
+ width: '70px'
9684
+ }
9685
+ }, val);
9686
+ }
9570
9687
  }];
9571
9688
  var GoodsModal$1 = function GoodsModal(props, ref) {
9572
9689
  useImperativeHandle(ref, function () {
9573
9690
  return {
9574
9691
  open: function open() {
9575
9692
  setVisible(true);
9693
+ setPageNo(1);
9576
9694
  setSelect([]);
9577
9695
  setSelectIds([]);
9578
9696
  queryItems();
9697
+ onReset();
9579
9698
  }
9580
9699
  };
9581
9700
  });
9582
9701
  var onSubmit = props.onSubmit,
9583
9702
  shopId = props.shopId,
9584
9703
  shopList = props.shopList,
9585
- width = props.width;
9704
+ width = props.width,
9705
+ shopCode = props.shopCode;
9586
9706
  var _useState = useState(false),
9587
9707
  _useState2 = _slicedToArray(_useState, 2),
9588
9708
  visible = _useState2[0],
@@ -9597,123 +9717,85 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9597
9717
  setSelectIds = _useState6[1];
9598
9718
  var _useState7 = useState([]),
9599
9719
  _useState8 = _slicedToArray(_useState7, 2),
9600
- goodList = _useState8[0],
9601
- setGoodList = _useState8[1];
9602
- var _useState9 = useState(false),
9720
+ allList = _useState8[0],
9721
+ setAllList = _useState8[1]; //获取到的所有数据
9722
+ var _useState9 = useState([]),
9603
9723
  _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
- }),
9724
+ filterList = _useState10[0],
9725
+ setFilterList = _useState10[1]; //获取到的筛选数据
9726
+ var _useState11 = useState(1),
9618
9727
  _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(''),
9728
+ pageNo = _useState12[0],
9729
+ setPageNo = _useState12[1];
9730
+ var _useState13 = useState(20),
9731
+ _useState14 = _slicedToArray(_useState13, 1),
9732
+ pageSize = _useState14[0];
9733
+ var _useState15 = useState([]),
9626
9734
  _useState16 = _slicedToArray(_useState15, 2),
9627
- platform = _useState16[0],
9628
- setPlatform = _useState16[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9629
- var _useState17 = useState({}),
9735
+ goodList = _useState16[0],
9736
+ setGoodList = _useState16[1];
9737
+ var _useState17 = useState(false),
9630
9738
  _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];
9739
+ loading = _useState18[0],
9740
+ setLoading = _useState18[1];
9741
+ var _useState19 = useState(0),
9742
+ _useState20 = _slicedToArray(_useState19, 2),
9743
+ total = _useState20[0],
9744
+ setTotal = _useState20[1];
9745
+ var _useState21 = useState(''),
9746
+ _useState22 = _slicedToArray(_useState21, 2),
9747
+ platform = _useState22[0],
9748
+ setPlatform = _useState22[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9749
+ var _useState23 = useState({}),
9750
+ _useState24 = _slicedToArray(_useState23, 2),
9751
+ shopInfo = _useState24[0],
9752
+ setShopInfo = _useState24[1]; //店铺信息
9753
+ var _Form$useForm = Form.useForm(),
9754
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9755
+ form = _Form$useForm2[0];
9641
9756
  //选择页码
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;
9757
+ var pageChange = function pageChange(page) {
9758
+ setPageNo(page);
9759
+ setGoodList(_toConsumableArray(filterList).splice((page - 1) * pageSize, pageSize));
9666
9760
  };
9667
9761
  /**
9668
9762
  * 查询商品
9669
9763
  */
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;
9764
+ var queryItems = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9765
+ var params, res, products, newProducts;
9766
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9767
+ while (1) switch (_context.prev = _context.next) {
9768
+ case 0:
9769
+ _context.prev = 0;
9770
+ setLoading(true);
9771
+ params = {
9772
+ shopCode: shopCode
9773
+ };
9774
+ _context.next = 5;
9775
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9776
+ method: 'post',
9777
+ data: params
9778
+ });
9779
+ case 5:
9780
+ res = _context.sent;
9781
+ products = res.data.products;
9782
+ newProducts = products.map(function (item, index) {
9783
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9784
+ index: index + 1
9700
9785
  });
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
- }();
9786
+ });
9787
+ setAllList(_toConsumableArray(newProducts));
9788
+ initData(_toConsumableArray(newProducts));
9789
+ case 10:
9790
+ _context.prev = 10;
9791
+ setLoading(false);
9792
+ return _context.finish(10);
9793
+ case 13:
9794
+ case "end":
9795
+ return _context.stop();
9796
+ }
9797
+ }, _callee, null, [[0,, 10, 13]]);
9798
+ })), [shopCode]);
9717
9799
  useEffect(function () {
9718
9800
  var shopInfo = shopList.find(function (item) {
9719
9801
  return shopId === item.shopId || shopId === item.shopName;
@@ -9724,12 +9806,19 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9724
9806
  }, [shopId]);
9725
9807
  var rowSelection = {
9726
9808
  selectedRowKeys: selectIds,
9809
+ fixed: true,
9727
9810
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9728
9811
  console.log(selectedRowKeys, selectedRows, info);
9729
9812
  setSelectIds(selectedRowKeys);
9730
9813
  setSelect(_toConsumableArray(selectedRows));
9731
9814
  }
9732
9815
  };
9816
+ var initData = function initData(list) {
9817
+ setFilterList(_toConsumableArray(list));
9818
+ setGoodList(_toConsumableArray(list).splice(0, pageSize));
9819
+ setTotal(list.length);
9820
+ setPageNo(1);
9821
+ };
9733
9822
  var _onCancel = function onCancel() {
9734
9823
  setVisible(false);
9735
9824
  };
@@ -9737,8 +9826,23 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9737
9826
  onSubmit(selectList);
9738
9827
  _onCancel();
9739
9828
  };
9829
+ var onFinish = function onFinish(value) {
9830
+ var newFilterList = [];
9831
+ Object.keys(value).forEach(function (key) {
9832
+ if (value[key]) {
9833
+ newFilterList = allList.filter(function (item) {
9834
+ return item[key].indexOf(value[key]) > -1;
9835
+ });
9836
+ }
9837
+ });
9838
+ initData(newFilterList);
9839
+ };
9840
+ var onReset = function onReset() {
9841
+ form.resetFields();
9842
+ initData(_toConsumableArray(allList));
9843
+ };
9740
9844
  return /*#__PURE__*/React.createElement(Modal, {
9741
- title: '选择商品编码',
9845
+ title: '选择商品',
9742
9846
  okText: '确认',
9743
9847
  cancelText: '取消',
9744
9848
  visible: visible,
@@ -9748,52 +9852,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9748
9852
  },
9749
9853
  onOk: onOk,
9750
9854
  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);
9855
+ }, /*#__PURE__*/React.createElement(Form, {
9856
+ layout: "inline",
9857
+ form: form,
9858
+ onFinish: onFinish
9859
+ }, /*#__PURE__*/React.createElement(Form.Item, {
9860
+ name: "name"
9861
+ }, /*#__PURE__*/React.createElement(Input, {
9862
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",
9863
+ style: {
9864
+ width: 150
9760
9865
  }
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",
9866
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9867
+ name: "code"
9868
+ }, /*#__PURE__*/React.createElement(Input, {
9869
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u7F16\u7801",
9768
9870
  style: {
9769
- display: searchParams.type === 'select' ? 'none' : ''
9871
+ width: 150
9872
+ }
9873
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9874
+ name: "skuCode"
9875
+ }, /*#__PURE__*/React.createElement(Input, {
9876
+ placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1sku\u7F16\u7801",
9877
+ style: {
9878
+ width: 150
9770
9879
  }
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
9880
  })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
9780
9881
  type: "primary",
9781
9882
  htmlType: "submit"
9782
- }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, null, "\u91CD\u7F6E")))), /*#__PURE__*/React.createElement(Spin, {
9883
+ }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
9884
+ onClick: onReset
9885
+ }, "\u91CD\u7F6E"))), /*#__PURE__*/React.createElement(Spin, {
9783
9886
  spinning: loading
9784
9887
  }, /*#__PURE__*/React.createElement(Table, {
9785
9888
  rowSelection: rowSelection,
9786
9889
  columns: columns,
9787
- rowKey: 'numIid',
9788
- dataSource: searchParams.type == 'select' ? selectList : goodList,
9890
+ rowKey: 'skuCode',
9891
+ dataSource: goodList,
9789
9892
  scroll: {
9893
+ x: true,
9790
9894
  y: 300
9791
9895
  },
9792
9896
  pagination: {
9793
9897
  size: 'small',
9794
9898
  total: total,
9795
- current: searchParams.pageNo,
9796
- pageSize: searchParams.pageSize,
9899
+ current: pageNo,
9900
+ pageSize: pageSize,
9901
+ pageSizeOptions: [],
9797
9902
  onChange: pageChange
9798
9903
  }
9799
9904
  })));
@@ -9812,8 +9917,8 @@ var GoodItem = function GoodItem(props) {
9812
9917
  value = _props$value === void 0 ? [] : _props$value,
9813
9918
  onChange = props.onChange,
9814
9919
  disabled = props.disabled,
9815
- _props$showField = props.showField,
9816
- showField = _props$showField === void 0 ? [] : _props$showField,
9920
+ _props$showHeader = props.showHeader,
9921
+ showHeader = _props$showHeader === void 0 ? [] : _props$showHeader,
9817
9922
  width = props.width,
9818
9923
  _props$shopList = props.shopList,
9819
9924
  shopList = _props$shopList === void 0 ? [] : _props$shopList,
@@ -9829,12 +9934,13 @@ var GoodItem = function GoodItem(props) {
9829
9934
  otherOperations = _props$otherOperation === void 0 ? null : _props$otherOperation,
9830
9935
  _props$canUpdateNumbe = props.canUpdateNumber,
9831
9936
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
9937
+ shopCode = props.shopCode,
9832
9938
  onSelect = props.onSelect,
9833
9939
  onDelete = props.onDelete;
9834
9940
  var refModal = useRef();
9835
- var handleDelete = function handleDelete(index) {
9941
+ var handleDelete = function handleDelete(record, index) {
9836
9942
  onDelete === null || onDelete === void 0 ? void 0 : onDelete(value[index]);
9837
- var newList = value.filter(function (item, i) {
9943
+ var newList = _toConsumableArray(value).filter(function (item, i) {
9838
9944
  return index !== i;
9839
9945
  });
9840
9946
  onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(newList));
@@ -9858,6 +9964,18 @@ var GoodItem = function GoodItem(props) {
9858
9964
  var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
9859
9965
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
9860
9966
  return [{
9967
+ dataIndex: 'pic',
9968
+ title: "\u56FE\u7247",
9969
+ align: 'center',
9970
+ ellipsis: true,
9971
+ width: 100,
9972
+ render: function render(val) {
9973
+ return /*#__PURE__*/React.createElement(Image, {
9974
+ width: 60,
9975
+ src: val
9976
+ });
9977
+ }
9978
+ }, {
9861
9979
  dataIndex: 'name',
9862
9980
  title: "".concat(text, "\u540D\u79F0"),
9863
9981
  align: 'center',
@@ -9890,6 +10008,8 @@ var GoodItem = function GoodItem(props) {
9890
10008
  render: function render(val, record, index) {
9891
10009
  return record.canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
9892
10010
  value: val,
10011
+ min: 0,
10012
+ precision: 0,
9893
10013
  onChange: function onChange(num) {
9894
10014
  return updateHandle(num, index, 'number');
9895
10015
  }
@@ -9919,20 +10039,8 @@ var GoodItem = function GoodItem(props) {
9919
10039
  render: function render(val, record, index) {
9920
10040
  return /*#__PURE__*/React.createElement("span", null, index + 1);
9921
10041
  }
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
10042
  }].concat(_toConsumableArray(GOODS_INFO_COLUMNS().filter(function (t) {
9935
- return showField.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
10043
+ return showHeader.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9936
10044
  })));
9937
10045
  if (!disabled) {
9938
10046
  columnList.push({
@@ -9945,30 +10053,32 @@ var GoodItem = function GoodItem(props) {
9945
10053
  return record.canDelete ? /*#__PURE__*/React.createElement(Button, {
9946
10054
  type: "link",
9947
10055
  onClick: function onClick() {
9948
- return handleDelete(index);
10056
+ return handleDelete(record, index);
9949
10057
  }
9950
10058
  }, "\u5220\u9664") : null;
9951
10059
  }
9952
10060
  });
9953
10061
  }
9954
10062
  return columnList;
9955
- }, [showField, value, disabled]);
10063
+ }, [showHeader, value, disabled]);
9956
10064
  var onSubmit = function onSubmit(list) {
9957
10065
  var newList = list.map(function (item) {
9958
- var picUrl = item.picUrl,
9959
- title = item.title,
9960
- price = item.price,
9961
- numIid = item.numIid;
10066
+ var goodsId = item.goodsId,
10067
+ name = item.name,
10068
+ code = item.code,
10069
+ skuCode = item.skuCode,
10070
+ marketPrice = item.marketPrice;
9962
10071
  return {
9963
- id: numIid,
9964
- pic: picUrl,
9965
- name: title,
9966
- code: '',
9967
- sku: '',
9968
- money: price,
9969
- share: '',
10072
+ id: goodsId,
10073
+ pic: '',
10074
+ name: name,
10075
+ code: code,
10076
+ sku: skuCode,
10077
+ money: marketPrice || 0,
10078
+ share: marketPrice || 0,
9970
10079
  number: 1,
9971
10080
  type: '',
10081
+ uuid: uuid(),
9972
10082
  canDelete: true,
9973
10083
  canUpdateNumber: canUpdateNumber
9974
10084
  };
@@ -9978,7 +10088,7 @@ var GoodItem = function GoodItem(props) {
9978
10088
  var onSelectChange = function onSelectChange(newSelectedRowKeys) {
9979
10089
  setSelectedRowKeys(newSelectedRowKeys);
9980
10090
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(value.filter(function (t) {
9981
- return newSelectedRowKeys.includes(t.id);
10091
+ return newSelectedRowKeys.includes(t.uuid);
9982
10092
  }));
9983
10093
  };
9984
10094
  var handleChangeGoods = function handleChangeGoods() {
@@ -10006,7 +10116,7 @@ var GoodItem = function GoodItem(props) {
10006
10116
  }, "\u9009\u62E9\u5546\u54C1"), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
10007
10117
  columns: newColumns,
10008
10118
  dataSource: value,
10009
- rowKey: 'id',
10119
+ rowKey: 'uuid',
10010
10120
  size: "small",
10011
10121
  pagination: false,
10012
10122
  scroll: {
@@ -10021,96 +10131,90 @@ var GoodItem = function GoodItem(props) {
10021
10131
  width: width,
10022
10132
  shopList: shopList,
10023
10133
  shopId: shopId,
10024
- maxLength: maxLength
10134
+ maxLength: maxLength,
10135
+ shopCode: shopCode
10025
10136
  }));
10026
10137
  };
10027
10138
 
10028
10139
  var BsGoods = function BsGoods(props) {
10029
10140
  var value = props.value,
10030
- disabled = props.disabled;
10141
+ disabled = props.disabled,
10142
+ onChange = props.onChange;
10031
10143
  var _useState = useState(false),
10032
10144
  _useState2 = _slicedToArray(_useState, 2),
10033
10145
  tableSelect = _useState2[0],
10034
10146
  setTableSelect = _useState2[1];
10035
- var _useState3 = useState({
10036
- type: '',
10037
- val: ''
10038
- }),
10147
+ // const [withInfo, setWithInfo] = useState({ type: '', val: '' });
10148
+ var _useState3 = useState(''),
10039
10149
  _useState4 = _slicedToArray(_useState3, 2),
10040
- withInfo = _useState4[0],
10041
- setWithInfo = _useState4[1];
10042
- var ref = useRef();
10043
- var reissueRef = useRef();
10150
+ withType = _useState4[0],
10151
+ setWithType = _useState4[1];
10152
+ var _useState5 = useState(''),
10153
+ _useState6 = _slicedToArray(_useState5, 2),
10154
+ withValue = _useState6[0],
10155
+ setWithValue = _useState6[1];
10044
10156
  useEffect(function () {
10045
- ref.current = pubsub.subscribeOnce('type', function (type, val) {
10046
- console.log('goods', type, val, value);
10157
+ pubsub.subscribe('type', function (type, val) {
10047
10158
  if (disabled) return;
10048
- setWithInfo({
10049
- type: type,
10050
- val: val
10051
- });
10159
+ console.log('type', type, val);
10160
+ // setWithInfo({ type, val });
10161
+ setWithType(type);
10162
+ setWithValue(val);
10052
10163
  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
10164
  });
10063
10165
  //补发
10064
- reissueRef.current = pubsub.subscribeOnce('reissueType', function (type, val) {
10166
+ pubsub.subscribe('reissueType', function (type, val) {
10065
10167
  if (disabled) return;
10066
- console.log('reissueType', type, val, value);
10067
- setWithInfo({
10068
- type: type,
10069
- val: val
10070
- });
10168
+ console.log('reissueType', type, val);
10169
+ // setWithInfo({ type, val });
10170
+ setWithType(type);
10171
+ setWithValue(val);
10071
10172
  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
10173
  });
10082
- return function () {
10083
- pubsub.unsubscribe(ref.current);
10084
- pubsub.unsubscribe(reissueRef.current);
10085
- };
10086
- }, [value, withInfo, disabled]);
10087
- var _onSelect = useCallback(function (list) {
10174
+ }, [disabled, withType, withValue, setWithType, setWithValue, setTableSelect]);
10175
+ useEffect(function () {
10176
+ if (!disabled) {
10177
+ pubsub.publish('goodList', {
10178
+ list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10179
+ });
10180
+ }
10181
+ }, [value, disabled]);
10182
+ var onSelect = function onSelect(list) {
10088
10183
  if (disabled) return;
10089
- console.log('withInfo', withInfo, list);
10090
10184
  var newList = cloneDeep(list);
10091
- pubsub.publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
10092
- type: withInfo.val,
10185
+ var type = withType === 'reissueType' ? 'reissueSelectList' : 'selectList';
10186
+ console.log(withType, withValue, type);
10187
+ pubsub.publish(type, {
10188
+ type: withValue,
10093
10189
  list: newList.map(function (item) {
10094
10190
  item.canDelete = true;
10095
10191
  return item;
10096
10192
  })
10097
10193
  });
10098
- }, [withInfo]);
10194
+ };
10099
10195
  var _onDelete = function onDelete(item) {
10100
- var deleteId = item === null || item === void 0 ? void 0 : item.id;
10196
+ var deleteId = item === null || item === void 0 ? void 0 : item.sku;
10101
10197
  pubsub.publish('deleteGood', deleteId);
10102
10198
  pubsub.publish('reissueDeleteGood', deleteId);
10103
10199
  };
10200
+ var changeHandle = function changeHandle(list) {
10201
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10202
+ bsGoods: list
10203
+ }));
10204
+ };
10104
10205
  return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10105
- key: 'bsGoods',
10106
- disabled: disabled
10206
+ key: 'bsGoods'
10107
10207
  }, props), {}, {
10208
+ disabled: disabled,
10209
+ value: value === null || value === void 0 ? void 0 : value.bsGoods,
10210
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10108
10211
  tableSelect: tableSelect,
10109
- onSelect: function onSelect(list) {
10110
- return _onSelect(list);
10111
- },
10212
+ onSelect: onSelect,
10112
10213
  onDelete: function onDelete(item) {
10113
10214
  return _onDelete(item);
10215
+ },
10216
+ onChange: function onChange(val) {
10217
+ return changeHandle(val);
10114
10218
  }
10115
10219
  }));
10116
10220
  };
@@ -10124,17 +10228,16 @@ var BsExchange = function BsExchange(props) {
10124
10228
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10125
10229
  disabled = props.disabled,
10126
10230
  other = _objectWithoutProperties(props, _excluded$b);
10231
+ var _useState = useState([]),
10232
+ _useState2 = _slicedToArray(_useState, 2),
10233
+ bsGoods = _useState2[0],
10234
+ setBsGoods = _useState2[1];
10127
10235
  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
- }
10236
+ pubsub.subscribe('goodList', function (_, data) {
10237
+ setBsGoods(data.list);
10137
10238
  });
10239
+ }, []);
10240
+ useEffect(function () {
10138
10241
  pubsub.subscribeOnce('deleteGood', function (_, data) {
10139
10242
  if (disabled) return;
10140
10243
  if (value) {
@@ -10143,48 +10246,63 @@ var BsExchange = function BsExchange(props) {
10143
10246
  if (['2', '4'].includes((_value$bsExchangeType = value.bsExchangeType) === null || _value$bsExchangeType === void 0 ? void 0 : _value$bsExchangeType[0])) {
10144
10247
  newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.map(function (item) {
10145
10248
  item.bsExchangeReturnGoods = item.bsExchangeReturnGoods.filter(function (t) {
10146
- return t.id !== data;
10249
+ return t.sku !== data;
10147
10250
  });
10148
10251
  return item;
10149
10252
  });
10150
10253
  } else if (['1', '3'].includes((_value$bsExchangeType2 = value.bsExchangeType) === null || _value$bsExchangeType2 === void 0 ? void 0 : _value$bsExchangeType2[0])) {
10151
10254
  newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.filter(function (item) {
10152
- return item.id !== data;
10255
+ return item.sku !== data;
10153
10256
  });
10154
10257
  }
10155
10258
  onChange(newValue);
10156
10259
  }
10157
10260
  });
10261
+ pubsub.subscribeOnce('selectList', function (_, data) {
10262
+ if (disabled) return;
10263
+ if (value) {
10264
+ var newData = cloneDeep(data);
10265
+ console.log(getListHandle(_toConsumableArray(newData.list), value));
10266
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10267
+ bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10268
+ }));
10269
+ }
10270
+ });
10158
10271
  }, [value]);
10159
10272
  var getListHandle = function getListHandle(list, val) {
10160
- var _val$bsExchangeType;
10273
+ var _val$bsExchangeType, _val$bsExchangeType2;
10161
10274
  //如果是原单换
10162
10275
  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
10276
  return list.reduce(function (prv, next) {
10164
- var _val$bsExchangeType2;
10165
10277
  next.canDelete = false;
10166
10278
  //数量大于1 拆开
10167
10279
  if (next.number > 1) {
10168
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10169
- t.number = 1;
10170
- return t;
10280
+ var newList = Array(next.number).fill({}).map(function () {
10281
+ var newNext = _objectSpread2({}, next);
10282
+ newNext.money = newNext.share;
10283
+ newNext.number = 1;
10284
+ newNext.uuid = uuid();
10285
+ return newNext;
10171
10286
  });
10172
10287
  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])) {
10288
+ } else {
10174
10289
  prv.push(_objectSpread2({}, next));
10175
10290
  }
10176
10291
  return prv;
10177
10292
  }, []);
10178
- } else {
10293
+ } 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
10294
  //补发换货
10180
10295
  return list.reduce(function (prv, next, index) {
10181
10296
  next.canDelete = true;
10182
10297
  next.index = index;
10183
10298
  //数量大于1 拆开
10184
10299
  if (next.number > 1) {
10185
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10186
- t.number = 1;
10187
- return t;
10300
+ var newList = Array(next.number).fill({}).map(function () {
10301
+ var newNext = _objectSpread2({}, next);
10302
+ newNext.money = newNext.share;
10303
+ newNext.number = 1;
10304
+ newNext.uuid = uuid();
10305
+ return newNext;
10188
10306
  });
10189
10307
  prv.push({
10190
10308
  bsExchangeReturnGoods: _toConsumableArray(newList),
@@ -10205,11 +10323,20 @@ var BsExchange = function BsExchange(props) {
10205
10323
  newValue.bsExchangeType = val;
10206
10324
  newValue.bsExchangeReturnGoods = [];
10207
10325
  newValue.bsExchangeGiftGoods = [];
10326
+ if (['1', '3'].includes(val[0])) {
10327
+ newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10328
+ }
10208
10329
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10209
10330
  pubsub.publish('type', val[0]);
10210
10331
  };
10211
10332
  var changeHandle = function changeHandle(val, key) {
10212
10333
  var newValue = _objectSpread2({}, value);
10334
+ if (key === 'bsExchangeGiftGoods') {
10335
+ val = cloneDeep(val).map(function (t) {
10336
+ t.money = 0;
10337
+ return t;
10338
+ });
10339
+ }
10213
10340
  newValue[key] = val;
10214
10341
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10215
10342
  if (key === 'bsExchangeType') {
@@ -10218,7 +10345,7 @@ var BsExchange = function BsExchange(props) {
10218
10345
  }
10219
10346
  };
10220
10347
  var changeReturnHandle = function changeReturnHandle(val, index, key) {
10221
- // console.log('changeReturnHandle', val, index, key);
10348
+ console.log('changeReturnHandle', val, index, key);
10222
10349
  var newValue = _objectSpread2({}, value);
10223
10350
  newValue.bsExchangeReturnGoods[index][key] = (val || []).map(function (t) {
10224
10351
  t.index = index;
@@ -10267,15 +10394,22 @@ var BsExchange = function BsExchange(props) {
10267
10394
  disabled: disabled,
10268
10395
  showChangeBtn: false,
10269
10396
  value: value === null || value === void 0 ? void 0 : value.bsExchangeReturnGoods,
10397
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10270
10398
  onChange: function onChange(val) {
10271
10399
  return changeHandle(val, 'bsExchangeReturnGoods');
10272
10400
  }
10273
10401
  })) : /*#__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({
10402
+ return /*#__PURE__*/React.createElement("div", {
10403
+ style: {
10404
+ border: '1px dashed',
10405
+ marginBottom: '8px'
10406
+ }
10407
+ }, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10275
10408
  key: 'bsReturnGoods'
10276
10409
  }, other), {}, {
10277
10410
  disabled: disabled,
10278
10411
  showChangeBtn: showChangeBtn,
10412
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10279
10413
  value: item === null || item === void 0 ? void 0 : item.bsExchangeReturnGoods,
10280
10414
  onChange: function onChange(val) {
10281
10415
  return changeReturnHandle(val, index, 'bsExchangeReturnGoods');
@@ -10287,6 +10421,7 @@ var BsExchange = function BsExchange(props) {
10287
10421
  showChangeBtn: showChangeBtn,
10288
10422
  otherOperations: copyGoods(index),
10289
10423
  value: item === null || item === void 0 ? void 0 : item.bsExchangeSwapOutGoods,
10424
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10290
10425
  onChange: function onChange(val) {
10291
10426
  return changeReturnHandle(val, index, 'bsExchangeSwapOutGoods');
10292
10427
  }
@@ -10294,7 +10429,8 @@ var BsExchange = function BsExchange(props) {
10294
10429
  })), ['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
10430
  headerText: "\u8D60\u54C1",
10296
10431
  key: 'bsGiftGoods',
10297
- disabled: disabled
10432
+ disabled: disabled,
10433
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode
10298
10434
  }, other), {}, {
10299
10435
  value: value === null || value === void 0 ? void 0 : value.bsExchangeGiftGoods,
10300
10436
  onChange: function onChange(val) {
@@ -10311,27 +10447,35 @@ var BsReissue = function BsReissue(props) {
10311
10447
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10312
10448
  disabled = props.disabled,
10313
10449
  other = _objectWithoutProperties(props, _excluded$c);
10450
+ var _useState = useState([]),
10451
+ _useState2 = _slicedToArray(_useState, 2),
10452
+ bsGoods = _useState2[0],
10453
+ setBsGoods = _useState2[1];
10314
10454
  useEffect(function () {
10315
- pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10455
+ pubsub.subscribe('goodList', function (_, data) {
10456
+ setBsGoods(data.list);
10457
+ });
10458
+ }, []);
10459
+ useEffect(function () {
10460
+ pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10316
10461
  if (disabled) return;
10317
- console.log(data, value);
10318
10462
  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
- }));
10463
+ var newValue = _objectSpread2({}, value);
10464
+ newValue.bsReissueGoods = newValue.bsReissueGoods.filter(function (item) {
10465
+ return item.sku !== data;
10466
+ });
10467
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10327
10468
  }
10328
10469
  });
10329
- pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10470
+ pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10330
10471
  if (disabled) return;
10331
10472
  if (value) {
10332
10473
  var newValue = _objectSpread2({}, value);
10333
- newValue.bsReissueGoods = newValue.bsReissueGoods.filter(function (item) {
10334
- return item.id !== data;
10474
+ newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10475
+ item.money = 0;
10476
+ item.share = 0;
10477
+ item.canUpdateNumber = true;
10478
+ return item;
10335
10479
  });
10336
10480
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10337
10481
  }
@@ -10342,17 +10486,24 @@ var BsReissue = function BsReissue(props) {
10342
10486
  if (key === 'bsReissueGoods') {
10343
10487
  val = (val || []).map(function (item) {
10344
10488
  item.money = 0;
10489
+ item.share = 0;
10345
10490
  return item;
10346
10491
  });
10347
10492
  }
10348
10493
  newValue[key] = val;
10349
10494
  if (key === 'bsReissueType') {
10350
10495
  newValue.bsReissueGoods = [];
10496
+ if (['1', '3'].includes(val[0])) {
10497
+ newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
10498
+ item.money = 0;
10499
+ item.share = 0;
10500
+ item.canUpdateNumber = false;
10501
+ return item;
10502
+ });
10503
+ }
10351
10504
  }
10352
10505
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10353
- if (key === 'bsReissueType') {
10354
- pubsub.publish('reissueType', val[0]);
10355
- }
10506
+ pubsub.publish('reissueType', val[0]);
10356
10507
  };
10357
10508
  //显示选择商品按钮 原单换不显示选择商品
10358
10509
  var showChangeBtn = useMemo(function () {
@@ -10370,12 +10521,13 @@ var BsReissue = function BsReissue(props) {
10370
10521
  onChange: function onChange(val) {
10371
10522
  return changeHandle(val, 'bsReissueType');
10372
10523
  }
10373
- }), /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10524
+ }), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10374
10525
  key: 'reissueGoods'
10375
10526
  }, other), {}, {
10376
10527
  disabled: disabled,
10377
10528
  canUpdateNumber: showChangeBtn,
10378
10529
  showChangeBtn: showChangeBtn,
10530
+ shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10379
10531
  value: value === null || value === void 0 ? void 0 : value.bsReissueGoods,
10380
10532
  onChange: function onChange(val) {
10381
10533
  return changeHandle(val, 'bsReissueGoods');
@@ -10386,7 +10538,7 @@ var BsReissue = function BsReissue(props) {
10386
10538
  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
10539
  styleInject(css_248z$9);
10388
10540
 
10389
- var TabPane$2 = Tabs.TabPane;
10541
+ var TabPane$1 = Tabs.TabPane;
10390
10542
  var Option$2 = Select.Option;
10391
10543
  var Search$1 = Input.Search;
10392
10544
  var GoodsModal$3 = function GoodsModal(props) {
@@ -10702,7 +10854,7 @@ var GoodsModal$3 = function GoodsModal(props) {
10702
10854
  }));
10703
10855
  }
10704
10856
  }, tabs.map(function (tab) {
10705
- return /*#__PURE__*/React.createElement(TabPane$2, {
10857
+ return /*#__PURE__*/React.createElement(TabPane$1, {
10706
10858
  tab: tab.tab + (tab.key === 'all' ? "(".concat(selectList.length, ")") : ''),
10707
10859
  key: tab.key
10708
10860
  });