@pisell/pisellos 0.0.236 → 0.0.238
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/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +12 -6
- package/dist/modules/Payment/types.d.ts +46 -1
- package/dist/modules/Payment/types.js +15 -0
- package/dist/modules/Payment/walletpass.js +36 -11
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +210 -173
- package/dist/solution/Checkout/types.d.ts +35 -1
- package/dist/solution/Checkout/types.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +65 -30
- package/dist/solution/ShopDiscount/types.d.ts +2 -1
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +14 -0
- package/lib/modules/Payment/types.d.ts +46 -1
- package/lib/modules/Payment/types.js +3 -0
- package/lib/modules/Payment/walletpass.js +27 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +86 -21
- package/lib/solution/Checkout/types.d.ts +35 -1
- package/lib/solution/Checkout/types.js +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +20 -1
- package/lib/solution/ShopDiscount/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -393,7 +393,11 @@ export declare enum CheckoutHooks {
|
|
|
393
393
|
/** 订单取消 */
|
|
394
394
|
OnOrderCancelled = "checkout:onOrderCancelled",
|
|
395
395
|
/** 订单状态已清理 */
|
|
396
|
-
OnOrderCleared = "checkout:onOrderCleared"
|
|
396
|
+
OnOrderCleared = "checkout:onOrderCleared",
|
|
397
|
+
/** 下单接口请求开始 */
|
|
398
|
+
OnOrderSubmitStart = "checkout:onOrderSubmitStart",
|
|
399
|
+
/** 下单接口请求完成 */
|
|
400
|
+
OnOrderSubmitEnd = "checkout:onOrderSubmitEnd"
|
|
397
401
|
}
|
|
398
402
|
/**
|
|
399
403
|
* 结账状态数据
|
|
@@ -824,4 +828,34 @@ export interface CheckoutEventData {
|
|
|
824
828
|
} | null;
|
|
825
829
|
timestamp: number;
|
|
826
830
|
};
|
|
831
|
+
/** 下单接口请求开始事件 */
|
|
832
|
+
orderSubmitStart: {
|
|
833
|
+
/** 订单UUID */
|
|
834
|
+
orderUuid: string;
|
|
835
|
+
/** 操作类型 */
|
|
836
|
+
operation: 'create' | 'update';
|
|
837
|
+
/** 是否手动同步 */
|
|
838
|
+
isManual: boolean;
|
|
839
|
+
/** 支付项数量 */
|
|
840
|
+
paymentItemCount: number;
|
|
841
|
+
timestamp: number;
|
|
842
|
+
};
|
|
843
|
+
/** 下单接口请求完成事件 */
|
|
844
|
+
orderSubmitEnd: {
|
|
845
|
+
/** 是否成功 */
|
|
846
|
+
success: boolean;
|
|
847
|
+
/** 订单UUID */
|
|
848
|
+
orderUuid: string;
|
|
849
|
+
/** 操作类型 */
|
|
850
|
+
operation: 'create' | 'update';
|
|
851
|
+
/** 是否手动同步 */
|
|
852
|
+
isManual: boolean;
|
|
853
|
+
/** 返回的订单ID(成功时) */
|
|
854
|
+
orderId?: string;
|
|
855
|
+
/** 错误信息(失败时) */
|
|
856
|
+
error?: string;
|
|
857
|
+
/** 耗时(毫秒) */
|
|
858
|
+
duration?: number;
|
|
859
|
+
timestamp: number;
|
|
860
|
+
};
|
|
827
861
|
}
|
|
@@ -71,6 +71,8 @@ var CheckoutHooks = /* @__PURE__ */ ((CheckoutHooks2) => {
|
|
|
71
71
|
CheckoutHooks2["OnShopDiscountChanged"] = "checkout:onShopDiscountChanged";
|
|
72
72
|
CheckoutHooks2["OnOrderCancelled"] = "checkout:onOrderCancelled";
|
|
73
73
|
CheckoutHooks2["OnOrderCleared"] = "checkout:onOrderCleared";
|
|
74
|
+
CheckoutHooks2["OnOrderSubmitStart"] = "checkout:onOrderSubmitStart";
|
|
75
|
+
CheckoutHooks2["OnOrderSubmitEnd"] = "checkout:onOrderSubmitEnd";
|
|
74
76
|
return CheckoutHooks2;
|
|
75
77
|
})(CheckoutHooks || {});
|
|
76
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -50,7 +50,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
50
50
|
customer: null,
|
|
51
51
|
productList: [],
|
|
52
52
|
discount: null,
|
|
53
|
-
rules: null
|
|
53
|
+
rules: null,
|
|
54
|
+
originalDiscountList: []
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
// =========== 生命周期方法 ===========
|
|
@@ -241,6 +242,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
241
242
|
};
|
|
242
243
|
if (isAvailable) {
|
|
243
244
|
this.setDiscountList(newDiscountList || []);
|
|
245
|
+
this.store.originalDiscountList = newDiscountList || [];
|
|
244
246
|
this.setProductList(newProductList || []);
|
|
245
247
|
if (this.isWalkIn() && resultDiscountList.length && ((_b = this.options.otherParams) == null ? void 0 : _b.platform) === "shop") {
|
|
246
248
|
await this.getCustomerWallet(
|
|
@@ -388,6 +390,22 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
388
390
|
console.error("[ShopDiscount] 获取客户钱包信息出错:", error);
|
|
389
391
|
}
|
|
390
392
|
}
|
|
393
|
+
async bestDiscount() {
|
|
394
|
+
var _a;
|
|
395
|
+
const newDiscountList = this.store.originalDiscountList;
|
|
396
|
+
this.setDiscountList(newDiscountList);
|
|
397
|
+
if ((_a = this.store.productList) == null ? void 0 : _a.length) {
|
|
398
|
+
const result = this.calcDiscount(this.store.productList);
|
|
399
|
+
await this.core.effects.emit(
|
|
400
|
+
import_types.ShopDiscountHooks.onLoadPrepareCalcResult,
|
|
401
|
+
result
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
await this.core.effects.emit(
|
|
405
|
+
import_types.ShopDiscountHooks.onLoadDiscountList,
|
|
406
|
+
newDiscountList
|
|
407
|
+
);
|
|
408
|
+
}
|
|
391
409
|
// 加载准备配置
|
|
392
410
|
async loadPrepareConfig(params) {
|
|
393
411
|
var _a, _b, _c, _d;
|
|
@@ -405,6 +423,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
405
423
|
const scanDiscountIds = scanDiscount.map((n) => n.id);
|
|
406
424
|
const newGoodPassList = goodPassList == null ? void 0 : goodPassList.filter((n) => !scanDiscountIds.includes(n.id));
|
|
407
425
|
const newDiscountList = [...scanDiscount, ...newGoodPassList || []];
|
|
426
|
+
this.store.originalDiscountList = newDiscountList;
|
|
408
427
|
this.setDiscountList(newDiscountList || []);
|
|
409
428
|
if ((_d = this.store.productList) == null ? void 0 : _d.length) {
|
|
410
429
|
const result = this.calcDiscount(this.store.productList);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiscountModule } from '../../modules/Discount';
|
|
1
|
+
import { DiscountModule, Discount } from '../../modules/Discount';
|
|
2
2
|
import { RulesModule } from '../../modules/Rules';
|
|
3
3
|
export declare enum ShopDiscountHooks {
|
|
4
4
|
onInited = "shopDiscount:onInited",
|
|
@@ -22,4 +22,5 @@ export interface ShopDiscountState {
|
|
|
22
22
|
discount: DiscountModule | null;
|
|
23
23
|
rules: RulesModule | null;
|
|
24
24
|
productList: Record<string, any>[];
|
|
25
|
+
originalDiscountList: Discount[];
|
|
25
26
|
}
|