@pisell/pisellos 2.2.178 → 2.2.179

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.
Files changed (182) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/Customer/index.d.ts +0 -6
  3. package/dist/modules/Customer/index.js +83 -129
  4. package/dist/modules/Customer/types.d.ts +0 -2
  5. package/dist/modules/Discount/index.d.ts +4 -2
  6. package/dist/modules/Discount/index.js +93 -8
  7. package/dist/modules/Discount/types.d.ts +7 -1
  8. package/dist/modules/Order/index.d.ts +18 -88
  9. package/dist/modules/Order/index.js +501 -1357
  10. package/dist/modules/Order/types.d.ts +19 -198
  11. package/dist/modules/Order/types.js +0 -31
  12. package/dist/modules/Order/utils.d.ts +1 -50
  13. package/dist/modules/Order/utils.js +32 -261
  14. package/dist/modules/Quotation/index.d.ts +1 -0
  15. package/dist/modules/Quotation/index.js +21 -23
  16. package/dist/modules/Rules/index.d.ts +0 -4
  17. package/dist/modules/Rules/index.js +10 -26
  18. package/dist/modules/SalesSummary/index.js +2 -4
  19. package/dist/modules/SalesSummary/utils.js +7 -21
  20. package/dist/modules/Schedule/index.js +2 -6
  21. package/dist/modules/index.d.ts +0 -1
  22. package/dist/modules/index.js +1 -2
  23. package/dist/server/index.js +29 -87
  24. package/dist/server/modules/order/index.d.ts +0 -23
  25. package/dist/server/modules/order/index.js +46 -123
  26. package/dist/server/modules/order/types.d.ts +2 -0
  27. package/dist/server/modules/order/utils/filterOrders.js +6 -20
  28. package/dist/server/modules/products/index.d.ts +1 -1
  29. package/dist/server/modules/products/index.js +113 -130
  30. package/dist/server/modules/schedule/index.js +6 -13
  31. package/dist/solution/BaseSales/index.d.ts +7 -89
  32. package/dist/solution/BaseSales/index.js +375 -1494
  33. package/dist/solution/BaseSales/types.d.ts +1 -67
  34. package/dist/solution/BaseSales/types.js +1 -3
  35. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
  36. package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  37. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
  38. package/dist/solution/BaseSales/utils.js +8 -46
  39. package/dist/solution/BookingByStep/index.d.ts +1 -1
  40. package/dist/solution/BookingTicket/index.d.ts +1 -133
  41. package/dist/solution/BookingTicket/index.js +175 -780
  42. package/dist/solution/BookingTicket/types.d.ts +0 -2
  43. package/dist/solution/BookingTicket/types.js +0 -3
  44. package/dist/solution/BookingTicket/utils/cartView.js +2 -4
  45. package/dist/solution/ScanOrder/index.d.ts +3 -9
  46. package/dist/solution/ScanOrder/index.js +128 -231
  47. package/dist/solution/ScanOrder/utils.js +8 -46
  48. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  49. package/dist/solution/ShopDiscount/index.js +23 -18
  50. package/dist/solution/VenueBooking/index.d.ts +9 -5
  51. package/dist/solution/VenueBooking/index.js +55 -103
  52. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  53. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  54. package/lib/modules/Customer/index.d.ts +0 -6
  55. package/lib/modules/Customer/index.js +11 -26
  56. package/lib/modules/Customer/types.d.ts +0 -2
  57. package/lib/modules/Discount/index.d.ts +4 -2
  58. package/lib/modules/Discount/index.js +63 -8
  59. package/lib/modules/Discount/types.d.ts +7 -1
  60. package/lib/modules/Order/index.d.ts +18 -88
  61. package/lib/modules/Order/index.js +149 -677
  62. package/lib/modules/Order/types.d.ts +19 -198
  63. package/lib/modules/Order/types.js +0 -1
  64. package/lib/modules/Order/utils.d.ts +1 -50
  65. package/lib/modules/Order/utils.js +22 -229
  66. package/lib/modules/Quotation/index.d.ts +1 -0
  67. package/lib/modules/Quotation/index.js +15 -18
  68. package/lib/modules/Rules/index.d.ts +0 -4
  69. package/lib/modules/Rules/index.js +14 -22
  70. package/lib/modules/SalesSummary/index.js +2 -4
  71. package/lib/modules/SalesSummary/utils.js +7 -21
  72. package/lib/modules/Schedule/index.js +1 -3
  73. package/lib/modules/index.d.ts +0 -1
  74. package/lib/modules/index.js +1 -3
  75. package/lib/server/index.js +4 -41
  76. package/lib/server/modules/order/index.d.ts +0 -23
  77. package/lib/server/modules/order/index.js +14 -46
  78. package/lib/server/modules/order/types.d.ts +2 -0
  79. package/lib/server/modules/order/utils/filterOrders.js +4 -12
  80. package/lib/server/modules/products/index.d.ts +1 -1
  81. package/lib/server/modules/products/index.js +20 -30
  82. package/lib/server/modules/schedule/index.js +1 -2
  83. package/lib/solution/BaseSales/index.d.ts +7 -89
  84. package/lib/solution/BaseSales/index.js +22 -736
  85. package/lib/solution/BaseSales/types.d.ts +1 -67
  86. package/lib/solution/BaseSales/types.js +1 -3
  87. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
  88. package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -0
  89. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
  90. package/lib/solution/BaseSales/utils.js +6 -46
  91. package/lib/solution/BookingByStep/index.d.ts +1 -1
  92. package/lib/solution/BookingTicket/index.d.ts +1 -133
  93. package/lib/solution/BookingTicket/index.js +8 -352
  94. package/lib/solution/BookingTicket/types.d.ts +0 -2
  95. package/lib/solution/BookingTicket/types.js +0 -6
  96. package/lib/solution/BookingTicket/utils/cartView.js +2 -4
  97. package/lib/solution/ScanOrder/index.d.ts +3 -9
  98. package/lib/solution/ScanOrder/index.js +66 -147
  99. package/lib/solution/ScanOrder/utils.js +6 -46
  100. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  101. package/lib/solution/ShopDiscount/index.js +4 -2
  102. package/lib/solution/VenueBooking/index.d.ts +9 -5
  103. package/lib/solution/VenueBooking/index.js +14 -50
  104. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  105. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  106. package/package.json +2 -2
  107. package/dist/modules/BookingContext/index.d.ts +0 -37
  108. package/dist/modules/BookingContext/index.js +0 -436
  109. package/dist/modules/BookingContext/types.d.ts +0 -102
  110. package/dist/modules/BookingContext/types.js +0 -51
  111. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  112. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
  113. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  114. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
  115. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
  116. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
  117. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  118. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  119. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  120. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  121. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  122. package/dist/modules/BookingContext/utils/index.js +0 -11
  123. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  124. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  125. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  126. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  127. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  128. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  129. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  130. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  131. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  132. package/dist/modules/BookingContext/utils/resources.js +0 -486
  133. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  134. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  135. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  136. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  137. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  138. package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
  139. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
  140. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1258
  141. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  142. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  143. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
  144. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  145. package/lib/modules/BookingContext/index.d.ts +0 -37
  146. package/lib/modules/BookingContext/index.js +0 -297
  147. package/lib/modules/BookingContext/types.d.ts +0 -102
  148. package/lib/modules/BookingContext/types.js +0 -34
  149. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  150. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
  151. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  152. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
  153. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
  154. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
  155. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  156. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  157. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  158. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  159. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  160. package/lib/modules/BookingContext/utils/index.js +0 -43
  161. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  162. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  163. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  164. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  165. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  166. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  167. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  168. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  169. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  170. package/lib/modules/BookingContext/utils/resources.js +0 -377
  171. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  172. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  173. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  174. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  175. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  176. package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
  177. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
  178. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -836
  179. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  180. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  181. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
  182. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
