@pisell/pisellos 2.3.127 → 2.3.128
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/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +19 -58
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +12 -24
- package/dist/modules/Customer/index.js +3 -6
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +151 -37
- package/dist/modules/Discount/types.d.ts +5 -36
- package/dist/modules/Order/index.d.ts +2 -7
- package/dist/modules/Order/index.js +331 -480
- package/dist/modules/Order/utils/orderCollectionIdentity.js +12 -16
- package/dist/modules/Order/utils/weighedProduct.d.ts +12 -0
- package/dist/modules/Order/utils/weighedProduct.js +94 -0
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +65 -104
- package/dist/modules/Payment/types.d.ts +1 -21
- package/dist/modules/Payment/types.js +0 -2
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +47 -80
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +190 -482
- package/dist/modules/Rules/types.d.ts +2 -4
- package/dist/server/modules/order/types.d.ts +0 -2
- package/dist/server/utils/small-ticket.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +2 -3
- package/dist/solution/BaseSales/index.js +77 -44
- package/dist/solution/BaseSales/types.d.ts +7 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +126 -141
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +40 -25
- package/dist/solution/BaseSales/utils.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +3 -2
- package/dist/solution/BookingTicket/index.js +63 -60
- package/dist/solution/BookingTicket/types.d.ts +1 -5
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +147 -338
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +6 -19
- package/dist/solution/ScanOrder/utils.js +3 -2
- package/dist/solution/ShopDiscount/index.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +42 -99
- package/dist/solution/ShopDiscount/utils.d.ts +2 -4
- package/dist/solution/ShopDiscount/utils.js +23 -43
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -35
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -13
- package/lib/modules/Customer/index.js +1 -5
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +129 -23
- package/lib/modules/Discount/types.d.ts +5 -36
- package/lib/modules/Order/index.d.ts +2 -7
- package/lib/modules/Order/index.js +109 -222
- package/lib/modules/Order/utils/orderCollectionIdentity.js +11 -14
- package/lib/modules/Order/utils/weighedProduct.d.ts +12 -0
- package/lib/modules/Order/utils/weighedProduct.js +89 -0
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +6 -41
- package/lib/modules/Payment/types.d.ts +1 -21
- package/lib/modules/Payment/types.js +0 -1
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +9 -29
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +114 -359
- package/lib/modules/Rules/types.d.ts +2 -4
- package/lib/server/modules/order/types.d.ts +0 -2
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +2 -3
- package/lib/solution/BaseSales/index.js +17 -11
- package/lib/solution/BaseSales/types.d.ts +7 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +4 -12
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -9
- package/lib/solution/BaseSales/utils.js +2 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +3 -2
- package/lib/solution/BookingTicket/index.js +33 -36
- package/lib/solution/BookingTicket/types.d.ts +1 -5
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +42 -174
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +3 -11
- package/lib/solution/ScanOrder/utils.js +2 -1
- package/lib/solution/ShopDiscount/index.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +9 -55
- package/lib/solution/ShopDiscount/utils.d.ts +2 -4
- package/lib/solution/ShopDiscount/utils.js +25 -42
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/package.json +1 -1
- package/dist/modules/Discount/availability.d.ts +0 -7
- package/dist/modules/Discount/availability.js +0 -49
- package/dist/modules/Discount/entitlementPass.d.ts +0 -34
- package/dist/modules/Discount/entitlementPass.js +0 -147
- package/lib/modules/Discount/availability.d.ts +0 -7
- package/lib/modules/Discount/availability.js +0 -43
- package/lib/modules/Discount/entitlementPass.d.ts +0 -34
- package/lib/modules/Discount/entitlementPass.js +0 -141
|
@@ -29,12 +29,10 @@ export interface RulesCalcDiscountOptions {
|
|
|
29
29
|
discountId?: number;
|
|
30
30
|
selectedList?: SetDiscountSelectedParams[];
|
|
31
31
|
scan?: boolean;
|
|
32
|
-
/** 本次扫码优先使用的次卡实例;普通重算不传,继续保留商品行当前选择。 */
|
|
33
|
-
preferredEntitlementPassIds?: number[];
|
|
34
|
-
/** 普通重算保留商品行已应用的次卡;最优选择传 false 恢复自动排序。 */
|
|
35
|
-
preserveEntitlementSelection?: boolean;
|
|
36
32
|
/** Change time 重报价目标行:允许已选编辑态折扣卡重新应用到这些 booking 商品。 */
|
|
37
33
|
reapplyBookingDiscountProductUids?: string[];
|
|
34
|
+
/** Reweighed order lines only: reapply selected wallet discounts against their new amount. */
|
|
35
|
+
reapplyWeighedDiscountProductUids?: string[];
|
|
38
36
|
}
|
|
39
37
|
export interface RulesModuleAPI {
|
|
40
38
|
setRulesList: (rulesList: Rules[]) => Promise<void>;
|
|
@@ -36,8 +36,6 @@ export type OrderSurchargeType = string;
|
|
|
36
36
|
export interface OrderProductDiscountMetadata {
|
|
37
37
|
/** 设备端本地唯一标识,用于与服务端记录对齐 */
|
|
38
38
|
unique_identification_number?: string;
|
|
39
|
-
/** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
|
|
40
|
-
balance?: number | null;
|
|
41
39
|
[key: string]: unknown;
|
|
42
40
|
}
|
|
43
41
|
/**
|
|
@@ -994,7 +994,7 @@ function resolveVariantItem(group, itemPositionId) {
|
|
|
994
994
|
}
|
|
995
995
|
function getProductTitleSource(source, locale) {
|
|
996
996
|
if (!source || _typeof(source) !== 'object') return '';
|
|
997
|
-
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
997
|
+
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title_i18n, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name_i18n, locale) || resolveTitleValue(source.name, locale);
|
|
998
998
|
}
|
|
999
999
|
function getBundleProductTitleSource(source, locale) {
|
|
1000
1000
|
if (!source || _typeof(source) !== 'object') return '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
3
|
+
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentOptions, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
5
|
import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
|
|
6
6
|
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
@@ -415,7 +415,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
415
415
|
refreshWalletAssets(params?: {
|
|
416
416
|
order_wait_pay_amount?: number;
|
|
417
417
|
preserveSelection?: boolean;
|
|
418
|
-
retainSearchResultCodes?: string[];
|
|
419
418
|
}): Promise<WalletAssetsState>;
|
|
420
419
|
/** 选择或取消单张钱包资产,并立即同步 pending wallet payments。 */
|
|
421
420
|
selectWalletAsset(params: {
|
|
@@ -451,7 +450,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
451
450
|
private findCashPaymentMethod;
|
|
452
451
|
private getPendingWalletPaymentAmount;
|
|
453
452
|
/** 读取现金 action 所需的支付方式、待付金额和快捷金额。 */
|
|
454
|
-
getCashPaymentConfig(): Promise<BaseSalesCashPaymentConfig>;
|
|
453
|
+
getCashPaymentConfig(options?: BaseSalesCashPaymentOptions): Promise<BaseSalesCashPaymentConfig>;
|
|
455
454
|
/**
|
|
456
455
|
* 确认足额覆盖订单的 pending Wallet 支付并提交订单。
|
|
457
456
|
*
|
|
@@ -2815,7 +2815,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2815
2815
|
(item.discount_list || []).forEach(function (discount) {
|
|
2816
2816
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
2817
2817
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
2818
|
-
if (!discountId || !['
|
|
2818
|
+
if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
|
|
2819
2819
|
var quantity = item.quantity || item.num || item.product_quantity || 1;
|
|
2820
2820
|
var savedAmount = new Decimal(discount.amount || 0).times(quantity).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
|
|
2821
2821
|
var index = historyDiscountList.findIndex(function (n) {
|
|
@@ -3380,8 +3380,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3380
3380
|
return resolveIsFormSubject(tempOrder, product);
|
|
3381
3381
|
},
|
|
3382
3382
|
orderTotalAmount: orderTotalAmount
|
|
3383
|
-
}, {
|
|
3384
|
-
preserveEntitlementSelection: false
|
|
3385
3383
|
}) || result;
|
|
3386
3384
|
if (result.productList) {
|
|
3387
3385
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
@@ -5215,8 +5213,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5215
5213
|
return this.publishWalletAssetsState(clearedState);
|
|
5216
5214
|
case 21:
|
|
5217
5215
|
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
5218
|
-
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
5219
|
-
retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
|
|
5216
|
+
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
5220
5217
|
});
|
|
5221
5218
|
_context47.next = 24;
|
|
5222
5219
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
@@ -5461,12 +5458,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5461
5458
|
}
|
|
5462
5459
|
}, {
|
|
5463
5460
|
key: "findCashPaymentMethod",
|
|
5464
|
-
value: function findCashPaymentMethod(paymentMethods) {
|
|
5461
|
+
value: function findCashPaymentMethod(paymentMethods, paymentMethodId) {
|
|
5465
5462
|
return paymentMethods.find(function (method) {
|
|
5463
|
+
if ((method === null || method === void 0 ? void 0 : method.enabled) === false || (method === null || method === void 0 ? void 0 : method.enable) === false) return false;
|
|
5466
5464
|
var identifiers = [method === null || method === void 0 ? void 0 : method.code, method === null || method === void 0 ? void 0 : method.type, method === null || method === void 0 ? void 0 : method.tag].map(function (value) {
|
|
5467
5465
|
return String(value || '').toUpperCase();
|
|
5468
5466
|
});
|
|
5469
|
-
|
|
5467
|
+
var isDefaultCash = identifiers.includes('CASHMANUAL');
|
|
5468
|
+
if (paymentMethodId === undefined) return isDefaultCash;
|
|
5469
|
+
var isCustomCash = String((method === null || method === void 0 ? void 0 : method.type) || '').trim().toLowerCase() === 'custom' && [method === null || method === void 0 ? void 0 : method.name, method === null || method === void 0 ? void 0 : method.nameEn].some(function (name) {
|
|
5470
|
+
return typeof name === 'string' && /现金|現金|cash/i.test(name);
|
|
5471
|
+
});
|
|
5472
|
+
return String(method === null || method === void 0 ? void 0 : method.id) === String(paymentMethodId) && (isDefaultCash || isCustomCash);
|
|
5470
5473
|
});
|
|
5471
5474
|
}
|
|
5472
5475
|
}, {
|
|
@@ -5492,28 +5495,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5492
5495
|
value: (function () {
|
|
5493
5496
|
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
|
|
5494
5497
|
var _this$store$order22, _this$store$order22$g, _this$store$order23, _this$store$order23$g, _this$otherParams34;
|
|
5495
|
-
var
|
|
5498
|
+
var options,
|
|
5499
|
+
paymentMethods,
|
|
5500
|
+
paymentMethod,
|
|
5501
|
+
amountSnapshot,
|
|
5502
|
+
pendingWalletAmount,
|
|
5503
|
+
amountDue,
|
|
5504
|
+
currency,
|
|
5505
|
+
recommendedAmounts,
|
|
5506
|
+
_args53 = arguments;
|
|
5496
5507
|
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5497
5508
|
while (1) switch (_context53.prev = _context53.next) {
|
|
5498
5509
|
case 0:
|
|
5510
|
+
options = _args53.length > 0 && _args53[0] !== undefined ? _args53[0] : {};
|
|
5499
5511
|
if (this.store.payment) {
|
|
5500
|
-
_context53.next =
|
|
5512
|
+
_context53.next = 3;
|
|
5501
5513
|
break;
|
|
5502
5514
|
}
|
|
5503
5515
|
throw new Error('payment 模块未初始化');
|
|
5504
|
-
case
|
|
5516
|
+
case 3:
|
|
5505
5517
|
paymentMethods = this.getPaymentMethods();
|
|
5506
|
-
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
5518
|
+
paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
|
|
5507
5519
|
if (paymentMethod) {
|
|
5508
|
-
_context53.next =
|
|
5520
|
+
_context53.next = 10;
|
|
5509
5521
|
break;
|
|
5510
5522
|
}
|
|
5511
|
-
_context53.next =
|
|
5523
|
+
_context53.next = 8;
|
|
5512
5524
|
return this.getPaymentMethodsAsync();
|
|
5513
|
-
case
|
|
5525
|
+
case 8:
|
|
5514
5526
|
paymentMethods = _context53.sent;
|
|
5515
|
-
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
5516
|
-
case
|
|
5527
|
+
paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
|
|
5528
|
+
case 10:
|
|
5529
|
+
if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
|
|
5530
|
+
_context53.next = 12;
|
|
5531
|
+
break;
|
|
5532
|
+
}
|
|
5533
|
+
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
|
|
5534
|
+
case 12:
|
|
5517
5535
|
amountSnapshot = (_this$store$order22 = this.store.order) === null || _this$store$order22 === void 0 || (_this$store$order22$g = _this$store$order22.getOrderAmountSnapshot) === null || _this$store$order22$g === void 0 ? void 0 : _this$store$order22$g.call(_this$store$order22);
|
|
5518
5536
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
5519
5537
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
@@ -5525,7 +5543,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5525
5543
|
amountDue: amountDue,
|
|
5526
5544
|
recommendedAmounts: recommendedAmounts
|
|
5527
5545
|
});
|
|
5528
|
-
case
|
|
5546
|
+
case 18:
|
|
5529
5547
|
case "end":
|
|
5530
5548
|
return _context53.stop();
|
|
5531
5549
|
}
|
|
@@ -5690,31 +5708,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5690
5708
|
}
|
|
5691
5709
|
throw new Error('现金支付金额必须大于 0');
|
|
5692
5710
|
case 5:
|
|
5693
|
-
|
|
5711
|
+
if (!(params.paymentMethodId === undefined)) {
|
|
5712
|
+
_context55.next = 11;
|
|
5713
|
+
break;
|
|
5714
|
+
}
|
|
5715
|
+
_context55.next = 8;
|
|
5694
5716
|
return this.getCashPaymentConfig();
|
|
5695
|
-
case
|
|
5696
|
-
|
|
5717
|
+
case 8:
|
|
5718
|
+
_context55.t0 = _context55.sent;
|
|
5719
|
+
_context55.next = 14;
|
|
5720
|
+
break;
|
|
5721
|
+
case 11:
|
|
5722
|
+
_context55.next = 13;
|
|
5723
|
+
return this.getCashPaymentConfig({
|
|
5724
|
+
paymentMethodId: params.paymentMethodId
|
|
5725
|
+
});
|
|
5726
|
+
case 13:
|
|
5727
|
+
_context55.t0 = _context55.sent;
|
|
5728
|
+
case 14:
|
|
5729
|
+
config = _context55.t0;
|
|
5697
5730
|
paymentMethod = config.paymentMethod;
|
|
5698
5731
|
if (paymentMethod) {
|
|
5699
|
-
_context55.next =
|
|
5732
|
+
_context55.next = 18;
|
|
5700
5733
|
break;
|
|
5701
5734
|
}
|
|
5702
5735
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
5703
|
-
case
|
|
5736
|
+
case 18:
|
|
5704
5737
|
if (!(config.amountDue <= 0)) {
|
|
5705
|
-
_context55.next =
|
|
5738
|
+
_context55.next = 20;
|
|
5706
5739
|
break;
|
|
5707
5740
|
}
|
|
5708
5741
|
throw new Error('当前订单没有待支付金额');
|
|
5709
|
-
case
|
|
5742
|
+
case 20:
|
|
5710
5743
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
5711
5744
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
5712
5745
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
5713
|
-
_context55.next =
|
|
5746
|
+
_context55.next = 24;
|
|
5714
5747
|
break;
|
|
5715
5748
|
}
|
|
5716
5749
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
5717
|
-
case
|
|
5750
|
+
case 24:
|
|
5718
5751
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5719
5752
|
beforePaymentStatus = (_this$store$order$get13 = this.store.order.getTempOrder()) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.payment_status;
|
|
5720
5753
|
uniquePaymentNumber = createUuidV4();
|
|
@@ -5723,11 +5756,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5723
5756
|
changeAmount = Number(params.changeAmount || 0);
|
|
5724
5757
|
shopWalletPassId = (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.shop_wallet_pass_id;
|
|
5725
5758
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
5726
|
-
_context55.next =
|
|
5759
|
+
_context55.next = 33;
|
|
5727
5760
|
break;
|
|
5728
5761
|
}
|
|
5729
5762
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
5730
|
-
case
|
|
5763
|
+
case 33:
|
|
5731
5764
|
(_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.interaction) === null || _this$window === void 0 || (_this$window = _this$window.utils) === null || _this$window === void 0 || (_this$window$postMess = _this$window.postMessageToApp) === null || _this$window$postMess === void 0 || _this$window$postMess.call(_this$window, {
|
|
5732
5765
|
module: 'till',
|
|
5733
5766
|
key: 'open_till',
|
|
@@ -5758,57 +5791,57 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5758
5791
|
var _item$metadata2;
|
|
5759
5792
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
5760
5793
|
});
|
|
5761
|
-
_context55.prev =
|
|
5762
|
-
_context55.next =
|
|
5794
|
+
_context55.prev = 36;
|
|
5795
|
+
_context55.next = 39;
|
|
5763
5796
|
return this.syncPaymentsToOrder({
|
|
5764
5797
|
payments: payments,
|
|
5765
5798
|
submitWhenPaid: true,
|
|
5766
5799
|
smallTicketDataFlag: 1,
|
|
5767
5800
|
confirmPendingVoucherPayments: true
|
|
5768
5801
|
});
|
|
5769
|
-
case
|
|
5802
|
+
case 39:
|
|
5770
5803
|
syncResult = _context55.sent;
|
|
5771
5804
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
5772
|
-
_context55.next =
|
|
5805
|
+
_context55.next = 42;
|
|
5773
5806
|
break;
|
|
5774
5807
|
}
|
|
5775
5808
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
5776
|
-
case
|
|
5809
|
+
case 42:
|
|
5777
5810
|
if (!this.store.payment) {
|
|
5778
|
-
_context55.next =
|
|
5811
|
+
_context55.next = 47;
|
|
5779
5812
|
break;
|
|
5780
5813
|
}
|
|
5781
5814
|
committed = this.getCommittedWalletAssets();
|
|
5782
5815
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5783
|
-
_context55.next =
|
|
5816
|
+
_context55.next = 47;
|
|
5784
5817
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
5785
|
-
case
|
|
5818
|
+
case 47:
|
|
5786
5819
|
return _context55.abrupt("return", {
|
|
5787
5820
|
payment: payment || {},
|
|
5788
5821
|
payments: this.store.order.getOrderPayments(),
|
|
5789
5822
|
syncResult: syncResult,
|
|
5790
5823
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
5791
5824
|
});
|
|
5792
|
-
case
|
|
5793
|
-
_context55.prev =
|
|
5794
|
-
_context55.
|
|
5825
|
+
case 50:
|
|
5826
|
+
_context55.prev = 50;
|
|
5827
|
+
_context55.t1 = _context55["catch"](36);
|
|
5795
5828
|
this.store.order.setOrderPayments(beforePayments);
|
|
5796
5829
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
5797
5830
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
5798
5831
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
5799
5832
|
this.store.order.persistTempOrder();
|
|
5800
5833
|
}
|
|
5801
|
-
_context55.next =
|
|
5834
|
+
_context55.next = 57;
|
|
5802
5835
|
return this.store.order.recalculateSummary({
|
|
5803
5836
|
createIfMissing: true
|
|
5804
5837
|
});
|
|
5805
|
-
case
|
|
5806
|
-
throw _context55.
|
|
5807
|
-
case
|
|
5838
|
+
case 57:
|
|
5839
|
+
throw _context55.t1;
|
|
5840
|
+
case 58:
|
|
5808
5841
|
case "end":
|
|
5809
5842
|
return _context55.stop();
|
|
5810
5843
|
}
|
|
5811
|
-
}, _callee55, this, [[
|
|
5844
|
+
}, _callee55, this, [[36, 50]]);
|
|
5812
5845
|
}));
|
|
5813
5846
|
function payCash(_x44) {
|
|
5814
5847
|
return _payCash.apply(this, arguments);
|
|
@@ -23,13 +23,17 @@ export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSales
|
|
|
23
23
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
24
24
|
export type BaseSalesStatus = 'idle' | 'initializing' | 'ready' | 'error';
|
|
25
25
|
export type BaseSalesPaymentStatus = 'paid' | 'partially_paid' | 'unpaid' | 'payment_processing' | string;
|
|
26
|
+
export interface BaseSalesCashPaymentOptions {
|
|
27
|
+
/** 指定现金支付方式;省略时使用默认 CASHMANUAL。 */
|
|
28
|
+
paymentMethodId?: number | string;
|
|
29
|
+
}
|
|
26
30
|
export interface BaseSalesCashPaymentConfig {
|
|
27
31
|
available: boolean;
|
|
28
32
|
paymentMethod?: PaymentMethod;
|
|
29
33
|
amountDue: number;
|
|
30
34
|
recommendedAmounts: number[];
|
|
31
35
|
}
|
|
32
|
-
export interface BaseSalesPayCashParams {
|
|
36
|
+
export interface BaseSalesPayCashParams extends BaseSalesCashPaymentOptions {
|
|
33
37
|
/** 实际计入订单的现金支付金额(部分支付时小于待付金额)。 */
|
|
34
38
|
amount: number;
|
|
35
39
|
/** 顾客实际交付现金;可大于 amount。 */
|
|
@@ -441,10 +445,10 @@ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
|
|
|
441
445
|
/** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
|
|
442
446
|
export interface BaseSalesScanCodeResult {
|
|
443
447
|
isAvailable: boolean;
|
|
444
|
-
/** 卡券已加入 Promotion
|
|
448
|
+
/** 卡券已加入 Promotion;false 时可能是无效、过期或已使用。 */
|
|
445
449
|
isAccepted?: boolean;
|
|
446
450
|
type?: 'server' | string;
|
|
447
451
|
unavailableReason?: 'time_limit' | string;
|
|
448
|
-
/**
|
|
452
|
+
/** batchSearch 原始结果;Holder 补全等流程可从这里读取原始卡券。 */
|
|
449
453
|
scannedDiscountList?: Discount[];
|
|
450
454
|
}
|