@pisell/pisellos 2.2.293 → 2.2.295

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 (70) hide show
  1. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +1 -4
  2. package/dist/model/strategy/adapter/itemRule/adapter.js +35 -135
  3. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
  4. package/dist/model/strategy/adapter/itemRule/evaluator.js +1 -25
  5. package/dist/model/strategy/adapter/itemRule/type.d.ts +0 -44
  6. package/dist/model/strategy/adapter/itemRule/type.js +1 -19
  7. package/dist/modules/Order/index.d.ts +3 -18
  8. package/dist/modules/Order/index.js +485 -885
  9. package/dist/modules/Order/types.d.ts +5 -91
  10. package/dist/modules/Order/types.js +0 -5
  11. package/dist/modules/Order/utils.js +10 -22
  12. package/dist/modules/ProductList/index.d.ts +1 -2
  13. package/dist/modules/ProductList/index.js +20 -100
  14. package/dist/modules/ProductList/types.d.ts +0 -10
  15. package/dist/server/index.d.ts +0 -6
  16. package/dist/server/index.js +3 -43
  17. package/dist/solution/BaseSales/index.d.ts +1 -9
  18. package/dist/solution/BaseSales/index.js +706 -894
  19. package/dist/solution/BookingByStep/index.d.ts +2 -2
  20. package/dist/solution/BookingTicket/utils/orderCustomer.js +2 -3
  21. package/dist/solution/RegisterAndLogin/config.d.ts +3 -9
  22. package/dist/solution/RegisterAndLogin/config.js +40 -95
  23. package/dist/solution/RegisterAndLogin/index.js +1 -4
  24. package/dist/solution/ScanOrder/index.d.ts +0 -1
  25. package/dist/solution/ScanOrder/index.js +27 -31
  26. package/dist/solution/ScanOrder/utils.d.ts +0 -1
  27. package/dist/solution/ScanOrder/utils.js +0 -2
  28. package/dist/solution/UnifiedBookingSales/index.d.ts +4 -17
  29. package/dist/solution/UnifiedBookingSales/index.js +489 -755
  30. package/dist/solution/UnifiedBookingSales/types.d.ts +1 -14
  31. package/dist/solution/VenueBooking/index.d.ts +0 -1
  32. package/dist/solution/VenueBooking/index.js +4 -8
  33. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +1 -4
  34. package/lib/model/strategy/adapter/itemRule/adapter.js +4 -73
  35. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
  36. package/lib/model/strategy/adapter/itemRule/evaluator.js +1 -23
  37. package/lib/model/strategy/adapter/itemRule/type.d.ts +0 -44
  38. package/lib/model/strategy/adapter/itemRule/type.js +1 -19
  39. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  40. package/lib/modules/Order/index.d.ts +3 -18
  41. package/lib/modules/Order/index.js +28 -325
  42. package/lib/modules/Order/types.d.ts +5 -91
  43. package/lib/modules/Order/types.js +0 -4
  44. package/lib/modules/Order/utils.js +1 -13
  45. package/lib/modules/ProductList/index.d.ts +1 -2
  46. package/lib/modules/ProductList/index.js +2 -47
  47. package/lib/modules/ProductList/types.d.ts +0 -10
  48. package/lib/server/index.d.ts +0 -6
  49. package/lib/server/index.js +3 -37
  50. package/lib/solution/BaseSales/index.d.ts +1 -9
  51. package/lib/solution/BaseSales/index.js +1 -105
  52. package/lib/solution/BookingByStep/index.d.ts +2 -2
  53. package/lib/solution/BookingTicket/utils/orderCustomer.js +1 -2
  54. package/lib/solution/RegisterAndLogin/config.d.ts +3 -9
  55. package/lib/solution/RegisterAndLogin/config.js +8 -49
  56. package/lib/solution/RegisterAndLogin/index.js +1 -4
  57. package/lib/solution/ScanOrder/index.d.ts +0 -1
  58. package/lib/solution/ScanOrder/index.js +1 -5
  59. package/lib/solution/ScanOrder/utils.d.ts +0 -1
  60. package/lib/solution/ScanOrder/utils.js +0 -1
  61. package/lib/solution/UnifiedBookingSales/index.d.ts +4 -17
  62. package/lib/solution/UnifiedBookingSales/index.js +6 -128
  63. package/lib/solution/UnifiedBookingSales/types.d.ts +1 -14
  64. package/lib/solution/VenueBooking/index.d.ts +0 -1
  65. package/lib/solution/VenueBooking/index.js +1 -5
  66. package/package.json +1 -1
  67. package/dist/modules/Order/salesNotes.d.ts +0 -31
  68. package/dist/modules/Order/salesNotes.js +0 -492
  69. package/lib/modules/Order/salesNotes.d.ts +0 -31
  70. package/lib/modules/Order/salesNotes.js +0 -382
@@ -34,7 +34,7 @@ import { BaseModule } from "../../modules/BaseModule";
34
34
  import { BaseSalesHookNames } from "./types";
35
35
  import { OrderModule } from "../../modules/Order";
36
36
  import Decimal from 'decimal.js';
37
- import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
37
+ import { cloneDeep, mergeWith } from 'lodash-es';
38
38
  import { createModule } from "../BookingByStep/types";
39
39
  import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
40
40
  import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
@@ -320,66 +320,7 @@ function mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey) {
320
320
  loadedValue.forEach(appendOrReplaceByUid);
321
321
  return result;
322
322
  }
323
-
324
- // checkout / realtime snapshots may reorder protocol arrays or append persistence fields.
325
- // Compare only the Sales Note protocol fields so a matching remote echo can acknowledge dirty state.
326
- function normalizeBaseSalesNotesForComparison(value, options) {
327
- var _options$unresolvedOr;
328
- if (!Array.isArray(value)) return null;
329
- var unresolvedOrderTargetUuid = String((_options$unresolvedOr = options === null || options === void 0 ? void 0 : options.unresolvedOrderTargetUuid) !== null && _options$unresolvedOr !== void 0 ? _options$unresolvedOr : '').trim();
330
- return value.map(function (note) {
331
- var _noteRecord$content;
332
- if (!note || _typeof(note) !== 'object' || Array.isArray(note)) {
333
- return cloneDeep(note);
334
- }
335
- var noteRecord = note;
336
- var relations = Array.isArray(noteRecord.note_relations) ? noteRecord.note_relations.map(function (relation) {
337
- var _relation$target_uuid;
338
- if (!relation || _typeof(relation) !== 'object' || Array.isArray(relation)) {
339
- return cloneDeep(relation);
340
- }
341
- var shouldResolveOrderTarget = relation.is_primary === 0 && relation.relation_type === 'related_to' && relation.target_type === 'order' && String((_relation$target_uuid = relation.target_uuid) !== null && _relation$target_uuid !== void 0 ? _relation$target_uuid : '').trim() === '' && unresolvedOrderTargetUuid.length > 0;
342
- return {
343
- uuid: relation.uuid,
344
- relation_type: relation.relation_type,
345
- target_type: relation.target_type,
346
- target_uuid: shouldResolveOrderTarget ? unresolvedOrderTargetUuid : relation.target_uuid,
347
- is_primary: relation.is_primary
348
- };
349
- }).sort(function (left, right) {
350
- var _left$uuid, _right$uuid;
351
- return String((_left$uuid = left === null || left === void 0 ? void 0 : left.uuid) !== null && _left$uuid !== void 0 ? _left$uuid : '').localeCompare(String((_right$uuid = right === null || right === void 0 ? void 0 : right.uuid) !== null && _right$uuid !== void 0 ? _right$uuid : ''));
352
- }) : cloneDeep(noteRecord.note_relations);
353
- return {
354
- uuid: noteRecord.uuid,
355
- note_type: noteRecord.note_type,
356
- content: {
357
- text: cloneDeep((_noteRecord$content = noteRecord.content) === null || _noteRecord$content === void 0 ? void 0 : _noteRecord$content.text)
358
- },
359
- importance: noteRecord.importance,
360
- note_relations: relations
361
- };
362
- }).sort(function (left, right) {
363
- var _left$uuid2, _right$uuid2;
364
- return String((_left$uuid2 = left === null || left === void 0 ? void 0 : left.uuid) !== null && _left$uuid2 !== void 0 ? _left$uuid2 : '').localeCompare(String((_right$uuid2 = right === null || right === void 0 ? void 0 : right.uuid) !== null && _right$uuid2 !== void 0 ? _right$uuid2 : ''));
365
- });
366
- }
367
- function areBaseSalesNotesEquivalent(currentValue, loadedValue, options) {
368
- var currentNotes = normalizeBaseSalesNotesForComparison(currentValue, {
369
- unresolvedOrderTargetUuid: options === null || options === void 0 ? void 0 : options.currentOrderTargetUuid
370
- });
371
- var loadedNotes = normalizeBaseSalesNotesForComparison(loadedValue);
372
- return currentNotes !== null && loadedNotes !== null && isEqual(currentNotes, loadedNotes);
373
- }
374
323
  function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
375
- var _currentTempOrder$_ex, _normalizedLoadedReco;
376
- var loadedHasSalesNotes = Object.prototype.hasOwnProperty.call(loadedRecord || {}, 'notes');
377
- var hasDirtyLocalSalesNotes = (currentTempOrder === null || currentTempOrder === void 0 || (_currentTempOrder$_ex = currentTempOrder._extend) === null || _currentTempOrder$_ex === void 0 || (_currentTempOrder$_ex = _currentTempOrder$_ex.salesNotesState) === null || _currentTempOrder$_ex === void 0 ? void 0 : _currentTempOrder$_ex.dirty) === true;
378
- var incomingSalesNotesMatchLocal = loadedHasSalesNotes && areBaseSalesNotesEquivalent(currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.notes, loadedRecord.notes, {
379
- currentOrderTargetUuid: (loadedRecord === null || loadedRecord === void 0 ? void 0 : loadedRecord.shop_order_number) || (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.shop_order_number)
380
- });
381
- var shouldAwaitAuthoritativeSalesNotes = strategy === 'authoritative-incoming' && hasDirtyLocalSalesNotes && (Number(loadedRecord === null || loadedRecord === void 0 ? void 0 : loadedRecord.need_sync) === 1 || !incomingSalesNotesMatchLocal);
382
- var preserveDirtyLocalSalesNotes = hasDirtyLocalSalesNotes && (strategy === 'preserve-local' || shouldAwaitAuthoritativeSalesNotes);
383
324
  var normalizedLoadedRecord = normalizeBaseSalesRecordCollections(loadedRecord || {}, {
384
325
  ensureUid: false
385
326
  });
@@ -391,12 +332,6 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
391
332
  });
392
333
  var uidRemaps = [];
393
334
  var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key) {
394
- if (key === 'notes') {
395
- if (preserveDirtyLocalSalesNotes && Array.isArray(currentValue)) {
396
- return cloneDeep(currentValue);
397
- }
398
- if (Array.isArray(loadedValue)) return cloneDeep(loadedValue);
399
- }
400
335
  var collectionKind = getBaseSalesOrderCollectionKind(key);
401
336
  if (collectionKind && Array.isArray(loadedValue)) {
402
337
  return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
@@ -420,23 +355,7 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
420
355
  return undefined;
421
356
  });
422
357
  delete mergedRecord.request_unique_idempotency_token;
423
- var normalizedMergedRecord = normalizeBaseSalesRecordCollections(applyOrderCollectionUidRemaps(mergedRecord, uidRemaps));
424
- normalizedMergedRecord._extend = _objectSpread(_objectSpread({}, normalizedMergedRecord._extend || {}), {}, {
425
- salesNotesState: preserveDirtyLocalSalesNotes ? {
426
- loaded: true,
427
- dirty: true
428
- } : loadedHasSalesNotes ? {
429
- loaded: true,
430
- dirty: ((_normalizedLoadedReco = normalizedLoadedRecord._extend) === null || _normalizedLoadedReco === void 0 || (_normalizedLoadedReco = _normalizedLoadedReco.salesNotesState) === null || _normalizedLoadedReco === void 0 ? void 0 : _normalizedLoadedReco.dirty) === true
431
- } : {
432
- loaded: false,
433
- dirty: false
434
- }
435
- });
436
- if (!loadedHasSalesNotes && !preserveDirtyLocalSalesNotes) {
437
- delete normalizedMergedRecord.notes;
438
- }
439
- return normalizedMergedRecord;
358
+ return normalizeBaseSalesRecordCollections(applyOrderCollectionUidRemaps(mergedRecord, uidRemaps));
440
359
  }
441
360
  function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
442
361
  if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
@@ -2170,101 +2089,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2170
2089
  if (!this.store.order) return '';
2171
2090
  return this.store.order.getTempOrderNote();
2172
2091
  }
2173
- }, {
2174
- key: "getSalesNotes",
2175
- value: function getSalesNotes() {
2176
- if (!this.store.order) return [];
2177
- return this.store.order.getSalesNotes();
2178
- }
2179
- }, {
2180
- key: "createSalesNotesMutationSnapshot",
2181
- value: function createSalesNotesMutationSnapshot() {
2182
- if (!this.store.order) throw new Error('order 模块未初始化');
2183
- return this.store.order.createSalesNotesMutationSnapshot();
2184
- }
2185
- }, {
2186
- key: "restoreSalesNotesMutationSnapshot",
2187
- value: function restoreSalesNotesMutationSnapshot(snapshot) {
2188
- if (!this.store.order) throw new Error('order 模块未初始化');
2189
- this.store.order.restoreSalesNotesMutationSnapshot(snapshot);
2190
- }
2191
- }, {
2192
- key: "setSalesNote",
2193
- value: function () {
2194
- var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(input) {
2195
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2196
- while (1) switch (_context16.prev = _context16.next) {
2197
- case 0:
2198
- if (this.store.order) {
2199
- _context16.next = 2;
2200
- break;
2201
- }
2202
- throw new Error('order 模块未初始化');
2203
- case 2:
2204
- return _context16.abrupt("return", this.store.order.setSalesNote(input));
2205
- case 3:
2206
- case "end":
2207
- return _context16.stop();
2208
- }
2209
- }, _callee16, this);
2210
- }));
2211
- function setSalesNote(_x15) {
2212
- return _setSalesNote.apply(this, arguments);
2213
- }
2214
- return setSalesNote;
2215
- }()
2216
- }, {
2217
- key: "removeSalesNote",
2218
- value: function () {
2219
- var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(uuid) {
2220
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2221
- while (1) switch (_context17.prev = _context17.next) {
2222
- case 0:
2223
- if (this.store.order) {
2224
- _context17.next = 2;
2225
- break;
2226
- }
2227
- throw new Error('order 模块未初始化');
2228
- case 2:
2229
- _context17.next = 4;
2230
- return this.store.order.removeSalesNote(uuid);
2231
- case 4:
2232
- case "end":
2233
- return _context17.stop();
2234
- }
2235
- }, _callee17, this);
2236
- }));
2237
- function removeSalesNote(_x16) {
2238
- return _removeSalesNote.apply(this, arguments);
2239
- }
2240
- return removeSalesNote;
2241
- }()
2242
- }, {
2243
- key: "clearSalesNotes",
2244
- value: function () {
2245
- var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2246
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2247
- while (1) switch (_context18.prev = _context18.next) {
2248
- case 0:
2249
- if (this.store.order) {
2250
- _context18.next = 2;
2251
- break;
2252
- }
2253
- throw new Error('order 模块未初始化');
2254
- case 2:
2255
- _context18.next = 4;
2256
- return this.store.order.clearSalesNotes();
2257
- case 4:
2258
- case "end":
2259
- return _context18.stop();
2260
- }
2261
- }, _callee18, this);
2262
- }));
2263
- function clearSalesNotes() {
2264
- return _clearSalesNotes.apply(this, arguments);
2265
- }
2266
- return clearSalesNotes;
2267
- }()
2268
2092
  }, {
2269
2093
  key: "updateTempOrderNote",
2270
2094
  value: function updateTempOrderNote(note) {
@@ -2295,18 +2119,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2295
2119
  if (!this.store.order) throw new Error('order 模块未初始化');
2296
2120
  return this.store.order.updateTempOrderDepositAmount(amount);
2297
2121
  }
2298
- }, {
2299
- key: "setPickupReferenceMode",
2300
- value: function setPickupReferenceMode(mode) {
2301
- if (!this.store.order) throw new Error('order 模块未初始化');
2302
- return this.store.order.updateTempOrderPickupReferenceMode(mode);
2303
- }
2304
- }, {
2305
- key: "setServiceType",
2306
- value: function setServiceType(serviceType) {
2307
- if (!this.store.order) throw new Error('order 模块未初始化');
2308
- return this.store.order.updateTempOrderServiceType(serviceType);
2309
- }
2310
2122
  }, {
2311
2123
  key: "updateTempOrderContactsInfo",
2312
2124
  value: function updateTempOrderContactsInfo(contactsInfo) {
@@ -2340,40 +2152,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2340
2152
  }, {
2341
2153
  key: "addNewOrder",
2342
2154
  value: function () {
2343
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2155
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2344
2156
  var tempOrder;
2345
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2346
- while (1) switch (_context19.prev = _context19.next) {
2157
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2158
+ while (1) switch (_context16.prev = _context16.next) {
2347
2159
  case 0:
2348
- _context19.prev = 0;
2160
+ _context16.prev = 0;
2349
2161
  if (this.store.order) {
2350
- _context19.next = 3;
2162
+ _context16.next = 3;
2351
2163
  break;
2352
2164
  }
2353
2165
  throw new Error('order 模块未初始化');
2354
2166
  case 3:
2355
- _context19.next = 5;
2167
+ _context16.next = 5;
2356
2168
  return this.store.order.addNewOrder();
2357
2169
  case 5:
2358
- tempOrder = _context19.sent;
2170
+ tempOrder = _context16.sent;
2359
2171
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2360
- _context19.next = 10;
2172
+ _context16.next = 10;
2361
2173
  break;
2362
2174
  }
2363
2175
  this.store.order.persistTempOrder();
2364
- _context19.next = 10;
2176
+ _context16.next = 10;
2365
2177
  return this.store.order.saveDraft();
2366
2178
  case 10:
2367
- return _context19.abrupt("return", tempOrder);
2179
+ return _context16.abrupt("return", tempOrder);
2368
2180
  case 13:
2369
- _context19.prev = 13;
2370
- _context19.t0 = _context19["catch"](0);
2371
- throw _context19.t0;
2181
+ _context16.prev = 13;
2182
+ _context16.t0 = _context16["catch"](0);
2183
+ throw _context16.t0;
2372
2184
  case 16:
2373
2185
  case "end":
2374
- return _context19.stop();
2186
+ return _context16.stop();
2375
2187
  }
2376
- }, _callee19, this, [[0, 13]]);
2188
+ }, _callee16, this, [[0, 13]]);
2377
2189
  }));
