@kmkf-fe-packages/basic-components 0.6.3-alpha.54 → 0.6.3-alpha.57

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
@@ -354,6 +354,53 @@ function _regeneratorRuntime() {
354
354
  }
355
355
  }, exports;
356
356
  }
357
+ function _wrapRegExp() {
358
+ _wrapRegExp = function (re, groups) {
359
+ return new BabelRegExp(re, void 0, groups);
360
+ };
361
+ var _super = RegExp.prototype,
362
+ _groups = new WeakMap();
363
+ function BabelRegExp(re, flags, groups) {
364
+ var _this = new RegExp(re, flags);
365
+ return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
366
+ }
367
+ function buildGroups(result, re) {
368
+ var g = _groups.get(re);
369
+ return Object.keys(g).reduce(function (groups, name) {
370
+ var i = g[name];
371
+ if ("number" == typeof i) groups[name] = result[i];else {
372
+ for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
373
+ groups[name] = result[i[k]];
374
+ }
375
+ return groups;
376
+ }, Object.create(null));
377
+ }
378
+ return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
379
+ var result = _super.exec.call(this, str);
380
+ if (result) {
381
+ result.groups = buildGroups(result, this);
382
+ var indices = result.indices;
383
+ indices && (indices.groups = buildGroups(indices, this));
384
+ }
385
+ return result;
386
+ }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
387
+ if ("string" == typeof substitution) {
388
+ var groups = _groups.get(this);
389
+ return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
390
+ var group = groups[name];
391
+ return "$" + (Array.isArray(group) ? group.join("$") : group);
392
+ }));
393
+ }
394
+ if ("function" == typeof substitution) {
395
+ var _this = this;
396
+ return _super[Symbol.replace].call(this, str, function () {
397
+ var args = arguments;
398
+ return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
399
+ });
400
+ }
401
+ return _super[Symbol.replace].call(this, str, substitution);
402
+ }, _wrapRegExp.apply(this, arguments);
403
+ }
357
404
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
358
405
  try {
359
406
  var info = gen[key](arg);
@@ -398,6 +445,29 @@ function _defineProperty(obj, key, value) {
398
445
  }
399
446
  return obj;
400
447
  }
448
+ function _inherits(subClass, superClass) {
449
+ if (typeof superClass !== "function" && superClass !== null) {
450
+ throw new TypeError("Super expression must either be null or a function");
451
+ }
452
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
453
+ constructor: {
454
+ value: subClass,
455
+ writable: true,
456
+ configurable: true
457
+ }
458
+ });
459
+ Object.defineProperty(subClass, "prototype", {
460
+ writable: false
461
+ });
462
+ if (superClass) _setPrototypeOf(subClass, superClass);
463
+ }
464
+ function _setPrototypeOf(o, p) {
465
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
466
+ o.__proto__ = p;
467
+ return o;
468
+ };
469
+ return _setPrototypeOf(o, p);
470
+ }
401
471
  function _objectWithoutPropertiesLoose(source, excluded) {
402
472
  if (source == null) return {};
403
473
  var target = {};
@@ -3052,6 +3122,89 @@ var Payment = function Payment(props) {
3052
3122
  }));
3053
3123
  };
3054
3124
 
