@pisell/pisellos 2.2.204 → 2.2.206

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 (68) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/OpenData/index.d.ts +1 -0
  3. package/dist/modules/OpenData/index.js +21 -16
  4. package/dist/modules/Order/index.d.ts +9 -0
  5. package/dist/modules/Order/index.js +237 -146
  6. package/dist/modules/Order/types.d.ts +10 -0
  7. package/dist/modules/Order/utils.js +7 -5
  8. package/dist/modules/Payment/index.d.ts +0 -13
  9. package/dist/modules/Payment/index.js +449 -833
  10. package/dist/plugins/request.d.ts +1 -0
  11. package/dist/server/index.d.ts +142 -0
  12. package/dist/server/index.js +2208 -824
  13. package/dist/server/modules/index.d.ts +2 -0
  14. package/dist/server/modules/index.js +2 -0
  15. package/dist/server/modules/order/index.d.ts +7 -0
  16. package/dist/server/modules/order/index.js +375 -337
  17. package/dist/server/modules/order/types.d.ts +15 -0
  18. package/dist/server/modules/order/types.js +8 -0
  19. package/dist/server/modules/payment/index.d.ts +28 -0
  20. package/dist/server/modules/payment/index.js +305 -0
  21. package/dist/server/modules/payment/types.d.ts +9 -0
  22. package/dist/server/modules/payment/types.js +1 -0
  23. package/dist/server/utils/small-ticket.d.ts +69 -0
  24. package/dist/server/utils/small-ticket.js +528 -0
  25. package/dist/solution/BaseSales/index.d.ts +10 -3
  26. package/dist/solution/BaseSales/index.js +307 -198
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/index.d.ts +8 -1
  29. package/dist/solution/BookingTicket/index.js +444 -264
  30. package/dist/solution/BookingTicket/types.d.ts +2 -1
  31. package/dist/solution/BookingTicket/types.js +3 -1
  32. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
  33. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  34. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  35. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  36. package/lib/modules/OpenData/index.d.ts +1 -0
  37. package/lib/modules/OpenData/index.js +6 -4
  38. package/lib/modules/Order/index.d.ts +9 -0
  39. package/lib/modules/Order/index.js +64 -4
  40. package/lib/modules/Order/types.d.ts +10 -0
  41. package/lib/modules/Order/utils.js +4 -3
  42. package/lib/modules/Payment/index.d.ts +0 -13
  43. package/lib/modules/Payment/index.js +6 -149
  44. package/lib/plugins/request.d.ts +1 -0
  45. package/lib/server/index.d.ts +142 -0
  46. package/lib/server/index.js +867 -49
  47. package/lib/server/modules/index.d.ts +2 -0
  48. package/lib/server/modules/index.js +3 -0
  49. package/lib/server/modules/order/index.d.ts +7 -0
  50. package/lib/server/modules/order/index.js +21 -7
  51. package/lib/server/modules/order/types.d.ts +15 -0
  52. package/lib/server/modules/payment/index.d.ts +28 -0
  53. package/lib/server/modules/payment/index.js +192 -0
  54. package/lib/server/modules/payment/types.d.ts +9 -0
  55. package/lib/server/modules/payment/types.js +17 -0
  56. package/lib/server/utils/small-ticket.d.ts +69 -0
  57. package/lib/server/utils/small-ticket.js +555 -0
  58. package/lib/solution/BaseSales/index.d.ts +10 -3
  59. package/lib/solution/BaseSales/index.js +98 -6
  60. package/lib/solution/BookingByStep/index.d.ts +1 -1
  61. package/lib/solution/BookingTicket/index.d.ts +8 -1
  62. package/lib/solution/BookingTicket/index.js +109 -2
  63. package/lib/solution/BookingTicket/types.d.ts +2 -1
  64. package/lib/solution/BookingTicket/types.js +5 -0
  65. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
  66. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  67. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  68. package/package.json +1 -1
@@ -1221,6 +1221,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1221
1221
  if (price.lte(0) || points.lte(0)) return payment.wallet_pass_use_value;
1222
1222
  return amount.div(price).times(points).toDecimalPlaces(2).toFixed(2);
1223
1223
  }
