@pisell/pisellos 2.2.147 → 2.2.149
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +2 -0
- package/dist/model/strategy/adapter/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +22 -1
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +16 -8
- package/dist/modules/Date/types.d.ts +3 -1
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +171 -1
- package/dist/modules/Order/index.js +2052 -112
- package/dist/modules/Order/types.d.ts +441 -20
- package/dist/modules/Order/types.js +23 -0
- package/dist/modules/Order/utils.d.ts +120 -0
- package/dist/modules/Order/utils.js +653 -2
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +8 -1
- package/dist/modules/Quotation/index.js +40 -10
- package/dist/modules/Quotation/types.d.ts +5 -0
- package/dist/modules/Rules/index.d.ts +3 -1
- package/dist/modules/Rules/index.js +136 -50
- package/dist/modules/Rules/types.d.ts +6 -0
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/SalesSummary/index.d.ts +70 -0
- package/dist/modules/SalesSummary/index.js +175 -0
- package/dist/modules/SalesSummary/types.d.ts +64 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +34 -0
- package/dist/modules/SalesSummary/utils.js +488 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +203 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +52 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +7 -7
- package/dist/modules/Schedule/index.d.ts +4 -13
- package/dist/modules/Schedule/index.js +6 -23
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/index.d.ts +3 -0
- package/dist/modules/Summary/index.js +134 -15
- package/dist/modules/Summary/types.d.ts +7 -0
- package/dist/modules/Summary/utils.d.ts +104 -1
- package/dist/modules/Summary/utils.js +1116 -13
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/server/index.d.ts +41 -4
- package/dist/server/index.js +900 -405
- package/dist/server/modules/order/index.d.ts +10 -2
- package/dist/server/modules/order/index.js +251 -196
- package/dist/server/modules/products/index.d.ts +26 -0
- package/dist/server/modules/products/index.js +618 -338
- package/dist/server/modules/products/types.d.ts +5 -1
- package/dist/solution/BaseSales/index.d.ts +175 -0
- package/dist/solution/BaseSales/index.js +1293 -0
- package/dist/solution/BaseSales/types.d.ts +305 -0
- package/dist/solution/BaseSales/types.js +38 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +159 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +222 -0
- package/dist/solution/BookingByStep/index.d.ts +14 -0
- package/dist/solution/BookingByStep/index.js +699 -212
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/resources.js +6 -1
- package/dist/solution/BookingTicket/index.d.ts +113 -15
- package/dist/solution/BookingTicket/index.js +534 -196
- package/dist/solution/BookingTicket/types.d.ts +69 -6
- package/dist/solution/BookingTicket/types.js +40 -9
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +66 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/dist/solution/BookingTicket/utils/cartView.js +84 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +1 -0
- package/dist/solution/ScanOrder/index.d.ts +146 -0
- package/dist/solution/ScanOrder/index.js +3029 -0
- package/dist/solution/ScanOrder/types.d.ts +305 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +768 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +9 -5
- package/dist/solution/ShopDiscount/types.d.ts +4 -0
- package/dist/solution/VenueBooking/index.d.ts +197 -0
- package/dist/solution/VenueBooking/index.js +3411 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +153 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +130 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +224 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +3 -0
- package/dist/solution/index.js +4 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/strategy/adapter/index.d.ts +2 -0
- package/lib/model/strategy/adapter/index.js +6 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +60 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +17 -1
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +7 -1
- package/lib/modules/Date/types.d.ts +3 -1
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +171 -1
- package/lib/modules/Order/index.js +1396 -5
- package/lib/modules/Order/types.d.ts +441 -20
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils.d.ts +120 -0
- package/lib/modules/Order/utils.js +562 -2
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +8 -1
- package/lib/modules/Quotation/index.js +33 -4
- package/lib/modules/Quotation/types.d.ts +5 -0
- package/lib/modules/Rules/index.d.ts +3 -1
- package/lib/modules/Rules/index.js +46 -6
- package/lib/modules/Rules/types.d.ts +6 -0
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/SalesSummary/index.d.ts +70 -0
- package/lib/modules/SalesSummary/index.js +106 -0
- package/lib/modules/SalesSummary/types.d.ts +64 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +34 -0
- package/lib/modules/SalesSummary/utils.js +430 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +148 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +52 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +5 -5
- package/lib/modules/Schedule/index.d.ts +4 -13
- package/lib/modules/Schedule/index.js +4 -15
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/index.d.ts +3 -0
- package/lib/modules/Summary/index.js +61 -2
- package/lib/modules/Summary/types.d.ts +7 -0
- package/lib/modules/Summary/utils.d.ts +104 -1
- package/lib/modules/Summary/utils.js +659 -8
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/server/index.d.ts +41 -4
- package/lib/server/index.js +272 -10
- package/lib/server/modules/order/index.d.ts +10 -2
- package/lib/server/modules/order/index.js +31 -4
- package/lib/server/modules/products/index.d.ts +26 -0
- package/lib/server/modules/products/index.js +174 -22
- package/lib/server/modules/products/types.d.ts +5 -1
- package/lib/solution/BaseSales/index.d.ts +175 -0
- package/lib/solution/BaseSales/index.js +655 -0
- package/lib/solution/BaseSales/types.d.ts +305 -0
- package/lib/solution/BaseSales/types.js +40 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +200 -0
- package/lib/solution/BookingByStep/index.d.ts +14 -0
- package/lib/solution/BookingByStep/index.js +469 -91
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +5 -2
- package/lib/solution/BookingTicket/index.d.ts +113 -15
- package/lib/solution/BookingTicket/index.js +253 -61
- package/lib/solution/BookingTicket/types.d.ts +69 -6
- package/lib/solution/BookingTicket/types.js +16 -14
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +65 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/lib/solution/BookingTicket/utils/cartView.js +103 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.d.ts +146 -0
- package/lib/solution/ScanOrder/index.js +1820 -0
- package/lib/solution/ScanOrder/types.d.ts +305 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +639 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +9 -4
- package/lib/solution/ShopDiscount/types.d.ts +4 -0
- package/lib/solution/VenueBooking/index.d.ts +197 -0
- package/lib/solution/VenueBooking/index.js +1892 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +153 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +91 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +225 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +3 -0
- package/lib/solution/index.js +7 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
export function isNormalProduct(product) {
|
|
9
9
|
var _product$scheduleIds;
|
|
10
10
|
// 如果有 duration 配置,则不是普通商品
|
|
11
|
-
if (product.duration) {
|
|
11
|
+
if (product !== null && product !== void 0 && product.duration) {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// 如果有 schedule.ids 且长度大于0,则不是普通商品
|
|
16
|
-
if ((_product$scheduleIds = product['schedule.ids']) !== null && _product$scheduleIds !== void 0 && _product$scheduleIds.length) {
|
|
16
|
+
if (product !== null && product !== void 0 && (_product$scheduleIds = product['schedule.ids']) !== null && _product$scheduleIds !== void 0 && _product$scheduleIds.length) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -136,7 +136,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
136
136
|
}, {
|
|
137
137
|
osServer: true,
|
|
138
138
|
callback: options === null || options === void 0 ? void 0 : options.callback,
|
|
139
|
-
subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId
|
|
139
|
+
subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
|
|
140
|
+
customToast: function customToast() {}
|
|
140
141
|
});
|
|
141
142
|
case 6:
|
|
142
143
|
productsData = _context3.sent;
|
|
@@ -2,7 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import type { ScheduleItem } from '../Schedule/types';
|
|
4
4
|
import type { QuotationItem } from './types';
|
|
5
|
-
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState } from './types';
|
|
5
|
+
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState, QuotationCustomer } from './types';
|
|
6
6
|
export declare class QuotationModule extends BaseModule implements Module {
|
|
7
7
|
protected defaultName: string;
|
|
8
8
|
protected defaultVersion: string;
|
|
@@ -13,6 +13,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
13
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
14
|
loadQuotations(params?: {
|
|
15
15
|
channel?: string;
|
|
16
|
+
customer_id?: number | string;
|
|
16
17
|
}): Promise<void>;
|
|
17
18
|
getQuotationList(): QuotationItem[];
|
|
18
19
|
/**
|
|
@@ -27,11 +28,13 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
27
28
|
productId: number;
|
|
28
29
|
variantId?: number;
|
|
29
30
|
datetime: string;
|
|
31
|
+
customer_id?: number | string;
|
|
30
32
|
}): string | null;
|
|
31
33
|
getQuotationShelfId(params: {
|
|
32
34
|
productId: number;
|
|
33
35
|
variantId?: number;
|
|
34
36
|
datetime: string;
|
|
37
|
+
customer_id?: number | string;
|
|
35
38
|
}): number;
|
|
36
39
|
/**
|
|
37
40
|
* Batch pre-compute quotation prices for a set of products across multiple time points.
|
|
@@ -41,8 +44,12 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
41
44
|
buildProductPriceMap(params: {
|
|
42
45
|
productIds: number[];
|
|
43
46
|
timePoints: string[];
|
|
47
|
+
customer_id?: number | string;
|
|
44
48
|
}): Map<string, string | null>;
|
|
45
49
|
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
50
|
+
private filterQuotationsByCustomer;
|
|
51
|
+
private isQuotationVisibleForCustomer;
|
|
52
|
+
private hasValidCustomerId;
|
|
46
53
|
private isQuotationActiveAt;
|
|
47
54
|
private findProductData;
|
|
48
55
|
}
|
|
@@ -78,21 +78,22 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
78
78
|
case 0:
|
|
79
79
|
query = {};
|
|
80
80
|
if (params !== null && params !== void 0 && params.channel) query.channel = params.channel;
|
|
81
|
+
if (params !== null && params !== void 0 && params.customer_id) query.customer_id = String(params.customer_id);
|
|
81
82
|
if ((params === null || params === void 0 ? void 0 : params.channel) === 'online_store') {
|
|
82
83
|
query.channel = 'online-store';
|
|
83
84
|
}
|
|
84
|
-
_context2.next =
|
|
85
|
+
_context2.next = 6;
|
|
85
86
|
return this.request.get('/quotation/available', query, {
|
|
86
87
|
useCache: false
|
|
87
88
|
});
|
|
88
|
-
case
|
|
89
|
+
case 6:
|
|
89
90
|
res = _context2.sent;
|
|
90
|
-
list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
|
|
91
|
+
list = this.filterQuotationsByCustomer((res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [], params === null || params === void 0 ? void 0 : params.customer_id);
|
|
91
92
|
list.sort(function (a, b) {
|
|
92
93
|
return a.sort - b.sort;
|
|
93
94
|
});
|
|
94
95
|
this.store.list = list;
|
|
95
|
-
case
|
|
96
|
+
case 10:
|
|
96
97
|
case "end":
|
|
97
98
|
return _context2.stop();
|
|
98
99
|
}
|
|
@@ -122,12 +123,14 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
122
123
|
value: function getPriceForProduct(params) {
|
|
123
124
|
var productId = params.productId,
|
|
124
125
|
variantId = params.variantId,
|
|
125
|
-
datetime = params.datetime
|
|
126
|
+
datetime = params.datetime,
|
|
127
|
+
customer_id = params.customer_id;
|
|
126
128
|
var _iterator = _createForOfIteratorHelper(this.store.list),
|
|
127
129
|
_step;
|
|
128
130
|
try {
|
|
129
131
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
130
132
|
var quotation = _step.value;
|
|
133
|
+
if (!this.isQuotationVisibleForCustomer(quotation, customer_id)) continue;
|
|
131
134
|
if (!this.isQuotationActiveAt(quotation, datetime)) continue;
|
|
132
135
|
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
133
136
|
if (!match) continue;
|
|
@@ -146,12 +149,14 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
146
149
|
value: function getQuotationShelfId(params) {
|
|
147
150
|
var productId = params.productId,
|
|
148
151
|
variantId = params.variantId,
|
|
149
|
-
datetime = params.datetime
|
|
152
|
+
datetime = params.datetime,
|
|
153
|
+
customer_id = params.customer_id;
|
|
150
154
|
var _iterator2 = _createForOfIteratorHelper(this.store.list),
|
|
151
155
|
_step2;
|
|
152
156
|
try {
|
|
153
157
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
154
158
|
var quotation = _step2.value;
|
|
159
|
+
if (!this.isQuotationVisibleForCustomer(quotation, customer_id)) continue;
|
|
155
160
|
if (!this.isQuotationActiveAt(quotation, datetime)) continue;
|
|
156
161
|
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
157
162
|
if (!match || match.value === 0) continue;
|
|
@@ -188,7 +193,8 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
188
193
|
var key = "".concat(productId, ":").concat(timePoint);
|
|
189
194
|
var price = this.getPriceForProduct({
|
|
190
195
|
productId: productId,
|
|
191
|
-
datetime: timePoint
|
|
196
|
+
datetime: timePoint,
|
|
197
|
+
customer_id: params.customer_id
|
|
192
198
|
});
|
|
193
199
|
if (price !== null) {
|
|
194
200
|
map.set(key, price);
|
|
@@ -212,15 +218,39 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
212
218
|
value: function setScheduleResolver(resolver) {
|
|
213
219
|
this.scheduleResolver = resolver;
|
|
214
220
|
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "filterQuotationsByCustomer",
|
|
223
|
+
value: function filterQuotationsByCustomer(list, customerId) {
|
|
224
|
+
var _this2 = this;
|
|
225
|
+
return list.filter(function (quotation) {
|
|
226
|
+
return _this2.isQuotationVisibleForCustomer(quotation, customerId);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "isQuotationVisibleForCustomer",
|
|
231
|
+
value: function isQuotationVisibleForCustomer(quotation, customerId) {
|
|
232
|
+
var customers = quotation.customer || [];
|
|
233
|
+
if (customers.length === 0) return true;
|
|
234
|
+
if (!this.hasValidCustomerId(customerId)) return false;
|
|
235
|
+
return customers.some(function (customer) {
|
|
236
|
+
return String(customer.id) === String(customerId);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "hasValidCustomerId",
|
|
241
|
+
value: function hasValidCustomerId(customerId) {
|
|
242
|
+
if (customerId === undefined || customerId === null || customerId === '') return false;
|
|
243
|
+
return Number(customerId) > 0;
|
|
244
|
+
}
|
|
215
245
|
}, {
|
|
216
246
|
key: "isQuotationActiveAt",
|
|
217
247
|
value: function isQuotationActiveAt(quotation, datetime) {
|
|
218
248
|
var _quotation$schedule,
|
|
219
|
-
|
|
249
|
+
_this3 = this;
|
|
220
250
|
if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
|
|
221
251
|
var scheduleItems = quotation.schedule.map(function (s) {
|
|
222
|
-
var
|
|
223
|
-
var full = (
|
|
252
|
+
var _this3$scheduleResolv;
|
|
253
|
+
var full = (_this3$scheduleResolv = _this3.scheduleResolver) === null || _this3$scheduleResolv === void 0 ? void 0 : _this3$scheduleResolv.call(_this3, s.id);
|
|
224
254
|
if (full) return full;
|
|
225
255
|
return _objectSpread(_objectSpread({}, s), {}, {
|
|
226
256
|
repeat_type: s.repeat_type || 'none',
|
|
@@ -22,6 +22,10 @@ export interface QuotationSchedule {
|
|
|
22
22
|
}>;
|
|
23
23
|
pivot?: Record<string, any>;
|
|
24
24
|
}
|
|
25
|
+
export interface QuotationCustomer {
|
|
26
|
+
id: number | string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
25
29
|
export interface QuotationItem {
|
|
26
30
|
id: number;
|
|
27
31
|
shop_id: number;
|
|
@@ -34,6 +38,7 @@ export interface QuotationItem {
|
|
|
34
38
|
created_at?: string;
|
|
35
39
|
updated_at?: string;
|
|
36
40
|
deleted_at?: string | null;
|
|
41
|
+
customer?: QuotationCustomer[];
|
|
37
42
|
schedule: QuotationSchedule[];
|
|
38
43
|
product_data: QuotationProductData[];
|
|
39
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Rules, RulesModuleAPI, DiscountResult } from './types';
|
|
3
|
+
import { Rules, RulesModuleAPI, DiscountResult, UnavailableReason } from './types';
|
|
4
4
|
import { Discount } from '../Discount/types';
|
|
5
5
|
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
6
6
|
import { WindowPlugin } from '../../plugins';
|
|
@@ -29,8 +29,10 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
29
29
|
isAvailable: boolean;
|
|
30
30
|
discountList: Discount[];
|
|
31
31
|
productList: any[];
|
|
32
|
+
unavailableReason?: UnavailableReason;
|
|
32
33
|
};
|
|
33
34
|
filterDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
35
|
+
private getUnavailableReason;
|
|
34
36
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
35
37
|
discountList: Discount[];
|
|
36
38
|
productList: any[];
|