3125
+ var TextArea$1 = Input.TextArea;
3126
+ var ParseLogistics = function ParseLogistics(props) {
3127
+ var onChange = props.onChange;
3128
+ var _useState = useState(''),
3129
+ _useState2 = _slicedToArray(_useState, 2),
3130
+ value = _useState2[0],
3131
+ setValue = _useState2[1];
3132
+ var handleIdentify = function handleIdentify() {
3133
+ var data = parseLogisticsInfo(value);
3134
+ // console.log(data);
3135
+ onChange === null || onChange === void 0 ? void 0 : onChange(data);
3136
+ };
3137
+ var parseLogisticsInfo = function parseLogisticsInfo(str) {
3138
+ var info = {};
3139
+ var regex1 = /*#__PURE__*/_wrapRegExp(/^([^省]+\u7701)?([^市]+\u5E02)?([^区]+\u533A)?(.*)?\s*\u59D3\u540D[:|:](.+)?\s*\u7535\u8BDD[:|:](.+)/, {
3140
+ province: 1,
3141
+ city: 2,
3142
+ district: 3,
3143
+ address: 4,
3144
+ name: 5,
3145
+ phone: 6
3146
+ });
3147
+ var regex2 = /*#__PURE__*/_wrapRegExp(/^\u6536\u8D27\u4EBA[:|:]\s*([^,]+),?\s*\u624B\u673A\u53F7\u7801[:|:]\s*([^,]+),?\s*\u6240\u5728\u5730\u533A[:|:]\s*([^省]+\u7701)?([^市]+\u5E02)?([^区]+\u533A)?(.+)/, {
3148
+ name: 1,
3149
+ phone: 2,
3150
+ province: 3,
3151
+ city: 4,
3152
+ district: 5,
3153
+ address: 6
3154
+ });
3155
+ var match1 = str.match(regex1);
3156
+ if (match1) {
3157
+ var _match1$groups, _match1$groups$provin, _match1$groups2, _match1$groups2$city, _match1$groups3, _match1$groups3$distr, _match1$groups4, _match1$groups4$addre, _match1$groups5, _match1$groups5$name, _match1$groups6, _match1$groups6$phone;
3158
+ info.province = ((_match1$groups = match1.groups) === null || _match1$groups === void 0 ? void 0 : (_match1$groups$provin = _match1$groups.province) === null || _match1$groups$provin === void 0 ? void 0 : _match1$groups$provin.trim()) || '';
3159
+ info.city = ((_match1$groups2 = match1.groups) === null || _match1$groups2 === void 0 ? void 0 : (_match1$groups2$city = _match1$groups2.city) === null || _match1$groups2$city === void 0 ? void 0 : _match1$groups2$city.trim()) || '';
3160
+ info.district = ((_match1$groups3 = match1.groups) === null || _match1$groups3 === void 0 ? void 0 : (_match1$groups3$distr = _match1$groups3.district) === null || _match1$groups3$distr === void 0 ? void 0 : _match1$groups3$distr.trim()) || '';
3161
+ info.address = ((_match1$groups4 = match1.groups) === null || _match1$groups4 === void 0 ? void 0 : (_match1$groups4$addre = _match1$groups4.address) === null || _match1$groups4$addre === void 0 ? void 0 : _match1$groups4$addre.trim()) || '';
3162
+ info.name = ((_match1$groups5 = match1.groups) === null || _match1$groups5 === void 0 ? void 0 : (_match1$groups5$name = _match1$groups5.name) === null || _match1$groups5$name === void 0 ? void 0 : _match1$groups5$name.trim()) || '';
3163
+ info.phone = ((_match1$groups6 = match1.groups) === null || _match1$groups6 === void 0 ? void 0 : (_match1$groups6$phone = _match1$groups6.phone) === null || _match1$groups6$phone === void 0 ? void 0 : _match1$groups6$phone.trim()) || '';
3164
+ return info;
3165
+ }
3166
+ var match2 = str.match(regex2);
3167
+ if (match2) {
3168
+ var _match2$groups, _match2$groups$provin, _match2$groups2, _match2$groups2$city, _match2$groups3, _match2$groups3$distr, _match2$groups4, _match2$groups4$addre, _match2$groups5, _match2$groups5$name, _match2$groups6, _match2$groups6$phone;
3169
+ info.province = ((_match2$groups = match2.groups) === null || _match2$groups === void 0 ? void 0 : (_match2$groups$provin = _match2$groups.province) === null || _match2$groups$provin === void 0 ? void 0 : _match2$groups$provin.trim()) || '';
3170
+ info.city = ((_match2$groups2 = match2.groups) === null || _match2$groups2 === void 0 ? void 0 : (_match2$groups2$city = _match2$groups2.city) === null || _match2$groups2$city === void 0 ? void 0 : _match2$groups2$city.trim()) || '';
3171
+ info.district = ((_match2$groups3 = match2.groups) === null || _match2$groups3 === void 0 ? void 0 : (_match2$groups3$distr = _match2$groups3.district) === null || _match2$groups3$distr === void 0 ? void 0 : _match2$groups3$distr.trim()) || '';
3172
+ info.address = ((_match2$groups4 = match2.groups) === null || _match2$groups4 === void 0 ? void 0 : (_match2$groups4$addre = _match2$groups4.address) === null || _match2$groups4$addre === void 0 ? void 0 : _match2$groups4$addre.trim()) || '';
3173
+ info.name = ((_match2$groups5 = match2.groups) === null || _match2$groups5 === void 0 ? void 0 : (_match2$groups5$name = _match2$groups5.name) === null || _match2$groups5$name === void 0 ? void 0 : _match2$groups5$name.trim()) || '';
3174
+ info.phone = ((_match2$groups6 = match2.groups) === null || _match2$groups6 === void 0 ? void 0 : (_match2$groups6$phone = _match2$groups6.phone) === null || _match2$groups6$phone === void 0 ? void 0 : _match2$groups6$phone.trim()) || '';
3175
+ return info;
3176
+ }
3177
+ // const match3 = str.match(regex3);
3178
+ // if (match3) {
3179
+ // info.province = match3.groups?.province?.trim() || '';
3180
+ // info.city = match3.groups?.city?.trim() || '';
3181
+ // info.district = match3.groups?.district?.trim() || '';
3182
+ // info.address = match3.groups?.address?.trim() || '';
3183
+ // info.name = match3.groups?.name?.trim() || '';
3184
+ // info.phone = match3.groups?.phone?.trim() || '';
3185
+ // return info;
3186
+ // }
3187
+ return info;
3188
+ };
3189
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextArea$1, {
3190
+ placeholder: "\u6536\u8D27\u4EBA: xxx\u3000\u624B\u673A\u53F7\u7801: xxxxx\u3000\u6240\u5728\u5730\u533A: xx\u7701xx\u5E02xx\u533A\u3000\u8BE6\u7EC6\u5730\u5740: xxx",
3191
+ rows: 5,
3192
+ value: value,
3193
+ onChange: function onChange(e) {
3194
+ return setValue(e.target.value);
3195
+ }
3196
+ }), /*#__PURE__*/React.createElement(Button, {
3197
+ size: "small",
3198
+ type: "primary",
3199
+ onClick: handleIdentify
3200
+ }, "\u667A\u80FD\u8BC6\u522B"), /*#__PURE__*/React.createElement(Button, {
3201
+ size: "small",
3202
+ onClick: function onClick() {
3203
+ return setValue('');
3204
+ }
3205
+ }, "\u6E05\u7A7A"));
3206
+ };
3207
+
3055
3208
  var Item = Form.Item;
