@kmkf-fe-packages/kmkf-utils 0.8.17-alpha.9 → 0.8.17

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/README.md CHANGED
@@ -0,0 +1 @@
1
+
@@ -1,2 +1,45 @@
1
- declare const _default: (detail?: any, templateDetail?: any) => any;
2
- export default _default;
1
+ export declare const bsOrderBackFormValues: (detail?: any, templateDetail?: any) => any;
2
+ export declare const bsOrderTransform: (detail: any) => {
3
+ bsSystemOrder: {
4
+ orderNo: any;
5
+ orders: any;
6
+ selectIds: any;
7
+ showOrderInfo: any;
8
+ };
9
+ bsSingingTime: any;
10
+ bsSendTime: any;
11
+ bsTradePaymentTime: any;
12
+ bsDeposit: any;
13
+ bsNetReceipts: any;
14
+ bsPackageWeight: any;
15
+ bsGoods: {
16
+ shopCode: any;
17
+ bsGoods: any;
18
+ };
19
+ bsExchangeGoods: {
20
+ shopCode: any;
21
+ bsExchangeType: never[];
22
+ bsExchangeReturnGoods: never[];
23
+ bsExchangeSwapOutGoods: never[];
24
+ bsExchangeGiftGoods: never[];
25
+ };
26
+ bsReissueGoods: {
27
+ shopCode: any;
28
+ bsReissueType: never[];
29
+ bsReissueGoods: never[];
30
+ };
31
+ bsReturnGoods: {
32
+ shopCode: any;
33
+ bsReturnType: never[];
34
+ bsReturnGoods: never[];
35
+ };
36
+ bsLogistics: any;
37
+ bsSendGood: any;
38
+ bsDeliveryNo: any;
39
+ bsPosting: {
40
+ postingAddress: any[];
41
+ postingDetail: any;
42
+ postingReceiverName: any;
43
+ postingReceiverMobile: any;
44
+ };
45
+ };
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ import ExpressData from "../expressData";
7
8
  import uuid from "./getUUid";
