@kmkf-fe-packages/basic-components 0.7.1-alpha.1 → 0.7.1

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
@@ -2,7 +2,7 @@ import React, { useRef, useState, useEffect, useMemo, forwardRef, useImperativeH
2
2
  import { Cascader, DatePicker, Input, InputNumber, Select, Upload, Image, message, Radio, Space, Spin, Checkbox, Row, Col, Slider, Rate, Form, Tabs, Modal, Button, ConfigProvider, Pagination, Popover } from 'antd';
3
3
  import { EyeOutlined, DeleteOutlined } from '@ant-design/icons';
4
4
  import request, { extend } from 'umi-request';
5
- import { AddressData, request as request$1, LogisticsAddressData } from '@kmkf-fe-packages/kmkf-utils';
5
+ import { AddressData } from '@kmkf-fe-packages/kmkf-utils';
6
6
  import zhCN from 'antd/lib/locale/zh_CN';
7
7
 
8
8
  function _iterableToArrayLimit(arr, i) {
@@ -3055,27 +3055,43 @@ var Payment = function Payment(props) {
3055
3055
  var TextArea$1 = Input.TextArea;
3056
3056
  var ParseLogistics = function ParseLogistics(props) {
3057
3057
  var onChange = props.onChange;
3058
- var _useState = useState(""),
3058
+ var _useState = useState(''),
3059
3059
  _useState2 = _slicedToArray(_useState, 2),
3060
3060
  value = _useState2[0],
3061
3061
  setValue = _useState2[1];
3062
- var handleIdentify = function handleIdentify() {
3063
- if (!value) {
3064
- return;
3065
- }
3066
- request$1({
3067
- url: "/qy/logistics/addressAnalysis",
3068
- method: "post",
3069
- data: {
3070
- fullAddress: value
3071
- }
3072
- }).then(function (res) {
3073
- var data = res.data;
3074
- onChange === null || onChange === void 0 ? void 0 : onChange(data);
3075
- }).catch(function (e) {
3076
- console.log(e);
3077
- });
3078
- };
3062
+ var handleIdentify = /*#__PURE__*/function () {
3063
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3064
+ var _yield$request, data;
3065
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3066
+ while (1) switch (_context.prev = _context.next) {
3067
+ case 0:
3068
+ if (value) {
3069
+ _context.next = 2;
3070
+ break;
3071
+ }
3072
+ return _context.abrupt("return");
3073
+ case 2:
3074
+ _context.next = 4;
3075
+ return extendRequest('/qy/logistics/addressAnalysis', {
3076
+ method: 'post',
3077
+ data: {
3078
+ fullAddress: value
3079
+ }
3080
+ });
3081
+ case 4:
3082
+ _yield$request = _context.sent;
3083
+ data = _yield$request.data;
3084
+ onChange === null || onChange === void 0 ? void 0 : onChange(data);
3085
+ case 7:
3086
+ case "end":
3087
+ return _context.stop();
3088
+ }
3089
+ }, _callee);
3090
+ }));
3091
+ return function handleIdentify() {
3092
+ return _ref.apply(this, arguments);
3093
+ };
3094
+ }();
3079
3095
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextArea$1, {
3080
3096
  placeholder: "\u590D\u5236\u7269\u6D41\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
3081
3097
  rows: 3,
@@ -3090,67 +3106,12 @@ var ParseLogistics = function ParseLogistics(props) {
3090
3106
  }, "\u667A\u80FD\u8BC6\u522B"), /*#__PURE__*/React.createElement(Button, {
3091
3107
  size: "small",
3092
3108
  onClick: function onClick() {
3093
- return setValue("");
3109
+ return setValue('');
3094
3110
  }
3095
3111
  }, "\u6E05\u7A7A")));
3096
3112
  };
3097
3113
 
