@kmkf-fe-packages/kmkf-utils 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/esm/expressInterceptData/index.d.ts +2 -0
- package/dist/esm/expressInterceptData/index.js +15 -2
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/logisticsAddressData/index.d.ts +31 -0
- package/dist/esm/logisticsAddressData/index.js +93 -0
- package/package.json +2 -2
|
@@ -13,6 +13,7 @@ export default class ExpressInterceptData {
|
|
|
13
13
|
showInterceptionMap: any;
|
|
14
14
|
showSenderMobileMap: any;
|
|
15
15
|
showNewAddressMap: any;
|
|
16
|
+
showReturnAddressMap: any;
|
|
16
17
|
typeNameMap: any;
|
|
17
18
|
statusNameMap: any;
|
|
18
19
|
typeOptions: {
|
|
@@ -30,6 +31,7 @@ export default class ExpressInterceptData {
|
|
|
30
31
|
getTypeNameMap(): any;
|
|
31
32
|
getStatusNameMap(): any;
|
|
32
33
|
getShowNewAddressMap(): any;
|
|
34
|
+
getShowReturnAddressMap(): any;
|
|
33
35
|
getShowSenderMobileMap(): any;
|
|
34
36
|
getTypeOptions(): {
|
|
35
37
|
label: string;
|
|
@@ -18,6 +18,7 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
18
18
|
//展示拦截按钮映射
|
|
19
19
|
//展示发件人手机号映射
|
|
20
20
|
//展示派送地址映射
|
|
21
|
+
//退回诶之显示映射
|
|
21
22
|
//拦截类型映射
|
|
22
23
|
//物流状态映射
|
|
23
24
|
//拦截类型筛选options
|
|
@@ -29,6 +30,7 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
29
30
|
_defineProperty(this, "showInterceptionMap", null);
|
|
30
31
|
_defineProperty(this, "showSenderMobileMap", {});
|
|
31
32
|
_defineProperty(this, "showNewAddressMap", {});
|
|
33
|
+
_defineProperty(this, "showReturnAddressMap", {});
|
|
32
34
|
_defineProperty(this, "typeNameMap", null);
|
|
33
35
|
_defineProperty(this, "statusNameMap", null);
|
|
34
36
|
_defineProperty(this, "typeOptions", []);
|
|
@@ -53,6 +55,7 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
53
55
|
var showBtn = {},
|
|
54
56
|
showSender = {},
|
|
55
57
|
showAddress = {},
|
|
58
|
+
showReturnAddress = {},
|
|
56
59
|
typeMap = {},
|
|
57
60
|
statusMap = {},
|
|
58
61
|
typeObj = {},
|
|
@@ -75,7 +78,7 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
75
78
|
}
|
|
76
79
|
if (item !== null && item !== void 0 && (_item$interceptionTyp = item.interceptionTypeList) !== null && _item$interceptionTyp !== void 0 && _item$interceptionTyp.length) {
|
|
77
80
|
item.interceptionTypeList.forEach(function (t) {
|
|
78
|
-
var _t$config, _t$config2;
|
|
81
|
+
var _t$config, _t$config2, _t$config3;
|
|
79
82
|
typeMap["".concat(t.value)] = t.label;
|
|
80
83
|
if (typeObj[t.label]) {
|
|
81
84
|
typeObj[t.label] = typeObj[t.label].add(t.value);
|
|
@@ -85,7 +88,10 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
85
88
|
if (t !== null && t !== void 0 && (_t$config = t.config) !== null && _t$config !== void 0 && _t$config.showAddress) {
|
|
86
89
|
showAddress["".concat(t.value)] = true;
|
|
87
90
|
}
|
|
88
|
-
if (t !== null && t !== void 0 && (_t$config2 = t.config) !== null && _t$config2 !== void 0 && _t$config2.
|
|
91
|
+
if (t !== null && t !== void 0 && (_t$config2 = t.config) !== null && _t$config2 !== void 0 && _t$config2.showAddressSelect) {
|
|
92
|
+
showReturnAddress["".concat(t.value)] = true;
|
|
93
|
+
}
|
|
94
|
+
if (t !== null && t !== void 0 && (_t$config3 = t.config) !== null && _t$config3 !== void 0 && _t$config3.showSenderMobile) {
|
|
89
95
|
showSender["".concat(t.value)] = true;
|
|
90
96
|
}
|
|
91
97
|
});
|
|
@@ -95,6 +101,7 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
95
101
|
_this.typeNameMap = typeMap;
|
|
96
102
|
_this.statusNameMap = statusMap;
|
|
97
103
|
_this.showNewAddressMap = showAddress;
|
|
104
|
+
_this.showReturnAddressMap = showReturnAddress;
|
|
98
105
|
_this.showSenderMobileMap = showSender;
|
|
99
106
|
_this.typeOptions = Object.keys(typeObj).map(function (key) {
|
|
100
107
|
return {
|
|
@@ -153,6 +160,12 @@ var ExpressInterceptData = /*#__PURE__*/function () {
|
|
|
153
160
|
value: function getShowNewAddressMap() {
|
|
154
161
|
return this.showNewAddressMap;
|
|
155
162
|
}
|
|
163
|
+
//获取退回地址展示映射
|
|
164
|
+
}, {
|
|
165
|
+
key: "getShowReturnAddressMap",
|
|
166
|
+
value: function getShowReturnAddressMap() {
|
|
167
|
+
return this.showReturnAddressMap;
|
|
168
|
+
}
|
|
156
169
|
//获取发件人手机号展示映射
|
|
157
170
|
}, {
|
|
158
171
|
key: "getShowSenderMobileMap",
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ export { default as ExpressData } from "./expressData";
|
|
|
2
2
|
export { default as ExpressInterceptData } from "./expressInterceptData";
|
|
3
3
|
export { default as AddressData } from "./addressData";
|
|
4
4
|
export { default as PlatData } from "./platData";
|
|
5
|
+
export { default as LogisticsAddressData } from "./logisticsAddressData";
|
|
5
6
|
export { default as request } from "./request";
|
|
6
7
|
export * from "./utils";
|
package/dist/esm/index.js
CHANGED
|
@@ -2,5 +2,6 @@ export { default as ExpressData } from "./expressData";
|
|
|
2
2
|
export { default as ExpressInterceptData } from "./expressInterceptData";
|
|
3
3
|
export { default as AddressData } from "./addressData";
|
|
4
4
|
export { default as PlatData } from "./platData";
|
|
5
|
+
export { default as LogisticsAddressData } from "./logisticsAddressData";
|
|
5
6
|
export { default as request } from "./request";
|
|
6
7
|
export * from "./utils";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
interface OptionsItem {
|
|
2
|
+
cpCode: string;
|
|
3
|
+
uk: string;
|
|
4
|
+
province: string;
|
|
5
|
+
city: string;
|
|
6
|
+
district: string;
|
|
7
|
+
detail: string;
|
|
8
|
+
userName: string;
|
|
9
|
+
mobile: string;
|
|
10
|
+
}
|
|
11
|
+
export default class logisticsAddressData {
|
|
12
|
+
private static instance;
|
|
13
|
+
addressData: OptionsItem[];
|
|
14
|
+
constructor();
|
|
15
|
+
initData: () => OptionsItem[] | undefined;
|
|
16
|
+
getAddressData: () => OptionsItem[] | undefined;
|
|
17
|
+
setaddressData: (val: OptionsItem[]) => OptionsItem[];
|
|
18
|
+
getItemByUk: (uk: string) => OptionsItem | undefined;
|
|
19
|
+
getCpListByCompany(company: string): OptionsItem[];
|
|
20
|
+
getUkByInfo({ cpCode, province, city, district, detail, userName, mobile, }: {
|
|
21
|
+
cpCode: string;
|
|
22
|
+
province: string | number;
|
|
23
|
+
city: string | number;
|
|
24
|
+
district: string | number;
|
|
25
|
+
detail: string;
|
|
26
|
+
userName: string;
|
|
27
|
+
mobile: string;
|
|
28
|
+
}): string;
|
|
29
|
+
static getInstance(): logisticsAddressData;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import request from "../request";
|
|
9
|
+
import address from "../addressData";
|
|
10
|
+
var Address = address.getInstance();
|
|
11
|
+
var logisticsAddressData = /*#__PURE__*/function () {
|
|
12
|
+
function logisticsAddressData() {
|
|
13
|
+
var _this = this;
|
|
14
|
+
_classCallCheck(this, logisticsAddressData);
|
|
15
|
+
_defineProperty(this, "addressData", []);
|
|
16
|
+
_defineProperty(this, "initData", function () {
|
|
17
|
+
if (_this.addressData.length > 0) return _this.addressData;
|
|
18
|
+
request({
|
|
19
|
+
url: "/qy/userConfig/listLogisticsAddress",
|
|
20
|
+
method: "post",
|
|
21
|
+
data: {}
|
|
22
|
+
}).then(function (res) {
|
|
23
|
+
var data = res.data;
|
|
24
|
+
// setTimeout(() => {
|
|
25
|
+
// const addressList = data.map((item: OptionsItem) => {
|
|
26
|
+
// return {
|
|
27
|
+
// ...item,
|
|
28
|
+
// label: `${Address.getNameByCode(item?.province) || ""}${
|
|
29
|
+
// Address.getNameByCode(item?.city) || ""
|
|
30
|
+
// }${Address.getNameByCode(item?.district) || ""}${item.detail} ${
|
|
31
|
+
// item?.userName
|
|
32
|
+
// }:${item?.mobile}`,
|
|
33
|
+
// value: item.uk,
|
|
34
|
+
// };
|
|
35
|
+
// });
|
|
36
|
+
|
|
37
|
+
// this.addressData = data;
|
|
38
|
+
// });
|
|
39
|
+
_this.addressData = data;
|
|
40
|
+
}).catch(function (e) {
|
|
41
|
+
console.log(e);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
_defineProperty(this, "getAddressData", function () {
|
|
45
|
+
var _this$addressData;
|
|
46
|
+
if (((_this$addressData = _this.addressData) === null || _this$addressData === void 0 ? void 0 : _this$addressData.length) > 0) return _this.addressData;
|
|
47
|
+
_this.initData();
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(this, "setaddressData", function (val) {
|
|
50
|
+
return _this.addressData = val;
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(this, "getItemByUk", function (uk) {
|
|
53
|
+
return (_this.addressData || []).find(function (item) {
|
|
54
|
+
return item.uk === uk;
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
this.initData();
|
|
58
|
+
}
|
|
59
|
+
_createClass(logisticsAddressData, [{
|
|
60
|
+
key: "getCpListByCompany",
|
|
61
|
+
value: function getCpListByCompany(company) {
|
|
62
|
+
return (this.addressData || []).filter(function (item) {
|
|
63
|
+
return item.cpCode === company;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
key: "getUkByInfo",
|
|
68
|
+
value: function getUkByInfo(_ref) {
|
|
69
|
+
var _find;
|
|
70
|
+
var cpCode = _ref.cpCode,
|
|
71
|
+
province = _ref.province,
|
|
72
|
+
city = _ref.city,
|
|
73
|
+
district = _ref.district,
|
|
74
|
+
detail = _ref.detail,
|
|
75
|
+
userName = _ref.userName,
|
|
76
|
+
mobile = _ref.mobile;
|
|
77
|
+
return ((_find = (this.addressData || []).find(function (item) {
|
|
78
|
+
return item.cpCode == cpCode && item.province == province && item.city == city && item.district == district && item.detail == detail && item.userName == userName && item.mobile == mobile;
|
|
79
|
+
})) === null || _find === void 0 ? void 0 : _find.uk) || "";
|
|
80
|
+
}
|
|
81
|
+
}], [{
|
|
82
|
+
key: "getInstance",
|
|
83
|
+
value: function getInstance() {
|
|
84
|
+
if (!logisticsAddressData.instance) {
|
|
85
|
+
logisticsAddressData.instance = new logisticsAddressData();
|
|
86
|
+
}
|
|
87
|
+
return logisticsAddressData.instance;
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
return logisticsAddressData;
|
|
91
|
+
}();
|
|
92
|
+
_defineProperty(logisticsAddressData, "instance", void 0);
|
|
93
|
+
export { logisticsAddressData as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-utils",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1-alpha.1",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"gitHooks": {
|
|
43
43
|
"pre-commit": "lint-staged"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "aa47b4aa4ce5e954a1312a4f0091daeb88b38336"
|
|
46
46
|
}
|