3056
3209
  var LogisticsInterception = function LogisticsInterception(props) {
3057
3210
  var _props$value = props.value,
@@ -3085,6 +3238,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3085
3238
  setIsInterface = _useState8[1];
3086
3239
  var firstIn = useRef(true);
3087
3240
  useEffect(function () {
3241
+ AddressData.getInstance();
3088
3242
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3089
3243
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3090
3244
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3113,14 +3267,25 @@ var LogisticsInterception = function LogisticsInterception(props) {
3113
3267
  var _item$config;
3114
3268
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType) && (item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.showAddress);
3115
3269
  });
3270
+ var showSender = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).some(function (item) {
3271
+ var _item$config2;
3272
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType) && (item === null || item === void 0 ? void 0 : (_item$config2 = item.config) === null || _item$config2 === void 0 ? void 0 : _item$config2.showSenderMobile);
3273
+ });
3274
+ var params = _objectSpread2({}, value);
3116
3275
  if (!showAddress) {
3117
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3276
+ params = _objectSpread2(_objectSpread2({}, params), {}, {
3118
3277
  interceptAddress: [],
3119
3278
  interceptDetail: '',
3120
3279
  interceptReceiverName: '',
3121
3280
  interceptReceiverMobile: ''
3122
- }));
3281
+ });
3282
+ }
3283
+ if (!showSender) {
3284
+ params = _objectSpread2(_objectSpread2({}, params), {}, {
3285
+ interceptSenderMobile: undefined
3286
+ });
3123
3287
  }
3288
+ onChange === null || onChange === void 0 ? void 0 : onChange(params);
3124
3289
  }, [value === null || value === void 0 ? void 0 : value.interceptType]);
3125
3290
  //是否展示新地址