2378
2190
  function addNewOrder() {
2379
2191
  return _addNewOrder.apply(this, arguments);
@@ -2383,22 +2195,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2383
2195
  }, {
2384
2196
  key: "saveDraft",
2385
2197
  value: function () {
2386
- var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2387
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2388
- while (1) switch (_context20.prev = _context20.next) {
2198
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
2199
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2200
+ while (1) switch (_context17.prev = _context17.next) {
2389
2201
  case 0:
2390
2202
  if (this.store.order) {
2391
- _context20.next = 2;
2203
+ _context17.next = 2;
2392
2204
  break;
2393
2205
  }
2394
2206
  throw new Error('order 模块未初始化');
2395
2207
  case 2:
2396
- return _context20.abrupt("return", this.store.order.saveDraft());
2208
+ return _context17.abrupt("return", this.store.order.saveDraft());
2397
2209
  case 3:
2398
2210
  case "end":
2399
- return _context20.stop();
2211
+ return _context17.stop();
2400
2212
  }
2401
- }, _callee20, this);
2213
+ }, _callee17, this);
2402
2214
  }));
2403
2215
  function saveDraft() {
2404
2216
  return _saveDraft.apply(this, arguments);
@@ -2409,14 +2221,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2409
2221
  }, {
2410
2222
  key: "restoreOrder",
2411
2223
  value: function () {
2412
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2224
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2413
2225
  var _this$store$payment, tempOrder, appDataChanged, wallet;
2414
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2415
- while (1) switch (_context21.prev = _context21.next) {
2226
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2227
+ while (1) switch (_context18.prev = _context18.next) {
2416
2228
  case 0:
2417
- _context21.prev = 0;
2229
+ _context18.prev = 0;
2418
2230
  if (this.store.order) {
2419
- _context21.next = 3;
2231
+ _context18.next = 3;
2420
2232
  break;
2421
2233
  }
2422
2234
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -2429,37 +2241,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2429
2241
  this.hasManualDiscountSelection = false;
2430
2242
  wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
2431
2243
  if (!wallet) {
2432
- _context21.next = 14;
2244
+ _context18.next = 14;
2433
2245
  break;
2434
2246
  }
2435
2247
  this.walletAssetsRefreshSequence += 1;
2436
2248
  wallet.clearAllCache();
2437
- _context21.next = 14;
2249
+ _context18.next = 14;
2438
2250
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
2439
2251
  case 14:
2440
- _context21.next = 16;
2252
+ _context18.next = 16;
2441
2253
  return this.effectsEmit('onTempOrderReplaced', {
2442
2254
  tempOrder: tempOrder
2443
2255
  });
2444
2256
  case 16:
2445
2257
  if (!(appDataChanged && this.isTempOrderPersistEnabled())) {
2446
- _context21.next = 20;
2258
+ _context18.next = 20;
2447
2259
  break;
2448
2260
  }
2449
2261
  this.store.order.persistTempOrder();
2450
- _context21.next = 20;
2262
+ _context18.next = 20;
2451
2263
  return this.store.order.saveDraft();
2452
2264
  case 20:
2453
- return _context21.abrupt("return", tempOrder);
2265
+ return _context18.abrupt("return", tempOrder);
2454
2266
  case 23:
2455
- _context21.prev = 23;
2456
- _context21.t0 = _context21["catch"](0);
2457
- throw _context21.t0;
2267
+ _context18.prev = 23;
2268
+ _context18.t0 = _context18["catch"](0);
2269
+ throw _context18.t0;
2458
2270
  case 26:
2459
2271
  case "end":
2460
- return _context21.stop();
2272
+ return _context18.stop();
2461
2273
  }
2462
- }, _callee21, this, [[0, 23]]);
2274
+ }, _callee18, this, [[0, 23]]);
2463
2275
  }));
2464
2276
  function restoreOrder() {
2465
2277
  return _restoreOrder.apply(this, arguments);
@@ -2473,22 +2285,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2473
2285
  }, {
2474
2286
  key: "clearOrderCartLines",
2475
2287
  value: (function () {
2476
- var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2288
+ var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2477
2289
  var tempOrder;
2478
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2479
- while (1) switch (_context22.prev = _context22.next) {
2290
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2291
+ while (1) switch (_context19.prev = _context19.next) {
2480
2292
  case 0:
2481
- _context22.prev = 0;
2293
+ _context19.prev = 0;
2482
2294
  if (this.store.order) {
2483
- _context22.next = 3;
2295
+ _context19.next = 3;
2484
2296
  break;
2485
2297
  }
2486
2298
  throw new Error('order 模块未初始化');
2487
2299
  case 3:
2488
- _context22.next = 5;
2300
+ _context19.next = 5;
2489
2301
  return this.store.order.clearOrderCartLines();
2490
2302
  case 5:
2491
- tempOrder = _context22.sent;
2303
+ tempOrder = _context19.sent;
2492
2304
  if (this.currentSalesDetail) {
2493
2305
  this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
2494
2306
  products: [],
@@ -2498,29 +2310,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2498
2310
  discount_list: []
2499
2311
  });
2500
2312
  }
2501
- _context22.next = 9;
2313
+ _context19.next = 9;
2502
2314
  return this.effectsEmit('onTempOrderReplaced', {
2503
2315
  tempOrder: tempOrder
2504
2316
  });
2505
2317
  case 9:
2506
2318
  if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
2507
- _context22.next = 13;
2319
+ _context19.next = 13;
2508
2320
  break;
2509
2321
  }
2510
2322
  this.store.order.persistTempOrder();
2511
- _context22.next = 13;
2323
+ _context19.next = 13;
2512
2324
  return this.store.order.saveDraft();
2513
2325
  case 13:
2514
- return _context22.abrupt("return", tempOrder);
2326
+ return _context19.abrupt("return", tempOrder);
2515
2327
  case 16:
2516
- _context22.prev = 16;
2517
- _context22.t0 = _context22["catch"](0);
2518
- throw _context22.t0;
2328
+ _context19.prev = 16;
2329
+ _context19.t0 = _context19["catch"](0);
2330
+ throw _context19.t0;
2519
2331
  case 19:
2520
2332
  case "end":
2521
- return _context22.stop();
2333
+ return _context19.stop();
2522
2334
  }
2523
- }, _callee22, this, [[0, 16]]);
2335
+ }, _callee19, this, [[0, 16]]);
2524
2336
  }));
2525
2337
  function clearOrderCartLines() {
2526
2338
  return _clearOrderCartLines.apply(this, arguments);
@@ -2537,32 +2349,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2537
2349
  }, {
2538
2350
  key: "getSummary",
2539
2351
  value: function () {
2540
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2352
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2541
2353
  var summary;
2542
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2543
- while (1) switch (_context23.prev = _context23.next) {
2354
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2355
+ while (1) switch (_context20.prev = _context20.next) {
2544
2356
  case 0:
2545
- _context23.prev = 0;
2357
+ _context20.prev = 0;
2546
2358
  if (this.store.order) {
2547
- _context23.next = 3;
2359
+ _context20.next = 3;
2548
2360
  break;
2549
2361
  }
2550
2362
  throw new Error('order 模块未初始化');
2551
2363
  case 3:
2552
- _context23.next = 5;
2364
+ _context20.next = 5;
2553
2365
  return this.store.order.getOrderSummary();
2554
2366
  case 5:
2555
- summary = _context23.sent;
2556
- return _context23.abrupt("return", summary);
2367
+ summary = _context20.sent;
2368
+ return _context20.abrupt("return", summary);
2557
2369
  case 9:
2558
- _context23.prev = 9;
2559
- _context23.t0 = _context23["catch"](0);
2560
- throw _context23.t0;
2370
+ _context20.prev = 9;
2371
+ _context20.t0 = _context20["catch"](0);
2372
+ throw _context20.t0;
2561
2373
  case 12:
2562
2374
  case "end":
2563
- return _context23.stop();
2375
+ return _context20.stop();
2564
2376
  }
2565
- }, _callee23, this, [[0, 9]]);
2377
+ }, _callee20, this, [[0, 9]]);
2566
2378
  }));
2567
2379
  function getSummary() {
2568
2380
  return _getSummary.apply(this, arguments);
@@ -2690,14 +2502,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2690
2502
  }, {
2691
2503
  key: "loadDiscountConfig",
2692
2504
  value: function () {
2693
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
2505
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2694
2506
  var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
2695
2507
  var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
2696
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2697
- while (1) switch (_context24.prev = _context24.next) {
2508
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2509
+ while (1) switch (_context21.prev = _context21.next) {
2698
2510
  case 0:
2699
2511
  if (this.store.order) {
2700
- _context24.next = 2;
2512
+ _context21.next = 2;
2701
2513
  break;
2702
2514
  }
2703
2515
  throw new Error('order 模块未初始化');
@@ -2717,18 +2529,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2717
2529
  discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
2718
2530
  preparedDiscountList = [];
2719
2531
  if (!(customerId && customerId !== 1)) {
2720
- _context24.next = 25;
2532
+ _context21.next = 25;
2721
2533
  break;
2722
2534
  }
2723
2535
  if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
2724
- _context24.next = 19;
2536
+ _context21.next = 19;
2725
2537
  break;
2726
2538
  }
2727
2539
  preparedDiscountList = originalDiscountList;
2728
- _context24.next = 25;
2540
+ _context21.next = 25;
2729
2541
  break;
2730
2542
  case 19:
2731
- _context24.next = 21;
2543
+ _context21.next = 21;
2732
2544
  return this.store.order.loadDiscountConfig({
2733
2545
  customerId: customerId,
2734
2546
  action: discountAction,
@@ -2736,16 +2548,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2736
2548
  apply: false
2737
2549
  });
2738
2550
  case 21:
2739
- preparedDiscountList = _context24.sent;
2551
+ preparedDiscountList = _context21.sent;
2740
2552
  this.discountConfigCacheKey = discountConfigCacheKey;
2741
- _context24.next = 25;
2553
+ _context21.next = 25;
2742
2554
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
2743
2555
  case 25:
2744
2556
  if (!(hasManualDiscountSelection && currentDiscountList.length)) {
2745
- _context24.next = 27;
2557
+ _context21.next = 27;
2746
2558
  break;
2747
2559
  }
2748
- return _context24.abrupt("return", {
2560
+ return _context21.abrupt("return", {
2749
2561
  productList: tempOrder.products || [],
2750
2562
  discountList: currentDiscountList,
2751
2563
  availableWalletIds: this.getAvailableWalletIds()
@@ -2753,7 +2565,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2753
2565
  case 27:
2754
2566
  nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
2755
2567
  nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
2756
- _context24.next = 31;
2568
+ _context21.next = 31;
2757
2569
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2758
2570
  case 31:
2759
2571
  shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
@@ -2763,17 +2575,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2763
2575
  nextDiscountList: nextDiscountList
2764
2576
  });
2765
2577
  if (!shouldSkipAutoApplyFetchedDiscounts) {
2766
- _context24.next = 40;
2578
+ _context21.next = 40;
2767
2579
  break;
2768
2580
  }
2769
- _context24.next = 35;
2581
+ _context21.next = 35;
2770
2582
  return this.store.order.recalculateSummary({
2771
2583
  createIfMissing: true
2772
2584
  });
2773
2585
  case 35:
2774
- _summary = _context24.sent;
2586
+ _summary = _context21.sent;
2775
2587
  this.store.order.persistTempOrder();
2776
- _context24.next = 39;
2588
+ _context21.next = 39;
2777
2589
  return this.effectsEmit('onDiscountApplied', {
2778
2590
  productList: tempOrder.products || [],
2779
2591
  discountList: nextDiscountList,
@@ -2781,14 +2593,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2781
2593
  tempOrder: tempOrder
2782
2594
  });
2783
2595
  case 39:
2784
- return _context24.abrupt("return", {
2596
+ return _context21.abrupt("return", {
2785
2597
  productList: tempOrder.products || [],
2786
2598
  discountList: nextDiscountList,
2787
2599
  availableWalletIds: this.getAvailableWalletIds()
2788
2600
  });
2789
2601
  case 40:
2790
2602
  if (!rulesModule) {
2791
- _context24.next = 76;
2603
+ _context21.next = 76;
2792
2604
  break;
2793
2605
  }
2794
2606
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
@@ -2808,21 +2620,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2808
2620
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2809
2621
  }
2810
2622
  _iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
2811
- _context24.prev = 45;
2623
+ _context21.prev = 45;
2812
2624
  _iterator3.s();
2813
2625
  case 47:
2814
2626
  if ((_step3 = _iterator3.n()).done) {
2815
- _context24.next = 62;
2627
+ _context21.next = 62;
2816
2628
  break;
2817
2629
  }
2818
2630
  product = _step3.value;
2819
2631
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
2820
2632
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
2821
2633
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
2822
- _context24.next = 53;
2634
+ _context21.next = 53;
2823
2635
  break;
2824
2636
  }
2825
- return _context24.abrupt("continue", 60);
2637
+ return _context21.abrupt("continue", 60);
2826
2638
  case 53:
2827
2639
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2828
2640
  return sum + Number(pd.amount || 0);
@@ -2840,41 +2652,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2840
2652
  bundle: product.product_bundle
2841
2653
  });
2842
2654
  case 60:
2843
- _context24.next = 47;
2655
+ _context21.next = 47;
2844
2656
  break;
2845
2657
  case 62:
2846
- _context24.next = 67;
2658
+ _context21.next = 67;
2847
2659
  break;
2848
2660
  case 64:
2849
- _context24.prev = 64;
2850
- _context24.t0 = _context24["catch"](45);
2851
- _iterator3.e(_context24.t0);
2661
+ _context21.prev = 64;
2662
+ _context21.t0 = _context21["catch"](45);
2663
+ _iterator3.e(_context21.t0);
2852
2664
  case 67:
2853
- _context24.prev = 67;
2665
+ _context21.prev = 67;
2854
2666
  _iterator3.f();
2855
- return _context24.finish(67);
2667
+ return _context21.finish(67);
2856
2668
  case 70:
2857
2669
  if (!result.discountList) {
2858
- _context24.next = 76;
2670
+ _context21.next = 76;
2859
2671
  break;
2860
2672
  }
2861
2673
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2862
2674
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2863
- _context24.next = 75;
2675
+ _context21.next = 75;
2864
2676
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2865
2677
  case 75:
2866
2678
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2867
2679
  return discount.isSelected;
2868
2680
  });
2869
2681
  case 76:
2870
- _context24.next = 78;
2682
+ _context21.next = 78;
2871
2683
  return this.store.order.recalculateSummary({
2872
2684
  createIfMissing: true
2873
2685
  });
2874
2686
  case 78:
2875
- summary = _context24.sent;
2687
+ summary = _context21.sent;
2876
2688
  this.store.order.persistTempOrder();
2877
- _context24.next = 82;
2689
+ _context21.next = 82;
2878
2690
  return this.effectsEmit('onDiscountApplied', {
2879
2691
  productList: tempOrder.products || [],
2880
2692
  discountList: nextDiscountList,
@@ -2882,18 +2694,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2882
2694
  tempOrder: tempOrder
2883
2695
  });
2884
2696
  case 82:
2885
- return _context24.abrupt("return", {
2697
+ return _context21.abrupt("return", {
2886
2698
  productList: tempOrder.products || [],
2887
2699
  discountList: nextDiscountList,
2888
2700
  availableWalletIds: this.getAvailableWalletIds()
2889
2701
  });
2890
2702
  case 83:
2891
2703
  case "end":
2892
- return _context24.stop();
2704
+ return _context21.stop();
2893
2705
  }
2894
- }, _callee24, this, [[45, 64, 67, 70]]);
2706
+ }, _callee21, this, [[45, 64, 67, 70]]);
2895
2707
  }));
