@pisell/pisellos 2.1.3 → 2.1.5
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/core/index.js +2 -1
- package/dist/effects/index.d.ts +4 -3
- package/dist/effects/index.js +15 -6
- package/dist/modules/AccountList/index.d.ts +7 -1
- package/dist/modules/AccountList/index.js +81 -14
- package/dist/modules/AccountList/types.d.ts +28 -0
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Customer/constants.js +12 -0
- package/dist/modules/Customer/index.d.ts +122 -0
- package/dist/modules/Customer/index.js +697 -0
- package/dist/modules/Customer/types.d.ts +146 -0
- package/dist/modules/Customer/types.js +41 -0
- package/dist/modules/Date/index.d.ts +17 -0
- package/dist/modules/Date/index.js +92 -4
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +25 -1
- package/dist/modules/Order/index.js +224 -2
- package/dist/modules/Order/types.d.ts +45 -0
- package/dist/modules/Order/types.js +8 -0
- package/dist/modules/Payment/cash.d.ts +19 -0
- package/dist/modules/Payment/cash.js +97 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
- package/dist/modules/Payment/eftpos.d.ts +11 -0
- package/dist/modules/Payment/eftpos.js +80 -0
- package/dist/modules/Payment/index.d.ts +184 -9
- package/dist/modules/Payment/index.js +2012 -108
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/types.d.ts +750 -30
- package/dist/modules/Payment/types.js +236 -12
- package/dist/modules/Payment/utils.d.ts +17 -0
- package/dist/modules/Payment/utils.js +62 -0
- package/dist/modules/Payment/walletpass.d.ts +99 -0
- package/dist/modules/Payment/walletpass.js +701 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +12 -1
- package/dist/modules/ProductList/index.js +27 -3
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +39 -17
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +68 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/app-types/app/app.d.ts +83 -0
- package/dist/plugins/app-types/app/const.d.ts +4 -0
- package/dist/plugins/app-types/app/index.d.ts +14 -0
- package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/dist/plugins/app-types/config.d.ts +3 -0
- package/dist/plugins/app-types/cookie/index.d.ts +13 -0
- package/dist/plugins/app-types/data/index.d.ts +8 -0
- package/dist/plugins/app-types/history/config.d.ts +24 -0
- package/dist/plugins/app-types/history/index.d.ts +20 -0
- package/dist/plugins/app-types/history/type.d.ts +2 -0
- package/dist/plugins/app-types/hooks/index.d.ts +12 -0
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/dist/plugins/app-types/index.d.ts +6 -0
- package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
- package/dist/plugins/app-types/locales/en.d.ts +3 -0
- package/dist/plugins/app-types/locales/index.d.ts +37 -0
- package/dist/plugins/app-types/locales/original.d.ts +3 -0
- package/dist/plugins/app-types/locales/type.d.ts +19 -0
- package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
- package/dist/plugins/app-types/logger/index.d.ts +122 -0
- package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
- package/dist/plugins/app-types/models/global.d.ts +32 -0
- package/dist/plugins/app-types/models/index.d.ts +45 -0
- package/dist/plugins/app-types/models/type.d.ts +2 -0
- package/dist/plugins/app-types/package.json +15 -0
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
- package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
- package/dist/plugins/app-types/request/cache.d.ts +46 -0
- package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/dist/plugins/app-types/request/config.d.ts +3 -0
- package/dist/plugins/app-types/request/constants.d.ts +2 -0
- package/dist/plugins/app-types/request/index.d.ts +24 -0
- package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/dist/plugins/app-types/request/type.d.ts +41 -0
- package/dist/plugins/app-types/request/utils.d.ts +46 -0
- package/dist/plugins/app-types/routes/config.d.ts +7 -0
- package/dist/plugins/app-types/routes/index.d.ts +28 -0
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
- package/dist/plugins/app-types/socket/constants.d.ts +33 -0
- package/dist/plugins/app-types/socket/events.d.ts +31 -0
- package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/dist/plugins/app-types/socket/index.d.ts +61 -0
- package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
- package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/dist/plugins/app-types/socket/socket.d.ts +129 -0
- package/dist/plugins/app-types/socket/types.d.ts +85 -0
- package/dist/plugins/app-types/storage/index.d.ts +17 -0
- package/dist/plugins/app-types/tasks/index.d.ts +77 -0
- package/dist/plugins/app-types/tasks/type.d.ts +62 -0
- package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/dist/plugins/app-types/type.d.ts +2 -0
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/dist/plugins/app-types/variables/config.d.ts +3 -0
- package/dist/plugins/app-types/variables/index.d.ts +6 -0
- package/dist/plugins/app-types/variables/type.d.ts +2 -0
- package/dist/plugins/app-types/website/index.d.ts +6 -0
- package/dist/plugins/app.d.ts +8 -0
- package/dist/plugins/app.js +1 -0
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +1 -1
- package/dist/solution/BookingTicket/index.d.ts +180 -0
- package/dist/solution/BookingTicket/index.js +689 -0
- package/dist/solution/BookingTicket/types.d.ts +68 -0
- package/dist/solution/BookingTicket/types.js +43 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +509 -0
- package/dist/solution/Checkout/index.js +4874 -0
- package/dist/solution/Checkout/types.d.ts +923 -0
- package/dist/solution/Checkout/types.js +148 -0
- package/dist/solution/Checkout/utils/index.d.ts +117 -0
- package/dist/solution/Checkout/utils/index.js +549 -0
- package/dist/solution/ShopDiscount/index.d.ts +4 -9
- package/dist/solution/ShopDiscount/index.js +106 -54
- package/dist/solution/ShopDiscount/types.d.ts +10 -1
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/task.js +171 -0
- package/dist/utils/watch.d.ts +102 -0
- package/dist/utils/watch.js +294 -0
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +4 -3
- package/lib/effects/index.js +4 -1
- package/lib/modules/AccountList/index.d.ts +7 -1
- package/lib/modules/AccountList/index.js +27 -0
- package/lib/modules/AccountList/types.d.ts +28 -0
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Customer/constants.js +39 -0
- package/lib/modules/Customer/index.d.ts +122 -0
- package/lib/modules/Customer/index.js +440 -0
- package/lib/modules/Customer/types.d.ts +146 -0
- package/lib/modules/Customer/types.js +37 -0
- package/lib/modules/Date/index.d.ts +17 -0
- package/lib/modules/Date/index.js +64 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +25 -1
- package/lib/modules/Order/index.js +182 -0
- package/lib/modules/Order/types.d.ts +45 -0
- package/lib/modules/Payment/cash.d.ts +19 -0
- package/lib/modules/Payment/cash.js +64 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
- package/lib/modules/Payment/eftpos.d.ts +11 -0
- package/lib/modules/Payment/eftpos.js +51 -0
- package/lib/modules/Payment/index.d.ts +184 -9
- package/lib/modules/Payment/index.js +1044 -50
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/types.d.ts +750 -30
- package/lib/modules/Payment/types.js +79 -6
- package/lib/modules/Payment/utils.d.ts +17 -0
- package/lib/modules/Payment/utils.js +67 -0
- package/lib/modules/Payment/walletpass.d.ts +99 -0
- package/lib/modules/Payment/walletpass.js +468 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +12 -1
- package/lib/modules/ProductList/index.js +29 -2
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +32 -15
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +51 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/plugins/app-types/app/app.d.ts +83 -0
- package/lib/plugins/app-types/app/const.d.ts +4 -0
- package/lib/plugins/app-types/app/index.d.ts +14 -0
- package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/lib/plugins/app-types/config.d.ts +3 -0
- package/lib/plugins/app-types/cookie/index.d.ts +13 -0
- package/lib/plugins/app-types/data/index.d.ts +8 -0
- package/lib/plugins/app-types/history/config.d.ts +24 -0
- package/lib/plugins/app-types/history/index.d.ts +20 -0
- package/lib/plugins/app-types/history/type.d.ts +2 -0
- package/lib/plugins/app-types/hooks/index.d.ts +12 -0
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/lib/plugins/app-types/index.d.ts +6 -0
- package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
- package/lib/plugins/app-types/locales/en.d.ts +3 -0
- package/lib/plugins/app-types/locales/index.d.ts +37 -0
- package/lib/plugins/app-types/locales/original.d.ts +3 -0
- package/lib/plugins/app-types/locales/type.d.ts +19 -0
- package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
- package/lib/plugins/app-types/logger/index.d.ts +122 -0
- package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
- package/lib/plugins/app-types/models/global.d.ts +32 -0
- package/lib/plugins/app-types/models/index.d.ts +45 -0
- package/lib/plugins/app-types/models/type.d.ts +2 -0
- package/lib/plugins/app-types/package.json +15 -0
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
- package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
- package/lib/plugins/app-types/request/cache.d.ts +46 -0
- package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/lib/plugins/app-types/request/config.d.ts +3 -0
- package/lib/plugins/app-types/request/constants.d.ts +2 -0
- package/lib/plugins/app-types/request/index.d.ts +24 -0
- package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/lib/plugins/app-types/request/type.d.ts +41 -0
- package/lib/plugins/app-types/request/utils.d.ts +46 -0
- package/lib/plugins/app-types/routes/config.d.ts +7 -0
- package/lib/plugins/app-types/routes/index.d.ts +28 -0
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
- package/lib/plugins/app-types/socket/constants.d.ts +33 -0
- package/lib/plugins/app-types/socket/events.d.ts +31 -0
- package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/lib/plugins/app-types/socket/index.d.ts +61 -0
- package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
- package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/lib/plugins/app-types/socket/socket.d.ts +129 -0
- package/lib/plugins/app-types/socket/types.d.ts +85 -0
- package/lib/plugins/app-types/storage/index.d.ts +17 -0
- package/lib/plugins/app-types/tasks/index.d.ts +77 -0
- package/lib/plugins/app-types/tasks/type.d.ts +62 -0
- package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/lib/plugins/app-types/type.d.ts +2 -0
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/lib/plugins/app-types/variables/config.d.ts +3 -0
- package/lib/plugins/app-types/variables/index.d.ts +6 -0
- package/lib/plugins/app-types/variables/type.d.ts +2 -0
- package/lib/plugins/app-types/website/index.d.ts +6 -0
- package/lib/plugins/app.d.ts +8 -0
- package/lib/plugins/app.js +17 -0
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1 -2
- package/lib/solution/BookingTicket/index.d.ts +180 -0
- package/lib/solution/BookingTicket/index.js +420 -0
- package/lib/solution/BookingTicket/types.d.ts +68 -0
- package/lib/solution/BookingTicket/types.js +72 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +509 -0
- package/lib/solution/Checkout/index.js +3002 -0
- package/lib/solution/Checkout/types.d.ts +923 -0
- package/lib/solution/Checkout/types.js +87 -0
- package/lib/solution/Checkout/utils/index.d.ts +117 -0
- package/lib/solution/Checkout/utils/index.js +403 -0
- package/lib/solution/ShopDiscount/index.d.ts +4 -9
- package/lib/solution/ShopDiscount/index.js +41 -13
- package/lib/solution/ShopDiscount/types.d.ts +10 -1
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/task.js +109 -0
- package/lib/utils/watch.d.ts +102 -0
- package/lib/utils/watch.js +217 -0
- package/package.json +4 -2
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/Payment/walletpass.ts
|
|
20
|
+
var walletpass_exports = {};
|
|
21
|
+
__export(walletpass_exports, {
|
|
22
|
+
WalletPassPaymentImpl: () => WalletPassPaymentImpl
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(walletpass_exports);
|
|
25
|
+
var import_types = require("./types");
|
|
26
|
+
var import_utils = require("./utils");
|
|
27
|
+
var WalletPassPaymentImpl = class {
|
|
28
|
+
constructor(paymentModule) {
|
|
29
|
+
this.paymentModule = paymentModule;
|
|
30
|
+
this.walletRecommendList = [];
|
|
31
|
+
this.userIdentificationCodes = [];
|
|
32
|
+
this.searchResults = [];
|
|
33
|
+
this.walletParams = null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 发送事件的辅助方法
|
|
37
|
+
* 支持使用WalletPassHooks或PaymentHooks
|
|
38
|
+
*/
|
|
39
|
+
emitEvent(hook, data) {
|
|
40
|
+
try {
|
|
41
|
+
this.paymentModule.core.effects.emit(hook, data);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 生成钱包API默认参数
|
|
48
|
+
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
49
|
+
*/
|
|
50
|
+
generateWalletParams(businessData) {
|
|
51
|
+
var _a;
|
|
52
|
+
const { customer_id, amountInfo, products, order_wait_pay_amount } = businessData;
|
|
53
|
+
const totalAmount = Number(amountInfo.totalAmount);
|
|
54
|
+
const subTotal = Number(amountInfo.subTotal);
|
|
55
|
+
const walletParams = {
|
|
56
|
+
sale_channel: "pos",
|
|
57
|
+
customer_id: customer_id || 0,
|
|
58
|
+
// 提供默认值,确保类型为 number
|
|
59
|
+
order_expect_amount: totalAmount,
|
|
60
|
+
// 订单小计金额
|
|
61
|
+
order_product_amount: subTotal,
|
|
62
|
+
// 订单待支付金额
|
|
63
|
+
order_wait_pay_amount: order_wait_pay_amount || totalAmount,
|
|
64
|
+
// order_behavior_count_customer_id: 1,
|
|
65
|
+
products,
|
|
66
|
+
prepare_payments: []
|
|
67
|
+
};
|
|
68
|
+
this.walletParams = walletParams;
|
|
69
|
+
this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
|
|
70
|
+
customer_id: walletParams.customer_id,
|
|
71
|
+
order_expect_amount: walletParams.order_expect_amount,
|
|
72
|
+
order_product_amount: walletParams.order_product_amount,
|
|
73
|
+
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
74
|
+
products_count: ((_a = walletParams.products) == null ? void 0 : _a.length) || 0
|
|
75
|
+
});
|
|
76
|
+
return walletParams;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 获取已存储的钱包参数
|
|
80
|
+
* 返回之前生成并存储的钱包参数
|
|
81
|
+
*/
|
|
82
|
+
getStoredWalletParams() {
|
|
83
|
+
return this.walletParams;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 清理已存储的钱包参数
|
|
87
|
+
* 清除之前存储的钱包参数
|
|
88
|
+
*/
|
|
89
|
+
clearStoredWalletParams() {
|
|
90
|
+
this.walletParams = null;
|
|
91
|
+
this.paymentModule.logInfo("[WalletPass] 已存储的钱包参数已清理");
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 从业务数据初始化钱包数据
|
|
95
|
+
* 内部生成参数,然后调用标准的初始化流程
|
|
96
|
+
*/
|
|
97
|
+
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
99
|
+
const startTime = Date.now();
|
|
100
|
+
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
|
+
return {
|
|
103
|
+
walletRecommendList: [],
|
|
104
|
+
userIdentificationCodes: []
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationStarted, {
|
|
108
|
+
businessData,
|
|
109
|
+
startTime
|
|
110
|
+
});
|
|
111
|
+
this.paymentModule.logInfo("[WalletPass] 开始从业务数据初始化钱包数据", {
|
|
112
|
+
customer_id: businessData.customer_id,
|
|
113
|
+
totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
|
|
114
|
+
subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
|
|
115
|
+
order_wait_pay_amount: businessData.order_wait_pay_amount,
|
|
116
|
+
products_count: ((_e = businessData.products) == null ? void 0 : _e.length) || 0
|
|
117
|
+
});
|
|
118
|
+
try {
|
|
119
|
+
const result = await this.initializeWalletDataAsync(walletParams);
|
|
120
|
+
const endTime = Date.now();
|
|
121
|
+
const duration = endTime - startTime;
|
|
122
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationCompleted, {
|
|
123
|
+
businessData,
|
|
124
|
+
result,
|
|
125
|
+
startTime,
|
|
126
|
+
endTime,
|
|
127
|
+
duration
|
|
128
|
+
});
|
|
129
|
+
this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
|
|
130
|
+
duration: `${duration}ms`,
|
|
131
|
+
walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
|
|
132
|
+
userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
|
|
133
|
+
});
|
|
134
|
+
return result;
|
|
135
|
+
} catch (error) {
|
|
136
|
+
const endTime = Date.now();
|
|
137
|
+
const duration = endTime - startTime;
|
|
138
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationFailed, {
|
|
139
|
+
businessData,
|
|
140
|
+
error,
|
|
141
|
+
startTime,
|
|
142
|
+
endTime,
|
|
143
|
+
duration
|
|
144
|
+
});
|
|
145
|
+
this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
|
|
146
|
+
duration: `${duration}ms`,
|
|
147
|
+
customer_id: businessData.customer_id,
|
|
148
|
+
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
149
|
+
});
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 初始化钱包数据
|
|
155
|
+
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
156
|
+
*/
|
|
157
|
+
async initializeWalletDataAsync(baseParams) {
|
|
158
|
+
try {
|
|
159
|
+
const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
|
|
160
|
+
const identificationParams = {
|
|
161
|
+
...baseParams,
|
|
162
|
+
available: 2,
|
|
163
|
+
prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
|
|
164
|
+
other_exact_codes: [],
|
|
165
|
+
filter_prepare_wallet_pass: 1
|
|
166
|
+
};
|
|
167
|
+
const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
168
|
+
return {
|
|
169
|
+
walletRecommendList,
|
|
170
|
+
userIdentificationCodes
|
|
171
|
+
};
|
|
172
|
+
} catch (error) {
|
|
173
|
+
this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
|
|
174
|
+
customer_id: baseParams.customer_id,
|
|
175
|
+
order_expect_amount: baseParams.order_expect_amount
|
|
176
|
+
});
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async getWalletPassRecommendListAsync(params) {
|
|
181
|
+
try {
|
|
182
|
+
this.paymentModule.logInfo("[WalletPass] 开始获取钱包推荐列表", {
|
|
183
|
+
customer_id: params.customer_id,
|
|
184
|
+
order_expect_amount: params.order_expect_amount,
|
|
185
|
+
sale_channel: params.sale_channel
|
|
186
|
+
});
|
|
187
|
+
const response = await this.paymentModule.request.post(
|
|
188
|
+
"/machinecode/prepare/deduction/recommend",
|
|
189
|
+
params
|
|
190
|
+
// 将 params 作为请求体数据
|
|
191
|
+
);
|
|
192
|
+
this.walletRecommendList = (response == null ? void 0 : response.data) || [];
|
|
193
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
194
|
+
walletRecommendList: this.walletRecommendList
|
|
195
|
+
});
|
|
196
|
+
this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已更新", {
|
|
197
|
+
count: this.walletRecommendList.length,
|
|
198
|
+
items: this.walletRecommendList.map((item) => ({
|
|
199
|
+
voucher_id: item.voucher_id,
|
|
200
|
+
name: item.name,
|
|
201
|
+
amount: item.amount,
|
|
202
|
+
tag: item.tag
|
|
203
|
+
}))
|
|
204
|
+
});
|
|
205
|
+
return this.walletRecommendList;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
this.paymentModule.logError("[WalletPass] 获取钱包推荐列表失败", error, {
|
|
208
|
+
customer_id: params.customer_id,
|
|
209
|
+
order_expect_amount: params.order_expect_amount,
|
|
210
|
+
sale_channel: params.sale_channel
|
|
211
|
+
});
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
formatWalletPassList2PreparePayments(list) {
|
|
216
|
+
return (0, import_utils.formatWalletPassList2PreparePayments)(list);
|
|
217
|
+
}
|
|
218
|
+
async getUserIdentificationCodeListAsync(params) {
|
|
219
|
+
var _a;
|
|
220
|
+
try {
|
|
221
|
+
const newParams = {
|
|
222
|
+
...this.walletParams,
|
|
223
|
+
...params
|
|
224
|
+
};
|
|
225
|
+
this.paymentModule.logInfo("[WalletPass] 开始获取用户识别码列表", {
|
|
226
|
+
customer_id: newParams.customer_id,
|
|
227
|
+
available: newParams.available,
|
|
228
|
+
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
229
|
+
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass
|
|
230
|
+
});
|
|
231
|
+
const response = await this.paymentModule.request.post(
|
|
232
|
+
"/machinecode/prepare/deduction",
|
|
233
|
+
newParams
|
|
234
|
+
);
|
|
235
|
+
const sortedData = (0, import_utils.sortUserIdentificationCodeList)((response == null ? void 0 : response.data) || []);
|
|
236
|
+
this.userIdentificationCodes = sortedData;
|
|
237
|
+
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
238
|
+
userIdentificationCodes: this.userIdentificationCodes
|
|
239
|
+
});
|
|
240
|
+
this.paymentModule.logInfo("[WalletPass] 用户识别码列表已更新", {
|
|
241
|
+
count: this.userIdentificationCodes.length,
|
|
242
|
+
sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
|
|
243
|
+
code: item.code,
|
|
244
|
+
error_code: item.error_code,
|
|
245
|
+
error_msg: item.error_msg
|
|
246
|
+
}))
|
|
247
|
+
});
|
|
248
|
+
return this.userIdentificationCodes;
|
|
249
|
+
} catch (error) {
|
|
250
|
+
this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
|
|
251
|
+
customer_id: params.customer_id,
|
|
252
|
+
available: params.available
|
|
253
|
+
});
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* 搜索识别码信息
|
|
259
|
+
* 通过识别码搜索相关的钱包通行证信息
|
|
260
|
+
* 基于 WalletDeductionRecommendParams 参数结构
|
|
261
|
+
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
262
|
+
*/
|
|
263
|
+
async searchIdentificationCodeAsync(params, config = {}) {
|
|
264
|
+
try {
|
|
265
|
+
const { code } = params;
|
|
266
|
+
this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
|
|
267
|
+
code,
|
|
268
|
+
code_length: code.length,
|
|
269
|
+
noCache: config.noCache || false
|
|
270
|
+
});
|
|
271
|
+
const isWalletCode = code.startsWith("WL");
|
|
272
|
+
if (isWalletCode) {
|
|
273
|
+
const walletDetailParams = {
|
|
274
|
+
code,
|
|
275
|
+
with_customer: 1,
|
|
276
|
+
with: ["wallet"]
|
|
277
|
+
};
|
|
278
|
+
this.paymentModule.logInfo("[WalletPass] 搜索钱包识别码", {
|
|
279
|
+
code,
|
|
280
|
+
with_customer: walletDetailParams.with_customer,
|
|
281
|
+
with: walletDetailParams.with
|
|
282
|
+
});
|
|
283
|
+
const response2 = await this.paymentModule.request.post(
|
|
284
|
+
"/wallet/detail/search",
|
|
285
|
+
walletDetailParams
|
|
286
|
+
);
|
|
287
|
+
const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
|
|
288
|
+
this.paymentModule.logInfo("[WalletPass] 钱包识别码搜索完成", {
|
|
289
|
+
code,
|
|
290
|
+
results_count: searchResults2.length,
|
|
291
|
+
type: "walletCode"
|
|
292
|
+
});
|
|
293
|
+
return {
|
|
294
|
+
type: "walletCode",
|
|
295
|
+
data: searchResults2
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
const baseWalletParams = this.walletParams;
|
|
299
|
+
const searchParams = {
|
|
300
|
+
// 基础钱包参数
|
|
301
|
+
sale_channel: params.sale_channel || (baseWalletParams == null ? void 0 : baseWalletParams.sale_channel),
|
|
302
|
+
customer_id: params.customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.customer_id),
|
|
303
|
+
order_expect_amount: params.order_expect_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_expect_amount),
|
|
304
|
+
order_product_amount: params.order_product_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_product_amount),
|
|
305
|
+
order_wait_pay_amount: params.order_wait_pay_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_wait_pay_amount),
|
|
306
|
+
order_behavior_count_customer_id: params.order_behavior_count_customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.order_behavior_count_customer_id),
|
|
307
|
+
products: params.products || (baseWalletParams == null ? void 0 : baseWalletParams.products),
|
|
308
|
+
prepare_payments: params.prepare_payments || (baseWalletParams == null ? void 0 : baseWalletParams.prepare_payments),
|
|
309
|
+
multiple: 1,
|
|
310
|
+
// 搜索特有参数
|
|
311
|
+
code: params.code
|
|
312
|
+
};
|
|
313
|
+
this.paymentModule.logInfo("[WalletPass] 搜索普通识别码", {
|
|
314
|
+
code: searchParams.code,
|
|
315
|
+
customer_id: searchParams.customer_id,
|
|
316
|
+
order_expect_amount: searchParams.order_expect_amount,
|
|
317
|
+
multiple: searchParams.multiple
|
|
318
|
+
});
|
|
319
|
+
const response = await this.paymentModule.request.post(
|
|
320
|
+
"/machinecode/prepare/deduction/search",
|
|
321
|
+
searchParams
|
|
322
|
+
);
|
|
323
|
+
const searchResults = (response == null ? void 0 : response.data) || [];
|
|
324
|
+
if (config.noCache) {
|
|
325
|
+
return {
|
|
326
|
+
type: "normalCode",
|
|
327
|
+
data: searchResults
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
if (searchResults.length > 0) {
|
|
331
|
+
const existingCodes = new Set(
|
|
332
|
+
this.searchResults.map((item) => item.code)
|
|
333
|
+
);
|
|
334
|
+
const newResults = searchResults.filter(
|
|
335
|
+
(item) => !existingCodes.has(item.code)
|
|
336
|
+
);
|
|
337
|
+
this.searchResults.push(...newResults);
|
|
338
|
+
}
|
|
339
|
+
this.emitEvent(import_types.WalletPassHooks.OnSearchIdentificationCodeCompleted, {
|
|
340
|
+
searchCode: params.code,
|
|
341
|
+
currentSearchResults: searchResults,
|
|
342
|
+
cachedSearchResults: [...this.searchResults],
|
|
343
|
+
searchParams: params
|
|
344
|
+
});
|
|
345
|
+
this.paymentModule.logInfo("[WalletPass] 普通识别码搜索完成", {
|
|
346
|
+
code: params.code,
|
|
347
|
+
results_count: searchResults.length,
|
|
348
|
+
cached_results_count: this.searchResults.length,
|
|
349
|
+
type: "normalCode"
|
|
350
|
+
});
|
|
351
|
+
return {
|
|
352
|
+
type: "normalCode",
|
|
353
|
+
data: searchResults
|
|
354
|
+
};
|
|
355
|
+
} catch (error) {
|
|
356
|
+
this.paymentModule.logError("[WalletPass] 搜索识别码信息失败", error, {
|
|
357
|
+
code: params.code,
|
|
358
|
+
customer_id: params.customer_id,
|
|
359
|
+
order_expect_amount: params.order_expect_amount
|
|
360
|
+
});
|
|
361
|
+
throw error;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
365
|
+
this.paymentModule.logInfo("[WalletPass] 开始处理钱包支付", {
|
|
366
|
+
amount,
|
|
367
|
+
orderUuid,
|
|
368
|
+
voucherId: voucherId || "none"
|
|
369
|
+
});
|
|
370
|
+
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
371
|
+
if (!walletMethod) {
|
|
372
|
+
this.paymentModule.logError("[WalletPass] 钱包支付方式未找到", null, {
|
|
373
|
+
amount,
|
|
374
|
+
orderUuid,
|
|
375
|
+
voucherId
|
|
376
|
+
});
|
|
377
|
+
throw new Error("钱包支付方式未找到");
|
|
378
|
+
}
|
|
379
|
+
const paymentItem = {
|
|
380
|
+
amount: amount.toString(),
|
|
381
|
+
code: walletMethod.code,
|
|
382
|
+
id: walletMethod.id,
|
|
383
|
+
name: walletMethod.name,
|
|
384
|
+
type: walletMethod.type,
|
|
385
|
+
voucher_id: voucherId || ""
|
|
386
|
+
};
|
|
387
|
+
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
388
|
+
this.paymentModule.logInfo("[WalletPass] 钱包支付处理完成", {
|
|
389
|
+
amount,
|
|
390
|
+
orderUuid,
|
|
391
|
+
voucherId: voucherId || "none",
|
|
392
|
+
payment_method: walletMethod.name
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
async getWalletBalance(voucherId) {
|
|
396
|
+
return 0;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* 获取缓存的钱包推荐列表
|
|
400
|
+
*/
|
|
401
|
+
getWalletRecommendList() {
|
|
402
|
+
return this.walletRecommendList;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* 获取缓存的用户识别码列表
|
|
406
|
+
*/
|
|
407
|
+
getUserIdentificationCodes() {
|
|
408
|
+
return this.userIdentificationCodes;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* 清除钱包推荐列表
|
|
412
|
+
*/
|
|
413
|
+
clearWalletRecommendList() {
|
|
414
|
+
this.walletRecommendList = [];
|
|
415
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
416
|
+
clearedTypes: ["walletRecommendList"]
|
|
417
|
+
});
|
|
418
|
+
this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已清除");
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* 清除用户识别码列表
|
|
422
|
+
*/
|
|
423
|
+
clearUserIdentificationCodes() {
|
|
424
|
+
this.userIdentificationCodes = [];
|
|
425
|
+
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
426
|
+
clearedTypes: ["userIdentificationCodes"]
|
|
427
|
+
});
|
|
428
|
+
this.paymentModule.logInfo("[WalletPass] 用户识别码列表已清除");
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* 获取缓存的搜索结果列表
|
|
432
|
+
*/
|
|
433
|
+
getSearchResults() {
|
|
434
|
+
return this.searchResults;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* 根据识别码查找搜索结果
|
|
438
|
+
*/
|
|
439
|
+
findSearchResultByCode(code) {
|
|
440
|
+
return this.searchResults.find((item) => item.code === code);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* 清除搜索结果缓存
|
|
444
|
+
*/
|
|
445
|
+
clearSearchResults() {
|
|
446
|
+
this.searchResults = [];
|
|
447
|
+
this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* 清除所有缓存数据
|
|
451
|
+
*/
|
|
452
|
+
clearAllCache() {
|
|
453
|
+
this.walletRecommendList = [];
|
|
454
|
+
this.userIdentificationCodes = [];
|
|
455
|
+
this.searchResults = [];
|
|
456
|
+
this.walletParams = null;
|
|
457
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
458
|
+
clearedTypes: ["all"]
|
|
459
|
+
});
|
|
460
|
+
this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
|
|
461
|
+
cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
466
|
+
0 && (module.exports = {
|
|
467
|
+
WalletPassPaymentImpl
|
|
468
|
+
});
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -11,12 +11,17 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
11
11
|
constructor(name?: string, version?: string);
|
|
12
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
-
loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
|
|
15
15
|
category_ids?: number[];
|
|
16
16
|
product_ids?: number[];
|
|
17
17
|
collection?: number | string[];
|
|
18
18
|
schedule_date?: string;
|
|
19
19
|
cacheId?: string;
|
|
20
|
+
customer_id?: number;
|
|
21
|
+
menu_list_ids?: number[];
|
|
22
|
+
schedule_datetime?: string;
|
|
23
|
+
with_count?: string[];
|
|
24
|
+
with_schedule?: number;
|
|
20
25
|
}): Promise<any>;
|
|
21
26
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
22
27
|
ids?: number[];
|
|
@@ -28,4 +33,10 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
28
33
|
getProduct(id: number): Promise<ProductData | undefined>;
|
|
29
34
|
addProduct(products: ProductData[]): Promise<void>;
|
|
30
35
|
selectProducts(products: ProductData[]): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* 根据商品编码或条码搜索商品
|
|
38
|
+
* @param code 商品编码或条码
|
|
39
|
+
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
40
|
+
*/
|
|
41
|
+
findProductsByCodeOrBarcode(code: string): ProductData[];
|
|
31
42
|
}
|
|
@@ -54,14 +54,19 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
54
54
|
category_ids = [],
|
|
55
55
|
product_ids = [],
|
|
56
56
|
collection = [],
|
|
57
|
+
menu_list_ids = [],
|
|
58
|
+
customer_id: paramsCustomerId,
|
|
59
|
+
with_count = [],
|
|
60
|
+
schedule_datetime,
|
|
57
61
|
schedule_date,
|
|
58
|
-
cacheId
|
|
62
|
+
cacheId,
|
|
63
|
+
with_schedule
|
|
59
64
|
}) {
|
|
60
65
|
var _a, _b;
|
|
61
66
|
let userPlugin = this.core.getPlugin("user");
|
|
62
67
|
let customer_id = void 0;
|
|
63
68
|
try {
|
|
64
|
-
customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
|
|
69
|
+
customer_id = paramsCustomerId || ((_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id);
|
|
65
70
|
} catch (error) {
|
|
66
71
|
console.error(error);
|
|
67
72
|
}
|
|
@@ -87,8 +92,12 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
87
92
|
ids: product_ids,
|
|
88
93
|
collection,
|
|
89
94
|
front_end_cache_id: cacheId,
|
|
95
|
+
menu_list_ids,
|
|
96
|
+
with_count,
|
|
90
97
|
// client_schedule_ids: schedule_ids,
|
|
91
98
|
schedule_date,
|
|
99
|
+
with_schedule,
|
|
100
|
+
schedule_datetime,
|
|
92
101
|
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
|
|
93
102
|
},
|
|
94
103
|
{ useCache: true }
|
|
@@ -148,6 +157,24 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
148
157
|
async selectProducts(products) {
|
|
149
158
|
this.store.selectProducts = products;
|
|
150
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* 根据商品编码或条码搜索商品
|
|
162
|
+
* @param code 商品编码或条码
|
|
163
|
+
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
164
|
+
*/
|
|
165
|
+
findProductsByCodeOrBarcode(code) {
|
|
166
|
+
if (!code || typeof code !== "string") {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
const trimmedCode = code.trim();
|
|
170
|
+
if (!trimmedCode) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
const matchingProducts = this.store.list.filter((product) => {
|
|
174
|
+
return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
|
|
175
|
+
});
|
|
176
|
+
return (0, import_lodash_es.cloneDeep)(matchingProducts);
|
|
177
|
+
}
|
|
151
178
|
};
|
|
152
179
|
// Annotate the CommonJS export names for ESM import in node:
|
|
153
180
|
0 && (module.exports = {
|
|
@@ -2,6 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import { Rules, RulesModuleAPI, DiscountResult } from './types';
|
|
4
4
|
import { Discount } from "../Discount/types";
|
|
5
|
+
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
5
6
|
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
6
7
|
protected defaultName: string;
|
|
7
8
|
protected defaultVersion: string;
|
|
@@ -26,6 +27,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
26
27
|
}, options?: {
|
|
27
28
|
isSelected?: boolean;
|
|
28
29
|
discountId?: number;
|
|
30
|
+
selectedList?: SetDiscountSelectedParams[];
|
|
29
31
|
scan?: boolean;
|
|
30
32
|
}): DiscountResult;
|
|
31
33
|
destroy(): Promise<void>;
|