@pisell/pisellos 2.2.205 → 2.2.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +21 -16
- package/dist/modules/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +230 -145
- package/dist/modules/Order/types.d.ts +10 -0
- package/dist/modules/Order/utils.js +7 -5
- package/dist/server/index.d.ts +136 -0
- package/dist/server/index.js +2055 -781
- package/dist/server/modules/order/index.d.ts +7 -0
- package/dist/server/modules/order/index.js +375 -337
- package/dist/server/modules/order/types.d.ts +15 -0
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/utils/small-ticket.d.ts +69 -0
- package/dist/server/utils/small-ticket.js +528 -0
- package/dist/solution/BaseSales/index.d.ts +4 -2
- package/dist/solution/BaseSales/index.js +248 -188
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -1
- package/dist/solution/BookingTicket/index.js +443 -263
- package/dist/solution/BookingTicket/types.d.ts +2 -1
- package/dist/solution/BookingTicket/types.js +3 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +6 -4
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +59 -3
- package/lib/modules/Order/types.d.ts +10 -0
- package/lib/modules/Order/utils.js +4 -3
- package/lib/server/index.d.ts +136 -0
- package/lib/server/index.js +823 -50
- package/lib/server/modules/order/index.d.ts +7 -0
- package/lib/server/modules/order/index.js +21 -7
- package/lib/server/modules/order/types.d.ts +15 -0
- package/lib/server/utils/small-ticket.d.ts +69 -0
- package/lib/server/utils/small-ticket.js +555 -0
- package/lib/solution/BaseSales/index.d.ts +4 -2
- package/lib/solution/BaseSales/index.js +47 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -1
- package/lib/solution/BookingTicket/index.js +108 -1
- package/lib/solution/BookingTicket/types.d.ts +2 -1
- package/lib/solution/BookingTicket/types.js +5 -0
- 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:
|
|
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
|
}
|
|
@@ -3378,25 +3398,90 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3378
3398
|
}
|
|
3379
3399
|
return clearOrderCartLines;
|
|
3380
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
|
+
}()
|
|
3381
3467
|
/**
|
|
3382
3468
|
* 提交当前 Sales tempOrder。
|
|
3383
3469
|
*
|
|
3384
3470
|
* smallTicketDataFlag 用于 B 端 checkout 小票数据返回。PaymentModal 在支付提交时
|
|
3385
3471
|
* 应传 1,确保 /shop/order/sales/checkout 返回打印所需数据。
|
|
3386
3472
|
*/
|
|
3387
|
-
)
|
|
3388
3473
|
}, {
|
|
3389
3474
|
key: "submitTempOrder",
|
|
3390
|
-
value: function () {
|
|
3391
|
-
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3392
|
-
var _params$
|
|
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;
|
|
3393
3478
|
var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
3394
|
-
return _regeneratorRuntime().wrap(function
|
|
3395
|
-
while (1) switch (
|
|
3479
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context26) {
|
|
3480
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3396
3481
|
case 0:
|
|
3397
3482
|
tempOrder = this.ensureTempOrder();
|
|
3398
3483
|
this.persistTempOrder();
|
|
3399
|
-
effectiveCacheId = (_params$
|
|
3484
|
+
effectiveCacheId = (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId;
|
|
3400
3485
|
hasPaymentOverride = (params === null || params === void 0 ? void 0 : params.payments) !== undefined;
|
|
3401
3486
|
hasPaymentStatusOverride = (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined;
|
|
3402
3487
|
hasSmallTicketDataFlagOverride = (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined;
|
|
@@ -3414,17 +3499,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3414
3499
|
payload = buildSubmitPayload({
|
|
3415
3500
|
tempOrder: tempOrder,
|
|
3416
3501
|
cacheId: effectiveCacheId,
|
|
3417
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$
|
|
3418
|
-
businessCode: (
|
|
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,
|
|
3419
3504
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
3420
3505
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
3421
3506
|
enhance: enhancePayload
|
|
3422
3507
|
}); // TODO: 前端生成的时间现在是有问题的,后面要统一优化
|
|
3423
3508
|
payload.created_at = undefined;
|
|
3424
|
-
|
|
3509
|
+
_context26.next = 11;
|
|
3425
3510
|
return this.saveDraft();
|
|
3426
3511
|
case 11:
|
|
3427
|
-
|
|
3512
|
+
_context26.prev = 11;
|
|
3428
3513
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
3429
3514
|
orderId: payload.order_id,
|
|
3430
3515
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -3433,93 +3518,93 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3433
3518
|
paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
|
|
3434
3519
|
smallTicketDataFlag: payload.small_ticket_data_flag
|
|
3435
3520
|
});
|
|
3436
|
-
|
|
3521
|
+
_context26.next = 15;
|
|
3437
3522
|
return this.submitSalesOrder({
|
|
3438
3523
|
query: payload
|
|
3439
3524
|
});
|
|
3440
3525
|
case 15:
|
|
3441
|
-
result =
|
|
3442
|
-
|
|
3526
|
+
result = _context26.sent;
|
|
3527
|
+
_context26.next = 28;
|
|
3443
3528
|
break;
|
|
3444
3529
|
case 18:
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
backendErrorResponse = this.extractSubmitErrorResponse(
|
|
3530
|
+
_context26.prev = 18;
|
|
3531
|
+
_context26.t0 = _context26["catch"](11);
|
|
3532
|
+
backendErrorResponse = this.extractSubmitErrorResponse(_context26.t0);
|
|
3448
3533
|
if (!backendErrorResponse) {
|
|
3449
|
-
|
|
3534
|
+
_context26.next = 25;
|
|
3450
3535
|
break;
|
|
3451
3536
|
}
|
|
3452
3537
|
this.store.syncState = 'failed';
|
|
3453
3538
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
3454
|
-
return
|
|
3539
|
+
return _context26.abrupt("return", backendErrorResponse);
|
|
3455
3540
|
case 25:
|
|
3456
3541
|
this.store.syncState = 'failed';
|
|
3457
3542
|
this.logError('submitTempOrder failed', {
|
|
3458
|
-
error:
|
|
3543
|
+
error: _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0),
|
|
3459
3544
|
orderId: payload.order_id,
|
|
3460
3545
|
externalSaleNumber: payload.external_sale_number,
|
|
3461
3546
|
paymentStatus: payload.payment_status,
|
|
3462
3547
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
3463
3548
|
});
|
|
3464
|
-
throw
|
|
3549
|
+
throw _context26.t0;
|
|
3465
3550
|
case 28:
|
|
3466
3551
|
if (!this.isSubmitResponseRejected(result)) {
|
|
3467
|
-
|
|
3552
|
+
_context26.next = 32;
|
|
3468
3553
|
break;
|
|
3469
3554
|
}
|
|
3470
3555
|
this.store.syncState = 'failed';
|
|
3471
3556
|
this.logSubmitBackendRejected(result, payload);
|
|
3472
|
-
return
|
|
3557
|
+
return _context26.abrupt("return", result);
|
|
3473
3558
|
case 32:
|
|
3474
3559
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
3475
3560
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
3476
|
-
|
|
3561
|
+
_context26.next = 40;
|
|
3477
3562
|
break;
|
|
3478
3563
|
}
|
|
3479
3564
|
tempOrder.order_id = submittedOrderId;
|
|
3480
3565
|
resultRecord = result;
|
|
3481
|
-
|
|
3566
|
+
_context26.next = 38;
|
|
3482
3567
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
3483
3568
|
case 38:
|
|
3484
|
-
|
|
3569
|
+
_context26.next = 41;
|
|
3485
3570
|
break;
|
|
3486
3571
|
case 40:
|
|
3487
3572
|
this.store.syncState = 'submitted';
|
|
3488
3573
|
case 41:
|
|
3489
|
-
return
|
|
3574
|
+
return _context26.abrupt("return", result);
|
|
3490
3575
|
case 42:
|
|
3491
3576
|
case "end":
|
|
3492
|
-
return
|
|
3577
|
+
return _context26.stop();
|
|
3493
3578
|
}
|
|
3494
|
-
},
|
|
3579
|
+
}, _callee24, this, [[11, 18]]);
|
|
3495
3580
|
}));
|
|
3496
|
-
function submitTempOrder(
|
|
3581
|
+
function submitTempOrder(_x26) {
|
|
3497
3582
|
return _submitTempOrder.apply(this, arguments);
|
|
3498
3583
|
}
|
|
3499
3584
|
return submitTempOrder;
|
|
3500
|
-
}()
|
|
3585
|
+
}())
|
|
3501
3586
|
}, {
|
|
3502
3587
|
key: "markLocalOrderSynced",
|
|
3503
3588
|
value: function () {
|
|
3504
|
-
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3589
|
+
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(orderId, remoteOrder) {
|
|
3505
3590
|
var tempOrder;
|
|
3506
|
-
return _regeneratorRuntime().wrap(function
|
|
3507
|
-
while (1) switch (
|
|
3591
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context27) {
|
|
3592
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3508
3593
|
case 0:
|
|
3509
3594
|
tempOrder = this.ensureTempOrder();
|
|
3510
3595
|
tempOrder.order_id = orderId;
|
|
3511
3596
|
this.store.lastOrderInfo = remoteOrder;
|
|
3512
3597
|
this.store.syncState = 'submitted';
|
|
3513
3598
|
this.persistTempOrder();
|
|
3514
|
-
|
|
3599
|
+
_context27.next = 7;
|
|
3515
3600
|
return this.saveDraft();
|
|
3516
3601
|
case 7:
|
|
3517
3602
|
case "end":
|
|
3518
|
-
return
|
|
3603
|
+
return _context27.stop();
|
|
3519
3604
|
}
|
|
3520
|
-
},
|
|
3605
|
+
}, _callee25, this);
|
|
3521
3606
|
}));
|
|
3522
|
-
function markLocalOrderSynced(
|
|
3607
|
+
function markLocalOrderSynced(_x27, _x28) {
|
|
3523
3608
|
return _markLocalOrderSynced.apply(this, arguments);
|
|
3524
3609
|
}
|
|
3525
3610
|
return markLocalOrderSynced;
|
|
@@ -3566,10 +3651,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3566
3651
|
}, {
|
|
3567
3652
|
key: "syncPaymentsToOrder",
|
|
3568
3653
|
value: function () {
|
|
3569
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3654
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
3570
3655
|
var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, paymentStatus, paymentSyncIdempotencyToken, submitResult;
|
|
3571
|
-
return _regeneratorRuntime().wrap(function
|
|
3572
|
-
while (1) switch (
|
|
3656
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context28) {
|
|
3657
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3573
3658
|
case 0:
|
|
3574
3659
|
tempOrder = this.ensureTempOrder();
|
|
3575
3660
|
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
@@ -3580,28 +3665,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3580
3665
|
tempOrder.payments = mappedPayments;
|
|
3581
3666
|
tempOrder.payment_status = paymentStatus;
|
|
3582
3667
|
this.persistTempOrder();
|
|
3583
|
-
|
|
3668
|
+
_context28.next = 11;
|
|
3584
3669
|
return this.saveDraft();
|
|
3585
3670
|
case 11:
|
|
3586
3671
|
if (params.submitWhenPaid) {
|
|
3587
|
-
|
|
3672
|
+
_context28.next = 13;
|
|
3588
3673
|
break;
|
|
3589
3674
|
}
|
|
3590
|
-
return
|
|
3675
|
+
return _context28.abrupt("return", {
|
|
3591
3676
|
isFullyPaid: isFullyPaid
|
|
3592
3677
|
});
|
|
3593
3678
|
case 13:
|
|
3594
3679
|
if (!(this.store.syncState === 'submitting')) {
|
|
3595
|
-
|
|
3680
|
+
_context28.next = 15;
|
|
3596
3681
|
break;
|
|
3597
3682
|
}
|
|
3598
|
-
return
|
|
3683
|
+
return _context28.abrupt("return", {
|
|
3599
3684
|
isFullyPaid: isFullyPaid
|
|
3600
3685
|
});
|
|
3601
3686
|
case 15:
|
|
3602
3687
|
this.store.syncState = 'submitting';
|
|
3603
3688
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, mappedPayments);
|
|
3604
|
-
|
|
3689
|
+
_context28.next = 19;
|
|
3605
3690
|
return this.submitTempOrder({
|
|
3606
3691
|
payments: mappedPayments,
|
|
3607
3692
|
paymentStatus: paymentStatus,
|
|
@@ -3616,18 +3701,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3616
3701
|
}
|
|
3617
3702
|
});
|
|
3618
3703
|
case 19:
|
|
3619
|
-
submitResult =
|
|
3620
|
-
return
|
|
3704
|
+
submitResult = _context28.sent;
|
|
3705
|
+
return _context28.abrupt("return", {
|
|
3621
3706
|
isFullyPaid: isFullyPaid,
|
|
3622
3707
|
submitResult: submitResult
|
|
3623
3708
|
});
|
|
3624
3709
|
case 21:
|
|
3625
3710
|
case "end":
|
|
3626
|
-
return
|
|
3711
|
+
return _context28.stop();
|
|
3627
3712
|
}
|
|
3628
|
-
},
|
|
3713
|
+
}, _callee26, this);
|
|
3629
3714
|
}));
|
|
3630
|
-
function syncPaymentsToOrder(
|
|
3715
|
+
function syncPaymentsToOrder(_x29) {
|
|
3631
3716
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3632
3717
|
}
|
|
3633
3718
|
return syncPaymentsToOrder;
|
|
@@ -3716,11 +3801,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3716
3801
|
}, {
|
|
3717
3802
|
key: "submitOrder",
|
|
3718
3803
|
value: function () {
|
|
3719
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3804
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(order) {
|
|
3720
3805
|
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
3721
3806
|
var url, query, fetchUrl, params;
|
|
3722
|
-
return _regeneratorRuntime().wrap(function
|
|
3723
|
-
while (1) switch (
|
|
3807
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context29) {
|
|
3808
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3724
3809
|
case 0:
|
|
3725
3810
|
this.logInfo('submitOrder called', {
|
|
3726
3811
|
url: order.url,
|
|
@@ -3740,14 +3825,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3740
3825
|
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
3741
3826
|
scheduleDate: params.schedule_date
|
|
3742
3827
|
});
|
|
3743
|
-
return
|
|
3828
|
+
return _context29.abrupt("return", this.request.post(fetchUrl, params));
|
|
3744
3829
|
case 6:
|
|
3745
3830
|
case "end":
|
|
3746
|
-
return
|
|
3831
|
+
return _context29.stop();
|
|
3747
3832
|
}
|
|
3748
|
-
},
|
|
3833
|
+
}, _callee27, this);
|
|
3749
3834
|
}));
|
|
3750
|
-
function submitOrder(
|
|
3835
|
+
function submitOrder(_x30) {
|
|
3751
3836
|
return _submitOrder.apply(this, arguments);
|
|
3752
3837
|
}
|
|
3753
3838
|
return submitOrder;
|
|
@@ -3755,13 +3840,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3755
3840
|
}, {
|
|
3756
3841
|
key: "cancelOrder",
|
|
3757
3842
|
value: function () {
|
|
3758
|
-
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3843
|
+
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
3759
3844
|
var payload;
|
|
3760
|
-
return _regeneratorRuntime().wrap(function
|
|
3761
|
-
while (1) switch (
|
|
3845
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context30) {
|
|
3846
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3762
3847
|
case 0:
|
|
3763
3848
|
if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
|
|
3764
|
-
|
|
3849
|
+
_context30.next = 2;
|
|
3765
3850
|
break;
|
|
3766
3851
|
}
|
|
3767
3852
|
throw new Error('取消订单失败:order_ids 不能为空');
|
|
@@ -3777,16 +3862,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3777
3862
|
method: 'PUT',
|
|
3778
3863
|
orderIdsCount: params.order_ids.length
|
|
3779
3864
|
});
|
|
3780
|
-
return
|
|
3865
|
+
return _context30.abrupt("return", this.request.put('/order/update-status', payload, {
|
|
3781
3866
|
isShopApi: true
|
|
3782
3867
|
}));
|
|
3783
3868
|
case 5:
|
|
3784
3869
|
case "end":
|
|
3785
|
-
return
|
|
3870
|
+
return _context30.stop();
|
|
3786
3871
|
}
|
|
3787
|
-
},
|
|
3872
|
+
}, _callee28, this);
|
|
3788
3873
|
}));
|
|
3789
|
-
function cancelOrder(
|
|
3874
|
+
function cancelOrder(_x31) {
|
|
3790
3875
|
return _cancelOrder.apply(this, arguments);
|
|
3791
3876
|
}
|
|
3792
3877
|
return cancelOrder;
|
|
@@ -3794,19 +3879,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3794
3879
|
}, {
|
|
3795
3880
|
key: "changeBookingStatus",
|
|
3796
3881
|
value: function () {
|
|
3797
|
-
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3882
|
+
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3798
3883
|
var url, payload;
|
|
3799
|
-
return _regeneratorRuntime().wrap(function
|
|
3800
|
-
while (1) switch (
|
|
3884
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
3885
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3801
3886
|
case 0:
|
|
3802
3887
|
if (params.booking_id) {
|
|
3803
|
-
|
|
3888
|
+
_context31.next = 2;
|
|
3804
3889
|
break;
|
|
3805
3890
|
}
|
|
3806
3891
|
throw new Error('变更预约状态失败:booking_id 不能为空');
|
|
3807
3892
|
case 2:
|
|
3808
3893
|
if (params.appointment_status) {
|
|
3809
|
-
|
|
3894
|
+
_context31.next = 4;
|
|
3810
3895
|
break;
|
|
3811
3896
|
}
|
|
3812
3897
|
throw new Error('变更预约状态失败:appointment_status 不能为空');
|
|
@@ -3821,16 +3906,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3821
3906
|
bookingId: params.booking_id,
|
|
3822
3907
|
appointmentStatus: params.appointment_status
|
|
3823
3908
|
});
|
|
3824
|
-
return
|
|
3909
|
+
return _context31.abrupt("return", this.request.put(url, payload, {
|
|
3825
3910
|
isShopApi: true
|
|
3826
3911
|
}));
|
|
3827
3912
|
case 8:
|
|
3828
3913
|
case "end":
|
|
3829
|
-
return
|
|
3914
|
+
return _context31.stop();
|
|
3830
3915
|
}
|
|
3831
|
-
},
|
|
3916
|
+
}, _callee29, this);
|
|
3832
3917
|
}));
|
|
3833
|
-
function changeBookingStatus(
|
|
3918
|
+
function changeBookingStatus(_x32) {
|
|
3834
3919
|
return _changeBookingStatus.apply(this, arguments);
|
|
3835
3920
|
}
|
|
3836
3921
|
return changeBookingStatus;
|
|
@@ -3848,11 +3933,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3848
3933
|
}, {
|
|
3849
3934
|
key: "createOrderByCheckout",
|
|
3850
3935
|
value: (function () {
|
|
3851
|
-
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3936
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3852
3937
|
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
|
|
3853
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;
|
|
3854
|
-
return _regeneratorRuntime().wrap(function
|
|
3855
|
-
while (1) switch (
|
|
3939
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context32) {
|
|
3940
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3856
3941
|
case 0:
|
|
3857
3942
|
// 过滤掉由在线店铺下单的 payment 支付数据
|
|
3858
3943
|
onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
|
|
@@ -3886,7 +3971,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3886
3971
|
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
3887
3972
|
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
3888
3973
|
});
|
|
3889
|
-
|
|
3974
|
+
_context32.prev = 4;
|
|
3890
3975
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
3891
3976
|
orderData = _objectSpread({
|
|
3892
3977
|
sales_channel: 'my_pisel',
|
|
@@ -3948,13 +4033,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3948
4033
|
hasOrderId: !!orderData.order_id,
|
|
3949
4034
|
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
3950
4035
|
});
|
|
3951
|
-
|
|
4036
|
+
_context32.next = 12;
|
|
3952
4037
|
return this.request.post('/order/checkout', orderData, {
|
|
3953
4038
|
osServer: true,
|
|
3954
4039
|
customToast: function customToast() {}
|
|
3955
4040
|
});
|
|
3956
4041
|
case 12:
|
|
3957
|
-
response =
|
|
4042
|
+
response = _context32.sent;
|
|
3958
4043
|
this.logInfo('Order API called successfully', {
|
|
3959
4044
|
response: response
|
|
3960
4045
|
});
|
|
@@ -3962,22 +4047,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3962
4047
|
success: !!response,
|
|
3963
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)
|
|
3964
4049
|
});
|
|
3965
|
-
return
|
|
4050
|
+
return _context32.abrupt("return", response);
|
|
3966
4051
|
case 18:
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
console.error('[Order] createOrderByCheckout 创建订单失败:',
|
|
4052
|
+
_context32.prev = 18;
|
|
4053
|
+
_context32.t0 = _context32["catch"](4);
|
|
4054
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context32.t0);
|
|
3970
4055
|
this.logInfo('Order API called failed', {
|
|
3971
|
-
error:
|
|
4056
|
+
error: _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0)
|
|
3972
4057
|
});
|
|
3973
|
-
throw
|
|
4058
|
+
throw _context32.t0;
|
|
3974
4059
|
case 23:
|
|
3975
4060
|
case "end":
|
|
3976
|
-
return
|
|
4061
|
+
return _context32.stop();
|
|
3977
4062
|
}
|
|
3978
|
-
},
|
|
4063
|
+
}, _callee30, this, [[4, 18]]);
|
|
3979
4064
|
}));
|
|
3980
|
-
function createOrderByCheckout(
|
|
4065
|
+
function createOrderByCheckout(_x33) {
|
|
3981
4066
|
return _createOrderByCheckout.apply(this, arguments);
|
|
3982
4067
|
}
|
|
3983
4068
|
return createOrderByCheckout;
|
|
@@ -3985,24 +4070,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3985
4070
|
}, {
|
|
3986
4071
|
key: "submitSalesOrder",
|
|
3987
4072
|
value: function () {
|
|
3988
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4073
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3989
4074
|
var url, query, fetchUrl;
|
|
3990
|
-
return _regeneratorRuntime().wrap(function
|
|
3991
|
-
while (1) switch (
|
|
4075
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context33) {
|
|
4076
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3992
4077
|
case 0:
|
|
3993
4078
|
url = params.url, query = params.query;
|
|
3994
4079
|
fetchUrl = url || '/order/sales/checkout';
|
|
3995
|
-
return
|
|
4080
|
+
return _context33.abrupt("return", this.request.post(fetchUrl, query, {
|
|
3996
4081
|
osServer: true,
|
|
3997
4082
|
customToast: function customToast() {}
|
|
3998
4083
|
}));
|
|
3999
4084
|
case 3:
|
|
4000
4085
|
case "end":
|
|
4001
|
-
return
|
|
4086
|
+
return _context33.stop();
|
|
4002
4087
|
}
|
|
4003
|
-
},
|
|
4088
|
+
}, _callee31, this);
|
|
4004
4089
|
}));
|
|
4005
|
-
function submitSalesOrder(
|
|
4090
|
+
function submitSalesOrder(_x34) {
|
|
4006
4091
|
return _submitSalesOrder.apply(this, arguments);
|
|
4007
4092
|
}
|
|
4008
4093
|
return submitSalesOrder;
|
|
@@ -4016,37 +4101,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4016
4101
|
}, {
|
|
4017
4102
|
key: "sendCustomerPayLink",
|
|
4018
4103
|
value: (function () {
|
|
4019
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4104
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
4020
4105
|
var _params$emails;
|
|
4021
4106
|
var orderIds;
|
|
4022
|
-
return _regeneratorRuntime().wrap(function
|
|
4023
|
-
while (1) switch (
|
|
4107
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context34) {
|
|
4108
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
4024
4109
|
case 0:
|
|
4025
4110
|
orderIds = params.order_ids || params.orderIds || [];
|
|
4026
4111
|
if (orderIds.length) {
|
|
4027
|
-
|
|
4112
|
+
_context34.next = 3;
|
|
4028
4113
|
break;
|
|
4029
4114
|
}
|
|
4030
4115
|
throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
|
|
4031
4116
|
case 3:
|
|
4032
4117
|
if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
|
|
4033
|
-
|
|
4118
|
+
_context34.next = 5;
|
|
4034
4119
|
break;
|
|
4035
4120
|
}
|
|
4036
4121
|
throw new Error('发送支付链接需要至少一个邮箱');
|
|
4037
4122
|
case 5:
|
|
4038
|
-
return
|
|
4123
|
+
return _context34.abrupt("return", this.request.post('/order/batch-email', {
|
|
4039
4124
|
order_ids: orderIds,
|
|
4040
4125
|
notify_action: params.notify_action || 'order_payment_reminder',
|
|
4041
4126
|
emails: params.emails
|
|
4042
4127
|
}));
|
|
4043
4128
|
case 6:
|
|
4044
4129
|
case "end":
|
|
4045
|
-
return
|
|
4130
|
+
return _context34.stop();
|
|
4046
4131
|
}
|
|
4047
|
-
},
|
|
4132
|
+
}, _callee32, this);
|
|
4048
4133
|
}));
|
|
4049
|
-
function sendCustomerPayLink(
|
|
4134
|
+
function sendCustomerPayLink(_x35) {
|
|
4050
4135
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
4051
4136
|
}
|
|
4052
4137
|
return sendCustomerPayLink;
|
|
@@ -4054,19 +4139,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4054
4139
|
}, {
|
|
4055
4140
|
key: "getSalesOrderByLookup",
|
|
4056
4141
|
value: function () {
|
|
4057
|
-
var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4142
|
+
var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
4058
4143
|
var lookup, res;
|
|
4059
|
-
return _regeneratorRuntime().wrap(function
|
|
4060
|
-
while (1) switch (
|
|
4144
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context35) {
|
|
4145
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
4061
4146
|
case 0:
|
|
4062
4147
|
lookup = params.lookup === undefined || params.lookup === null ? '' : String(params.lookup).trim();
|
|
4063
4148
|
if (lookup) {
|
|
4064
|
-
|
|
4149
|
+
_context35.next = 3;
|
|
4065
4150
|
break;
|
|
4066
4151
|
}
|
|
4067
4152
|
throw new Error('加载销售详情需要 lookup');
|
|
4068
4153
|
case 3:
|
|
4069
|
-
|
|
4154
|
+
_context35.next = 5;
|
|
4070
4155
|
return this.request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
|
|
4071
4156
|
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
|
|
4072
4157
|
}, params.forceRemote ? {
|
|
@@ -4075,18 +4160,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4075
4160
|
osServer: true
|
|
4076
4161
|
});
|
|
4077
4162
|
case 5:
|
|
4078
|
-
res =
|
|
4163
|
+
res = _context35.sent;
|
|
4079
4164
|
if (res.code === 200) {
|
|
4080
4165
|
this.store.lastOrderInfo = res.data;
|
|
4081
4166
|
}
|
|
4082
|
-
return
|
|
4167
|
+
return _context35.abrupt("return", res);
|
|
4083
4168
|
case 8:
|
|
4084
4169
|
case "end":
|
|
4085
|
-
return
|
|
4170
|
+
return _context35.stop();
|
|
4086
4171
|
}
|
|
4087
|
-
},
|
|
4172
|
+
}, _callee33, this);
|
|
4088
4173
|
}));
|
|
4089
|
-
function getSalesOrderByLookup(
|
|
4174
|
+
function getSalesOrderByLookup(_x36) {
|
|
4090
4175
|
return _getSalesOrderByLookup.apply(this, arguments);
|
|
4091
4176
|
}
|
|
4092
4177
|
return getSalesOrderByLookup;
|
|
@@ -4100,11 +4185,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4100
4185
|
}, {
|
|
4101
4186
|
key: "hydrateTempOrderFromRecord",
|
|
4102
4187
|
value: (function () {
|
|
4103
|
-
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4188
|
+
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(record, options) {
|
|
4104
4189
|
var _this$store$discount13, _this$store$discount14;
|
|
4105
4190
|
var raw, nextTempOrder, rawSummary, summarySurcharges, hydratedEditDiscounts;
|
|
4106
|
-
return _regeneratorRuntime().wrap(function
|
|
4107
|
-
while (1) switch (
|
|
4191
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context36) {
|
|
4192
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
4108
4193
|
case 0:
|
|
4109
4194
|
raw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
4110
4195
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw);
|
|
@@ -4127,30 +4212,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4127
4212
|
});
|
|
4128
4213
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
4129
4214
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
4130
|
-
|
|
4215
|
+
_context36.next = 11;
|
|
4131
4216
|
return (_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.setOriginalDiscountList(hydratedEditDiscounts);
|
|
4132
4217
|
case 11:
|
|
4133
|
-
|
|
4218
|
+
_context36.next = 13;
|
|
4134
4219
|
return (_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.setDiscountList(hydratedEditDiscounts);
|
|
4135
4220
|
case 13:
|
|
4136
4221
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
4137
|
-
|
|
4222
|
+
_context36.next = 16;
|
|
4138
4223
|
break;
|
|
4139
4224
|
}
|
|
4140
|
-
|
|
4225
|
+
_context36.next = 16;
|
|
4141
4226
|
return this.recalculateSummary({
|
|
4142
4227
|
createIfMissing: false
|
|
4143
4228
|
});
|
|
4144
4229
|
case 16:
|
|
4145
4230
|
this.persistTempOrder();
|
|
4146
|
-
return
|
|
4231
|
+
return _context36.abrupt("return", nextTempOrder);
|
|
4147
4232
|
case 18:
|
|
4148
4233
|
case "end":
|
|
4149
|
-
return
|
|
4234
|
+
return _context36.stop();
|
|
4150
4235
|
}
|
|
4151
|
-
},
|
|
4236
|
+
}, _callee34, this);
|
|
4152
4237
|
}));
|
|
4153
|
-
function hydrateTempOrderFromRecord(
|
|
4238
|
+
function hydrateTempOrderFromRecord(_x37, _x38) {
|
|
4154
4239
|
return _hydrateTempOrderFromRecord.apply(this, arguments);
|
|
4155
4240
|
}
|
|
4156
4241
|
return hydrateTempOrderFromRecord;
|
|
@@ -4209,7 +4294,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4209
4294
|
_step18;
|
|
4210
4295
|
try {
|
|
4211
4296
|
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
4212
|
-
var _product$metadata7,
|
|
4297
|
+
var _product$metadata7, _ref69, _ref70, _existed$origin, _rawProduct$metadata;
|
|
4213
4298
|
var _step18$value = _slicedToArray(_step18.value, 2),
|
|
4214
4299
|
index = _step18$value[0],
|
|
4215
4300
|
product = _step18$value[1];
|
|
@@ -4217,7 +4302,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4217
4302
|
if (!uid) continue;
|
|
4218
4303
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
4219
4304
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
4220
|
-
var origin = (
|
|
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;
|
|
4221
4306
|
var originSnapshot = cloneDeep(origin);
|
|
4222
4307
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
4223
4308
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -4285,10 +4370,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4285
4370
|
}, {
|
|
4286
4371
|
key: "normalizeHydratedProductOptionItem",
|
|
4287
4372
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
4288
|
-
var
|
|
4289
|
-
var rawNum = (
|
|
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;
|
|
4290
4375
|
var parsedNum = Number(rawNum);
|
|
4291
|
-
var rawPrice = (
|
|
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;
|
|
4292
4377
|
var parsedPrice = Number(rawPrice);
|
|
4293
4378
|
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
4294
4379
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -4344,25 +4429,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4344
4429
|
}, {
|
|
4345
4430
|
key: "getOrderInfo",
|
|
4346
4431
|
value: function () {
|
|
4347
|
-
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4432
|
+
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(order_id) {
|
|
4348
4433
|
var res;
|
|
4349
|
-
return _regeneratorRuntime().wrap(function
|
|
4350
|
-
while (1) switch (
|
|
4434
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context37) {
|
|
4435
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
4351
4436
|
case 0:
|
|
4352
|
-
|
|
4437
|
+
_context37.next = 2;
|
|
4353
4438
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
4354
4439
|
with: ['products', 'bookings']
|
|
4355
4440
|
});
|
|
4356
4441
|
case 2:
|
|
4357
|
-
res =
|
|
4358
|
-
return
|
|
4442
|
+
res = _context37.sent;
|
|
4443
|
+
return _context37.abrupt("return", res);
|
|
4359
4444
|
case 4:
|
|
4360
4445
|
case "end":
|
|
4361
|
-
return
|
|
4446
|
+
return _context37.stop();
|
|
4362
4447
|
}
|
|
4363
|
-
},
|
|
4448
|
+
}, _callee35, this);
|
|
4364
4449
|
}));
|
|
4365
|
-
function getOrderInfo(
|
|
4450
|
+
function getOrderInfo(_x39) {
|
|
4366
4451
|
return _getOrderInfo.apply(this, arguments);
|
|
4367
4452
|
}
|
|
4368
4453
|
return getOrderInfo;
|
|
@@ -4401,9 +4486,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4401
4486
|
_step23;
|
|
4402
4487
|
try {
|
|
4403
4488
|
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
|
4404
|
-
var
|
|
4489
|
+
var _ref73, _bundle$num3;
|
|
4405
4490
|
var bundle = _step23.value;
|
|
4406
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
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();
|
|
4407
4492
|
var _iterator24 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
4408
4493
|
_step24;
|
|
4409
4494
|
try {
|