@pisell/pisellos 3.0.76 → 3.0.77
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 +1 -2
- package/dist/effects/index.d.ts +3 -5
- package/dist/effects/index.js +8 -40
- package/dist/modules/Account/index.js +3 -2
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/BaseModule.d.ts +0 -3
- package/dist/modules/BaseModule.js +0 -15
- package/dist/modules/Cart/index.d.ts +0 -1
- package/dist/modules/Cart/index.js +1 -2
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.d.ts +1 -25
- package/dist/modules/Order/index.js +3 -224
- package/dist/modules/Order/types.d.ts +0 -45
- package/dist/modules/Order/types.js +0 -8
- package/dist/modules/Order/utils.js +1 -1
- package/dist/modules/Payment/index.d.ts +9 -184
- package/dist/modules/Payment/index.js +109 -2084
- package/dist/modules/Payment/types.d.ts +30 -772
- package/dist/modules/Payment/types.js +12 -236
- package/dist/modules/ProductList/index.d.ts +1 -12
- package/dist/modules/ProductList/index.js +15 -37
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.d.ts +1 -2
- package/dist/modules/Rules/index.js +26 -66
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +0 -9
- package/dist/modules/Schedule/index.js +0 -77
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +13 -43
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BuyTickets/index.js +8 -7
- package/dist/solution/ShopDiscount/index.d.ts +10 -10
- package/dist/solution/ShopDiscount/index.js +57 -107
- package/dist/solution/ShopDiscount/types.d.ts +0 -8
- package/dist/solution/ShopDiscount/utils.js +1 -0
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/dist/types/index.d.ts +1 -4
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -5
- package/lib/effects/index.js +1 -17
- package/lib/modules/Account/index.js +3 -2
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/BaseModule.d.ts +0 -3
- package/lib/modules/BaseModule.js +0 -9
- package/lib/modules/Cart/index.d.ts +0 -1
- package/lib/modules/Cart/index.js +2 -5
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.d.ts +1 -25
- package/lib/modules/Order/index.js +1 -186
- package/lib/modules/Order/types.d.ts +0 -45
- package/lib/modules/Order/utils.js +1 -1
- package/lib/modules/Payment/index.d.ts +9 -184
- package/lib/modules/Payment/index.js +51 -1084
- package/lib/modules/Payment/types.d.ts +30 -772
- package/lib/modules/Payment/types.js +6 -79
- package/lib/modules/ProductList/index.d.ts +1 -12
- package/lib/modules/ProductList/index.js +12 -31
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.d.ts +1 -2
- package/lib/modules/Rules/index.js +24 -41
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +0 -9
- package/lib/modules/Schedule/index.js +0 -60
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +6 -18
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BuyTickets/index.js +8 -7
- package/lib/solution/ShopDiscount/index.d.ts +10 -10
- package/lib/solution/ShopDiscount/index.js +21 -47
- package/lib/solution/ShopDiscount/types.d.ts +0 -8
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/lib/types/index.d.ts +1 -4
- package/package.json +1 -3
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -696
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/modules/Payment/cash.d.ts +0 -19
- package/dist/modules/Payment/cash.js +0 -97
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +0 -423
- package/dist/modules/Payment/eftpos.d.ts +0 -11
- package/dist/modules/Payment/eftpos.js +0 -80
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/utils.d.ts +0 -17
- package/dist/modules/Payment/utils.js +0 -62
- package/dist/modules/Payment/walletpass.d.ts +0 -99
- package/dist/modules/Payment/walletpass.js +0 -711
- package/dist/plugins/app-types/app/app.d.ts +0 -83
- package/dist/plugins/app-types/app/const.d.ts +0 -4
- package/dist/plugins/app-types/app/index.d.ts +0 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/dist/plugins/app-types/config.d.ts +0 -3
- package/dist/plugins/app-types/cookie/index.d.ts +0 -13
- package/dist/plugins/app-types/data/index.d.ts +0 -8
- package/dist/plugins/app-types/history/config.d.ts +0 -24
- package/dist/plugins/app-types/history/index.d.ts +0 -20
- package/dist/plugins/app-types/history/type.d.ts +0 -2
- package/dist/plugins/app-types/hooks/index.d.ts +0 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/dist/plugins/app-types/index.d.ts +0 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
- package/dist/plugins/app-types/locales/en.d.ts +0 -3
- package/dist/plugins/app-types/locales/index.d.ts +0 -37
- package/dist/plugins/app-types/locales/original.d.ts +0 -3
- package/dist/plugins/app-types/locales/type.d.ts +0 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
- package/dist/plugins/app-types/logger/index.d.ts +0 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
- package/dist/plugins/app-types/models/global.d.ts +0 -32
- package/dist/plugins/app-types/models/index.d.ts +0 -45
- package/dist/plugins/app-types/models/type.d.ts +0 -2
- package/dist/plugins/app-types/package.json +0 -15
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
- package/dist/plugins/app-types/request/cache.d.ts +0 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/dist/plugins/app-types/request/config.d.ts +0 -3
- package/dist/plugins/app-types/request/constants.d.ts +0 -2
- package/dist/plugins/app-types/request/index.d.ts +0 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/dist/plugins/app-types/request/type.d.ts +0 -41
- package/dist/plugins/app-types/request/utils.d.ts +0 -46
- package/dist/plugins/app-types/routes/config.d.ts +0 -7
- package/dist/plugins/app-types/routes/index.d.ts +0 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
- package/dist/plugins/app-types/socket/constants.d.ts +0 -33
- package/dist/plugins/app-types/socket/events.d.ts +0 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/dist/plugins/app-types/socket/index.d.ts +0 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/dist/plugins/app-types/socket/socket.d.ts +0 -129
- package/dist/plugins/app-types/socket/types.d.ts +0 -85
- package/dist/plugins/app-types/storage/index.d.ts +0 -17
- package/dist/plugins/app-types/tasks/index.d.ts +0 -77
- package/dist/plugins/app-types/tasks/type.d.ts +0 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/dist/plugins/app-types/type.d.ts +0 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/dist/plugins/app-types/variables/config.d.ts +0 -3
- package/dist/plugins/app-types/variables/index.d.ts +0 -6
- package/dist/plugins/app-types/variables/type.d.ts +0 -2
- package/dist/plugins/app-types/website/index.d.ts +0 -6
- package/dist/plugins/app.d.ts +0 -8
- package/dist/plugins/app.js +0 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -184
- package/dist/solution/BookingTicket/index.js +0 -698
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -189
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -85
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -294
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/Checkout/index.d.ts +0 -432
- package/dist/solution/Checkout/index.js +0 -4452
- package/dist/solution/Checkout/types.d.ts +0 -727
- package/dist/solution/Checkout/types.js +0 -104
- package/dist/solution/Checkout/utils/index.d.ts +0 -121
- package/dist/solution/Checkout/utils/index.js +0 -511
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -439
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/modules/Payment/cash.d.ts +0 -19
- package/lib/modules/Payment/cash.js +0 -64
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +0 -342
- package/lib/modules/Payment/eftpos.d.ts +0 -11
- package/lib/modules/Payment/eftpos.js +0 -51
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/utils.d.ts +0 -17
- package/lib/modules/Payment/utils.js +0 -67
- package/lib/modules/Payment/walletpass.d.ts +0 -99
- package/lib/modules/Payment/walletpass.js +0 -484
- package/lib/plugins/app-types/app/app.d.ts +0 -83
- package/lib/plugins/app-types/app/const.d.ts +0 -4
- package/lib/plugins/app-types/app/index.d.ts +0 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/lib/plugins/app-types/config.d.ts +0 -3
- package/lib/plugins/app-types/cookie/index.d.ts +0 -13
- package/lib/plugins/app-types/data/index.d.ts +0 -8
- package/lib/plugins/app-types/history/config.d.ts +0 -24
- package/lib/plugins/app-types/history/index.d.ts +0 -20
- package/lib/plugins/app-types/history/type.d.ts +0 -2
- package/lib/plugins/app-types/hooks/index.d.ts +0 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/lib/plugins/app-types/index.d.ts +0 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
- package/lib/plugins/app-types/locales/en.d.ts +0 -3
- package/lib/plugins/app-types/locales/index.d.ts +0 -37
- package/lib/plugins/app-types/locales/original.d.ts +0 -3
- package/lib/plugins/app-types/locales/type.d.ts +0 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
- package/lib/plugins/app-types/logger/index.d.ts +0 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
- package/lib/plugins/app-types/models/global.d.ts +0 -32
- package/lib/plugins/app-types/models/index.d.ts +0 -45
- package/lib/plugins/app-types/models/type.d.ts +0 -2
- package/lib/plugins/app-types/package.json +0 -15
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
- package/lib/plugins/app-types/request/cache.d.ts +0 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/lib/plugins/app-types/request/config.d.ts +0 -3
- package/lib/plugins/app-types/request/constants.d.ts +0 -2
- package/lib/plugins/app-types/request/index.d.ts +0 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/lib/plugins/app-types/request/type.d.ts +0 -41
- package/lib/plugins/app-types/request/utils.d.ts +0 -46
- package/lib/plugins/app-types/routes/config.d.ts +0 -7
- package/lib/plugins/app-types/routes/index.d.ts +0 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
- package/lib/plugins/app-types/socket/constants.d.ts +0 -33
- package/lib/plugins/app-types/socket/events.d.ts +0 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/lib/plugins/app-types/socket/index.d.ts +0 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/lib/plugins/app-types/socket/socket.d.ts +0 -129
- package/lib/plugins/app-types/socket/types.d.ts +0 -85
- package/lib/plugins/app-types/storage/index.d.ts +0 -17
- package/lib/plugins/app-types/tasks/index.d.ts +0 -77
- package/lib/plugins/app-types/tasks/type.d.ts +0 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/lib/plugins/app-types/type.d.ts +0 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/lib/plugins/app-types/variables/config.d.ts +0 -3
- package/lib/plugins/app-types/variables/index.d.ts +0 -6
- package/lib/plugins/app-types/variables/type.d.ts +0 -2
- package/lib/plugins/app-types/website/index.d.ts +0 -6
- package/lib/plugins/app.d.ts +0 -8
- package/lib/plugins/app.js +0 -17
- package/lib/solution/BookingTicket/index.d.ts +0 -184
- package/lib/solution/BookingTicket/index.js +0 -426
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -132
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -85
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -216
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/index.d.ts +0 -432
- package/lib/solution/Checkout/index.js +0 -2776
- package/lib/solution/Checkout/types.d.ts +0 -727
- package/lib/solution/Checkout/types.js +0 -63
- package/lib/solution/Checkout/utils/index.d.ts +0 -121
- package/lib/solution/Checkout/utils/index.js +0 -362
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -24,6 +24,7 @@ __export(BuyTickets_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(BuyTickets_exports);
|
|
26
26
|
var import_modules = require("../../modules/");
|
|
27
|
+
var import_types = require("./types");
|
|
27
28
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
28
29
|
__reExport(BuyTickets_exports, require("./types"), module.exports);
|
|
29
30
|
var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
@@ -48,7 +49,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
48
49
|
if (this.otherParams.prodctIds) {
|
|
49
50
|
await this.loadProductsByIds(this.otherParams.prodctIds);
|
|
50
51
|
}
|
|
51
|
-
await this.core.effects.emit(
|
|
52
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onInited, {});
|
|
52
53
|
}
|
|
53
54
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
|
|
54
55
|
async loadProductsByIds(ids) {
|
|
@@ -68,13 +69,13 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
68
69
|
}
|
|
69
70
|
});
|
|
70
71
|
this.store.mainProducts = mainProducts;
|
|
71
|
-
await this.core.effects.emit(
|
|
72
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onMainProductsLoaded, {});
|
|
72
73
|
}
|
|
73
74
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是其他商品
|
|
74
75
|
async loadProductsByCategory(categoryId) {
|
|
75
76
|
}
|
|
76
77
|
async destroy() {
|
|
77
|
-
await this.core.effects.emit(
|
|
78
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onDestroy, {});
|
|
78
79
|
console.log("[BuyTickets] 已销毁");
|
|
79
80
|
}
|
|
80
81
|
// 获取当前绑定的所有商品
|
|
@@ -82,7 +83,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
82
83
|
var _a;
|
|
83
84
|
const mainData = await this.store.mainProducts.getProducts() || [];
|
|
84
85
|
const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
|
|
85
|
-
await this.core.effects.emit(
|
|
86
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [
|
|
86
87
|
...mainData,
|
|
87
88
|
...otherData
|
|
88
89
|
]);
|
|
@@ -101,7 +102,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
101
102
|
}
|
|
102
103
|
// 商品列表页提交
|
|
103
104
|
async listSubmit(data) {
|
|
104
|
-
const res = await this.core.effects.emit(
|
|
105
|
+
const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, {
|
|
105
106
|
...data,
|
|
106
107
|
products: this.getProducts()
|
|
107
108
|
});
|
|
@@ -115,14 +116,14 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
115
116
|
}
|
|
116
117
|
// 购物车提交
|
|
117
118
|
async cartSubmit(data) {
|
|
118
|
-
await this.core.effects.emit(
|
|
119
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, {
|
|
119
120
|
...data,
|
|
120
121
|
products: this.getProducts()
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
// 结算提交
|
|
124
125
|
async checkoutSubmit(data) {
|
|
125
|
-
await this.core.effects.emit(
|
|
126
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, {
|
|
126
127
|
...data,
|
|
127
128
|
products: this.getProducts()
|
|
128
129
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { Customer
|
|
3
|
+
import { Customer } from './types';
|
|
4
4
|
import { Discount } from '../../modules/Discount/types';
|
|
5
5
|
export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
6
6
|
protected defaultName: string;
|
|
@@ -28,11 +28,17 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
28
28
|
type?: 'form' | 'customer';
|
|
29
29
|
[key: string]: any;
|
|
30
30
|
}): void;
|
|
31
|
-
calcDiscount(productList: Record<string, any>[], options?:
|
|
31
|
+
calcDiscount(productList: Record<string, any>[], options?: {
|
|
32
|
+
discountId: number;
|
|
33
|
+
isSelected: boolean;
|
|
34
|
+
}): {
|
|
32
35
|
productList: Record<string, any>[];
|
|
33
36
|
discountList: Discount[];
|
|
34
37
|
};
|
|
35
|
-
setDiscountSelected(
|
|
38
|
+
setDiscountSelected({ discountId, isSelected, }: {
|
|
39
|
+
discountId: number;
|
|
40
|
+
isSelected: boolean;
|
|
41
|
+
}): {
|
|
36
42
|
productList: Record<string, any>[];
|
|
37
43
|
discountList: Discount[];
|
|
38
44
|
};
|
|
@@ -50,12 +56,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
50
56
|
private setDiscountList;
|
|
51
57
|
private getDiscountList;
|
|
52
58
|
private getCustomerWallet;
|
|
53
|
-
private
|
|
54
|
-
loadPrepareConfig(params: {
|
|
55
|
-
customerId: number;
|
|
56
|
-
action?: 'create' | 'update';
|
|
57
|
-
with_good_pass?: 0 | 1;
|
|
58
|
-
with_discount_card?: 0 | 1;
|
|
59
|
-
}): Promise<void>;
|
|
59
|
+
private loadPrepareConfig;
|
|
60
60
|
}
|
|
61
61
|
export default ShopDiscountImpl;
|
|
@@ -34,11 +34,11 @@ __export(ShopDiscount_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(ShopDiscount_exports);
|
|
36
36
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
37
|
+
var import_types = require("./types");
|
|
37
38
|
var import_Discount = require("../../modules/Discount");
|
|
38
39
|
var import_Rules = require("../../modules/Rules");
|
|
39
40
|
var import_utils = require("./utils");
|
|
40
41
|
var import_decimal = __toESM(require("decimal.js"));
|
|
41
|
-
var import_lodash_es = require("lodash-es");
|
|
42
42
|
var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
43
43
|
constructor(name, version) {
|
|
44
44
|
super(name, version);
|
|
@@ -77,7 +77,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
77
77
|
(_a = this.store.discount) == null ? void 0 : _a.destroy();
|
|
78
78
|
(_b = this.store.rules) == null ? void 0 : _b.destroy();
|
|
79
79
|
this.core.effects.offByModuleDestroy(this.name);
|
|
80
|
-
await this.core.effects.emit(
|
|
80
|
+
await this.core.effects.emit(import_types.ShopDiscountHooks.onDestroy, {});
|
|
81
81
|
console.log("[ShopDiscount] 已销毁");
|
|
82
82
|
}
|
|
83
83
|
async clear() {
|
|
@@ -127,8 +127,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
127
127
|
this.store.rules = rules;
|
|
128
128
|
}
|
|
129
129
|
registerEventListeners() {
|
|
130
|
-
this.core.effects.
|
|
131
|
-
|
|
130
|
+
this.core.effects.on(
|
|
131
|
+
import_types.ShopDiscountHooks.onCustomerChange,
|
|
132
132
|
(customer) => {
|
|
133
133
|
var _a;
|
|
134
134
|
if (((_a = this.options.otherParams) == null ? void 0 : _a.cacheId) && this.getDiscountList().length) {
|
|
@@ -188,7 +188,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
188
188
|
if (((_a = this.store.customer) == null ? void 0 : _a.id) !== customer.id) {
|
|
189
189
|
this.store.customer = customer;
|
|
190
190
|
await this.core.effects.emit(
|
|
191
|
-
|
|
191
|
+
import_types.ShopDiscountHooks.onCustomerChange,
|
|
192
192
|
customer
|
|
193
193
|
);
|
|
194
194
|
}
|
|
@@ -226,34 +226,27 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
// 设置优惠券使用状态
|
|
229
|
-
setDiscountSelected(
|
|
229
|
+
setDiscountSelected({
|
|
230
|
+
discountId,
|
|
231
|
+
isSelected
|
|
232
|
+
}) {
|
|
230
233
|
const discountList = this.getDiscountList();
|
|
231
|
-
const selectionOperations = [];
|
|
232
|
-
selectionOperations.push({
|
|
233
|
-
discountId: params.discountId,
|
|
234
|
-
isSelected: params.isSelected
|
|
235
|
-
});
|
|
236
|
-
if (params.selectedList && params.selectedList.length > 0) {
|
|
237
|
-
selectionOperations.push(...params.selectedList);
|
|
238
|
-
}
|
|
239
|
-
const selectionMap = /* @__PURE__ */ new Map();
|
|
240
|
-
selectionOperations.forEach((operation) => {
|
|
241
|
-
selectionMap.set(operation.discountId, operation.isSelected);
|
|
242
|
-
});
|
|
243
234
|
const newDiscountList = discountList.map((discount) => {
|
|
244
|
-
if (
|
|
245
|
-
const targetIsSelected = selectionMap.get(discount.id);
|
|
235
|
+
if (discount.id === discountId) {
|
|
246
236
|
return {
|
|
247
237
|
...discount,
|
|
248
|
-
isSelected
|
|
238
|
+
isSelected,
|
|
249
239
|
// 手动设置不使用
|
|
250
|
-
isManualSelect: !
|
|
240
|
+
isManualSelect: !isSelected
|
|
251
241
|
};
|
|
252
242
|
}
|
|
253
243
|
return { ...discount, isManualSelect: !(discount == null ? void 0 : discount.isSelected) };
|
|
254
244
|
});
|
|
255
245
|
this.setDiscountList(newDiscountList);
|
|
256
|
-
return this.calcDiscount(this.store.productList || [],
|
|
246
|
+
return this.calcDiscount(this.store.productList || [], {
|
|
247
|
+
discountId,
|
|
248
|
+
isSelected
|
|
249
|
+
});
|
|
257
250
|
}
|
|
258
251
|
setProductList(productList) {
|
|
259
252
|
this.store.productList = productList;
|
|
@@ -312,7 +305,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
312
305
|
};
|
|
313
306
|
if (isAvailable) {
|
|
314
307
|
this.setDiscountList(newDiscountList || []);
|
|
315
|
-
this.store.originalDiscountList = newDiscountList || [];
|
|
316
308
|
this.setProductList(newProductList || []);
|
|
317
309
|
if (this.isWalkIn() && resultDiscountList.length && ((_c = this.options.otherParams) == null ? void 0 : _c.platform) === "shop") {
|
|
318
310
|
await this.getCustomerWallet(
|
|
@@ -355,7 +347,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
355
347
|
// 触发优惠列表变更事件
|
|
356
348
|
async emitDiscountListChange(discountList) {
|
|
357
349
|
await this.core.effects.emit(
|
|
358
|
-
|
|
350
|
+
import_types.ShopDiscountHooks.onDiscountListChange,
|
|
359
351
|
discountList
|
|
360
352
|
);
|
|
361
353
|
}
|
|
@@ -387,7 +379,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
387
379
|
}
|
|
388
380
|
editModeDiscountList.push({
|
|
389
381
|
...discount,
|
|
390
|
-
name: discount.name || discount.discount.title.auto,
|
|
391
382
|
isEditMode: true,
|
|
392
383
|
limited_relation_product_data: {},
|
|
393
384
|
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.product_discount_difference) || 0).toNumber(),
|
|
@@ -413,7 +404,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
413
404
|
if (!targetProduct)
|
|
414
405
|
return false;
|
|
415
406
|
const product = (_a2 = this.hooks) == null ? void 0 : _a2.getProduct(targetProduct);
|
|
416
|
-
return Number(product == null ? void 0 : product.total)
|
|
407
|
+
return Number(product == null ? void 0 : product.total) === 0 && (Number(product == null ? void 0 : product.origin_total) === 0 || !(product == null ? void 0 : product.origin_total));
|
|
417
408
|
};
|
|
418
409
|
const allUsedProductIds = newDiscountList.filter((item) => !(item == null ? void 0 : item.isEditMode)).map((n) => {
|
|
419
410
|
var _a2;
|
|
@@ -455,7 +446,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
455
446
|
const { ...customer } = result.data;
|
|
456
447
|
this.setCustomer(customer);
|
|
457
448
|
await this.core.effects.emit(
|
|
458
|
-
|
|
449
|
+
import_types.ShopDiscountHooks.onScanCustomerChange,
|
|
459
450
|
customer
|
|
460
451
|
);
|
|
461
452
|
}
|
|
@@ -463,23 +454,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
463
454
|
console.error("[ShopDiscount] 获取客户钱包信息出错:", error);
|
|
464
455
|
}
|
|
465
456
|
}
|
|
466
|
-
async bestDiscount(cb) {
|
|
467
|
-
var _a;
|
|
468
|
-
const newDiscountList = this.store.originalDiscountList;
|
|
469
|
-
this.setDiscountList(newDiscountList);
|
|
470
|
-
if ((_a = this.store.productList) == null ? void 0 : _a.length) {
|
|
471
|
-
const result = this.calcDiscount(this.store.productList);
|
|
472
|
-
cb == null ? void 0 : cb(result);
|
|
473
|
-
await this.core.effects.emit(
|
|
474
|
-
`${this.name}:onLoadPrepareCalcResult`,
|
|
475
|
-
result
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
await this.core.effects.emit(
|
|
479
|
-
`${this.name}:onLoadDiscountList`,
|
|
480
|
-
newDiscountList
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
457
|
// 加载准备配置
|
|
484
458
|
async loadPrepareConfig(params) {
|
|
485
459
|
var _a, _b, _c, _d, _e;
|
|
@@ -506,12 +480,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
506
480
|
if ((_e = this.store.productList) == null ? void 0 : _e.length) {
|
|
507
481
|
const result = this.calcDiscount(this.store.productList);
|
|
508
482
|
await this.core.effects.emit(
|
|
509
|
-
|
|
483
|
+
import_types.ShopDiscountHooks.onLoadPrepareCalcResult,
|
|
510
484
|
result
|
|
511
485
|
);
|
|
512
486
|
}
|
|
513
487
|
await this.core.effects.emit(
|
|
514
|
-
|
|
488
|
+
import_types.ShopDiscountHooks.onLoadDiscountList,
|
|
515
489
|
filteredDiscountList
|
|
516
490
|
);
|
|
517
491
|
} catch (error) {
|
package/lib/solution/index.d.ts
CHANGED
package/lib/solution/index.js
CHANGED
|
@@ -18,16 +18,12 @@ var solution_exports = {};
|
|
|
18
18
|
module.exports = __toCommonJS(solution_exports);
|
|
19
19
|
__reExport(solution_exports, require("./BuyTickets"), module.exports);
|
|
20
20
|
__reExport(solution_exports, require("./BookingByStep"), module.exports);
|
|
21
|
-
__reExport(solution_exports, require("./BookingTicket"), module.exports);
|
|
22
21
|
__reExport(solution_exports, require("./ShopDiscount"), module.exports);
|
|
23
22
|
__reExport(solution_exports, require("./RegisterAndLogin"), module.exports);
|
|
24
|
-
__reExport(solution_exports, require("./Checkout"), module.exports);
|
|
25
23
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
24
|
0 && (module.exports = {
|
|
27
25
|
...require("./BuyTickets"),
|
|
28
26
|
...require("./BookingByStep"),
|
|
29
|
-
...require("./BookingTicket"),
|
|
30
27
|
...require("./ShopDiscount"),
|
|
31
|
-
...require("./RegisterAndLogin")
|
|
32
|
-
...require("./Checkout")
|
|
28
|
+
...require("./RegisterAndLogin")
|
|
33
29
|
});
|
package/lib/types/index.d.ts
CHANGED
|
@@ -38,10 +38,7 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
on: (event: string, callback: (payload: any) => void) =>
|
|
42
|
-
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
-
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
44
|
-
off: (event: string, callback: (payload: any) => void) => void;
|
|
41
|
+
on: (event: string, callback: (payload: any) => void) => void;
|
|
45
42
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
46
43
|
status: boolean;
|
|
47
44
|
data: any;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@pisell/pisellos",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.77",
|
|
5
5
|
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "father build",
|
|
14
14
|
"dev": "father dev --watch",
|
|
15
|
-
"push": "yalc push --replace",
|
|
16
15
|
"test": "vitest",
|
|
17
16
|
"lint": "eslint src --ext .ts",
|
|
18
17
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
@@ -55,7 +54,6 @@
|
|
|
55
54
|
"@typescript-eslint/parser": "^5.57.1",
|
|
56
55
|
"axios": "1.7.2",
|
|
57
56
|
"eslint": "^8.37.0",
|
|
58
|
-
"fake-indexeddb": "^6.0.1",
|
|
59
57
|
"father": "^4.1.0",
|
|
60
58
|
"prettier": "^3.5.3",
|
|
61
59
|
"ts-node": "^10.9.1",
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
-
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { CustomerState, ShopCustomer, ShopGetCustomerListParams, CustomerModuleAPI, IPaginationInfo, ICustomerListResponse } from './types';
|
|
4
|
-
export declare class CustomerModule extends BaseModule implements Module, CustomerModuleAPI {
|
|
5
|
-
protected defaultName: string;
|
|
6
|
-
protected defaultVersion: string;
|
|
7
|
-
private store;
|
|
8
|
-
private request;
|
|
9
|
-
private cacheId;
|
|
10
|
-
private openCache;
|
|
11
|
-
private fatherModule;
|
|
12
|
-
constructor(name?: string, version?: string);
|
|
13
|
-
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* 获取客户列表数据(内部方法)
|
|
16
|
-
* @param params 查询参数
|
|
17
|
-
* @returns API响应数据
|
|
18
|
-
*/
|
|
19
|
-
private fetchCustomerListData;
|
|
20
|
-
/**
|
|
21
|
-
* 处理客户列表操作的错误(内部方法)
|
|
22
|
-
* @param error 错误对象
|
|
23
|
-
* @param operation 操作名称
|
|
24
|
-
*/
|
|
25
|
-
private handleCustomerListError;
|
|
26
|
-
/**
|
|
27
|
-
* 获取客户列表
|
|
28
|
-
* @param params 查询参数
|
|
29
|
-
* @returns 客户列表响应
|
|
30
|
-
*/
|
|
31
|
-
getCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
32
|
-
/**
|
|
33
|
-
* 设置客户列表
|
|
34
|
-
* @param customers 客户列表
|
|
35
|
-
* @param total 总数
|
|
36
|
-
*/
|
|
37
|
-
setCustomerList(customers: ShopCustomer[], total?: number): void;
|
|
38
|
-
/**
|
|
39
|
-
* 设置当前选择的客户
|
|
40
|
-
* @param customer 选择的客户
|
|
41
|
-
*/
|
|
42
|
-
setSelectedCustomer(customer: ShopCustomer | null): void;
|
|
43
|
-
/**
|
|
44
|
-
* 获取当前选择的客户
|
|
45
|
-
* @returns 当前选择的客户
|
|
46
|
-
*/
|
|
47
|
-
getSelectedCustomer(): ShopCustomer | null;
|
|
48
|
-
/**
|
|
49
|
-
* 获取客户列表
|
|
50
|
-
* @returns 客户列表
|
|
51
|
-
*/
|
|
52
|
-
getCustomers(): ShopCustomer[];
|
|
53
|
-
/**
|
|
54
|
-
* 根据ID查找客户
|
|
55
|
-
* @param id 客户ID
|
|
56
|
-
* @returns 客户信息
|
|
57
|
-
*/
|
|
58
|
-
getCustomerById(id: string | number): ShopCustomer | null;
|
|
59
|
-
/**
|
|
60
|
-
* 清空客户列表
|
|
61
|
-
*/
|
|
62
|
-
clearCustomers(): void;
|
|
63
|
-
/**
|
|
64
|
-
* 添加客户到列表第一位
|
|
65
|
-
* @param customer 要添加的客户信息
|
|
66
|
-
*/
|
|
67
|
-
addCustomerToFirst(customer: ShopCustomer): void;
|
|
68
|
-
/**
|
|
69
|
-
* 获取当前状态
|
|
70
|
-
* @returns 当前状态
|
|
71
|
-
*/
|
|
72
|
-
getState(): CustomerState;
|
|
73
|
-
/**
|
|
74
|
-
* 获取分页信息
|
|
75
|
-
* @returns 分页信息
|
|
76
|
-
*/
|
|
77
|
-
getPaginationInfo(): IPaginationInfo;
|
|
78
|
-
/**
|
|
79
|
-
* 触发分页变化事件
|
|
80
|
-
* @param pagination 分页信息
|
|
81
|
-
*/
|
|
82
|
-
triggerPaginationChange(pagination: IPaginationInfo): void;
|
|
83
|
-
/**
|
|
84
|
-
* 设置分页信息
|
|
85
|
-
* @param page 页码
|
|
86
|
-
* @param pageSize 每页数量
|
|
87
|
-
*/
|
|
88
|
-
setPaginationInfo(page: number, pageSize: number): void;
|
|
89
|
-
/**
|
|
90
|
-
* 便捷方法:切换分页并自动获取数据
|
|
91
|
-
* @param page 页码
|
|
92
|
-
* @param pageSize 每页数量(可选,不传则使用当前pageSize)
|
|
93
|
-
* @returns 客户列表响应
|
|
94
|
-
*/
|
|
95
|
-
changeCustomerPage(page: number, pageSize?: number): Promise<ICustomerListResponse>;
|
|
96
|
-
/**
|
|
97
|
-
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
98
|
-
* @returns 客户列表响应
|
|
99
|
-
*/
|
|
100
|
-
loadMoreCustomers(): Promise<ICustomerListResponse>;
|
|
101
|
-
/**
|
|
102
|
-
* 重置并重新开始滚动加载
|
|
103
|
-
* @param params 查询参数
|
|
104
|
-
* @returns 客户列表响应
|
|
105
|
-
*/
|
|
106
|
-
resetAndLoadCustomers(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
107
|
-
/**
|
|
108
|
-
* 检查是否还有更多数据可以加载
|
|
109
|
-
* @returns 是否还有更多数据
|
|
110
|
-
*/
|
|
111
|
-
hasMoreCustomers(): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* 获取当前的搜索条件
|
|
114
|
-
* @returns 当前搜索条件
|
|
115
|
-
*/
|
|
116
|
-
getCurrentSearchParams(): Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
117
|
-
/**
|
|
118
|
-
* 缓存状态变化
|
|
119
|
-
*/
|
|
120
|
-
private storeChange;
|
|
121
|
-
}
|
|
122
|
-
export * from './types';
|