@pisell/pisellos 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +2 -1
- package/dist/effects/index.d.ts +4 -3
- package/dist/effects/index.js +15 -6
- package/dist/modules/AccountList/index.d.ts +7 -1
- package/dist/modules/AccountList/index.js +81 -14
- package/dist/modules/AccountList/types.d.ts +28 -0
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Customer/constants.js +12 -0
- package/dist/modules/Customer/index.d.ts +122 -0
- package/dist/modules/Customer/index.js +697 -0
- package/dist/modules/Customer/types.d.ts +146 -0
- package/dist/modules/Customer/types.js +41 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +25 -1
- package/dist/modules/Order/index.js +224 -2
- package/dist/modules/Order/types.d.ts +45 -0
- package/dist/modules/Order/types.js +8 -0
- package/dist/modules/Payment/cash.d.ts +19 -0
- package/dist/modules/Payment/cash.js +97 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
- package/dist/modules/Payment/eftpos.d.ts +11 -0
- package/dist/modules/Payment/eftpos.js +80 -0
- package/dist/modules/Payment/index.d.ts +184 -9
- package/dist/modules/Payment/index.js +2012 -108
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/types.d.ts +750 -30
- package/dist/modules/Payment/types.js +236 -12
- package/dist/modules/Payment/utils.d.ts +17 -0
- package/dist/modules/Payment/utils.js +62 -0
- package/dist/modules/Payment/walletpass.d.ts +99 -0
- package/dist/modules/Payment/walletpass.js +701 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +12 -1
- package/dist/modules/ProductList/index.js +27 -3
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +39 -17
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +68 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/app-types/app/app.d.ts +83 -0
- package/dist/plugins/app-types/app/const.d.ts +4 -0
- package/dist/plugins/app-types/app/index.d.ts +14 -0
- package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/dist/plugins/app-types/config.d.ts +3 -0
- package/dist/plugins/app-types/cookie/index.d.ts +13 -0
- package/dist/plugins/app-types/data/index.d.ts +8 -0
- package/dist/plugins/app-types/history/config.d.ts +24 -0
- package/dist/plugins/app-types/history/index.d.ts +20 -0
- package/dist/plugins/app-types/history/type.d.ts +2 -0
- package/dist/plugins/app-types/hooks/index.d.ts +12 -0
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/dist/plugins/app-types/index.d.ts +6 -0
- package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
- package/dist/plugins/app-types/locales/en.d.ts +3 -0
- package/dist/plugins/app-types/locales/index.d.ts +37 -0
- package/dist/plugins/app-types/locales/original.d.ts +3 -0
- package/dist/plugins/app-types/locales/type.d.ts +19 -0
- package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
- package/dist/plugins/app-types/logger/index.d.ts +122 -0
- package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
- package/dist/plugins/app-types/models/global.d.ts +32 -0
- package/dist/plugins/app-types/models/index.d.ts +45 -0
- package/dist/plugins/app-types/models/type.d.ts +2 -0
- package/dist/plugins/app-types/package.json +15 -0
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
- package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
- package/dist/plugins/app-types/request/cache.d.ts +46 -0
- package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/dist/plugins/app-types/request/config.d.ts +3 -0
- package/dist/plugins/app-types/request/constants.d.ts +2 -0
- package/dist/plugins/app-types/request/index.d.ts +24 -0
- package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/dist/plugins/app-types/request/type.d.ts +41 -0
- package/dist/plugins/app-types/request/utils.d.ts +46 -0
- package/dist/plugins/app-types/routes/config.d.ts +7 -0
- package/dist/plugins/app-types/routes/index.d.ts +28 -0
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
- package/dist/plugins/app-types/socket/constants.d.ts +33 -0
- package/dist/plugins/app-types/socket/events.d.ts +31 -0
- package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/dist/plugins/app-types/socket/index.d.ts +61 -0
- package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
- package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/dist/plugins/app-types/socket/socket.d.ts +129 -0
- package/dist/plugins/app-types/socket/types.d.ts +85 -0
- package/dist/plugins/app-types/storage/index.d.ts +17 -0
- package/dist/plugins/app-types/tasks/index.d.ts +77 -0
- package/dist/plugins/app-types/tasks/type.d.ts +62 -0
- package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/dist/plugins/app-types/type.d.ts +2 -0
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/dist/plugins/app-types/variables/config.d.ts +3 -0
- package/dist/plugins/app-types/variables/index.d.ts +6 -0
- package/dist/plugins/app-types/variables/type.d.ts +2 -0
- package/dist/plugins/app-types/website/index.d.ts +6 -0
- package/dist/plugins/app.d.ts +8 -0
- package/dist/plugins/app.js +1 -0
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +1 -1
- package/dist/solution/BookingTicket/index.d.ts +180 -0
- package/dist/solution/BookingTicket/index.js +689 -0
- package/dist/solution/BookingTicket/types.d.ts +68 -0
- package/dist/solution/BookingTicket/types.js +43 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +509 -0
- package/dist/solution/Checkout/index.js +4874 -0
- package/dist/solution/Checkout/types.d.ts +923 -0
- package/dist/solution/Checkout/types.js +148 -0
- package/dist/solution/Checkout/utils/index.d.ts +117 -0
- package/dist/solution/Checkout/utils/index.js +549 -0
- package/dist/solution/ShopDiscount/index.d.ts +4 -9
- package/dist/solution/ShopDiscount/index.js +106 -54
- package/dist/solution/ShopDiscount/types.d.ts +10 -1
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/task.js +171 -0
- package/dist/utils/watch.d.ts +102 -0
- package/dist/utils/watch.js +294 -0
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +4 -3
- package/lib/effects/index.js +4 -1
- package/lib/modules/AccountList/index.d.ts +7 -1
- package/lib/modules/AccountList/index.js +27 -0
- package/lib/modules/AccountList/types.d.ts +28 -0
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Customer/constants.js +39 -0
- package/lib/modules/Customer/index.d.ts +122 -0
- package/lib/modules/Customer/index.js +440 -0
- package/lib/modules/Customer/types.d.ts +146 -0
- package/lib/modules/Customer/types.js +37 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +25 -1
- package/lib/modules/Order/index.js +182 -0
- package/lib/modules/Order/types.d.ts +45 -0
- package/lib/modules/Payment/cash.d.ts +19 -0
- package/lib/modules/Payment/cash.js +64 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
- package/lib/modules/Payment/eftpos.d.ts +11 -0
- package/lib/modules/Payment/eftpos.js +51 -0
- package/lib/modules/Payment/index.d.ts +184 -9
- package/lib/modules/Payment/index.js +1044 -50
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/types.d.ts +750 -30
- package/lib/modules/Payment/types.js +79 -6
- package/lib/modules/Payment/utils.d.ts +17 -0
- package/lib/modules/Payment/utils.js +67 -0
- package/lib/modules/Payment/walletpass.d.ts +99 -0
- package/lib/modules/Payment/walletpass.js +468 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +12 -1
- package/lib/modules/ProductList/index.js +29 -2
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +32 -15
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +51 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/plugins/app-types/app/app.d.ts +83 -0
- package/lib/plugins/app-types/app/const.d.ts +4 -0
- package/lib/plugins/app-types/app/index.d.ts +14 -0
- package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/lib/plugins/app-types/config.d.ts +3 -0
- package/lib/plugins/app-types/cookie/index.d.ts +13 -0
- package/lib/plugins/app-types/data/index.d.ts +8 -0
- package/lib/plugins/app-types/history/config.d.ts +24 -0
- package/lib/plugins/app-types/history/index.d.ts +20 -0
- package/lib/plugins/app-types/history/type.d.ts +2 -0
- package/lib/plugins/app-types/hooks/index.d.ts +12 -0
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/lib/plugins/app-types/index.d.ts +6 -0
- package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
- package/lib/plugins/app-types/locales/en.d.ts +3 -0
- package/lib/plugins/app-types/locales/index.d.ts +37 -0
- package/lib/plugins/app-types/locales/original.d.ts +3 -0
- package/lib/plugins/app-types/locales/type.d.ts +19 -0
- package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
- package/lib/plugins/app-types/logger/index.d.ts +122 -0
- package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
- package/lib/plugins/app-types/models/global.d.ts +32 -0
- package/lib/plugins/app-types/models/index.d.ts +45 -0
- package/lib/plugins/app-types/models/type.d.ts +2 -0
- package/lib/plugins/app-types/package.json +15 -0
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
- package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
- package/lib/plugins/app-types/request/cache.d.ts +46 -0
- package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/lib/plugins/app-types/request/config.d.ts +3 -0
- package/lib/plugins/app-types/request/constants.d.ts +2 -0
- package/lib/plugins/app-types/request/index.d.ts +24 -0
- package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/lib/plugins/app-types/request/type.d.ts +41 -0
- package/lib/plugins/app-types/request/utils.d.ts +46 -0
- package/lib/plugins/app-types/routes/config.d.ts +7 -0
- package/lib/plugins/app-types/routes/index.d.ts +28 -0
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
- package/lib/plugins/app-types/socket/constants.d.ts +33 -0
- package/lib/plugins/app-types/socket/events.d.ts +31 -0
- package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/lib/plugins/app-types/socket/index.d.ts +61 -0
- package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
- package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/lib/plugins/app-types/socket/socket.d.ts +129 -0
- package/lib/plugins/app-types/socket/types.d.ts +85 -0
- package/lib/plugins/app-types/storage/index.d.ts +17 -0
- package/lib/plugins/app-types/tasks/index.d.ts +77 -0
- package/lib/plugins/app-types/tasks/type.d.ts +62 -0
- package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/lib/plugins/app-types/type.d.ts +2 -0
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/lib/plugins/app-types/variables/config.d.ts +3 -0
- package/lib/plugins/app-types/variables/index.d.ts +6 -0
- package/lib/plugins/app-types/variables/type.d.ts +2 -0
- package/lib/plugins/app-types/website/index.d.ts +6 -0
- package/lib/plugins/app.d.ts +8 -0
- package/lib/plugins/app.js +17 -0
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1 -2
- package/lib/solution/BookingTicket/index.d.ts +180 -0
- package/lib/solution/BookingTicket/index.js +420 -0
- package/lib/solution/BookingTicket/types.d.ts +68 -0
- package/lib/solution/BookingTicket/types.js +72 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +509 -0
- package/lib/solution/Checkout/index.js +3002 -0
- package/lib/solution/Checkout/types.d.ts +923 -0
- package/lib/solution/Checkout/types.js +87 -0
- package/lib/solution/Checkout/utils/index.d.ts +117 -0
- package/lib/solution/Checkout/utils/index.js +403 -0
- package/lib/solution/ShopDiscount/index.d.ts +4 -9
- package/lib/solution/ShopDiscount/index.js +41 -13
- package/lib/solution/ShopDiscount/types.d.ts +10 -1
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/task.js +109 -0
- package/lib/utils/watch.d.ts +102 -0
- package/lib/utils/watch.js +217 -0
- package/package.json +4 -2
|
@@ -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,26 +189,30 @@ 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
|
});
|
|
207
212
|
});
|
|
208
213
|
console.log(sortedProductList, "sortedProductListsortedProductList");
|
|
209
214
|
sortedProductList.forEach((originProduct, i) => {
|
|
210
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
215
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
211
216
|
const product = this.hooks.getProduct(originProduct);
|
|
212
217
|
if ((product == null ? void 0 : product.booking_id) && ((_a = product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount) => discount.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount.tag || discount.type)))) {
|
|
213
218
|
processedProductsMap.set(product._id, [originProduct]);
|
|
@@ -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,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
242
247
|
}))) {
|
|
243
248
|
isManualDiscount = false;
|
|
244
249
|
}
|
|
245
|
-
if (
|
|
250
|
+
if ((options == null ? void 0 : options.selectedList) && ((_g = product.discount_list) == null ? void 0 : _g.some((item) => {
|
|
251
|
+
var _a2;
|
|
252
|
+
return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
|
|
253
|
+
var _a3;
|
|
254
|
+
return n.discountId === ((_a3 = item.discount) == null ? void 0 : _a3.resource_id);
|
|
255
|
+
});
|
|
256
|
+
}))) {
|
|
257
|
+
isManualDiscount = false;
|
|
258
|
+
}
|
|
259
|
+
if (applicableDiscounts.length === 0 || isManualDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
246
260
|
if (product.isClient) {
|
|
247
261
|
processedProductsMap.set(
|
|
248
262
|
product._id,
|
|
@@ -302,25 +316,28 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
302
316
|
usedDiscounts.set(selectedDiscount2.id, true);
|
|
303
317
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
304
318
|
let productOriginTotal = product.origin_total || product.total || 0;
|
|
305
|
-
if (((
|
|
319
|
+
if (((_h = product.discount_list) == null ? void 0 : _h.length) && product.origin_total) {
|
|
306
320
|
productOriginTotal = product.origin_total;
|
|
307
321
|
}
|
|
308
|
-
if (Number(((
|
|
322
|
+
if (Number(((_i = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _i.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
|
|
309
323
|
productOriginTotal = product.total;
|
|
310
324
|
}
|
|
311
325
|
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();
|
|
326
|
+
const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
|
|
312
327
|
const discountDetail = {
|
|
313
328
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|
|
314
|
-
type:
|
|
329
|
+
type: discountType,
|
|
315
330
|
discount: {
|
|
316
331
|
resource_id: selectedDiscount2.id,
|
|
317
332
|
title: selectedDiscount2.format_title,
|
|
318
333
|
original_amount: productOriginTotal,
|
|
319
334
|
product_id: originProduct.id,
|
|
320
335
|
percent: selectedDiscount2.par_value
|
|
321
|
-
}
|
|
322
|
-
num: product.num || 1
|
|
336
|
+
}
|
|
323
337
|
};
|
|
338
|
+
if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
|
|
339
|
+
discountDetail.num = product.num || 1;
|
|
340
|
+
}
|
|
324
341
|
appliedProducts.push(discountDetail);
|
|
325
342
|
appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
|
|
326
343
|
if (product.isClient) {
|
|
@@ -25,4 +25,13 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
25
25
|
setOtherProductsIds(ids: number[]): void;
|
|
26
26
|
getOtherProductsIds(): number[];
|
|
27
27
|
storeChange(): void;
|
|
28
|
+
/**
|
|
29
|
+
* 传入一个时间, 判断改时间是否在schedule 内
|
|
30
|
+
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
static isInScheduleByDate({ date, schedule, }: {
|
|
34
|
+
date: string;
|
|
35
|
+
schedule: any;
|
|
36
|
+
}): true | undefined;
|
|
28
37
|
}
|
|
@@ -38,6 +38,7 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
38
38
|
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
|
|
39
39
|
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
|
|
40
40
|
var import_utils = require("../Date/utils");
|
|
41
|
+
var import_utils2 = require("./utils");
|
|
41
42
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
42
43
|
import_dayjs.default.extend(import_isSameOrAfter.default);
|
|
43
44
|
var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
@@ -158,6 +159,56 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* 传入一个时间, 判断改时间是否在schedule 内
|
|
164
|
+
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
165
|
+
* @returns
|
|
166
|
+
*/
|
|
167
|
+
static isInScheduleByDate({
|
|
168
|
+
date,
|
|
169
|
+
schedule
|
|
170
|
+
}) {
|
|
171
|
+
var _a, _b, _c, _d;
|
|
172
|
+
let _schedule = {
|
|
173
|
+
...schedule,
|
|
174
|
+
// 开始时间向前推一天
|
|
175
|
+
start_time: (0, import_dayjs.default)(date).subtract(1, "day").format("YYYY-MM-DD HH:mm:ss"),
|
|
176
|
+
end_time: (0, import_dayjs.default)(date).add(1, "day").format("YYYY-MM-DD HH:mm:ss")
|
|
177
|
+
};
|
|
178
|
+
if (((_b = (_a = _schedule.repeat_rule) == null ? void 0 : _a.end) == null ? void 0 : _b.type) === "never") {
|
|
179
|
+
_schedule = {
|
|
180
|
+
..._schedule,
|
|
181
|
+
repeat_rule: {
|
|
182
|
+
..._schedule.repeat_rule,
|
|
183
|
+
end: {
|
|
184
|
+
type: "date",
|
|
185
|
+
end_date: _schedule.end_time,
|
|
186
|
+
occurrence: null
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (((_d = (_c = _schedule.repeat_rule) == null ? void 0 : _c.end) == null ? void 0 : _d.type) === "date") {
|
|
192
|
+
_schedule = {
|
|
193
|
+
..._schedule,
|
|
194
|
+
repeat_rule: {
|
|
195
|
+
..._schedule.repeat_rule,
|
|
196
|
+
end: {
|
|
197
|
+
..._schedule.repeat_rule.end,
|
|
198
|
+
end_date: _schedule.end_time
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const dateRanges = (0, import_utils2.calcScheduleDateRange)({ ..._schedule });
|
|
204
|
+
for (const range of dateRanges) {
|
|
205
|
+
const startTime = (0, import_dayjs.default)(range.start);
|
|
206
|
+
const endTime = (0, import_dayjs.default)(range.end);
|
|
207
|
+
if ((0, import_dayjs.default)(date).isSameOrAfter(startTime) && (0, import_dayjs.default)(date).isSameOrBefore(endTime)) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
161
212
|
};
|
|
162
213
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
214
|
0 && (module.exports = {
|
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;
|