@kmkf-fe-packages/kmkf-utils 2.7.3-beta.0 → 2.7.3-beta.4

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
@@ -1 +1 @@
1
- 1123111123
1
+ 112311112311
@@ -90,6 +90,7 @@ export var SendDataCenter = /*#__PURE__*/function () {
90
90
  if (platform === "JST_SEND_GOOD") platform = "jst";
91
91
  if (platform === "JY_SEND_GOOD") platform = "jy";
92
92
  if (platform === "JKY_SEND_GOOD") platform = "jky";
93
+ if (platform === "WLN_SEND_GOOD") platform = "wln";
93
94
  if (!this.instanceMap.has(platform)) {
94
95
  this.instanceMap.set(platform, new SendData(platform));
95
96
  }
@@ -9,9 +9,15 @@ export declare const WLN_SYSTEM_ORDER_CONFIG: {
9
9
  width: number;
10
10
  }[];
11
11
  };
12
- export declare const updateWlnGoodsHandle: (orders?: any[]) => any;
12
+ export declare const getIsPlatformCodesIncludeOrderNos: (platformCodes: string, orderNos: string) => boolean;
13
+ export declare const updateWlnGoodsHandle: (orders?: any[], options?: {
14
+ canEdit?: boolean;
15
+ orderBackGoodsLevel?: string;
16
+ }) => any;
13
17
  export declare const wlnOrderBackFormValues: (detail?: any, templateDetail?: any) => any;