3126
3291
  var showNewAddress = useMemo(function () {
@@ -3129,6 +3294,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
3129
3294
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3130
3295
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3131
3296
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3297
+ //是否展示发件人手机号
3298
+ var showSenderMobile = useMemo(function () {
3299
+ var _find2, _find2$config;
3300
+ return (_find2 = (typeOptions || []).find(function (item) {
3301
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3302
+ })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showSenderMobile;
3303
+ }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3132
3304
  //判断是否能修改物流信息
3133
3305
  var canEdit = useMemo(function () {
3134
3306
  var company = expressInterceptData.find(function (item) {
@@ -3143,12 +3315,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
3143
3315
  return item.value === val;
3144
3316
  });
3145
3317
  var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3146
- var _item$config2;
3147
- return item === null || item === void 0 ? void 0 : (_item$config2 = item.config) === null || _item$config2 === void 0 ? void 0 : _item$config2.isDefault;
3318
+ var _item$config3;
3319
+ return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3148
3320
  });
3149
3321
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3150
3322
  interceptCompany: val,
3151
3323
  interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3324
+ interceptSenderMobile: undefined,
3152
3325
  interceptAddress: [],
3153
3326
  interceptDetail: undefined,
3154
3327
  interceptReceiverName: undefined,
@@ -3159,6 +3332,17 @@ var LogisticsInterception = function LogisticsInterception(props) {
3159
3332
  }
3160
3333
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3161
3334
  };
3335
+ var handleParseLogistics = function handleParseLogistics(val) {
3336
+ var params = _objectSpread2(_objectSpread2({}, value), {}, {
3337
+ interceptDetail: val === null || val === void 0 ? void 0 : val.address,
3338
+ interceptReceiverName: val === null || val === void 0 ? void 0 : val.name,
3339
+ interceptReceiverMobile: val === null || val === void 0 ? void 0 : val.phone
3340
+ });
3341
+ if (val === null || val === void 0 ? void 0 : val.province) {
3342
+ 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)];
3343
+ }
3344
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3345
+ };
3162
3346
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Item, {
3163
3347
  label: '物流信息',
3164
3348
  required: required,
@@ -3204,12 +3388,26 @@ var LogisticsInterception = function LogisticsInterception(props) {
3204
3388
  filterOption: function filterOption(input, option) {
3205
3389
  return option.label.includes(input);
3206
3390
  }
3391
+ })), /*#__PURE__*/React.createElement(Item, {
3392
+ label: '发件人手机号',
3393
+ required: true,
3394
+ key: 'interceptSenderMobile',
3395
+ hidden: !showSenderMobile
3396
+ }, /*#__PURE__*/React.createElement(Input, {
3397
+ value: value === null || value === void 0 ? void 0 : value.interceptSenderMobile,
3398
+ disabled: disabled || canEdit,
3399
+ placeholder: "\u53D1\u4EF6\u4EBA\u624B\u673A\u53F7",
3400
+ onChange: function onChange(e) {
3401
+ return changeHandle(e.target.value, 'interceptSenderMobile');
3402
+ }
3207
3403
  })), /*#__PURE__*/React.createElement(Item, {
3208
3404
  label: '派送地址',
3209
3405
  required: true,
3210
3406
  key: 'newAddress',
3211
3407
  hidden: !showNewAddress
3212
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Province, {
3408
+ }, /*#__PURE__*/React.createElement(ParseLogistics, {
3409
+ onChange: handleParseLogistics
3410
+ }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Province, {
3213
3411
  value: value === null || value === void 0 ? void 0 : value.interceptAddress,
3214
3412
  onChange: function onChange(val) {
3215
3413
  return changeHandle(val, 'interceptAddress');
package/dist/index.js CHANGED
@@ -364,6 +364,53 @@ function _regeneratorRuntime() {
364
364
  }
365
365
  }, exports;
366
366
  }
367
+ function _wrapRegExp() {
368
+ _wrapRegExp = function (re, groups) {
369
+ return new BabelRegExp(re, void 0, groups);
370
+ };
371
+ var _super = RegExp.prototype,
372
+ _groups = new WeakMap();
373
+ function BabelRegExp(re, flags, groups) {
374
+ var _this = new RegExp(re, flags);
375
+ return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
376
+ }
377
+ function buildGroups(result, re) {
378
+ var g = _groups.get(re);
379
+ return Object.keys(g).reduce(function (groups, name) {
380
+ var i = g[name];
381
+ if ("number" == typeof i) groups[name] = result[i];else {
382
+ for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
383
+ groups[name] = result[i[k]];
384
+ }
385
+ return groups;
386
+ }, Object.create(null));
387
+ }
388
+ return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
389
+ var result = _super.exec.call(this, str);
390
+ if (result) {
391
+ result.groups = buildGroups(result, this);
392
+ var indices = result.indices;
393
+ indices && (indices.groups = buildGroups(indices, this));
394
+ }
395
+ return result;
396
+ }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
397
+ if ("string" == typeof substitution) {
398
+ var groups = _groups.get(this);
399
+ return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
400
+ var group = groups[name];
401
+ return "$" + (Array.isArray(group) ? group.join("$") : group);
402
+ }));
403
+ }
404
+ if ("function" == typeof substitution) {
405
+ var _this = this;
406
+ return _super[Symbol.replace].call(this, str, function () {
407
+ var args = arguments;
408
+ return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
409
+ });
410
+ }
411
+ return _super[Symbol.replace].call(this, str, substitution);
412
+ }, _wrapRegExp.apply(this, arguments);
413
+ }
367
414
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
368
415
  try {
369
416
  var info = gen[key](arg);
@@ -408,6 +455,29 @@ function _defineProperty(obj, key, value) {
408
455
  }
409
456
  return obj;
410
457
  }