2896
- function loadDiscountConfig(_x17) {
2708
+ function loadDiscountConfig(_x15) {
2897
2709
  return _loadDiscountConfig.apply(this, arguments);
2898
2710
  }
2899
2711
  return loadDiscountConfig;
@@ -2908,14 +2720,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2908
2720
  }, {
2909
2721
  key: "bestDiscount",
2910
2722
  value: function () {
2911
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(cb) {
2723
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(cb) {
2912
2724
  var _discountModule$getOr2, _discountModule$getDi3;
2913
2725
  var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
2914
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2915
- while (1) switch (_context25.prev = _context25.next) {
2726
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2727
+ while (1) switch (_context22.prev = _context22.next) {
2916
2728
  case 0:
2917
2729
  if (this.store.order) {
2918
- _context25.next = 2;
2730
+ _context22.next = 2;
2919
2731
  break;
2920
2732
  }
2921
2733
  throw new Error('order 模块未初始化');
@@ -2931,11 +2743,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2931
2743
  productList: tempOrder.products || [],
2932
2744
  discountList: nextDiscountList
2933
2745
  };
2934
- _context25.next = 12;
2746
+ _context22.next = 12;
2935
2747
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2936
2748
  case 12:
2937
2749
  if (!rulesModule) {
2938
- _context25.next = 23;
2750
+ _context22.next = 23;
2939
2751
  break;
2940
2752
  }
2941
2753
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
@@ -2952,12 +2764,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2952
2764
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2953
2765
  }
2954
2766
  if (!result.discountList) {
2955
- _context25.next = 23;
2767
+ _context22.next = 23;
2956
2768
  break;
2957
2769
  }
2958
2770
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2959
2771
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2960
- _context25.next = 21;
2772
+ _context22.next = 21;
2961
2773
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2962
2774
  case 21:
2963
2775
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -2968,13 +2780,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2968
2780
  discountList: nextDiscountList
2969
2781
  };
2970
2782
  case 23:
2971
- _context25.next = 25;
2783
+ _context22.next = 25;
2972
2784
  return this.store.order.recalculateSummary({
2973
2785
  createIfMissing: true
2974
2786
  });
2975
2787
  case 25:
2976
2788
  this.store.order.persistTempOrder();
2977
- _context25.next = 28;
2789
+ _context22.next = 28;
2978
2790
  return this.effectsEmit('onDiscountApplied', {
2979
2791
  productList: tempOrder.products || [],
2980
2792
  discountList: nextDiscountList,
@@ -2983,14 +2795,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2983
2795
  });
2984
2796
  case 28:
2985
2797
  cb === null || cb === void 0 || cb(result);
2986
- return _context25.abrupt("return", result);
2798
+ return _context22.abrupt("return", result);
2987
2799
  case 30:
2988
2800
  case "end":
2989
- return _context25.stop();
2801
+ return _context22.stop();
2990
2802
  }
2991
- }, _callee25, this);
2803
+ }, _callee22, this);
2992
2804
  }));
2993
- function bestDiscount(_x18) {
2805
+ function bestDiscount(_x16) {
2994
2806
  return _bestDiscount.apply(this, arguments);
2995
2807
  }
2996
2808
  return bestDiscount;
@@ -3019,41 +2831,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3019
2831
  }, {
3020
2832
  key: "replaceDiscountStoreLists",
3021
2833
  value: (function () {
3022
- var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2834
+ var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
3023
2835
  var _store2;
3024
2836
  var discountModule;
3025
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3026
- while (1) switch (_context26.prev = _context26.next) {
2837
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2838
+ while (1) switch (_context23.prev = _context23.next) {
3027
2839
  case 0:
3028
2840
  if (this.store.order) {
3029
- _context26.next = 2;
2841
+ _context23.next = 2;
3030
2842
  break;
3031
2843
  }
3032
2844
  throw new Error('order 模块未初始化');
3033
2845
  case 2:
3034
2846
  discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
3035
2847
  if (discountModule) {
3036
- _context26.next = 5;
2848
+ _context23.next = 5;
3037
2849
  break;
3038
2850
  }
3039
- return _context26.abrupt("return");
2851
+ return _context23.abrupt("return");
3040
2852
  case 5:
3041
2853
  if (!params.originalDiscountList) {
3042
- _context26.next = 8;
2854
+ _context23.next = 8;
3043
2855
  break;
3044
2856
  }
3045
- _context26.next = 8;
2857
+ _context23.next = 8;
3046
2858
  return discountModule.setOriginalDiscountList(params.originalDiscountList);
3047
2859
  case 8:
3048
- _context26.next = 10;
2860
+ _context23.next = 10;
3049
2861
  return discountModule.setDiscountList(params.discountList);
3050
2862
  case 10:
3051
2863
  case "end":
3052
- return _context26.stop();
2864
+ return _context23.stop();
3053
2865
  }
3054
- }, _callee26, this);
2866
+ }, _callee23, this);
3055
2867
  }));
3056
- function replaceDiscountStoreLists(_x19) {
2868
+ function replaceDiscountStoreLists(_x17) {
3057
2869
  return _replaceDiscountStoreLists.apply(this, arguments);
3058
2870
  }
3059
2871
  return replaceDiscountStoreLists;
@@ -3061,34 +2873,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3061
2873
  }, {
3062
2874
  key: "scanPromotionCode",
3063
2875
  value: function () {
3064
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(code, customerId) {
2876
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(code, customerId) {
3065
2877
  var raw, tempOrder;
3066
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3067
- while (1) switch (_context27.prev = _context27.next) {
2878
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2879
+ while (1) switch (_context24.prev = _context24.next) {
3068
2880
  case 0:
3069
- _context27.prev = 0;
2881
+ _context24.prev = 0;
3070
2882
  if (this.store.order) {
3071
- _context27.next = 3;
2883
+ _context24.next = 3;
3072
2884
  break;
3073
2885
  }
3074
2886
  throw new Error('order 模块未初始化');
3075
2887
  case 3:
3076
- _context27.next = 5;
2888
+ _context24.next = 5;
3077
2889
  return this.store.order.scanCode(code, customerId);
3078
2890
  case 5:
3079
- raw = _context27.sent;
2891
+ raw = _context24.sent;
3080
2892
  if (!raw.isAvailable) {
3081
- _context27.next = 13;
2893
+ _context24.next = 13;
3082
2894
  break;
3083
2895
  }
3084
- _context27.next = 9;
2896
+ _context24.next = 9;
3085
2897
  return this.store.order.recalculateSummary({
3086
2898
  createIfMissing: true
3087
2899
  });
3088
2900
  case 9:
3089
2901
  this.store.order.persistTempOrder();
3090
2902
  tempOrder = this.store.order.ensureTempOrder();
3091
- _context27.next = 13;
2903
+ _context24.next = 13;
3092
2904
  return this.effectsEmit('onDiscountApplied', {
3093
2905
  productList: tempOrder.products || [],
3094
2906
  discountList: this.store.order.getDiscountList(),
@@ -3096,7 +2908,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3096
2908
  tempOrder: tempOrder
3097
2909
  });
3098
2910
  case 13:
3099
- return _context27.abrupt("return", _objectSpread(_objectSpread({
2911
+ return _context24.abrupt("return", _objectSpread(_objectSpread({
3100
2912
  isAvailable: raw.isAvailable
3101
2913
  }, raw.isAccepted !== undefined ? {
3102
2914
  isAccepted: raw.isAccepted
@@ -3106,16 +2918,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3106
2918
  scannedDiscountList: raw.scannedDiscountList
3107
2919
  }));
3108
2920
  case 16:
3109
- _context27.prev = 16;
3110
- _context27.t0 = _context27["catch"](0);
3111
- throw _context27.t0;
2921
+ _context24.prev = 16;
2922
+ _context24.t0 = _context24["catch"](0);
2923
+ throw _context24.t0;
3112
2924
  case 19:
3113
2925
  case "end":
3114
- return _context27.stop();
2926
+ return _context24.stop();
3115
2927
  }
3116
- }, _callee27, this, [[0, 16]]);
2928
+ }, _callee24, this, [[0, 16]]);
3117
2929
  }));
3118
- function scanPromotionCode(_x20, _x21) {
2930
+ function scanPromotionCode(_x18, _x19) {
3119
2931
  return _scanPromotionCode.apply(this, arguments);
3120
2932
  }
3121
2933
  return scanPromotionCode;
@@ -3123,14 +2935,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3123
2935
  }, {
3124
2936
  key: "setDiscountSelected",
3125
2937
  value: function () {
3126
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2938
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3127
2939
  var list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator4, _step4, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator5, _step5, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
3128
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3129
- while (1) switch (_context28.prev = _context28.next) {
2940
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2941
+ while (1) switch (_context25.prev = _context25.next) {
3130
2942
  case 0:
3131
- _context28.prev = 0;
2943
+ _context25.prev = 0;
3132
2944
  if (this.store.order) {
3133
- _context28.next = 3;
2945
+ _context25.next = 3;
3134
2946
  break;
3135
2947
  }
3136
2948
  throw new Error('order 模块未初始化');
@@ -3148,7 +2960,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3148
2960
  discountModule = orderStore.discount;
3149
2961
  rulesModule = orderStore.rules;
3150
2962
  nextDiscountList = updated;
3151
- _context28.next = 13;
2963
+ _context25.next = 13;
3152
2964
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
3153
2965
  case 13:
3154
2966
  if (rulesModule) {
@@ -3210,21 +3022,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3210
3022
  });
3211
3023
  };
3212
3024
  _iterator5 = _createForOfIteratorHelper(tempOrder.products);
3213
- _context28.prev = 17;
3025
+ _context25.prev = 17;
3214
3026
  _iterator5.s();
3215
3027
  case 19:
3216
3028
  if ((_step5 = _iterator5.n()).done) {
3217
- _context28.next = 36;
3029
+ _context25.next = 36;
3218
3030
  break;
3219
3031
  }
3220
3032
  product = _step5.value;
3221
3033
  productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
3222
3034
  runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
3223
3035
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
3224
- _context28.next = 25;
3036
+ _context25.next = 25;
3225
3037
  break;
3226
3038
  }
3227
- return _context28.abrupt("continue", 34);
3039
+ return _context25.abrupt("continue", 34);
3228
3040
  case 25:
3229
3041
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
3230
3042
  if (Array.isArray(product.product_bundle)) {
@@ -3260,28 +3072,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3260
3072
  bundle: product.product_bundle
3261
3073
  });
3262
3074
  case 34:
3263
- _context28.next = 19;
3075
+ _context25.next = 19;
3264
3076
  break;
3265
3077
  case 36:
3266
- _context28.next = 41;
3078
+ _context25.next = 41;
3267
3079
  break;
3268
3080
  case 38:
3269
- _context28.prev = 38;
3270
- _context28.t0 = _context28["catch"](17);
3271
- _iterator5.e(_context28.t0);
3081
+ _context25.prev = 38;
3082
+ _context25.t0 = _context25["catch"](17);
3083
+ _iterator5.e(_context25.t0);
3272
3084
  case 41:
3273
- _context28.prev = 41;
3085
+ _context25.prev = 41;
3274
3086
  _iterator5.f();
3275
- return _context28.finish(41);
3087
+ return _context25.finish(41);
3276
3088
  case 44:
3277
3089
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
3278
- _context28.next = 47;
3090
+ _context25.next = 47;
3279
3091
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
3280
3092
  case 47:
3281
3093
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
3282
3094
  return d.isSelected;
3283
3095
  });
3284
- _context28.next = 50;
3096
+ _context25.next = 50;
3285
3097
  return this.store.order.recalculateSummary({
3286
3098
  createIfMissing: true
3287
3099
  });
@@ -3293,19 +3105,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3293
3105
  selectedDiscountList: tempOrder.discount_list,
3294
3106
  tempOrder: tempOrder
3295
3107
  });
3296
- _context28.next = 57;
3108
+ _context25.next = 57;
3297
3109
  break;
3298
3110
  case 54:
3299
- _context28.prev = 54;
3300
- _context28.t1 = _context28["catch"](0);
3301
- throw _context28.t1;
3111
+ _context25.prev = 54;
3112
+ _context25.t1 = _context25["catch"](0);
3113
+ throw _context25.t1;
3302
3114
  case 57:
3303
3115
  case "end":
3304
- return _context28.stop();
3116
+ return _context25.stop();
3305
3117
  }
3306
- }, _callee28, this, [[0, 54], [17, 38, 41, 44]]);
3118
+ }, _callee25, this, [[0, 54], [17, 38, 41, 44]]);
3307
3119
  }));
3308
- function setDiscountSelected(_x22) {
3120
+ function setDiscountSelected(_x20) {
3309
3121
  return _setDiscountSelected.apply(this, arguments);
3310
3122
  }
3311
3123
  return setDiscountSelected;
@@ -3313,23 +3125,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3313
3125
  }, {
3314
3126
  key: "applyDiscountCalculationResult",
3315
3127
  value: function () {
3316
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(result) {
3128
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(result) {
3317
3129
  var tempOrder, orderStore, discountModule;
3318
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3319
- while (1) switch (_context29.prev = _context29.next) {
3130
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3131
+ while (1) switch (_context26.prev = _context26.next) {
3320
3132
  case 0:
3321
- _context29.prev = 0;
3133
+ _context26.prev = 0;
3322
3134
  if (this.store.order) {
3323
- _context29.next = 3;
3135
+ _context26.next = 3;
3324
3136
  break;
3325
3137
  }
3326
3138
  throw new Error('order 模块未初始化');
3327
3139
  case 3:
3328
3140
  if (result) {
3329
- _context29.next = 5;
3141
+ _context26.next = 5;
3330
3142
  break;
3331
3143
  }
3332
- return _context29.abrupt("return");
3144
+ return _context26.abrupt("return");
3333
3145
  case 5:
3334
3146
  tempOrder = this.store.order.ensureTempOrder();
3335
3147
  orderStore = this.store.order.store || {};
@@ -3338,24 +3150,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3338
3150
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
3339
3151
  }
3340
3152
  if (!result.discountList) {
3341
- _context29.next = 14;
3153
+ _context26.next = 14;
3342
3154
  break;
3343
3155
  }
3344
3156
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
3345
- _context29.next = 13;
3157
+ _context26.next = 13;
3346
3158
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
3347
3159
  case 13:
3348
3160
  tempOrder.discount_list = result.discountList.filter(function (discount) {
3349
3161
  return discount.isSelected;
3350
3162
  });
3351
3163
  case 14:
3352
- _context29.next = 16;
3164
+ _context26.next = 16;
3353
3165
  return this.store.order.recalculateSummary({
3354
3166
  createIfMissing: true
3355
3167
  });
3356
3168
  case 16:
3357
3169
  this.store.order.persistTempOrder();
3358
- _context29.next = 19;
3170
+ _context26.next = 19;
3359
3171
  return this.effectsEmit('onDiscountApplied', {
3360
3172
  productList: tempOrder.products || [],
3361
3173
  discountList: result.discountList || [],
@@ -3363,19 +3175,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3363
3175
  tempOrder: tempOrder
3364
3176
  });
3365
3177
  case 19:
3366
- _context29.next = 24;
3178
+ _context26.next = 24;
3367
3179
  break;
3368
3180
  case 21:
3369
- _context29.prev = 21;
3370
- _context29.t0 = _context29["catch"](0);
3371
- throw _context29.t0;
3181
+ _context26.prev = 21;
3182
+ _context26.t0 = _context26["catch"](0);
3183
+ throw _context26.t0;
3372
3184
  case 24:
3373
3185
  case "end":
3374
- return _context29.stop();
3186
+ return _context26.stop();
3375
3187
  }
3376
- }, _callee29, this, [[0, 21]]);
3188
+ }, _callee26, this, [[0, 21]]);
3377
3189
  }));
3378
- function applyDiscountCalculationResult(_x23) {
3190
+ function applyDiscountCalculationResult(_x21) {
3379
3191
  return _applyDiscountCalculationResult.apply(this, arguments);
3380
3192
  }
3381
3193
  return applyDiscountCalculationResult;
@@ -3383,18 +3195,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3383
3195
  }, {
3384
3196
  key: "submitScanOrder",
3385
3197
  value: function () {
3386
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3387
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3388
- while (1) switch (_context30.prev = _context30.next) {
3198
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3199
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3200
+ while (1) switch (_context27.prev = _context27.next) {
3389
3201
  case 0:
3390
- return _context30.abrupt("return", this.submitSalesOrder(params));
3202
+ return _context27.abrupt("return", this.submitSalesOrder(params));
3391
3203
  case 1:
3392
3204
  case "end":
3393
- return _context30.stop();
3205
+ return _context27.stop();
3394
3206
  }
3395
- }, _callee30, this);
3207
+ }, _callee27, this);
3396
3208
  }));
3397
- function submitScanOrder(_x24) {
3209
+ function submitScanOrder(_x22) {
3398
3210
  return _submitScanOrder.apply(this, arguments);
3399
3211
  }
3400
3212
  return submitScanOrder;
@@ -3408,14 +3220,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3408
3220
  }, {
3409
3221
  key: "submitSalesOrder",
3410
3222
  value: (function () {
3411
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3223
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3412
3224
  var _params$smallTicketDa, _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16;
3413
3225
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
3414
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3415
- while (1) switch (_context31.prev = _context31.next) {
3226
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3227
+ while (1) switch (_context28.prev = _context28.next) {
3416
3228
  case 0:
3417
3229
  if (this.store.order) {
3418
- _context31.next = 2;
3230
+ _context28.next = 2;
3419
3231
  break;
3420
3232
  }
3421
3233
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -3442,14 +3254,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3442
3254
  } : {}), enhancePayload !== undefined ? {
3443
3255
  enhancePayload: enhancePayload
3444
3256
  } : {});
3445
- return _context31.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
3257
+ return _context28.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
3446
3258
  case 7:
3447
3259
  case "end":
3448
- return _context31.stop();
3260
+ return _context28.stop();
3449
3261
  }
3450
- }, _callee31, this);
3262
+ }, _callee28, this);
3451
3263
  }));
