@pisell/pisellos 0.0.490 → 0.0.492

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 (157) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/model/strategy/adapter/index.d.ts +2 -0
  4. package/dist/model/strategy/adapter/index.js +3 -1
  5. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  6. package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
  7. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  8. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  9. package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  10. package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
  11. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  12. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  13. package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
  14. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  15. package/dist/model/strategy/adapter/walletPass/utils.js +2 -2
  16. package/dist/modules/OpenData/index.d.ts +23 -0
  17. package/dist/modules/OpenData/index.js +167 -0
  18. package/dist/modules/OpenData/types.d.ts +73 -0
  19. package/dist/modules/OpenData/types.js +1 -0
  20. package/dist/modules/OpenData/utils.d.ts +2 -0
  21. package/dist/modules/OpenData/utils.js +75 -0
  22. package/dist/modules/Order/index.d.ts +53 -1
  23. package/dist/modules/Order/index.js +717 -27
  24. package/dist/modules/Order/types.d.ts +144 -12
  25. package/dist/modules/Order/utils.d.ts +25 -0
  26. package/dist/modules/Order/utils.js +214 -1
  27. package/dist/modules/Product/utils.js +2 -2
  28. package/dist/modules/ProductList/index.d.ts +1 -1
  29. package/dist/modules/ProductList/index.js +3 -1
  30. package/dist/modules/Quotation/index.d.ts +40 -0
  31. package/dist/modules/Quotation/index.js +212 -0
  32. package/dist/modules/Quotation/types.d.ts +42 -0
  33. package/dist/modules/Quotation/types.js +1 -0
  34. package/dist/modules/Rules/index.js +2 -2
  35. package/dist/modules/SalesSummary/index.d.ts +63 -0
  36. package/dist/modules/SalesSummary/index.js +174 -0
  37. package/dist/modules/SalesSummary/types.d.ts +59 -0
  38. package/dist/modules/SalesSummary/types.js +1 -0
  39. package/dist/modules/SalesSummary/utils.d.ts +30 -0
  40. package/dist/modules/SalesSummary/utils.js +506 -0
  41. package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
  42. package/dist/modules/ScanOrderLogger/index.js +161 -0
  43. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  44. package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
  45. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  46. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  47. package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
  48. package/dist/modules/ScanOrderLogger/types.js +1 -0
  49. package/dist/modules/Summary/utils.d.ts +3 -3
  50. package/dist/modules/Summary/utils.js +4 -4
  51. package/dist/modules/index.d.ts +4 -0
  52. package/dist/modules/index.js +5 -1
  53. package/dist/solution/BookingByStep/index.d.ts +1 -1
  54. package/dist/solution/BookingByStep/types.d.ts +3 -1
  55. package/dist/solution/BookingByStep/types.js +5 -1
  56. package/dist/solution/ScanOrder/index.d.ts +90 -0
  57. package/dist/solution/ScanOrder/index.js +1853 -0
  58. package/dist/solution/ScanOrder/types.d.ts +210 -0
  59. package/dist/solution/ScanOrder/types.js +16 -0
  60. package/dist/solution/ScanOrder/utils.d.ts +93 -0
  61. package/dist/solution/ScanOrder/utils.js +378 -0
  62. package/dist/solution/VenueBooking/index.d.ts +159 -0
  63. package/dist/solution/VenueBooking/index.js +2773 -0
  64. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  65. package/dist/solution/VenueBooking/types.d.ts +123 -0
  66. package/dist/solution/VenueBooking/types.js +21 -0
  67. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  68. package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
  69. package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
  70. package/dist/solution/VenueBooking/utils/resource.js +94 -0
  71. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +18 -0
  72. package/dist/solution/VenueBooking/utils/slotMerge.js +128 -0
  73. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  74. package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
  75. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  76. package/dist/solution/VenueBooking/utils.js +1 -0
  77. package/dist/solution/index.d.ts +2 -0
  78. package/dist/solution/index.js +3 -1
  79. package/lib/apis/picoding.d.ts +0 -0
  80. package/lib/apis/picoding.js +0 -0
  81. package/lib/model/strategy/adapter/index.d.ts +2 -0
  82. package/lib/model/strategy/adapter/index.js +6 -0
  83. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  84. package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
  85. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  86. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  87. package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  88. package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
  89. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  90. package/lib/model/strategy/adapter/itemRule/index.js +58 -0
  91. package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
  92. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  93. package/lib/model/strategy/adapter/walletPass/utils.js +2 -2
  94. package/lib/modules/OpenData/index.d.ts +23 -0
  95. package/lib/modules/OpenData/index.js +116 -0
  96. package/lib/modules/OpenData/types.d.ts +73 -0
  97. package/lib/modules/OpenData/types.js +17 -0
  98. package/lib/modules/OpenData/utils.d.ts +2 -0
  99. package/lib/modules/OpenData/utils.js +111 -0
  100. package/lib/modules/Order/index.d.ts +53 -1
  101. package/lib/modules/Order/index.js +389 -1
  102. package/lib/modules/Order/types.d.ts +144 -12
  103. package/lib/modules/Order/utils.d.ts +25 -0
  104. package/lib/modules/Order/utils.js +217 -0
  105. package/lib/modules/Product/utils.js +2 -2
  106. package/lib/modules/ProductList/index.d.ts +1 -1
  107. package/lib/modules/ProductList/index.js +2 -1
  108. package/lib/modules/Quotation/index.d.ts +40 -0
  109. package/lib/modules/Quotation/index.js +128 -0
  110. package/lib/modules/Quotation/types.d.ts +42 -0
  111. package/lib/modules/Quotation/types.js +17 -0
  112. package/lib/modules/Rules/index.js +1 -1
  113. package/lib/modules/SalesSummary/index.d.ts +63 -0
  114. package/lib/modules/SalesSummary/index.js +105 -0
  115. package/lib/modules/SalesSummary/types.d.ts +59 -0
  116. package/lib/modules/SalesSummary/types.js +17 -0
  117. package/lib/modules/SalesSummary/utils.d.ts +30 -0
  118. package/lib/modules/SalesSummary/utils.js +445 -0
  119. package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
  120. package/lib/modules/ScanOrderLogger/index.js +135 -0
  121. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  122. package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
  123. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  124. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  125. package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
  126. package/lib/modules/ScanOrderLogger/types.js +17 -0
  127. package/lib/modules/Summary/utils.d.ts +3 -3
  128. package/lib/modules/Summary/utils.js +4 -4
  129. package/lib/modules/index.d.ts +4 -0
  130. package/lib/modules/index.js +9 -1
  131. package/lib/solution/BookingByStep/index.d.ts +1 -1
  132. package/lib/solution/BookingByStep/types.d.ts +3 -1
  133. package/lib/solution/BookingByStep/types.js +10 -0
  134. package/lib/solution/ScanOrder/index.d.ts +90 -0
  135. package/lib/solution/ScanOrder/index.js +1071 -0
  136. package/lib/solution/ScanOrder/types.d.ts +210 -0
  137. package/lib/solution/ScanOrder/types.js +36 -0
  138. package/lib/solution/ScanOrder/utils.d.ts +93 -0
  139. package/lib/solution/ScanOrder/utils.js +342 -0
  140. package/lib/solution/VenueBooking/index.d.ts +159 -0
  141. package/lib/solution/VenueBooking/index.js +1508 -0
  142. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  143. package/lib/solution/VenueBooking/types.d.ts +123 -0
  144. package/lib/solution/VenueBooking/types.js +44 -0
  145. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  146. package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
  147. package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
  148. package/lib/solution/VenueBooking/utils/resource.js +80 -0
  149. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +18 -0
  150. package/lib/solution/VenueBooking/utils/slotMerge.js +156 -0
  151. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  152. package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
  153. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  154. package/lib/solution/VenueBooking/utils.js +69 -0
  155. package/lib/solution/index.d.ts +2 -0
  156. package/lib/solution/index.js +5 -1
  157. package/package.json +1 -1