458
+ function _inherits(subClass, superClass) {
459
+ if (typeof superClass !== "function" && superClass !== null) {
460
+ throw new TypeError("Super expression must either be null or a function");
461
+ }
462
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
463
+ constructor: {
464
+ value: subClass,
465
+ writable: true,
466
+ configurable: true
467
+ }
468
+ });
469
+ Object.defineProperty(subClass, "prototype", {
470
+ writable: false
471
+ });
472
+ if (superClass) _setPrototypeOf(subClass, superClass);
473
+ }
474
+ function _setPrototypeOf(o, p) {
475
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
476
+ o.__proto__ = p;
477
+ return o;
478
+ };
479
+ return _setPrototypeOf(o, p);
480
+ }
411
481
  function _objectWithoutPropertiesLoose(source, excluded) {
412
482
  if (source == null) return {};
413
483
  var target = {};
@@ -3062,6 +3132,89 @@ var Payment = function Payment(props) {
3062
3132
  }));
3063
3133
  };
3064
3134
 
3135
+ var TextArea$1 = antd.Input.TextArea;
3136
+ var ParseLogistics = function ParseLogistics(props) {
3137
+ var onChange = props.onChange;
3138
+ var _useState = React.useState(''),
3139
+ _useState2 = _slicedToArray(_useState, 2),
3140
+ value = _useState2[0],
3141
+ setValue = _useState2[1];
3142
+ var handleIdentify = function handleIdentify() {
3143
+ var data = parseLogisticsInfo(value);
3144
+ // console.log(data);
3145
+ onChange === null || onChange === void 0 ? void 0 : onChange(data);
3146
+ };
3147
+ var parseLogisticsInfo = function parseLogisticsInfo(str) {
3148
+ var info = {};
3149
+ var regex1 = /*#__PURE__*/_wrapRegExp(/^([^省]+\u7701)?([^市]+\u5E02)?([^区]+\u533A)?(.*)?\s*\u59D3\u540D[:|:](.+)?\s*\u7535\u8BDD[:|:](.+)/, {
3150
+ province: 1,
3151
+ city: 2,
3152
+ district: 3,
3153
+ address: 4,
3154
+ name: 5,
3155
+ phone: 6
3156
+ });
3157
+ var regex2 = /*#__PURE__*/_wrapRegExp(/^\u6536\u8D27\u4EBA[:|:]\s*([^,]+),?\s*\u624B\u673A\u53F7\u7801[:|:]\s*([^,]+),?\s*\u6240\u5728\u5730\u533A[:|:]\s*([^省]+\u7701)?([^市]+\u5E02)?([^区]+\u533A)?(.+)/, {
3158
+ name: 1,
3159
+ phone: 2,
3160
+ province: 3,
3161
+ city: 4,
3162
+ district: 5,
3163
+ address: 6
3164
+ });
3165
+ var match1 = str.match(regex1);
3166
+ if (match1) {
3167
+ var _match1$groups, _match1$groups$provin, _match1$groups2, _match1$groups2$city, _match1$groups3, _match1$groups3$distr, _match1$groups4, _match1$groups4$addre, _match1$groups5, _match1$groups5$name, _match1$groups6, _match1$groups6$phone;
3168
+ info.province = ((_match1$groups = match1.groups) === null || _match1$groups === void 0 ? void 0 : (_match1$groups$provin = _match1$groups.province) === null || _match1$groups$provin === void 0 ? void 0 : _match1$groups$provin.trim()) || '';
3169
+ info.city = ((_match1$groups2 = match1.groups) === null || _match1$groups2 === void 0 ? void 0 : (_match1$groups2$city = _match1$groups2.city) === null || _match1$groups2$city === void 0 ? void 0 : _match1$groups2$city.trim()) || '';
3170
+ info.district = ((_match1$groups3 = match1.groups) === null || _match1$groups3 === void 0 ? void 0 : (_match1$groups3$distr = _match1$groups3.district) === null || _match1$groups3$distr === void 0 ? void 0 : _match1$groups3$distr.trim()) || '';
3171
+ info.address = ((_match1$groups4 = match1.groups) === null || _match1$groups4 === void 0 ? void 0 : (_match1$groups4$addre = _match1$groups4.address) === null || _match1$groups4$addre === void 0 ? void 0 : _match1$groups4$addre.trim()) || '';
3172
+ info.name = ((_match1$groups5 = match1.groups) === null || _match1$groups5 === void 0 ? void 0 : (_match1$groups5$name = _match1$groups5.name) === null || _match1$groups5$name === void 0 ? void 0 : _match1$groups5$name.trim()) || '';
3173
+ info.phone = ((_match1$groups6 = match1.groups) === null || _match1$groups6 === void 0 ? void 0 : (_match1$groups6$phone = _match1$groups6.phone) === null || _match1$groups6$phone === void 0 ? void 0 : _match1$groups6$phone.trim()) || '';
3174
+ return info;
3175
+ }
3176
+ var match2 = str.match(regex2);
3177
+ if (match2) {
3178
+ var _match2$groups, _match2$groups$provin, _match2$groups2, _match2$groups2$city, _match2$groups3, _match2$groups3$distr, _match2$groups4, _match2$groups4$addre, _match2$groups5, _match2$groups5$name, _match2$groups6, _match2$groups6$phone;
3179
+ info.province = ((_match2$groups = match2.groups) === null || _match2$groups === void 0 ? void 0 : (_match2$groups$provin = _match2$groups.province) === null || _match2$groups$provin === void 0 ? void 0 : _match2$groups$provin.trim()) || '';
3180
+ info.city = ((_match2$groups2 = match2.groups) === null || _match2$groups2 === void 0 ? void 0 : (_match2$groups2$city = _match2$groups2.city) === null || _match2$groups2$city === void 0 ? void 0 : _match2$groups2$city.trim()) || '';
3181
+ info.district = ((_match2$groups3 = match2.groups) === null || _match2$groups3 === void 0 ? void 0 : (_match2$groups3$distr = _match2$groups3.district) === null || _match2$groups3$distr === void 0 ? void 0 : _match2$groups3$distr.trim()) || '';
3182
+ info.address = ((_match2$groups4 = match2.groups) === null || _match2$groups4 === void 0 ? void 0 : (_match2$groups4$addre = _match2$groups4.address) === null || _match2$groups4$addre === void 0 ? void 0 : _match2$groups4$addre.trim()) || '';
3183
+ info.name = ((_match2$groups5 = match2.groups) === null || _match2$groups5 === void 0 ? void 0 : (_match2$groups5$name = _match2$groups5.name) === null || _match2$groups5$name === void 0 ? void 0 : _match2$groups5$name.trim()) || '';
3184
+ info.phone = ((_match2$groups6 = match2.groups) === null || _match2$groups6 === void 0 ? void 0 : (_match2$groups6$phone = _match2$groups6.phone) === null || _match2$groups6$phone === void 0 ? void 0 : _match2$groups6$phone.trim()) || '';
3185
+ return info;
3186
+ }
3187
+ // const match3 = str.match(regex3);
3188
+ // if (match3) {
3189
+ // info.province = match3.groups?.province?.trim() || '';
3190
+ // info.city = match3.groups?.city?.trim() || '';
3191
+ // info.district = match3.groups?.district?.trim() || '';
3192
+ // info.address = match3.groups?.address?.trim() || '';
3193
+ // info.name = match3.groups?.name?.trim() || '';
3194
+ // info.phone = match3.groups?.phone?.trim() || '';
3195
+ // return info;
3196
+ // }
3197
+ return info;
3198
+ };
3199
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(TextArea$1, {
3200
+ placeholder: "\u6536\u8D27\u4EBA: xxx\u3000\u624B\u673A\u53F7\u7801: xxxxx\u3000\u6240\u5728\u5730\u533A: xx\u7701xx\u5E02xx\u533A\u3000\u8BE6\u7EC6\u5730\u5740: xxx",
3201
+ rows: 5,
3202
+ value: value,
3203
+ onChange: function onChange(e) {
3204
+ return setValue(e.target.value);
3205
+ }
3206
+ }), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
3207
+ size: "small",
3208
+ type: "primary",
3209
+ onClick: handleIdentify
3210
+ }, "\u667A\u80FD\u8BC6\u522B"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
3211
+ size: "small",
3212
+ onClick: function onClick() {
3213
+ return setValue('');
3214
+ }
3215
+ }, "\u6E05\u7A7A"));
3216
+ };
3217
+
3065
3218
  var Item = antd.Form.Item;