3452
- function submitSalesOrder(_x25) {
3264
+ function submitSalesOrder(_x23) {
3453
3265
  return _submitSalesOrder.apply(this, arguments);
3454
3266
  }
3455
3267
  return submitSalesOrder;
@@ -3457,18 +3269,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3457
3269
  }, {
3458
3270
  key: "saveSalesOrderDraft",
3459
3271
  value: function () {
3460
- var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3272
+ var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3461
3273
  var _params$platform, _this$otherParams17, _this$otherParams18, _this$otherParams19, _params$channel, _params$type, _this$otherParams20;
3462
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3463
- while (1) switch (_context32.prev = _context32.next) {
3274
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3275
+ while (1) switch (_context29.prev = _context29.next) {
3464
3276
  case 0:
3465
3277
  if (this.store.order) {
3466
- _context32.next = 2;
3278
+ _context29.next = 2;
3467
3279
  break;
3468
3280
  }
3469
3281
  throw new Error('BaseSales 解决方案需要 order 模块支持');
3470
3282
  case 2:
3471
- return _context32.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
3283
+ return _context29.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
3472
3284
  cacheId: this.cacheId,
3473
3285
  platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform,
3474
3286
  businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) || ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code),
@@ -3479,11 +3291,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3479
3291
  } : {})));
3480
3292
  case 3:
3481
3293
  case "end":
3482
- return _context32.stop();
3294
+ return _context29.stop();
3483
3295
  }
3484
- }, _callee32, this);
3296
+ }, _callee29, this);
3485
3297
  }));
3486
- function saveSalesOrderDraft(_x26) {
3298
+ function saveSalesOrderDraft(_x24) {
3487
3299
  return _saveSalesOrderDraft.apply(this, arguments);
3488
3300
  }
3489
3301
  return saveSalesOrderDraft;
@@ -3491,14 +3303,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3491
3303
  }, {
3492
3304
  key: "submitTempOrderAsync",
3493
3305
  value: function () {
3494
- var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3306
+ var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3495
3307
  var _params$smallTicketDa2, _this$otherParams21, _this$otherParams22, _this$otherParams23, _this$otherParams24;
3496
3308
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
3497
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3498
- while (1) switch (_context33.prev = _context33.next) {
3309
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3310
+ while (1) switch (_context30.prev = _context30.next) {
3499
3311
  case 0:
3500
3312
  if (this.store.order) {
3501
- _context33.next = 2;
3313
+ _context30.next = 2;
3502
3314
  break;
3503
3315
  }
3504
3316
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -3524,14 +3336,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3524
3336
  } : {}), enhancePayload !== undefined ? {
3525
3337
  enhancePayload: enhancePayload
3526
3338
  } : {});
3527
- return _context33.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
3339
+ return _context30.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
3528
3340
  case 7:
3529
3341
  case "end":
3530
- return _context33.stop();
3342
+ return _context30.stop();
3531
3343
  }
3532
- }, _callee33, this);
3344
+ }, _callee30, this);
3533
3345
  }));
3534
- function submitTempOrderAsync(_x27) {
3346
+ function submitTempOrderAsync(_x25) {
3535
3347
  return _submitTempOrderAsync.apply(this, arguments);
3536
3348
  }
3537
3349
  return submitTempOrderAsync;
@@ -3557,14 +3369,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3557
3369
  }, {
3558
3370
  key: "printLocalOrderReceipt",
3559
3371
  value: function () {
3560
- var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(lookup) {
3372
+ var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(lookup) {
3561
3373
  var _this$otherParams26, _this$otherParams27, _this$otherParams28, _this$otherParams29;
3562
3374
  var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
3563
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3564
- while (1) switch (_context34.prev = _context34.next) {
3375
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3376
+ while (1) switch (_context31.prev = _context31.next) {
3565
3377
  case 0:
3566
3378
  if (this.store.order) {
3567
- _context34.next = 2;
3379
+ _context31.next = 2;
3568
3380
  break;
3569
3381
  }
3570
3382
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -3595,28 +3407,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3595
3407
  channel: context.channel,
3596
3408
  type: context.type
3597
3409
  });
3598
- _context34.next = 8;
3410
+ _context31.next = 8;
3599
3411
  return this.request.post('/local/print-order', payload, {
3600
3412
  osServer: true,
3601
3413
  customToast: function customToast() {}
3602
3414
  });
3603
3415
  case 8:
3604
- response = _context34.sent;
3416
+ response = _context31.sent;
3605
3417
  if (hasLookup) {
3606
- _context34.next = 12;
3418
+ _context31.next = 12;
3607
3419
  break;
3608
3420
  }
3609
- _context34.next = 12;
3421
+ _context31.next = 12;
3610
3422
  return (_this$store$order$app = (_this$store$order5 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order5, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
3611
3423
  case 12:
3612
- return _context34.abrupt("return", response);
3424
+ return _context31.abrupt("return", response);
3613
3425
  case 13:
3614
3426
  case "end":
3615
- return _context34.stop();
3427
+ return _context31.stop();
3616
3428
  }
3617
- }, _callee34, this);
3429
+ }, _callee31, this);
3618
3430
  }));
3619
- function printLocalOrderReceipt(_x28) {
3431
+ function printLocalOrderReceipt(_x26) {
3620
3432
  return _printLocalOrderReceipt.apply(this, arguments);
3621
3433
  }
3622
3434
  return printLocalOrderReceipt;
@@ -3637,14 +3449,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3637
3449
  }, {
3638
3450
  key: "syncPaymentsToOrder",
3639
3451
  value: function () {
3640
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
3452
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3641
3453
  var _ref36, _params$businessCode, _this$otherParams30, _this$otherParams31, _params$channel2;
3642
3454
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
3643
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3644
- while (1) switch (_context35.prev = _context35.next) {
3455
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3456
+ while (1) switch (_context32.prev = _context32.next) {
3645
3457
  case 0:
3646
3458
  if (this.store.order) {
3647
- _context35.next = 2;
3459
+ _context32.next = 2;
3648
3460
  break;
3649
3461
  }
3650
3462
  throw new Error('order 模块未初始化');
@@ -3663,14 +3475,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3663
3475
  } : {});
3664
3476
  syncState = this.store.order.getOrderSyncState();
3665
3477
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
3666
- _context35.next = 10;
3478
+ _context32.next = 10;
3667
3479
  break;
3668
3480
  }
3669
3481
  this.queueLatestAutoPaymentSync();
3670
- return _context35.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
3482
+ return _context32.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
3671
3483
  case 10:
3672
3484
  payments = params.payments || [];
3673
- _context35.next = 13;
3485
+ _context32.next = 13;
3674
3486
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
3675
3487
  payments: payments,
3676
3488
  params: syncParams,
@@ -3678,11 +3490,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3678
3490
  orderSnapshot: this.store.order.getOrderSnapshot()
3679
3491
  });
3680
3492
  case 13:
3681
- _context35.prev = 13;
3682
- _context35.next = 16;
3493
+ _context32.prev = 13;
3494
+ _context32.next = 16;
3683
3495
  return this.store.order.syncPaymentsToOrder(syncParams);
3684
3496
  case 16:
3685
- syncResult = _context35.sent;
3497
+ syncResult = _context32.sent;
3686
3498
  latestPayments = this.store.order.getOrderPayments();
3687
3499
  amountSnapshot = this.store.order.getOrderAmountSnapshot();
3688
3500
  orderSnapshot = this.store.order.getOrderSnapshot();
@@ -3700,25 +3512,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3700
3512
  depositAmount: syncResult.depositAmount,
3701
3513
  orderExpectedAmount: syncResult.orderExpectedAmount
3702
3514
  };
3703
- _context35.next = 23;
3515
+ _context32.next = 23;
3704
3516
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
3705
3517
  case 23:
3706
3518
  if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
3707
- _context35.next = 26;
3519
+ _context32.next = 26;
3708
3520
  break;
3709
3521
  }
3710
- _context35.next = 26;
3522
+ _context32.next = 26;
3711
3523
  return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
3712
3524
  case 26:
3713
3525
  this.scheduleQueuedAutoPaymentSyncFlush(0);
3714
- return _context35.abrupt("return", syncResult);
3526
+ return _context32.abrupt("return", syncResult);
3715
3527
  case 30:
3716
- _context35.prev = 30;
3717
- _context35.t0 = _context35["catch"](13);
3718
- _context35.next = 34;
3528
+ _context32.prev = 30;
3529
+ _context32.t0 = _context32["catch"](13);
3530
+ _context32.next = 34;
3719
3531
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
3720
3532
  ok: false,
3721
- error: _context35.t0,
3533
+ error: _context32.t0,
3722
3534
  payments: this.store.order.getOrderPayments(),
3723
3535
  params: syncParams,
3724
3536
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
@@ -3726,14 +3538,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3726
3538
  });
3727
3539
  case 34:
3728
3540
  this.scheduleQueuedAutoPaymentSyncFlush(0);
3729
- throw _context35.t0;
3541
+ throw _context32.t0;
3730
3542
  case 36:
3731
3543
  case "end":
3732
- return _context35.stop();
3544
+ return _context32.stop();
3733
3545
  }
3734
- }, _callee35, this, [[13, 30]]);
3546
+ }, _callee32, this, [[13, 30]]);
3735
3547
  }));
3736
- function syncPaymentsToOrder(_x29) {
3548
+ function syncPaymentsToOrder(_x27) {
3737
3549
  return _syncPaymentsToOrder.apply(this, arguments);
3738
3550
  }
3739
3551
  return syncPaymentsToOrder;
@@ -3782,46 +3594,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3782
3594
  }, {
3783
3595
  key: "flushQueuedAutoPaymentSync",
3784
3596
  value: function () {
3785
- var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3597
+ var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3786
3598
  var payments;
3787
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3788
- while (1) switch (_context36.prev = _context36.next) {
3599
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3600
+ while (1) switch (_context33.prev = _context33.next) {
3789
3601
  case 0:
3790
3602
  if (this.store.order) {
3791
- _context36.next = 2;
3603
+ _context33.next = 2;
3792
3604
  break;
3793
3605
  }
3794
- return _context36.abrupt("return");
3606
+ return _context33.abrupt("return");
3795
3607
  case 2:
3796
3608
  if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
3797
- _context36.next = 4;
3609
+ _context33.next = 4;
3798
3610
  break;
3799
3611
  }
3800
- return _context36.abrupt("return");
3612
+ return _context33.abrupt("return");
3801
3613
  case 4:
3802
3614
  if (!(this.store.order.getOrderSyncState() === 'submitting')) {
3803
- _context36.next = 7;
3615
+ _context33.next = 7;
3804
3616
  break;
3805
3617
  }
3806
3618
  this.scheduleQueuedAutoPaymentSyncFlush();
3807
- return _context36.abrupt("return");
3619
+ return _context33.abrupt("return");
3808
3620
  case 7:
3809
3621
  this.autoPaymentSyncFlushing = true;
3810
- _context36.prev = 8;
3622
+ _context33.prev = 8;
3811
3623
  case 9:
3812
3624
  if (!this.queuedAutoPaymentSync) {
3813
- _context36.next = 18;
3625
+ _context33.next = 18;
3814
3626
  break;
3815
3627
  }
3816
3628
  this.queuedAutoPaymentSync = false;
3817
3629
  payments = this.store.order.getOrderPayments();
3818
3630
  if (payments.length) {
3819
- _context36.next = 14;
3631
+ _context33.next = 14;
3820
3632
  break;
3821
3633
  }
3822
- return _context36.abrupt("continue", 9);
3634
+ return _context33.abrupt("continue", 9);
3823
3635
  case 14:
3824
- _context36.next = 16;
3636
+ _context33.next = 16;
3825
3637
  return this.syncPaymentsToOrder({
3826
3638
  payments: payments,
3827
3639
  paymentStatus: this.getPaymentStatusForSync(payments),
@@ -3829,29 +3641,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3829
3641
  smallTicketDataFlag: 1
3830
3642
  });
3831
3643
  case 16:
3832
- _context36.next = 9;
3644
+ _context33.next = 9;
3833
3645
  break;
3834
3646
  case 18:
3835
- _context36.next = 23;
3647
+ _context33.next = 23;
3836
3648
  break;
3837
3649
  case 20:
3838
- _context36.prev = 20;
3839
- _context36.t0 = _context36["catch"](8);
3650
+ _context33.prev = 20;
3651
+ _context33.t0 = _context33["catch"](8);
3840
3652
  this.logError('queued auto sync payments failed', {
3841
- error: _context36.t0 instanceof Error ? _context36.t0.message : String(_context36.t0)
3653
+ error: _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0)
3842
3654
  });
3843
3655
  case 23:
3844
- _context36.prev = 23;
3656
+ _context33.prev = 23;
3845
3657
  this.autoPaymentSyncFlushing = false;
3846
3658
  if (this.queuedAutoPaymentSync) {
3847
3659
  this.scheduleQueuedAutoPaymentSyncFlush(0);
3848
3660
  }
3849
- return _context36.finish(23);
3661
+ return _context33.finish(23);
3850
3662
  case 27:
3851
3663
  case "end":
3852
- return _context36.stop();
3664
+ return _context33.stop();
3853
3665
  }
3854
- }, _callee36, this, [[8, 20, 23, 27]]);
3666
+ }, _callee33, this, [[8, 20, 23, 27]]);
3855
3667
  }));
3856
3668
  function flushQueuedAutoPaymentSync() {
3857
3669
  return _flushQueuedAutoPaymentSync.apply(this, arguments);
@@ -3875,35 +3687,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3875
3687
  }, {
3876
3688
  key: "addOrderPaymentAsync",
3877
3689
  value: (function () {
3878
- var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(payment) {
3690
+ var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(payment) {
3879
3691
  var paymentRecord, hasPaymentNumber, devicePrefix;
3880
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3881
- while (1) switch (_context37.prev = _context37.next) {
3692
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3693
+ while (1) switch (_context34.prev = _context34.next) {
3882
3694
  case 0:
3883
3695
  paymentRecord = payment;
3884
3696
  hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
3885
3697
  if (!hasPaymentNumber) {
3886
- _context37.next = 6;
3698
+ _context34.next = 6;
3887
3699
  break;
3888
3700
  }
3889
- _context37.t0 = 'LOCAL';
3890
- _context37.next = 9;
3701
+ _context34.t0 = 'LOCAL';
3702
+ _context34.next = 9;
3891
3703
  break;
3892
3704
  case 6:
3893
- _context37.next = 8;
3705
+ _context34.next = 8;
3894
3706
  return this.getPaymentNumberDevicePrefixAsync();
3895
3707
  case 8:
3896
- _context37.t0 = _context37.sent;
3708
+ _context34.t0 = _context34.sent;
3897
3709
  case 9:
3898
- devicePrefix = _context37.t0;
3899
- return _context37.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
3710
+ devicePrefix = _context34.t0;
3711
+ return _context34.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
3900
3712
  case 11:
3901
3713
  case "end":
3902
- return _context37.stop();
3714
+ return _context34.stop();
3903
3715
  }
3904
- }, _callee37, this);
3716
+ }, _callee34, this);
3905
3717
  }));
3906
- function addOrderPaymentAsync(_x30) {
3718
+ function addOrderPaymentAsync(_x28) {
3907
3719
  return _addOrderPaymentAsync.apply(this, arguments);
3908
3720
  }
3909
3721
  return addOrderPaymentAsync;
@@ -3972,7 +3784,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3972
3784
  }, {
3973
3785
  key: "updateOrderPayment",
3974
3786
  value: (function () {
3975
- var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(paymentIdentity, updates) {
3787
+ var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(paymentIdentity, updates) {
3976
3788
  var _result$payment, _result$payment2;
3977
3789
  var options,
3978
3790
  matchMode,
@@ -3989,13 +3801,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3989
3801
  shouldSubmit,
3990
3802
  syncResult,
3991
3803
  _options$smallTicketD2,
3992
- _args38 = arguments;
3993
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3994
- while (1) switch (_context38.prev = _context38.next) {
3804
+ _args35 = arguments;
3805
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3806
+ while (1) switch (_context35.prev = _context35.next) {
3995
3807
  case 0:
3996
- options = _args38.length > 2 && _args38[2] !== undefined ? _args38[2] : {};
3808
+ options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
3997
3809
  if (this.store.order) {
3998
- _context38.next = 3;
3810
+ _context35.next = 3;
3999
3811
  break;
4000
3812
  }
4001
3813
  throw new Error('order 模块未初始化');
@@ -4004,15 +3816,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4004
3816
  previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
4005
3817
  previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
4006
3818
  if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
4007
- _context38.next = 13;
3819
+ _context35.next = 13;
4008
3820
  break;
4009
3821
  }
4010
3822
  currentPayments = this.store.order.getOrderPayments();
4011
3823
  if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
4012
- _context38.next = 12;
3824
+ _context35.next = 12;
4013
3825
  break;
4014
3826
  }
4015
- _context38.next = 11;
3827
+ _context35.next = 11;
4016
3828
  return this.syncPaymentsToOrder({
4017
3829
  payments: currentPayments,
4018
3830
  paymentStatus: this.getPaymentStatusForSync(currentPayments),
@@ -4020,9 +3832,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4020
3832
  smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
4021
3833
  });
4022
3834
  case 11:
4023
- _syncResult = _context38.sent;
3835
+ _syncResult = _context35.sent;
4024
3836
  case 12:
4025
- return _context38.abrupt("return", _objectSpread({
3837
+ return _context35.abrupt("return", _objectSpread({
4026
3838
  updated: false,
4027
3839
  payment: previousPayment,
4028
3840
  payments: currentPayments,
@@ -4031,44 +3843,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4031
3843
  syncResult: _syncResult
4032
3844
  } : {}));
4033
3845
  case 13:
4034
- _context38.next = 15;
3846
+ _context35.next = 15;
4035
3847
  return this.store.order.updateOrderPayment(paymentIdentity, updates, {
4036
3848
  matchBy: matchMode
4037
3849
  });
4038
3850
  case 15:
4039
- result = _context38.sent;
3851
+ result = _context35.sent;
4040
3852
  if (!(options.persistDraft !== false)) {
4041
- _context38.next = 29;
3853
+ _context35.next = 29;
4042
3854
  break;
4043
3855
  }
4044
- _context38.prev = 17;
4045
- _context38.next = 20;
3856
+ _context35.prev = 17;
3857
+ _context35.next = 20;
4046
3858
  return this.saveSalesOrderDraft();
4047
3859
  case 20:
4048
- draftResult = _context38.sent;
4049
- _context38.next = 29;
3860
+ draftResult = _context35.sent;
3861
+ _context35.next = 29;
4050
3862
  break;
4051
3863
  case 23:
4052
- _context38.prev = 23;
4053
- _context38.t0 = _context38["catch"](17);
4054
- draftError = _context38.t0;
3864
+ _context35.prev = 23;
3865
+ _context35.t0 = _context35["catch"](17);
3866
+ draftError = _context35.t0;
4055
3867
  this.logError('updateOrderPayment: 保存支付草稿失败', {
4056
3868
  paymentIdentity: paymentIdentity,
4057
- error: _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0)
3869
+ error: _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0)
4058
3870
  });
4059
3871
  if (options.submitWhenPaid) {
4060
- _context38.next = 29;
3872
+ _context35.next = 29;
4061
3873
  break;
4062
3874
  }
4063
- throw _context38.t0;
3875
+ throw _context35.t0;
4064
3876
  case 29:
4065
3877
  becamePaid = (previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) !== 'paid' && ((_result$payment = result.payment) === null || _result$payment === void 0 ? void 0 : _result$payment.status) === 'paid';
4066
3878
  shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
4067
3879
  if (!shouldSubmit) {
4068
- _context38.next = 35;
3880
+ _context35.next = 35;
4069
3881
  break;
4070
3882
  }
4071
- _context38.next = 34;
3883
+ _context35.next = 34;
4072
3884
  return this.syncPaymentsToOrder({
4073
3885
  payments: result.payments,
4074
3886
  paymentStatus: this.getPaymentStatusForSync(result.payments),
@@ -4076,9 +3888,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4076
3888
  smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
4077
3889
  });
4078
3890
  case 34:
4079
- syncResult = _context38.sent;
3891
+ syncResult = _context35.sent;
4080
3892
  case 35:
4081
- return _context38.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
3893
+ return _context35.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
4082
3894
  draftResult: draftResult
4083
3895
  } : {}), draftError !== undefined ? {
4084
3896
  draftError: draftError
@@ -4087,11 +3899,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4087
3899
  } : {}));
4088
3900
  case 36:
4089
3901
  case "end":
4090
- return _context38.stop();
3902
+ return _context35.stop();
4091
3903
  }
4092
- }, _callee38, this, [[17, 23]]);
3904
+ }, _callee35, this, [[17, 23]]);
4093
3905
  }));