3098
- var IdentifyAddress = function IdentifyAddress(props) {
3099
- var value = props.value,
3100
- onChange = props.onChange,
3101
- _props$disabled = props.disabled,
3102
- disabled = _props$disabled === void 0 ? false : _props$disabled;
3103
- var changeHandle = function changeHandle(val, type) {
3104
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val)));
3105
- };
3106
- var handleParseLogistics = function handleParseLogistics(val) {
3107
- var params = {
3108
- detail: val === null || val === void 0 ? void 0 : val.addressDetail,
3109
- receiverName: val === null || val === void 0 ? void 0 : val.name,
3110
- receiverMobile: val === null || val === void 0 ? void 0 : val.phone,
3111
- address: []
3112
- };
3113
- if (val === null || val === void 0 ? void 0 : val.province) {
3114
- params.address = [AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.province), AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.city), AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
3115
- }
3116
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3117
- };
3118
- return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && /*#__PURE__*/React.createElement(ParseLogistics, {
3119
- onChange: handleParseLogistics
3120
- }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Province, {
3121
- value: value.address,
3122
- onChange: function onChange(val) {
3123
- return changeHandle(val, 'address');
3124
- },
3125
- options: [],
3126
- disabled: disabled
3127
- }), /*#__PURE__*/React.createElement(Input, {
3128
- value: value.detail,
3129
- disabled: disabled,
3130
- placeholder: "\u8BE6\u7EC6\u5730\u5740",
3131
- onChange: function onChange(e) {
3132
- return changeHandle(e.target.value, 'detail');
3133
- }
3134
- })), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
3135
- value: value.receiverName,
3136
- disabled: disabled,
3137
- placeholder: "\u6536\u4EF6\u4EBA\u59D3\u540D",
3138
- onChange: function onChange(e) {
3139
- return changeHandle(e.target.value, 'receiverName');
3140
- }
3141
- }), /*#__PURE__*/React.createElement(Input, {
3142
- value: value.receiverMobile,
3143
- disabled: disabled,
3144
- placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
3145
- onChange: function onChange(e) {
3146
- return changeHandle(e.target.value, 'receiverMobile');
3147
- }
3148
- })));
3149
- };
3150
-
3151
3114
  var Item = Form.Item;