14
18
  export declare const wlnOrderTransform: (detail: any, form: any) => {
19
+ jstReissueGoods: any;
20
+ wlnReissueGoods: any;
15
21
  wlnSystemOrder: {
16
22
  orderNo: any;
17
23
  orders: any;
@@ -15,6 +15,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
15
15
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
16
  import ExpressData from "../expressData";
17
17
  import uuid from "./getUUid";
18
+ import isNull from "./isNull";
18
19
  export var WLN_SYSTEM_ORDER_CONFIG = {
19
20
  key: "wlnSystemShowOrder",
20
21
  name: "万里牛",
@@ -82,36 +83,85 @@ export var WLN_SYSTEM_ORDER_CONFIG = {
82
83
  width: 150
83
84
  }]
84
85
  };
86
+ export var getIsPlatformCodesIncludeOrderNos = function getIsPlatformCodesIncludeOrderNos(platformCodes, orderNos) {
87
+ var getSortedList = function getSortedList(str) {
88
+ try {
89
+ var parts = str.split(";");
90
+ var bigInts = parts.map(BigInt);
91
+ var sortedBigInts = bigInts.sort(function (a, b) {
92
+ if (a < b) return -1;
93
+ if (a > b) return 1;
94
+ return 0;
95
+ });
96
+ return sortedBigInts.map(String).join(";");
97
+ } catch (error) {
98
+ return "";
99
+ }
100
+ };
101
+ var platformCodesSortStr = getSortedList(platformCodes || "");
102
+ var orderNosSortStr = getSortedList(orderNos || "");
103
+ return platformCodesSortStr.includes(orderNosSortStr);
104
+ };
85
105
  export var updateWlnGoodsHandle = function updateWlnGoodsHandle() {
86
106
  var orders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
107
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
108
+ canEdit: false,
109
+ orderBackGoodsLevel: "1"
110
+ };
111
+ console.log('*** updateWlnGoodsHandle');
112
+ var wrapItem = function wrapItem(item, systemOrderNo) {
113
+ item.uuid = item.uuid || uuid();
114
+ item.systemOrderNo = systemOrderNo;
115
+ item.canDelete = true;
116
+ item.canEdit = !!options.canEdit;
117
+ var picPath = item.picPath,
118
+ itemId = item.itemId,
119
+ itemName = item.itemName,
120
+ skuId = item.skuId,
121
+ skuName = item.skuName,
122
+ isGift = item.isGift,
123
+ size = item.size,
124
+ payment = item.payment,
125
+ price = item.price,
126
+ others = _objectWithoutProperties(item, _excluded);
127
+ return _objectSpread(_objectSpread({}, others), {}, {
128
+ skuName: skuName,
129
+ pic: picPath,
130
+ name: itemName,
131
+ code: itemId,
132
+ sku: skuId,
133
+ money: payment || 0,
134
+ number: size,
135
+ share: price,
136
+ type: isGift
137
+ });
138
+ };
87
139
  var list = orders.reduce(function (prv, next) {
88
- var goods = next.items.map(function (item) {
89
- item.uuid = item.uuid || uuid();
90
- item.systemOrderNo = next === null || next === void 0 ? void 0 : next.tradeNo;
91
- var picPath = item.picPath,
92
- itemId = item.itemId,
93
- itemName = item.itemName,
94
- skuId = item.skuId,
95
- skuName = item.skuName,
96
- isGift = item.isGift,
97
- size = item.size,
98
- payment = item.payment,
99
- price = item.price,
100
- others = _objectWithoutProperties(item, _excluded);
101
- return _objectSpread(_objectSpread({}, others), {}, {
102
- skuName: skuName,
103
- pic: picPath,
104
- name: itemName,
105
- code: itemId,
106
- sku: skuId,
107
- money: payment || 0,
108
- number: size,
109
- share: price,
110
- type: isGift,
111
- canDelete: true
140
+ if (options.orderBackGoodsLevel !== "2") {
141
+ var _next$items;
142
+ // 反填子商品
143
+ next === null || next === void 0 ? void 0 : (_next$items = next.items) === null || _next$items === void 0 ? void 0 : _next$items.forEach(function (item) {
144
+ if (item.skuType === 'combine') {
145
+ item.subItems.forEach(function (subItem) {
146
+ var newSubItem = wrapItem(subItem, next === null || next === void 0 ? void 0 : next.tradeNo);
147
+ // TODO: 调整下属性
148
+ // newSubItem.batchId = item.batchId
149
+ // newSubItem.isGift = item.isGift
150
+ // newSubItem.qty = subItem.qty * item.qty
151
+ prv.push(newSubItem);
152
+ });
153
+ } else {
154
+ prv.push(wrapItem(item, next === null || next === void 0 ? void 0 : next.tradeNo));
155
+ }
112
156
  });
113
- });
114
- prv.push.apply(prv, _toConsumableArray(goods));
157
+ } else {
158
+ var _next$items2;
159
+ // 反填组合商品
160
+ var goods = (next === null || next === void 0 ? void 0 : (_next$items2 = next.items) === null || _next$items2 === void 0 ? void 0 : _next$items2.map(function (item) {
161
+ return wrapItem(item, next === null || next === void 0 ? void 0 : next.tradeNo);
162
+ })) || [];
163
+ prv.push.apply(prv, _toConsumableArray(goods));
164
+ }
115
165
  return prv;
116
166
  }, []);
117
167
  return list;
@@ -226,6 +276,17 @@ export var wlnOrderBackFormValues = function wlnOrderBackFormValues() {
226
276
  case "WLN_SYSTEM_ORDER":
227
277
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wlnSystemOrder;
228
278
  break;
279
+ case "WLN_REISSUE_GOODS":
280
+ {
281
+ var initReason = !isNull(config === null || config === void 0 ? void 0 : config.initReason) ? config.initReason : "1";
282
+ prv[uniqueKey] = {
283
+ wlnSystemOrder: detail === null || detail === void 0 ? void 0 : detail.wlnSystemOrder,
284
+ wlnReissueGoods: initReason === "2" ? [] : detail === null || detail === void 0 ? void 0 : detail.wlnReissueGoods,
285
+ wlnSystemOrderNo: detail === null || detail === void 0 ? void 0 : detail.wlnSystemOrderNo,
286
+ wlnReissueType: [initReason]
287
+ };
288
+ }
289
+ break;
229
290
  case "WLN_GOODS":
230
291
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wlnGoods;
231
292
  break;
@@ -241,7 +302,7 @@ export var wlnOrderBackFormValues = function wlnOrderBackFormValues() {
241
302
  };
242
303
  //wln订单信息转换
243
304
  export var wlnOrderTransform = function wlnOrderTransform(detail, form) {
244
- var _form$getFieldValue, _wlnReissueCom$compon, _wlnGoodsCom$componen, _wlnReissueCom$compon2, _detail$orders, _ref, _detail$orders2, _detail$orders2$;
305
+ var _form$getFieldValue, _wlnReissueCom$compon, _wlnGoodsCom$componen, _wlnReissueCom$compon2, _wlnReissueCom$compon3, _detail$orders, _ref, _detail$orders2, _detail$orders2$;
245
306
  console.log("\uD83D\uDE80 ~ wlnOrderBackFormValues.ts:265 ~ wlnOrderTransform ~ detail:", detail);
246
307
  var _detail$allOrders = detail.allOrders,
247
308
  allOrders = _detail$allOrders === void 0 ? [] : _detail$allOrders,
@@ -263,7 +324,11 @@ export var wlnOrderTransform = function wlnOrderTransform(detail, form) {
263
324
  var isReissueDefaultSelect = !!(wlnReissueCom !== null && wlnReissueCom !== void 0 && (_wlnReissueCom$compon = wlnReissueCom.componentConfig) !== null && _wlnReissueCom$compon !== void 0 && _wlnReissueCom$compon.showDefaultSelect);
264
325
  var wlnGoodsOrderBackGoodsLevel = wlnGoodsCom === null || wlnGoodsCom === void 0 ? void 0 : (_wlnGoodsCom$componen = wlnGoodsCom.componentConfig) === null || _wlnGoodsCom$componen === void 0 ? void 0 : _wlnGoodsCom$componen.orderBackGoodsLevel;
265
326
  var wlnReissueGoodsOrderBackGoodsLevel = wlnReissueCom === null || wlnReissueCom === void 0 ? void 0 : (_wlnReissueCom$compon2 = wlnReissueCom.componentConfig) === null || _wlnReissueCom$compon2 === void 0 ? void 0 : _wlnReissueCom$compon2.orderBackGoodsLevel;
266
- console.log('**** ', {
327
+ var newOrderList = filterCurrentTrades === null || filterCurrentTrades === void 0 ? void 0 : filterCurrentTrades.map(function (item) {
328
+ return _objectSpread({}, item);
329
+ });
330
+ var defaultOrder = newOrderList !== null && newOrderList !== void 0 && newOrderList[0] ? [newOrderList[0]] : [];
331
+ console.log("**** ", {
267
332
  isStrict: isStrict,
268
333
  onlyOneSystemOrder: onlyOneSystemOrder,
269
334
  isReissueDefaultSelect: isReissueDefaultSelect,
@@ -271,6 +336,17 @@ export var wlnOrderTransform = function wlnOrderTransform(detail, form) {
271
336
  wlnReissueGoodsOrderBackGoodsLevel: wlnReissueGoodsOrderBackGoodsLevel
272
337
  });
273
338
  return {
339
+ jstReissueGoods: onlyOneSystemOrder || isReissueDefaultSelect ? updateWlnGoodsHandle(defaultOrder, {
340
+ orderBackGoodsLevel: wlnReissueCom === null || wlnReissueCom === void 0 ? void 0 : (_wlnReissueCom$compon3 = wlnReissueCom.componentConfig) === null || _wlnReissueCom$compon3 === void 0 ? void 0 : _wlnReissueCom$compon3.orderBackGoodsLevel,
341
+ canEdit: true
342
+ }).filter(function (good) {
343
+ return !isStrict || !orderNo || good.originalDealCode === orderNo;
344
+ }) : [],
345
+ wlnReissueGoods: onlyOneSystemOrder || isReissueDefaultSelect ? updateWlnGoodsHandle(defaultOrder, {
346
+ canEdit: true
347
+ }).filter(function (good) {
348
+ return !isStrict || !orderNo || getIsPlatformCodesIncludeOrderNos(good.platformCode, orderNo);
349
+ }) : [],
274
350
  wlnSystemOrder: {
275
351
  orderNo: detail === null || detail === void 0 ? void 0 : detail.tradeNo,
276
352
  orders: ((detail === null || detail === void 0 ? void 0 : detail.orders) || []).map(function (item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "2.7.3-beta.0",
3
+ "version": "2.7.3-beta.4",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "8c80641421cc67b5f77f17fbe4db443014610338",
44
+ "gitHead": "006184824679eeb9a994787da6e31518e6d6f981",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }