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

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,66 @@ 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(val, type);
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();
3115
3153
  var LogisticsInterception = function LogisticsInterception(props) {
3116
3154
  var _props$value = props.value,
3117
3155
  value = _props$value === void 0 ? {} : _props$value,
@@ -3119,6 +3157,8 @@ var LogisticsInterception = function LogisticsInterception(props) {
3119
3157
  logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
3120
3158
  _props$expressInterce = props.expressInterceptData,
3121
3159
  expressInterceptData = _props$expressInterce === void 0 ? [] : _props$expressInterce,
3160
+ _props$logisticsAddre = props.logisticsAddressData,
3161
+ logisticsAddressData = _props$logisticsAddre === void 0 ? [] : _props$logisticsAddre,
3122
3162
  _props$required = props.required,
3123
3163
  required = _props$required === void 0 ? false : _props$required,
3124
3164
  onChange = props.onChange,
@@ -3200,12 +3240,19 @@ var LogisticsInterception = function LogisticsInterception(props) {
3200
3240
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3201
3241
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3202
3242
  }, [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 () {
3243
+ //是否回退新地址
3244
+ var showReturnAddress = useMemo(function () {
3205
3245
  var _find2, _find2$config;
3206
3246
  return (_find2 = (typeOptions || []).find(function (item) {
3207
3247
  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;
3248
+ })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showAddressSelect;
3249
+ }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3250
+ //是否展示发件人手机号
3251
+ var showSenderMobile = useMemo(function () {
3252
+ var _find3, _find3$config;
3253
+ return (_find3 = (typeOptions || []).find(function (item) {
3254
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3255
+ })) === null || _find3 === void 0 ? void 0 : (_find3$config = _find3.config) === null || _find3$config === void 0 ? void 0 : _find3$config.showSenderMobile;
3209
3256
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3210
3257
  //判断是否能修改物流信息
3211
3258
  var isEdit = useMemo(function () {
@@ -3214,6 +3261,12 @@ var LogisticsInterception = function LogisticsInterception(props) {
3214
3261
  });
3215
3262
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3216
3263
  }, [isEditing, initCompany]);
3264
+ var logisticsAddressOptions = useMemo(function () {
3265
+ return logisticsAddressData.filter(function (item) {
3266
+ return item.cpCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3267
+ });
3268
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3269
+ //选择回调
3217
3270
  var changeHandle = function changeHandle(val, type) {
3218
3271
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3219
3272
  if (type === 'interceptCompany') {
@@ -3238,16 +3291,40 @@ var LogisticsInterception = function LogisticsInterception(props) {
3238
3291
  }
3239
3292
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3240
3293
  };
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
3246
- });
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)];
3294
+ //智能识别回调
3295
+ var changeIdentify = function changeIdentify(val, type) {
3296
+ //输入返填
3297
+ if (type) {
3298
+ var typeMap = {
3299
+ address: 'interceptAddress',
3300
+ detail: 'interceptDetail',
3301
+ receiverName: 'interceptReceiverName',
3302
+ receiverMobile: 'interceptReceiverMobile'
3303
+ };
3304
+ var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, typeMap[type], val));
3305
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3306
+ } else {
3307
+ //智能识别返填
3308
+ var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3309
+ interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3310
+ interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3311
+ interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3312
+ interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3313
+ });
3314
+ onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3315
+ }
3316
+ };
3317
+ //选择退回地址
3318
+ var changeReturnAddress = function changeReturnAddress(uk) {
3319
+ var item = LogisticsAddress.getItemByUk(uk);
3320
+ if (item) {
3321
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3322
+ 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],
3323
+ interceptDetail: item === null || item === void 0 ? void 0 : item.detail,
3324
+ interceptReceiverName: item === null || item === void 0 ? void 0 : item.userName,
3325
+ interceptReceiverMobile: item === null || item === void 0 ? void 0 : item.mobile
3326
+ }));
3249
3327
  }
3250
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3251
3328
  };