8
9
  var updateBsGoodsHandle = function updateBsGoodsHandle() {
9
10
  var orders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -13,12 +14,14 @@ var updateBsGoodsHandle = function updateBsGoodsHandle() {
13
14
  code = item.code,
14
15
  name = item.name,
15
16
  skuCode = item.skuCode,
17
+ skuName = item.skuName,
16
18
  giftType = item.giftType,
17
19
  qty = item.qty,
18
20
  amountShareSettle = item.amountShareSettle,
19
21
  sharePrice = item.sharePrice;
20
22
  return {
21
23
  mark: "是",
24
+ skuName: skuName,
22
25
  pic: picPath,
23
26
  name: name,
24
27
  code: code,
@@ -45,8 +48,6 @@ var updateBsGoodsHandle = function updateBsGoodsHandle() {
45
48
  };
46
49
  var updateBsItemListHandle = function updateBsItemListHandle(list, type) {
47
50
  var _newList;
48
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
49
- var showField = config.showField;
50
51
  var newList = list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
51
52
  var items = (next.items || []).map(function (t) {
52
53
  return {
@@ -61,20 +62,11 @@ var updateBsItemListHandle = function updateBsItemListHandle(list, type) {
61
62
  items: items
62
63
  };
63
64
  if (type === "logistics") {
64
- if (["logisticsCompany", ""].includes(showField || "")) {
65
- console.log(item.logisticCompany, ExpressData.getInstance().getExpressCodeByName(item.logisticCompany));
66
- params.logisticsCompany = ExpressData.getInstance().getExpressCodeByName(item.logisticCompany);
67
- }
68
- if (["logisticsCode", ""].includes(showField || "")) {
69
- params.logisticsCode = item === null || item === void 0 ? void 0 : item.deliveryNo;
70
- }
65
+ params.logisticsCompany = ExpressData.getInstance().getExpressCodeByName(item.logisticCompany);
66
+ params.logisticsCode = item === null || item === void 0 ? void 0 : item.deliveryNo;
71
67
  } else if (type === "send") {
72
- if (["sendId", "all"].includes(showField || "")) {
73
- params.sendId = item.wareHouseRealCode;
74
- }
75
- if (["sendName", "all"].includes(showField || "")) {
76
- params.sendName = item.wareHouseRealName;
77
- }
68
+ params.sendId = item.wareHouseRealCode;
69
+ params.sendName = item.wareHouseRealName;
78
70
  }
79
71
  return params;
80
72
  });
@@ -104,102 +96,167 @@ var updateBsItemListHandle = function updateBsItemListHandle(list, type) {
104
96
  }
105
97
  return newList;
106
98
  };
107
- export default (function () {
108
- var _detail$orders, _detail$orders$, _detail$orders$$advan;
99
+ var updateBsSystemItemListHandle = function updateBsSystemItemListHandle(list, type) {
100
+ var _newList2;
101
+ var newList = list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
102
+ prv.push({
103
+ deliveryNo: next.wmsStockOutBillNo,
104
+ systemOrderId: next.billNo
105
+ });
106
+ return prv;
107
+ }, []);
108
+ if (!((_newList2 = newList) !== null && _newList2 !== void 0 && _newList2.length)) {
109
+ switch (type) {
110
+ case "delivery":
111
+ newList = [{
112
+ deliveryNo: "",
113
+ systemOrderId: ""
114
+ }];
115
+ break;
116
+ }
117
+ }
118
+ return newList;
119
+ };
120
+ var updateBsItemListByConfigHandle = function updateBsItemListByConfigHandle(list, type) {
121
+ var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
122
+ var showField = config.showField;
123
+ return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
124
+ if (type === "logistics") {
125
+ if (!["logisticsCompany", ""].includes(showField || "")) {
126
+ next.logisticsCompany = undefined;
127
+ }
128
+ if (!["logisticsCode", ""].includes(showField || "")) {
129
+ next.logisticsCode = undefined;
130
+ }
131
+ } else if (type === "send") {
132
+ if (!["sendId", "all"].includes(showField || "")) {
133
+ next.sendId = undefined;
134
+ }
135
+ if (!["sendName", "all"].includes(showField || "")) {
136
+ next.sendName = undefined;
137
+ }
138
+ }
139
+ prv.push(next);
140
+ return prv;
141
+ }, []);
142
+ };
143
+ export var bsOrderBackFormValues = function bsOrderBackFormValues() {
109
144
  var detail = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
110
145
  var templateDetail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
111
- console.log("bsOrderBackFormValues", detail);
112
- var advItem = (detail === null || detail === void 0 ? void 0 : (_detail$orders = detail.orders) === null || _detail$orders === void 0 ? void 0 : (_detail$orders$ = _detail$orders[0]) === null || _detail$orders$ === void 0 ? void 0 : (_detail$orders$$advan = _detail$orders$.advancedDistributionInfos) === null || _detail$orders$$advan === void 0 ? void 0 : _detail$orders$$advan[0]) || {};
113
- var weight = 0;
114
- var bsPostingAddress = [];
115
146
  return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
116
- var _ref, _detail$orders2, _detail$orders2$, _detail$orders2$$adva, _detail$orders2$$adva2;
117
147
  var uniqueKey = next.uniqueKey;
118
148
  var config = next.componentConfig;
119
149
  switch (next.workOrderComponentType) {
120
150
  case "BS_SYSTEM_ORDER":
121
- prv[uniqueKey] = {
122
- orderNo: detail === null || detail === void 0 ? void 0 : detail.sourceBillNo,
123
- orders: (detail === null || detail === void 0 ? void 0 : detail.systemOrders) || [],
124
- selectIds: [],
125
- showOrderInfo: (_ref = (detail === null || detail === void 0 ? void 0 : detail.systemOrders) || []) === null || _ref === void 0 ? void 0 : _ref.map(function (item) {
126
- return {
127
- billNo: item.billNo,
128
- billType: item.billType,
129
- billTag: item.billTag
130
- };
131
- })
132
- };
151
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsSystemOrder;
133
152
  break;
134
153
  case "BS_SIGNING_TIME":
135
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.receiptDate;
154
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsSingingTime;
136
155
  break;
137
156
  case "BS_SEND_TIME":
138
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : (_detail$orders2 = detail.orders) === null || _detail$orders2 === void 0 ? void 0 : (_detail$orders2$ = _detail$orders2[0]) === null || _detail$orders2$ === void 0 ? void 0 : (_detail$orders2$$adva = _detail$orders2$.advancedDistributionInfos) === null || _detail$orders2$$adva === void 0 ? void 0 : (_detail$orders2$$adva2 = _detail$orders2$$adva[0]) === null || _detail$orders2$$adva2 === void 0 ? void 0 : _detail$orders2$$adva2.deliveryDate;
157
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsSendTime;
139
158
  break;
140
159
  case "BS_TRADE_PAYMENT_TIME":
141
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.payDate;
160
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsTradePaymentTime;
142
161
  break;
143
162
  case "BS_DEPOSIT":
144
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.amountPaid;
163
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsDeposit;
145
164
  break;
146
165
  case "BS_NET_RECEIPTS":
147
- prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.merchantRealIncome;
166
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsNetReceipts;
148
167
  break;
149
168
  case "BS_PACKAGE_WEIGHT":
150
- weight = ((detail === null || detail === void 0 ? void 0 : detail.orders) || []).reduce(function (prv, next) {
151
- var number = ((next === null || next === void 0 ? void 0 : next.advancedDistributionInfos) || []).reduce(function (p, n) {
152
- p += n.orderWeight || 0;
153
- return p;
154
- }, 0);
155
- prv += number || 0;
156
- return prv;
157
- }, 0);
158
- prv[uniqueKey] = weight || null;
169
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsPackageWeight;
159
170
  break;
160
171
  case "BS_GOODS":
161
- prv[uniqueKey] = {
162
- shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
163
- bsGoods: updateBsGoodsHandle(detail === null || detail === void 0 ? void 0 : detail.orders)
164
- };
172
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsGoods;
165
173
  break;
166
174
  case "BS_EXCHANGE_GOODS":
167
- prv[uniqueKey] = {
168
- shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
169
- bsExchangeType: [],
170
- bsExchangeReturnGoods: [],
171
- bsExchangeSwapOutGoods: [],
172
- bsExchangeGiftGoods: []
173
- };
175
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsExchangeGoods;
174
176
  break;
175
177
  case "BS_REISSUE_GOODS":
176
- prv[uniqueKey] = {
177
- shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
178
- bsReissueType: [],
179
- bsReissueGoods: []
180
- };
178
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsReissueGoods;
179
+ break;
180
+ case "BS_RETURN_GOODS":
181
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsReturnGoods;
181
182
  break;
182
183
  case "BS_LOGISTICS":
183
- prv[uniqueKey] = updateBsItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orders, "logistics", config);
184
+ prv[uniqueKey] = updateBsItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.bsLogistics, "logistics", config);
184
185
  break;
185
186
  case "BS_SEND_GOOD":
186
- prv[uniqueKey] = updateBsItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orders, "send", config);
187
+ prv[uniqueKey] = updateBsItemListByConfigHandle(detail === null || detail === void 0 ? void 0 : detail.bsSendGood, "send", config);
188
+ break;
189
+ case "BS_DELIVERY_NO":
190
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsDeliveryNo;
187
191
  break;
188
192
  case "BS_POSTING":
189
- if (advItem !== null && advItem !== void 0 && advItem.provinceId) {
190
- bsPostingAddress = [advItem === null || advItem === void 0 ? void 0 : advItem.provinceId, advItem === null || advItem === void 0 ? void 0 : advItem.cityId];
191
- if (advItem !== null && advItem !== void 0 && advItem.districtId) {
192
- bsPostingAddress.push(advItem === null || advItem === void 0 ? void 0 : advItem.districtId);
193
- }
194
- }
195
- prv[uniqueKey] = {
196
- postingAddress: bsPostingAddress,
197
- postingDetail: advItem === null || advItem === void 0 ? void 0 : advItem.address,
198
- postingReceiverName: advItem === null || advItem === void 0 ? void 0 : advItem.receiver,
199
- postingReceiverMobile: advItem === null || advItem === void 0 ? void 0 : advItem.receiverTel
200
- };
193
+ prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsPosting;
201
194
  break;
202
195
  }