1224
+ }, {
1225
+ key: "adjustVoucherFundRecord",
1226
+ value: function adjustVoucherFundRecord(params) {
1227
+ var _params$voucher$fund_;
1228
+ var fundRecord = params.voucher.fund_record && _typeof(params.voucher.fund_record) === 'object' && !Array.isArray(params.voucher.fund_record) ? _objectSpread({}, params.voucher.fund_record) : null;
1229
+ if (!fundRecord || fundRecord.using_before_value === undefined || fundRecord.using_before_value === null) {
1230
+ return fundRecord || undefined;
1231
+ }
1232
+ var code = String(params.voucher.code || '').toUpperCase();
1233
+ var isPointCard = code === 'POINTCARD' || String(((_params$voucher$fund_ = params.voucher.fund_record) === null || _params$voucher$fund_ === void 0 ? void 0 : _params$voucher$fund_.tag) || '').toLowerCase() === 'point_card';
1234
+ var usingValue = isPointCard ? new Decimal(params.walletPassUseValue || 0) : params.amount;
1235
+ fundRecord.using_after_value = new Decimal(fundRecord.using_before_value || 0).minus(usingValue).toDecimalPlaces(2).toFixed(2);
1236
+ return fundRecord;
1237
+ }
1224
1238
  }, {
1225
1239
  key: "capVoucherPaymentsByRemainingAmount",
1226
1240
  value: function capVoucherPaymentsByRemainingAmount(params) {
@@ -1239,10 +1253,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1239
1253
  if (voucherAmount.lte(0)) continue;
1240
1254
  var cappedAmount = Decimal.min(voucherAmount, remainingAmount);
1241
1255
  var amountText = cappedAmount.toDecimalPlaces(2).toFixed(2);
1256
+ var walletPassUseValue = this.resolveWalletPassUseValue(voucher, cappedAmount);
1242
1257
  cappedVouchers.push(_objectSpread(_objectSpread({}, voucher), {}, {
1243
1258
  amount: amountText,
1244
1259
  origin_amount: amountText,
1245
- wallet_pass_use_value: this.resolveWalletPassUseValue(voucher, cappedAmount)
1260
+ wallet_pass_use_value: walletPassUseValue,
1261
+ fund_record: this.adjustVoucherFundRecord({
1262
+ voucher: voucher,
1263
+ amount: cappedAmount,
1264
+ walletPassUseValue: walletPassUseValue
1265
+ })
1246
1266
  }));
1247
1267
  remainingAmount = remainingAmount.minus(cappedAmount);
1248
1268
  }
@@ -2781,6 +2801,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2781
2801
  shouldForceNewLine = !!booking;
2782
2802
  matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
2783
2803
  if (_this16.hasGoodPassDiscount(item)) return false;
2804
+ if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
2784
2805
  if (item.product_id !== productToAdd.product_id) return false;
2785
2806
  if (item.product_variant_id !== productToAdd.product_variant_id) return false;
2786
2807
  var existedFingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
@@ -3377,25 +3398,90 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3377
3398
  }
3378
3399
  return clearOrderCartLines;
3379
3400
  }() // ─── TempOrder: 提交 ───
