@pisell/pisellos 2.2.7 → 2.2.9
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/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Payment/cash.js +1 -1
- package/dist/modules/Payment/eftpos.js +1 -1
- package/dist/modules/Payment/index.js +102 -32
- package/dist/modules/Payment/types.d.ts +21 -2
- package/dist/modules/Payment/walletpass.js +5 -2
- package/dist/modules/Rules/index.d.ts +9 -2
- package/dist/modules/Rules/index.js +39 -6
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/modules/menu/index.js +1 -1
- package/dist/server/modules/products/index.js +1 -1
- package/dist/server/modules/schedule/index.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +2 -0
- package/dist/solution/Checkout/index.js +217 -72
- package/dist/solution/Checkout/types.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +3 -0
- package/dist/solution/ShopDiscount/index.js +16 -5
- package/dist/solution/ShopDiscount/types.d.ts +5 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +71 -11
- package/lib/modules/Payment/types.d.ts +21 -2
- package/lib/modules/Payment/walletpass.js +6 -4
- package/lib/modules/Rules/index.d.ts +9 -2
- package/lib/modules/Rules/index.js +40 -9
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/modules/menu/index.js +1 -1
- package/lib/server/modules/products/index.js +1 -1
- package/lib/server/modules/schedule/index.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +2 -0
- package/lib/solution/Checkout/index.js +121 -10
- package/lib/solution/Checkout/types.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +3 -0
- package/lib/solution/ShopDiscount/index.js +12 -4
- package/lib/solution/ShopDiscount/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -371,10 +371,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
371
371
|
}
|
|
372
372
|
return initializeCheckoutAsync;
|
|
373
373
|
}())
|
|
374
|
+
}, {
|
|
375
|
+
key: "getHolderIdFromBooking",
|
|
376
|
+
value: function getHolderIdFromBooking(obj) {
|
|
377
|
+
var _obj$holder;
|
|
378
|
+
if (!obj) return undefined;
|
|
379
|
+
var ret = obj.holder_id || ((_obj$holder = obj.holder) === null || _obj$holder === void 0 ? void 0 : _obj$holder.form_record);
|
|
380
|
+
if (Array.isArray(ret)) {
|
|
381
|
+
return ret.length > 0 ? Number(ret[0]) : undefined;
|
|
382
|
+
}
|
|
383
|
+
return Number(ret) || undefined;
|
|
384
|
+
}
|
|
374
385
|
}, {
|
|
375
386
|
key: "getProductListByOrder",
|
|
376
387
|
value: function getProductListByOrder() {
|
|
377
|
-
var _this$store$currentOr,
|
|
388
|
+
var _this$store$currentOr,
|
|
389
|
+
_this3 = this,
|
|
390
|
+
_this$store$currentOr2;
|
|
378
391
|
if (!this.store.currentOrder) {
|
|
379
392
|
return [];
|
|
380
393
|
}
|
|
@@ -388,7 +401,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
388
401
|
product_id: item.product.product_id,
|
|
389
402
|
product_variant_id: item.product.product_variant_id,
|
|
390
403
|
quantity: item.product.num,
|
|
391
|
-
selling_price: item.product.calculated_selling_price
|
|
404
|
+
selling_price: item.product.calculated_selling_price,
|
|
405
|
+
holder_id: _this3.getHolderIdFromBooking(item)
|
|
392
406
|
};
|
|
393
407
|
})) || [];
|
|
394
408
|
var relationProducts = ((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.relation_products) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.map(function (item) {
|
|
@@ -405,8 +419,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
405
419
|
key: "initWalletData",
|
|
406
420
|
value: function () {
|
|
407
421
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
408
|
-
var _this$store$currentOr3, _this$store$currentCu, _this$store$currentOr4, _this$store$currentOr5, _this$store$
|
|
409
|
-
var amountInfo, walletBusinessData, _this$store$
|
|
422
|
+
var _this$store$currentOr3, _this$store$currentCu, _this$store$currentOr4, _this$store$currentOr5, _this$store$currentOr6, _this$store$currentOr8;
|
|
423
|
+
var amountInfo, walletBusinessData, _this$store$currentOr7;
|
|
410
424
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
411
425
|
while (1) switch (_context8.prev = _context8.next) {
|
|
412
426
|
case 0:
|
|
@@ -426,16 +440,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
426
440
|
// 准备钱包初始化的业务数据
|
|
427
441
|
walletBusinessData = _objectSpread({
|
|
428
442
|
customer_id: (_this$store$currentCu = this.store.currentCustomer) !== null && _this$store$currentCu !== void 0 && _this$store$currentCu.customer_id ? Number(this.store.currentCustomer.customer_id) : undefined,
|
|
443
|
+
holder: (_this$store$currentOr4 = this.store.currentOrder) === null || _this$store$currentOr4 === void 0 || (_this$store$currentOr4 = _this$store$currentOr4.order_info) === null || _this$store$currentOr4 === void 0 || (_this$store$currentOr4 = _this$store$currentOr4.original_order_data) === null || _this$store$currentOr4 === void 0 ? void 0 : _this$store$currentOr4.holder,
|
|
429
444
|
amountInfo: {
|
|
430
445
|
totalAmount: amountInfo.totalAmount,
|
|
431
446
|
subTotal: amountInfo.subTotal,
|
|
432
|
-
depositAmount: (_this$store$
|
|
433
|
-
isDeposit: (_this$store$
|
|
447
|
+
depositAmount: (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.deposit_amount,
|
|
448
|
+
isDeposit: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.is_deposit
|
|
434
449
|
},
|
|
435
450
|
products: this.getProductListByOrder()
|
|
436
451
|
}, params); // 判断订单是否已经同步,如果是则追加payment_order_id参数
|
|
437
452
|
if (this.store.isOrderSynced) {
|
|
438
|
-
walletBusinessData.payment_order_id = (_this$store$
|
|
453
|
+
walletBusinessData.payment_order_id = (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.order_id;
|
|
439
454
|
}
|
|
440
455
|
this.logInfo('开始拉取:initializeWalletDataFromBusinessAsync', {
|
|
441
456
|
walletBusinessData: walletBusinessData
|
|
@@ -460,7 +475,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
460
475
|
// 触发钱包数据初始化完成事件
|
|
461
476
|
_context8.next = 16;
|
|
462
477
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
463
|
-
orderUuid: (_this$store$
|
|
478
|
+
orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid,
|
|
464
479
|
customerId: walletBusinessData.customer_id,
|
|
465
480
|
walletBusinessData: {
|
|
466
481
|
customer_id: walletBusinessData.customer_id,
|
|
@@ -693,7 +708,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
693
708
|
value: (function () {
|
|
694
709
|
var _updateLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
695
710
|
var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8;
|
|
696
|
-
var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment, totalAmount, activePayments, paidAmount, remaining,
|
|
711
|
+
var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment2, _existingOrder$paymen, _updated$payment, currentTime, formattedExistPayments, _isNeedDeposit, _updated, syncedPayments, _syncedAmount, _totalAmount, _remainingExpectAmount, _depositDiffAmount, totalAmount, activePayments, paidAmount, remaining, _isNeedDeposit2, updated, syncedAmount, remainingExpectAmount, depositDiffAmount, isNeedDeposit, created, _syncedPayments, _syncedAmount2;
|
|
697
712
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
698
713
|
while (1) switch (_context10.prev = _context10.next) {
|
|
699
714
|
case 0:
|
|
@@ -746,10 +761,104 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
746
761
|
return String(o.id) === String(params.orderId) || String(o.order_id) === String(params.orderId);
|
|
747
762
|
});
|
|
748
763
|
if (!existingOrder) {
|
|
749
|
-
_context10.next =
|
|
764
|
+
_context10.next = 71;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
if (!(params.existPayment && params.existPayment.length > 0)) {
|
|
768
|
+
_context10.next = 47;
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
this.logInfo('检测到云端支付项,将替换本地订单的支付项列表', {
|
|
772
|
+
orderId: params.orderId,
|
|
773
|
+
existingPaymentCount: ((_existingOrder$paymen = existingOrder.payment) === null || _existingOrder$paymen === void 0 ? void 0 : _existingOrder$paymen.length) || 0,
|
|
774
|
+
newPaymentCount: params.existPayment.length
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
// 标记订单已同步(因为支付项来自云端)
|
|
778
|
+
this.store.isOrderSynced = true;
|
|
779
|
+
|
|
780
|
+
// 格式化云端支付项(添加时间戳、标记已同步)
|
|
781
|
+
currentTime = formatDateTime(new Date());
|
|
782
|
+
formattedExistPayments = params.existPayment.map(function (payment) {
|
|
783
|
+
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
784
|
+
isSynced: true,
|
|
785
|
+
// 标记为已同步
|
|
786
|
+
status: payment.status || 'active',
|
|
787
|
+
created_at: payment.created_at || currentTime,
|
|
788
|
+
updated_at: payment.updated_at || currentTime
|
|
789
|
+
});
|
|
790
|
+
}); // 计算是否需要支付定金
|
|
791
|
+
_isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 更新订单,替换支付项列表
|
|
792
|
+
_context10.next = 28;
|
|
793
|
+
return this.payment.updateOrderAsync(existingOrder.uuid, {
|
|
794
|
+
total_amount: amountInfo.totalAmount,
|
|
795
|
+
is_deposit: _isNeedDeposit.hasDeposit ? 1 : 0,
|
|
796
|
+
deposit_amount: _isNeedDeposit.total ? _isNeedDeposit.total.toString() : '0.00',
|
|
797
|
+
payment: formattedExistPayments,
|
|
798
|
+
// 🔧 替换支付项列表
|
|
799
|
+
order_info: {
|
|
800
|
+
original_order_data: params.orderData,
|
|
801
|
+
cart_summary: params.cartSummary,
|
|
802
|
+
created_at: new Date().toISOString(),
|
|
803
|
+
platform: params.orderData.platform,
|
|
804
|
+
type: params.orderData.type,
|
|
805
|
+
schedule_date: params.orderData.schedule_date,
|
|
806
|
+
shop_note: params.orderData.shop_note,
|
|
807
|
+
amount_breakdown: amountInfo
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
case 28:
|
|
811
|
+
_context10.next = 30;
|
|
812
|
+
return this.payment.getPaymentOrderByUuidAsync(existingOrder.uuid);
|
|
813
|
+
case 30:
|
|
814
|
+
_updated = _context10.sent;
|
|
815
|
+
if (_updated) {
|
|
816
|
+
_context10.next = 33;
|
|
750
817
|
break;
|
|
751
818
|
}
|
|
752
|
-
|
|
819
|
+
throw createCheckoutError(CheckoutErrorType.UnknownError, '订单更新失败');
|
|
820
|
+
case 33:
|
|
821
|
+
this.store.currentOrder = _updated;
|
|
822
|
+
_context10.next = 36;
|
|
823
|
+
return this.updateStateAmountToRemaining(false);
|
|
824
|
+
case 36:
|
|
825
|
+
this.logInfo('本地订单更新成功(已替换云端支付项):', {
|
|
826
|
+
orderId: params.orderId,
|
|
827
|
+
uuid: _updated.uuid,
|
|
828
|
+
payments: ((_updated$payment = _updated.payment) === null || _updated$payment === void 0 ? void 0 : _updated$payment.length) || 0,
|
|
829
|
+
totalAmount: _updated.total_amount,
|
|
830
|
+
expectAmount: _updated.expect_amount,
|
|
831
|
+
isOrderSynced: true
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// 事件通知
|
|
835
|
+
_context10.next = 39;
|
|
836
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
837
|
+
order: _updated,
|
|
838
|
+
timestamp: Date.now()
|
|
839
|
+
});
|
|
840
|
+
case 39:
|
|
841
|
+
// 计算已同步的支付金额
|
|
842
|
+
syncedPayments = _updated.payment.filter(function (p) {
|
|
843
|
+
return p.isSynced && p.status !== 'voided';
|
|
844
|
+
});
|
|
845
|
+
_syncedAmount = syncedPayments.reduce(function (sum, p) {
|
|
846
|
+
var amt = new Decimal(p.amount || '0');
|
|
847
|
+
var rounding = new Decimal(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || '0').abs();
|
|
848
|
+
return sum.plus(amt).plus(rounding);
|
|
849
|
+
}, new Decimal(0));
|
|
850
|
+
_totalAmount = new Decimal(amountInfo.totalAmount || '0');
|
|
851
|
+
_remainingExpectAmount = Decimal.max(0, _totalAmount.minus(_syncedAmount)).toFixed(2); // 计算定金差值
|
|
852
|
+
_depositDiffAmount = new Decimal(0).toFixed(2);
|
|
853
|
+
if (_updated.is_deposit === 1) {
|
|
854
|
+
_depositDiffAmount = new Decimal(_updated.deposit_amount).minus(_syncedAmount).toFixed(2);
|
|
855
|
+
}
|
|
856
|
+
this.initWalletData({
|
|
857
|
+
order_wait_pay_amount: Number(_depositDiffAmount) > 0 ? Number(_depositDiffAmount) : Number(_remainingExpectAmount)
|
|
858
|
+
});
|
|
859
|
+
return _context10.abrupt("return", _updated);
|
|
860
|
+
case 47:
|
|
861
|
+
// 原有逻辑:保留现有支付项
|
|
753
862
|
totalAmount = new Decimal(amountInfo.totalAmount || '0');
|
|
754
863
|
activePayments = (existingOrder.payment || []).filter(function (p) {
|
|
755
864
|
return p.status !== 'voided';
|
|
@@ -760,12 +869,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
760
869
|
return sum.plus(amt).plus(rounding);
|
|
761
870
|
}, new Decimal(0));
|
|
762
871
|
remaining = Decimal.max(0, totalAmount.minus(paidAmount)).toFixed(2); // 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
763
|
-
|
|
764
|
-
_context10.next =
|
|
872
|
+
_isNeedDeposit2 = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 更新到支付模块(使用 uuid,不修改 payment 列表)
|
|
873
|
+
_context10.next = 54;
|
|
765
874
|
return this.payment.updateOrderAsync(existingOrder.uuid, {
|
|
766
875
|
total_amount: amountInfo.totalAmount,
|
|
767
|
-
is_deposit:
|
|
768
|
-
deposit_amount:
|
|
876
|
+
is_deposit: _isNeedDeposit2.hasDeposit ? 1 : 0,
|
|
877
|
+
deposit_amount: _isNeedDeposit2.total ? _isNeedDeposit2.total.toString() : '0.00',
|
|
769
878
|
expect_amount: remaining,
|
|
770
879
|
order_info: {
|
|
771
880
|
original_order_data: params.orderData,
|
|
@@ -778,36 +887,36 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
778
887
|
amount_breakdown: amountInfo
|
|
779
888
|
}
|
|
780
889
|
});
|
|
781
|
-
case
|
|
782
|
-
_context10.next =
|
|
890
|
+
case 54:
|
|
891
|
+
_context10.next = 56;
|
|
783
892
|
return this.payment.getPaymentOrderByUuidAsync(existingOrder.uuid);
|
|
784
|
-
case
|
|
893
|
+
case 56:
|
|
785
894
|
updated = _context10.sent;
|
|
786
895
|
if (updated) {
|
|
787
|
-
_context10.next =
|
|
896
|
+
_context10.next = 59;
|
|
788
897
|
break;
|
|
789
898
|
}
|
|
790
899
|
throw createCheckoutError(CheckoutErrorType.UnknownError, '订单更新失败');
|
|
791
|
-
case
|
|
900
|
+
case 59:
|
|
792
901
|
this.store.currentOrder = updated;
|
|
793
|
-
_context10.next =
|
|
902
|
+
_context10.next = 62;
|
|
794
903
|
return this.updateStateAmountToRemaining(false);
|
|
795
|
-
case
|
|
904
|
+
case 62:
|
|
796
905
|
this.logInfo('本地订单更新成功(保留支付项):', {
|
|
797
906
|
orderId: params.orderId,
|
|
798
907
|
uuid: updated.uuid,
|
|
799
|
-
payments: ((_updated$
|
|
908
|
+
payments: ((_updated$payment2 = updated.payment) === null || _updated$payment2 === void 0 ? void 0 : _updated$payment2.length) || 0,
|
|
800
909
|
totalAmount: updated.total_amount,
|
|
801
910
|
expectAmount: updated.expect_amount
|
|
802
911
|
});
|
|
803
912
|
|
|
804
913
|
// 事件通知(复用创建事件,便于上层监听刷新)
|
|
805
|
-
_context10.next =
|
|
914
|
+
_context10.next = 65;
|
|
806
915
|
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
807
916
|
order: updated,
|
|
808
917
|
timestamp: Date.now()
|
|
809
918
|
});
|
|
810
|
-
case
|
|
919
|
+
case 65:
|
|
811
920
|
// 需要减去已经同步给后端的支付过的钱
|
|
812
921
|
syncedAmount = activePayments.reduce(function (sum, p) {
|
|
813
922
|
var amt = new Decimal(p.amount || '0');
|
|
@@ -823,15 +932,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
823
932
|
order_wait_pay_amount: Number(depositDiffAmount) > 0 ? Number(depositDiffAmount) : Number(remainingExpectAmount)
|
|
824
933
|
});
|
|
825
934
|
return _context10.abrupt("return", updated);
|
|
826
|
-
case
|
|
935
|
+
case 71:
|
|
827
936
|
// 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
828
937
|
isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 没找到现有订单时,回退为创建逻辑(用于异常兜底)
|
|
829
|
-
_context10.next =
|
|
938
|
+
_context10.next = 74;
|
|
830
939
|
return this.payment.createPaymentOrderAsync({
|
|
831
940
|
order_id: String(params.orderId),
|
|
832
941
|
total_amount: amountInfo.totalAmount,
|
|
833
942
|
is_deposit: isNeedDeposit.hasDeposit ? 1 : 0,
|
|
834
943
|
deposit_amount: isNeedDeposit.total ? isNeedDeposit.total.toString() : '0.00',
|
|
944
|
+
existPayment: params.existPayment,
|
|
945
|
+
// 🔧 新增: 传递云端支付项
|
|
835
946
|
order_info: {
|
|
836
947
|
original_order_data: params.orderData,
|
|
837
948
|
cart_summary: params.cartSummary,
|
|
@@ -843,12 +954,43 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
843
954
|
amount_breakdown: amountInfo
|
|
844
955
|
}
|
|
845
956
|
});
|
|
846
|
-
case
|
|
957
|
+
case 74:
|
|
847
958
|
created = _context10.sent;
|
|
848
959
|
this.store.currentOrder = created;
|
|
849
|
-
|
|
960
|
+
|
|
961
|
+
// 🔧 新增: 如果有云端支付项,需要计算正确的待付金额
|
|
962
|
+
if (params.existPayment && params.existPayment.length > 0) {
|
|
963
|
+
// 标记订单已同步(因为订单和支付项都来自云端)
|
|
964
|
+
this.store.isOrderSynced = true;
|
|
965
|
+
|
|
966
|
+
// 计算已同步的支付金额
|
|
967
|
+
_syncedPayments = created.payment.filter(function (p) {
|
|
968
|
+
return p.isSynced && p.status !== 'voided';
|
|
969
|
+
});
|
|
970
|
+
_syncedAmount2 = _syncedPayments.reduce(function (sum, p) {
|
|
971
|
+
var amt = new Decimal(p.amount || '0');
|
|
972
|
+
var rounding = new Decimal(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || '0').abs();
|
|
973
|
+
return sum.plus(amt).plus(rounding);
|
|
974
|
+
}, new Decimal(0));
|
|
975
|
+
this.logInfo('云端订单初始化钱包数据', {
|
|
976
|
+
orderId: params.orderId,
|
|
977
|
+
totalAmount: created.total_amount,
|
|
978
|
+
expectAmount: created.expect_amount,
|
|
979
|
+
syncedAmount: _syncedAmount2.toFixed(2),
|
|
980
|
+
syncedPaymentCount: _syncedPayments.length,
|
|
981
|
+
isOrderSynced: true
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// 初始化钱包数据,使用系统计算的待付金额
|
|
985
|
+
this.initWalletData({
|
|
986
|
+
order_wait_pay_amount: Number(created.expect_amount)
|
|
987
|
+
});
|
|
988
|
+
} else {
|
|
989
|
+
// 没有云端支付项,正常初始化
|
|
990
|
+
this.initWalletData();
|
|
991
|
+
}
|
|
850
992
|
return _context10.abrupt("return", created);
|
|
851
|
-
case
|
|
993
|
+
case 78:
|
|
852
994
|
case "end":
|
|
853
995
|
return _context10.stop();
|
|
854
996
|
}
|
|
@@ -931,8 +1073,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
931
1073
|
}, {
|
|
932
1074
|
key: "getOrderOriginalData",
|
|
933
1075
|
value: function getOrderOriginalData() {
|
|
934
|
-
var _this$store$
|
|
935
|
-
return (_this$store$
|
|
1076
|
+
var _this$store$currentOr9;
|
|
1077
|
+
return (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.order_info;
|
|
936
1078
|
}
|
|
937
1079
|
|
|
938
1080
|
/**
|
|
@@ -1542,7 +1684,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1542
1684
|
key: "updateVoucherPaymentItemsAsync",
|
|
1543
1685
|
value: (function () {
|
|
1544
1686
|
var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(voucherPaymentItems) {
|
|
1545
|
-
var
|
|
1687
|
+
var _this4 = this;
|
|
1546
1688
|
var paymentItems, allPaymentItemsSynced, remainingAmount, remainingValue, isOrderSynced, orderPaymentType, voucherPaymentItemsWithType, currentOrderId, isCurrentOrderReal, updatedOrder;
|
|
1547
1689
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1548
1690
|
while (1) switch (_context18.prev = _context18.next) {
|
|
@@ -1594,8 +1736,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1594
1736
|
|
|
1595
1737
|
// 从 otherParams 获取 metadata 字段
|
|
1596
1738
|
var metadata = _objectSpread(_objectSpread({}, item.metadata), {}, {
|
|
1597
|
-
rounding_rule:
|
|
1598
|
-
shop_wallet_pass_id:
|
|
1739
|
+
rounding_rule: _this4.otherParams.order_rounding_setting,
|
|
1740
|
+
shop_wallet_pass_id: _this4.otherParams.shop_wallet_pass_id
|
|
1599
1741
|
});
|
|
1600
1742
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1601
1743
|
order_payment_type: orderPaymentType,
|
|
@@ -1781,7 +1923,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1781
1923
|
key: "setDepositAmountAsync",
|
|
1782
1924
|
value: (function () {
|
|
1783
1925
|
var _setDepositAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(depositAmount) {
|
|
1784
|
-
var _this$store$
|
|
1926
|
+
var _this$store$currentOr10, _this$store$currentOr11;
|
|
1785
1927
|
var depositValue, formattedDepositAmount, oldDepositAmount, updateParams;
|
|
1786
1928
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1787
1929
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -1789,8 +1931,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1789
1931
|
this.logInfo('setDepositAmountAsync called', {
|
|
1790
1932
|
depositAmount: depositAmount,
|
|
1791
1933
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
1792
|
-
currentOrderId: (_this$store$
|
|
1793
|
-
currentTotalAmount: (_this$store$
|
|
1934
|
+
currentOrderId: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.order_id,
|
|
1935
|
+
currentTotalAmount: (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.total_amount
|
|
1794
1936
|
});
|
|
1795
1937
|
_context20.prev = 1;
|
|
1796
1938
|
// 验证定金金额格式
|
|
@@ -1910,17 +2052,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1910
2052
|
key: "manualSyncOrderAsync",
|
|
1911
2053
|
value: (function () {
|
|
1912
2054
|
var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1913
|
-
var _this$store$
|
|
1914
|
-
var _this$store$
|
|
2055
|
+
var _this$store$currentOr12, _this$store$currentOr13, _this$store$currentOr14;
|
|
2056
|
+
var _this$store$currentOr15, orderUuid, oldOrderId, syncResult, finalOrderId, finalIsVirtual, newRes, _this$store$currentOr16, errorMessage;
|
|
1915
2057
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1916
2058
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1917
2059
|
case 0:
|
|
1918
2060
|
console.log('manualSyncOrderAsync called');
|
|
1919
2061
|
this.logInfo('manualSyncOrderAsync called', {
|
|
1920
2062
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
1921
|
-
currentOrderId: (_this$store$
|
|
1922
|
-
orderUuid: (_this$store$
|
|
1923
|
-
totalAmount: (_this$store$
|
|
2063
|
+
currentOrderId: (_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.order_id,
|
|
2064
|
+
orderUuid: (_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.uuid,
|
|
2065
|
+
totalAmount: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.total_amount,
|
|
1924
2066
|
isOrderSynced: this.store.isOrderSynced,
|
|
1925
2067
|
isVirtualOrderId: this.store.currentOrder ? isVirtualOrderId(this.store.currentOrder.order_id) : false
|
|
1926
2068
|
});
|
|
@@ -1980,7 +2122,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1980
2122
|
this.logError('[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!');
|
|
1981
2123
|
}
|
|
1982
2124
|
newRes = _objectSpread(_objectSpread({}, syncResult), {}, {
|
|
1983
|
-
is_deposit: ((_this$store$
|
|
2125
|
+
is_deposit: ((_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.is_deposit) || 0
|
|
1984
2126
|
});
|
|
1985
2127
|
_context21.next = 30;
|
|
1986
2128
|
return this.updateStateAmountToRemaining(false);
|
|
@@ -1994,7 +2136,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1994
2136
|
return _context21.abrupt("return", {
|
|
1995
2137
|
success: false,
|
|
1996
2138
|
message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
|
|
1997
|
-
orderUuid: (_this$store$
|
|
2139
|
+
orderUuid: (_this$store$currentOr16 = this.store.currentOrder) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.uuid
|
|
1998
2140
|
});
|
|
1999
2141
|
case 38:
|
|
2000
2142
|
case "end":
|
|
@@ -2071,15 +2213,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2071
2213
|
key: "cancelCurrentOrderAsync",
|
|
2072
2214
|
value: (function () {
|
|
2073
2215
|
var _cancelCurrentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(cancelReason) {
|
|
2074
|
-
var _this$store$
|
|
2216
|
+
var _this$store$currentOr17, _this$store$currentOr18, currentOrderUuid, currentOrderId, isOrderSynced, errorMessage;
|
|
2075
2217
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2076
2218
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2077
2219
|
case 0:
|
|
2078
2220
|
_context22.prev = 0;
|
|
2079
2221
|
this.logInfo('开始取消当前本地订单:', {
|
|
2080
2222
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
2081
|
-
orderUuid: (_this$store$
|
|
2082
|
-
orderId: (_this$store$
|
|
2223
|
+
orderUuid: (_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.uuid,
|
|
2224
|
+
orderId: (_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.order_id,
|
|
2083
2225
|
isOrderSynced: this.store.isOrderSynced,
|
|
2084
2226
|
cancelReason: cancelReason
|
|
2085
2227
|
});
|
|
@@ -2190,7 +2332,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2190
2332
|
key: "saveForLaterPaymentAsync",
|
|
2191
2333
|
value: (function () {
|
|
2192
2334
|
var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2193
|
-
var orderUuid, currentOrderId, allPaymentItems, syncResult, _this$store$
|
|
2335
|
+
var orderUuid, currentOrderId, allPaymentItems, syncResult, _this$store$currentOr19, errorMessage;
|
|
2194
2336
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2195
2337
|
while (1) switch (_context23.prev = _context23.next) {
|
|
2196
2338
|
case 0:
|
|
@@ -2244,7 +2386,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2244
2386
|
return _context23.abrupt("return", {
|
|
2245
2387
|
success: false,
|
|
2246
2388
|
message: "\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ".concat(errorMessage),
|
|
2247
|
-
orderUuid: (_this$store$
|
|
2389
|
+
orderUuid: (_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.uuid
|
|
2248
2390
|
});
|
|
2249
2391
|
case 21:
|
|
2250
2392
|
case "end":
|
|
@@ -2267,7 +2409,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2267
2409
|
key: "updateOrderNoteAsync",
|
|
2268
2410
|
value: (function () {
|
|
2269
2411
|
var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(note) {
|
|
2270
|
-
var _this$store$
|
|
2412
|
+
var _this$store$currentOr20, _this$store$currentOr21, oldNote, orderInPayment;
|
|
2271
2413
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2272
2414
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2273
2415
|
case 0:
|
|
@@ -2279,7 +2421,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2279
2421
|
throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
|
|
2280
2422
|
case 3:
|
|
2281
2423
|
console.log('[Checkout] 更新订单备注:', {
|
|
2282
|
-
orderUuid: (_this$store$
|
|
2424
|
+
orderUuid: (_this$store$currentOr20 = this.store.currentOrder) === null || _this$store$currentOr20 === void 0 ? void 0 : _this$store$currentOr20.uuid,
|
|
2283
2425
|
oldNote: this.store.localOrderData.shop_note,
|
|
2284
2426
|
newNote: note
|
|
2285
2427
|
});
|
|
@@ -2312,7 +2454,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2312
2454
|
case 17:
|
|
2313
2455
|
_context24.next = 19;
|
|
2314
2456
|
return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
|
|
2315
|
-
orderUuid: (_this$store$
|
|
2457
|
+
orderUuid: (_this$store$currentOr21 = this.store.currentOrder) === null || _this$store$currentOr21 === void 0 ? void 0 : _this$store$currentOr21.uuid,
|
|
2316
2458
|
oldNote: oldNote,
|
|
2317
2459
|
newNote: note,
|
|
2318
2460
|
timestamp: Date.now()
|
|
@@ -2384,7 +2526,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2384
2526
|
key: "handlePaymentSuccess",
|
|
2385
2527
|
value: (function () {
|
|
2386
2528
|
var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
|
|
2387
|
-
var _this$store$
|
|
2529
|
+
var _this$store$currentOr22;
|
|
2388
2530
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2389
2531
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2390
2532
|
case 0:
|
|
@@ -2395,7 +2537,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2395
2537
|
return this.core.effects.emit("".concat(this.name, ":onPaymentSuccess"), {
|
|
2396
2538
|
orderUuid: data.orderUuid,
|
|
2397
2539
|
paymentMethodCode: '',
|
|
2398
|
-
amount: ((_this$store$
|
|
2540
|
+
amount: ((_this$store$currentOr22 = this.store.currentOrder) === null || _this$store$currentOr22 === void 0 ? void 0 : _this$store$currentOr22.total_amount) || '0',
|
|
2399
2541
|
timestamp: data.timestamp
|
|
2400
2542
|
});
|
|
2401
2543
|
case 4:
|
|
@@ -2420,7 +2562,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2420
2562
|
key: "handlePaymentError",
|
|
2421
2563
|
value: (function () {
|
|
2422
2564
|
var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
|
|
2423
|
-
var _this$store$
|
|
2565
|
+
var _this$store$currentOr23;
|
|
2424
2566
|
var error;
|
|
2425
2567
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2426
2568
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -2433,7 +2575,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2433
2575
|
return this.core.effects.emit("".concat(this.name, ":onPaymentFailed"), {
|
|
2434
2576
|
orderUuid: data.orderUuid,
|
|
2435
2577
|
paymentMethodCode: '',
|
|
2436
|
-
amount: ((_this$store$
|
|
2578
|
+
amount: ((_this$store$currentOr23 = this.store.currentOrder) === null || _this$store$currentOr23 === void 0 ? void 0 : _this$store$currentOr23.total_amount) || '0',
|
|
2437
2579
|
timestamp: data.timestamp
|
|
2438
2580
|
});
|
|
2439
2581
|
case 5:
|
|
@@ -3140,7 +3282,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3140
3282
|
key: "updateStateAmountToRemaining",
|
|
3141
3283
|
value: (function () {
|
|
3142
3284
|
var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3143
|
-
var
|
|
3285
|
+
var _this5 = this;
|
|
3144
3286
|
var checkOrder,
|
|
3145
3287
|
_yield$this$fetchOrde3,
|
|
3146
3288
|
paymentItems,
|
|
@@ -3191,8 +3333,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3191
3333
|
depositPaidAmount = paymentItems.filter(function (item) {
|
|
3192
3334
|
return item.order_payment_type === 'deposit' && item.status !== 'voided';
|
|
3193
3335
|
}).reduce(function (sum, item) {
|
|
3194
|
-
// 如果是 wallet
|
|
3195
|
-
|
|
3336
|
+
// 如果是 wallet,并且还没同步到后端,且此时还没有其他类型的支付项(现金,eftpos,标记支付),不计入已付金额
|
|
3337
|
+
// 如果有其他支付项了,代表此时处于马上要同步的状态,所以计入
|
|
3338
|
+
if (item.voucher_id && !item.isSynced && paymentItems.filter(function (item) {
|
|
3339
|
+
return !item.voucher_id;
|
|
3340
|
+
}).length === 0) {
|
|
3196
3341
|
return sum;
|
|
3197
3342
|
}
|
|
3198
3343
|
var amount = new Decimal(item.amount || '0');
|
|
@@ -3233,7 +3378,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3233
3378
|
hasStateChanged = true;
|
|
3234
3379
|
setTimeout(function () {
|
|
3235
3380
|
// 发出 stateAmount 变更事件
|
|
3236
|
-
|
|
3381
|
+
_this5.core.effects.emit("".concat(_this5.name, ":onStateAmountChanged"), {
|
|
3237
3382
|
oldAmount: currentStateAmount,
|
|
3238
3383
|
newAmount: remainingAmount,
|
|
3239
3384
|
timestamp: Date.now(),
|
|
@@ -3254,7 +3399,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3254
3399
|
|
|
3255
3400
|
// 发出 balanceDueAmount 变更事件
|
|
3256
3401
|
setTimeout(function () {
|
|
3257
|
-
|
|
3402
|
+
_this5.core.effects.emit("".concat(_this5.name, ":onBalanceDueAmountChanged"), {
|
|
3258
3403
|
oldAmount: currentBalanceDueAmount,
|
|
3259
3404
|
newAmount: remainingAmount,
|
|
3260
3405
|
timestamp: Date.now(),
|
|
@@ -3552,11 +3697,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3552
3697
|
key: "syncOrderToBackendWithReturn",
|
|
3553
3698
|
value: (function () {
|
|
3554
3699
|
var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3555
|
-
var
|
|
3556
|
-
_this$store$currentOr23,
|
|
3700
|
+
var _this6 = this,
|
|
3557
3701
|
_this$store$currentOr24,
|
|
3558
|
-
_this$store$currentCu2,
|
|
3559
3702
|
_this$store$currentOr25,
|
|
3703
|
+
_this$store$currentCu2,
|
|
3704
|
+
_this$store$currentOr26,
|
|
3560
3705
|
_this$store$localOrde,
|
|
3561
3706
|
_this$store$localOrde2,
|
|
3562
3707
|
_checkoutResponse3,
|
|
@@ -3633,12 +3778,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3633
3778
|
var _item$metadata, _item$metadata2;
|
|
3634
3779
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
3635
3780
|
metadata: _objectSpread(_objectSpread({}, item.metadata), {}, {
|
|
3636
|
-
rounding_rule: ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.rounding_rule) ||
|
|
3637
|
-
shop_wallet_pass_id: ((_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.shop_wallet_pass_id) ||
|
|
3781
|
+
rounding_rule: ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.rounding_rule) || _this6.otherParams.order_rounding_setting,
|
|
3782
|
+
shop_wallet_pass_id: ((_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.shop_wallet_pass_id) || _this6.otherParams.shop_wallet_pass_id
|
|
3638
3783
|
})
|
|
3639
3784
|
});
|
|
3640
3785
|
}); // 确定最终的定金金额:优先使用手动设置的值,否则从支付项中计算
|
|
3641
|
-
manualDepositAmount = ((_this$store$
|
|
3786
|
+
manualDepositAmount = ((_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
|
|
3642
3787
|
manualDepositValue = new Decimal(manualDepositAmount);
|
|
3643
3788
|
if (manualDepositValue.gt(0)) {
|
|
3644
3789
|
// 如果手动设置了定金金额且大于0,使用手动设置的值
|
|
@@ -3698,7 +3843,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3698
3843
|
}),
|
|
3699
3844
|
manualDepositAmount: manualDepositAmount,
|
|
3700
3845
|
finalDepositAmount: finalDepositAmount,
|
|
3701
|
-
isDeposit: ((_this$store$
|
|
3846
|
+
isDeposit: ((_this$store$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.is_deposit) || 0
|
|
3702
3847
|
});
|
|
3703
3848
|
|
|
3704
3849
|
// 构造订单参数,直接使用 localOrderData 中已处理好的数据
|
|
@@ -3720,7 +3865,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3720
3865
|
currency_code: this.otherParams.currency_code,
|
|
3721
3866
|
currency_symbol: this.otherParams.currency_symbol,
|
|
3722
3867
|
currency_format: this.otherParams.currency_format,
|
|
3723
|
-
is_deposit: ((_this$store$
|
|
3868
|
+
is_deposit: ((_this$store$currentOr26 = this.store.currentOrder) !== null && _this$store$currentOr26 !== void 0 && _this$store$currentOr26.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
|
|
3724
3869
|
deposit_amount: finalDepositAmount,
|
|
3725
3870
|
// 使用最终确定的定金金额(手动设置优先)
|
|
3726
3871
|
product_tax_fee: this.store.localOrderData.tax_fee,
|
|
@@ -4341,7 +4486,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4341
4486
|
}, {
|
|
4342
4487
|
key: "resetStoreState",
|
|
4343
4488
|
value: function resetStoreState() {
|
|
4344
|
-
var
|
|
4489
|
+
var _this7 = this;
|
|
4345
4490
|
try {
|
|
4346
4491
|
var prevOrderInfo = this.store.currentOrder ? {
|
|
4347
4492
|
uuid: this.store.currentOrder.uuid,
|
|
@@ -4376,7 +4521,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4376
4521
|
// 使用 setTimeout 确保事件处理不会阻塞状态重置
|
|
4377
4522
|
if (prevOrderInfo) {
|
|
4378
4523
|
setTimeout(function () {
|
|
4379
|
-
|
|
4524
|
+
_this7.core.effects.emit("".concat(_this7.name, ":onOrderCleared"), {
|
|
4380
4525
|
previousOrder: prevOrderInfo,
|
|
4381
4526
|
timestamp: Date.now()
|
|
4382
4527
|
});
|
|
@@ -103,6 +103,8 @@ export interface UpdateLocalOrderParams {
|
|
|
103
103
|
cartSummary: CartSummaryItem[];
|
|
104
104
|
/** total 信息(用于拆解金额) */
|
|
105
105
|
totalInfo: any;
|
|
106
|
+
/** 云端已存在的支付项(可选,用于处理订单在其他设备或云端生成的场景) */
|
|
107
|
+
existPayment?: PaymentItem[];
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
108
110
|
* 本地订单数据结构 (基于 appointmentDemo.json)
|
|
@@ -19,6 +19,9 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
19
19
|
private registerDependentModules;
|
|
20
20
|
private registerEventListeners;
|
|
21
21
|
setCustomer(customer: Customer): Promise<void>;
|
|
22
|
+
setHolders(holders: {
|
|
23
|
+
form_record_id: number;
|
|
24
|
+
}[]): void;
|
|
22
25
|
calcDiscount(productList: Record<string, any>[], options?: SetDiscountSelectedParams): {
|
|
23
26
|
productList: Record<string, any>[];
|
|
24
27
|
discountList: Discount[];
|