203
196
  return prv;
204
197
  }, {});
205
- });
198
+ };
199
+ //bs订单信息转换
200
+ export var bsOrderTransform = function bsOrderTransform(detail) {
201
+ var _detail$orders, _detail$orders$, _detail$orders$$advan, _detail$orders2, _ref, _detail$orders3, _detail$orders3$, _detail$orders3$$adva, _detail$orders3$$adva2;
202
+ var advItem = (detail === null || detail === void 0 ? void 0 : (_detail$orders = detail.orders) === null || _detail$orders === void 0 ? void 0 : (_detail$orders$ = _detail$orders[0]) === null || _detail$orders$ === void 0 ? void 0 : (_detail$orders$$advan = _detail$orders$.advancedDistributionInfos) === null || _detail$orders$$advan === void 0 ? void 0 : _detail$orders$$advan[0]) || {};
203
+ return {
204
+ bsSystemOrder: {
205
+ orderNo: detail === null || detail === void 0 ? void 0 : detail.sourceBillNo,
206
+ orders: (detail === null || detail === void 0 ? void 0 : detail.orders) || [],
207
+ selectIds: (detail === null || detail === void 0 ? void 0 : (_detail$orders2 = detail.orders) === null || _detail$orders2 === void 0 ? void 0 : _detail$orders2.length) === 1 ? detail === null || detail === void 0 ? void 0 : detail.orders.map(function (item) {
208
+ return item.billNo;
209
+ }) : [],
210
+ showOrderInfo: (_ref = (detail === null || detail === void 0 ? void 0 : detail.orders) || []) === null || _ref === void 0 ? void 0 : _ref.map(function (item) {
211
+ return {
212
+ billNo: item.billNo,
213
+ billType: item.billType,
214
+ billTag: item.billTag
215
+ };
216
+ })
217
+ },
218
+ bsSingingTime: detail === null || detail === void 0 ? void 0 : detail.receiptDate,
219
+ bsSendTime: detail === null || detail === void 0 ? void 0 : (_detail$orders3 = detail.orders) === null || _detail$orders3 === void 0 ? void 0 : (_detail$orders3$ = _detail$orders3[0]) === null || _detail$orders3$ === void 0 ? void 0 : (_detail$orders3$$adva = _detail$orders3$.advancedDistributionInfos) === null || _detail$orders3$$adva === void 0 ? void 0 : (_detail$orders3$$adva2 = _detail$orders3$$adva[0]) === null || _detail$orders3$$adva2 === void 0 ? void 0 : _detail$orders3$$adva2.deliveryDate,
220
+ bsTradePaymentTime: detail === null || detail === void 0 ? void 0 : detail.payDate,
221
+ bsDeposit: detail === null || detail === void 0 ? void 0 : detail.amountPaid,
222
+ bsNetReceipts: detail === null || detail === void 0 ? void 0 : detail.merchantRealIncome,
223
+ bsPackageWeight: ((detail === null || detail === void 0 ? void 0 : detail.orders) || []).reduce(function (prv, next) {
224
+ var number = ((next === null || next === void 0 ? void 0 : next.advancedDistributionInfos) || []).reduce(function (p, n) {
225
+ p += n.orderWeight || 0;
226
+ return p;
227
+ }, 0);
228
+ prv += number || 0;
229
+ return prv;
230
+ }, 0) || null,
231
+ bsGoods: {
232
+ shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
233
+ bsGoods: updateBsGoodsHandle(detail === null || detail === void 0 ? void 0 : detail.orders)
234
+ },
235
+ bsExchangeGoods: {
236
+ shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
237
+ bsExchangeType: [],
238
+ bsExchangeReturnGoods: [],
239
+ bsExchangeSwapOutGoods: [],
240
+ bsExchangeGiftGoods: []
241
+ },
242
+ bsReissueGoods: {
243
+ shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
244
+ bsReissueType: [],
245
+ bsReissueGoods: []
246
+ },
247
+ bsReturnGoods: {
248
+ shopCode: detail === null || detail === void 0 ? void 0 : detail.shopCode,
249
+ bsReturnType: [],
250
+ bsReturnGoods: []
251
+ },
252
+ bsLogistics: updateBsItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orders, "logistics"),
253
+ bsSendGood: updateBsItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orders, "send"),
254
+ bsDeliveryNo: updateBsSystemItemListHandle(detail === null || detail === void 0 ? void 0 : detail.orders, "delivery"),
255
+ bsPosting: {
256
+ postingAddress: [advItem === null || advItem === void 0 ? void 0 : advItem.provinceId, advItem === null || advItem === void 0 ? void 0 : advItem.cityId, advItem === null || advItem === void 0 ? void 0 : advItem.districtId],
257
+ postingDetail: advItem === null || advItem === void 0 ? void 0 : advItem.address,
258
+ postingReceiverName: advItem === null || advItem === void 0 ? void 0 : advItem.receiver,
259
+ postingReceiverMobile: advItem === null || advItem === void 0 ? void 0 : advItem.receiverTel
260
+ }
261
+ };
262
+ };
@@ -1,19 +1,18 @@
1
- import isEmpty from 'lodash/isEmpty';
2
- import keys from 'lodash/keys';
3
- import get from 'lodash/get';
4
- import find from 'lodash/find';
1
+ import isEmpty from "lodash/isEmpty";
2
+ import keys from "lodash/keys";
3
+ import get from "lodash/get";
4
+ import find from "lodash/find";
5
5
  export default (function (values, options) {
6
6
  if (isEmpty(values)) return [];
7
7
  var newKV = [];
8
8
  values === null || values === void 0 ? void 0 : values.map(function (value, index) {
9
- var _options$index;
10
- var list = options === null || options === void 0 ? void 0 : (_options$index = options[index]) === null || _options$index === void 0 ? void 0 : _options$index['list'];
9
+ var list = get(options, "".concat(index, ".list"), []);
11
10
  var flatt = keys(list).reduce(function (next, cur) {
12
11
  return next.concat(list[cur]);
13
12
  }, []);
14
13
  var label = get(find(flatt, {
15
14
  actived: value
16
- }), 'label', '');
15
+ }), "label", "");
17
16
  newKV.push({
18
17
  label: label,
19
18
  actived: value
@@ -6,7 +6,7 @@ export { default as isNull } from "./isNull";
6
6
  export { default as getExpression } from "./getExpression";
7
7
  export { default as formatDisplayConfig } from "./formatDisplayConfig";
8
8
  export { default as orderBackFormValues } from "./orderBackFormValues";
9
- export { default as bsOrderBackFormValues } from "./bsOrderBackFormValues";
9
+ export * from "./bsOrderBackFormValues";
10
10
  export { default as jstOrderBackFormValues } from "./jstOrderBackFormValues";
11
11
  export { default as uuid } from "./getUUid";
12
12
  export * as filterFn from "./filterFn";
@@ -6,7 +6,7 @@ export { default as isNull } from "./isNull";
6
6
  export { default as getExpression } from "./getExpression";
7
7
  export { default as formatDisplayConfig } from "./formatDisplayConfig";
8
8
  export { default as orderBackFormValues } from "./orderBackFormValues";
9
- export { default as bsOrderBackFormValues } from "./bsOrderBackFormValues";
9
+ export * from "./bsOrderBackFormValues";
10
10
  export { default as jstOrderBackFormValues } from "./jstOrderBackFormValues";
11
11
  export { default as uuid } from "./getUUid";
12
12
  import * as _filterFn from "./filterFn";
@@ -7,7 +7,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
7
7
  import moment from "moment";
8
8
  import ExpressData from "../expressData";
9
9
  import ExpressInterceptData from "../expressInterceptData";
10
- import bsOrderBackFormValues from "./bsOrderBackFormValues";
10
+ import { bsOrderBackFormValues } from "./bsOrderBackFormValues";
11
11
  import jstOrderBackFormValues from "./jstOrderBackFormValues";
12
12
 
13
13
  // 淘宝商品组件信息处理
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.8.17-alpha.9",
3
+ "version": "0.8.17",
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": "53d97c7e58b0f9ee82fd6fc5de6e8d7890797d44"
45
+ "gitHead": "fbac5157adf5ac4b01dd6a57fd1a19bb0137ce18"
46
46
  }