@pisell/pisellos 2.1.24 → 2.1.26
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/Cart/index.d.ts +1 -0
- package/dist/modules/Cart/index.js +1 -0
- package/dist/modules/Order/index.js +8 -13
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/dist/modules/Payment/index.js +58 -36
- package/dist/modules/Payment/types.d.ts +21 -0
- package/dist/modules/Payment/walletpass.js +16 -10
- package/dist/modules/Rules/index.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +16 -1
- package/dist/solution/Checkout/index.js +1106 -763
- package/dist/solution/Checkout/types.d.ts +17 -0
- package/dist/solution/Checkout/types.js +4 -0
- package/dist/solution/ShopDiscount/index.d.ts +6 -1
- package/dist/solution/ShopDiscount/index.js +1 -0
- package/lib/modules/Cart/index.d.ts +1 -0
- package/lib/modules/Cart/index.js +4 -1
- package/lib/modules/Order/index.js +1 -4
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/index.js +22 -5
- package/lib/modules/Payment/types.d.ts +21 -0
- package/lib/modules/Payment/walletpass.js +15 -9
- package/lib/modules/Rules/index.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +16 -1
- package/lib/solution/Checkout/index.js +303 -58
- package/lib/solution/Checkout/types.d.ts +17 -0
- package/lib/solution/ShopDiscount/index.d.ts +6 -1
- package/lib/solution/ShopDiscount/index.js +1 -0
- package/package.json +1 -1
|
@@ -91,6 +91,19 @@ export interface CreateLocalOrderParams {
|
|
|
91
91
|
autoPayment?: boolean;
|
|
92
92
|
totalInfo: any;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* 本地订单更新参数
|
|
96
|
+
*/
|
|
97
|
+
export interface UpdateLocalOrderParams {
|
|
98
|
+
/** 要更新的后端订单ID(已同步过后端的订单) */
|
|
99
|
+
orderId: string;
|
|
100
|
+
/** 更新后的订单数据(结构与创建时一致,允许部分字段变化) */
|
|
101
|
+
orderData: LocalOrderData;
|
|
102
|
+
/** 更新后的购物车小计数据 */
|
|
103
|
+
cartSummary: CartSummaryItem[];
|
|
104
|
+
/** total 信息(用于拆解金额) */
|
|
105
|
+
totalInfo: any;
|
|
106
|
+
}
|
|
94
107
|
/**
|
|
95
108
|
* 本地订单数据结构 (基于 appointmentDemo.json)
|
|
96
109
|
*/
|
|
@@ -373,6 +386,10 @@ export interface CheckoutModuleAPI extends Module {
|
|
|
373
386
|
* 创建本地订单 (前端模拟下单流程)
|
|
374
387
|
*/
|
|
375
388
|
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
389
|
+
/**
|
|
390
|
+
* 更新本地订单(基于已同步后的真实 orderId)并设置为当前订单
|
|
391
|
+
*/
|
|
392
|
+
updateLocalOrderAsync(params: UpdateLocalOrderParams): Promise<PaymentOrder>;
|
|
376
393
|
/**
|
|
377
394
|
* 完成结账
|
|
378
395
|
*/
|
|
@@ -42,6 +42,11 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
42
42
|
private getDiscountList;
|
|
43
43
|
private getCustomerWallet;
|
|
44
44
|
private bestDiscount;
|
|
45
|
-
|
|
45
|
+
loadPrepareConfig(params: {
|
|
46
|
+
customerId: number;
|
|
47
|
+
action?: 'create' | 'update';
|
|
48
|
+
with_good_pass?: 0 | 1;
|
|
49
|
+
with_discount_card?: 0 | 1;
|
|
50
|
+
}): Promise<void>;
|
|
46
51
|
}
|
|
47
52
|
export default ShopDiscountImpl;
|
|
@@ -488,6 +488,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
488
488
|
discount.tag = discount.type;
|
|
489
489
|
}
|
|
490
490
|
editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
491
|
+
name: discount.name || discount.discount.title.auto,
|
|
491
492
|
isEditMode: true,
|
|
492
493
|
limited_relation_product_data: {},
|
|
493
494
|
savedAmount: discount.amount * ((product === null || product === void 0 ? void 0 : product.num) || 1),
|
|
@@ -3,6 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { CartItem, CartModuleAPI, ECartItemCheckType, ECartItemInfoType, IAddItemParams, IUpdateItemParams } from './types';
|
|
4
4
|
import { Account } from '../Account';
|
|
5
5
|
export * from './types';
|
|
6
|
+
export { getProductDeposit } from './utils';
|
|
6
7
|
/**
|
|
7
8
|
* 购物车模块实现
|
|
8
9
|
*/
|
|
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/modules/Cart/index.ts
|
|
21
21
|
var Cart_exports = {};
|
|
22
22
|
__export(Cart_exports, {
|
|
23
|
-
CartModule: () => CartModule
|
|
23
|
+
CartModule: () => CartModule,
|
|
24
|
+
getProductDeposit: () => import_utils3.getProductDeposit
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(Cart_exports);
|
|
26
27
|
var import_BaseModule = require("../BaseModule");
|
|
@@ -29,6 +30,7 @@ var import_utils = require("./utils");
|
|
|
29
30
|
var import_lodash_es = require("lodash-es");
|
|
30
31
|
var import_utils2 = require("../Product/utils");
|
|
31
32
|
__reExport(Cart_exports, require("./types"), module.exports);
|
|
33
|
+
var import_utils3 = require("./utils");
|
|
32
34
|
var CartModule = class extends import_BaseModule.BaseModule {
|
|
33
35
|
constructor(name, version) {
|
|
34
36
|
super(name || "cart", version || "1.0.0");
|
|
@@ -361,5 +363,6 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
361
363
|
// Annotate the CommonJS export names for ESM import in node:
|
|
362
364
|
0 && (module.exports = {
|
|
363
365
|
CartModule,
|
|
366
|
+
getProductDeposit,
|
|
364
367
|
...require("./types")
|
|
365
368
|
});
|
|
@@ -225,16 +225,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
225
225
|
relation_products: [],
|
|
226
226
|
relation_forms: [],
|
|
227
227
|
payments: [],
|
|
228
|
+
is_full_overwrite_flag: 1,
|
|
228
229
|
...params
|
|
229
230
|
// 使用传入的参数覆盖默认值
|
|
230
231
|
};
|
|
231
232
|
if ((_h = orderData.payments) == null ? void 0 : _h.length) {
|
|
232
233
|
orderData.small_ticket_data_flag = 1;
|
|
233
234
|
}
|
|
234
|
-
if (params.order_id) {
|
|
235
|
-
orderData.bookings = [];
|
|
236
|
-
orderData.relation_products = [];
|
|
237
|
-
}
|
|
238
235
|
if (!params.order_id && !orderData.schedule_date) {
|
|
239
236
|
orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
240
237
|
}
|
|
@@ -25,7 +25,7 @@ __export(cashRecommendationAlgorithm_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(cashRecommendationAlgorithm_exports);
|
|
26
26
|
var CURRENCY_DENOMINATIONS = {
|
|
27
27
|
// 美元
|
|
28
|
-
"USD": [100, 50, 20, 10, 5,
|
|
28
|
+
"USD": [100, 50, 20, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.01],
|
|
29
29
|
// 人民币
|
|
30
30
|
"CNY": [100, 50, 20, 10, 5, 1, 0.5, 0.1, 0.05, 0.01],
|
|
31
31
|
"RMB": [100, 50, 20, 10, 5, 1, 0.5, 0.1, 0.05, 0.01],
|
|
@@ -397,6 +397,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
397
397
|
const order = await this.dbManager.get("order", orderUuid);
|
|
398
398
|
if (order) {
|
|
399
399
|
const updatedOrder = { ...order, ...params };
|
|
400
|
+
this.recalculateOrderAmount(updatedOrder);
|
|
400
401
|
await this.dbManager.update("order", updatedOrder);
|
|
401
402
|
await this.core.effects.emit(import_types.PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
402
403
|
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
@@ -527,7 +528,14 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
527
528
|
throw new Error(`Order not found: ${orderUuid}`);
|
|
528
529
|
}
|
|
529
530
|
const expectAmount = new import_decimal.Decimal(order.expect_amount);
|
|
530
|
-
|
|
531
|
+
const paidDepositAmount = order.payment.reduce((sum, payment) => {
|
|
532
|
+
if (payment.order_payment_type === "deposit" && payment.status !== "voided") {
|
|
533
|
+
return sum.plus(new import_decimal.Decimal(payment.amount));
|
|
534
|
+
}
|
|
535
|
+
return sum;
|
|
536
|
+
}, new import_decimal.Decimal(0));
|
|
537
|
+
const expectedDepositAmount = new import_decimal.Decimal(order.deposit_amount || "0").sub(paidDepositAmount);
|
|
538
|
+
if (expectAmount.lte(0) && expectedDepositAmount.eq(0)) {
|
|
531
539
|
const warningMessage = `订单 ${orderUuid} 待付金额已为0,不允许添加新的支付项`;
|
|
532
540
|
console.warn("[PaymentModule] Payment lock triggered:", {
|
|
533
541
|
orderUuid,
|
|
@@ -671,7 +679,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
671
679
|
throw new Error(`订单不存在: ${orderUuid}`);
|
|
672
680
|
}
|
|
673
681
|
const existingVoucherItems = order.payment.filter(
|
|
674
|
-
(payment) => payment.voucher_id && payment.status !== "voided"
|
|
682
|
+
(payment) => payment.voucher_id && payment.status !== "voided" && !payment.isSynced
|
|
675
683
|
);
|
|
676
684
|
console.log("[PaymentModule] 发现现有代金券支付项:", {
|
|
677
685
|
orderUuid,
|
|
@@ -680,7 +688,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
680
688
|
uuid: item.uuid,
|
|
681
689
|
code: item.code,
|
|
682
690
|
amount: item.amount,
|
|
683
|
-
voucher_id: item.voucher_id
|
|
691
|
+
voucher_id: item.voucher_id,
|
|
692
|
+
isSynced: item.isSynced
|
|
684
693
|
}))
|
|
685
694
|
});
|
|
686
695
|
for (const voucherItem of existingVoucherItems) {
|
|
@@ -913,7 +922,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
913
922
|
},
|
|
914
923
|
new import_decimal.Decimal(0)
|
|
915
924
|
);
|
|
916
|
-
const remainingAmount = totalAmount.minus(paidAmount);
|
|
925
|
+
const remainingAmount = order.is_deposit === 1 ? new import_decimal.Decimal(order.deposit_amount).minus(paidAmount) : totalAmount.minus(paidAmount);
|
|
917
926
|
order.expect_amount = import_decimal.Decimal.max(0, remainingAmount).toFixed(2);
|
|
918
927
|
console.log(`[PaymentModule] 重新计算订单金额:`, {
|
|
919
928
|
orderUuid: order.uuid,
|
|
@@ -1055,8 +1064,16 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1055
1064
|
throw new Error(`不支持的舍入规则: ${rule}`);
|
|
1056
1065
|
}
|
|
1057
1066
|
const finalAmount = roundedValue.mul(roundingInterval);
|
|
1058
|
-
const roundedAmountStr = finalAmount.toFixed(2);
|
|
1059
1067
|
const originalAmountStr = amount.toFixed(2);
|
|
1068
|
+
if (finalAmount.eq(0)) {
|
|
1069
|
+
console.log(`[PaymentModule] 最终金额为0,返回原始金额: ${originalAmountStr}`);
|
|
1070
|
+
return {
|
|
1071
|
+
originalAmount: originalAmountStr,
|
|
1072
|
+
roundedAmount: originalAmountStr,
|
|
1073
|
+
roundingDifference: "0.00"
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
const roundedAmountStr = finalAmount.toFixed(2);
|
|
1060
1077
|
const roundingDifference = finalAmount.sub(amount);
|
|
1061
1078
|
const roundingDifferenceStr = roundingDifference.toFixed(2);
|
|
1062
1079
|
console.log(`[PaymentModule] 舍入结果 - 原始金额: ${originalAmountStr}, 舍入后金额: ${roundedAmountStr}, 舍入差额: ${roundingDifferenceStr}`);
|
|
@@ -129,6 +129,15 @@ export interface PaymentItem {
|
|
|
129
129
|
origin_amount?: string;
|
|
130
130
|
/** 订单支付类型 */
|
|
131
131
|
order_payment_type?: 'normal' | 'deposit';
|
|
132
|
+
/** 本支付项是否已成功同步到后端 */
|
|
133
|
+
isSynced?: boolean;
|
|
134
|
+
/** 最近一次同步失败信息(存在则代表同步失败过) */
|
|
135
|
+
syncError?: {
|
|
136
|
+
error: string;
|
|
137
|
+
errorCode?: string;
|
|
138
|
+
statusCode?: number;
|
|
139
|
+
timestamp: number;
|
|
140
|
+
};
|
|
132
141
|
}
|
|
133
142
|
/**
|
|
134
143
|
* 订单信息
|
|
@@ -614,6 +623,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
614
623
|
amount: number;
|
|
615
624
|
tag: string;
|
|
616
625
|
}[];
|
|
626
|
+
/** 订单ID */
|
|
627
|
+
payment_order_id?: string;
|
|
617
628
|
}
|
|
618
629
|
/**
|
|
619
630
|
* 钱包初始化业务数据接口
|
|
@@ -626,6 +637,10 @@ export interface WalletInitBusinessData {
|
|
|
626
637
|
amountInfo: {
|
|
627
638
|
totalAmount: string;
|
|
628
639
|
subTotal: string;
|
|
640
|
+
/** 是否是定金订单 */
|
|
641
|
+
isDeposit?: number;
|
|
642
|
+
/** 定金金额 */
|
|
643
|
+
depositAmount?: string;
|
|
629
644
|
};
|
|
630
645
|
/** 商品列表 */
|
|
631
646
|
products: {
|
|
@@ -635,6 +650,8 @@ export interface WalletInitBusinessData {
|
|
|
635
650
|
selling_price: number;
|
|
636
651
|
}[];
|
|
637
652
|
order_wait_pay_amount?: number;
|
|
653
|
+
/** 订单ID */
|
|
654
|
+
payment_order_id?: string;
|
|
638
655
|
}
|
|
639
656
|
/**
|
|
640
657
|
* 查询用户识别码列表请求参数
|
|
@@ -652,6 +669,8 @@ export interface UserIdentificationCodeParams extends WalletDeductionRecommendPa
|
|
|
652
669
|
amount: number;
|
|
653
670
|
tag: string;
|
|
654
671
|
}[];
|
|
672
|
+
/** 订单ID */
|
|
673
|
+
payment_order_id?: string;
|
|
655
674
|
}
|
|
656
675
|
/**
|
|
657
676
|
* 钱包推荐扣款响应数据
|
|
@@ -703,6 +722,8 @@ export interface UserIdentificationCodeItem {
|
|
|
703
722
|
export interface SearchIdentificationCodeParams extends WalletDeductionRecommendParams {
|
|
704
723
|
/** 识别码 */
|
|
705
724
|
code: string;
|
|
725
|
+
/** 订单ID */
|
|
726
|
+
payment_order_id?: string;
|
|
706
727
|
}
|
|
707
728
|
/**
|
|
708
729
|
* 搜索识别码响应数据
|
|
@@ -49,7 +49,7 @@ var WalletPassPaymentImpl = class {
|
|
|
49
49
|
*/
|
|
50
50
|
generateWalletParams(businessData) {
|
|
51
51
|
var _a;
|
|
52
|
-
const { customer_id, amountInfo, products, order_wait_pay_amount } = businessData;
|
|
52
|
+
const { customer_id, amountInfo, products, order_wait_pay_amount, payment_order_id } = businessData;
|
|
53
53
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
54
54
|
const subTotal = Number(amountInfo.subTotal);
|
|
55
55
|
const walletParams = {
|
|
@@ -60,10 +60,11 @@ var WalletPassPaymentImpl = class {
|
|
|
60
60
|
// 订单小计金额
|
|
61
61
|
order_product_amount: subTotal,
|
|
62
62
|
// 订单待支付金额
|
|
63
|
-
order_wait_pay_amount: order_wait_pay_amount || totalAmount,
|
|
63
|
+
order_wait_pay_amount: order_wait_pay_amount || ((amountInfo == null ? void 0 : amountInfo.isDeposit) ? Number(amountInfo == null ? void 0 : amountInfo.depositAmount) : totalAmount),
|
|
64
64
|
// order_behavior_count_customer_id: 1,
|
|
65
65
|
products,
|
|
66
|
-
prepare_payments: []
|
|
66
|
+
prepare_payments: [],
|
|
67
|
+
payment_order_id
|
|
67
68
|
};
|
|
68
69
|
this.walletParams = walletParams;
|
|
69
70
|
this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
|
|
@@ -98,7 +99,7 @@ var WalletPassPaymentImpl = class {
|
|
|
98
99
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
99
100
|
const startTime = Date.now();
|
|
100
101
|
const walletParams = this.generateWalletParams(businessData);
|
|
101
|
-
if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0) {
|
|
102
|
+
if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0 || [1, 0].includes(walletParams == null ? void 0 : walletParams.customer_id)) {
|
|
102
103
|
return {
|
|
103
104
|
walletRecommendList: [],
|
|
104
105
|
userIdentificationCodes: []
|
|
@@ -178,11 +179,13 @@ var WalletPassPaymentImpl = class {
|
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
async getWalletPassRecommendListAsync(params) {
|
|
182
|
+
var _a;
|
|
181
183
|
try {
|
|
182
184
|
this.paymentModule.logInfo("[WalletPass] 开始获取钱包推荐列表", {
|
|
183
185
|
customer_id: params.customer_id,
|
|
184
186
|
order_expect_amount: params.order_expect_amount,
|
|
185
|
-
sale_channel: params.sale_channel
|
|
187
|
+
sale_channel: params.sale_channel,
|
|
188
|
+
payment_order_id: (_a = this.walletParams) == null ? void 0 : _a.payment_order_id
|
|
186
189
|
});
|
|
187
190
|
const response = await this.paymentModule.request.post(
|
|
188
191
|
"/machinecode/prepare/deduction/recommend",
|
|
@@ -216,7 +219,7 @@ var WalletPassPaymentImpl = class {
|
|
|
216
219
|
return (0, import_utils.formatWalletPassList2PreparePayments)(list);
|
|
217
220
|
}
|
|
218
221
|
async getUserIdentificationCodeListAsync(params) {
|
|
219
|
-
var _a;
|
|
222
|
+
var _a, _b;
|
|
220
223
|
try {
|
|
221
224
|
const newParams = {
|
|
222
225
|
...this.walletParams,
|
|
@@ -226,7 +229,8 @@ var WalletPassPaymentImpl = class {
|
|
|
226
229
|
customer_id: newParams.customer_id,
|
|
227
230
|
available: newParams.available,
|
|
228
231
|
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
229
|
-
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass
|
|
232
|
+
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
233
|
+
payment_order_id: (_b = this.walletParams) == null ? void 0 : _b.payment_order_id
|
|
230
234
|
});
|
|
231
235
|
const response = await this.paymentModule.request.post(
|
|
232
236
|
"/machinecode/prepare/deduction",
|
|
@@ -308,13 +312,15 @@ var WalletPassPaymentImpl = class {
|
|
|
308
312
|
prepare_payments: params.prepare_payments || (baseWalletParams == null ? void 0 : baseWalletParams.prepare_payments),
|
|
309
313
|
multiple: 1,
|
|
310
314
|
// 搜索特有参数
|
|
311
|
-
code: params.code
|
|
315
|
+
code: params.code,
|
|
316
|
+
payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
|
|
312
317
|
};
|
|
313
318
|
this.paymentModule.logInfo("[WalletPass] 搜索普通识别码", {
|
|
314
319
|
code: searchParams.code,
|
|
315
320
|
customer_id: searchParams.customer_id,
|
|
316
321
|
order_expect_amount: searchParams.order_expect_amount,
|
|
317
|
-
multiple: searchParams.multiple
|
|
322
|
+
multiple: searchParams.multiple,
|
|
323
|
+
payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
|
|
318
324
|
});
|
|
319
325
|
const response = await this.paymentModule.request.post(
|
|
320
326
|
"/machinecode/prepare/deduction/search",
|
|
@@ -379,7 +379,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
379
379
|
} else {
|
|
380
380
|
arr.push(this.hooks.setProduct(originProduct, {
|
|
381
381
|
discount_list: [discountDetail],
|
|
382
|
-
_id: product._id.split("___")[0] + "___" + selectedDiscount2.id + index,
|
|
382
|
+
_id: product._id.split("___")[0] + "___" + selectedDiscount2.id + "___" + index,
|
|
383
383
|
price: selectedDiscount2.tag === "good_pass" ? 0 : product.price,
|
|
384
384
|
quantity: isNeedSplit ? 1 : product.quantity,
|
|
385
385
|
total: targetProductTotal,
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
};
|
|
327
327
|
setOtherData(key: string, value: any): void;
|
|
328
328
|
getOtherData(key: string): any;
|
|
329
|
-
getProductTypeById(id: number): Promise<"
|
|
329
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
330
330
|
/**
|
|
331
331
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
332
332
|
*
|
|
@@ -2,7 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { OrderModule } from '../../modules/Order';
|
|
4
4
|
import { PaymentModule } from '../../modules/Payment';
|
|
5
|
-
import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
|
|
5
|
+
import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, UpdateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
|
|
6
6
|
import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
|
|
7
7
|
export * from './types';
|
|
8
8
|
/**
|
|
@@ -56,6 +56,14 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
56
56
|
initWalletData(params?: {
|
|
57
57
|
order_wait_pay_amount: number;
|
|
58
58
|
}): Promise<void>;
|
|
59
|
+
checkIsNeedDepositAsync(bookings: any[], relationProducts: any[]): {
|
|
60
|
+
total: number;
|
|
61
|
+
protocols: {
|
|
62
|
+
id: number;
|
|
63
|
+
title: string;
|
|
64
|
+
}[];
|
|
65
|
+
hasDeposit: boolean;
|
|
66
|
+
};
|
|
59
67
|
/**
|
|
60
68
|
* 创建本地订单 (前端模拟下单流程)
|
|
61
69
|
*
|
|
@@ -64,6 +72,13 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
64
72
|
* 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
|
|
65
73
|
*/
|
|
66
74
|
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
75
|
+
/**
|
|
76
|
+
* 更新本地订单(已同步后端的订单)并设置为当前订单
|
|
77
|
+
*
|
|
78
|
+
* 通过传入真实的 orderId,对已缓存的订单数据进行更新,
|
|
79
|
+
* 会覆盖 order_info 与金额等字段,并重新计算待付金额,最后设置为 currentOrder。
|
|
80
|
+
*/
|
|
81
|
+
updateLocalOrderAsync(params: UpdateLocalOrderParams): Promise<PaymentOrder>;
|
|
67
82
|
/**
|
|
68
83
|
* 完成结账
|
|
69
84
|
*/
|