@@ -24,14 +24,17 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
25
25
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
26
  import { BaseModule } from "../BaseModule";
27
- import { generateDuration, getAllDiscountList, mergeRelationForms } from "./utils";
27
+ import { generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createEmptySummary, formatDateTime, formatV1Product, isTempOrder } from "./utils";
28
28
  import { isNormalProduct } from "../Product/utils";
29
29
  import dayjs from 'dayjs';
30
+ import { getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
31
+ import { DiscountModule } from "../Discount";
32
+ import { RulesModule } from "../Rules";
33
+ import { UnavailableReason } from "../Rules/types";
34
+ import Decimal from 'decimal.js';
30
35
  export var OrderModule = /*#__PURE__*/function (_BaseModule) {
31
36
  _inherits(OrderModule, _BaseModule);
32
37
  var _super = _createSuper(OrderModule);
33
- // LoggerManager 实例
34
-
35
38
  function OrderModule(name, version) {
36
39
  var _this;
37
40
  _classCallCheck(this, OrderModule);
@@ -41,19 +44,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
41
44
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
42
45
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
43
46
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
47
+ // LoggerManager 实例
48
+ _defineProperty(_assertThisInitialized(_this), "window", void 0);
49
+ _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
50
+ _defineProperty(_assertThisInitialized(_this), "salesSummaryModuleName", void 0);
51
+ _defineProperty(_assertThisInitialized(_this), "rulesHooksOverride", void 0);
44
52
  return _this;
45
53
  }
46
54
  _createClass(OrderModule, [{
47
55
  key: "initialize",
48
56
  value: function () {
49
57
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
50
- var appPlugin, app;
58
+ var _otherParams$rules;
59
+ var otherParams, appPlugin, app;
51
60
  return _regeneratorRuntime().wrap(function _callee$(_context) {
52
61
  while (1) switch (_context.prev = _context.next) {
53
62
  case 0:
54
63
  this.core = core;
55
64
  this.store = options.store;
65
+ if (!this.store.tempOrder) {
66
+ this.store.tempOrder = null;
67
+ }
56
68
  this.request = this.core.getPlugin('request');
69
+ this.window = this.core.getPlugin('window');
70
+ otherParams = options.otherParams || {};
71
+ this.cacheId = otherParams.cacheId;
72
+ this.salesSummaryModuleName = otherParams.salesSummaryModuleName;
73
+ this.rulesHooksOverride = (_otherParams$rules = otherParams.rules) === null || _otherParams$rules === void 0 ? void 0 : _otherParams$rules.hooks;
74
+ this.registerDiscountModules(options);
75
+ this.restoreTempOrderFromStorage();
57
76
  appPlugin = this.core.getPlugin('app');
58
77
  if (!appPlugin) {
59
78
  console.warn('Order 模块需要 app 插件支持');
@@ -61,7 +80,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
61
80
  app = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp();
62
81
  if (app) this.logger = app.logger;
63
82
  this.logInfo('OrderModule initialized successfully');
64
- case 8:
83
+ case 16:
65
84
  case "end":
66
85
  return _context.stop();
67
86
  }
@@ -116,6 +135,629 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
116
135
  });
117
136
  }
118
137
  }
138
+
139
+ // ─── Discount: 子模块注册 ───
140
+ }, {
141
+ key: "registerDiscountModules",
142
+ value: function registerDiscountModules(options) {
143
+ var discount = new DiscountModule("".concat(this.name, "_discount"));
144
+ this.core.registerModule(discount, {
145
+ otherParams: {
146
+ fatherModule: this.name
147
+ }
148
+ });
149
+ this.store.discount = discount;
150
+ var rules = new RulesModule("".concat(this.name, "_rules"));
151
+ this.core.registerModule(rules, {
152
+ hooks: this.rulesHooksOverride || this.createDefaultRulesHooks()
153
+ });
154
+ this.store.rules = rules;
155
+ }
156
+ }, {
157
+ key: "createDefaultRulesHooks",
158
+ value: function createDefaultRulesHooks() {
159
+ return {
160
+ getProduct: function getProduct(product) {
161
+ var _product$_origin, _product$_origin2, _product$_origin3, _product$_origin4;
162
+ return {
163
+ id: product.product_id,
164
+ _id: product.identity_key ? "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(product.identity_key) : "".concat(product.product_id, "_").concat(product.product_variant_id),
165
+ price: product.selling_price,
166
+ total: new Decimal(product.payment_price || product.selling_price || 0).times(product.num || 1).toNumber(),
167
+ origin_total: new Decimal(product.original_price || product.selling_price || 0).times(product.num || 1).toNumber(),
168
+ original_price: product.original_price,
169
+ quantity: product.num || 1,
170
+ num: product.num || 1,
171
+ discount_list: product.discount_list || [],
172
+ bundle: product.product_bundle || [],
173
+ booking_id: ((_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.booking_id) || null,
174
+ isClient: false,
175
+ isManualDiscount: ((_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.isManualDiscount) || false,
176
+ holder_id: (_product$_origin3 = product._origin) === null || _product$_origin3 === void 0 ? void 0 : _product$_origin3.holder_id,
177
+ startDate: (_product$_origin4 = product._origin) === null || _product$_origin4 === void 0 ? void 0 : _product$_origin4.startDate
178
+ };
179
+ },
180
+ setProduct: function setProduct(product, values) {
181
+ var _values$discount_list, _values$quantity, _values$bundle;
182
+ return _objectSpread(_objectSpread({}, product), {}, {
183
+ selling_price: values.price !== undefined ? String(values.price) : product.selling_price,
184
+ payment_price: values.total !== undefined ? String(values.total) : product.payment_price,
185
+ original_price: values.original_price !== undefined ? String(values.original_price) : product.original_price,
186
+ discount_list: (_values$discount_list = values.discount_list) !== null && _values$discount_list !== void 0 ? _values$discount_list : product.discount_list,
187
+ num: (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num,
188
+ product_bundle: (_values$bundle = values.bundle) !== null && _values$bundle !== void 0 ? _values$bundle : product.product_bundle
189
+ });
190
+ }
191
+ };
192
+ }
193
+
194
+ // ─── Discount: 公共 API ───
195
+ }, {
196
+ key: "loadDiscountConfig",
197
+ value: function () {
198
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
199
+ var _this$store$discount, _this$store$tempOrder;
200
+ var discountList, _this$store$discount2;
201
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
202
+ while (1) switch (_context2.prev = _context2.next) {
203
+ case 0:
204
+ _context2.next = 2;
205
+ return (_this$store$discount = this.store.discount) === null || _this$store$discount === void 0 ? void 0 : _this$store$discount.loadPrepareConfig({
206
+ customer_id: params.customerId,
207
+ action: params.action || 'create',
208
+ with_good_pass: 1,
209
+ with_discount_card: 1,
210
+ with_wallet_pass_holder: 1,
211
+ request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
212
+ });
213
+ case 2:
214
+ discountList = _context2.sent;
215
+ if (discountList) {
216
+ (_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 || _this$store$discount2.setDiscountList(discountList);
217
+ }
218
+ if ((_this$store$tempOrder = this.store.tempOrder) !== null && _this$store$tempOrder !== void 0 && (_this$store$tempOrder = _this$store$tempOrder.products) !== null && _this$store$tempOrder !== void 0 && _this$store$tempOrder.length) {
219
+ this.applyDiscount();
220
+ }
221
+ case 5:
222
+ case "end":
223
+ return _context2.stop();
224
+ }
225
+ }, _callee2, this);
226
+ }));
227
+ function loadDiscountConfig(_x3) {
228
+ return _loadDiscountConfig.apply(this, arguments);
229
+ }
230
+ return loadDiscountConfig;
231
+ }()
232
+ }, {
233
+ key: "getDiscountList",
234
+ value: function getDiscountList() {
235
+ var _this$store$discount3;
236
+ return ((_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.getDiscountList()) || [];
237
+ }
238
+ }, {
239
+ key: "scanCode",
240
+ value: function () {
241
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(code, customerId) {
242
+ var _this$store$discount4, _tempOrder$holder, _tempOrder$holder2, _tempOrder$summary;
243
+ var resultDiscountList, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref, isAvailable, newDiscountList, unavailableReason, _this$store$discount5;
244
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
245
+ while (1) switch (_context3.prev = _context3.next) {
246
+ case 0:
247
+ _context3.next = 2;
248
+ return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.batchSearch(code, {
249
+ customerId: customerId
250
+ });
251
+ case 2:
252
+ _context3.t0 = _context3.sent;
253
+ if (_context3.t0) {
254
+ _context3.next = 5;
255
+ break;
256
+ }
257
+ _context3.t0 = [];
258
+ case 5:
259
+ resultDiscountList = _context3.t0;
260
+ rulesModule = this.store.rules;
261
+ if (rulesModule) {
262
+ _context3.next = 9;
263
+ break;
264
+ }
265
+ return _context3.abrupt("return", {
266
+ type: 'clientCalc',
267
+ isAvailable: false,
268
+ discountList: this.getDiscountList(),
269
+ unavailableReason: UnavailableReason.Unknown
270
+ });
271
+ case 9:
272
+ if (resultDiscountList.length) {
273
+ _context3.next = 11;
274
+ break;
275
+ }
276
+ return _context3.abrupt("return", {
277
+ type: 'server',
278
+ isAvailable: false,
279
+ discountList: this.getDiscountList()
280
+ });
281
+ case 11:
282
+ withScanList = resultDiscountList.map(function (item) {
283
+ return _objectSpread(_objectSpread({}, item), {}, {
284
+ isScan: true
285
+ });
286
+ });
287
+ currentSelected = this.getDiscountList().filter(function (n) {
288
+ return n.isSelected;
289
+ });
290
+ if (!(currentSelected.length && currentSelected.some(function (n) {
291
+ return withScanList.some(function (m) {
292
+ return m.id === n.id;
293
+ });
294
+ }))) {
295
+ _context3.next = 15;
296
+ break;
297
+ }
298
+ return _context3.abrupt("return", {
299
+ type: 'clientCalc',
300
+ isAvailable: true,
301
+ discountList: this.getDiscountList()
302
+ });
303
+ case 15:
304
+ tempOrder = this.store.tempOrder;
305
+ holders = tempOrder !== null && tempOrder !== void 0 && (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
306
+ form_record_id: tempOrder.holder.form_record_id
307
+ }] : [];
308
+ _ref = rulesModule.isDiscountListAvailable({
309
+ productList: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
310
+ oldDiscountList: this.getDiscountList(),
311
+ newDiscountList: withScanList,
312
+ holders: holders,
313
+ isFormSubject: !!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
314
+ orderTotalAmount: Number((tempOrder === null || tempOrder === void 0 || (_tempOrder$summary = tempOrder.summary) === null || _tempOrder$summary === void 0 ? void 0 : _tempOrder$summary.total_amount) || 0)
315
+ }) || {
316
+ isAvailable: false,
317
+ discountList: this.getDiscountList()
318
+ }, isAvailable = _ref.isAvailable, newDiscountList = _ref.discountList, unavailableReason = _ref.unavailableReason;
319
+ if (isAvailable && newDiscountList) {
320
+ (_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 || _this$store$discount5.setDiscountList(newDiscountList);
321
+ this.applyDiscount();
322
+ }
323
+ return _context3.abrupt("return", {
324
+ type: 'clientCalc',
325
+ isAvailable: isAvailable || false,
326
+ discountList: newDiscountList || this.getDiscountList(),
327
+ unavailableReason: unavailableReason
328
+ });
329
+ case 20:
330
+ case "end":
331
+ return _context3.stop();
332
+ }
333
+ }, _callee3, this);
334
+ }));
335
+ function scanCode(_x4, _x5) {
336
+ return _scanCode.apply(this, arguments);
337
+ }
338
+ return scanCode;
339
+ }()
340
+ }, {
341
+ key: "applyDiscount",
342
+ value: function applyDiscount() {
343
+ var _tempOrder$products, _this$store$discount6, _tempOrder$holder3, _tempOrder$holder4, _tempOrder$summary2;
344
+ var tempOrder = this.store.tempOrder;
345
+ if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
346
+ var rulesModule = this.store.rules;
347
+ if (!rulesModule) return;
348
+ var discountList = ((_this$store$discount6 = this.store.discount) === null || _this$store$discount6 === void 0 ? void 0 : _this$store$discount6.getDiscountList()) || [];
349
+ var holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
350
+ form_record_id: tempOrder.holder.form_record_id
351
+ }] : [];
352
+ var result = rulesModule.calcDiscount({
353
+ productList: tempOrder.products,
354
+ discountList: discountList,
355
+ holders: holders,
356
+ isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
357
+ orderTotalAmount: Number((tempOrder === null || tempOrder === void 0 || (_tempOrder$summary2 = tempOrder.summary) === null || _tempOrder$summary2 === void 0 ? void 0 : _tempOrder$summary2.total_amount) || 0)
358
+ });
359
+ if (result !== null && result !== void 0 && result.productList) {
360
+ tempOrder.products = result.productList;
361
+ }
362
+ if (result !== null && result !== void 0 && result.discountList) {
363
+ var _this$store$discount7;
364
+ (_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 || _this$store$discount7.setDiscountList(result.discountList);
365
+ tempOrder.discount_list = result.discountList.filter(function (d) {
366
+ return d.isSelected;
367
+ });
368
+ }
369
+ }
370
+
371
+ // ─── TempOrder: 初始化入口 ───
372
+ }, {
373
+ key: "initTempOrder",
374
+ value: function initTempOrder(params) {
375
+ if (params.cacheId !== undefined) this.cacheId = params.cacheId;
376
+ if (params.salesSummaryModuleName !== undefined) this.salesSummaryModuleName = params.salesSummaryModuleName;
377
+ this.restoreTempOrderFromStorage();
378
+ }
379
+
380
+ // ─── TempOrder: localStorage 持久化 ───
381
+ }, {
382
+ key: "getTempOrderStorageKey",
383
+ value: function getTempOrderStorageKey() {
384
+ if (!this.cacheId) return null;
385
+ return "scanOrder:tempOrder:".concat(this.cacheId);
386
+ }
387
+ }, {
388
+ key: "restoreTempOrderFromStorage",
389
+ value: function restoreTempOrderFromStorage() {
390
+ var key = this.getTempOrderStorageKey();
391
+ if (!key) return;
392
+ if (!this.window) return;
393
+ var cachedData = this.window.localStorage.getItem(key);
394
+ if (!cachedData) return;
395
+ try {
396
+ var parsedData = JSON.parse(cachedData);
397
+ if (!isTempOrder(parsedData)) {
398
+ this.window.localStorage.removeItem(key);
399
+ return;
400
+ }
401
+ this.store.tempOrder = parsedData;
402
+ } catch (_unused) {
403
+ var _this$window;
404
+ (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.localStorage) === null || _this$window === void 0 || _this$window.removeItem(key);
405
+ }
406
+ }
407
+ }, {
408
+ key: "persistTempOrder",
409
+ value: function persistTempOrder() {
410
+ var key = this.getTempOrderStorageKey();
411
+ if (!key || !this.store.tempOrder) return;
412
+ if (!this.window) return;
413
+ this.window.localStorage.setItem(key, JSON.stringify(this.store.tempOrder));
414
+ }
415
+
416
+ // ─── TempOrder: 创建 & 获取 ───
417
+ }, {
418
+ key: "createDefaultTempOrderInstance",
419
+ value: function createDefaultTempOrderInstance() {
420
+ return createDefaultTempOrder({
421
+ now: formatDateTime(new Date()),
422
+ summary: createEmptySummary()
423
+ });
424
+ }
425
+ }, {
426
+ key: "ensureTempOrder",
427
+ value: function ensureTempOrder() {
428
+ if (this.store.tempOrder) return this.store.tempOrder;
429
+ var newOrder = this.createDefaultTempOrderInstance();
430
+ this.store.tempOrder = newOrder;
431
+ this.persistTempOrder();
432
+ return newOrder;
433
+ }
434
+ }, {
435
+ key: "getTempOrder",
436
+ value: function getTempOrder() {
437
+ return this.store.tempOrder;
438
+ }
439
+ }, {
440
+ key: "addNewOrder",
441
+ value: function () {
442
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
443
+ var tempOrder;
444
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
445
+ while (1) switch (_context4.prev = _context4.next) {
446
+ case 0:
447
+ tempOrder = this.ensureTempOrder();
448
+ _context4.next = 3;
449
+ return this.recalculateSummary({
450
+ createIfMissing: true
451
+ });
452
+ case 3:
453
+ this.persistTempOrder();
454
+ return _context4.abrupt("return", tempOrder);
455
+ case 5:
456
+ case "end":
457
+ return _context4.stop();
458
+ }
459
+ }, _callee4, this);
460
+ }));
461
+ function addNewOrder() {
462
+ return _addNewOrder.apply(this, arguments);
463
+ }
464
+ return addNewOrder;
465
+ }()
466
+ }, {
467
+ key: "getOrderProducts",
468
+ value: function getOrderProducts() {
469
+ var tempOrder = this.ensureTempOrder();
470
+ return tempOrder.products;
471
+ }
472
+
473
+ // ─── TempOrder: 金额汇总 ───
474
+ }, {
475
+ key: "getSalesSummary",
476
+ value: function getSalesSummary() {
477
+ if (!this.salesSummaryModuleName) return null;
478
+ return this.core.getModule(this.salesSummaryModuleName);
479
+ }
480
+ }, {
481
+ key: "recalculateSummary",
482
+ value: function () {
483
+ var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(options) {
484
+ var tempOrder, salesSummary, summary;
485
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
486
+ while (1) switch (_context5.prev = _context5.next) {
487
+ case 0:
488
+ tempOrder = options !== null && options !== void 0 && options.createIfMissing ? this.ensureTempOrder() : this.store.tempOrder;
489
+ if (tempOrder) {
490
+ _context5.next = 3;
491
+ break;
492
+ }
493
+ return _context5.abrupt("return", null);
494
+ case 3:
495
+ salesSummary = this.getSalesSummary();
496
+ if (salesSummary) {
497
+ _context5.next = 8;
498
+ break;
499
+ }
500
+ tempOrder.summary = createEmptySummary();
501
+ tempOrder.surcharge_fee = tempOrder.summary.surcharge_fee;
502
+ return _context5.abrupt("return", tempOrder.summary);
503
+ case 8:
504
+ _context5.next = 10;
505
+ return salesSummary.getSummary({
506
+ products: tempOrder.products
507
+ });
508
+ case 10:
509
+ summary = _context5.sent;
510
+ tempOrder.summary = summary;
511
+ if (summary.is_price_include_tax !== undefined) {
512
+ tempOrder.is_price_include_tax = summary.is_price_include_tax;
513
+ }
514
+ if (typeof summary.tax_title === 'string') {
515
+ tempOrder.tax_title = summary.tax_title;
516
+ }
517
+ tempOrder.surcharge_fee = summary.surcharge_fee;
518
+ tempOrder.surcharges = summary.surcharges || [];
519
+ tempOrder.deposit_amount = summary.deposit_amount || '0.00';
520
+ tempOrder.is_deposit = summary.deposit_amount !== '0.00' ? 1 : 0;
521
+ tempOrder.shop_discount = summary.discount_amount || '0.00';
522
+ return _context5.abrupt("return", tempOrder.summary);
523
+ case 20:
524
+ case "end":
525
+ return _context5.stop();
526
+ }
527
+ }, _callee5, this);
528
+ }));
529
+ function recalculateSummary(_x6) {
530
+ return _recalculateSummary.apply(this, arguments);
531
+ }
532
+ return recalculateSummary;
533
+ }()
534
+ }, {
535
+ key: "getScanOrderSummary",
536
+ value: function () {
537
+ var _getScanOrderSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
538
+ var summary;
539
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
540
+ while (1) switch (_context6.prev = _context6.next) {
541
+ case 0:
542
+ _context6.next = 2;
543
+ return this.recalculateSummary({
544
+ createIfMissing: true
545
+ });
546
+ case 2:
547
+ summary = _context6.sent;
548
+ if (summary) {
549
+ _context6.next = 5;
550
+ break;
551
+ }
552
+ return _context6.abrupt("return", createEmptySummary());
553
+ case 5:
554
+ this.persistTempOrder();
555
+ return _context6.abrupt("return", summary);
556
+ case 7:
557
+ case "end":
558
+ return _context6.stop();
559
+ }
560
+ }, _callee6, this);
561
+ }));
562
+ function getScanOrderSummary() {
563
+ return _getScanOrderSummary.apply(this, arguments);
564
+ }
565
+ return getScanOrderSummary;
566
+ }() // ─── TempOrder: 备注 ───
567
+ }, {
568
+ key: "updateTempOrderNote",
569
+ value: function updateTempOrderNote(note) {
570
+ var tempOrder = this.ensureTempOrder();
571
+ tempOrder.note = String(note || '');
572
+ this.persistTempOrder();
573
+ return tempOrder.note;
574
+ }
575
+ }, {
576
+ key: "updateTempOrderContactsInfo",
577
+ value: function updateTempOrderContactsInfo(contactsInfo) {
578
+ var tempOrder = this.ensureTempOrder();
579
+ tempOrder.contacts_info = Array.isArray(contactsInfo) ? contactsInfo : [];
580
+ this.persistTempOrder();
581
+ return tempOrder.contacts_info;
582
+ }
583
+
584
+ // ─── TempOrder: 商品 CRUD ───
585
+ }, {
586
+ key: "addProductToOrder",
587
+ value: function () {
588
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(product) {
589
+ var tempOrder, normalizedProduct, productIndex, targetProduct;
590
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
591
+ while (1) switch (_context7.prev = _context7.next) {
592
+ case 0:
593
+ tempOrder = this.ensureTempOrder();
594
+ normalizedProduct = normalizeOrderProduct(product);
595
+ productIndex = getProductIdentityIndex(tempOrder.products, normalizedProduct);
596
+ if (productIndex === -1) {
597
+ tempOrder.products.push(normalizedProduct);
598
+ } else {
599
+ targetProduct = tempOrder.products[productIndex];
600
+ tempOrder.products[productIndex] = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), normalizedProduct), {}, {
601
+ num: getSafeProductNum(targetProduct.num + normalizedProduct.num),
602
+ _origin: normalizedProduct._origin || targetProduct._origin
603
+ });
604
+ }
605
+ this.applyDiscount();
606
+ _context7.next = 7;
607
+ return this.recalculateSummary({
608
+ createIfMissing: true
609
+ });
610
+ case 7:
611
+ this.persistTempOrder();
612
+ return _context7.abrupt("return", tempOrder.products);
613
+ case 9:
614
+ case "end":
615
+ return _context7.stop();
616
+ }
617
+ }, _callee7, this);
618
+ }));
619
+ function addProductToOrder(_x7) {
620
+ return _addProductToOrder.apply(this, arguments);
621
+ }
622
+ return addProductToOrder;
623
+ }()
624
+ }, {
625
+ key: "updateProductInOrder",
626
+ value: function () {
627
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
628
+ var product_id, product_variant_id, updates, tempOrder, productIndex, targetProduct, nextProduct;
629
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
630
+ while (1) switch (_context8.prev = _context8.next) {
631
+ case 0:
632
+ product_id = params.product_id, product_variant_id = params.product_variant_id, updates = params.updates;
633
+ tempOrder = this.ensureTempOrder();
634
+ productIndex = getProductIdentityIndex(tempOrder.products, {
635
+ product_id: product_id,
636
+ product_variant_id: product_variant_id
637
+ });
638
+ if (!(productIndex === -1)) {
639
+ _context8.next = 5;
640
+ break;
641
+ }
642
+ throw new Error('[Order] 目标商品不存在,无法更新');
643
+ case 5:
644
+ targetProduct = tempOrder.products[productIndex];
645
+ nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), updates), {}, {
646
+ product_id: product_id,
647
+ product_variant_id: product_variant_id
648
+ });
649
+ nextProduct.num = getSafeProductNum(nextProduct.num);
650
+ tempOrder.products[productIndex] = nextProduct;
651
+ this.applyDiscount();
652
+ _context8.next = 12;
653
+ return this.recalculateSummary({
654
+ createIfMissing: true
655
+ });
656
+ case 12:
657
+ this.persistTempOrder();
658
+ return _context8.abrupt("return", tempOrder.products);
659
+ case 14:
660
+ case "end":
661
+ return _context8.stop();
662
+ }
663
+ }, _callee8, this);
664
+ }));
665
+ function updateProductInOrder(_x8) {
666
+ return _updateProductInOrder.apply(this, arguments);
667
+ }
668
+ return updateProductInOrder;
669
+ }()
670
+ }, {
671
+ key: "removeProductFromOrder",
672
+ value: function () {
673
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(identity) {
674
+ var tempOrder;
675
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
676
+ while (1) switch (_context9.prev = _context9.next) {
677
+ case 0:
678
+ tempOrder = this.ensureTempOrder();
679
+ tempOrder.products = tempOrder.products.filter(function (item) {
680
+ return !isIdentityMatch(item, identity);
681
+ });
682
+ this.applyDiscount();
683
+ _context9.next = 5;
684
+ return this.recalculateSummary({
685
+ createIfMissing: true
686
+ });
687
+ case 5:
688
+ this.persistTempOrder();
689
+ return _context9.abrupt("return", tempOrder.products);
690
+ case 7:
691
+ case "end":
692
+ return _context9.stop();
693
+ }
694
+ }, _callee9, this);
695
+ }));
696
+ function removeProductFromOrder(_x9) {
697
+ return _removeProductFromOrder.apply(this, arguments);
698
+ }
699
+ return removeProductFromOrder;
700
+ }() // ─── TempOrder: 提交 ───
701
+ }, {
702
+ key: "submitTempOrder",
703
+ value: function () {
704
+ var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
705
+ var _params$cacheId;
706
+ var tempOrder, effectiveCacheId, payload, result, products, moreResult;
707
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
708
+ while (1) switch (_context10.prev = _context10.next) {
709
+ case 0:
710
+ tempOrder = this.ensureTempOrder();
711
+ this.persistTempOrder();
712
+ effectiveCacheId = (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId;
713
+ payload = buildSubmitPayload({
714
+ tempOrder: tempOrder,
715
+ cacheId: effectiveCacheId
716
+ });
717
+ if (!tempOrder.order_id) {
718
+ _context10.next = 12;
719
+ break;
720
+ }
721
+ products = formatV1Product(payload.products);
722
+ _context10.next = 8;
723
+ return this.scanOrderMore({
724
+ query: {
725
+ order_id: tempOrder.order_id,
726
+ products: products,
727
+ request_unique_idempotency_token: payload.request_unique_idempotency_token
728
+ }
729
+ });
730
+ case 8:
731
+ moreResult = _context10.sent;
732
+ if (moreResult.code === 200) {
733
+ result = {
734
+ data: {
735
+ order_id: tempOrder.order_id
736
+ }
737
+ };
738
+ }
739
+ _context10.next = 15;
740
+ break;
741
+ case 12:
742
+ _context10.next = 14;
743
+ return this.submitScanOrder({
744
+ query: payload
745
+ });
746
+ case 14:
747
+ result = _context10.sent;
748
+ case 15:
749
+ return _context10.abrupt("return", result);
750
+ case 16:
751
+ case "end":
752
+ return _context10.stop();
753
+ }
754
+ }, _callee10, this);
755
+ }));
756
+ function submitTempOrder(_x10) {
757
+ return _submitTempOrder.apply(this, arguments);
758
+ }
759
+ return submitTempOrder;
760
+ }()
119
761
  }, {
120
762
  key: "createOrder",
121
763
  value: function createOrder(params) {
@@ -200,11 +842,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
200
842
  }, {
201
843
  key: "submitOrder",
202
844
  value: function () {
203
- var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(order) {
845
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(order) {
204
846
  var _order$query$cartItem, _params$bookings, _params$relation_prod;
205
847
  var url, query, fetchUrl, params;
206
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
207
- while (1) switch (_context2.prev = _context2.next) {
848
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
849
+ while (1) switch (_context11.prev = _context11.next) {
208
850
  case 0:
209
851
  this.logInfo('submitOrder called', {
210
852
  url: order.url,
@@ -224,14 +866,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
224
866
  relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
225
867
  scheduleDate: params.schedule_date
226
868
  });
227
- return _context2.abrupt("return", this.request.post(fetchUrl, params));
869
+ return _context11.abrupt("return", this.request.post(fetchUrl, params));
228
870
  case 6:
229
871
  case "end":
230
- return _context2.stop();
872
+ return _context11.stop();
231
873
  }
232
- }, _callee2, this);
874
+ }, _callee11, this);
233
875
  }));
