@pisell/pisellos 0.0.567 → 0.0.568
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 +6 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +32 -40
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -246
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +652 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +22 -45
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +117 -113
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +63 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -167
- package/lib/modules/Schedule/index.js +97 -107
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +882 -623
- package/lib/server/modules/index.js +85 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +227 -158
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -1,98 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
BookingTicketImpl: true,
|
|
8
|
+
BookingTicket: true
|
|
18
9
|
};
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
__export(BookingTicket_exports, {
|
|
33
|
-
BookingTicket: () => BookingTicketImpl,
|
|
34
|
-
BookingTicketImpl: () => BookingTicketImpl
|
|
10
|
+
exports.BookingTicketImpl = exports.BookingTicket = void 0;
|
|
11
|
+
var _BaseModule = require("../../modules/BaseModule");
|
|
12
|
+
var _types = require("./types");
|
|
13
|
+
Object.keys(_types).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _types[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
35
23
|
});
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
24
|
+
var _scan = _interopRequireDefault(require("./utils/scan"));
|
|
25
|
+
var _handleScan = require("./utils/scan/handleScan");
|
|
26
|
+
var _scanCache = _interopRequireDefault(require("./utils/scan/scanCache"));
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
class BookingTicketImpl extends _BaseModule.BaseModule {
|
|
29
|
+
defaultName = 'bookingTicket';
|
|
30
|
+
defaultVersion = '1.0.0';
|
|
31
|
+
isSolution = true;
|
|
32
|
+
request;
|
|
33
|
+
window;
|
|
34
|
+
shopStore;
|
|
35
|
+
store;
|
|
36
|
+
otherParams = {};
|
|
37
|
+
cacheId;
|
|
38
|
+
platform; // 平台类型,用于判断是 PC / H5
|
|
39
|
+
|
|
40
|
+
scan;
|
|
51
41
|
async initialize(core, options) {
|
|
52
|
-
var _a, _b, _c;
|
|
53
42
|
this.core = core;
|
|
54
43
|
this.store = options.store || {};
|
|
55
44
|
this.otherParams = options.otherParams || {};
|
|
56
|
-
|
|
57
|
-
this.request = core.getPlugin(
|
|
58
|
-
this.window = core.getPlugin(
|
|
59
|
-
this.shopStore = core.getPlugin(
|
|
45
|
+
// 获取依赖的插件
|
|
46
|
+
this.request = core.getPlugin('request');
|
|
47
|
+
this.window = core.getPlugin('window');
|
|
48
|
+
this.shopStore = core.getPlugin('shopStore');
|
|
60
49
|
if (!this.request) {
|
|
61
|
-
throw new Error(
|
|
50
|
+
throw new Error('bookingTicket解决方案需要 request 插件支持');
|
|
62
51
|
}
|
|
63
52
|
if (!this.shopStore) {
|
|
64
|
-
throw new Error(
|
|
53
|
+
throw new Error('bookingTicket解决方案需要 shopStore 插件支持');
|
|
65
54
|
}
|
|
55
|
+
|
|
56
|
+
// 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
|
|
66
57
|
let targetCacheData = {};
|
|
67
|
-
this.cacheId =
|
|
68
|
-
this.platform =
|
|
69
|
-
this.scan = new
|
|
70
|
-
if (
|
|
58
|
+
this.cacheId = this.otherParams?.cacheId;
|
|
59
|
+
this.platform = this.otherParams?.platform;
|
|
60
|
+
this.scan = new _scan.default(this, 'BOOKING_TICKET_SCAN');
|
|
61
|
+
if (this.otherParams?.cacheId) {
|
|
71
62
|
const sessionData = this.window.sessionStorage.getItem(this.name);
|
|
72
63
|
if (sessionData) {
|
|
73
64
|
const data = JSON.parse(sessionData);
|
|
74
65
|
targetCacheData = data[this.otherParams.cacheId];
|
|
75
66
|
}
|
|
76
67
|
}
|
|
77
|
-
const moduleArr = [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"accountList",
|
|
81
|
-
"customer",
|
|
82
|
-
"order"
|
|
83
|
-
];
|
|
84
|
-
moduleArr.forEach((step) => {
|
|
85
|
-
var _a2, _b2;
|
|
86
|
-
const targetModule = (0, import_types.createModule)(step, this.name);
|
|
68
|
+
const moduleArr = ['cart', 'products', 'accountList', 'customer', 'order'];
|
|
69
|
+
moduleArr.forEach(step => {
|
|
70
|
+
const targetModule = (0, _types.createModule)(step, this.name);
|
|
87
71
|
if (targetModule) {
|
|
88
72
|
this.store[step] = targetModule;
|
|
89
73
|
this.core.registerModule(targetModule, {
|
|
90
|
-
initialState: targetCacheData
|
|
74
|
+
initialState: targetCacheData?.[targetModule.name],
|
|
91
75
|
otherParams: {
|
|
92
76
|
...this.otherParams,
|
|
93
77
|
fatherModule: this.name,
|
|
94
|
-
openCache:
|
|
95
|
-
cacheId:
|
|
78
|
+
openCache: this.otherParams?.cacheId ? true : false,
|
|
79
|
+
cacheId: this.otherParams?.cacheId
|
|
96
80
|
}
|
|
97
81
|
});
|
|
98
82
|
} else {
|
|
@@ -101,16 +85,22 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
101
85
|
});
|
|
102
86
|
this.core.effects.emit(`${this.name}:onInited`, {});
|
|
103
87
|
}
|
|
88
|
+
|
|
104
89
|
/**
|
|
105
90
|
* 获取商品列表
|
|
106
91
|
* @param params 包含 schedule_date 的参数
|
|
107
92
|
* @returns 商品列表
|
|
108
93
|
*/
|
|
109
94
|
async loadProducts(params = {}, options) {
|
|
110
|
-
const {
|
|
95
|
+
const {
|
|
96
|
+
schedule_date,
|
|
97
|
+
customer_id,
|
|
98
|
+
menu_list_ids,
|
|
99
|
+
schedule_datetime
|
|
100
|
+
} = params;
|
|
111
101
|
try {
|
|
112
102
|
const result = await this.store.products.loadProducts({
|
|
113
|
-
with_count: [
|
|
103
|
+
with_count: ['bundleGroup', 'optionGroup'],
|
|
114
104
|
with_schedule: 1,
|
|
115
105
|
...params,
|
|
116
106
|
cacheId: this.cacheId
|
|
@@ -118,24 +108,26 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
118
108
|
this.core.effects.emit(`${this.name}:onProductsLoaded`, result);
|
|
119
109
|
return result;
|
|
120
110
|
} catch (error) {
|
|
121
|
-
console.error(
|
|
111
|
+
console.error('Failed to load products:', error);
|
|
122
112
|
throw error;
|
|
123
113
|
}
|
|
124
114
|
}
|
|
115
|
+
|
|
125
116
|
/**
|
|
126
117
|
* 取消商品查询订阅
|
|
127
118
|
* @param subscriberId 订阅时传入的 subscriberId
|
|
128
119
|
*/
|
|
129
120
|
unsubscribeProductQuery(subscriberId) {
|
|
130
|
-
|
|
131
|
-
(_a = this.core.server) == null ? void 0 : _a.removeProductQuerySubscriber(subscriberId);
|
|
121
|
+
this.core.server?.removeProductQuerySubscriber(subscriberId);
|
|
132
122
|
}
|
|
123
|
+
|
|
133
124
|
/**
|
|
134
125
|
* 初始化外设扫码结果监听
|
|
135
126
|
*/
|
|
136
127
|
initPeripheralsListener() {
|
|
137
128
|
this.scan.initPeripheralsListener();
|
|
138
129
|
}
|
|
130
|
+
|
|
139
131
|
/**
|
|
140
132
|
* 获取商品列表(不加载到模块中)
|
|
141
133
|
* @returns 商品列表
|
|
@@ -143,19 +135,21 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
143
135
|
async getProducts() {
|
|
144
136
|
return this.store.products.getProducts();
|
|
145
137
|
}
|
|
138
|
+
|
|
146
139
|
/**
|
|
147
140
|
* 获取日程时间段点
|
|
148
141
|
* @param params 参数
|
|
149
142
|
* @returns 日程时间段点
|
|
150
143
|
*/
|
|
151
144
|
async getScheduleTimePoints(params) {
|
|
152
|
-
const result = await this.request.post(
|
|
145
|
+
const result = await this.request.post('/menu/schedule-time-points', {
|
|
153
146
|
menu_list_ids: params.menu_list_ids
|
|
154
147
|
}, {
|
|
155
148
|
osServer: true
|
|
156
149
|
});
|
|
157
150
|
return result.data || [];
|
|
158
151
|
}
|
|
152
|
+
|
|
159
153
|
/**
|
|
160
154
|
* 获取客户列表
|
|
161
155
|
* @param params 查询参数
|
|
@@ -166,10 +160,11 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
166
160
|
const result = await this.store.customer.getCustomerList(params);
|
|
167
161
|
return result;
|
|
168
162
|
} catch (error) {
|
|
169
|
-
console.error(
|
|
163
|
+
console.error('Failed to get customer list:', error);
|
|
170
164
|
throw error;
|
|
171
165
|
}
|
|
172
166
|
}
|
|
167
|
+
|
|
173
168
|
/**
|
|
174
169
|
* 设置活跃客户
|
|
175
170
|
* @param customer 客户信息
|
|
@@ -180,6 +175,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
180
175
|
customer
|
|
181
176
|
});
|
|
182
177
|
}
|
|
178
|
+
|
|
183
179
|
/**
|
|
184
180
|
* 获取当前活跃客户
|
|
185
181
|
* @returns 当前活跃客户
|
|
@@ -187,6 +183,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
187
183
|
getActiveCustomer() {
|
|
188
184
|
return this.store.customer.getSelectedCustomer();
|
|
189
185
|
}
|
|
186
|
+
|
|
190
187
|
/**
|
|
191
188
|
* 根据ID设置选中的客户
|
|
192
189
|
* @param customerId 客户ID
|
|
@@ -200,6 +197,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
200
197
|
});
|
|
201
198
|
}
|
|
202
199
|
}
|
|
200
|
+
|
|
203
201
|
/**
|
|
204
202
|
* 获取所有客户
|
|
205
203
|
* @returns 客户列表
|
|
@@ -207,6 +205,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
207
205
|
getCustomers() {
|
|
208
206
|
return this.store.customer.getCustomers();
|
|
209
207
|
}
|
|
208
|
+
|
|
210
209
|
/**
|
|
211
210
|
* 根据ID获取客户
|
|
212
211
|
* @param customerId 客户ID
|
|
@@ -215,12 +214,14 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
215
214
|
getCustomerById(customerId) {
|
|
216
215
|
return this.store.customer.getCustomerById(customerId);
|
|
217
216
|
}
|
|
217
|
+
|
|
218
218
|
/**
|
|
219
219
|
* 清空客户列表
|
|
220
220
|
*/
|
|
221
221
|
clearCustomers() {
|
|
222
222
|
this.store.customer.clearCustomers();
|
|
223
223
|
}
|
|
224
|
+
|
|
224
225
|
/**
|
|
225
226
|
* 添加客户到列表第一位
|
|
226
227
|
* @param customer 要添加的客户信息
|
|
@@ -228,6 +229,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
228
229
|
addCustomerToFirst(customer) {
|
|
229
230
|
this.store.customer.addCustomerToFirst(customer);
|
|
230
231
|
}
|
|
232
|
+
|
|
231
233
|
/**
|
|
232
234
|
* 获取客户分页信息
|
|
233
235
|
* @returns 分页信息
|
|
@@ -235,6 +237,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
235
237
|
getCustomerPaginationInfo() {
|
|
236
238
|
return this.store.customer.getPaginationInfo();
|
|
237
239
|
}
|
|
240
|
+
|
|
238
241
|
/**
|
|
239
242
|
* 获取客户列表总数
|
|
240
243
|
* @returns 总数
|
|
@@ -242,6 +245,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
242
245
|
getCustomerTotal() {
|
|
243
246
|
return this.store.customer.getState().total;
|
|
244
247
|
}
|
|
248
|
+
|
|
245
249
|
/**
|
|
246
250
|
* 设置客户分页信息
|
|
247
251
|
* @param page 页码
|
|
@@ -250,6 +254,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
250
254
|
setCustomerPaginationInfo(page, pageSize) {
|
|
251
255
|
this.store.customer.setPaginationInfo(page, pageSize);
|
|
252
256
|
}
|
|
257
|
+
|
|
253
258
|
/**
|
|
254
259
|
* 便捷方法:切换客户分页并自动获取数据
|
|
255
260
|
* @param page 页码
|
|
@@ -258,16 +263,14 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
258
263
|
*/
|
|
259
264
|
async changeCustomerPage(page, pageSize) {
|
|
260
265
|
try {
|
|
261
|
-
const result = await this.store.customer.changeCustomerPage(
|
|
262
|
-
page,
|
|
263
|
-
pageSize
|
|
264
|
-
);
|
|
266
|
+
const result = await this.store.customer.changeCustomerPage(page, pageSize);
|
|
265
267
|
return result;
|
|
266
268
|
} catch (error) {
|
|
267
|
-
console.error(
|
|
269
|
+
console.error('Failed to change customer page:', error);
|
|
268
270
|
throw error;
|
|
269
271
|
}
|
|
270
272
|
}
|
|
273
|
+
|
|
271
274
|
/**
|
|
272
275
|
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
273
276
|
* @returns 客户列表响应
|
|
@@ -278,10 +281,11 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
278
281
|
this.core.effects.emit(`${this.name}:onCustomerListUpdate`, result);
|
|
279
282
|
return result;
|
|
280
283
|
} catch (error) {
|
|
281
|
-
console.error(
|
|
284
|
+
console.error('Failed to load more customers:', error);
|
|
282
285
|
throw error;
|
|
283
286
|
}
|
|
284
287
|
}
|
|
288
|
+
|
|
285
289
|
/**
|
|
286
290
|
* 重置并重新开始滚动加载客户数据
|
|
287
291
|
* @param params 查询参数
|
|
@@ -293,10 +297,11 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
293
297
|
this.core.effects.emit(`${this.name}:onCustomerListReset`, result);
|
|
294
298
|
return result;
|
|
295
299
|
} catch (error) {
|
|
296
|
-
console.error(
|
|
300
|
+
console.error('Failed to reset and load customers:', error);
|
|
297
301
|
throw error;
|
|
298
302
|
}
|
|
299
303
|
}
|
|
304
|
+
|
|
300
305
|
/**
|
|
301
306
|
* 检查是否还有更多客户数据可以加载
|
|
302
307
|
* @returns 是否还有更多数据
|
|
@@ -304,6 +309,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
304
309
|
hasMoreCustomers() {
|
|
305
310
|
return this.store.customer.hasMoreCustomers();
|
|
306
311
|
}
|
|
312
|
+
|
|
307
313
|
/**
|
|
308
314
|
* 获取当前的客户搜索条件
|
|
309
315
|
* @returns 当前搜索条件
|
|
@@ -311,6 +317,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
311
317
|
getCurrentCustomerSearchParams() {
|
|
312
318
|
return this.store.customer.getCurrentSearchParams();
|
|
313
319
|
}
|
|
320
|
+
|
|
314
321
|
/**
|
|
315
322
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
316
323
|
* @returns 客户状态
|
|
@@ -318,104 +325,123 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
318
325
|
getCustomerState() {
|
|
319
326
|
return this.store.customer.getState();
|
|
320
327
|
}
|
|
328
|
+
|
|
321
329
|
/**
|
|
322
330
|
* 全局扫描监听
|
|
323
331
|
* @param callback 回调
|
|
324
332
|
*/
|
|
325
333
|
scanGlobalListener(callback) {
|
|
326
|
-
const localSearch =
|
|
327
|
-
const scanCallback = (0,
|
|
328
|
-
const safeCallback =
|
|
334
|
+
const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
|
|
335
|
+
const scanCallback = (0, _handleScan.handleGlobalScan)(this.request, localSearch);
|
|
336
|
+
const safeCallback = d => {
|
|
329
337
|
try {
|
|
330
338
|
callback(d);
|
|
331
339
|
} catch (error) {
|
|
332
|
-
console.error(
|
|
340
|
+
console.error('scanGlobalListener传入的回调函数异常', error);
|
|
333
341
|
}
|
|
334
342
|
};
|
|
335
|
-
const listener = {
|
|
343
|
+
const listener = {
|
|
344
|
+
key: 'global',
|
|
345
|
+
callback: safeCallback
|
|
346
|
+
};
|
|
336
347
|
const removeListener = this.scan.addListener(listener, scanCallback);
|
|
337
348
|
return removeListener;
|
|
338
349
|
}
|
|
350
|
+
|
|
339
351
|
/**
|
|
340
352
|
* 客户扫描监听
|
|
341
353
|
* @param callback 回调
|
|
342
354
|
*/
|
|
343
355
|
scanCustomerListener(callback) {
|
|
344
|
-
const scanCallback = (0,
|
|
345
|
-
const safeCallback =
|
|
356
|
+
const scanCallback = (0, _handleScan.handleCustomerScan)();
|
|
357
|
+
const safeCallback = d => {
|
|
346
358
|
try {
|
|
347
359
|
callback(d);
|
|
348
360
|
} catch (error) {
|
|
349
|
-
console.error(
|
|
361
|
+
console.error('scanCustomerListener传入的回调函数异常', error);
|
|
350
362
|
}
|
|
351
363
|
};
|
|
352
|
-
const listener = {
|
|
364
|
+
const listener = {
|
|
365
|
+
key: 'customer',
|
|
366
|
+
callback: safeCallback
|
|
367
|
+
};
|
|
353
368
|
const removeListener = this.scan.addListener(listener, scanCallback);
|
|
354
369
|
return removeListener;
|
|
355
370
|
}
|
|
371
|
+
|
|
356
372
|
/**
|
|
357
373
|
* @title 通用扫描监听
|
|
358
374
|
* @description 直接将扫描结果返回给调用方
|
|
359
375
|
* @param callback 回调
|
|
360
376
|
*/
|
|
361
377
|
scanUniversalListener(callback, key) {
|
|
362
|
-
const scanCallback = (0,
|
|
363
|
-
const safeCallback =
|
|
378
|
+
const scanCallback = (0, _handleScan.handleUniversalScan)();
|
|
379
|
+
const safeCallback = d => {
|
|
364
380
|
try {
|
|
365
381
|
callback(d);
|
|
366
382
|
} catch (error) {
|
|
367
|
-
console.error(
|
|
368
|
-
`scanUniversalListener传入的回调函数异常, key: ${key}`,
|
|
369
|
-
error
|
|
370
|
-
);
|
|
383
|
+
console.error(`scanUniversalListener传入的回调函数异常, key: ${key}`, error);
|
|
371
384
|
}
|
|
372
385
|
};
|
|
373
|
-
const listener = {
|
|
386
|
+
const listener = {
|
|
387
|
+
key,
|
|
388
|
+
callback: safeCallback
|
|
389
|
+
};
|
|
374
390
|
const removeListener = this.scan.addListener(listener, scanCallback);
|
|
375
391
|
return removeListener;
|
|
376
392
|
}
|
|
393
|
+
|
|
377
394
|
/**
|
|
378
395
|
* 调用摄像头
|
|
379
396
|
* @param data 用户自定义数据
|
|
380
397
|
*/
|
|
381
398
|
activateCamera(data) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
key: "active_native_scanner",
|
|
399
|
+
this.window?.interaction?.utils?.postMessageToApp?.({
|
|
400
|
+
module: 'global',
|
|
401
|
+
key: 'active_native_scanner',
|
|
386
402
|
data
|
|
387
403
|
});
|
|
388
404
|
}
|
|
405
|
+
|
|
389
406
|
/**
|
|
390
407
|
* 禁用所有扫描监听
|
|
391
408
|
*/
|
|
392
409
|
disableAllScanListeners() {
|
|
393
410
|
this.scan.disableAllListeners();
|
|
394
411
|
}
|
|
412
|
+
|
|
395
413
|
/**
|
|
396
414
|
* 启用所有扫描监听
|
|
397
415
|
*/
|
|
398
416
|
enableAllScanListeners() {
|
|
399
417
|
this.scan.enableAllListeners();
|
|
400
418
|
}
|
|
419
|
+
|
|
401
420
|
/**
|
|
402
421
|
* 清空所有扫描监听对应的任务执行队列
|
|
403
422
|
*/
|
|
404
423
|
clearAllScanListenersTaskQueue() {
|
|
405
424
|
this.scan.clearTaskQueue();
|
|
406
425
|
}
|
|
426
|
+
|
|
407
427
|
/**
|
|
408
428
|
* 设置其他参数
|
|
409
429
|
* @param params 参数
|
|
410
430
|
* @param options 选项
|
|
411
431
|
*/
|
|
412
|
-
async setOtherParams(params, {
|
|
432
|
+
async setOtherParams(params, {
|
|
433
|
+
cover = false
|
|
434
|
+
} = {}) {
|
|
413
435
|
if (cover) {
|
|
414
436
|
this.otherParams = params;
|
|
415
437
|
} else {
|
|
416
|
-
this.otherParams = {
|
|
438
|
+
this.otherParams = {
|
|
439
|
+
...this.otherParams,
|
|
440
|
+
...params
|
|
441
|
+
};
|
|
417
442
|
}
|
|
418
443
|
}
|
|
444
|
+
|
|
419
445
|
/**
|
|
420
446
|
* 获取其他参数
|
|
421
447
|
* @returns 其他参数
|
|
@@ -423,25 +449,24 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
423
449
|
async getOtherParams() {
|
|
424
450
|
return this.otherParams;
|
|
425
451
|
}
|
|
452
|
+
|
|
426
453
|
/**
|
|
427
454
|
* 销毁模块
|
|
428
455
|
*/
|
|
429
456
|
destroy() {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
(_e = this.store.order) == null ? void 0 : _e.destroy();
|
|
457
|
+
this.store.cart?.destroy();
|
|
458
|
+
this.store.products?.destroy();
|
|
459
|
+
this.store.accountList?.destroy();
|
|
460
|
+
this.store.customer?.destroy();
|
|
461
|
+
this.store.order?.destroy();
|
|
436
462
|
this.core.effects.offByModuleDestroy(this.name);
|
|
437
463
|
this.core.unregisterModule(this);
|
|
464
|
+
// 清除所有的监听
|
|
438
465
|
this.scan.removeAllListeners();
|
|
439
|
-
|
|
466
|
+
// 清除scan数据内存缓存
|
|
467
|
+
_scanCache.default.clear();
|
|
440
468
|
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
BookingTicketImpl,
|
|
446
|
-
...require("./types")
|
|
447
|
-
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// 导出相关类型和实现
|
|
472
|
+
exports.BookingTicket = exports.BookingTicketImpl = BookingTicketImpl;
|
|
@@ -1,72 +1,46 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
"use strict";
|
|
18
2
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__export(types_exports, {
|
|
22
|
-
BookingTicketHooks: () => BookingTicketHooks,
|
|
23
|
-
createModule: () => createModule
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
6
|
+
exports.BookingTicketHooks = void 0;
|
|
7
|
+
exports.createModule = createModule;
|
|
8
|
+
var _modules = require("../../modules");
|
|
9
|
+
var _Customer = require("../../modules/Customer");
|
|
28
10
|
function createModule(moduleName, solutionName, name, version) {
|
|
29
11
|
switch (moduleName) {
|
|
30
|
-
case
|
|
31
|
-
return new
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
40
|
-
case "accountList":
|
|
41
|
-
return new import_modules.AccountListModule(
|
|
42
|
-
`${solutionName}_${name || moduleName}`,
|
|
43
|
-
version
|
|
44
|
-
);
|
|
45
|
-
case "customer":
|
|
46
|
-
return new import_Customer.CustomerModule(
|
|
47
|
-
`${solutionName}_${name || moduleName}`,
|
|
48
|
-
version
|
|
49
|
-
);
|
|
50
|
-
case "order":
|
|
51
|
-
return new import_modules.OrderModule(
|
|
52
|
-
`${solutionName}_${name || moduleName}`,
|
|
53
|
-
version
|
|
54
|
-
);
|
|
12
|
+
case 'cart':
|
|
13
|
+
return new _modules.CartModule(`${solutionName}_${name || moduleName}`, version);
|
|
14
|
+
case 'products':
|
|
15
|
+
return new _modules.ProductList(`${solutionName}_${name || moduleName}`, version);
|
|
16
|
+
case 'accountList':
|
|
17
|
+
return new _modules.AccountListModule(`${solutionName}_${name || moduleName}`, version);
|
|
18
|
+
case 'customer':
|
|
19
|
+
return new _Customer.CustomerModule(`${solutionName}_${name || moduleName}`, version);
|
|
20
|
+
case 'order':
|
|
21
|
+
return new _modules.OrderModule(`${solutionName}_${name || moduleName}`, version);
|
|
55
22
|
default:
|
|
56
23
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
57
24
|
}
|
|
58
25
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
26
|
+
let BookingTicketHooks = exports.BookingTicketHooks = /*#__PURE__*/function (BookingTicketHooks) {
|
|
27
|
+
BookingTicketHooks["onInited"] = "bookingTicket:onInited";
|
|
28
|
+
BookingTicketHooks["onDestroy"] = "bookingTicket:onDestroy";
|
|
29
|
+
BookingTicketHooks["onProductsLoaded"] = "bookingTicket:onProductsLoaded";
|
|
30
|
+
BookingTicketHooks["onCustomerSelected"] = "bookingTicket:onCustomerSelected";
|
|
31
|
+
BookingTicketHooks["onCustomerListUpdate"] = "bookingTicket:onCustomerListUpdate";
|
|
32
|
+
BookingTicketHooks["onCustomerListReset"] = "bookingTicket:onCustomerListReset";
|
|
33
|
+
return BookingTicketHooks;
|
|
34
|
+
}({});
|
|
35
|
+
/**
|
|
36
|
+
* 获取客户列表的参数
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* 客户信息
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* 加载商品列表的参数
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* 扫描结果
|
|
46
|
+
*/
|