4094
- function updateOrderPayment(_x31, _x32) {
3906
+ function updateOrderPayment(_x29, _x30) {
4095
3907
  return _updateOrderPayment.apply(this, arguments);
4096
3908
  }
4097
3909
  return updateOrderPayment;
@@ -4113,24 +3925,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4113
3925
  }, {
4114
3926
  key: "updateVoucherOrderPaymentsAsync",
4115
3927
  value: function () {
4116
- var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(payments, options) {
4117
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4118
- while (1) switch (_context39.prev = _context39.next) {
3928
+ var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(payments, options) {
3929
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3930
+ while (1) switch (_context36.prev = _context36.next) {
4119
3931
  case 0:
4120
3932
  if (this.store.order) {
4121
- _context39.next = 2;
3933
+ _context36.next = 2;
4122
3934
  break;
4123
3935
  }
4124
3936
  throw new Error('order 模块未初始化');
4125
3937
  case 2:
4126
- return _context39.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
3938
+ return _context36.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
4127
3939
  case 3:
4128
3940
  case "end":
4129
- return _context39.stop();
3941
+ return _context36.stop();
4130
3942
  }
4131
- }, _callee39, this);
3943
+ }, _callee36, this);
4132
3944
  }));
4133
- function updateVoucherOrderPaymentsAsync(_x33, _x34) {
3945
+ function updateVoucherOrderPaymentsAsync(_x31, _x32) {
4134
3946
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
4135
3947
  }
4136
3948
  return updateVoucherOrderPaymentsAsync;
@@ -4241,20 +4053,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4241
4053
  }, {
4242
4054
  key: "initWalletData",
4243
4055
  value: function () {
4244
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4056
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4245
4057
  var _snapshot$identity;
4246
4058
  var snapshot, walletBusinessData, result;
4247
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4248
- while (1) switch (_context40.prev = _context40.next) {
4059
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4060
+ while (1) switch (_context37.prev = _context37.next) {
4249
4061
  case 0:
4250
4062
  if (this.store.order) {
4251
- _context40.next = 2;
4063
+ _context37.next = 2;
4252
4064
  break;
4253
4065
  }
4254
4066
  throw new Error('order 模块未初始化');
4255
4067
  case 2:
4256
4068
  if (this.store.payment) {
4257
- _context40.next = 4;
4069
+ _context37.next = 4;
4258
4070
  break;
4259
4071
  }
4260
4072
  throw new Error('payment 模块未初始化');
@@ -4262,10 +4074,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4262
4074
  snapshot = this.store.order.getOrderSnapshot();
4263
4075
  walletBusinessData = this.buildWalletInitBusinessData(params);
4264
4076
  if (walletBusinessData) {
4265
- _context40.next = 8;
4077
+ _context37.next = 8;
4266
4078
  break;
4267
4079
  }
4268
- return _context40.abrupt("return", {
4080
+ return _context37.abrupt("return", {
4269
4081
  walletRecommendList: [],
4270
4082
  userIdentificationCodes: [],
4271
4083
  transformList: [],
@@ -4273,11 +4085,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4273
4085
  products: []
4274
4086
  });
4275
4087
  case 8:
4276
- _context40.next = 10;
4088
+ _context37.next = 10;
4277
4089
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
4278
4090
  case 10:
4279
- result = _context40.sent;
4280
- _context40.next = 13;
4091
+ result = _context37.sent;
4092
+ _context37.next = 13;
4281
4093
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
4282
4094
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
4283
4095
  customerId: walletBusinessData.customer_id,
@@ -4289,14 +4101,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4289
4101
  timestamp: Date.now()
4290
4102
  });
4291
4103
  case 13:
4292
- return _context40.abrupt("return", result);
4104
+ return _context37.abrupt("return", result);
4293
4105
  case 14:
4294
4106
  case "end":
4295
- return _context40.stop();
4107
+ return _context37.stop();
4296
4108
  }
4297
- }, _callee40, this);
4109
+ }, _callee37, this);
4298
4110
  }));
4299
- function initWalletData(_x35) {
4111
+ function initWalletData(_x33) {
4300
4112
  return _initWalletData.apply(this, arguments);
4301
4113
  }
4302
4114
  return initWalletData;
@@ -4347,23 +4159,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4347
4159
  }, {
4348
4160
  key: "publishWalletAssetsState",
4349
4161
  value: function () {
4350
- var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(state) {
4351
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4352
- while (1) switch (_context41.prev = _context41.next) {
4162
+ var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(state) {
4163
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4164
+ while (1) switch (_context38.prev = _context38.next) {
4353
4165
  case 0:
4354
- _context41.next = 2;
4166
+ _context38.next = 2;
4355
4167
  return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
4356
4168
  state: state
4357
4169
  });
4358
4170
  case 2:
4359
- return _context41.abrupt("return", state);
4171
+ return _context38.abrupt("return", state);
4360
4172
  case 3:
4361
4173
  case "end":
4362
- return _context41.stop();
4174
+ return _context38.stop();
4363
4175
  }
4364
- }, _callee41, this);
4176
+ }, _callee38, this);
4365
4177
  }));
4366
- function publishWalletAssetsState(_x36) {
4178
+ function publishWalletAssetsState(_x34) {
4367
4179
  return _publishWalletAssetsState.apply(this, arguments);
4368
4180
  }
4369
4181
  return publishWalletAssetsState;
@@ -4371,26 +4183,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4371
4183
  }, {
4372
4184
  key: "syncSelectedWalletAssets",
4373
4185
  value: function () {
4374
- var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(state) {
4186
+ var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(state) {
4375
4187
  var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
4376
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4377
- while (1) switch (_context42.prev = _context42.next) {
4188
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4189
+ while (1) switch (_context39.prev = _context39.next) {
4378
4190
  case 0:
4379
4191
  if (!(!this.store.order || !this.store.payment)) {
4380
- _context42.next = 2;
4192
+ _context39.next = 2;
4381
4193
  break;
4382
4194
  }
4383
4195
  throw new Error('订单或支付模块未初始化');
4384
4196
  case 2:
4385
4197
  paymentMethods = this.getPaymentMethods();
4386
4198
  if (!(!paymentMethods.length && state.selectedItems.length)) {
4387
- _context42.next = 7;
4199
+ _context39.next = 7;
4388
4200
  break;
4389
4201
  }
4390
- _context42.next = 6;
4202
+ _context39.next = 6;
4391
4203
  return this.getPaymentMethodsAsync();
4392
4204
  case 6:
4393
- paymentMethods = _context42.sent;
4205
+ paymentMethods = _context39.sent;
4394
4206
  case 7:
4395
4207
  methodByCode = new Map(paymentMethods.map(function (method) {
4396
4208
  return [String(method.code || '').toUpperCase(), method];
@@ -4432,19 +4244,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4432
4244
  payments = this.updateVoucherOrderPayments(voucherPayments, {
4433
4245
  status: 'payment_pending'
4434
4246
  });
4435
- _context42.next = 14;
4247
+ _context39.next = 14;
4436
4248
  return this.store.order.recalculateSummary({
4437
4249
  createIfMissing: true
4438
4250
  });
4439
4251
  case 14:
4440
- return _context42.abrupt("return", payments);
4252
+ return _context39.abrupt("return", payments);
4441
4253
  case 15:
4442
4254
  case "end":
4443
- return _context42.stop();
4255
+ return _context39.stop();
4444
4256
  }
4445
- }, _callee42, this);
4257
+ }, _callee39, this);
4446
4258
  }));
4447
- function syncSelectedWalletAssets(_x37) {
4259
+ function syncSelectedWalletAssets(_x35) {
4448
4260
  return _syncSelectedWalletAssets.apply(this, arguments);
4449
4261
  }
4450
4262
  return syncSelectedWalletAssets;
@@ -4478,29 +4290,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4478
4290
  }, {
4479
4291
  key: "importWalletAssetsSnapshot",
4480
4292
  value: (function () {
4481
- var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(snapshot) {
4293
+ var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(snapshot) {
4482
4294
  var state;
4483
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4484
- while (1) switch (_context43.prev = _context43.next) {
4295
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4296
+ while (1) switch (_context40.prev = _context40.next) {
4485
4297
  case 0:
4486
4298
  if (this.store.payment) {
4487
- _context43.next = 2;
4299
+ _context40.next = 2;
4488
4300
  break;
4489
4301
  }
4490
4302
  throw new Error('payment 模块未初始化');
4491
4303
  case 2:
4492
4304
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
4493
- _context43.next = 5;
4305
+ _context40.next = 5;
4494
4306
  return this.syncSelectedWalletAssets(state);
4495
4307
  case 5:
4496
- return _context43.abrupt("return", this.publishWalletAssetsState(state));
4308
+ return _context40.abrupt("return", this.publishWalletAssetsState(state));
4497
4309
  case 6:
4498
4310
  case "end":
4499
- return _context43.stop();
4311
+ return _context40.stop();
4500
4312
  }
4501
- }, _callee43, this);
4313
+ }, _callee40, this);
4502
4314
  }));
4503
- function importWalletAssetsSnapshot(_x38) {
4315
+ function importWalletAssetsSnapshot(_x36) {
4504
4316
  return _importWalletAssetsSnapshot.apply(this, arguments);
4505
4317
  }
4506
4318
  return importWalletAssetsSnapshot;
@@ -4512,20 +4324,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4512
4324
  }, {
4513
4325
  key: "refreshWalletAssets",
4514
4326
  value: (function () {
4515
- var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4327
+ var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4516
4328
  var _previousState$custom, _businessData$custome;
4517
4329
  var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
4518
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4519
- while (1) switch (_context44.prev = _context44.next) {
4330
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4331
+ while (1) switch (_context41.prev = _context41.next) {
4520
4332
  case 0:
4521
4333
  if (this.store.order) {
4522
- _context44.next = 2;
4334
+ _context41.next = 2;
4523
4335
  break;
4524
4336
  }
4525
4337
  throw new Error('order 模块未初始化');
4526
4338
  case 2:
4527
4339
  if (this.store.payment) {
4528
- _context44.next = 4;
4340
+ _context41.next = 4;
4529
4341
  break;
4530
4342
  }
4531
4343
  throw new Error('payment 模块未初始化');
@@ -4534,7 +4346,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4534
4346
  wallet = this.store.payment.wallet;
4535
4347
  businessData = this.buildWalletInitBusinessData(params);
4536
4348
  if (businessData) {
4537
- _context44.next = 12;
4349
+ _context41.next = 12;
4538
4350
  break;
4539
4351
  }
4540
4352
  wallet.clearAllCache();
@@ -4542,53 +4354,53 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4542
4354
  this.updateVoucherOrderPayments([], {
4543
4355
  status: 'payment_pending'
4544
4356
  });
4545
- return _context44.abrupt("return", this.publishWalletAssetsState(emptyState));
4357
+ return _context41.abrupt("return", this.publishWalletAssetsState(emptyState));
4546
4358
  case 12:
4547
4359
  previousState = wallet.getWalletAssetsState();
4548
4360
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
4549
4361
  customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
4550
4362
  if (!customerChanged) {
4551
- _context44.next = 20;
4363
+ _context41.next = 20;
4552
4364
  break;
4553
4365
  }
4554
4366
  clearedState = wallet.clearWalletAssetSelection();
4555
4367
  this.updateVoucherOrderPayments([], {
4556
4368
  status: 'payment_pending'
4557
4369
  });
4558
- _context44.next = 20;
4370
+ _context41.next = 20;
4559
4371
  return this.publishWalletAssetsState(clearedState);
4560
4372
  case 20:
4561
4373
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
4562
4374
  preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
4563
4375
  });
4564
- _context44.next = 23;
4376
+ _context41.next = 23;
4565
4377
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
4566
4378
  case 23:
4567
- _context44.next = 25;
4379
+ _context41.next = 25;
4568
4380
  return refreshTask;
4569
4381
  case 25:
4570
- state = _context44.sent;
4382
+ state = _context41.sent;
4571
4383
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
4572
- _context44.next = 28;
4384
+ _context41.next = 28;
4573
4385
  break;
4574
4386
  }
4575
- return _context44.abrupt("return", wallet.getWalletAssetsState());
4387
+ return _context41.abrupt("return", wallet.getWalletAssetsState());
4576
4388
  case 28:
4577
4389
  if (state.status !== 'error') {
4578
4390
  committed = this.getCommittedWalletAssets();
4579
4391
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
4580
4392
  }
4581
- _context44.next = 31;
4393
+ _context41.next = 31;
4582
4394
  return this.syncSelectedWalletAssets(state);
4583
4395
  case 31:
4584
- return _context44.abrupt("return", this.publishWalletAssetsState(state));
4396
+ return _context41.abrupt("return", this.publishWalletAssetsState(state));
4585
4397
  case 32:
4586
4398
  case "end":
4587
- return _context44.stop();
4399
+ return _context41.stop();
4588
4400
  }
4589
- }, _callee44, this);
4401
+ }, _callee41, this);
4590
4402
  }));
4591
- function refreshWalletAssets(_x39) {
4403
+ function refreshWalletAssets(_x37) {
4592
4404
  return _refreshWalletAssets.apply(this, arguments);
4593
4405
  }
4594
4406
  return refreshWalletAssets;
@@ -4596,13 +4408,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4596
4408
  }, {
4597
4409
  key: "selectWalletAsset",
4598
4410
  value: (function () {
4599
- var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4411
+ var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4600
4412
  var state;
4601
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4602
- while (1) switch (_context45.prev = _context45.next) {
4413
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4414
+ while (1) switch (_context42.prev = _context42.next) {
4603
4415
  case 0:
4604
4416
  if (this.store.payment) {
4605
- _context45.next = 2;
4417
+ _context42.next = 2;
4606
4418
  break;
4607
4419
  }
4608
4420
  throw new Error('payment 模块未初始化');
@@ -4611,17 +4423,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4611
4423
  selected: params.selected,
4612
4424
  source: params.source
4613
4425
  });
4614
- _context45.next = 5;
4426
+ _context42.next = 5;
4615
4427
  return this.syncSelectedWalletAssets(state);
4616
4428
  case 5:
4617
- return _context45.abrupt("return", this.publishWalletAssetsState(state));
4429
+ return _context42.abrupt("return", this.publishWalletAssetsState(state));
4618
4430
  case 6:
4619
4431
  case "end":
4620
- return _context45.stop();
4432
+ return _context42.stop();
4621
4433
  }
4622
- }, _callee45, this);
4434
+ }, _callee42, this);
4623
4435
  }));