3152
- var LogisticsAddress = LogisticsAddressData.getInstance();
3153
- var address$1 = AddressData.getInstance();
3154
3115
  var LogisticsInterception = function LogisticsInterception(props) {
3155
3116
  var _props$value = props.value,
3156
3117
  value = _props$value === void 0 ? {} : _props$value,
@@ -3183,6 +3144,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3183
3144
  setIsInterface = _useState8[1];
3184
3145
  var firstIn = useRef(true);
3185
3146
  useEffect(function () {
3147
+ AddressData.getInstance();
3186
3148
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3187
3149
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3188
3150
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3238,19 +3200,12 @@ var LogisticsInterception = function LogisticsInterception(props) {
3238
3200
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3239
3201
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3240
3202
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3241
- //是否回退新地址
3242
- var showReturnAddress = useMemo(function () {
3243
- var _find2, _find2$config;
3244
- return (_find2 = (typeOptions || []).find(function (item) {
3245
- return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3246
- })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showAddressSelect;
3247
- }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3248
3203
  //是否展示发件人手机号
3249
3204
  var showSenderMobile = useMemo(function () {
3250
- var _find3, _find3$config;
3251
- return (_find3 = (typeOptions || []).find(function (item) {
3205
+ var _find2, _find2$config;
3206
+ return (_find2 = (typeOptions || []).find(function (item) {
3252
3207
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3253
- })) === null || _find3 === void 0 ? void 0 : (_find3$config = _find3.config) === null || _find3$config === void 0 ? void 0 : _find3$config.showSenderMobile;
3208
+ })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showSenderMobile;
3254
3209
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3255
3210
  //判断是否能修改物流信息
3256
3211
  var isEdit = useMemo(function () {
@@ -3259,39 +3214,19 @@ var LogisticsInterception = function LogisticsInterception(props) {
3259
3214
  });
3260
3215
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3261
3216
  }, [isEditing, initCompany]);
3262
- //退回地址列表
3263
- var logisticsAddressOptions = useMemo(function () {
3264
- return ((LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getAddressData()) || []).filter(function (item) {
3265
- return item.cpCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3266
- });
3267
- }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3268
- var returnValue = useMemo(function () {
3269
- var _value$interceptAddre, _value$interceptAddre2, _value$interceptAddre3;
3270
- var uk = LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getUkByInfo({
3271
- cpCode: (value === null || value === void 0 ? void 0 : value.interceptCompany) || '',
3272
- province: value === null || value === void 0 ? void 0 : (_value$interceptAddre = value.interceptAddress) === null || _value$interceptAddre === void 0 ? void 0 : _value$interceptAddre[0],
3273
- city: value === null || value === void 0 ? void 0 : (_value$interceptAddre2 = value.interceptAddress) === null || _value$interceptAddre2 === void 0 ? void 0 : _value$interceptAddre2[1],
3274
- district: value === null || value === void 0 ? void 0 : (_value$interceptAddre3 = value.interceptAddress) === null || _value$interceptAddre3 === void 0 ? void 0 : _value$interceptAddre3[2],
3275
- detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3276
- userName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3277
- mobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3278
- });
3279
- return uk;
3280
- }, [value === null || value === void 0 ? void 0 : value.interceptCompany, value === null || value === void 0 ? void 0 : value.interceptAddress]);
3281
- //选择回调
3282
3217
  var changeHandle = function changeHandle(val, type) {
3283
3218
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3284
3219
  if (type === 'interceptCompany') {
3285
3220
  var interceptCompany = expressInterceptData.find(function (item) {
3286
3221
  return item.value === val;
3287
3222
  });
3288
- var _returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3223
+ var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3289
3224
  var _item$config3;
3290
3225
  return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3291
3226
  });
3292
3227
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3293
3228
  interceptCompany: val,
3294
- interceptType: _returnValue === null || _returnValue === void 0 ? void 0 : _returnValue.value,
3229
+ interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3295
3230
  interceptSenderMobile: undefined,
3296
3231
  interceptAddress: [],
3297
3232
  interceptDetail: undefined,
@@ -3303,29 +3238,16 @@ var LogisticsInterception = function LogisticsInterception(props) {
3303
3238
  }
3304
3239
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3305
3240
  };
3306
- //智能识别回调
3307
- var changeIdentify = function changeIdentify(val) {
3308
- //智能识别返填
3309
- var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3310
- interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3311
- interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3312
- interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3313
- interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3241
+ var handleParseLogistics = function handleParseLogistics(val) {
3242
+ var params = _objectSpread2(_objectSpread2({}, value), {}, {
3243
+ interceptDetail: val === null || val === void 0 ? void 0 : val.addressDetail,
3244
+ interceptReceiverName: val === null || val === void 0 ? void 0 : val.name,
3245
+ interceptReceiverMobile: val === null || val === void 0 ? void 0 : val.phone
3314
3246
  });
3315
- onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3316
- };
3317
- //选择退回地址
3318
- var changeReturnAddress = function changeReturnAddress(uk) {
3319
- var item = LogisticsAddress.getItemByUk(uk);
3320
- console.log(item);
3321
- if (item) {
3322
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3323
- interceptAddress: [item === null || item === void 0 ? void 0 : item.province, item === null || item === void 0 ? void 0 : item.city, item === null || item === void 0 ? void 0 : item.district],
3324
- interceptDetail: item === null || item === void 0 ? void 0 : item.detail,
3325
- interceptReceiverName: item === null || item === void 0 ? void 0 : item.userName,
3326
- interceptReceiverMobile: item === null || item === void 0 ? void 0 : item.mobile
3327
- }));
3247
+ if (val === null || val === void 0 ? void 0 : val.province) {
3248
+ params.interceptAddress = [AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.province), AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.city), AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
3328
3249
  }
3250
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3329
3251
  };
3330
3252
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Item, {
3331
3253
  label: '物流信息',
@@ -3385,35 +3307,41 @@ var LogisticsInterception = function LogisticsInterception(props) {
3385
3307
  return changeHandle(e.target.value, 'interceptSenderMobile');
3386
3308
  }
3387
3309
  })), /*#__PURE__*/React.createElement(Item, {
3388
- label: '退回地址',
3389
- required: true,
3390
- key: 'returnAddress',
3391
- hidden: !showReturnAddress
3392
- }, /*#__PURE__*/React.createElement(Select, {
3393
- disabled: disabled || isEdit,
3394
- value: returnValue,
3395
- onChange: changeReturnAddress,
3396
- placeholder: "\u8BF7\u9009\u62E9\u9000\u56DE\u5730\u5740"
3397
- }, logisticsAddressOptions.map(function (item) {
3398
- return /*#__PURE__*/React.createElement(Select.Option, {
3399
- key: item.uk,
3400
- value: item.uk
3401
- }, "".concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.province) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.city) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.district) || '').concat(item.detail, " ").concat(item === null || item === void 0 ? void 0 : item.userName, ":").concat(item === null || item === void 0 ? void 0 : item.mobile));
3402
- }))), /*#__PURE__*/React.createElement(Item, {
3403
3310
  label: '派送地址',
3404
3311
  required: true,
3405
3312
  key: 'newAddress',
3406
3313
  hidden: !showNewAddress
3407
- }, /*#__PURE__*/React.createElement(IdentifyAddress, {
3408
- disabled: disabled || isEdit,
3409
- value: {
3410
- address: (value === null || value === void 0 ? void 0 : value.interceptAddress) || [],
3411
- detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3412
- receiverName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3413
- receiverMobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3314
+ }, !(disabled || isEdit) && /*#__PURE__*/React.createElement(ParseLogistics, {
3315
+ onChange: handleParseLogistics
3316
+ }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Province, {
3317
+ value: value === null || value === void 0 ? void 0 : value.interceptAddress,
3318
+ onChange: function onChange(val) {
3319
+ return changeHandle(val, 'interceptAddress');
3414
3320
  },
3415
- onChange: changeIdentify
3416
- })), /*#__PURE__*/React.createElement(Item, {
3321
+ options: [],
3322
+ disabled: disabled || isEdit
3323
+ }), /*#__PURE__*/React.createElement(Input, {
3324
+ value: value === null || value === void 0 ? void 0 : value.interceptDetail,
3325
+ disabled: disabled || isEdit,
3326
+ placeholder: "\u8BE6\u7EC6\u5730\u5740",
3327
+ onChange: function onChange(e) {
3328
+ return changeHandle(e.target.value, 'interceptDetail');
3329
+ }
3330
+ })), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Input, {
3331
+ value: value === null || value === void 0 ? void 0 : value.interceptReceiverName,
3332
+ disabled: disabled || isEdit,
3333
+ placeholder: "\u6536\u4EF6\u4EBA\u59D3\u540D",
3334
+ onChange: function onChange(e) {
3335
+ return changeHandle(e.target.value, 'interceptReceiverName');
3336
+ }
3337
+ }), /*#__PURE__*/React.createElement(Input, {
3338
+ value: value === null || value === void 0 ? void 0 : value.interceptReceiverMobile,
3339
+ disabled: disabled || isEdit,
3340
+ placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
3341
+ onChange: function onChange(e) {
3342
+ return changeHandle(e.target.value, 'interceptReceiverMobile');
3343
+ }
3344
+ }))), /*#__PURE__*/React.createElement(Item, {
3417
3345
  label: '物流状态',
3418
3346
  key: 'interceptLogisticsStatus'
3419
3347
  }, /*#__PURE__*/React.createElement(Select, {
@@ -4107,4 +4035,4 @@ var Goods$1 = function Goods(props, ref) {
4107
4035
  };
4108
4036
  var index = /*#__PURE__*/forwardRef(Goods$1);
4109
4037
 
4110
- export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasMultipleSelect, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, ApaasUploadAsync, BuyerNick, ChooseBaby, ExpressLogistics, Goods, index as GoodsTable, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, ParseLogistics, Payment, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, Supplier, TBGoodId, TBGoodSerial, TradeId };
4038
+ export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasMultipleSelect, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, ApaasUploadAsync, BuyerNick, ChooseBaby, ExpressLogistics, Goods, index as GoodsTable, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, Payment, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, Supplier, TBGoodId, TBGoodSerial, TradeId };
package/dist/index.js CHANGED
@@ -3065,27 +3065,43 @@ var Payment = function Payment(props) {
3065
3065
  var TextArea$1 = antd.Input.TextArea;
3066
3066
  var ParseLogistics = function ParseLogistics(props) {
3067
3067
  var onChange = props.onChange;
3068
- var _useState = React.useState(""),
3068
+ var _useState = React.useState(''),
3069
3069
  _useState2 = _slicedToArray(_useState, 2),
3070
3070
  value = _useState2[0],
3071
3071
  setValue = _useState2[1];
3072
- var handleIdentify = function handleIdentify() {
3073
- if (!value) {
3074
- return;
3075
- }
3076
- kmkfUtils.request({
3077
- url: "/qy/logistics/addressAnalysis",
3078
- method: "post",
3079
- data: {
3080
- fullAddress: value
3081
- }
3082
- }).then(function (res) {
3083
- var data = res.data;
3084
- onChange === null || onChange === void 0 ? void 0 : onChange(data);
3085
- }).catch(function (e) {
3086
- console.log(e);
3087
- });
3088
- };
3072
+ var handleIdentify = /*#__PURE__*/function () {
3073
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3074
+ var _yield$request, data;
3075
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3076
+ while (1) switch (_context.prev = _context.next) {
3077
+ case 0:
3078
+ if (value) {
3079
+ _context.next = 2;
3080
+ break;
3081
+ }
3082
+ return _context.abrupt("return");
3083
+ case 2:
3084
+ _context.next = 4;
3085
+ return extendRequest('/qy/logistics/addressAnalysis', {
3086
+ method: 'post',
3087
+ data: {
3088
+ fullAddress: value
3089
+ }
3090
+ });
3091
+ case 4:
3092
+ _yield$request = _context.sent;
3093
+ data = _yield$request.data;
3094
+ onChange === null || onChange === void 0 ? void 0 : onChange(data);
3095
+ case 7:
3096
+ case "end":
3097
+ return _context.stop();
3098
+ }
3099
+ }, _callee);
3100
+ }));
3101
+ return function handleIdentify() {
3102
+ return _ref.apply(this, arguments);
3103
+ };
3104
+ }();
3089
3105
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(TextArea$1, {
3090
3106
  placeholder: "\u590D\u5236\u7269\u6D41\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
3091
3107
  rows: 3,
@@ -3100,67 +3116,12 @@ var ParseLogistics = function ParseLogistics(props) {
3100
3116
  }, "\u667A\u80FD\u8BC6\u522B"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
3101
3117
  size: "small",
3102
3118
  onClick: function onClick() {
3103
- return setValue("");
3119
+ return setValue('');
3104
3120
  }
3105
3121
  }, "\u6E05\u7A7A")));