3401
+ )
3402
+ }, {
3403
+ key: "buildCurrentSubmitPayloadForLocalPrint",
3404
+ value: function buildCurrentSubmitPayloadForLocalPrint(params) {
3405
+ var _params$cacheId, _this$otherParams, _ref64, _params$businessCode, _this$otherParams2, _this$otherParams3;
3406
+ var tempOrder = this.ensureTempOrder();
3407
+ this.persistTempOrder();
3408
+ var payload = buildSubmitPayload({
3409
+ tempOrder: tempOrder,
3410
+ cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
3411
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform),
3412
+ businessCode: (_ref64 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _ref64 !== void 0 ? _ref64 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code,
3413
+ channel: params === null || params === void 0 ? void 0 : params.channel,
3414
+ type: params === null || params === void 0 ? void 0 : params.type,
3415
+ enhance: function enhance(nextPayload) {
3416
+ var _ref65, _tempOrder$order_numb, _ref66, _tempOrder$shop_order, _ref67, _tempOrder$shop_full_;
3417
+ return _objectSpread(_objectSpread({}, nextPayload), {}, {
3418
+ order_number: (_ref65 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref65 !== void 0 ? _ref65 : null,
3419
+ shop_order_number: (_ref66 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref66 !== void 0 ? _ref66 : null,
3420
+ shop_full_order_number: (_ref67 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref67 !== void 0 ? _ref67 : null,
3421
+ small_ticket_data_flag: 1
3422
+ });
3423
+ }
3424
+ });
3425
+ payload.created_at = undefined;
3426
+ return payload;
3427
+ }
3428
+ }, {
3429
+ key: "applyLocalPrintOrderNumbers",
3430
+ value: function () {
3431
+ var _applyLocalPrintOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(order) {
3432
+ var tempOrder, shopOrderNumber, shopFullOrderNumber;
3433
+ return _regeneratorRuntime().wrap(function _callee23$(_context25) {
3434
+ while (1) switch (_context25.prev = _context25.next) {
3435
+ case 0:
3436
+ tempOrder = this.ensureTempOrder();
3437
+ if (!(!order || _typeof(order) !== 'object')) {
3438
+ _context25.next = 3;
3439
+ break;
3440
+ }
3441
+ return _context25.abrupt("return", tempOrder);
3442
+ case 3:
3443
+ shopOrderNumber = order.shop_order_number;
3444
+ shopFullOrderNumber = order.shop_full_order_number;
3445
+ if (shopOrderNumber !== undefined && shopOrderNumber !== null && shopOrderNumber !== '') {
3446
+ tempOrder.shop_order_number = String(shopOrderNumber);
3447
+ }
3448
+ if (shopFullOrderNumber !== undefined && shopFullOrderNumber !== null && shopFullOrderNumber !== '') {
3449
+ tempOrder.shop_full_order_number = String(shopFullOrderNumber);
3450
+ }
3451
+ this.persistTempOrder();
3452
+ _context25.next = 10;
3453
+ return this.saveDraft();
3454
+ case 10:
3455
+ return _context25.abrupt("return", tempOrder);
3456
+ case 11:
3457
+ case "end":
3458
+ return _context25.stop();
3459
+ }
3460
+ }, _callee23, this);
3461
+ }));
3462
+ function applyLocalPrintOrderNumbers(_x25) {
3463
+ return _applyLocalPrintOrderNumbers.apply(this, arguments);
3464
+ }
3465
+ return applyLocalPrintOrderNumbers;
3466
+ }()
3380
3467
  /**
3381
3468
  * 提交当前 Sales tempOrder。
3382
3469
  *
3383
3470
  * smallTicketDataFlag 用于 B 端 checkout 小票数据返回。PaymentModal 在支付提交时
3384
3471
  * 应传 1,确保 /shop/order/sales/checkout 返回打印所需数据。
3385
3472
  */
3386
- )
3387
3473
  }, {
3388
3474
  key: "submitTempOrder",
3389
- value: function () {
3390
- var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
3391
- var _params$cacheId, _this$otherParams, _ref64, _params$businessCode, _this$otherParams2, _this$otherParams3;
3475
+ value: (function () {
3476
+ var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
3477
+ var _params$cacheId2, _this$otherParams4, _ref68, _params$businessCode2, _this$otherParams5, _this$otherParams6;
3392
3478
  var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
3393
- return _regeneratorRuntime().wrap(function _callee23$(_context25) {
3394
- while (1) switch (_context25.prev = _context25.next) {
3479
+ return _regeneratorRuntime().wrap(function _callee24$(_context26) {
3480
+ while (1) switch (_context26.prev = _context26.next) {
3395
3481
  case 0:
3396
3482
  tempOrder = this.ensureTempOrder();
3397
3483
  this.persistTempOrder();
3398
- effectiveCacheId = (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId;
3484
+ effectiveCacheId = (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId;
3399
3485
  hasPaymentOverride = (params === null || params === void 0 ? void 0 : params.payments) !== undefined;
3400
3486
  hasPaymentStatusOverride = (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined;
3401
3487
  hasSmallTicketDataFlagOverride = (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined;
@@ -3413,17 +3499,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3413
3499
  payload = buildSubmitPayload({
3414
3500
  tempOrder: tempOrder,
3415
3501
  cacheId: effectiveCacheId,
3416
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform),
3417
- businessCode: (_ref64 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _ref64 !== void 0 ? _ref64 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code,
3502
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform),
3503
+ businessCode: (_ref68 = (_params$businessCode2 = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode2 !== void 0 ? _params$businessCode2 : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode) !== null && _ref68 !== void 0 ? _ref68 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.business_code,
3418
3504
  channel: params === null || params === void 0 ? void 0 : params.channel,
3419
3505
  type: params === null || params === void 0 ? void 0 : params.type,
3420
3506
  enhance: enhancePayload
3421
3507
  }); // TODO: 前端生成的时间现在是有问题的,后面要统一优化
3422
3508
  payload.created_at = undefined;
3423
- _context25.next = 11;
3509
+ _context26.next = 11;
3424
3510
  return this.saveDraft();
3425
3511
  case 11:
3426
- _context25.prev = 11;
3512
+ _context26.prev = 11;
3427
3513
  this.logInfo('submitTempOrder calling sales checkout', {
3428
3514
  orderId: payload.order_id,
3429
3515
  externalSaleNumber: payload.external_sale_number,
@@ -3432,88 +3518,93 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3432
3518
  paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
3433
3519
  smallTicketDataFlag: payload.small_ticket_data_flag
3434
3520
  });
3435
- _context25.next = 15;
3521
+ _context26.next = 15;
3436
3522
  return this.submitSalesOrder({
3437
3523
  query: payload
3438
3524
  });
3439
3525
  case 15:
3440
- result = _context25.sent;
3441
- _context25.next = 28;
3526
+ result = _context26.sent;
3527
+ _context26.next = 28;
3442
3528
  break;
3443
3529
  case 18:
3444
- _context25.prev = 18;
3445
- _context25.t0 = _context25["catch"](11);
3446
- backendErrorResponse = this.extractSubmitErrorResponse(_context25.t0);
3530
+ _context26.prev = 18;
3531
+ _context26.t0 = _context26["catch"](11);
3532
+ backendErrorResponse = this.extractSubmitErrorResponse(_context26.t0);
3447
3533
  if (!backendErrorResponse) {
3448
- _context25.next = 25;
3534
+ _context26.next = 25;
3449
3535
  break;
3450
3536
  }
3451
3537
  this.store.syncState = 'failed';
3452
3538
  this.logSubmitBackendRejected(backendErrorResponse, payload);
3453
- return _context25.abrupt("return", backendErrorResponse);
3539
+ return _context26.abrupt("return", backendErrorResponse);
3454
3540
  case 25:
3455
3541
  this.store.syncState = 'failed';
3456
3542
  this.logError('submitTempOrder failed', {
3457
- error: _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0),
3543
+ error: _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0),
3458
3544
  orderId: payload.order_id,
3459
3545
  externalSaleNumber: payload.external_sale_number,
3460
3546
  paymentStatus: payload.payment_status,
3461
3547
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
3462
3548
  });
3463
- throw _context25.t0;
3549
+ throw _context26.t0;
3464
3550
  case 28:
3465
3551
  if (!this.isSubmitResponseRejected(result)) {
3466
- _context25.next = 32;
3552
+ _context26.next = 32;
3467
3553
  break;
3468
3554
  }
3469
3555
  this.store.syncState = 'failed';
3470
3556
  this.logSubmitBackendRejected(result, payload);
3471
- return _context25.abrupt("return", result);
3557
+ return _context26.abrupt("return", result);
3472
3558
  case 32:
3473
3559
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
3474
3560
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
3475
- _context25.next = 38;
3561
+ _context26.next = 40;
3476
3562
  break;
3477
3563
  }
3478
3564
  tempOrder.order_id = submittedOrderId;
3479
3565
  resultRecord = result;
3480
- _context25.next = 38;
3566
+ _context26.next = 38;
3481
3567
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
3482
3568
  case 38:
3483
- return _context25.abrupt("return", result);
3484
- case 39:
3569
+ _context26.next = 41;
3570
+ break;
3571
+ case 40:
3572
+ this.store.syncState = 'submitted';
3573
+ case 41:
3574
+ return _context26.abrupt("return", result);
3575
+ case 42:
3485
3576
  case "end":
3486
- return _context25.stop();
3577
+ return _context26.stop();
3487
3578
  }
3488
- }, _callee23, this, [[11, 18]]);
3579
+ }, _callee24, this, [[11, 18]]);
3489
3580
  }));
3490
- function submitTempOrder(_x25) {
3581
+ function submitTempOrder(_x26) {
3491
3582
  return _submitTempOrder.apply(this, arguments);
3492
3583
  }
3493
3584
  return submitTempOrder;
3494
- }()
3585
+ }())
3495
3586
  }, {
3496
3587
  key: "markLocalOrderSynced",
3497
3588
  value: function () {
3498
- var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(orderId, remoteOrder) {
3589
+ var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(orderId, remoteOrder) {
3499
3590
  var tempOrder;
3500
- return _regeneratorRuntime().wrap(function _callee24$(_context26) {
3501
- while (1) switch (_context26.prev = _context26.next) {
3591
+ return _regeneratorRuntime().wrap(function _callee25$(_context27) {
3592
+ while (1) switch (_context27.prev = _context27.next) {
3502
3593
  case 0:
3503
3594
  tempOrder = this.ensureTempOrder();
3504
3595
  tempOrder.order_id = orderId;
3505
3596
  this.store.lastOrderInfo = remoteOrder;
3506
3597
  this.store.syncState = 'submitted';
3507
3598
  this.persistTempOrder();
3508
- _context26.next = 7;
3599
+ _context27.next = 7;
3509
3600
  return this.saveDraft();
3510
3601
  case 7:
3511
3602
  case "end":
3512
- return _context26.stop();
3603
+ return _context27.stop();
3513
3604
  }
3514
- }, _callee24, this);
3605
+ }, _callee25, this);
3515
3606
  }));
3516
- function markLocalOrderSynced(_x26, _x27) {
3607
+ function markLocalOrderSynced(_x27, _x28) {
3517
3608
  return _markLocalOrderSynced.apply(this, arguments);
3518
3609
  }
3519
3610
  return markLocalOrderSynced;
@@ -3560,10 +3651,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3560
3651
  }, {
3561
3652
  key: "syncPaymentsToOrder",
3562
3653
  value: function () {
3563
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
3654
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
3564
3655
  var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, paymentStatus, paymentSyncIdempotencyToken, submitResult;
3565
- return _regeneratorRuntime().wrap(function _callee25$(_context27) {
3566
- while (1) switch (_context27.prev = _context27.next) {
3656
+ return _regeneratorRuntime().wrap(function _callee26$(_context28) {
3657
+ while (1) switch (_context28.prev = _context28.next) {
3567
3658
  case 0:
3568
3659
  tempOrder = this.ensureTempOrder();
3569
3660
  mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
@@ -3574,28 +3665,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3574
3665
  tempOrder.payments = mappedPayments;
3575
3666
  tempOrder.payment_status = paymentStatus;
3576
3667
  this.persistTempOrder();
3577
- _context27.next = 11;
3668
+ _context28.next = 11;
3578
3669
  return this.saveDraft();
3579
3670
  case 11:
3580
3671
  if (params.submitWhenPaid) {
3581
- _context27.next = 13;
3672
+ _context28.next = 13;
3582
3673
  break;
3583
3674
  }
3584
- return _context27.abrupt("return", {
3675
+ return _context28.abrupt("return", {
3585
3676
  isFullyPaid: isFullyPaid
3586
3677
  });
3587
3678
  case 13:
3588
3679
  if (!(this.store.syncState === 'submitting')) {
3589
- _context27.next = 15;
3680
+ _context28.next = 15;
3590
3681
  break;
3591
3682
  }
3592
- return _context27.abrupt("return", {
3683
+ return _context28.abrupt("return", {
3593
3684
  isFullyPaid: isFullyPaid
3594
3685
  });
3595
3686
  case 15:
3596
3687
  this.store.syncState = 'submitting';
3597
3688
  paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, mappedPayments);
3598
- _context27.next = 19;
3689
+ _context28.next = 19;
3599
3690
  return this.submitTempOrder({
3600
3691
  payments: mappedPayments,
3601
3692
  paymentStatus: paymentStatus,
@@ -3610,18 +3701,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3610
3701
  }
3611
3702
  });
3612
3703
  case 19:
3613
- submitResult = _context27.sent;
3614
- return _context27.abrupt("return", {
3704
+ submitResult = _context28.sent;
3705
+ return _context28.abrupt("return", {
3615
3706
  isFullyPaid: isFullyPaid,
3616
3707
  submitResult: submitResult
3617
3708
  });
3618
3709
  case 21:
3619
3710
  case "end":
3620
- return _context27.stop();
3711
+ return _context28.stop();
3621
3712
  }
3622
- }, _callee25, this);
3713
+ }, _callee26, this);
3623
3714
  }));
3624
- function syncPaymentsToOrder(_x28) {
3715
+ function syncPaymentsToOrder(_x29) {
3625
3716
  return _syncPaymentsToOrder.apply(this, arguments);
3626
3717
  }
3627
3718
  return syncPaymentsToOrder;
@@ -3710,11 +3801,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3710
3801
  }, {
3711
3802
  key: "submitOrder",
3712
3803
  value: function () {
3713
- var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(order) {
3804
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(order) {
3714
3805
  var _order$query$cartItem, _params$bookings, _params$relation_prod;
3715
3806
  var url, query, fetchUrl, params;
3716
- return _regeneratorRuntime().wrap(function _callee26$(_context28) {
3717
- while (1) switch (_context28.prev = _context28.next) {
3807
+ return _regeneratorRuntime().wrap(function _callee27$(_context29) {
3808
+ while (1) switch (_context29.prev = _context29.next) {
3718
3809
  case 0:
3719
3810
  this.logInfo('submitOrder called', {
3720
3811
  url: order.url,
@@ -3734,14 +3825,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3734
3825
  relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
3735
3826
  scheduleDate: params.schedule_date
3736
3827
  });
3737
- return _context28.abrupt("return", this.request.post(fetchUrl, params));
3828
+ return _context29.abrupt("return", this.request.post(fetchUrl, params));
3738
3829
  case 6:
3739
3830
  case "end":
3740
- return _context28.stop();
3831
+ return _context29.stop();
3741
3832
  }
3742
- }, _callee26, this);
3833
+ }, _callee27, this);
3743
3834
  }));
3744
- function submitOrder(_x29) {
3835
+ function submitOrder(_x30) {
3745
3836
  return _submitOrder.apply(this, arguments);
3746
3837
  }
3747
3838
  return submitOrder;
@@ -3749,13 +3840,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3749
3840
  }, {
3750
3841
  key: "cancelOrder",
3751
3842
  value: function () {
3752
- var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3843
+ var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3753
3844
  var payload;
3754
- return _regeneratorRuntime().wrap(function _callee27$(_context29) {
3755
- while (1) switch (_context29.prev = _context29.next) {
3845
+ return _regeneratorRuntime().wrap(function _callee28$(_context30) {
3846
+ while (1) switch (_context30.prev = _context30.next) {
3756
3847
  case 0:
3757
3848
  if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
3758
- _context29.next = 2;
3849
+ _context30.next = 2;
3759
3850
  break;
3760
3851
  }
3761
3852
  throw new Error('取消订单失败:order_ids 不能为空');
@@ -3771,16 +3862,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3771
3862
  method: 'PUT',
3772
3863
  orderIdsCount: params.order_ids.length
3773
3864
  });
3774
- return _context29.abrupt("return", this.request.put('/order/update-status', payload, {
3865
+ return _context30.abrupt("return", this.request.put('/order/update-status', payload, {
3775
3866
  isShopApi: true
3776
3867
  }));
3777
3868
  case 5:
3778
3869
  case "end":
3779
- return _context29.stop();
3870
+ return _context30.stop();
3780
3871
  }
3781
- }, _callee27, this);
3872
+ }, _callee28, this);
3782
3873
  }));
3783
- function cancelOrder(_x30) {
3874
+ function cancelOrder(_x31) {
3784
3875
  return _cancelOrder.apply(this, arguments);
3785
3876
  }
3786
3877
  return cancelOrder;
@@ -3788,19 +3879,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3788
3879
  }, {
3789
3880
  key: "changeBookingStatus",
3790
3881
  value: function () {
3791
- var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3882
+ var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3792
3883
  var url, payload;
3793
- return _regeneratorRuntime().wrap(function _callee28$(_context30) {
3794
- while (1) switch (_context30.prev = _context30.next) {
3884
+ return _regeneratorRuntime().wrap(function _callee29$(_context31) {
3885
+ while (1) switch (_context31.prev = _context31.next) {
3795
3886
  case 0:
3796
3887
  if (params.booking_id) {
3797
- _context30.next = 2;
3888
+ _context31.next = 2;
3798
3889
  break;
3799
3890
  }
3800
3891
  throw new Error('变更预约状态失败:booking_id 不能为空');
3801
3892
  case 2:
3802
3893
  if (params.appointment_status) {
3803
- _context30.next = 4;
3894
+ _context31.next = 4;
3804
3895
  break;
3805
3896
  }
3806
3897
  throw new Error('变更预约状态失败:appointment_status 不能为空');
@@ -3815,16 +3906,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3815
3906
  bookingId: params.booking_id,
3816
3907
  appointmentStatus: params.appointment_status
3817
3908
  });
3818
- return _context30.abrupt("return", this.request.put(url, payload, {
3909
+ return _context31.abrupt("return", this.request.put(url, payload, {
3819
3910
  isShopApi: true
3820
3911
  }));
3821
3912
  case 8:
3822
3913
  case "end":
3823
- return _context30.stop();
3914
+ return _context31.stop();
3824
3915
  }
3825
- }, _callee28, this);
3916
+ }, _callee29, this);
3826
3917
  }));
3827
- function changeBookingStatus(_x31) {
3918
+ function changeBookingStatus(_x32) {
3828
3919
  return _changeBookingStatus.apply(this, arguments);
3829
3920
  }
3830
3921
  return changeBookingStatus;
@@ -3842,11 +3933,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3842
3933
  }, {
3843
3934
  key: "createOrderByCheckout",
3844
3935
  value: (function () {
3845
- var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3936
+ var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3846
3937
  var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
3847
3938
  var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
3848
- return _regeneratorRuntime().wrap(function _callee29$(_context31) {
3849
- while (1) switch (_context31.prev = _context31.next) {
3939
+ return _regeneratorRuntime().wrap(function _callee30$(_context32) {
3940
+ while (1) switch (_context32.prev = _context32.next) {
3850
3941
  case 0:
3851
3942
  // 过滤掉由在线店铺下单的 payment 支付数据
3852
3943
  onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
@@ -3880,7 +3971,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3880
3971
  relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
3881
3972
  paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
3882
3973
  });
3883
- _context31.prev = 4;
3974
+ _context32.prev = 4;
3884
3975
  // 构建订单数据,设置默认值并允许 params 覆盖
3885
3976
  orderData = _objectSpread({
3886
3977
  sales_channel: 'my_pisel',
@@ -3942,13 +4033,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3942
4033
  hasOrderId: !!orderData.order_id,
3943
4034
  smallTicketDataFlag: orderData.small_ticket_data_flag
3944
4035
  });
3945
- _context31.next = 12;
3946
- return this.request.post('/shop/order/checkout', orderData, {
4036
+ _context32.next = 12;
4037
+ return this.request.post('/order/checkout', orderData, {
3947
4038
  osServer: true,
3948
4039
  customToast: function customToast() {}
3949
4040
  });
3950
4041
  case 12:
3951
- response = _context31.sent;
4042
+ response = _context32.sent;
3952
4043
  this.logInfo('Order API called successfully', {
3953
4044
  response: response
3954
4045
  });
@@ -3956,22 +4047,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3956
4047
  success: !!response,
3957
4048
  hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
3958
4049
  });
3959
- return _context31.abrupt("return", response);
4050
+ return _context32.abrupt("return", response);
3960
4051
  case 18:
3961
- _context31.prev = 18;
3962
- _context31.t0 = _context31["catch"](4);
3963
- console.error('[Order] createOrderByCheckout 创建订单失败:', _context31.t0);
4052
+ _context32.prev = 18;
4053
+ _context32.t0 = _context32["catch"](4);
4054
+ console.error('[Order] createOrderByCheckout 创建订单失败:', _context32.t0);
3964
4055
  this.logInfo('Order API called failed', {
3965
- error: _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0)
4056
+ error: _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0)
3966
4057
  });
3967
- throw _context31.t0;
4058
+ throw _context32.t0;
3968
4059
  case 23:
3969
4060
  case "end":
3970
- return _context31.stop();
4061
+ return _context32.stop();
3971
4062
  }
3972
- }, _callee29, this, [[4, 18]]);
4063
+ }, _callee30, this, [[4, 18]]);
3973
4064
  }));
3974
- function createOrderByCheckout(_x32) {
4065
+ function createOrderByCheckout(_x33) {
3975
4066
  return _createOrderByCheckout.apply(this, arguments);
3976
4067
  }
3977
4068
  return createOrderByCheckout;
@@ -3979,24 +4070,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3979
4070
  }, {
3980
4071
  key: "submitSalesOrder",
3981
4072
  value: function () {
3982
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
4073
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3983
4074
  var url, query, fetchUrl;
3984
- return _regeneratorRuntime().wrap(function _callee30$(_context32) {
3985
- while (1) switch (_context32.prev = _context32.next) {
4075
+ return _regeneratorRuntime().wrap(function _callee31$(_context33) {
4076
+ while (1) switch (_context33.prev = _context33.next) {
3986
4077
  case 0:
3987
4078
  url = params.url, query = params.query;
3988
4079
  fetchUrl = url || '/order/sales/checkout';
3989
- return _context32.abrupt("return", this.request.post(fetchUrl, query, {
4080
+ return _context33.abrupt("return", this.request.post(fetchUrl, query, {
3990
4081
  osServer: true,
3991
4082
  customToast: function customToast() {}
3992
4083
  }));
3993
4084
  case 3:
3994
4085
  case "end":
3995
- return _context32.stop();
4086
+ return _context33.stop();
3996
4087
  }
3997
- }, _callee30, this);
4088
+ }, _callee31, this);
3998
4089
  }));
3999
- function submitSalesOrder(_x33) {
4090
+ function submitSalesOrder(_x34) {
4000
4091
  return _submitSalesOrder.apply(this, arguments);
4001
4092
  }
4002
4093
  return submitSalesOrder;
@@ -4010,37 +4101,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4010
4101
  }, {
4011
4102
  key: "sendCustomerPayLink",
4012
4103
  value: (function () {
4013
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
4104
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
4014
4105
  var _params$emails;
4015
4106
  var orderIds;
4016
- return _regeneratorRuntime().wrap(function _callee31$(_context33) {
4017
- while (1) switch (_context33.prev = _context33.next) {
4107
+ return _regeneratorRuntime().wrap(function _callee32$(_context34) {
4108
+ while (1) switch (_context34.prev = _context34.next) {
4018
4109
  case 0:
4019
4110
  orderIds = params.order_ids || params.orderIds || [];
4020
4111
  if (orderIds.length) {
4021
- _context33.next = 3;
4112
+ _context34.next = 3;
4022
4113
  break;
4023
4114
  }
4024
4115
  throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
4025
4116
  case 3:
4026
4117
  if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
4027
- _context33.next = 5;
4118
+ _context34.next = 5;
4028
4119
  break;
4029
4120
  }
4030
4121
  throw new Error('发送支付链接需要至少一个邮箱');
4031
4122
  case 5:
4032
- return _context33.abrupt("return", this.request.post('/order/batch-email', {
4123
+ return _context34.abrupt("return", this.request.post('/order/batch-email', {
4033
4124
  order_ids: orderIds,
4034
4125
  notify_action: params.notify_action || 'order_payment_reminder',
4035
4126
  emails: params.emails
4036
4127
  }));
4037
4128
  case 6:
4038
4129
  case "end":
4039
- return _context33.stop();
4130
+ return _context34.stop();
4040
4131
  }
4041
- }, _callee31, this);
4132
+ }, _callee32, this);
4042
4133
  }));
4043
- function sendCustomerPayLink(_x34) {
4134
+ function sendCustomerPayLink(_x35) {
4044
4135
  return _sendCustomerPayLink.apply(this, arguments);
4045
4136
  }
4046
4137
  return sendCustomerPayLink;
@@ -4048,19 +4139,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4048
4139
  }, {
4049
4140
  key: "getSalesOrderByLookup",
4050
4141
  value: function () {
4051
- var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
4142
+ var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
4052
4143
  var lookup, res;
4053
- return _regeneratorRuntime().wrap(function _callee32$(_context34) {
4054
- while (1) switch (_context34.prev = _context34.next) {
4144
+ return _regeneratorRuntime().wrap(function _callee33$(_context35) {
4145
+ while (1) switch (_context35.prev = _context35.next) {
4055
4146
  case 0:
4056
4147
  lookup = params.lookup === undefined || params.lookup === null ? '' : String(params.lookup).trim();
4057
4148
  if (lookup) {
4058
- _context34.next = 3;
4149
+ _context35.next = 3;
4059
4150
  break;
4060
4151
  }
4061
4152
  throw new Error('加载销售详情需要 lookup');
4062
4153
  case 3:
4063
- _context34.next = 5;
4154
+ _context35.next = 5;
4064
4155
  return this.request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
4065
4156
  with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
4066
4157
  }, params.forceRemote ? {
@@ -4069,18 +4160,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4069
4160
  osServer: true
4070
4161
  });
4071
4162
  case 5:
4072
- res = _context34.sent;
4163
+ res = _context35.sent;
4073
4164
  if (res.code === 200) {
4074
4165
  this.store.lastOrderInfo = res.data;
4075
4166
  }
4076
- return _context34.abrupt("return", res);
4167
+ return _context35.abrupt("return", res);
4077
4168
  case 8:
4078
4169
  case "end":
4079
- return _context34.stop();
4170
+ return _context35.stop();
4080
4171
  }
4081
- }, _callee32, this);
4172
+ }, _callee33, this);
4082
4173
  }));
4083
- function getSalesOrderByLookup(_x35) {
4174
+ function getSalesOrderByLookup(_x36) {
4084
4175
  return _getSalesOrderByLookup.apply(this, arguments);
4085
4176
  }
4086
4177
  return getSalesOrderByLookup;
@@ -4094,11 +4185,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4094
4185
  }, {
4095
4186
  key: "hydrateTempOrderFromRecord",
4096
4187
  value: (function () {
4097
- var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(record, options) {
4188
+ var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(record, options) {
4098
4189
  var _this$store$discount13, _this$store$discount14;
4099
4190
  var raw, nextTempOrder, rawSummary, summarySurcharges, hydratedEditDiscounts;
4100
- return _regeneratorRuntime().wrap(function _callee33$(_context35) {
4101
- while (1) switch (_context35.prev = _context35.next) {
4191
+ return _regeneratorRuntime().wrap(function _callee34$(_context36) {
4192
+ while (1) switch (_context36.prev = _context36.next) {
4102
4193
  case 0:
4103
4194
  raw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
4104
4195
  nextTempOrder = this.normalizeTempOrderForRuntime(raw);
@@ -4121,30 +4212,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4121
4212
  });
4122
4213
  this.store.lastOrderInfo = raw.lastOrderInfo || raw;
4123
4214
  hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
4124
- _context35.next = 11;
4215
+ _context36.next = 11;
4125
4216
  return (_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.setOriginalDiscountList(hydratedEditDiscounts);
4126
4217
  case 11:
4127
- _context35.next = 13;
4218
+ _context36.next = 13;
4128
4219
  return (_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.setDiscountList(hydratedEditDiscounts);
4129
4220
  case 13:
4130
4221
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
4131
- _context35.next = 16;
4222
+ _context36.next = 16;
4132
4223
  break;
4133
4224
  }
4134
- _context35.next = 16;
4225
+ _context36.next = 16;
4135
4226
  return this.recalculateSummary({
4136
4227
  createIfMissing: false
4137
4228
  });
4138
4229
  case 16:
4139
4230
  this.persistTempOrder();
4140
- return _context35.abrupt("return", nextTempOrder);
4231
+ return _context36.abrupt("return", nextTempOrder);
4141
4232
  case 18:
4142
4233
  case "end":
4143
- return _context35.stop();
4234
+ return _context36.stop();
4144
4235
  }
4145
- }, _callee33, this);
4236
+ }, _callee34, this);
4146
4237
  }));
4147
- function hydrateTempOrderFromRecord(_x36, _x37) {
4238
+ function hydrateTempOrderFromRecord(_x37, _x38) {
4148
4239
  return _hydrateTempOrderFromRecord.apply(this, arguments);
4149
4240
  }
4150
4241
  return hydrateTempOrderFromRecord;
@@ -4203,7 +4294,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4203
4294
  _step18;
4204
4295
  try {
4205
4296
  for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
4206
- var _product$metadata7, _ref65, _ref66, _existed$origin, _rawProduct$metadata;
4297
+ var _product$metadata7, _ref69, _ref70, _existed$origin, _rawProduct$metadata;
4207
4298
  var _step18$value = _slicedToArray(_step18.value, 2),
4208
4299
  index = _step18$value[0],
4209
4300
  product = _step18$value[1];
@@ -4211,7 +4302,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4211
4302
  if (!uid) continue;
4212
4303
  var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
4213
4304
  var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
4214
- var origin = (_ref65 = (_ref66 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref66 !== void 0 ? _ref66 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref65 !== void 0 ? _ref65 : rawProduct;
4305
+ var origin = (_ref69 = (_ref70 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref70 !== void 0 ? _ref70 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref69 !== void 0 ? _ref69 : rawProduct;
4215
4306
  var originSnapshot = cloneDeep(origin);
4216
4307
  var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
4217
4308
  if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
@@ -4279,10 +4370,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4279
4370
  }, {
4280
4371
  key: "normalizeHydratedProductOptionItem",
4281
4372
  value: function normalizeHydratedProductOptionItem(optionItem) {
4282
- var _ref67, _optionItem$num, _ref68, _optionItem$add_price;
4283
- var rawNum = (_ref67 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref67 !== void 0 ? _ref67 : 1;
4373
+ var _ref71, _optionItem$num, _ref72, _optionItem$add_price;
4374
+ var rawNum = (_ref71 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref71 !== void 0 ? _ref71 : 1;
4284
4375
  var parsedNum = Number(rawNum);
4285
- var rawPrice = (_ref68 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref68 !== void 0 ? _ref68 : 0;
4376
+ var rawPrice = (_ref72 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref72 !== void 0 ? _ref72 : 0;
4286
4377
  var parsedPrice = Number(rawPrice);
4287
4378
  var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
4288
4379
  option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
@@ -4338,25 +4429,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4338
4429
  }, {
4339
4430
  key: "getOrderInfo",
4340
4431
  value: function () {
4341
- var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(order_id) {
4432
+ var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(order_id) {
4342
4433
  var res;
4343
- return _regeneratorRuntime().wrap(function _callee34$(_context36) {
4344
- while (1) switch (_context36.prev = _context36.next) {
4434
+ return _regeneratorRuntime().wrap(function _callee35$(_context37) {
4435
+ while (1) switch (_context37.prev = _context37.next) {
4345
4436
  case 0:
4346
- _context36.next = 2;
4437
+ _context37.next = 2;
4347
4438
  return this.request.get("/order/sales/".concat(order_id), {
4348
4439
  with: ['products', 'bookings']
4349
4440
  });
4350
4441
  case 2:
4351
- res = _context36.sent;
4352
- return _context36.abrupt("return", res);
4442
+ res = _context37.sent;
4443
+ return _context37.abrupt("return", res);
4353
4444
  case 4:
4354
4445
  case "end":
4355
- return _context36.stop();
4446
+ return _context37.stop();
4356
4447
  }
4357
- }, _callee34, this);
4448
+ }, _callee35, this);
4358
4449
  }));
4359
- function getOrderInfo(_x38) {
4450
+ function getOrderInfo(_x39) {
4360
4451
  return _getOrderInfo.apply(this, arguments);
4361
4452
  }
4362
4453
  return getOrderInfo;
@@ -4395,9 +4486,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4395
4486
  _step23;
4396
4487
  try {
4397
4488
  for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
4398
- var _ref69, _bundle$num3;
4489
+ var _ref73, _bundle$num3;
4399
4490
  var bundle = _step23.value;
4400
- var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref69 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref69 !== void 0 ? _ref69 : 1) || 1).toNumber();
4491
+ var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref73 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref73 !== void 0 ? _ref73 : 1) || 1).toNumber();
4401
4492
  var _iterator24 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
4402
4493
  _step24;
4403
4494
  try {