4624
- function selectWalletAsset(_x40) {
4436
+ function selectWalletAsset(_x38) {
4625
4437
  return _selectWalletAsset.apply(this, arguments);
4626
4438
  }
4627
4439
  return selectWalletAsset;
@@ -4629,29 +4441,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4629
4441
  }, {
4630
4442
  key: "updateWalletAssetAmount",
4631
4443
  value: (function () {
4632
- var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
4444
+ var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4633
4445
  var state;
4634
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4635
- while (1) switch (_context46.prev = _context46.next) {
4446
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4447
+ while (1) switch (_context43.prev = _context43.next) {
4636
4448
  case 0:
4637
4449
  if (this.store.payment) {
4638
- _context46.next = 2;
4450
+ _context43.next = 2;
4639
4451
  break;
4640
4452
  }
4641
4453
  throw new Error('payment 模块未初始化');
4642
4454
  case 2:
4643
4455
  state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
4644
- _context46.next = 5;
4456
+ _context43.next = 5;
4645
4457
  return this.syncSelectedWalletAssets(state);
4646
4458
  case 5:
4647
- return _context46.abrupt("return", this.publishWalletAssetsState(state));
4459
+ return _context43.abrupt("return", this.publishWalletAssetsState(state));
4648
4460
  case 6:
4649
4461
  case "end":
4650
- return _context46.stop();
4462
+ return _context43.stop();
4651
4463
  }
4652
- }, _callee46, this);
4464
+ }, _callee43, this);
4653
4465
  }));
4654
- function updateWalletAssetAmount(_x41) {
4466
+ function updateWalletAssetAmount(_x39) {
4655
4467
  return _updateWalletAssetAmount.apply(this, arguments);
4656
4468
  }
4657
4469
  return updateWalletAssetAmount;
@@ -4659,13 +4471,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4659
4471
  }, {
4660
4472
  key: "scanWalletAsset",
4661
4473
  value: (function () {
4662
- var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(code) {
4474
+ var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(code) {
4663
4475
  var wallet, businessData, result;
4664
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4665
- while (1) switch (_context47.prev = _context47.next) {
4476
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4477
+ while (1) switch (_context44.prev = _context44.next) {
4666
4478
  case 0:
4667
4479
  if (this.store.payment) {
4668
- _context47.next = 2;
4480
+ _context44.next = 2;
4669
4481
  break;
4670
4482
  }
4671
4483
  throw new Error('payment 模块未初始化');
@@ -4675,28 +4487,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4675
4487
  if (businessData) {
4676
4488
  wallet.generateWalletParams(businessData);
4677
4489
  }
4678
- _context47.next = 7;
4490
+ _context44.next = 7;
4679
4491
  return wallet.scanWalletAssetAsync(code);
4680
4492
  case 7:
4681
- result = _context47.sent;
4493
+ result = _context44.sent;
4682
4494
  if (!(result.type === 'normalCode')) {
4683
- _context47.next = 13;
4495
+ _context44.next = 13;
4684
4496
  break;
4685
4497
  }
4686
- _context47.next = 11;
4498
+ _context44.next = 11;
4687
4499
  return this.syncSelectedWalletAssets(result.state);
4688
4500
  case 11:
4689
- _context47.next = 13;
4501
+ _context44.next = 13;
4690
4502
  return this.publishWalletAssetsState(result.state);
4691
4503
  case 13:
4692
- return _context47.abrupt("return", result);
4504
+ return _context44.abrupt("return", result);
4693
4505
  case 14:
4694
4506
  case "end":
4695
- return _context47.stop();
4507
+ return _context44.stop();
4696
4508
  }
4697
- }, _callee47, this);
4509
+ }, _callee44, this);
4698
4510
  }));
4699
- function scanWalletAsset(_x42) {
4511
+ function scanWalletAsset(_x40) {
4700
4512
  return _scanWalletAsset.apply(this, arguments);
4701
4513
  }
4702
4514
  return scanWalletAsset;
@@ -4704,27 +4516,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4704
4516
  }, {
4705
4517
  key: "clearWalletAssetSelection",
4706
4518
  value: (function () {
4707
- var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
4519
+ var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
4708
4520
  var state;
4709
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4710
- while (1) switch (_context48.prev = _context48.next) {
4521
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4522
+ while (1) switch (_context45.prev = _context45.next) {
4711
4523
  case 0:
4712
4524
  if (this.store.payment) {
4713
- _context48.next = 2;
4525
+ _context45.next = 2;
4714
4526
  break;
4715
4527
  }
4716
4528
  throw new Error('payment 模块未初始化');
4717
4529
  case 2:
4718
4530
  state = this.store.payment.wallet.clearWalletAssetSelection();
4719
- _context48.next = 5;
4531
+ _context45.next = 5;
4720
4532
  return this.syncSelectedWalletAssets(state);
4721
4533
  case 5:
4722
- return _context48.abrupt("return", this.publishWalletAssetsState(state));
4534
+ return _context45.abrupt("return", this.publishWalletAssetsState(state));
4723
4535
  case 6:
4724
4536
  case "end":
4725
- return _context48.stop();
4537
+ return _context45.stop();
4726
4538
  }
4727
- }, _callee48, this);
4539
+ }, _callee45, this);
4728
4540
  }));
4729
4541
  function clearWalletAssetSelection() {
4730
4542
  return _clearWalletAssetSelection.apply(this, arguments);
@@ -4754,35 +4566,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4754
4566
  }, {
4755
4567
  key: "getPaymentMethodsAsync",
4756
4568
  value: (function () {
4757
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
4569
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
4758
4570
  var response, paymentMethods;
4759
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4760
- while (1) switch (_context49.prev = _context49.next) {
4571
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4572
+ while (1) switch (_context46.prev = _context46.next) {
4761
4573
  case 0:
4762
- _context49.prev = 0;
4763
- _context49.next = 3;
4574
+ _context46.prev = 0;
4575
+ _context46.next = 3;
4764
4576
  return this.request.get('/pay/custom-payment/all', {
4765
4577
  filterPaymentMethods: true
4766
4578
  }, {
4767
4579
  osServer: true
4768
4580
  });
4769
4581
  case 3:
4770
- response = _context49.sent;
4582
+ response = _context46.sent;
4771
4583
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
4772
4584
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
4773
- return _context49.abrupt("return", this.getPaymentMethods());
4585
+ return _context46.abrupt("return", this.getPaymentMethods());
4774
4586
  case 9:
4775
- _context49.prev = 9;
4776
- _context49.t0 = _context49["catch"](0);
4587
+ _context46.prev = 9;
4588
+ _context46.t0 = _context46["catch"](0);
4777
4589
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
4778
- error: _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0)
4590
+ error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
4779
4591
  });
4780
- return _context49.abrupt("return", this.getPaymentMethods());
4592
+ return _context46.abrupt("return", this.getPaymentMethods());
4781
4593
  case 13:
4782
4594
  case "end":
4783
- return _context49.stop();
4595
+ return _context46.stop();
4784
4596
  }
4785
- }, _callee49, this, [[0, 9]]);
4597
+ }, _callee46, this, [[0, 9]]);
4786
4598
  }));
4787
4599
  function getPaymentMethodsAsync() {
4788
4600
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -4825,14 +4637,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4825
4637
  }, {
4826
4638
  key: "getCashPaymentConfig",
4827
4639
  value: (function () {
4828
- var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
4640
+ var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
4829
4641
  var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams33;
4830
4642
  var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
4831
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4832
- while (1) switch (_context50.prev = _context50.next) {
4643
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4644
+ while (1) switch (_context47.prev = _context47.next) {
4833
4645
  case 0:
4834
4646
  if (this.store.payment) {
4835
- _context50.next = 2;
4647
+ _context47.next = 2;
4836
4648
  break;
4837
4649
  }
4838
4650
  throw new Error('payment 模块未初始化');
@@ -4840,13 +4652,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4840
4652
  paymentMethods = this.getPaymentMethods();
4841
4653
  paymentMethod = this.findCashPaymentMethod(paymentMethods);
4842
4654
  if (paymentMethod) {
4843
- _context50.next = 9;
4655
+ _context47.next = 9;
4844
4656
  break;
4845
4657
  }
4846
- _context50.next = 7;
4658
+ _context47.next = 7;
4847
4659
  return this.getPaymentMethodsAsync();
4848
4660
  case 7:
4849
- paymentMethods = _context50.sent;
4661
+ paymentMethods = _context47.sent;
4850
4662
  paymentMethod = this.findCashPaymentMethod(paymentMethods);
4851
4663
  case 9:
4852
4664
  amountSnapshot = (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderAmountSnapshot) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11);
@@ -4854,7 +4666,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4854
4666
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
4855
4667
  currency = ((_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getTempOrder) === null || _this$store$order12$g === void 0 || (_this$store$order12$g = _this$store$order12$g.call(_this$store$order12)) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.currency_code) || ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.currency) || 'USD';
4856
4668
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
4857
- return _context50.abrupt("return", {
4669
+ return _context47.abrupt("return", {
4858
4670
  available: Boolean(paymentMethod && amountDue > 0),
4859
4671
  paymentMethod: paymentMethod,
4860
4672
  amountDue: amountDue,
@@ -4862,9 +4674,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4862
4674
  });
4863
4675
  case 15:
4864
4676
  case "end":
4865
- return _context50.stop();
4677
+ return _context47.stop();
4866
4678
  }
4867
- }, _callee50, this);
4679
+ }, _callee47, this);
4868
4680
  }));
4869
4681
  function getCashPaymentConfig() {
4870
4682
  return _getCashPaymentConfig.apply(this, arguments);
@@ -4881,14 +4693,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4881
4693
  }, {
4882
4694
  key: "confirmWalletPayment",
4883
4695
  value: (function () {
4884
- var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51() {
4696
+ var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
4885
4697
  var _this$store$order$get3, _this$store$order13, _this$store$order$get4, _this$store$order$get5, _this$store$order14;
4886
4698
  var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
4887
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4888
- while (1) switch (_context51.prev = _context51.next) {
4699
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4700
+ while (1) switch (_context48.prev = _context48.next) {
4889
4701
  case 0:
4890
4702
  if (this.store.order) {
4891
- _context51.next = 2;
4703
+ _context48.next = 2;
4892
4704
  break;
4893
4705
  }
4894
4706
  throw new Error('order 模块未初始化');
@@ -4896,7 +4708,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4896
4708
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
4897
4709
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
4898
4710
  if (!pendingWalletAmount.lte(0)) {
4899
- _context51.next = 6;
4711
+ _context48.next = 6;
4900
4712
  break;
4901
4713
  }
4902
4714
  throw new Error('当前订单没有待确认的 Wallet 支付');
@@ -4904,74 +4716,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4904
4716
  amountSnapshot = (_this$store$order$get3 = (_this$store$order13 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order13);
4905
4717
  effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
4906
4718
  if (!effectiveAmountDue.gt(0.01)) {
4907
- _context51.next = 10;
4719
+ _context48.next = 10;
4908
4720
  break;
4909
4721
  }
4910
4722
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
4911
4723
  case 10:
4912
4724
  beforePaymentStatus = (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.payment_status;
4913
- _context51.prev = 11;
4914
- _context51.next = 14;
4725
+ _context48.prev = 11;
4726
+ _context48.next = 14;
4915
4727
  return this.submitSalesOrder({
4916
4728
  smallTicketDataFlag: 1,
4917
4729
  confirmPendingVoucherPayments: true
4918
4730
  });
4919
4731
  case 14:
4920
- submitResult = _context51.sent;
4732
+ submitResult = _context48.sent;
4921
4733
  if (!isRejectedSalesSubmitResult(submitResult)) {
4922
- _context51.next = 17;
4734
+ _context48.next = 17;
4923
4735
  break;
4924
4736
  }
4925
4737
  throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
4926
4738
  case 17:
4927
- _context51.next = 27;
4739
+ _context48.next = 27;
4928
4740
  break;
4929
4741
  case 19:
4930
- _context51.prev = 19;
4931
- _context51.t0 = _context51["catch"](11);
4742
+ _context48.prev = 19;
4743
+ _context48.t0 = _context48["catch"](11);
4932
4744
  this.store.order.setOrderPayments(beforePayments);
4933
4745
  restoredTempOrder = this.store.order.getTempOrder();
4934
4746
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
4935
4747
  restoredTempOrder.payment_status = beforePaymentStatus;
4936
4748
  this.store.order.persistTempOrder();
4937
4749
  }
4938
- _context51.next = 26;
4750
+ _context48.next = 26;
4939
4751
  return this.store.order.recalculateSummary({
4940
4752
  createIfMissing: true
4941
4753
  });
4942
4754
  case 26:
4943
- throw _context51.t0;
4755
+ throw _context48.t0;
4944
4756
  case 27:
4945
4757
  if (!this.store.payment) {
4946
- _context51.next = 38;
4758
+ _context48.next = 38;
4947
4759
  break;
4948
4760
  }
4949
- _context51.prev = 28;
4761
+ _context48.prev = 28;
4950
4762
  committed = this.getCommittedWalletAssets();
4951
4763
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
4952
- _context51.next = 33;
4764
+ _context48.next = 33;
4953
4765
  return this.publishWalletAssetsState(walletState);
4954
4766
  case 33:
4955
- _context51.next = 38;
4767
+ _context48.next = 38;
4956
4768
  break;
4957
4769
  case 35:
4958
- _context51.prev = 35;
4959
- _context51.t1 = _context51["catch"](28);
4770
+ _context48.prev = 35;
4771
+ _context48.t1 = _context48["catch"](28);
4960
4772
  this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
4961
- error: _context51.t1 instanceof Error ? _context51.t1.message : String(_context51.t1)
4773
+ error: _context48.t1 instanceof Error ? _context48.t1.message : String(_context48.t1)
4962
4774
  });
4963
4775
  case 38:
4964
4776
  latestAmountSnapshot = (_this$store$order$get5 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.call(_this$store$order14);
4965
- return _context51.abrupt("return", {
4777
+ return _context48.abrupt("return", {
4966
4778
  submitResult: submitResult,
4967
4779
  payments: this.store.order.getOrderPayments(),
4968
4780
  isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
4969
4781
  });
4970
4782
  case 40:
4971
4783
  case "end":
4972
- return _context51.stop();
4784
+ return _context48.stop();
4973
4785
  }
4974
- }, _callee51, this, [[11, 19], [28, 35]]);
4786
+ }, _callee48, this, [[11, 19], [28, 35]]);
4975
4787
  }));
4976
4788
  function confirmWalletPayment() {
4977
4789
  return _confirmWalletPayment.apply(this, arguments);
@@ -4986,38 +4798,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4986
4798
  }, {
4987
4799
  key: "payCash",
4988
4800
  value: (function () {
4989
- var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
4801
+ var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
4990
4802
  var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams34, _this$window, _this$window$postMess;
4991
4803
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
4992
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4993
- while (1) switch (_context52.prev = _context52.next) {
4804
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4805
+ while (1) switch (_context49.prev = _context49.next) {
4994
4806
  case 0:
4995
4807
  if (this.store.order) {
4996
- _context52.next = 2;
4808
+ _context49.next = 2;
4997
4809
  break;
4998
4810
  }
4999
4811
  throw new Error('order 模块未初始化');
5000
4812
  case 2:
5001
4813
  amount = Number(params.amount || 0);
5002
4814
  if (!(!Number.isFinite(amount) || amount <= 0)) {
5003
- _context52.next = 5;
4815
+ _context49.next = 5;
5004
4816
  break;
5005
4817
  }
5006
4818
  throw new Error('现金支付金额必须大于 0');
5007
4819
  case 5:
5008
- _context52.next = 7;
4820
+ _context49.next = 7;
5009
4821
  return this.getCashPaymentConfig();
5010
4822
  case 7:
5011
- config = _context52.sent;
4823
+ config = _context49.sent;
5012
4824
  paymentMethod = config.paymentMethod;
5013
4825
  if (paymentMethod) {
5014
- _context52.next = 11;
4826
+ _context49.next = 11;
5015
4827
  break;
5016
4828
  }
5017
4829
  throw new Error('未找到可用的 CASHMANUAL 支付方式');
5018
4830
  case 11:
5019
4831
  if (!(config.amountDue <= 0)) {
5020
- _context52.next = 13;
4832
+ _context49.next = 13;
5021
4833
  break;
5022
4834
  }
5023
4835
  throw new Error('当前订单没有待支付金额');
@@ -5025,7 +4837,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5025
4837
  roundingAmount = Number(params.roundingAmount || 0);
5026
4838
  effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
5027
4839
  if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
5028
- _context52.next = 17;
4840
+ _context49.next = 17;
5029
4841
  break;
5030
4842
  }
5031
4843
  throw new Error('现金支付金额超过当前待支付金额');
@@ -5038,7 +4850,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5038
4850
  changeAmount = Number(params.changeAmount || 0);
5039
4851
  shopWalletPassId = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.shop_wallet_pass_id;
5040
4852
  if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
5041
- _context52.next = 26;
4853
+ _context49.next = 26;
5042
4854
  break;
5043
4855
  }
5044
4856
  throw new Error('顾客实收现金不能小于支付金额');
@@ -5073,8 +4885,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5073
4885
  var _item$metadata2;
5074
4886
  return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
5075
4887
  });
5076
- _context52.prev = 29;
5077
- _context52.next = 32;
4888
+ _context49.prev = 29;
4889
+ _context49.next = 32;
5078
4890
  return this.syncPaymentsToOrder({
5079
4891
  payments: payments,
5080
4892
  submitWhenPaid: true,
@@ -5082,50 +4894,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5082
4894
  confirmPendingVoucherPayments: true
5083
4895
  });
5084
4896
  case 32:
5085
- syncResult = _context52.sent;
4897
+ syncResult = _context49.sent;
5086
4898
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
5087
- _context52.next = 35;
4899
+ _context49.next = 35;
5088
4900
  break;
5089
4901
  }
5090
4902
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
5091
4903
  case 35:
5092
4904
  if (!this.store.payment) {
5093
- _context52.next = 40;
4905
+ _context49.next = 40;
5094
4906
  break;
5095
4907
  }
5096
4908
  committed = this.getCommittedWalletAssets();