3066
3219
  var LogisticsInterception = function LogisticsInterception(props) {
3067
3220
  var _props$value = props.value,
@@ -3095,6 +3248,7 @@ var LogisticsInterception = function LogisticsInterception(props) {
3095
3248
  setIsInterface = _useState8[1];
3096
3249
  var firstIn = React.useRef(true);
3097
3250
  React.useEffect(function () {
3251
+ kmkfUtils.AddressData.getInstance();
3098
3252
  //存入第一次的物流地址,防止非对接物流切换成对接物流后无法编辑
3099
3253
  if (firstIn.current && JSON.stringify(value) !== '{}') {
3100
3254
  setInitCompany(value === null || value === void 0 ? void 0 : value.interceptCompany);
@@ -3123,14 +3277,25 @@ var LogisticsInterception = function LogisticsInterception(props) {
3123
3277
  var _item$config;
3124
3278
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType) && (item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.showAddress);
3125
3279
  });
3280
+ var showSender = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).some(function (item) {
3281
+ var _item$config2;
3282
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType) && (item === null || item === void 0 ? void 0 : (_item$config2 = item.config) === null || _item$config2 === void 0 ? void 0 : _item$config2.showSenderMobile);
3283
+ });
3284
+ var params = _objectSpread2({}, value);
3126
3285
  if (!showAddress) {
3127
- onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
3286
+ params = _objectSpread2(_objectSpread2({}, params), {}, {
3128
3287
  interceptAddress: [],
3129
3288
  interceptDetail: '',
3130
3289
  interceptReceiverName: '',
3131
3290
  interceptReceiverMobile: ''
3132
- }));
3291
+ });
3292
+ }
3293
+ if (!showSender) {
3294
+ params = _objectSpread2(_objectSpread2({}, params), {}, {
3295
+ interceptSenderMobile: undefined
3296
+ });
3133
3297
  }