3252
3329
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Item, {
3253
3330
  label: '物流信息',
@@ -3306,42 +3383,29 @@ var LogisticsInterception = function LogisticsInterception(props) {
3306
3383
  onChange: function onChange(e) {
3307
3384
  return changeHandle(e.target.value, 'interceptSenderMobile');
3308
3385
  }
3386
+ })), /*#__PURE__*/React.createElement(Item, {
3387
+ label: '退回地址',
3388
+ required: true,
3389
+ key: 'returnAddress',
3390
+ hidden: !showReturnAddress
3391
+ }, /*#__PURE__*/React.createElement(Select, {
3392
+ options: logisticsAddressOptions,
3393
+ onChange: changeReturnAddress
3309
3394
  })), /*#__PURE__*/React.createElement(Item, {
3310
3395
  label: '派送地址',
3311
3396
  required: true,
3312
3397
  key: 'newAddress',
3313
3398
  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,
3399
+ }, /*#__PURE__*/React.createElement(IdentifyAddress, {
3325
3400
  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, {
3401
+ value: {
3402
+ address: (value === null || value === void 0 ? void 0 : value.interceptAddress) || [],
3403
+ detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3404
+ receiverName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3405
+ receiverMobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3406
+ },
3407
+ onChange: changeIdentify
3408
+ })), /*#__PURE__*/React.createElement(Item, {
3345
3409
  label: '物流状态',
3346
3410
  key: 'interceptLogisticsStatus'
3347
3411
  }, /*#__PURE__*/React.createElement(Select, {
@@ -4035,4 +4099,4 @@ var Goods$1 = function Goods(props, ref) {
4035
4099
  };
4036
4100
  var index = /*#__PURE__*/forwardRef(Goods$1);
4037
4101
 
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 };
4102
+ 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,66 @@ 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(val, type);
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();
3125
3163
  var LogisticsInterception = function LogisticsInterception(props) {
3126
3164
  var _props$value = props.value,
3127
3165
  value = _props$value === void 0 ? {} : _props$value,
@@ -3129,6 +3167,8 @@ var LogisticsInterception = function LogisticsInterception(props) {
3129
3167
  logisticsOptions = _props$logisticsOptio === void 0 ? [] : _props$logisticsOptio,
3130
3168
  _props$expressInterce = props.expressInterceptData,
3131
3169
  expressInterceptData = _props$expressInterce === void 0 ? [] : _props$expressInterce,
3170
+ _props$logisticsAddre = props.logisticsAddressData,
3171
+ logisticsAddressData = _props$logisticsAddre === void 0 ? [] : _props$logisticsAddre,
3132
3172
  _props$required = props.required,
3133
3173
  required = _props$required === void 0 ? false : _props$required,
3134
3174
  onChange = props.onChange,
@@ -3210,12 +3250,19 @@ var LogisticsInterception = function LogisticsInterception(props) {
3210
3250
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3211
3251
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3212
3252
  }, [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 () {
3253
+ //是否回退新地址
3254
+ var showReturnAddress = React.useMemo(function () {
3215
3255
  var _find2, _find2$config;
3216
3256
  return (_find2 = (typeOptions || []).find(function (item) {
3217
3257
  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;
3258
+ })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showAddressSelect;
3259
+ }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3260
+ //是否展示发件人手机号
3261
+ var showSenderMobile = React.useMemo(function () {
3262
+ var _find3, _find3$config;
3263
+ return (_find3 = (typeOptions || []).find(function (item) {
3264
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3265
+ })) === null || _find3 === void 0 ? void 0 : (_find3$config = _find3.config) === null || _find3$config === void 0 ? void 0 : _find3$config.showSenderMobile;
3219
3266
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3220
3267
  //判断是否能修改物流信息
3221
3268
  var isEdit = React.useMemo(function () {
@@ -3224,6 +3271,12 @@ var LogisticsInterception = function LogisticsInterception(props) {
3224
3271
  });
3225
3272
  return isEditing && !!(company === null || company === void 0 ? void 0 : company.isInterface);
3226
3273
  }, [isEditing, initCompany]);
3274
+ var logisticsAddressOptions = React.useMemo(function () {
3275
+ return logisticsAddressData.filter(function (item) {
3276
+ return item.cpCode === (value === null || value === void 0 ? void 0 : value.interceptCompany);
3277
+ });
3278
+ }, [value === null || value === void 0 ? void 0 : value.interceptCompany]);
3279
+ //选择回调
3227
3280
  var changeHandle = function changeHandle(val, type) {
3228
3281
  var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, type, val));
3229
3282
  if (type === 'interceptCompany') {
@@ -3248,16 +3301,40 @@ var LogisticsInterception = function LogisticsInterception(props) {
3248
3301
  }
3249
3302
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3250
3303
  };
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
3256
- });
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)];
3304
+ //智能识别回调
3305
+ var changeIdentify = function changeIdentify(val, type) {
3306
+ //输入返填
3307
+ if (type) {
3308
+ var typeMap = {
3309
+ address: 'interceptAddress',
3310
+ detail: 'interceptDetail',
3311
+ receiverName: 'interceptReceiverName',
3312
+ receiverMobile: 'interceptReceiverMobile'
3313
+ };
3314
+ var newValue = _objectSpread2(_objectSpread2({}, value), {}, _defineProperty({}, typeMap[type], val));
3315
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3316
+ } else {
3317
+ //智能识别返填
3318
+ var parseValue = _objectSpread2(_objectSpread2({}, value), {}, {
3319
+ interceptAddress: (val === null || val === void 0 ? void 0 : val.address) || [],
3320
+ interceptDetail: (val === null || val === void 0 ? void 0 : val.detail) || '',
3321
+ interceptReceiverName: (val === null || val === void 0 ? void 0 : val.receiverName) || '',
3322
+ interceptReceiverMobile: (val === null || val === void 0 ? void 0 : val.receiverMobile) || ''
3323
+ });
3324
+ onChange === null || onChange === void 0 ? void 0 : onChange(parseValue);
3325
+ }
3326
+ };
3327
+ //选择退回地址
3328
+ var changeReturnAddress = function changeReturnAddress(uk) {
3329
+ var item = LogisticsAddress.getItemByUk(uk);
3330
+ if (item) {
3331
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3332
+ 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],
3333
+ interceptDetail: item === null || item === void 0 ? void 0 : item.detail,
3334
+ interceptReceiverName: item === null || item === void 0 ? void 0 : item.userName,
3335
+ interceptReceiverMobile: item === null || item === void 0 ? void 0 : item.mobile
3336
+ }));
3259
3337
  }
3260
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3261
3338
  };
3262
3339
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Item, {
3263
3340
  label: '物流信息',
@@ -3316,42 +3393,29 @@ var LogisticsInterception = function LogisticsInterception(props) {
3316
3393
  onChange: function onChange(e) {
3317
3394
  return changeHandle(e.target.value, 'interceptSenderMobile');
3318
3395
  }
3396
+ })), /*#__PURE__*/React__default['default'].createElement(Item, {
3397
+ label: '退回地址',
3398
+ required: true,
3399
+ key: 'returnAddress',
3400
+ hidden: !showReturnAddress
3401
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
3402
+ options: logisticsAddressOptions,
3403
+ onChange: changeReturnAddress
3319
3404
  })), /*#__PURE__*/React__default['default'].createElement(Item, {
3320
3405
  label: '派送地址',
3321
3406
  required: true,
3322
3407
  key: 'newAddress',
3323
3408
  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,
3409
+ }, /*#__PURE__*/React__default['default'].createElement(IdentifyAddress, {
3335
3410
  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, {
3411
+ value: {
3412
+ address: (value === null || value === void 0 ? void 0 : value.interceptAddress) || [],
3413
+ detail: (value === null || value === void 0 ? void 0 : value.interceptDetail) || '',
3414
+ receiverName: (value === null || value === void 0 ? void 0 : value.interceptReceiverName) || '',
3415
+ receiverMobile: (value === null || value === void 0 ? void 0 : value.interceptReceiverMobile) || ''
3416
+ },
3417
+ onChange: changeIdentify
3418
+ })), /*#__PURE__*/React__default['default'].createElement(Item, {
3355
3419
  label: '物流状态',
3356
3420
  key: 'interceptLogisticsStatus'
3357
3421
  }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
@@ -4067,10 +4131,12 @@ exports.ChooseBaby = ChooseBaby;
4067
4131
  exports.ExpressLogistics = ExpressLogistics;
4068
4132
  exports.Goods = Goods;
4069
4133
  exports.GoodsTable = index;
4134
+ exports.IdentifyAddress = IdentifyAddress;
4070
4135
  exports.Invoice = Invoice;
4071
4136
  exports.JstGoods = jstGoods;
4072
4137
  exports.JstItemList = ItemList;
4073
4138
  exports.LogisticsInterception = LogisticsInterception;
4139
+ exports.ParseLogistics = ParseLogistics;
4074
4140
  exports.Payment = Payment;
4075
4141
  exports.Remark = RemarkInput;
4076
4142
  exports.ReturnLogistics = ExpressLogistics;
@@ -15,6 +15,7 @@ interface LogisticsInterceptionProps {
15
15
  value: Partial<LogisticsInterceptionValueType>;
16
16
  logisticsOptions: any[];
17
17
  expressInterceptData: any[];
18
+ logisticsAddressData: any[];
18
19
  required: boolean;
19
20
  disabled: boolean;
20
21
  isEditing: boolean;
@@ -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, type?: string) => 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.0",
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.0",
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": "7ad1a590f1f169f979d75636f52a0456343ceeee"
58
58
  }