5097
4909
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5098
- _context52.next = 40;
4910
+ _context49.next = 40;
5099
4911
  return this.publishWalletAssetsState(walletState);
5100
4912
  case 40:
5101
- return _context52.abrupt("return", {
4913
+ return _context49.abrupt("return", {
5102
4914
  payment: payment || {},
5103
4915
  payments: this.store.order.getOrderPayments(),
5104
4916
  syncResult: syncResult,
5105
4917
  isOrderFullyPaid: syncResult.isOrderFullyPaid
5106
4918
  });
5107
4919
  case 43:
5108
- _context52.prev = 43;
5109
- _context52.t0 = _context52["catch"](29);
4920
+ _context49.prev = 43;
4921
+ _context49.t0 = _context49["catch"](29);
5110
4922
  this.store.order.setOrderPayments(beforePayments);
5111
4923
  restoredTempOrder = this.store.order.getTempOrder();
5112
4924
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5113
4925
  restoredTempOrder.payment_status = beforePaymentStatus;
5114
4926
  this.store.order.persistTempOrder();
5115
4927
  }
5116
- _context52.next = 50;
4928
+ _context49.next = 50;
5117
4929
  return this.store.order.recalculateSummary({
5118
4930
  createIfMissing: true
5119
4931
  });
5120
4932
  case 50:
5121
- throw _context52.t0;
4933
+ throw _context49.t0;
5122
4934
  case 51:
5123
4935
  case "end":
5124
- return _context52.stop();
4936
+ return _context49.stop();
5125
4937
  }
5126
- }, _callee52, this, [[29, 43]]);
4938
+ }, _callee49, this, [[29, 43]]);
5127
4939
  }));
5128
- function payCash(_x43) {
4940
+ function payCash(_x41) {
5129
4941
  return _payCash.apply(this, arguments);
5130
4942
  }
5131
4943
  return payCash;
@@ -5141,21 +4953,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5141
4953
  }, {
5142
4954
  key: "commitPaymentMethodPayment",
5143
4955
  value: (function () {
5144
- var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
4956
+ var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5145
4957
  var _this$store$order$get7, _this$store$order15, _this$store$order$get8, _params$metadata, _params$originAmount;
5146
4958
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5147
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5148
- while (1) switch (_context53.prev = _context53.next) {
4959
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4960
+ while (1) switch (_context50.prev = _context50.next) {
5149
4961
  case 0:
5150
4962
  if (this.store.order) {
5151
- _context53.next = 2;
4963
+ _context50.next = 2;
5152
4964
  break;
5153
4965
  }
5154
4966
  throw new Error('order 模块未初始化');
5155
4967
  case 2:
5156
4968
  amount = Number(params.amount || 0);
5157
4969
  if (!(!Number.isFinite(amount) || amount <= 0)) {
5158
- _context53.next = 5;
4970
+ _context50.next = 5;
5159
4971
  break;
5160
4972
  }
5161
4973
  throw new Error('支付金额必须大于 0');
@@ -5171,17 +4983,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5171
4983
  };
5172
4984
  paymentMethod = findPaymentMethod();
5173
4985
  if (paymentMethod) {
5174
- _context53.next = 13;
4986
+ _context50.next = 13;
5175
4987
  break;
5176
4988
  }
5177
- _context53.next = 11;
4989
+ _context50.next = 11;
5178
4990
  return this.getPaymentMethodsAsync();
5179
4991
  case 11:
5180
- paymentMethods = _context53.sent;
4992
+ paymentMethods = _context50.sent;
5181
4993
  paymentMethod = findPaymentMethod();
5182
4994
  case 13:
5183
4995
  if (paymentMethod) {
5184
- _context53.next = 15;
4996
+ _context50.next = 15;
5185
4997
  break;
5186
4998
  }
5187
4999
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
@@ -5190,13 +5002,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5190
5002
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5191
5003
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5192
5004
  if (!amountDue.lte(0)) {
5193
- _context53.next = 20;
5005
+ _context50.next = 20;
5194
5006
  break;
5195
5007
  }
5196
5008
  throw new Error('当前订单没有待支付金额');
5197
5009
  case 20:
5198
5010
  if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
5199
- _context53.next = 22;
5011
+ _context50.next = 22;
5200
5012
  break;
5201
5013
  }
5202
5014
  throw new Error('支付金额超过当前待支付金额');
@@ -5235,8 +5047,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5235
5047
  var _item$metadata3;
5236
5048
  return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
5237
5049
  });
5238
- _context53.prev = 30;
5239
- _context53.next = 33;
5050
+ _context50.prev = 30;
5051
+ _context50.next = 33;
5240
5052
  return this.syncPaymentsToOrder({
5241
5053
  payments: payments,
5242
5054
  submitWhenPaid: true,
@@ -5244,50 +5056,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5244
5056
  confirmPendingVoucherPayments: true
5245
5057
  });
5246
5058
  case 33:
5247
- syncResult = _context53.sent;
5059
+ syncResult = _context50.sent;
5248
5060
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
5249
- _context53.next = 36;
5061
+ _context50.next = 36;
5250
5062
  break;
5251
5063
  }
5252
5064
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
5253
5065
  case 36:
5254
5066
  if (!this.store.payment) {
5255
- _context53.next = 41;
5067
+ _context50.next = 41;
5256
5068
  break;
5257
5069
  }
5258
5070
  committed = this.getCommittedWalletAssets();
5259
5071
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5260
- _context53.next = 41;
5072
+ _context50.next = 41;
5261
5073
  return this.publishWalletAssetsState(walletState);
5262
5074
  case 41:
5263
- return _context53.abrupt("return", {
5075
+ return _context50.abrupt("return", {
5264
5076
  payment: payment || {},
5265
5077
  payments: this.store.order.getOrderPayments(),
5266
5078
  syncResult: syncResult,
5267
5079
  isOrderFullyPaid: syncResult.isOrderFullyPaid
5268
5080
  });
5269
5081
  case 44:
5270
- _context53.prev = 44;
5271
- _context53.t0 = _context53["catch"](30);
5082
+ _context50.prev = 44;
5083
+ _context50.t0 = _context50["catch"](30);
5272
5084
  this.store.order.setOrderPayments(beforePayments);
5273
5085
  restoredTempOrder = this.store.order.getTempOrder();
5274
5086
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
5275
5087
  restoredTempOrder.payment_status = beforePaymentStatus;
5276
5088
  this.store.order.persistTempOrder();
5277
5089
  }
5278
- _context53.next = 51;
5090
+ _context50.next = 51;
5279
5091
  return this.store.order.recalculateSummary({
5280
5092
  createIfMissing: true
5281
5093
  });
5282
5094
  case 51:
5283
- throw _context53.t0;
5095
+ throw _context50.t0;
5284
5096
  case 52:
5285
5097
  case "end":
5286
- return _context53.stop();
5098
+ return _context50.stop();
5287
5099
  }
5288
- }, _callee53, this, [[30, 44]]);
5100
+ }, _callee50, this, [[30, 44]]);
5289
5101
  }));
5290
- function commitPaymentMethodPayment(_x44) {
5102
+ function commitPaymentMethodPayment(_x42) {
5291
5103
  return _commitPaymentMethodPayment.apply(this, arguments);
5292
5104
  }
5293
5105
  return commitPaymentMethodPayment;
@@ -5302,40 +5114,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5302
5114
  }, {
5303
5115
  key: "roundAmount",
5304
5116
  value: (function () {
5305
- var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
5117
+ var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
5306
5118
  var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
5307
5119
  var amount, cashManualPayment;
5308
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5309
- while (1) switch (_context54.prev = _context54.next) {
5120
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5121
+ while (1) switch (_context51.prev = _context51.next) {
5310
5122
  case 0:
5311
5123
  amount = params.amount;
5312
5124
  cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
5313
5125
  return paymentMethod.code === 'CASHMANUAL';
5314
5126
  });
5315
5127
  if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
5316
- _context54.next = 4;
5128
+ _context51.next = 4;
5317
5129
  break;
5318
5130
  }
5319
- return _context54.abrupt("return", {
5131
+ return _context51.abrupt("return", {
5320
5132
  originalAmount: amount.toString(),
5321
5133
  roundedAmount: amount.toString(),
5322
5134
  roundingDifference: '0.00'
5323
5135
  });
5324
5136
  case 4:
5325
5137
  if (this.payment) {
5326
- _context54.next = 6;
5138
+ _context51.next = 6;
5327
5139
  break;
5328
5140
  }
5329
5141
  throw new Error('payment 模块未初始化');
5330
5142
  case 6:
5331
- return _context54.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
5143
+ return _context51.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
5332
5144
  case 7:
5333
5145
  case "end":
5334
- return _context54.stop();
5146
+ return _context51.stop();
5335
5147
  }
5336
- }, _callee54, this);
5148
+ }, _callee51, this);
5337
5149
  }));
5338
- function roundAmount(_x45) {
5150
+ function roundAmount(_x43) {
5339
5151
  return _roundAmount.apply(this, arguments);
5340
5152
  }
5341
5153
  return roundAmount;
@@ -5350,49 +5162,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5350
5162
  }, {
5351
5163
  key: "sendCustomerPayLink",
5352
5164
  value: (function () {
5353
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5165
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
5354
5166
  var orderIds, _ref41, _ref42, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
5355
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5356
- while (1) switch (_context55.prev = _context55.next) {
5167
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5168
+ while (1) switch (_context52.prev = _context52.next) {
5357
5169
  case 0:
5358
5170
  if (this.store.order) {
5359
- _context55.next = 2;
5171
+ _context52.next = 2;
5360
5172
  break;
5361
5173
  }
5362
5174
  throw new Error('order 模块未初始化');
5363
5175
  case 2:
5364
5176
  orderIds = params.order_ids || params.orderIds || [];
5365
5177
  if (!(!orderIds.length || params.submitBeforeSend)) {
5366
- _context55.next = 11;
5178
+ _context52.next = 11;
5367
5179
  break;
5368
5180
  }
5369
- _context55.next = 6;
5181
+ _context52.next = 6;
5370
5182
  return this.submitSalesOrder({
5371
5183
  smallTicketDataFlag: 1
5372
5184
  });
5373
5185
  case 6:
5374
- submitResult = _context55.sent;
5186
+ submitResult = _context52.sent;
5375
5187
  orderId = (_ref41 = (_ref42 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref42 !== void 0 ? _ref42 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref41 !== void 0 ? _ref41 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
5376
5188
  if (orderId) {
5377
- _context55.next = 10;
5189
+ _context52.next = 10;
5378
5190
  break;
5379
5191
  }
5380
5192
  throw new Error('本地订单提交云端失败,无法发送支付链接');
5381
5193
  case 10:
5382
5194
  orderIds = [orderId];
5383
5195
  case 11:
5384
- return _context55.abrupt("return", this.store.order.sendCustomerPayLink({
5196
+ return _context52.abrupt("return", this.store.order.sendCustomerPayLink({
5385
5197
  emails: params.emails,
5386
5198
  notify_action: params.notify_action,
5387
5199
  order_ids: orderIds
5388
5200
  }));
5389
5201
  case 12:
5390
5202
  case "end":
5391
- return _context55.stop();
5203
+ return _context52.stop();
5392
5204
  }
5393
- }, _callee55, this);
5205
+ }, _callee52, this);
5394
5206
  }));
5395
- function sendCustomerPayLink(_x46) {
5207
+ function sendCustomerPayLink(_x44) {
5396
5208
  return _sendCustomerPayLink.apply(this, arguments);
5397
5209
  }
5398
5210
  return sendCustomerPayLink;
@@ -5405,20 +5217,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5405
5217
  }, {
5406
5218
  key: "calculateProductBookingPrice",
5407
5219
  value: function () {
5408
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5220
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
5409
5221
  var _params$customer_id;
5410
5222
  var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
5411
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5412
- while (1) switch (_context56.prev = _context56.next) {
5223
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5224
+ while (1) switch (_context53.prev = _context53.next) {
5413
5225
  case 0:
5414
5226
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
5415
5227
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
5416
5228
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
5417
- _context56.next = 5;
5229
+ _context53.next = 5;
5418
5230
  return this.prepareProductPriceQueryContext(customerId);
5419
5231
  case 5:
5420
5232
  channel = this.getPriceQueryChannel(params.channel);
5421
- _context56.next = 8;
5233
+ _context53.next = 8;
5422
5234
  return this.resolveProductsForPriceQuery({
5423
5235
  priceQueries: [params],
5424
5236
  schedule: this.getPriceQuerySchedule(params),
@@ -5426,22 +5238,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5426
5238
  channel: channel
5427
5239
  });
5428
5240
  case 8:
5429
- _yield$this$resolvePr = _context56.sent;
5241
+ _yield$this$resolvePr = _context53.sent;
5430
5242
  _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
5431
5243
  authoritativeProduct = _yield$this$resolvePr2[0];
5432
5244
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
5433
5245
  if (useCustomerUserPricing) {
5434
- _context56.next = 15;
5246
+ _context53.next = 15;
5435
5247
  break;
5436
5248
  }
5437
- _context56.next = 15;
5249
+ _context53.next = 15;
5438
5250
  return this.loadQuotationForPriceQuery({
5439
5251
  quotation: quotation,
5440
5252
  customer_id: customerId,
5441
5253
  channel: channel
5442
5254
  });
5443
5255
  case 15:
5444
- return _context56.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
5256
+ return _context53.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
5445
5257
  channel: channel,
5446
5258
  product: product,
5447
5259
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
@@ -5450,11 +5262,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5450
5262
  })));
5451
5263
  case 16:
5452
5264
  case "end":
5453
- return _context56.stop();
5265
+ return _context53.stop();
5454
5266
  }
5455
- }, _callee56, this);
5267
+ }, _callee53, this);
5456
5268
  }));
5457
- function calculateProductBookingPrice(_x47) {
5269
+ function calculateProductBookingPrice(_x45) {
5458
5270
  return _calculateProductBookingPrice.apply(this, arguments);
5459
5271
  }
5460
5272
  return calculateProductBookingPrice;
@@ -5538,17 +5350,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5538
5350
  }, {
5539
5351
  key: "calculateProductBookingPrices",
5540
5352
  value: function () {
5541
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(paramsList) {
5353
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(paramsList) {
5542
5354
  var _this18 = this;
5543
5355
  var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
5544
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5545
- while (1) switch (_context58.prev = _context58.next) {
5356
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5357
+ while (1) switch (_context55.prev = _context55.next) {
5546
5358
  case 0:
5547
5359
  if (paramsList.length) {
5548
- _context58.next = 2;
5360
+ _context55.next = 2;
5549
5361
  break;
5550
5362
  }
5551
- return _context58.abrupt("return", []);
5363
+ return _context55.abrupt("return", []);
5552
5364
  case 2:
5553
5365
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
5554
5366
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
@@ -5575,20 +5387,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5575
5387
  group.indices.push(index);
5576
5388
  groups.set(groupKey, group);
5577
5389
  });
5578
- _context58.next = 11;
5390
+ _context55.next = 11;
5579
5391
  return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
5580
- var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(group) {
5392
+ var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(group) {
5581
5393
  var priceQueries, resolvedProducts;
5582
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5583
- while (1) switch (_context57.prev = _context57.next) {
5394
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5395
+ while (1) switch (_context54.prev = _context54.next) {
5584
5396
  case 0:
5585
- _context57.next = 2;
5397
+ _context54.next = 2;
5586
5398
  return _this18.prepareProductPriceQueryContext(group.customerId);
5587
5399
  case 2:
5588
5400
  priceQueries = group.indices.map(function (index) {
5589
5401
  return paramsList[index];
5590
5402
  });
5591
- _context57.next = 5;
5403
+ _context54.next = 5;
5592
5404
  return _this18.resolveProductsForPriceQuery({
5593
5405
  priceQueries: priceQueries,
5594
5406
  schedule: group.schedule,
@@ -5596,23 +5408,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5596
5408
  channel: group.channel
5597
5409
  });
5598
5410
  case 5:
5599
- resolvedProducts = _context57.sent;
5411
+ resolvedProducts = _context54.sent;
5600
5412
  group.indices.forEach(function (originalIndex, groupIndex) {
5601
5413
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
5602
5414
  });
5603
5415
  case 7:
5604
5416
  case "end":
5605
- return _context57.stop();
5417
+ return _context54.stop();
5606
5418
  }
5607
- }, _callee57);
5419
+ }, _callee54);
5608
5420
  }));
5609
- return function (_x49) {
5421
+ return function (_x47) {
5610
5422
  return _ref43.apply(this, arguments);
5611
5423
  };
5612
5424
  }()));
5613
5425
  case 11:
5614
5426
  if (useCustomerUserPricing) {
5615
- _context58.next = 16;
5427
+ _context55.next = 16;
5616
5428
  break;
5617
5429
  }
5618
5430
  quotationContexts = new Map();
@@ -5626,14 +5438,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5626
5438
  customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
5627
5439
  });
5628
5440
  });
5629
- _context58.next = 16;
5441
+ _context55.next = 16;
5630
5442
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
5631
5443
  return _this18.loadQuotationForPriceQuery(_objectSpread({
5632
5444
  quotation: quotation
5633
5445
  }, context));
5634
5446
  }));
5635
5447
  case 16:
5636
- return _context58.abrupt("return", paramsList.map(function (params, index) {
5448
+ return _context55.abrupt("return", paramsList.map(function (params, index) {
5637
5449
  var _params$customer_id4;
5638
5450
  var productInput = params.product || {};
5639
5451
  var authoritativeProduct = authoritativeProducts[index];
@@ -5650,11 +5462,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5650
5462
  }));
5651
5463
  case 17:
5652
5464
  case "end":
5653
- return _context58.stop();
5465
+ return _context55.stop();
5654
5466
  }
5655
- }, _callee58, this);
5467
+ }, _callee55, this);
5656
5468
  }));
