@pisell/pisellos 3.0.56 → 3.0.57
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/Cart/utils/changePrice.d.ts +2 -2
- package/dist/modules/Cart/utils/changePrice.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/Payment/cash.d.ts +11 -0
- package/dist/modules/Payment/cash.js +78 -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 +273 -9
- package/dist/modules/Payment/index.js +2525 -109
- package/dist/modules/Payment/types.d.ts +382 -30
- package/dist/modules/Payment/types.js +116 -14
- package/dist/modules/Payment/wallet.d.ts +11 -0
- package/dist/modules/Payment/wallet.js +78 -0
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/modules/ProductList/index.d.ts +13 -3
- package/dist/modules/ProductList/index.js +52 -42
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +27 -14
- package/dist/modules/Rules/types.d.ts +1 -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.js +59 -35
- package/dist/solution/BookingByStep/types.d.ts +3 -2
- package/dist/solution/BookingTicket/index.d.ts +172 -0
- package/dist/solution/BookingTicket/index.js +665 -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 +16 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -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/BuyTickets/index.d.ts +2 -2
- package/dist/solution/BuyTickets/index.js +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +181 -0
- package/dist/solution/Checkout/index.js +1596 -0
- package/dist/solution/Checkout/types.d.ts +550 -0
- package/dist/solution/Checkout/types.js +132 -0
- package/dist/solution/Checkout/utils/index.d.ts +73 -0
- package/dist/solution/Checkout/utils/index.js +371 -0
- package/dist/solution/ShopDiscount/index.js +4 -2
- 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/Cart/utils/changePrice.d.ts +2 -2
- package/lib/modules/Cart/utils/changePrice.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/Payment/cash.d.ts +11 -0
- package/lib/modules/Payment/cash.js +51 -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 +273 -9
- package/lib/modules/Payment/index.js +1285 -50
- package/lib/modules/Payment/types.d.ts +382 -30
- package/lib/modules/Payment/types.js +41 -6
- package/lib/modules/Payment/wallet.d.ts +11 -0
- package/lib/modules/Payment/wallet.js +51 -0
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/modules/ProductList/index.d.ts +13 -3
- package/lib/modules/ProductList/index.js +37 -26
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/Rules/index.js +20 -12
- package/lib/modules/Rules/types.d.ts +1 -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.js +40 -29
- package/lib/solution/BookingByStep/types.d.ts +3 -2
- package/lib/solution/BookingTicket/index.d.ts +172 -0
- package/lib/solution/BookingTicket/index.js +399 -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 +16 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -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/BuyTickets/index.d.ts +2 -2
- package/lib/solution/BuyTickets/index.js +1 -1
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +181 -0
- package/lib/solution/Checkout/index.js +864 -0
- package/lib/solution/Checkout/types.d.ts +550 -0
- package/lib/solution/Checkout/types.js +75 -0
- package/lib/solution/Checkout/utils/index.d.ts +73 -0
- package/lib/solution/Checkout/utils/index.js +266 -0
- package/lib/solution/ShopDiscount/index.js +2 -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
|
@@ -24,7 +24,6 @@ __export(ProductList_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(ProductList_exports);
|
|
26
26
|
var import_BaseModule = require("../BaseModule");
|
|
27
|
-
var import_Product = require("../Product");
|
|
28
27
|
var import_types = require("./types");
|
|
29
28
|
var import_lodash_es = require("lodash-es");
|
|
30
29
|
__reExport(ProductList_exports, require("./types"), module.exports);
|
|
@@ -41,43 +40,33 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
41
40
|
this.store = options.store;
|
|
42
41
|
this.otherParams = options.otherParams || {};
|
|
43
42
|
if (Array.isArray((_a = options.initialState) == null ? void 0 : _a.list)) {
|
|
44
|
-
this.store.list = options.initialState.list;
|
|
43
|
+
this.store.list = options.initialState.list.slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
45
44
|
this.core.effects.emit(`${this.name}:changed`, this.store.list);
|
|
46
|
-
this.storeChange();
|
|
47
45
|
} else {
|
|
48
46
|
this.store.list = [];
|
|
49
|
-
this.store.productMap = /* @__PURE__ */ new Map();
|
|
50
47
|
this.store.selectProducts = [];
|
|
51
48
|
}
|
|
52
49
|
this.request = core.getPlugin("request");
|
|
53
50
|
}
|
|
54
51
|
async storeChange(path, value) {
|
|
55
|
-
var _a;
|
|
56
|
-
(_a = this.store.list) == null ? void 0 : _a.forEach((product) => {
|
|
57
|
-
const productModule = this.store.productMap.get(`product-${product.id}`);
|
|
58
|
-
if (!productModule) {
|
|
59
|
-
const newProductModule = new import_Product.Product(
|
|
60
|
-
`product_${product.id.toString()}`
|
|
61
|
-
);
|
|
62
|
-
this.core.registerModule(newProductModule, { initialState: product });
|
|
63
|
-
this.store.productMap.set(product.id.toString(), newProductModule);
|
|
64
|
-
} else {
|
|
65
|
-
productModule.updateData(product);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
52
|
}
|
|
69
53
|
async loadProducts({
|
|
70
54
|
category_ids = [],
|
|
71
55
|
product_ids = [],
|
|
72
56
|
collection = [],
|
|
57
|
+
menu_list_ids = [],
|
|
58
|
+
customer_id: paramsCustomerId,
|
|
59
|
+
with_count = [],
|
|
60
|
+
schedule_datetime,
|
|
73
61
|
schedule_date,
|
|
74
|
-
cacheId
|
|
62
|
+
cacheId,
|
|
63
|
+
with_schedule
|
|
75
64
|
}) {
|
|
76
65
|
var _a, _b;
|
|
77
66
|
let userPlugin = this.core.getPlugin("user");
|
|
78
67
|
let customer_id = void 0;
|
|
79
68
|
try {
|
|
80
|
-
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);
|
|
81
70
|
} catch (error) {
|
|
82
71
|
console.error(error);
|
|
83
72
|
}
|
|
@@ -103,14 +92,19 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
103
92
|
ids: product_ids,
|
|
104
93
|
collection,
|
|
105
94
|
front_end_cache_id: cacheId,
|
|
95
|
+
menu_list_ids,
|
|
96
|
+
with_count,
|
|
106
97
|
// client_schedule_ids: schedule_ids,
|
|
107
98
|
schedule_date,
|
|
99
|
+
with_schedule,
|
|
100
|
+
schedule_datetime,
|
|
108
101
|
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
|
|
109
102
|
},
|
|
110
103
|
{ useCache: true }
|
|
111
104
|
);
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
106
|
+
this.addProduct(sortedList);
|
|
107
|
+
return sortedList;
|
|
114
108
|
}
|
|
115
109
|
async loadProductsPrice({
|
|
116
110
|
ids = [],
|
|
@@ -142,10 +136,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
142
136
|
import_types.ProductListHooks.onGetProduct,
|
|
143
137
|
this.store.list
|
|
144
138
|
);
|
|
145
|
-
const product = this.store.
|
|
146
|
-
|
|
147
|
-
return product;
|
|
148
|
-
return void 0;
|
|
139
|
+
const product = this.store.list.find((product2) => product2.id === id);
|
|
140
|
+
return product ? (0, import_lodash_es.cloneDeep)(product) : void 0;
|
|
149
141
|
}
|
|
150
142
|
async addProduct(products) {
|
|
151
143
|
if (!this.store.list) {
|
|
@@ -159,11 +151,30 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
159
151
|
this.store.list[index] = n;
|
|
160
152
|
}
|
|
161
153
|
});
|
|
162
|
-
this.
|
|
154
|
+
this.store.list.sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
155
|
+
this.core.effects.emit(`${this.name}:changed`, this.store.list);
|
|
163
156
|
}
|
|
164
157
|
async selectProducts(products) {
|
|
165
158
|
this.store.selectProducts = products;
|
|
166
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
|
+
}
|
|
167
178
|
};
|
|
168
179
|
// Annotate the CommonJS export names for ESM import in node:
|
|
169
180
|
0 && (module.exports = {
|
|
@@ -37,6 +37,7 @@ var import_types = require("./types");
|
|
|
37
37
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
38
38
|
var import_utils2 = require("../Cart/utils");
|
|
39
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
40
|
+
var import_lodash_es = require("lodash-es");
|
|
40
41
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
41
42
|
constructor(name, version) {
|
|
42
43
|
super(name, version);
|
|
@@ -188,19 +189,23 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
188
189
|
if (isAvailableProduct && isLimitedProduct) {
|
|
189
190
|
(_c = discountApplicability.get(discount.id)) == null ? void 0 : _c.push(product.id);
|
|
190
191
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
191
|
-
|
|
192
|
+
const discountType = discount.tag || discount.type;
|
|
193
|
+
const productData = {
|
|
192
194
|
amount: product.price,
|
|
193
|
-
type:
|
|
194
|
-
tag:
|
|
195
|
+
type: discountType,
|
|
196
|
+
tag: discountType,
|
|
195
197
|
discount: {
|
|
196
198
|
resource_id: discount.id,
|
|
197
199
|
title: discount.format_title,
|
|
198
200
|
original_amount: product.origin_total,
|
|
199
201
|
pre_value: discount.par_value,
|
|
200
202
|
product_id: originProduct.id
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
if (discountType !== "good_pass") {
|
|
206
|
+
productData.num = product.num || 1;
|
|
207
|
+
}
|
|
208
|
+
applicableProducts.push(productData);
|
|
204
209
|
discountApplicableProducts.set(discount.id, applicableProducts);
|
|
205
210
|
}
|
|
206
211
|
});
|
|
@@ -215,9 +220,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
215
220
|
}
|
|
216
221
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
217
222
|
var _a2;
|
|
218
|
-
if ((Number(product.price)
|
|
223
|
+
if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === "good_pass")
|
|
219
224
|
return false;
|
|
220
|
-
if ((Number(product.total)
|
|
225
|
+
if ((Number(product.total) <= 0 || !product.total) && !((_a2 = product.discount_list) == null ? void 0 : _a2.find((n) => {
|
|
221
226
|
var _a3;
|
|
222
227
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
223
228
|
})) && (discount.tag || discount.type) !== "good_pass")
|
|
@@ -242,7 +247,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
242
247
|
}))) {
|
|
243
248
|
isManualDiscount = false;
|
|
244
249
|
}
|
|
245
|
-
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
250
|
+
if (applicableDiscounts.length === 0 || isManualDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
246
251
|
if (product.isClient) {
|
|
247
252
|
processedProductsMap.set(
|
|
248
253
|
product._id,
|
|
@@ -309,18 +314,21 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
309
314
|
productOriginTotal = product.total;
|
|
310
315
|
}
|
|
311
316
|
const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(productOriginTotal).minus(new import_decimal.default(product.price || 0)).toNumber() : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(productOriginTotal)).toNumber();
|
|
317
|
+
const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
|
|
312
318
|
const discountDetail = {
|
|
313
319
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|
|
314
|
-
type:
|
|
320
|
+
type: discountType,
|
|
315
321
|
discount: {
|
|
316
322
|
resource_id: selectedDiscount2.id,
|
|
317
323
|
title: selectedDiscount2.format_title,
|
|
318
324
|
original_amount: productOriginTotal,
|
|
319
325
|
product_id: originProduct.id,
|
|
320
326
|
percent: selectedDiscount2.par_value
|
|
321
|
-
}
|
|
322
|
-
num: product.num || 1
|
|
327
|
+
}
|
|
323
328
|
};
|
|
329
|
+
if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
|
|
330
|
+
discountDetail.num = product.num || 1;
|
|
331
|
+
}
|
|
324
332
|
appliedProducts.push(discountDetail);
|
|
325
333
|
appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
|
|
326
334
|
if (product.isClient) {
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __reExport(modules_exports, require("./ProductList"), module.exports);
|
|
|
21
21
|
__reExport(modules_exports, require("./Cart"), module.exports);
|
|
22
22
|
__reExport(modules_exports, require("./Account"), module.exports);
|
|
23
23
|
__reExport(modules_exports, require("./AccountList"), module.exports);
|
|
24
|
+
__reExport(modules_exports, require("./Customer"), module.exports);
|
|
24
25
|
__reExport(modules_exports, require("./Date"), module.exports);
|
|
25
26
|
__reExport(modules_exports, require("./Guests"), module.exports);
|
|
26
27
|
__reExport(modules_exports, require("./Order"), module.exports);
|
|
@@ -36,6 +37,7 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
36
37
|
...require("./Cart"),
|
|
37
38
|
...require("./Account"),
|
|
38
39
|
...require("./AccountList"),
|
|
40
|
+
...require("./Customer"),
|
|
39
41
|
...require("./Date"),
|
|
40
42
|
...require("./Guests"),
|
|
41
43
|
...require("./Order"),
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RouterManager } from '../routes';
|
|
2
|
+
import { ApplicationManager } from '../applicationManager';
|
|
3
|
+
import { History, HistoryOptions } from '../history';
|
|
4
|
+
import { Data } from '../data';
|
|
5
|
+
import { Locales, LocalesOptions } from '../locales';
|
|
6
|
+
import { Storage, StorageOptions } from '../storage';
|
|
7
|
+
import { MenuManager } from '../menuManager';
|
|
8
|
+
import LoggerManager, { LoggerOptions } from '../logger';
|
|
9
|
+
import { TasksManager } from '../tasks';
|
|
10
|
+
import IndexDBManager, { DBOptions } from '../indexDB';
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
app: App;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export interface AppOptions {
|
|
17
|
+
logger?: LoggerOptions;
|
|
18
|
+
db?: DBOptions;
|
|
19
|
+
constants?: any;
|
|
20
|
+
history?: HistoryOptions;
|
|
21
|
+
storage?: StorageOptions;
|
|
22
|
+
locales?: LocalesOptions;
|
|
23
|
+
}
|
|
24
|
+
declare class App {
|
|
25
|
+
private static instance;
|
|
26
|
+
private plugins;
|
|
27
|
+
globalData: any;
|
|
28
|
+
router: RouterManager;
|
|
29
|
+
applicationManager: ApplicationManager;
|
|
30
|
+
history: History;
|
|
31
|
+
data: Data;
|
|
32
|
+
hooks: import("../hooks").HooksExport;
|
|
33
|
+
locales: Locales;
|
|
34
|
+
models: {
|
|
35
|
+
getStore: () => import("../models").Store;
|
|
36
|
+
StoreProvider: typeof import("react-redux").Provider;
|
|
37
|
+
setConfig: (models: any[]) => void;
|
|
38
|
+
};
|
|
39
|
+
request: {
|
|
40
|
+
get: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
41
|
+
post: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
42
|
+
put: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
43
|
+
remove: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
44
|
+
custom: (url: import("../request").RequestWrapperProps["url"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
|
|
45
|
+
setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
|
|
46
|
+
getConfig: () => import("../request").RequestConfig;
|
|
47
|
+
};
|
|
48
|
+
storage: Storage;
|
|
49
|
+
menuManager: MenuManager;
|
|
50
|
+
cookie: {
|
|
51
|
+
setCookie: (name: string, value: string, domain?: string) => void;
|
|
52
|
+
getCookie: (name: string) => string | null;
|
|
53
|
+
deleteCookie: (name: string, domain?: string) => void;
|
|
54
|
+
checkCookie: (name: string) => boolean;
|
|
55
|
+
updateCookie: (name: string, value: string, domain?: string) => void;
|
|
56
|
+
};
|
|
57
|
+
website: {
|
|
58
|
+
setTitle: (title: string) => void;
|
|
59
|
+
setIcon: (paramsIcon: string) => void;
|
|
60
|
+
setAppleWebAppTitle: (title: string) => void;
|
|
61
|
+
};
|
|
62
|
+
logger: LoggerManager;
|
|
63
|
+
pubsub: import("../pubsub").PubSub;
|
|
64
|
+
tasksManager: TasksManager;
|
|
65
|
+
dbManager: IndexDBManager | null;
|
|
66
|
+
constants: {
|
|
67
|
+
channel: string;
|
|
68
|
+
[key: string]: string;
|
|
69
|
+
};
|
|
70
|
+
private constructor();
|
|
71
|
+
static getInstance(options?: AppOptions): App;
|
|
72
|
+
setGlobalData(globalData: any): void;
|
|
73
|
+
usePlugin(name: string, plugin: any): void;
|
|
74
|
+
usePlugins(plugins: {
|
|
75
|
+
name: string;
|
|
76
|
+
plugin: any;
|
|
77
|
+
}[]): void;
|
|
78
|
+
getPlugin(name: string): any;
|
|
79
|
+
getGlobalData(): any;
|
|
80
|
+
install(): void;
|
|
81
|
+
unInstall(): void;
|
|
82
|
+
}
|
|
83
|
+
export default App;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import App, { AppOptions } from "./app";
|
|
3
|
+
type AppContextType = {
|
|
4
|
+
globalData: any;
|
|
5
|
+
setGlobalData: React.Dispatch<React.SetStateAction<any>>;
|
|
6
|
+
app: App;
|
|
7
|
+
};
|
|
8
|
+
export declare const AppProvider: React.FC<{
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
options: AppOptions;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useApp: () => AppContextType;
|
|
13
|
+
export declare const getApp: typeof App.getInstance;
|
|
14
|
+
export default App;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import App from "../app";
|
|
2
|
+
import { LoadLibraryByUrlParams } from "../locales/type";
|
|
3
|
+
import { MenuItem } from "../menuManager/index";
|
|
4
|
+
export type ApplicationInterface = {
|
|
5
|
+
page_type: "low_code" | "code";
|
|
6
|
+
page_id: number | string;
|
|
7
|
+
page_code: string;
|
|
8
|
+
page_version?: string;
|
|
9
|
+
page_name: string;
|
|
10
|
+
router: string;
|
|
11
|
+
category: "page" | "component" | "function";
|
|
12
|
+
Component?: any;
|
|
13
|
+
children?: any;
|
|
14
|
+
layout?: string;
|
|
15
|
+
originalUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ApplicationData = {
|
|
18
|
+
app_id: number;
|
|
19
|
+
app_name: string;
|
|
20
|
+
app_type: "system" | "custom";
|
|
21
|
+
interfaces: ApplicationInterface[];
|
|
22
|
+
functions?: any[];
|
|
23
|
+
menu?: {
|
|
24
|
+
[key: string]: MenuItem[];
|
|
25
|
+
};
|
|
26
|
+
locales?: LoadLibraryByUrlParams;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
export declare class Application {
|
|
30
|
+
options: ApplicationData;
|
|
31
|
+
name: ApplicationData["app_name"];
|
|
32
|
+
interfaces: Map<ApplicationInterface["page_name"], ApplicationInterface>;
|
|
33
|
+
components: Map<string, any>;
|
|
34
|
+
functions: Map<string, any>;
|
|
35
|
+
app: App;
|
|
36
|
+
constructor(options: ApplicationData, app: App);
|
|
37
|
+
afterAdd(application: Application): Promise<void>;
|
|
38
|
+
beforeLoad(): Promise<void>;
|
|
39
|
+
load(): Promise<void>;
|
|
40
|
+
initInterfaces(interfaces: ApplicationData["interfaces"]): void;
|
|
41
|
+
initFunctions(functions: ApplicationData["functions"]): void;
|
|
42
|
+
loadInterface(interfaceItem: ApplicationInterface): Promise<ApplicationInterface>;
|
|
43
|
+
setInterface(code: string, interfaceItem: ApplicationInterface): void;
|
|
44
|
+
setComponent(code: string, component: ApplicationInterface): void;
|
|
45
|
+
setFunction(code: string, functionItem: ApplicationInterface): void;
|
|
46
|
+
getInterface(code: string): ApplicationInterface | undefined;
|
|
47
|
+
getComponent(code: string): any;
|
|
48
|
+
getFunction(code: string): any;
|
|
49
|
+
runFunction(code: string, params?: any, ...args: any): any;
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import APP from "../app";
|
|
2
|
+
import { Application, ApplicationData } from "./application";
|
|
3
|
+
export declare class ApplicationManager {
|
|
4
|
+
applicationList: Application[];
|
|
5
|
+
protected app: APP;
|
|
6
|
+
applications: Map<string, Application>;
|
|
7
|
+
constructor(applicationList: Application[] | undefined, app: APP);
|
|
8
|
+
init(applicationList: Application[] | ApplicationData[]): Promise<unknown>;
|
|
9
|
+
add(application: Application): Promise<void>;
|
|
10
|
+
get(appName: Application["name"]): Application | undefined;
|
|
11
|
+
remove(appName: Application["name"]): void;
|
|
12
|
+
load(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function setCookie(name: string, value: string, domain?: string): void;
|
|
2
|
+
declare function getCookie(name: string): string | null;
|
|
3
|
+
declare function deleteCookie(name: string, domain?: string): void;
|
|
4
|
+
declare function checkCookie(name: string): boolean;
|
|
5
|
+
declare function updateCookie(name: string, value: string, domain?: string): void;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
setCookie: typeof setCookie;
|
|
8
|
+
getCookie: typeof getCookie;
|
|
9
|
+
deleteCookie: typeof deleteCookie;
|
|
10
|
+
checkCookie: typeof checkCookie;
|
|
11
|
+
updateCookie: typeof updateCookie;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HistoryConfig } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 默认配置
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultConfig: HistoryConfig;
|
|
9
|
+
/**
|
|
10
|
+
* @title: 设置配置
|
|
11
|
+
* @description:
|
|
12
|
+
* @param {Partial} newConfig
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @Author: zhiwei.Wang
|
|
15
|
+
*/
|
|
16
|
+
export declare const setConfig: (newConfig: Partial<HistoryConfig>) => HistoryConfig;
|
|
17
|
+
/**
|
|
18
|
+
* @title: 获取配置
|
|
19
|
+
* @description:
|
|
20
|
+
* @param {*} HistoryConfig
|
|
21
|
+
* @return {*}
|
|
22
|
+
* @Author: zhiwei.Wang
|
|
23
|
+
*/
|
|
24
|
+
export declare const getConfig: () => HistoryConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { History as HistoryType } from "history";
|
|
2
|
+
import { useHistory, useLocation, useParams } from "react-router-dom";
|
|
3
|
+
import App from "../app";
|
|
4
|
+
export interface HistoryOptions {
|
|
5
|
+
basename?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class History {
|
|
8
|
+
instance: HistoryType<unknown>;
|
|
9
|
+
useHistory: typeof useHistory;
|
|
10
|
+
useLocation: typeof useLocation;
|
|
11
|
+
useParams: typeof useParams;
|
|
12
|
+
app: App;
|
|
13
|
+
constructor(app: App, options?: HistoryOptions);
|
|
14
|
+
push: HistoryType["push"];
|
|
15
|
+
replace: HistoryType["replace"];
|
|
16
|
+
reload: () => void;
|
|
17
|
+
reloadTo: (path: string) => void;
|
|
18
|
+
externalPage: (path: string) => void;
|
|
19
|
+
goLogin: () => any;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import useLowCode from './useLowCode';
|
|
2
|
+
import useDelayedValue from './useDelayedValue';
|
|
3
|
+
import useStore from './useStore';
|
|
4
|
+
import useDispatch from './useDispatch';
|
|
5
|
+
export interface HooksExport {
|
|
6
|
+
useLowCode: typeof useLowCode;
|
|
7
|
+
useDelayedValue: typeof useDelayedValue;
|
|
8
|
+
useStore: typeof useStore;
|
|
9
|
+
useDispatch: typeof useDispatch;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: HooksExport;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface useLowCodeProps {
|
|
2
|
+
onChange: (e: any) => void;
|
|
3
|
+
onReady: (e: any) => void;
|
|
4
|
+
}
|
|
5
|
+
export interface useLowCodeResult {
|
|
6
|
+
lowcodeRef: {
|
|
7
|
+
onReady: (e: any) => void;
|
|
8
|
+
onChange: (e: any) => void;
|
|
9
|
+
};
|
|
10
|
+
setState: (values: any, callback?: any) => any;
|
|
11
|
+
}
|
|
12
|
+
declare const useLowCode: (props: Partial<useLowCodeProps>) => useLowCodeResult;
|
|
13
|
+
export default useLowCode;
|