234
- function submitOrder(_x3) {
876
+ function submitOrder(_x11) {
235
877
  return _submitOrder.apply(this, arguments);
236
878
  }
237
879
  return submitOrder;
@@ -249,11 +891,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
249
891
  }, {
250
892
  key: "createOrderByCheckout",
251
893
  value: (function () {
252
- var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
894
+ var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
253
895
  var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
254
896
  var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
255
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
256
- while (1) switch (_context3.prev = _context3.next) {
897
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
898
+ while (1) switch (_context12.prev = _context12.next) {
257
899
  case 0:
258
900
  // 过滤掉由在线店铺下单的 payment 支付数据
259
901
  onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
@@ -287,7 +929,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
287
929
  relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
288
930
  paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
289
931
  });
290
- _context3.prev = 4;
932
+ _context12.prev = 4;
291
933
  // 构建订单数据,设置默认值并允许 params 覆盖
292
934
  orderData = _objectSpread({
293
935
  sales_channel: 'my_pisel',
@@ -351,10 +993,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
351
993
  });
352
994
 
353
995
  // 调用后端接口
354
- _context3.next = 12;
996
+ _context12.next = 12;
355
997
  return this.request.post('/order/checkout', orderData);
356
998
  case 12:
357
- response = _context3.sent;
999
+ response = _context12.sent;
358
1000
  this.logInfo('Order API called successfully', {
359
1001
  response: response
360
1002
  });
@@ -362,26 +1004,74 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
362
1004
  success: !!response,
363
1005
  hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
364
1006
  });
365
- return _context3.abrupt("return", response);
1007
+ return _context12.abrupt("return", response);
366
1008
  case 18:
367
- _context3.prev = 18;
368
- _context3.t0 = _context3["catch"](4);
369
- console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
1009
+ _context12.prev = 18;
1010
+ _context12.t0 = _context12["catch"](4);
1011
+ console.error('[Order] createOrderByCheckout 创建订单失败:', _context12.t0);
370
1012
  this.logInfo('Order API called failed', {
371
- error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
1013
+ error: _context12.t0 instanceof Error ? _context12.t0.message : String(_context12.t0)
372
1014
  });
373
- throw _context3.t0;
1015
+ throw _context12.t0;
374
1016
  case 23:
375
1017
  case "end":
376
- return _context3.stop();
1018
+ return _context12.stop();
377
1019
  }