5657
- function calculateProductBookingPrices(_x48) {
5469
+ function calculateProductBookingPrices(_x46) {
5658
5470
  return _calculateProductBookingPrices.apply(this, arguments);
5659
5471
  }
5660
5472
  return calculateProductBookingPrices;
@@ -5662,34 +5474,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5662
5474
  }, {
5663
5475
  key: "addProductToOrder",
5664
5476
  value: function () {
5665
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(product, booking, options) {
5477
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(product, booking, options) {
5666
5478
  var products;
5667
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5668
- while (1) switch (_context59.prev = _context59.next) {
5479
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5480
+ while (1) switch (_context56.prev = _context56.next) {
5669
5481
  case 0:
5670
- _context59.prev = 0;
5482
+ _context56.prev = 0;
5671
5483
  if (this.store.order) {
5672
- _context59.next = 3;
5484
+ _context56.next = 3;
5673
5485
  break;
5674
5486
  }
5675
5487
  throw new Error('order 模块未初始化');
5676
5488
  case 3:
5677
- _context59.next = 5;
5489
+ _context56.next = 5;
5678
5490
  return this.store.order.addProductToOrder(product, booking, options);
5679
5491
  case 5:
5680
- products = _context59.sent;
5681
- return _context59.abrupt("return", products);
5492
+ products = _context56.sent;
5493
+ return _context56.abrupt("return", products);
5682
5494
  case 9:
5683
- _context59.prev = 9;
5684
- _context59.t0 = _context59["catch"](0);
5685
- throw _context59.t0;
5495
+ _context56.prev = 9;
5496
+ _context56.t0 = _context56["catch"](0);
5497
+ throw _context56.t0;
5686
5498
  case 12:
5687
5499
  case "end":
5688
- return _context59.stop();
5500
+ return _context56.stop();
5689
5501
  }
5690
- }, _callee59, this, [[0, 9]]);
5502
+ }, _callee56, this, [[0, 9]]);
5691
5503
  }));
5692
- function addProductToOrder(_x50, _x51, _x52) {
5504
+ function addProductToOrder(_x48, _x49, _x50) {
5693
5505
  return _addProductToOrder.apply(this, arguments);
5694
5506
  }
5695
5507
  return addProductToOrder;
@@ -5697,34 +5509,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5697
5509
  }, {
5698
5510
  key: "updateOrderProduct",
5699
5511
  value: function () {
5700
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
5512
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
5701
5513
  var products;
5702
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5703
- while (1) switch (_context60.prev = _context60.next) {
5514
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5515
+ while (1) switch (_context57.prev = _context57.next) {
5704
5516
  case 0:
5705
- _context60.prev = 0;
5517
+ _context57.prev = 0;
5706
5518
  if (this.store.order) {
5707
- _context60.next = 3;
5519
+ _context57.next = 3;
5708
5520
  break;
5709
5521
  }
5710
5522
  throw new Error('order 模块未初始化');
5711
5523
  case 3:
5712
- _context60.next = 5;
5524
+ _context57.next = 5;
5713
5525
  return this.store.order.updateOrderProduct(params);
5714
5526
  case 5:
5715
- products = _context60.sent;
5716
- return _context60.abrupt("return", products);
5527
+ products = _context57.sent;
5528
+ return _context57.abrupt("return", products);
5717
5529
  case 9:
5718
- _context60.prev = 9;
5719
- _context60.t0 = _context60["catch"](0);
5720
- throw _context60.t0;
5530
+ _context57.prev = 9;
5531
+ _context57.t0 = _context57["catch"](0);
5532
+ throw _context57.t0;
5721
5533
  case 12:
5722
5534
  case "end":
5723
- return _context60.stop();
5535
+ return _context57.stop();
5724
5536
  }
5725
- }, _callee60, this, [[0, 9]]);
5537
+ }, _callee57, this, [[0, 9]]);
5726
5538
  }));
5727
- function updateOrderProduct(_x53) {
5539
+ function updateOrderProduct(_x51) {
5728
5540
  return _updateOrderProduct.apply(this, arguments);
5729
5541
  }
5730
5542
  return updateOrderProduct;
@@ -5732,34 +5544,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5732
5544
  }, {
5733
5545
  key: "updateOrderProducts",
5734
5546
  value: function () {
5735
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(paramsList) {
5547
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(paramsList) {
5736
5548
  var products;
5737
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
5738
- while (1) switch (_context61.prev = _context61.next) {
5549
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5550
+ while (1) switch (_context58.prev = _context58.next) {
5739
5551
  case 0:
5740
- _context61.prev = 0;
5552
+ _context58.prev = 0;
5741
5553
  if (this.store.order) {
5742
- _context61.next = 3;
5554
+ _context58.next = 3;
5743
5555
  break;
5744
5556
  }
5745
5557
  throw new Error('order 模块未初始化');
5746
5558
  case 3:
5747
- _context61.next = 5;
5559
+ _context58.next = 5;
5748
5560
  return this.store.order.updateOrderProducts(paramsList);
5749
5561
  case 5:
5750
- products = _context61.sent;
5751
- return _context61.abrupt("return", products);
5562
+ products = _context58.sent;
5563
+ return _context58.abrupt("return", products);
5752
5564
  case 9:
5753
- _context61.prev = 9;
5754
- _context61.t0 = _context61["catch"](0);
5755
- throw _context61.t0;
5565
+ _context58.prev = 9;
5566
+ _context58.t0 = _context58["catch"](0);
5567
+ throw _context58.t0;
5756
5568
  case 12:
5757
5569
  case "end":
5758
- return _context61.stop();
5570
+ return _context58.stop();
5759
5571
  }
5760
- }, _callee61, this, [[0, 9]]);
5572
+ }, _callee58, this, [[0, 9]]);
5761
5573
  }));
5762
- function updateOrderProducts(_x54) {
5574
+ function updateOrderProducts(_x52) {
5763
5575
  return _updateOrderProducts.apply(this, arguments);
5764
5576
  }
5765
5577
  return updateOrderProducts;
@@ -5767,34 +5579,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5767
5579
  }, {
5768
5580
  key: "updateOrderProductQuantity",
5769
5581
  value: function () {
5770
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
5582
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
5771
5583
  var products;
5772
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
5773
- while (1) switch (_context62.prev = _context62.next) {
5584
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5585
+ while (1) switch (_context59.prev = _context59.next) {
5774
5586
  case 0:
5775
- _context62.prev = 0;
5587
+ _context59.prev = 0;
5776
5588
  if (this.store.order) {
5777
- _context62.next = 3;
5589
+ _context59.next = 3;
5778
5590
  break;
5779
5591
  }
5780
5592
  throw new Error('order 模块未初始化');
5781
5593
  case 3:
5782
- _context62.next = 5;
5594
+ _context59.next = 5;
5783
5595
  return this.store.order.updateOrderProductQuantity(params);
5784
5596
  case 5:
5785
- products = _context62.sent;
5786
- return _context62.abrupt("return", products);
5597
+ products = _context59.sent;
5598
+ return _context59.abrupt("return", products);
5787
5599
  case 9:
5788
- _context62.prev = 9;
5789
- _context62.t0 = _context62["catch"](0);
5790
- throw _context62.t0;
5600
+ _context59.prev = 9;
5601
+ _context59.t0 = _context59["catch"](0);
5602
+ throw _context59.t0;
5791
5603
  case 12:
5792
5604
  case "end":
5793
- return _context62.stop();
5605
+ return _context59.stop();
5794
5606
  }
5795
- }, _callee62, this, [[0, 9]]);
5607
+ }, _callee59, this, [[0, 9]]);
5796
5608
  }));
5797
- function updateOrderProductQuantity(_x55) {
5609
+ function updateOrderProductQuantity(_x53) {
5798
5610
  return _updateOrderProductQuantity.apply(this, arguments);
5799
5611
  }
5800
5612
  return updateOrderProductQuantity;
@@ -5817,12 +5629,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5817
5629
  }, {
5818
5630
  key: "setOrderProductLineNote",
5819
5631
  value: (function () {
5820
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(identity, note) {
5632
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(identity, note) {
5821
5633
  var params, products;
5822
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
5823
- while (1) switch (_context63.prev = _context63.next) {
5634
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5635
+ while (1) switch (_context60.prev = _context60.next) {
5824
5636
  case 0:
5825
- _context63.prev = 0;
5637
+ _context60.prev = 0;
5826
5638
  params = {
5827
5639
  product_id: identity.product_id,
5828
5640
  product_variant_id: identity.product_variant_id,
@@ -5837,22 +5649,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5837
5649
  params.product_sku = identity.product_sku;
5838
5650
  }
5839
5651
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
5840
- _context63.next = 7;
5652
+ _context60.next = 7;
5841
5653
  return this.updateOrderProduct(params);
5842
5654
  case 7:
5843
- products = _context63.sent;
5844
- return _context63.abrupt("return", products);
5655
+ products = _context60.sent;
5656
+ return _context60.abrupt("return", products);
5845
5657
  case 11:
5846
- _context63.prev = 11;
5847
- _context63.t0 = _context63["catch"](0);
5848
- throw _context63.t0;
5658
+ _context60.prev = 11;
5659
+ _context60.t0 = _context60["catch"](0);
5660
+ throw _context60.t0;
5849
5661
  case 14:
5850
5662
  case "end":
5851
- return _context63.stop();
5663
+ return _context60.stop();
5852
5664
  }
5853
- }, _callee63, this, [[0, 11]]);
5665
+ }, _callee60, this, [[0, 11]]);
5854
5666
  }));
5855
- function setOrderProductLineNote(_x56, _x57) {
5667
+ function setOrderProductLineNote(_x54, _x55) {
5856
5668
  return _setOrderProductLineNote.apply(this, arguments);
5857
5669
  }
5858
5670
  return setOrderProductLineNote;
@@ -5867,32 +5679,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5867
5679
  }, {
5868
5680
  key: "removeProductsFromOrder",
5869
5681
  value: (function () {
5870
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(identities, options) {
5871
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
5872
- while (1) switch (_context64.prev = _context64.next) {
5682
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(identities, options) {
5683
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
5684
+ while (1) switch (_context61.prev = _context61.next) {
5873
5685
  case 0:
5874
- _context64.prev = 0;
5686
+ _context61.prev = 0;
5875
5687
  if (this.store.order) {
5876
- _context64.next = 3;
5688
+ _context61.next = 3;
5877
5689
  break;
5878
5690
  }
5879
5691
  throw new Error('order 模块未初始化');
5880
5692
  case 3:
5881
- _context64.next = 5;
5693
+ _context61.next = 5;
5882
5694
  return this.store.order.removeProductsFromOrder(identities, options);
5883
5695
  case 5:
5884
- return _context64.abrupt("return", _context64.sent);
5696
+ return _context61.abrupt("return", _context61.sent);
5885
5697
  case 8:
5886
- _context64.prev = 8;
5887
- _context64.t0 = _context64["catch"](0);
5888
- throw _context64.t0;
5698
+ _context61.prev = 8;
5699
+ _context61.t0 = _context61["catch"](0);
5700
+ throw _context61.t0;
5889
5701
  case 11:
5890
5702
  case "end":
5891
- return _context64.stop();
5703
+ return _context61.stop();
5892
5704
  }
5893
- }, _callee64, this, [[0, 8]]);
5705
+ }, _callee61, this, [[0, 8]]);
5894
5706
  }));
5895
- function removeProductsFromOrder(_x58, _x59) {
5707
+ function removeProductsFromOrder(_x56, _x57) {
5896
5708
  return _removeProductsFromOrder.apply(this, arguments);
5897
5709
  }
5898
5710
  return removeProductsFromOrder;
@@ -5900,18 +5712,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5900
5712
  }, {
5901
5713
  key: "removeProductFromOrder",
5902
5714
  value: function () {
5903
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(identity, options) {
5904
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
5905
- while (1) switch (_context65.prev = _context65.next) {
5715
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(identity, options) {
5716
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
5717
+ while (1) switch (_context62.prev = _context62.next) {
5906
5718
  case 0:
5907
- return _context65.abrupt("return", this.removeProductsFromOrder([identity], options));
5719
+ return _context62.abrupt("return", this.removeProductsFromOrder([identity], options));
5908
5720
  case 1:
5909
5721
  case "end":
5910
- return _context65.stop();
5722
+ return _context62.stop();
5911
5723
  }
5912
- }, _callee65, this);
5724
+ }, _callee62, this);
5913
5725
  }));
5914
- function removeProductFromOrder(_x60, _x61) {
5726
+ function removeProductFromOrder(_x58, _x59) {
5915
5727
  return _removeProductFromOrder.apply(this, arguments);
5916
5728
  }
5917
5729
  return removeProductFromOrder;
@@ -5961,23 +5773,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5961
5773
  }, {
5962
5774
  key: "applyPromotion",
5963
5775
  value: (function () {
5964
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
5965
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
5966
- while (1) switch (_context66.prev = _context66.next) {
5776
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63() {
5777
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
5778
+ while (1) switch (_context63.prev = _context63.next) {
5967
5779
  case 0:
5968
5780
  if (this.store.order) {
5969
- _context66.next = 2;
5781
+ _context63.next = 2;
5970
5782
  break;
5971
5783
  }
5972
5784
  throw new Error('order 模块未初始化');
5973
5785
  case 2:
5974
- _context66.next = 4;
5786
+ _context63.next = 4;
5975
5787
  return this.store.order.applyPromotion();
5976
5788
  case 4:
5977
5789
  case "end":
5978
- return _context66.stop();
5790
+ return _context63.stop();
5979
5791
  }
5980
- }, _callee66, this);
5792
+ }, _callee63, this);
5981
5793
  }));
5982
5794
  function applyPromotion() {
5983
5795
  return _applyPromotion.apply(this, arguments);
@@ -6004,18 +5816,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6004
5816
  }, {
6005
5817
  key: "getProductList",
6006
5818
  value: function () {
6007
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
5819
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64() {
6008
5820
  var _this$otherParams35;
6009
5821
  var menu_list_ids, _this$store$products, res;
6010
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6011
- while (1) switch (_context67.prev = _context67.next) {
5822
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
5823
+ while (1) switch (_context64.prev = _context64.next) {
6012
5824
  case 0:
6013
5825
  // 可以直接通过配置里的 menu 读取
6014
5826
  menu_list_ids = ((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 || (_this$otherParams35 = _this$otherParams35.dineInConfig) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35['menu.associated_menus'].map(function (n) {
6015
5827
  return Number(n.value);
6016
5828
  })) || [];
6017
- _context67.prev = 1;
6018
- _context67.next = 4;
5829
+ _context64.prev = 1;
5830
+ _context64.next = 4;
6019
5831
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
6020
5832
  menu_list_ids: menu_list_ids,
6021
5833
  cacheId: this.cacheId,
@@ -6023,17 +5835,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6023
5835
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
6024
5836
  });
6025
5837
  case 4:
6026
- res = _context67.sent;
6027
- return _context67.abrupt("return", res);
5838
+ res = _context64.sent;
5839
+ return _context64.abrupt("return", res);
6028
5840
  case 8:
6029
- _context67.prev = 8;
6030
- _context67.t0 = _context67["catch"](1);
6031
- throw _context67.t0;
5841
+ _context64.prev = 8;
5842
+ _context64.t0 = _context64["catch"](1);
5843
+ throw _context64.t0;
6032
5844
  case 11:
6033
5845
  case "end":
6034
- return _context67.stop();
5846
+ return _context64.stop();
6035
5847
  }
6036
- }, _callee67, this, [[1, 8]]);
5848
+ }, _callee64, this, [[1, 8]]);
6037
5849
  }));
6038
5850
  function getProductList() {
6039
5851
  return _getProductList.apply(this, arguments);
@@ -6048,33 +5860,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6048
5860
  }, {
6049
5861
  key: "setOtherParams",
6050
5862
  value: function () {
6051
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
5863
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
6052
5864
  var _this$otherParams36;
6053
5865
  var _ref44,
6054
5866
  _ref44$cover,
6055
5867
  cover,
6056
- _args68 = arguments;
6057
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6058
- while (1) switch (_context68.prev = _context68.next) {
5868
+ _args65 = arguments;
5869
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
5870
+ while (1) switch (_context65.prev = _context65.next) {
6059
5871
  case 0:
6060
- _ref44 = _args68.length > 1 && _args68[1] !== undefined ? _args68[1] : {}, _ref44$cover = _ref44.cover, cover = _ref44$cover === void 0 ? false : _ref44$cover;
5872
+ _ref44 = _args65.length > 1 && _args65[1] !== undefined ? _args65[1] : {}, _ref44$cover = _ref44.cover, cover = _ref44$cover === void 0 ? false : _ref44$cover;
6061
5873
  if (cover) {
6062
5874
  this.otherParams = _objectSpread({}, params);
6063
5875
  } else {
6064
5876
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
6065
5877
  }
6066
5878
  this.cacheId = (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.cacheId;
6067
- _context68.next = 5;
5879
+ _context65.next = 5;
6068
5880
  return this.syncOtherParamsToSubModules(params, {
6069
5881
  cover: cover
6070
5882
  });
6071
5883
  case 5:
6072
5884
  case "end":
6073
- return _context68.stop();
5885
+ return _context65.stop();
6074
5886
  }
6075
- }, _callee68, this);
5887
+ }, _callee65, this);
6076
5888
  }));
6077
- function setOtherParams(_x62) {
5889
+ function setOtherParams(_x60) {
6078
5890
  return _setOtherParams.apply(this, arguments);
6079
5891
  }
6080
5892
  return setOtherParams;