@pisell/pisellos 2.3.1 → 2.3.2
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/modules/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +448 -369
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Quotation/index.d.ts +16 -2
- package/dist/modules/Quotation/index.js +71 -38
- package/dist/modules/Quotation/types.d.ts +14 -0
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +7 -4
- package/dist/modules/Schedule/index.d.ts +4 -0
- package/dist/modules/Schedule/index.js +31 -1
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/server/index.js +13 -12
- package/dist/server/modules/products/index.d.ts +4 -0
- package/dist/server/modules/products/index.js +76 -45
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +278 -66
- package/dist/server/modules/schedule/index.d.ts +2 -0
- package/dist/server/modules/schedule/index.js +10 -2
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +825 -528
- package/dist/solution/BaseSales/types.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
- package/dist/solution/BaseSales/utils/quotationPrice.js +16 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +48 -7
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Quotation/index.d.ts +16 -2
- package/lib/modules/Quotation/index.js +49 -13
- package/lib/modules/Quotation/types.d.ts +14 -0
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -3
- package/lib/modules/Schedule/index.d.ts +4 -0
- package/lib/modules/Schedule/index.js +21 -0
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/server/index.js +1 -1
- package/lib/server/modules/products/index.d.ts +4 -0
- package/lib/server/modules/products/index.js +43 -19
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +179 -1
- package/lib/server/modules/schedule/index.d.ts +2 -0
- package/lib/server/modules/schedule/index.js +8 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +218 -19
- package/lib/solution/BaseSales/types.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
- package/lib/solution/BaseSales/utils/quotationPrice.js +15 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -666,6 +666,8 @@ export interface OrderModuleAPI {
|
|
|
666
666
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
667
667
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
|
|
668
668
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
669
|
+
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
670
|
+
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
669
671
|
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
670
672
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
671
673
|
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import type { ScheduleItem } from '../Schedule/types';
|
|
4
|
-
import type { QuotationItem } from './types';
|
|
5
|
-
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState, QuotationCustomer } from './types';
|
|
4
|
+
import type { QuotationItem, QuotationCustomerScopeInfo } from './types';
|
|
5
|
+
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState, QuotationCustomer, QuotationCustomerScope, QuotationCustomerScopeInfo, } from './types';
|
|
6
6
|
export declare class QuotationModule extends BaseModule implements Module {
|
|
7
7
|
protected defaultName: string;
|
|
8
8
|
protected defaultVersion: string;
|
|
@@ -16,6 +16,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
16
16
|
customer_id?: number | string;
|
|
17
17
|
}): Promise<void>;
|
|
18
18
|
getQuotationList(): QuotationItem[];
|
|
19
|
+
getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
|
|
19
20
|
/**
|
|
20
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
21
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
@@ -28,12 +29,24 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
28
29
|
productId: number;
|
|
29
30
|
variantId?: number;
|
|
30
31
|
datetime: string;
|
|
32
|
+
channel?: string;
|
|
31
33
|
customer_id?: number | string;
|
|
32
34
|
}): string | null;
|
|
35
|
+
getQuotationMatchForProduct(params: {
|
|
36
|
+
productId: number;
|
|
37
|
+
variantId?: number;
|
|
38
|
+
datetime: string;
|
|
39
|
+
channel?: string;
|
|
40
|
+
customer_id?: number | string;
|
|
41
|
+
}): {
|
|
42
|
+
price: string | null;
|
|
43
|
+
quotationShelfId: number;
|
|
44
|
+
} | null;
|
|
33
45
|
getQuotationShelfId(params: {
|
|
34
46
|
productId: number;
|
|
35
47
|
variantId?: number;
|
|
36
48
|
datetime: string;
|
|
49
|
+
channel?: string;
|
|
37
50
|
customer_id?: number | string;
|
|
38
51
|
}): number;
|
|
39
52
|
/**
|
|
@@ -49,6 +62,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
49
62
|
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
50
63
|
private isQuotationVisibleForCustomer;
|
|
51
64
|
private hasValidCustomerId;
|
|
65
|
+
private normalizeCustomerId;
|
|
52
66
|
private isQuotationActiveAt;
|
|
53
67
|
private findProductData;
|
|
54
68
|
}
|
|
@@ -109,6 +109,43 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
109
109
|
value: function getQuotationList() {
|
|
110
110
|
return this.store.list;
|
|
111
111
|
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "getQuotationCustomerScopeInfo",
|
|
114
|
+
value: function getQuotationCustomerScopeInfo() {
|
|
115
|
+
var _this2 = this;
|
|
116
|
+
var customerById = new Map();
|
|
117
|
+
var quotationScopes = this.store.list.filter(function (quotation) {
|
|
118
|
+
return Array.isArray(quotation.customer) && quotation.customer.length > 0;
|
|
119
|
+
}).map(function (quotation) {
|
|
120
|
+
var customerIds = [];
|
|
121
|
+
var customers = [];
|
|
122
|
+
var localSeen = new Set();
|
|
123
|
+
var quotationCustomers = quotation.customer || [];
|
|
124
|
+
quotationCustomers.forEach(function (customer) {
|
|
125
|
+
var customerId = _this2.normalizeCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
126
|
+
if (!customerId || localSeen.has(customerId)) return;
|
|
127
|
+
localSeen.add(customerId);
|
|
128
|
+
customerIds.push(customerId);
|
|
129
|
+
customers.push(customer);
|
|
130
|
+
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
quotationId: quotation.id,
|
|
134
|
+
quotationName: quotation.name,
|
|
135
|
+
customerIds: customerIds,
|
|
136
|
+
customers: customers
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
var result = {
|
|
140
|
+
quotationCount: this.store.list.length,
|
|
141
|
+
hasCustomerScopedQuotations: quotationScopes.length > 0,
|
|
142
|
+
allQuotationsCustomerScoped: this.store.list.length > 0 && quotationScopes.length === this.store.list.length,
|
|
143
|
+
customerIds: Array.from(customerById.keys()),
|
|
144
|
+
customers: Array.from(customerById.values()),
|
|
145
|
+
quotationScopes: quotationScopes
|
|
146
|
+
};
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
112
149
|
|
|
113
150
|
/**
|
|
114
151
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
@@ -121,6 +158,12 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
121
158
|
}, {
|
|
122
159
|
key: "getPriceForProduct",
|
|
123
160
|
value: function getPriceForProduct(params) {
|
|
161
|
+
var _this$getQuotationMat, _this$getQuotationMat2;
|
|
162
|
+
return (_this$getQuotationMat = (_this$getQuotationMat2 = this.getQuotationMatchForProduct(params)) === null || _this$getQuotationMat2 === void 0 ? void 0 : _this$getQuotationMat2.price) !== null && _this$getQuotationMat !== void 0 ? _this$getQuotationMat : null;
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "getQuotationMatchForProduct",
|
|
166
|
+
value: function getQuotationMatchForProduct(params) {
|
|
124
167
|
var productId = params.productId,
|
|
125
168
|
variantId = params.variantId,
|
|
126
169
|
datetime = params.datetime,
|
|
@@ -137,7 +180,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
137
180
|
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
138
181
|
if (!match) continue;
|
|
139
182
|
if (match.value === 0) continue;
|
|
140
|
-
return
|
|
183
|
+
return {
|
|
184
|
+
price: String(match.value),
|
|
185
|
+
quotationShelfId: quotation.id
|
|
186
|
+
};
|
|
141
187
|
}
|
|
142
188
|
} catch (err) {
|
|
143
189
|
_iterator.e(err);
|
|
@@ -149,27 +195,8 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
149
195
|
}, {
|
|
150
196
|
key: "getQuotationShelfId",
|
|
151
197
|
value: function getQuotationShelfId(params) {
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
datetime = params.datetime,
|
|
155
|
-
customer_id = params.customer_id;
|
|
156
|
-
var _iterator2 = _createForOfIteratorHelper(this.store.list),
|
|
157
|
-
_step2;
|
|
158
|
-
try {
|
|
159
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
160
|
-
var quotation = _step2.value;
|
|
161
|
-
if (!this.isQuotationVisibleForCustomer(quotation, customer_id)) continue;
|
|
162
|
-
if (!this.isQuotationActiveAt(quotation, datetime)) continue;
|
|
163
|
-
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
164
|
-
if (!match || match.value === 0) continue;
|
|
165
|
-
return quotation.id;
|
|
166
|
-
}
|
|
167
|
-
} catch (err) {
|
|
168
|
-
_iterator2.e(err);
|
|
169
|
-
} finally {
|
|
170
|
-
_iterator2.f();
|
|
171
|
-
}
|
|
172
|
-
return 0;
|
|
198
|
+
var _this$getQuotationMat3, _this$getQuotationMat4;
|
|
199
|
+
return (_this$getQuotationMat3 = (_this$getQuotationMat4 = this.getQuotationMatchForProduct(params)) === null || _this$getQuotationMat4 === void 0 ? void 0 : _this$getQuotationMat4.quotationShelfId) !== null && _this$getQuotationMat3 !== void 0 ? _this$getQuotationMat3 : 0;
|
|
173
200
|
}
|
|
174
201
|
|
|
175
202
|
/**
|
|
@@ -182,16 +209,16 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
182
209
|
value: function buildProductPriceMap(params) {
|
|
183
210
|
var map = new Map();
|
|
184
211
|
if (!this.store.list.length) return map;
|
|
185
|
-
var
|
|
186
|
-
|
|
212
|
+
var _iterator2 = _createForOfIteratorHelper(params.productIds),
|
|
213
|
+
_step2;
|
|
187
214
|
try {
|
|
188
|
-
for (
|
|
189
|
-
var productId =
|
|
190
|
-
var
|
|
191
|
-
|
|
215
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
216
|
+
var productId = _step2.value;
|
|
217
|
+
var _iterator3 = _createForOfIteratorHelper(params.timePoints),
|
|
218
|
+
_step3;
|
|
192
219
|
try {
|
|
193
|
-
for (
|
|
194
|
-
var timePoint =
|
|
220
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
221
|
+
var timePoint = _step3.value;
|
|
195
222
|
var key = "".concat(productId, ":").concat(timePoint);
|
|
196
223
|
var price = this.getPriceForProduct({
|
|
197
224
|
productId: productId,
|
|
@@ -203,15 +230,15 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
203
230
|
}
|
|
204
231
|
}
|
|
205
232
|
} catch (err) {
|
|
206
|
-
|
|
233
|
+
_iterator3.e(err);
|
|
207
234
|
} finally {
|
|
208
|
-
|
|
235
|
+
_iterator3.f();
|
|
209
236
|
}
|
|
210
237
|
}
|
|
211
238
|
} catch (err) {
|
|
212
|
-
|
|
239
|
+
_iterator2.e(err);
|
|
213
240
|
} finally {
|
|
214
|
-
|
|
241
|
+
_iterator2.f();
|
|
215
242
|
}
|
|
216
243
|
return map;
|
|
217
244
|
}
|
|
@@ -236,21 +263,27 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
236
263
|
if (customerId === undefined || customerId === null || customerId === '') return false;
|
|
237
264
|
return Number(customerId) > 0;
|
|
238
265
|
}
|
|
266
|
+
}, {
|
|
267
|
+
key: "normalizeCustomerId",
|
|
268
|
+
value: function normalizeCustomerId(customerId) {
|
|
269
|
+
if (customerId === undefined || customerId === null || customerId === '') return null;
|
|
270
|
+
return String(customerId);
|
|
271
|
+
}
|
|
239
272
|
}, {
|
|
240
273
|
key: "isQuotationActiveAt",
|
|
241
274
|
value: function isQuotationActiveAt(quotation, datetime) {
|
|
242
275
|
var _quotation$schedule,
|
|
243
|
-
|
|
276
|
+
_this3 = this;
|
|
244
277
|
if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
|
|
245
278
|
var scheduleItems = [];
|
|
246
279
|
quotation.schedule.forEach(function (s) {
|
|
247
|
-
var
|
|
248
|
-
var full = (
|
|
280
|
+
var _this3$scheduleResolv;
|
|
281
|
+
var full = (_this3$scheduleResolv = _this3.scheduleResolver) === null || _this3$scheduleResolv === void 0 ? void 0 : _this3$scheduleResolv.call(_this3, s.id);
|
|
249
282
|
if (full) {
|
|
250
283
|
scheduleItems.push(full);
|
|
251
284
|
return;
|
|
252
285
|
}
|
|
253
|
-
if (
|
|
286
|
+
if (_this3.scheduleResolver) {
|
|
254
287
|
return;
|
|
255
288
|
}
|
|
256
289
|
var fallbackSchedule = _objectSpread(_objectSpread({}, s), {}, {
|
|
@@ -45,3 +45,17 @@ export interface QuotationItem {
|
|
|
45
45
|
export interface QuotationState {
|
|
46
46
|
list: QuotationItem[];
|
|
47
47
|
}
|
|
48
|
+
export interface QuotationCustomerScope {
|
|
49
|
+
quotationId: number;
|
|
50
|
+
quotationName: string;
|
|
51
|
+
customerIds: string[];
|
|
52
|
+
customers: QuotationCustomer[];
|
|
53
|
+
}
|
|
54
|
+
export interface QuotationCustomerScopeInfo {
|
|
55
|
+
quotationCount: number;
|
|
56
|
+
hasCustomerScopedQuotations: boolean;
|
|
57
|
+
allQuotationsCustomerScoped: boolean;
|
|
58
|
+
customerIds: string[];
|
|
59
|
+
customers: QuotationCustomer[];
|
|
60
|
+
quotationScopes: QuotationCustomerScope[];
|
|
61
|
+
}
|
|
@@ -29,6 +29,7 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
29
29
|
}): Promise<{
|
|
30
30
|
tax_title: string;
|
|
31
31
|
tax_rate: number | undefined;
|
|
32
|
+
tax_country_code: string;
|
|
32
33
|
product_quantity: number;
|
|
33
34
|
product_original_amount: string;
|
|
34
35
|
product_amount: string;
|
|
@@ -201,10 +201,12 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
201
|
_params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount;
|
|
202
202
|
taxConfig = this.getTaxConfig();
|
|
203
203
|
summarySchedule = this.core.getModule("".concat(this.name.split('_')[0], "_schedule"));
|
|
204
|
-
needScheduleIds = (_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
|
|
204
|
+
needScheduleIds = (((_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
|
|
205
205
|
return item.available_schedule_ids;
|
|
206
|
-
})) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat()
|
|
207
|
-
|
|
206
|
+
})) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat()) || []).filter(function (id) {
|
|
207
|
+
return id !== undefined && id !== null && id !== '';
|
|
208
|
+
});
|
|
209
|
+
scheduleList = needScheduleIds.length > 0 ? summarySchedule === null || summarySchedule === void 0 ? void 0 : summarySchedule.getScheduleListByIds(needScheduleIds) : [];
|
|
208
210
|
scheduleById = {};
|
|
209
211
|
if (Array.isArray(scheduleList)) {
|
|
210
212
|
_iterator = _createForOfIteratorHelper(scheduleList);
|
|
@@ -230,7 +232,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
230
232
|
});
|
|
231
233
|
summaryWithTaxMeta = _objectSpread(_objectSpread({}, summary), {}, {
|
|
232
234
|
tax_title: taxConfig.taxTitle || '',
|
|
233
|
-
tax_rate: taxRate !== null && taxRate !== void 0 ? taxRate : taxConfig.taxRate
|
|
235
|
+
tax_rate: taxRate !== null && taxRate !== void 0 ? taxRate : taxConfig.taxRate,
|
|
236
|
+
tax_country_code: taxConfig.taxCountryCode || ''
|
|
234
237
|
});
|
|
235
238
|
this.store.summary = summaryWithTaxMeta;
|
|
236
239
|
return _context4.abrupt("return", summaryWithTaxMeta);
|
|
@@ -9,6 +9,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
9
9
|
private cacheId;
|
|
10
10
|
private openCache;
|
|
11
11
|
private fatherModule;
|
|
12
|
+
private hasLoadedScheduleList;
|
|
12
13
|
constructor(name?: string, version?: string);
|
|
13
14
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
15
|
/**
|
|
@@ -25,6 +26,9 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
25
26
|
*/
|
|
26
27
|
loadAllSchedule(): Promise<void>;
|
|
27
28
|
setScheduleList(list: ScheduleItem[]): void;
|
|
29
|
+
private syncScheduleMap;
|
|
30
|
+
getScheduleList(): ScheduleItem[];
|
|
31
|
+
isScheduleListLoaded(): boolean;
|
|
28
32
|
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: LoadScheduleAvailableDateParams): Promise<import("../Date/types").ITime[]>;
|
|
29
33
|
getScheduleListByIds(ids: number[]): ScheduleItem[];
|
|
30
34
|
setAvailabilityScheduleDateList(list: ScheduleAvailabilityDateItem[]): void;
|
|
@@ -44,6 +44,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
44
44
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
45
45
|
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
46
46
|
_defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "hasLoadedScheduleList", false);
|
|
47
48
|
return _this;
|
|
48
49
|
}
|
|
49
50
|
_createClass(ScheduleModule, [{
|
|
@@ -70,10 +71,14 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
70
71
|
this.store = options === null || options === void 0 ? void 0 : options.store;
|
|
71
72
|
if (options.initialState) {
|
|
72
73
|
this.store.scheduleList = options.initialState.scheduleList;
|
|
74
|
+
this.syncScheduleMap();
|
|
73
75
|
this.store.availabilityDateList = options.initialState.availabilityDateList;
|
|
76
|
+
this.hasLoadedScheduleList = Array.isArray(options.initialState.scheduleList);
|
|
74
77
|
} else {
|
|
75
78
|
this.store.scheduleList = [];
|
|
79
|
+
this.store.map = new Map();
|
|
76
80
|
this.store.availabilityDateList = [];
|
|
81
|
+
this.hasLoadedScheduleList = false;
|
|
77
82
|
}
|
|
78
83
|
if ((_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
|
|
79
84
|
this.openCache = options.otherParams.openCache;
|
|
@@ -147,6 +152,25 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
147
152
|
key: "setScheduleList",
|
|
148
153
|
value: function setScheduleList(list) {
|
|
149
154
|
this.store.scheduleList = list;
|
|
155
|
+
this.syncScheduleMap();
|
|
156
|
+
this.hasLoadedScheduleList = true;
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "syncScheduleMap",
|
|
160
|
+
value: function syncScheduleMap() {
|
|
161
|
+
this.store.map = new Map((this.store.scheduleList || []).map(function (schedule) {
|
|
162
|
+
return [Number(schedule.id), schedule];
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "getScheduleList",
|
|
167
|
+
value: function getScheduleList() {
|
|
168
|
+
return this.store.scheduleList || [];
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "isScheduleListLoaded",
|
|
172
|
+
value: function isScheduleListLoaded() {
|
|
173
|
+
return this.hasLoadedScheduleList;
|
|
150
174
|
}
|
|
151
175
|
}, {
|
|
152
176
|
key: "loadScheduleAvailableDate",
|
|
@@ -221,11 +245,17 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
221
245
|
}, {
|
|
222
246
|
key: "getScheduleListByIds",
|
|
223
247
|
value: function getScheduleListByIds(ids) {
|
|
224
|
-
var
|
|
248
|
+
var _this2 = this,
|
|
249
|
+
_this$store$scheduleL;
|
|
225
250
|
var idSet = new Set(ids.map(function (id) {
|
|
226
251
|
return String(id);
|
|
227
252
|
}));
|
|
228
253
|
console.log('getScheduleListByIds', this.store.scheduleList);
|
|
254
|
+
if (this.store.map instanceof Map && this.store.map.size > 0) {
|
|
255
|
+
return ids.map(function (id) {
|
|
256
|
+
return _this2.store.map.get(Number(id));
|
|
257
|
+
}).filter(Boolean);
|
|
258
|
+
}
|
|
229
259
|
var list = (_this$store$scheduleL = this.store.scheduleList) === null || _this$store$scheduleL === void 0 ? void 0 : _this$store$scheduleL.filter(function (n) {
|
|
230
260
|
return idSet.has(String(n.id));
|
|
231
261
|
});
|
package/dist/server/index.js
CHANGED
|
@@ -3953,9 +3953,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3953
3953
|
externalSaleNumber = next.external_sale_number;
|
|
3954
3954
|
shouldClearLocalOrderId = this.isLocalCheckoutOrderId(next.order_id);
|
|
3955
3955
|
if (shouldClearLocalOrderId) next.order_id = null;
|
|
3956
|
+
// 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
|
|
3957
|
+
delete next.vouchers;
|
|
3956
3958
|
hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
|
|
3957
3959
|
if (!hasCheckoutOrderNumbers) {
|
|
3958
|
-
_context42.next =
|
|
3960
|
+
_context42.next = 11;
|
|
3959
3961
|
break;
|
|
3960
3962
|
}
|
|
3961
3963
|
this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
|
|
@@ -3966,9 +3968,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3966
3968
|
shop_full_order_number: next.shop_full_order_number
|
|
3967
3969
|
});
|
|
3968
3970
|
return _context42.abrupt("return", next);
|
|
3969
|
-
case
|
|
3971
|
+
case 11:
|
|
3970
3972
|
if (!this.isBlankCheckoutValue(externalSaleNumber)) {
|
|
3971
|
-
_context42.next =
|
|
3973
|
+
_context42.next = 14;
|
|
3972
3974
|
break;
|
|
3973
3975
|
}
|
|
3974
3976
|
if (shouldClearLocalOrderId) {
|
|
@@ -3978,9 +3980,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3978
3980
|
});
|
|
3979
3981
|
}
|
|
3980
3982
|
return _context42.abrupt("return", next);
|
|
3981
|
-
case
|
|
3983
|
+
case 14:
|
|
3982
3984
|
if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
|
|
3983
|
-
_context42.next =
|
|
3985
|
+
_context42.next = 17;
|
|
3984
3986
|
break;
|
|
3985
3987
|
}
|
|
3986
3988
|
if (shouldClearLocalOrderId) {
|
|
@@ -3990,11 +3992,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3990
3992
|
});
|
|
3991
3993
|
}
|
|
3992
3994
|
return _context42.abrupt("return", next);
|
|
3993
|
-
case
|
|
3994
|
-
_context42.prev =
|
|
3995
|
+
case 17:
|
|
3996
|
+
_context42.prev = 17;
|
|
3995
3997
|
localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
|
|
3996
3998
|
if (localOrder) {
|
|
3997
|
-
_context42.next =
|
|
3999
|
+
_context42.next = 22;
|
|
3998
4000
|
break;
|
|
3999
4001
|
}
|
|
4000
4002
|
if (shouldClearLocalOrderId) {
|
|
@@ -4005,7 +4007,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4005
4007
|
});
|
|
4006
4008
|
}
|
|
4007
4009
|
return _context42.abrupt("return", next);
|
|
4008
|
-
case
|
|
4010
|
+
case 22:
|
|
4009
4011
|
if (this.isBlankCheckoutValue(next.shop_order_number)) {
|
|
4010
4012
|
next.shop_order_number = localOrder.shop_order_number;
|
|
4011
4013
|
}
|
|
@@ -4021,11 +4023,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4021
4023
|
shop_full_order_number: next.shop_full_order_number
|
|
4022
4024
|
});
|
|
4023
4025
|
// 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
|
|
4024
|
-
delete next.vouchers;
|
|
4025
4026
|
return _context42.abrupt("return", next);
|
|
4026
4027
|
case 28:
|
|
4027
4028
|
_context42.prev = 28;
|
|
4028
|
-
_context42.t0 = _context42["catch"](
|
|
4029
|
+
_context42.t0 = _context42["catch"](17);
|
|
4029
4030
|
this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
|
|
4030
4031
|
external_sale_number: externalSaleNumber,
|
|
4031
4032
|
error: this.getUnknownErrorMessage(_context42.t0),
|
|
@@ -4036,7 +4037,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4036
4037
|
case "end":
|
|
4037
4038
|
return _context42.stop();
|
|
4038
4039
|
}
|
|
4039
|
-
}, _callee42, this, [[
|
|
4040
|
+
}, _callee42, this, [[17, 28]]);
|
|
4040
4041
|
}));
|
|
4041
4042
|
function normalizeCheckoutSubmitData(_x44, _x45) {
|
|
4042
4043
|
return _normalizeCheckoutSubmitData.apply(this, arguments);
|
|
@@ -24,6 +24,9 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
24
24
|
private quotationBridgeLoadedKey?;
|
|
25
25
|
private quotationBridgeRefreshPromise?;
|
|
26
26
|
private quotationBridgeRefreshKey?;
|
|
27
|
+
private quotationScheduleCache;
|
|
28
|
+
private quotationScheduleCacheSource;
|
|
29
|
+
private quotationScheduleCacheLoaded;
|
|
27
30
|
private productDataSource;
|
|
28
31
|
private pendingSyncMessages;
|
|
29
32
|
private syncTimer?;
|
|
@@ -75,6 +78,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
75
78
|
}): Promise<void>;
|
|
76
79
|
private ensureQuotationBridgeReady;
|
|
77
80
|
private getQuotationBridgeScopeKey;
|
|
81
|
+
private getQuotedPrice;
|
|
78
82
|
private buildPriceDataFromQuotation;
|
|
79
83
|
private buildVariantPriceData;
|
|
80
84
|
private buildBundleGroupPriceData;
|