378
- }, _callee3, this, [[4, 18]]);
1020
+ }, _callee12, this, [[4, 18]]);
379
1021
  }));
380
- function createOrderByCheckout(_x4) {
1022
+ function createOrderByCheckout(_x12) {
381
1023
  return _createOrderByCheckout.apply(this, arguments);
382
1024
  }
383
1025
  return createOrderByCheckout;
384
1026
  }())
1027
+ }, {
1028
+ key: "submitScanOrder",
1029
+ value: function () {
1030
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1031
+ var url, query, fetchUrl;
1032
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1033
+ while (1) switch (_context13.prev = _context13.next) {
1034
+ case 0:
1035
+ url = params.url, query = params.query;
1036
+ fetchUrl = url || '/order/sales/checkout';
1037
+ return _context13.abrupt("return", this.request.post(fetchUrl, query));
1038
+ case 3:
1039
+ case "end":
1040
+ return _context13.stop();
1041
+ }
1042
+ }, _callee13, this);
1043
+ }));
1044
+ function submitScanOrder(_x13) {
1045
+ return _submitScanOrder.apply(this, arguments);
1046
+ }
1047
+ return submitScanOrder;
1048
+ }()
1049
+ }, {
1050
+ key: "scanOrderMore",
1051
+ value: function () {
1052
+ var _scanOrderMore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1053
+ var url, query, fetchUrl, requestBody;
1054
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1055
+ while (1) switch (_context14.prev = _context14.next) {
1056
+ case 0:
1057
+ url = params.url, query = params.query;
1058
+ fetchUrl = url || "/order/order/product/".concat(query.order_id);
1059
+ requestBody = {
1060
+ products: query.products,
1061
+ request_unique_idempotency_token: query.request_unique_idempotency_token
1062
+ };
1063
+ return _context14.abrupt("return", this.request.put(fetchUrl, requestBody));
1064
+ case 4:
1065
+ case "end":
1066
+ return _context14.stop();
1067
+ }
1068
+ }, _callee14, this);
1069
+ }));
1070
+ function scanOrderMore(_x14) {
1071
+ return _scanOrderMore.apply(this, arguments);
1072
+ }
1073
+ return scanOrderMore;
1074
+ }()
385
1075
  }]);
386
1076
  return OrderModule;
387
1077
  }(BaseModule);