3298
+ onChange === null || onChange === void 0 ? void 0 : onChange(params);
3134
3299
  }, [value === null || value === void 0 ? void 0 : value.interceptType]);
3135
3300
  //是否展示新地址
3136
3301
  var showNewAddress = React.useMemo(function () {
@@ -3139,6 +3304,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
3139
3304
  return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3140
3305
  })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
3141
3306
  }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3307
+ //是否展示发件人手机号
3308
+ var showSenderMobile = React.useMemo(function () {
3309
+ var _find2, _find2$config;
3310
+ return (_find2 = (typeOptions || []).find(function (item) {
3311
+ return item.value === (value === null || value === void 0 ? void 0 : value.interceptType);
3312
+ })) === null || _find2 === void 0 ? void 0 : (_find2$config = _find2.config) === null || _find2$config === void 0 ? void 0 : _find2$config.showSenderMobile;
3313
+ }, [value === null || value === void 0 ? void 0 : value.interceptType, typeOptions, value === null || value === void 0 ? void 0 : value.interceptCompany]);
3142
3314
  //判断是否能修改物流信息
3143
3315
  var canEdit = React.useMemo(function () {
3144
3316
  var company = expressInterceptData.find(function (item) {
@@ -3153,12 +3325,13 @@ var LogisticsInterception = function LogisticsInterception(props) {
3153
3325
  return item.value === val;
3154
3326
  });
3155
3327
  var returnValue = ((interceptCompany === null || interceptCompany === void 0 ? void 0 : interceptCompany.interceptionTypeList) || []).find(function (item) {
3156
- var _item$config2;
3157
- return item === null || item === void 0 ? void 0 : (_item$config2 = item.config) === null || _item$config2 === void 0 ? void 0 : _item$config2.isDefault;
3328
+ var _item$config3;
3329
+ return item === null || item === void 0 ? void 0 : (_item$config3 = item.config) === null || _item$config3 === void 0 ? void 0 : _item$config3.isDefault;
3158
3330
  });
3159
3331
  newValue = _objectSpread2(_objectSpread2({}, value), {}, {
3160
3332
  interceptCompany: val,
3161
3333
  interceptType: returnValue === null || returnValue === void 0 ? void 0 : returnValue.value,
3334
+ interceptSenderMobile: undefined,
3162
3335
  interceptAddress: [],
3163
3336
  interceptDetail: undefined,
3164
3337
  interceptReceiverName: undefined,
@@ -3169,6 +3342,17 @@ var LogisticsInterception = function LogisticsInterception(props) {
3169
3342
  }
3170
3343
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
3171
3344
  };
3345
+ var handleParseLogistics = function handleParseLogistics(val) {
3346
+ var params = _objectSpread2(_objectSpread2({}, value), {}, {
3347
+ interceptDetail: val === null || val === void 0 ? void 0 : val.address,
3348
+ interceptReceiverName: val === null || val === void 0 ? void 0 : val.name,
3349
+ interceptReceiverMobile: val === null || val === void 0 ? void 0 : val.phone
3350
+ });
3351
+ if (val === null || val === void 0 ? void 0 : val.province) {
3352
+ 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)];
3353
+ }
3354
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, params));
3355
+ };
3172
3356
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Item, {
3173
3357
  label: '物流信息',
3174
3358
  required: required,
@@ -3214,12 +3398,26 @@ var LogisticsInterception = function LogisticsInterception(props) {
3214
3398
  filterOption: function filterOption(input, option) {
3215
3399
  return option.label.includes(input);
3216
3400
  }
3401
+ })), /*#__PURE__*/React__default['default'].createElement(Item, {
3402
+ label: '发件人手机号',
3403
+ required: true,
3404
+ key: 'interceptSenderMobile',
3405
+ hidden: !showSenderMobile
3406
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
3407
+ value: value === null || value === void 0 ? void 0 : value.interceptSenderMobile,
3408
+ disabled: disabled || canEdit,
3409
+ placeholder: "\u53D1\u4EF6\u4EBA\u624B\u673A\u53F7",
3410
+ onChange: function onChange(e) {
3411
+ return changeHandle(e.target.value, 'interceptSenderMobile');
3412
+ }
3217
3413
  })), /*#__PURE__*/React__default['default'].createElement(Item, {
3218
3414
  label: '派送地址',
3219
3415
  required: true,
3220
3416
  key: 'newAddress',
3221
3417
  hidden: !showNewAddress
3222
- }, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(Province, {
3418
+ }, /*#__PURE__*/React__default['default'].createElement(ParseLogistics, {
3419
+ onChange: handleParseLogistics
3420
+ }), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(Province, {
3223
3421
  value: value === null || value === void 0 ? void 0 : value.interceptAddress,
3224
3422
  onChange: function onChange(val) {
3225
3423
  return changeHandle(val, 'interceptAddress');
@@ -3,6 +3,7 @@ interface LogisticsInterceptionValueType {
3
3
  interceptCompany: string;
4
4
  interceptCode: string;
5
5
  interceptType: string;
6
+ interceptSenderMobile: string;
6
7
  interceptAddress: any[];
7
8
  interceptDetail: string;
8
9
  interceptReceiverName: string;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface ParseLogisticsProps {
3
+ onChange: (value: any) => void;
4
+ }
5
+ declare const ParseLogistics: (props: ParseLogisticsProps) => React.JSX.Element;
6
+ export default ParseLogistics;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.6.3-alpha.54",
3
+ "version": "0.6.3-alpha.57",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "test": "jest"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.6.3-alpha.54",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.6.3-alpha.56",
24
24
  "umi-request": "^1.4.0"
25
25
  },
26
26
  "devDependencies": {
@@ -51,5 +51,5 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "gitHead": "3374d90f3a3b8aa18e8d60390b8e95263ae3d967"
54
+ "gitHead": "2dfaa8121ffa8cd0eeb41be266c0587a0e4e8b38"
55
55
  }