@kmkf-fe-packages/basic-components 0.7.0 → 0.7.1-alpha.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 } from '@kmkf-fe-packages/kmkf-utils';
5
+ import { AddressData, request as request$1, LogisticsAddressData } 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,43 +3055,27 @@ 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 = /*#__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
- }();
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
+ };
3095
3079
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextArea$1, {
3096
3080
  placeholder: "\u590D\u5236\u7269\u6D41\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
3097
3081
  rows: 3,
@@ -3106,12 +3090,67 @@ var ParseLogistics = function ParseLogistics(props) {
3106
3090
  }, "\u667A\u80FD\u8BC6\u522B"), /*#__PURE__*/React.createElement(Button, {
3107
3091
  size: "small",
3108
3092
  onClick: function onClick() {
3109
- return setValue('');
3093
+ return setValue("");
3110
3094
  }
3111
3095
  }, "\u6E05\u7A7A")));
3112
3096
  };
3113
3097
 
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
+
3114
3151
  var Item = Form.Item;
3152
+ var LogisticsAddress = LogisticsAddressData.getInstance();
3153
+ var address$1 = AddressData.getInstance();
3115
3154
  var LogisticsInterception = function LogisticsInterception(props) {
3116
3155
  var _props$value = props.value,
3117
3156
  value = _props$value === void 0 ? {} : _props$value,
@@ -3144,7 +3183,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
3144
3183
  setIsInterface = _useState8[1];
3145
3184
  var firstIn = useRef(true);
3146
3185
  useEffect(function () {
3147
- AddressData.getInstance();
3148
3186
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3149
3187
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3150
3188
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3200,12 +3238,19 @@ var LogisticsInterception = function LogisticsInterception(props) {
3200
3238
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3201
3239
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3202
3240
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3203
- //是否展示发件人手机号
3204
- var showSenderMobile = useMemo(function () {
3241
+ //是否回退新地址
3242
+ var showReturnAddress = useMemo(function () {
3205
3243
  var _find2, _find2$config;
3206
3244
  return (_find2 = (typeOptions || []).find(function (item) {
3207
3245
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3208
- })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showSenderMobile;
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
+ //是否展示发件人手机号
3249
+ var showSenderMobile = useMemo(function () {
3250
+ var _find3, _find3$config;
3251
+ return (_find3 = (typeOptions || []).find(function (item) {
3252
+ 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;
3209
3254
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3210
3255
  //判断是否能修改物流信息
3211
3256
  var isEdit = useMemo(function () {
@@ -3214,19 +3259,39 @@ var LogisticsInterception = function LogisticsInterception(props) {
3214
3259
  });
3215
3260
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3216
3261
  }, [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
+ //选择回调
3217
3282
  var changeHandle = function changeHandle(val, type) {
3218
3283
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3219
3284
  if (type === 'interceptCompany') {
3220
3285
  var interceptCompany = expressInterceptData.find(function (item) {
3221
3286
  return item.value === val;
3222
3287
  });
3223
- var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3288
+ var _returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3224
3289
  var _item$config3;
3225
3290
  return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3226
3291
  });
3227
3292
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3228
3293
  interceptCompany: val,
3229
- interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3294
+ interceptType: _returnValue === null || _returnValue === void 0 ? void 0 : _returnValue.value,
3230
3295
  interceptSenderMobile: undefined,
3231
3296
  interceptAddress: [],
3232
3297
  interceptDetail: undefined,
@@ -3238,16 +3303,29 @@ var LogisticsInterception = function LogisticsInterception(props) {
3238
3303
  }
3239
3304
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3240
3305
  };
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
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) || ''
3246
3314
  });
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)];
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
+ }));
3249
3328
  }
3250
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3251
3329
  };
3252
3330
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Item, {
3253
3331
  label: '物流信息',
@@ -3307,41 +3385,35 @@ var LogisticsInterception = function LogisticsInterception(props) {
3307
3385
  return changeHandle(e.target.value, 'interceptSenderMobile');
3308
3386
  }
3309
3387
  })), /*#__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, {
3310
3403
  label: '派送地址',
3311
3404
  required: true,
3312
3405
  key: 'newAddress',
3313
3406
  hidden: !showNewAddress
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');
3320
- },
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,
3407
+ }, /*#__PURE__*/React.createElement(IdentifyAddress, {
3339
3408
  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, {
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) || ''
3414
+ },
3415
+ onChange: changeIdentify
3416
+ })), /*#__PURE__*/React.createElement(Item, {
3345
3417
  label: '物流状态',
3346
3418
  key: 'interceptLogisticsStatus'
3347
3419
  }, /*#__PURE__*/React.createElement(Select, {
@@ -4035,4 +4107,4 @@ var Goods$1 = function Goods(props, ref) {
4035
4107
  };
4036
4108
  var index = /*#__PURE__*/forwardRef(Goods$1);
4037
4109
 
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 };
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 };
package/dist/index.js CHANGED
@@ -3065,43 +3065,27 @@ 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 = /*#__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
- }();
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
+ };
3105
3089
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(TextArea$1, {
3106
3090
  placeholder: "\u590D\u5236\u7269\u6D41\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
3107
3091
  rows: 3,
@@ -3116,12 +3100,67 @@ var ParseLogistics = function ParseLogistics(props) {
3116
3100
  }, "\u667A\u80FD\u8BC6\u522B"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
3117
3101
  size: "small",
3118
3102
  onClick: function onClick() {
3119
- return setValue('');
3103
+ return setValue("");
3120
3104
  }
3121
3105
  }, "\u6E05\u7A7A")));
3122
3106
  };
3123
3107
 
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
+
3124
3161
  var Item = antd.Form.Item;
3162
+ var LogisticsAddress = kmkfUtils.LogisticsAddressData.getInstance();
3163
+ var address$1 = kmkfUtils.AddressData.getInstance();
3125
3164
  var LogisticsInterception = function LogisticsInterception(props) {
3126
3165
  var _props$value = props.value,
3127
3166
  value = _props$value === void 0 ? {} : _props$value,
@@ -3154,7 +3193,6 @@ var LogisticsInterception = function LogisticsInterception(props) {
3154
3193
  setIsInterface = _useState8[1];
3155
3194
  var firstIn = React.useRef(true);
3156
3195
  React.useEffect(function () {
3157
- kmkfUtils.AddressData.getInstance();
3158
3196
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3159
3197
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3160
3198
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3210,12 +3248,19 @@ var LogisticsInterception = function LogisticsInterception(props) {
3210
3248
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3211
3249
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3212
3250
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3213
- //是否展示发件人手机号
3214
- var showSenderMobile = React.useMemo(function () {
3251
+ //是否回退新地址
3252
+ var showReturnAddress = React.useMemo(function () {
3215
3253
  var _find2, _find2$config;
3216
3254
  return (_find2 = (typeOptions || []).find(function (item) {
3217
3255
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3218
- })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showSenderMobile;
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
+ //是否展示发件人手机号
3259
+ var showSenderMobile = React.useMemo(function () {
3260
+ var _find3, _find3$config;
3261
+ return (_find3 = (typeOptions || []).find(function (item) {
3262
+ 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;
3219
3264
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3220
3265
  //判断是否能修改物流信息
3221
3266
  var isEdit = React.useMemo(function () {
@@ -3224,19 +3269,39 @@ var LogisticsInterception = function LogisticsInterception(props) {
3224
3269
  });
3225
3270
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3226
3271
  }, [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
+ //选择回调
3227
3292
  var changeHandle = function changeHandle(val, type) {
3228
3293
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3229
3294
  if (type === 'interceptCompany') {
3230
3295
  var interceptCompany = expressInterceptData.find(function (item) {
3231
3296
  return item.value === val;
3232
3297
  });
3233
- var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3298
+ var _returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3234
3299
  var _item$config3;
3235
3300
  return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3236
3301
  });
3237
3302
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3238
3303
  interceptCompany: val,
3239
- interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3304
+ interceptType: _returnValue === null || _returnValue === void 0 ? void 0 : _returnValue.value,
3240
3305
  interceptSenderMobile: undefined,
3241
3306
  interceptAddress: [],
3242
3307
  interceptDetail: undefined,
@@ -3248,16 +3313,29 @@ var LogisticsInterception = function LogisticsInterception(props) {
3248
3313
  }
3249
3314
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3250
3315
  };
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
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) || ''
3256
3324
  });
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)];
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
+ }));
3259
3338
  }
3260
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3261
3339
  };
3262
3340
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Item, {
3263
3341
  label: '物流信息',
@@ -3317,41 +3395,35 @@ var LogisticsInterception = function LogisticsInterception(props) {
3317
3395
  return changeHandle(e.target.value, 'interceptSenderMobile');
3318
3396
  }
3319
3397
  })), /*#__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, {
3320
3413
  label: '派送地址',
3321
3414
  required: true,
3322
3415
  key: 'newAddress',
3323
3416
  hidden: !showNewAddress
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');
3330
- },
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,
3417
+ }, /*#__PURE__*/React__default['default'].createElement(IdentifyAddress, {
3349
3418
  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, {
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) || ''
3424
+ },
3425
+ onChange: changeIdentify
3426
+ })), /*#__PURE__*/React__default['default'].createElement(Item, {
3355
3427
  label: '物流状态',
3356
3428
  key: 'interceptLogisticsStatus'
3357
3429
  }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
@@ -4067,10 +4139,12 @@ exports.ChooseBaby = ChooseBaby;
4067
4139
  exports.ExpressLogistics = ExpressLogistics;
4068
4140
  exports.Goods = Goods;
4069
4141
  exports.GoodsTable = index;
4142
+ exports.IdentifyAddress = IdentifyAddress;
4070
4143
  exports.Invoice = Invoice;
4071
4144
  exports.JstGoods = jstGoods;
4072
4145
  exports.JstItemList = ItemList;
4073
4146
  exports.LogisticsInterception = LogisticsInterception;
4147
+ exports.ParseLogistics = ParseLogistics;
4074
4148
  exports.Payment = Payment;
4075
4149
  exports.Remark = RemarkInput;
4076
4150
  exports.ReturnLogistics = ExpressLogistics;
@@ -0,0 +1,13 @@
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;
@@ -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,3 +33,5 @@ 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.0",
3
+ "version": "0.7.1-alpha.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
- "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'",
20
- "test": "jest"
19
+ "test": "jest",
20
+ "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.7.0",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.7.1-alpha.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": "214345484eba96df7edb7f29f9205f2389f1debc"
57
+ "gitHead": "aa47b4aa4ce5e954a1312a4f0091daeb88b38336"
58
58
  }