@pisell/pisellos 0.0.244 → 0.0.246
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/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +365 -388
- package/dist/solution/Checkout/types.d.ts +20 -1
- package/dist/solution/Checkout/types.js +1 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +18 -8
- package/lib/solution/Checkout/types.d.ts +20 -1
- package/lib/solution/Checkout/types.js +1 -0
- package/package.json +1 -1
|
@@ -403,7 +403,9 @@ export declare enum CheckoutHooks {
|
|
|
403
403
|
/** 下单接口请求开始 */
|
|
404
404
|
OnOrderSubmitStart = "checkout:onOrderSubmitStart",
|
|
405
405
|
/** 下单接口请求完成 */
|
|
406
|
-
OnOrderSubmitEnd = "checkout:onOrderSubmitEnd"
|
|
406
|
+
OnOrderSubmitEnd = "checkout:onOrderSubmitEnd",
|
|
407
|
+
/** 钱包数据初始化完成 */
|
|
408
|
+
OnWalletDataInitialized = "checkout:onWalletDataInitialized"
|
|
407
409
|
}
|
|
408
410
|
/**
|
|
409
411
|
* 结账状态数据
|
|
@@ -897,4 +899,21 @@ export interface CheckoutEventData {
|
|
|
897
899
|
duration?: number;
|
|
898
900
|
timestamp: number;
|
|
899
901
|
};
|
|
902
|
+
/** 钱包数据初始化完成事件 */
|
|
903
|
+
walletDataInitialized: {
|
|
904
|
+
/** 订单UUID */
|
|
905
|
+
orderUuid?: string;
|
|
906
|
+
/** 客户ID */
|
|
907
|
+
customerId?: number;
|
|
908
|
+
/** 钱包业务数据 */
|
|
909
|
+
walletBusinessData: {
|
|
910
|
+
customer_id?: number;
|
|
911
|
+
amountInfo: {
|
|
912
|
+
totalAmount: string;
|
|
913
|
+
subTotal: string;
|
|
914
|
+
};
|
|
915
|
+
order_wait_pay_amount?: number;
|
|
916
|
+
};
|
|
917
|
+
timestamp: number;
|
|
918
|
+
};
|
|
900
919
|
}
|
|
@@ -123,6 +123,7 @@ export var CheckoutHooks = /*#__PURE__*/function (CheckoutHooks) {
|
|
|
123
123
|
CheckoutHooks["OnOrderCleared"] = "checkout:onOrderCleared";
|
|
124
124
|
CheckoutHooks["OnOrderSubmitStart"] = "checkout:onOrderSubmitStart";
|
|
125
125
|
CheckoutHooks["OnOrderSubmitEnd"] = "checkout:onOrderSubmitEnd";
|
|
126
|
+
CheckoutHooks["OnWalletDataInitialized"] = "checkout:onWalletDataInitialized";
|
|
126
127
|
return CheckoutHooks;
|
|
127
128
|
}({});
|
|
128
129
|
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -121,7 +121,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
121
121
|
async initializeCheckoutAsync(params) {
|
|
122
122
|
try {
|
|
123
123
|
await this.setStatus(import_types.CheckoutStatus.Initializing);
|
|
124
|
-
const validation =
|
|
124
|
+
const validation = this.validateCheckoutParams(params);
|
|
125
125
|
if (!validation.valid) {
|
|
126
126
|
throw (0, import_utils.createCheckoutError)(
|
|
127
127
|
import_types.CheckoutErrorType.ValidationFailed,
|
|
@@ -164,7 +164,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
164
164
|
return [...productList, ...relationProducts];
|
|
165
165
|
}
|
|
166
166
|
async initWalletData(params) {
|
|
167
|
-
var _a, _b, _c;
|
|
167
|
+
var _a, _b, _c, _d;
|
|
168
168
|
const amountInfo = (_b = (_a = this.store.currentOrder) == null ? void 0 : _a.order_info) == null ? void 0 : _b.amount_breakdown;
|
|
169
169
|
if (!amountInfo) {
|
|
170
170
|
return;
|
|
@@ -181,6 +181,16 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
181
181
|
await this.payment.wallet.initializeWalletDataFromBusinessAsync(
|
|
182
182
|
walletBusinessData
|
|
183
183
|
);
|
|
184
|
+
await this.core.effects.emit(import_types.CheckoutHooks.OnWalletDataInitialized, {
|
|
185
|
+
orderUuid: (_d = this.store.currentOrder) == null ? void 0 : _d.uuid,
|
|
186
|
+
customerId: walletBusinessData.customer_id,
|
|
187
|
+
walletBusinessData: {
|
|
188
|
+
customer_id: walletBusinessData.customer_id,
|
|
189
|
+
amountInfo: walletBusinessData.amountInfo,
|
|
190
|
+
order_wait_pay_amount: params == null ? void 0 : params.order_wait_pay_amount
|
|
191
|
+
},
|
|
192
|
+
timestamp: Date.now()
|
|
193
|
+
});
|
|
184
194
|
}
|
|
185
195
|
/**
|
|
186
196
|
* 创建本地订单 (前端模拟下单流程)
|
|
@@ -194,7 +204,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
194
204
|
try {
|
|
195
205
|
await this.resetStoreStateAsync();
|
|
196
206
|
await this.setStatus(import_types.CheckoutStatus.CreatingOrder);
|
|
197
|
-
const validation =
|
|
207
|
+
const validation = this.validateLocalOrderData(params.orderData);
|
|
198
208
|
if (!validation.valid) {
|
|
199
209
|
throw (0, import_utils.createCheckoutError)(
|
|
200
210
|
import_types.CheckoutErrorType.ValidationFailed,
|
|
@@ -238,13 +248,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
238
248
|
}
|
|
239
249
|
});
|
|
240
250
|
this.store.currentOrder = paymentOrder;
|
|
241
|
-
|
|
251
|
+
this.initWalletData();
|
|
242
252
|
await this.setStatus(import_types.CheckoutStatus.OrderCreated);
|
|
243
253
|
await this.setStep(import_types.CheckoutStep.PaymentMethod);
|
|
244
254
|
if (params.autoPayment) {
|
|
245
255
|
await this.setStep(import_types.CheckoutStep.PaymentProcessing);
|
|
246
256
|
}
|
|
247
|
-
|
|
257
|
+
this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
|
|
248
258
|
order: paymentOrder,
|
|
249
259
|
timestamp: Date.now()
|
|
250
260
|
});
|
|
@@ -263,7 +273,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
263
273
|
error,
|
|
264
274
|
import_types.CheckoutErrorType.OrderCreationFailed
|
|
265
275
|
);
|
|
266
|
-
|
|
276
|
+
this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreationFailed, {
|
|
267
277
|
error: this.store.lastError,
|
|
268
278
|
timestamp: Date.now()
|
|
269
279
|
});
|
|
@@ -1799,13 +1809,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1799
1809
|
/**
|
|
1800
1810
|
* 验证结账参数
|
|
1801
1811
|
*/
|
|
1802
|
-
|
|
1812
|
+
validateCheckoutParams(params) {
|
|
1803
1813
|
return (0, import_utils.validateCheckoutData)(params);
|
|
1804
1814
|
}
|
|
1805
1815
|
/**
|
|
1806
1816
|
* 验证本地订单数据
|
|
1807
1817
|
*/
|
|
1808
|
-
|
|
1818
|
+
validateLocalOrderData(orderData) {
|
|
1809
1819
|
var _a;
|
|
1810
1820
|
const errors = [];
|
|
1811
1821
|
if (!orderData.type) {
|
|
@@ -403,7 +403,9 @@ export declare enum CheckoutHooks {
|
|
|
403
403
|
/** 下单接口请求开始 */
|
|
404
404
|
OnOrderSubmitStart = "checkout:onOrderSubmitStart",
|
|
405
405
|
/** 下单接口请求完成 */
|
|
406
|
-
OnOrderSubmitEnd = "checkout:onOrderSubmitEnd"
|
|
406
|
+
OnOrderSubmitEnd = "checkout:onOrderSubmitEnd",
|
|
407
|
+
/** 钱包数据初始化完成 */
|
|
408
|
+
OnWalletDataInitialized = "checkout:onWalletDataInitialized"
|
|
407
409
|
}
|
|
408
410
|
/**
|
|
409
411
|
* 结账状态数据
|
|
@@ -897,4 +899,21 @@ export interface CheckoutEventData {
|
|
|
897
899
|
duration?: number;
|
|
898
900
|
timestamp: number;
|
|
899
901
|
};
|
|
902
|
+
/** 钱包数据初始化完成事件 */
|
|
903
|
+
walletDataInitialized: {
|
|
904
|
+
/** 订单UUID */
|
|
905
|
+
orderUuid?: string;
|
|
906
|
+
/** 客户ID */
|
|
907
|
+
customerId?: number;
|
|
908
|
+
/** 钱包业务数据 */
|
|
909
|
+
walletBusinessData: {
|
|
910
|
+
customer_id?: number;
|
|
911
|
+
amountInfo: {
|
|
912
|
+
totalAmount: string;
|
|
913
|
+
subTotal: string;
|
|
914
|
+
};
|
|
915
|
+
order_wait_pay_amount?: number;
|
|
916
|
+
};
|
|
917
|
+
timestamp: number;
|
|
918
|
+
};
|
|
900
919
|
}
|
|
@@ -75,6 +75,7 @@ var CheckoutHooks = /* @__PURE__ */ ((CheckoutHooks2) => {
|
|
|
75
75
|
CheckoutHooks2["OnOrderCleared"] = "checkout:onOrderCleared";
|
|
76
76
|
CheckoutHooks2["OnOrderSubmitStart"] = "checkout:onOrderSubmitStart";
|
|
77
77
|
CheckoutHooks2["OnOrderSubmitEnd"] = "checkout:onOrderSubmitEnd";
|
|
78
|
+
CheckoutHooks2["OnWalletDataInitialized"] = "checkout:onWalletDataInitialized";
|
|
78
79
|
return CheckoutHooks2;
|
|
79
80
|
})(CheckoutHooks || {});
|
|
80
81
|
// Annotate the CommonJS export names for ESM import in node:
|