3106
3122
  };
3107
3123
 
3108
- var IdentifyAddress = function IdentifyAddress(props) {
3109
- var value = props.value,
3110
- onChange = props.onChange,
3111
- _props$disabled = props.disabled,
3112
- disabled = _props$disabled === void 0 ? false : _props$disabled;
3113
- var changeHandle = function changeHandle(val, type) {
3114
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val)));
3115
- };
3116
- var handleParseLogistics = function handleParseLogistics(val) {
3117
- var params = {
3118
- detail: val === null || val === void 0 ? void 0 : val.addressDetail,
3119
- receiverName: val === null || val === void 0 ? void 0 : val.name,
3120
- receiverMobile: val === null || val === void 0 ? void 0 : val.phone,
3121
- address: []
3122
- };
3123
- if (val === null || val === void 0 ? void 0 : val.province) {
3124
- params.address = [kmkfUtils.AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.province), kmkfUtils.AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.city), kmkfUtils.AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
3125
- }
3126
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3127
- };
3128
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, !disabled && /*#__PURE__*/React__default['default'].createElement(ParseLogistics, {
3129
- onChange: handleParseLogistics
3130
- }), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(Province, {
3131
- value: value.address,
3132
- onChange: function onChange(val) {
3133
- return changeHandle(val, 'address');
3134
- },
3135
- options: [],
3136
- disabled: disabled
3137
- }), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3138
- value: value.detail,
3139
- disabled: disabled,
3140
- placeholder: "\u8BE6\u7EC6\u5730\u5740",
3141
- onChange: function onChange(e) {
3142
- return changeHandle(e.target.value, 'detail');
3143
- }
3144
- })), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3145
- value: value.receiverName,
3146
- disabled: disabled,
3147
- placeholder: "\u6536\u4EF6\u4EBA\u59D3\u540D",
3148
- onChange: function onChange(e) {
3149
- return changeHandle(e.target.value, 'receiverName');
3150
- }
3151
- }), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3152
- value: value.receiverMobile,
3153
- disabled: disabled,
3154
- placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
3155
- onChange: function onChange(e) {
3156
- return changeHandle(e.target.value, 'receiverMobile');
3157
- }
3158
- })));
3159
- };
3160
-
3161
3124
  var Item = antd.Form.Item;
3162
- var LogisticsAddress = kmkfUtils.LogisticsAddressData.getInstance();
3163
- var address$1 = kmkfUtils.AddressData.getInstance();
3164
3125
  var LogisticsInterception = function LogisticsInterception(props) {
3165
3126
  var _props$value = props.value,
3166
3127
  value = _props$value === void 0 ? {} : _props$value,
@@ -3193,6 +3154,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3193
3154
  setIsInterface = _useState8[1];
3194
3155
  var firstIn = React.useRef(true);
3195
3156
  React.useEffect(function () {
3157
+ kmkfUtils.AddressData.getInstance();
3196
3158
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3197
3159
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3198
3160
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3248,19 +3210,12 @@ var LogisticsInterception = function LogisticsInterception(props) {
3248
3210
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3249
3211
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3250
3212
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3251
- //是否回退新地址
3252
- var showReturnAddress = React.useMemo(function () {
3253
- var _find2, _find2$config;
3254
- return (_find2 = (typeOptions || []).find(function (item) {
3255
- return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3256
- })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showAddressSelect;
3257
- }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3258
3213
  //是否展示发件人手机号
3259
3214
  var showSenderMobile = React.useMemo(function () {
3260
- var _find3, _find3$config;
3261
- return (_find3 = (typeOptions || []).find(function (item) {
3215
+ var _find2, _find2$config;
3216
+ return (_find2 = (typeOptions || []).find(function (item) {
3262
3217
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3263
- })) === null || _find3 === void 0 ? void 0 : (_find3$config = _find3.config) === null || _find3$config === void 0 ? void 0 : _find3$config.showSenderMobile;
3218
+ })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showSenderMobile;
3264
3219
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3265
3220
  //判断是否能修改物流信息
3266
3221
  var isEdit = React.useMemo(function () {
@@ -3269,39 +3224,19 @@ var LogisticsInterception = function LogisticsInterception(props) {
3269
3224
  });
3270
3225
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3271
3226
  }, [isEditing, initCompany]);
3272
- //退回地址列表
3273
- var logisticsAddressOptions = React.useMemo(function () {
3274
- return ((LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getAddressData()) || []).filter(function (item) {
3275
- return item.cpCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3276
- });
3277
- }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3278
- var returnValue = React.useMemo(function () {
3279
- var _value$interceptAddre, _value$interceptAddre2, _value$interceptAddre3;
3280
- var uk = LogisticsAddress === null || LogisticsAddress === void 0 ? void 0 : LogisticsAddress.getUkByInfo({
3281
- cpCode: (value === null || value === void 0 ? void 0 : value.interceptCompany) || '',
3282
- province: value === null || value === void 0 ? void 0 : (_value$interceptAddre = value.interceptAddress) === null || _value$interceptAddre === void 0 ? void 0 : _value$interceptAddre[0],
3283
- city: value === null || value === void 0 ? void 0 : (_value$interceptAddre2 = value.interceptAddress) === null || _value$interceptAddre2 === void 0 ? void 0 : _value$interceptAddre2[1],
3284
- district: value === null || value === void 0 ? void 0 : (_value$interceptAddre3 = value.interceptAddress) === null || _value$interceptAddre3 === void 0 ? void 0 : _value$interceptAddre3[2],
3285
- detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3286
- userName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3287
- mobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3288
- });
3289
- return uk;
3290
- }, [value === null || value === void 0 ? void 0 : value.interceptCompany, value === null || value === void 0 ? void 0 : value.interceptAddress]);
3291
- //选择回调
3292
3227
  var changeHandle = function changeHandle(val, type) {
3293
3228
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3294
3229
  if (type === 'interceptCompany') {
3295
3230
  var interceptCompany = expressInterceptData.find(function (item) {
3296
3231
  return item.value === val;
3297
3232
  });
3298
- var _returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3233
+ var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3299
3234
  var _item$config3;
3300
3235
  return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3301
3236
  });
3302
3237
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3303
3238
  interceptCompany: val,
3304
- interceptType: _returnValue === null || _returnValue === void 0 ? void 0 : _returnValue.value,
3239
+ interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3305
3240
  interceptSenderMobile: undefined,
3306
3241
  interceptAddress: [],
3307
3242
  interceptDetail: undefined,
@@ -3313,29 +3248,16 @@ var LogisticsInterception = function LogisticsInterception(props) {
3313
3248
  }
3314
3249
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3315
3250
  };
3316
- //智能识别回调
3317
- var changeIdentify = function changeIdentify(val) {
3318
- //智能识别返填
3319
- var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3320
- interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3321
- interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3322
- interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3323
- interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3251
+ var handleParseLogistics = function handleParseLogistics(val) {
3252
+ var params = _objectSpread2(_objectSpread2({}, value), {}, {
3253
+ interceptDetail: val === null || val === void 0 ? void 0 : val.addressDetail,
3254
+ interceptReceiverName: val === null || val === void 0 ? void 0 : val.name,
3255
+ interceptReceiverMobile: val === null || val === void 0 ? void 0 : val.phone
3324
3256
  });
3325
- onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3326
- };
3327
- //选择退回地址
3328
- var changeReturnAddress = function changeReturnAddress(uk) {
3329
- var item = LogisticsAddress.getItemByUk(uk);
3330
- console.log(item);
3331
- if (item) {
3332
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3333
- interceptAddress: [item === null || item === void 0 ? void 0 : item.province, item === null || item === void 0 ? void 0 : item.city, item === null || item === void 0 ? void 0 : item.district],
3334
- interceptDetail: item === null || item === void 0 ? void 0 : item.detail,
3335
- interceptReceiverName: item === null || item === void 0 ? void 0 : item.userName,
3336
- interceptReceiverMobile: item === null || item === void 0 ? void 0 : item.mobile
3337
- }));
3257
+ if (val === null || val === void 0 ? void 0 : val.province) {
3258
+ params.interceptAddress = [kmkfUtils.AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.province), kmkfUtils.AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.city), kmkfUtils.AddressData.getInstance().getProCodeByName(val === null || val === void 0 ? void 0 : val.district)];
3338
3259
  }
3260
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3339
3261
  };
3340
3262
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Item, {
3341
3263
  label: '物流信息',
@@ -3395,35 +3317,41 @@ var LogisticsInterception = function LogisticsInterception(props) {
3395
3317
  return changeHandle(e.target.value, 'interceptSenderMobile');
3396
3318
  }
3397
3319
  })), /*#__PURE__*/React__default['default'].createElement(Item, {
3398
- label: '退回地址',
3399
- required: true,
3400
- key: 'returnAddress',
3401
- hidden: !showReturnAddress
3402
- }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
3403
- disabled: disabled || isEdit,
3404
- value: returnValue,
3405
- onChange: changeReturnAddress,
3406
- placeholder: "\u8BF7\u9009\u62E9\u9000\u56DE\u5730\u5740"
3407
- }, logisticsAddressOptions.map(function (item) {
3408
- return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
3409
- key: item.uk,
3410
- value: item.uk
3411
- }, "".concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.province) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.city) || '').concat(address$1.getNameByCode(item === null || item === void 0 ? void 0 : item.district) || '').concat(item.detail, " ").concat(item === null || item === void 0 ? void 0 : item.userName, ":").concat(item === null || item === void 0 ? void 0 : item.mobile));
3412
- }))), /*#__PURE__*/React__default['default'].createElement(Item, {
3413
3320
  label: '派送地址',
3414
3321
  required: true,
3415
3322
  key: 'newAddress',
3416
3323
  hidden: !showNewAddress
3417
- }, /*#__PURE__*/React__default['default'].createElement(IdentifyAddress, {
3418
- disabled: disabled || isEdit,
3419
- value: {
3420
- address: (value === null || value === void 0 ? void 0 : value.interceptAddress) || [],
3421
- detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3422
- receiverName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3423
- receiverMobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3324
+ }, !(disabled || isEdit) && /*#__PURE__*/React__default['default'].createElement(ParseLogistics, {
3325
+ onChange: handleParseLogistics
3326
+ }), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(Province, {
3327
+ value: value === null || value === void 0 ? void 0 : value.interceptAddress,
3328
+ onChange: function onChange(val) {
3329
+ return changeHandle(val, 'interceptAddress');
3424
3330
  },
3425
- onChange: changeIdentify
3426
- })), /*#__PURE__*/React__default['default'].createElement(Item, {
3331
+ options: [],
3332
+ disabled: disabled || isEdit
3333
+ }), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3334
+ value: value === null || value === void 0 ? void 0 : value.interceptDetail,
3335
+ disabled: disabled || isEdit,
3336
+ placeholder: "\u8BE6\u7EC6\u5730\u5740",
3337
+ onChange: function onChange(e) {
3338
+ return changeHandle(e.target.value, 'interceptDetail');
3339
+ }
3340
+ })), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3341
+ value: value === null || value === void 0 ? void 0 : value.interceptReceiverName,
3342
+ disabled: disabled || isEdit,
3343
+ placeholder: "\u6536\u4EF6\u4EBA\u59D3\u540D",
3344
+ onChange: function onChange(e) {
3345
+ return changeHandle(e.target.value, 'interceptReceiverName');
3346
+ }
3347
+ }), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3348
+ value: value === null || value === void 0 ? void 0 : value.interceptReceiverMobile,
3349
+ disabled: disabled || isEdit,
3350
+ placeholder: "\u6536\u4EF6\u4EBA\u7535\u8BDD",
3351
+ onChange: function onChange(e) {
3352
+ return changeHandle(e.target.value, 'interceptReceiverMobile');
3353
+ }
3354
+ }))), /*#__PURE__*/React__default['default'].createElement(Item, {
3427
3355
  label: '物流状态',
3428
3356
  key: 'interceptLogisticsStatus'
3429
3357
  }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
@@ -4139,12 +4067,10 @@ exports.ChooseBaby = ChooseBaby;
4139
4067
  exports.ExpressLogistics = ExpressLogistics;
4140
4068
  exports.Goods = Goods;
4141
4069
  exports.GoodsTable = index;
4142
- exports.IdentifyAddress = IdentifyAddress;
4143
4070
  exports.Invoice = Invoice;
4144
4071
  exports.JstGoods = jstGoods;
4145
4072
  exports.JstItemList = ItemList;
4146
4073
  exports.LogisticsInterception = LogisticsInterception;
4147
- exports.ParseLogistics = ParseLogistics;
4148
4074
  exports.Payment = Payment;
4149
4075
  exports.Remark = RemarkInput;
4150
4076
  exports.ReturnLogistics = ExpressLogistics;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  interface ParseLogisticsProps {
3
3
  onChange: (value: any) => void;
4
4
  }
@@ -33,5 +33,3 @@ export { default as Goods } from './common/Goods';
33
33
  export { default as JstGoods } from './jst/Goods';
34
34
  export { default as JstItemList } from './jst/ItemList';
35
35
  export { default as GoodsTable } from './common/GoodsTable';
36
- export { default as ParseLogistics } from './common/ParseLogistics';
37
- export { default as IdentifyAddress } from './common/IdentifyAddress';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.7.1-alpha.1",
3
+ "version": "0.7.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -16,11 +16,11 @@
16
16
  "lint": "eslint '**/*.{ts,tsx}'",
17
17
  "lint:fix": "eslint --fix '**/*.{ts,tsx}'",
18
18
  "start": "dumi dev",
19
- "test": "jest",
20
- "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
19
+ "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'",
20
+ "test": "jest"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.7.1-alpha.1",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.7.1",
24
24
  "umi-request": "^1.4.0"
25
25
  },
26
26
  "devDependencies": {
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "aa47b4aa4ce5e954a1312a4f0091daeb88b38336"
57
+ "gitHead": "45b9ed0a862e698d4e244071b87ad8109a2d26c7"
58
58
  }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- interface IdentifyAddressProps {
3
- value: {
4
- address: any[];
5
- detail: string;
6
- receiverName: string;
7
- receiverMobile: string;
8
- };
9
- onChange: (value: any) => void;
10
- disabled?: boolean;
11
- }
12
- declare const IdentifyAddress: (props: IdentifyAddressProps) => React.JSX.Element;
13
- export default IdentifyAddress;