@@ -1,17 +1,4 @@
1
1
  import dayjs from 'dayjs';
2
- /** 从订单 payments 提取支付方式 code,与 UI 筛选选项及 filterBookings 一致 */
3
- function getOrderPaymentCodes(order) {
4
- var payments = order.payments;
5
- if (!Array.isArray(payments) || payments.length === 0) {
6
- return [];
7
- }
8
- return payments.map(function (item) {
9
- return item === null || item === void 0 ? void 0 : item.code;
10
- }).filter(function (code) {
11
- return typeof code === 'string' && code.length > 0;
12
- });
13
- }
14
-
15
2
  /**
16
3
  * 订单过滤函数
17
4
  * @param orders 原始订单列表
@@ -139,23 +126,22 @@ export function filterOrders(orders, filters) {
139
126
  }
140
127
  }
141
128
 
142
- // payment_methods - 支付方式(按 payments[].code 匹配,不再使用 order.payment_methods)
129
+ // payment_methods - 支付方式
143
130
  if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
144
- var orderPaymentCodes = getOrderPaymentCodes(order);
145
- if (orderPaymentCodes.length === 0) {
131
+ if (!order.payment_methods || !Array.isArray(order.payment_methods) || order.payment_methods.length === 0) {
146
132
  rejected.push({
147
133
  order_id: order.order_id,
148
134
  order_number: order.order_number,
149
135
  reason: {
150
136
  field: 'payment_methods',
151
- actual: order.payments,
137
+ actual: order.payment_methods,
152
138
  expected: safeFilters.payment_methods
153
139
  }
154
140
  });
155
141
  return false;
156
142
  }
157
- var hasMatch = orderPaymentCodes.some(function (code) {
158
- return safeFilters.payment_methods.includes(code);
143
+ var hasMatch = order.payment_methods.some(function (pm) {
144
+ return safeFilters.payment_methods.includes(pm);
159
145
  });
160
146
  if (!hasMatch) {
161
147
  rejected.push({
@@ -163,7 +149,7 @@ export function filterOrders(orders, filters) {
163
149
  order_number: order.order_number,
164
150
  reason: {
165
151
  field: 'payment_methods',
166
- actual: orderPaymentCodes,
152
+ actual: order.payment_methods,
167
153
  expected: safeFilters.payment_methods
168
154
  }
169
155
  });
@@ -21,7 +21,7 @@ export declare class ProductsModule extends BaseModule implements Module {
21
21
  private isPriceFormatterRegistered;
22
22
  private quotationPriceBridge?;
23
23
  private quotationBridgeChannel?;
24
- private quotationBridgeLoadedKey?;
24
+ private quotationBridgeCustomerId?;
25
25
  private quotationBridgeRefreshPromise?;
26
26
  private quotationBridgeRefreshKey?;
27
27
  private productDataSource;
@@ -73,7 +73,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
73
73
  // 普通层 QuotationModule 桥接器:本地计算报价单价格,替代 /product/query/price
74
74
  _defineProperty(_assertThisInitialized(_this), "quotationPriceBridge", void 0);
75
75
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeChannel", void 0);
76
- _defineProperty(_assertThisInitialized(_this), "quotationBridgeLoadedKey", '');
76
+ _defineProperty(_assertThisInitialized(_this), "quotationBridgeCustomerId", void 0);
77
77
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshPromise", void 0);
78
78
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshKey", void 0);
79
79
  // ---- 商品数据同步相关 ----
@@ -277,7 +277,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
277
277
  value: (function () {
278
278
  var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
279
279
  var _this$otherParams;
280
- var channel, quotation, scheduleCache, hasLoadedScheduleList;
280
+ var channel, quotation, _params$scheduleModul, _params$scheduleModul2, scheduleList, scheduleMap;
281
281
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
282
282
  while (1) switch (_context3.prev = _context3.next) {
283
283
  case 0:
@@ -301,32 +301,14 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
301
301
  this.quotationPriceBridge = quotation;
302
302
  case 10:
303
303
  if (params.scheduleModule) {
304
- scheduleCache = new Map();
305
- hasLoadedScheduleList = false;
304
+ scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
305
+ scheduleMap = new Map(scheduleList.map(function (schedule) {
306
+ return [schedule.id, schedule];
307
+ }));
306
308
  this.quotationPriceBridge.setScheduleResolver(function (id) {
307
- var _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
308
- var scheduleId = String(id);
309
- if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
310
- if (!hasLoadedScheduleList) {
311
- var _params$scheduleModul, _params$scheduleModul2;
312
- var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
313
- var _iterator = _createForOfIteratorHelper(scheduleList),
314
- _step;
315
- try {
316
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
317
- var schedule = _step.value;
318
- scheduleCache.set(String(schedule.id), schedule);
319
- }
320
- } catch (err) {
321
- _iterator.e(err);
322
- } finally {
323
- _iterator.f();
324
- }
325
- hasLoadedScheduleList = true;
326
- }
327
- if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
328
- var schedules = ((_params$scheduleModul3 = (_params$scheduleModul4 = params.scheduleModule).getScheduleListByIds) === null || _params$scheduleModul3 === void 0 ? void 0 : _params$scheduleModul3.call(_params$scheduleModul4, [id])) || ((_params$scheduleModul5 = (_params$scheduleModul6 = params.scheduleModule).getScheduleByIds) === null || _params$scheduleModul5 === void 0 ? void 0 : _params$scheduleModul5.call(_params$scheduleModul6, [id])) || [];
329
- if (schedules[0]) scheduleCache.set(scheduleId, schedules[0]);
309
+ var _params$scheduleModul3, _params$scheduleModul4;
310
+ if (scheduleMap.has(id)) return scheduleMap.get(id);
311
+ var schedules = ((_params$scheduleModul3 = (_params$scheduleModul4 = params.scheduleModule).getScheduleByIds) === null || _params$scheduleModul3 === void 0 ? void 0 : _params$scheduleModul3.call(_params$scheduleModul4, [id])) || [];
330
312
  return schedules[0];
331
313
  });
332
314
  }
@@ -354,7 +336,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
354
336
  value: (function () {
355
337
  var _refreshQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
356
338
  var _this3 = this;
357
- var refreshKey;
339
+ var customerId, refreshKey;
358
340
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
359
341
  while (1) switch (_context4.prev = _context4.next) {
360
342
  case 0:
@@ -364,35 +346,37 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
364
346
  }
365
347
  return _context4.abrupt("return");
366
348
  case 2:
367
- refreshKey = this.getQuotationBridgeScopeKey();
349
+ customerId = params && 'customer_id' in params ? params.customer_id : this.quotationBridgeCustomerId;
350
+ refreshKey = this.getQuotationBridgeScopeKey(customerId);
368
351
  if (!(this.quotationBridgeRefreshPromise && this.quotationBridgeRefreshKey === refreshKey)) {
369
- _context4.next = 7;
352
+ _context4.next = 8;
370
353
  break;
371
354
  }
372
- _context4.next = 6;
355
+ _context4.next = 7;
373
356
  return this.quotationBridgeRefreshPromise;
374
- case 6:
375
- return _context4.abrupt("return");
376
357
  case 7:
358
+ return _context4.abrupt("return");
359
+ case 8:
377
360
  if (!this.quotationBridgeRefreshPromise) {
378
- _context4.next = 10;
361
+ _context4.next = 11;
379
362
  break;
380
363
  }
381
- _context4.next = 10;
364
+ _context4.next = 11;
382
365
  return this.quotationBridgeRefreshPromise;
383
- case 10:
366
+ case 11:
384
367
  this.quotationBridgeRefreshKey = refreshKey;
385
368
  this.quotationBridgeRefreshPromise = this.quotationPriceBridge.loadQuotations({
386
- channel: this.quotationBridgeChannel
369
+ channel: this.quotationBridgeChannel,
370
+ customer_id: customerId
387
371
  }).then(function () {
388
- _this3.quotationBridgeLoadedKey = refreshKey;
372
+ _this3.quotationBridgeCustomerId = customerId;
389
373
  }).finally(function () {
390
374
  _this3.quotationBridgeRefreshPromise = undefined;
391
375
  _this3.quotationBridgeRefreshKey = undefined;
392
376
  });
393
- _context4.next = 14;
377
+ _context4.next = 15;
394
378
  return this.quotationBridgeRefreshPromise;
395
- case 14:
379
+ case 15:
396
380
  case "end":
397
381
  return _context4.stop();
398
382
  }
@@ -430,7 +414,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
430
414
  _context5.next = 7;
431
415
  return this.quotationBridgeRefreshPromise;
432
416
  case 7:
433
- if (!(this.getQuotationBridgeScopeKey() !== this.quotationBridgeLoadedKey)) {
417
+ if (!(this.getQuotationBridgeScopeKey(customerId) !== this.getQuotationBridgeScopeKey(this.quotationBridgeCustomerId))) {
434
418
  _context5.next = 10;
435
419
  break;
436
420
  }
@@ -451,24 +435,23 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
451
435
  }()
452
436
  }, {
453
437
  key: "getQuotationBridgeScopeKey",
454
- value: function getQuotationBridgeScopeKey() {
455
- return this.quotationBridgeChannel || '';
438
+ value: function getQuotationBridgeScopeKey(customerId) {
439
+ return "".concat(this.quotationBridgeChannel || '', ":").concat(customerId !== null && customerId !== void 0 ? customerId : '');
456
440
  }
457
441
  }, {
458
442
  key: "buildPriceDataFromQuotation",
459
443
  value: function buildPriceDataFromQuotation(product, datetime, customerId) {
460
- var _this$quotationPriceB, _ref2, _ref3;
444
+ var _this$quotationPriceB, _ref2, _product$base_price;
461
445
  var quotedPrice = (_this$quotationPriceB = this.quotationPriceBridge) === null || _this$quotationPriceB === void 0 ? void 0 : _this$quotationPriceB.getPriceForProduct({
462
446
  productId: product.id,
463
447
  datetime: datetime,
464
448
  customer_id: customerId
465
449
  });
466
450
  var productPrice = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.price;
467
- var productBasePrice = (_ref2 = (_ref3 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.base_price) !== null && _ref3 !== void 0 ? _ref3 : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0;
468
451
  return {
469
452
  id: product.id,
470
453
  price: String(productPrice !== null && productPrice !== void 0 ? productPrice : 0),
471
- base_price: String(productBasePrice),
454
+ base_price: String((_ref2 = (_product$base_price = product.base_price) !== null && _product$base_price !== void 0 ? _product$base_price : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0),
472
455
  variant: this.buildVariantPriceData(product, datetime, customerId),
473
456
  bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
474
457
  };
@@ -479,15 +462,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
479
462
  var _this4 = this;
480
463
  if (!Array.isArray(product.variant)) return [];
481
464
  return product.variant.map(function (variant) {
482
- var _this4$quotationPrice, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _variant$product_id;
465
+ var _this4$quotationPrice, _ref3, _ref4, _ref5, _ref6, _ref7, _variant$base_price, _variant$product_id;
483
466
  var quotedPrice = (_this4$quotationPrice = _this4.quotationPriceBridge) === null || _this4$quotationPrice === void 0 ? void 0 : _this4$quotationPrice.getPriceForProduct({
484
467
  productId: product.id,
485
468
  variantId: Number(variant.id),
486
469
  datetime: datetime,
487
470
  customer_id: customerId
488
471
  });
489
- var price = (_ref4 = (_ref5 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref5 !== void 0 ? _ref5 : product.price) !== null && _ref4 !== void 0 ? _ref4 : 0;
490
- var basePrice = (_ref6 = (_ref7 = (_ref8 = (_ref9 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.base_price) !== null && _ref9 !== void 0 ? _ref9 : variant.price) !== null && _ref8 !== void 0 ? _ref8 : product.base_price) !== null && _ref7 !== void 0 ? _ref7 : product.price) !== null && _ref6 !== void 0 ? _ref6 : 0;
472
+ var price = (_ref3 = (_ref4 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref4 !== void 0 ? _ref4 : product.price) !== null && _ref3 !== void 0 ? _ref3 : 0;
473
+ var basePrice = (_ref5 = (_ref6 = (_ref7 = (_variant$base_price = variant.base_price) !== null && _variant$base_price !== void 0 ? _variant$base_price : variant.price) !== null && _ref7 !== void 0 ? _ref7 : product.base_price) !== null && _ref6 !== void 0 ? _ref6 : product.price) !== null && _ref5 !== void 0 ? _ref5 : 0;
491
474
  return {
492
475
  id: Number(variant.id),
493
476
  product_id: Number((_variant$product_id = variant.product_id) !== null && _variant$product_id !== void 0 ? _variant$product_id : product.id),
@@ -505,7 +488,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
505
488
  return {
506
489
  id: Number(group.id),
507
490
  bundle_item: (group.bundle_item || []).map(function (item) {
508
- var _this5$quotationPrice, _ref10, _ref11, _ref12, _item$product_id, _item$group_id;
491
+ var _this5$quotationPrice, _ref8, _ref9, _item$base_price, _item$product_id, _item$group_id;
509
492
  var bundleProductId = Number(item.bundle_product_id);
510
493
  var bundleVariantId = Number(item.bundle_variant_id || 0);
511
494
  var quotedPrice = (_this5$quotationPrice = _this5.quotationPriceBridge) === null || _this5$quotationPrice === void 0 ? void 0 : _this5$quotationPrice.getPriceForProduct({
@@ -514,8 +497,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
514
497
  datetime: datetime,
515
498
  customer_id: customerId
516
499
  });
517
- var price = (_ref10 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0;
518
- var basePrice = (_ref11 = (_ref12 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.base_price) !== null && _ref12 !== void 0 ? _ref12 : item.price) !== null && _ref11 !== void 0 ? _ref11 : 0;
500
+ var price = (_ref8 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref8 !== void 0 ? _ref8 : 0;
501
+ var basePrice = (_ref9 = (_item$base_price = item.base_price) !== null && _item$base_price !== void 0 ? _item$base_price : item.price) !== null && _ref9 !== void 0 ? _ref9 : 0;
519
502
  return {
520
503
  id: Number(item.id),
521
504
  product_id: Number((_item$product_id = item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : product.id),
@@ -548,7 +531,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
548
531
  value: (function () {
549
532
  var _getProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(schedule_date, extraContext, options) {
550
533
  var _options$changedIds;
551
- var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator2, _step2, p, _iterator3, _step3, _p, errorMessage, result;
534
+ var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator, _step, p, _iterator2, _step2, _p, errorMessage, result;
552
535
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
553
536
  while (1) switch (_context6.prev = _context6.next) {
554
537
  case 0:
@@ -589,10 +572,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
589
572
  return [p.id, p];
590
573
  }));
591
574
  mergedCache = [];
592
- _iterator2 = _createForOfIteratorHelper(cachedProducts);
575
+ _iterator = _createForOfIteratorHelper(cachedProducts);
593
576
  try {
594
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
595
- p = _step2.value;
577
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
578
+ p = _step.value;
596
579
  if (updatedMap.has(p.id)) {
597
580
  mergedCache.push(updatedMap.get(p.id));
598
581
  updatedMap.delete(p.id);
@@ -602,20 +585,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
602
585
  }
603
586
  // 剩余的是新增商品(create 场景)
604
587
  } catch (err) {
605
- _iterator2.e(err);
588
+ _iterator.e(err);
606
589
  } finally {
607
- _iterator2.f();
590
+ _iterator.f();
608
591
  }
609
- _iterator3 = _createForOfIteratorHelper(updatedMap.values());
592
+ _iterator2 = _createForOfIteratorHelper(updatedMap.values());
610
593
  try {
611
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
612
- _p = _step3.value;
594
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
595
+ _p = _step2.value;
613
596
  mergedCache.push(_p);
614
597
  }
615
598
  } catch (err) {
616
- _iterator3.e(err);
599
+ _iterator2.e(err);
617
600
  } finally {
618
- _iterator3.f();
601
+ _iterator2.f();
619
602
  }
620
603
  this.productsPriceCache.set(cacheKey, mergedCache);
621
604
  this.logInfo('增量更新完成', {
@@ -850,25 +833,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
850
833
  }
851
834
  if (productIds.length === 0 && collectionIds.length === 0) return [];
852
835
  var result = new Set();
853
- var _iterator4 = _createForOfIteratorHelper(productIds),
854
- _step4;
836
+ var _iterator3 = _createForOfIteratorHelper(productIds),
837
+ _step3;
855
838
  try {
856
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
857
- var id = _step4.value;
839
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
840
+ var id = _step3.value;
858
841
  if (this.store.map.has(id)) result.add(id);
859
842
  }
860
843
  } catch (err) {
861
- _iterator4.e(err);
844
+ _iterator3.e(err);
862
845
  } finally {
863
- _iterator4.f();
846
+ _iterator3.f();
864
847
  }
865
848
  if (collectionIds.length === 0) return Array.from(result);
866
849
  var collectionIdSet = new Set(collectionIds);
867
- var _iterator5 = _createForOfIteratorHelper(this.getProductsRef()),
868
- _step5;
850
+ var _iterator4 = _createForOfIteratorHelper(this.getProductsRef()),
851
+ _step4;
869
852
  try {
870
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
871
- var product = _step5.value;
853
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
854
+ var product = _step4.value;
872
855
  if (result.has(product.id)) continue;
873
856
  if (!Array.isArray(product.collection)) continue;
874
857
  var isInCollection = product.collection.some(function (collection) {
@@ -877,9 +860,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
877
860
  if (isInCollection) result.add(product.id);
878
861
  }
879
862
  } catch (err) {
880
- _iterator5.e(err);
863
+ _iterator4.e(err);
881
864
  } finally {
882
- _iterator5.f();
865
+ _iterator4.f();
883
866
  }
884
867
  return Array.from(result);
885
868
  }
@@ -1158,11 +1141,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1158
1141
  key: "fetchProductsByHttp",
1159
1142
  value: (function () {
1160
1143
  var _fetchProductsByHttp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1161
- var _ref13, _ref13$category_ids, category_ids, _ref13$product_ids, product_ids, _ref13$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1144
+ var _ref10, _ref10$category_ids, category_ids, _ref10$product_ids, product_ids, _ref10$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1162
1145
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1163
1146
  while (1) switch (_context10.prev = _context10.next) {
1164
1147
  case 0:
1165
- _ref13 = params || {}, _ref13$category_ids = _ref13.category_ids, category_ids = _ref13$category_ids === void 0 ? [] : _ref13$category_ids, _ref13$product_ids = _ref13.product_ids, product_ids = _ref13$product_ids === void 0 ? [] : _ref13$product_ids, _ref13$collection = _ref13.collection, collection = _ref13$collection === void 0 ? [] : _ref13$collection, customer_id = _ref13.customer_id, cacheId = _ref13.cacheId;
1148
+ _ref10 = params || {}, _ref10$category_ids = _ref10.category_ids, category_ids = _ref10$category_ids === void 0 ? [] : _ref10$category_ids, _ref10$product_ids = _ref10.product_ids, product_ids = _ref10$product_ids === void 0 ? [] : _ref10$product_ids, _ref10$collection = _ref10.collection, collection = _ref10$collection === void 0 ? [] : _ref10$collection, customer_id = _ref10.customer_id, cacheId = _ref10.cacheId;
1166
1149
  this.logInfo('fetchProductsByHttp: 开始请求', {
1167
1150
  categoryIdsCount: category_ids.length,
1168
1151
  productIdsCount: product_ids.length,
@@ -1310,18 +1293,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1310
1293
  key: "getProductsRefByIds",
1311
1294
  value: function getProductsRefByIds(ids) {
1312
1295
  var products = [];
1313
- var _iterator6 = _createForOfIteratorHelper(ids),
1314
- _step6;
1296
+ var _iterator5 = _createForOfIteratorHelper(ids),
1297
+ _step5;
1315
1298
  try {
1316
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1317
- var id = _step6.value;
1299
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1300
+ var id = _step5.value;
1318
1301
  var product = this.store.map.get(id);
1319
1302
  if (product) products.push(product);
1320
1303
  }
1321
1304
  } catch (err) {
1322
- _iterator6.e(err);
1305
+ _iterator5.e(err);
1323
1306
  } finally {
1324
- _iterator6.f();
1307
+ _iterator5.f();
1325
1308
  }
1326
1309
  return products;
1327
1310
  }
@@ -1360,7 +1343,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1360
1343
  key: "removeProductsByIds",
1361
1344
  value: (function () {
1362
1345
  var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
1363
- var idSet, _iterator7, _step7, _id, _iterator8, _step8, id, errorMessage, _iterator9, _step9, _step9$value, dateKey, cachedProducts;
1346
+ var idSet, _iterator6, _step6, _id, _iterator7, _step7, id, errorMessage, _iterator8, _step8, _step8$value, dateKey, cachedProducts;
1364
1347
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1365
1348
  while (1) switch (_context14.prev = _context14.next) {
1366
1349
  case 0:
@@ -1372,31 +1355,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1372
1355
  this.store.list = this.store.list.filter(function (p) {
1373
1356
  return !idSet.has(p.id);
1374
1357
  });
1375
- _iterator7 = _createForOfIteratorHelper(ids);
1358
+ _iterator6 = _createForOfIteratorHelper(ids);
1376
1359
  try {
1377
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1378
- _id = _step7.value;
1360
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1361
+ _id = _step6.value;
1379
1362
  this.store.map.delete(_id);
1380
1363
  }
1381
1364
  } catch (err) {
1382
- _iterator7.e(err);
1365
+ _iterator6.e(err);
1383
1366
  } finally {
1384
- _iterator7.f();
1367
+ _iterator6.f();
1385
1368
  }
1386
1369
  if (!this.dbManager) {
1387
1370
  _context14.next = 30;
1388
1371
  break;
1389
1372
  }
1390
1373
  _context14.prev = 6;
1391
- _iterator8 = _createForOfIteratorHelper(ids);
1374
+ _iterator7 = _createForOfIteratorHelper(ids);
1392
1375
  _context14.prev = 8;
1393
- _iterator8.s();
1376
+ _iterator7.s();
1394
1377
  case 10:
1395
- if ((_step8 = _iterator8.n()).done) {
1378
+ if ((_step7 = _iterator7.n()).done) {
1396
1379
  _context14.next = 16;
1397
1380
  break;
1398
1381
  }
1399
- id = _step8.value;
1382
+ id = _step7.value;
1400
1383
  _context14.next = 14;
1401
1384
  return this.dbManager.delete(INDEXDB_STORE_NAME, id);
1402
1385
  case 14:
@@ -1408,10 +1391,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1408
1391
  case 18:
1409
1392
  _context14.prev = 18;
1410
1393
  _context14.t0 = _context14["catch"](8);
1411
- _iterator8.e(_context14.t0);
1394
+ _iterator7.e(_context14.t0);
1412
1395
  case 21:
1413
1396
  _context14.prev = 21;
1414
- _iterator8.f();
1397
+ _iterator7.f();
1415
1398
  return _context14.finish(21);
1416
1399
  case 24:
1417
1400
  _context14.next = 30;
@@ -1425,18 +1408,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1425
1408
  error: errorMessage
1426
1409
  });
1427
1410
  case 30:
1428
- _iterator9 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1411
+ _iterator8 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1429
1412
  try {
1430
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1431
- _step9$value = _slicedToArray(_step9.value, 2), dateKey = _step9$value[0], cachedProducts = _step9$value[1];
1413
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1414
+ _step8$value = _slicedToArray(_step8.value, 2), dateKey = _step8$value[0], cachedProducts = _step8$value[1];
1432
1415
  this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
1433
1416
  return !idSet.has(p.id);
1434
1417
  }));
1435
1418
  }
1436
1419
  } catch (err) {
1437
- _iterator9.e(err);
1420
+ _iterator8.e(err);
1438
1421
  } finally {
1439
- _iterator9.f();
1422
+ _iterator8.f();
1440
1423
  }
1441
1424
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
1442
1425
  this.logInfo('removeProductsByIds 完成', {
@@ -1676,17 +1659,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1676
1659
  value: function syncProductsMap() {
1677
1660
  var t0 = performance.now();
1678
1661
  this.store.map.clear();
1679
- var _iterator10 = _createForOfIteratorHelper(this.store.list),
1680
- _step10;
1662
+ var _iterator9 = _createForOfIteratorHelper(this.store.list),
1663
+ _step9;
1681
1664
  try {
1682
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1683
- var product = _step10.value;
1665
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1666
+ var product = _step9.value;
1684
1667
  this.store.map.set(product.id, product);
1685
1668
  }
1686
1669
  } catch (err) {
1687
- _iterator10.e(err);
1670
+ _iterator9.e(err);
1688
1671
  } finally {
1689
- _iterator10.f();
1672
+ _iterator9.f();
1690
1673
  }
1691
1674
  perfMark('syncProductsMap', performance.now() - t0, {
1692
1675
  count: this.store.map.size
@@ -1898,7 +1881,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1898
1881
  key: "processProductSyncMessages",
1899
1882
  value: (function () {
1900
1883
  var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1901
- var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator11, _step11, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
1884
+ var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator10, _step10, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
1902
1885
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1903
1886
  while (1) switch (_context20.prev = _context20.next) {
1904
1887
  case 0:
@@ -1918,15 +1901,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1918
1901
  sseRefreshIds = [];
1919
1902
  priceRefreshIds = [];
1920
1903
  shouldClearPriceCache = false;
1921
- _iterator11 = _createForOfIteratorHelper(messages);
1904
+ _iterator10 = _createForOfIteratorHelper(messages);
1922
1905
  _context20.prev = 11;
1923
- _iterator11.s();
1906
+ _iterator10.s();
1924
1907
  case 13:
1925
- if ((_step11 = _iterator11.n()).done) {
1908
+ if ((_step10 = _iterator10.n()).done) {
1926
1909
  _context20.next = 36;
1927
1910
  break;
1928
1911
  }
1929
- msg = _step11.value;
1912
+ msg = _step10.value;
1930
1913
  channelKey = msg._channelKey || msg.module || 'product';
1931
1914
  if (!(channelKey === 'product')) {
1932
1915
  _context20.next = 33;
@@ -1992,10 +1975,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1992
1975
  case 38:
1993
1976
  _context20.prev = 38;
1994
1977
  _context20.t0 = _context20["catch"](11);
1995
- _iterator11.e(_context20.t0);
1978
+ _iterator10.e(_context20.t0);
1996
1979
  case 41:
1997
1980
  _context20.prev = 41;
1998
- _iterator11.f();
1981
+ _iterator10.f();
1999
1982
  return _context20.finish(41);
2000
1983
  case 44:
2001
1984
  uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
@@ -2166,7 +2149,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2166
2149
  key: "applyBodyUpdatesToStore",
2167
2150
  value: (function () {
2168
2151
  var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(bodyUpdates) {
2169
- var updatedCount, newCount, appliedIds, _iterator12, _step12, _step12$value, id, body;
2152
+ var updatedCount, newCount, appliedIds, _iterator11, _step11, _step11$value, id, body;
2170
2153
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2171
2154
  while (1) switch (_context22.prev = _context22.next) {
2172
2155
  case 0:
@@ -2184,19 +2167,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2184
2167
  }
2185
2168
  return p;
2186
2169
  });
2187
- _iterator12 = _createForOfIteratorHelper(bodyUpdates);
2170
+ _iterator11 = _createForOfIteratorHelper(bodyUpdates);
2188
2171
  try {
2189
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2190
- _step12$value = _slicedToArray(_step12.value, 2), id = _step12$value[0], body = _step12$value[1];
2172
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2173
+ _step11$value = _slicedToArray(_step11.value, 2), id = _step11$value[0], body = _step11$value[1];
2191
2174
  if (!appliedIds.has(id)) {
2192
2175
  this.store.list.push(body);
2193
2176
  newCount++;
2194
2177
  }
2195
2178
  }
2196
2179
  } catch (err) {
2197
- _iterator12.e(err);
2180
+ _iterator11.e(err);
2198
2181
  } finally {
2199
- _iterator12.f();
2182
+ _iterator11.f();
2200
2183
  }
2201
2184
  this.syncProductsMap();
2202
2185
  _context22.next = 10;
@@ -2229,21 +2212,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2229
2212
  key: "mergeProductsToStore",
2230
2213
  value: (function () {
2231
2214
  var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(freshProducts) {
2232
- var freshMap, _iterator13, _step13, p, updatedList, newCount, _iterator14, _step14, _p2, updatedCount;
2215
+ var freshMap, _iterator12, _step12, p, updatedList, newCount, _iterator13, _step13, _p2, updatedCount;
2233
2216
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2234
2217
  while (1) switch (_context23.prev = _context23.next) {
2235
2218
  case 0:
2236
2219
  freshMap = new Map();
2237
- _iterator13 = _createForOfIteratorHelper(freshProducts);
2220
+ _iterator12 = _createForOfIteratorHelper(freshProducts);
2238
2221
  try {
2239
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2240
- p = _step13.value;
2222
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2223
+ p = _step12.value;
2241
2224
  freshMap.set(p.id, p);
2242
2225
  }
2243
2226
  } catch (err) {
2244
- _iterator13.e(err);
2227
+ _iterator12.e(err);
2245
2228
  } finally {
2246
- _iterator13.f();
2229
+ _iterator12.f();
2247
2230
  }
2248
2231
  updatedList = this.store.list.map(function (p) {
2249
2232
  if (freshMap.has(p.id)) {
@@ -2254,16 +2237,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2254
2237
  return p;
2255
2238
  }); // freshMap 中剩余的是新商品(create 场景)
2256
2239
  newCount = freshMap.size;
2257
- _iterator14 = _createForOfIteratorHelper(freshMap.values());
2240
+ _iterator13 = _createForOfIteratorHelper(freshMap.values());
2258
2241
  try {
2259
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2260
- _p2 = _step14.value;
2242
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2243
+ _p2 = _step13.value;
2261
2244
  updatedList.push(_p2);
2262
2245
  }
2263
2246
  } catch (err) {
2264
- _iterator14.e(err);
2247
+ _iterator13.e(err);
2265
2248
  } finally {
2266
- _iterator14.f();
2249
+ _iterator13.f();
2267
2250
  }
2268
2251
  updatedCount = freshProducts.length - newCount;
2269
2252
  this.store.list = updatedList;