@pisell/pisellos 2.3.53 → 2.3.54
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/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +54 -25
- package/dist/modules/Order/types.d.ts +9 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +34 -15
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +47 -13
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -0
- package/dist/server/index.js +907 -793
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +64 -42
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +14 -2
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1142 -739
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +179 -0
- package/dist/solution/UnifiedBookingSales/index.js +1892 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1167 -841
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +26 -10
- package/lib/modules/Order/types.d.ts +9 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +48 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +33 -16
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -0
- package/lib/server/index.js +72 -15
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +24 -8
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +14 -2
- package/lib/solution/BookingTicket/index.js +10 -2
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +179 -0
- package/lib/solution/UnifiedBookingSales/index.js +1085 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +322 -110
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ProductData } from '../Product/types';
|
|
2
|
+
/**
|
|
3
|
+
* 商品 holder 配置
|
|
4
|
+
*/
|
|
5
|
+
export interface IHolderConfig {
|
|
6
|
+
required?: number;
|
|
7
|
+
resource_id: number;
|
|
8
|
+
status?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 表单记录
|
|
13
|
+
*/
|
|
14
|
+
export interface IFormRecord {
|
|
15
|
+
form_id: number;
|
|
16
|
+
form_record_id: number;
|
|
17
|
+
main_field: string;
|
|
18
|
+
customer_cover?: string;
|
|
19
|
+
created_at?: string;
|
|
20
|
+
customer_id?: number;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 表单配置/定义
|
|
25
|
+
*/
|
|
26
|
+
export interface IFormInfo {
|
|
27
|
+
form_id: number;
|
|
28
|
+
name: string;
|
|
29
|
+
fields?: Record<string, any>[];
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 单个 form_id 下的数据结构
|
|
34
|
+
*/
|
|
35
|
+
export interface IFormItemData {
|
|
36
|
+
records: IFormRecord[];
|
|
37
|
+
form: IFormInfo | Record<string, any>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* form_id 为 key 的 map 结构,如 948: { records: [], form: {} }
|
|
41
|
+
*/
|
|
42
|
+
export type HolderFormMap = Record<string, IFormItemData>;
|
|
43
|
+
/**
|
|
44
|
+
* Holder 模块 reactive store,仅 holderMap 会触发 changed 事件
|
|
45
|
+
*/
|
|
46
|
+
export interface HolderState {
|
|
47
|
+
holderMap: HolderFormMap;
|
|
48
|
+
}
|
|
49
|
+
export interface IFetchFormInfoParams {
|
|
50
|
+
url?: string;
|
|
51
|
+
query: {
|
|
52
|
+
form_id: string | number;
|
|
53
|
+
};
|
|
54
|
+
useCache?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface IFetchFormRecordsParams {
|
|
57
|
+
url?: string;
|
|
58
|
+
query: {
|
|
59
|
+
customer_id?: number;
|
|
60
|
+
form_id: string | number;
|
|
61
|
+
shop_id: string | number;
|
|
62
|
+
num?: number;
|
|
63
|
+
skip?: number;
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
};
|
|
66
|
+
useCache?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface IAddFormRecordParams {
|
|
69
|
+
url?: string;
|
|
70
|
+
body: {
|
|
71
|
+
form_id: number;
|
|
72
|
+
shop_id: number | string;
|
|
73
|
+
customer_id?: number;
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* UI 层自行调用添加接口后,将返回记录写入 holderMap
|
|
79
|
+
*/
|
|
80
|
+
export interface IAppendFormRecordParams {
|
|
81
|
+
/** 接口返回的 data,或完整响应 { data: {...} } */
|
|
82
|
+
record: IFormRecord | Record<string, any>;
|
|
83
|
+
/** 可选,未传则从 record.form_id 读取 */
|
|
84
|
+
form_id?: number | string;
|
|
85
|
+
}
|
|
86
|
+
export interface IEnsureFormDataParams {
|
|
87
|
+
form_id: number | string;
|
|
88
|
+
shop_id: number | string;
|
|
89
|
+
customer_id?: number;
|
|
90
|
+
useCache?: boolean;
|
|
91
|
+
forceRefresh?: boolean;
|
|
92
|
+
formInfoUrl?: string;
|
|
93
|
+
recordsUrl?: string;
|
|
94
|
+
skip?: number;
|
|
95
|
+
num?: number;
|
|
96
|
+
}
|
|
97
|
+
export interface IEnsureFormByProductParams {
|
|
98
|
+
product: ProductData | Record<string, any>;
|
|
99
|
+
customer_id?: number;
|
|
100
|
+
shop_id?: number | string;
|
|
101
|
+
useCache?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface IRefreshAllFormRecordsParams {
|
|
104
|
+
customer_id?: number;
|
|
105
|
+
useCache?: boolean;
|
|
106
|
+
recordsUrl?: string;
|
|
107
|
+
num?: number;
|
|
108
|
+
skip?: number;
|
|
109
|
+
}
|
|
110
|
+
export interface HolderModuleAPI {
|
|
111
|
+
getHolderFormMap: () => HolderFormMap;
|
|
112
|
+
getHolderFormData: (formId: number | string) => IFormItemData | undefined;
|
|
113
|
+
setFormData: (formId: number | string, data: Partial<IFormItemData>) => void;
|
|
114
|
+
fetchFormInfo: (params: IFetchFormInfoParams) => Promise<IFormInfo | IFormInfo[]>;
|
|
115
|
+
fetchRecords: (params: IFetchFormRecordsParams) => Promise<IFormRecord[]>;
|
|
116
|
+
ensureFormData: (params: IEnsureFormDataParams) => Promise<IFormItemData>;
|
|
117
|
+
ensureFormByProduct: (params: IEnsureFormByProductParams) => Promise<IFormItemData | null>;
|
|
118
|
+
addFormRecord: (params: IAddFormRecordParams) => Promise<IFormRecord>;
|
|
119
|
+
appendFormRecord: (params: IAppendFormRecordParams) => IFormRecord;
|
|
120
|
+
removeFormRecord: (formId: number | string, formRecordId: number) => void;
|
|
121
|
+
clearFormData: (formId?: number | string) => void;
|
|
122
|
+
refreshAllFormRecords: (params?: IRefreshAllFormRecordsParams) => Promise<HolderFormMap>;
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProductData } from '../Product/types';
|
|
2
|
+
import { IFormItemData, IHolderConfig } from './types';
|
|
3
|
+
export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
|
|
4
|
+
export declare function getFormIdFromHolderConfig(config: IHolderConfig): number;
|
|
5
|
+
export declare function normalizeFormId(formId: number | string): number;
|
|
6
|
+
export declare function createEmptyFormItemData(): {
|
|
7
|
+
records: any[];
|
|
8
|
+
form: Record<string, any>;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveFormMetaFromHolderItem(mapKey: string, item: IFormItemData): {
|
|
11
|
+
form_id: string | number;
|
|
12
|
+
shop_id: number | string;
|
|
13
|
+
} | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function getProductHolderConfig(product) {
|
|
2
|
+
var _product$holder_confi, _product$origin;
|
|
3
|
+
if (!product) return null;
|
|
4
|
+
var config = (_product$holder_confi = product === null || product === void 0 ? void 0 : product.holder_config) !== null && _product$holder_confi !== void 0 ? _product$holder_confi : product === null || product === void 0 || (_product$origin = product.origin) === null || _product$origin === void 0 ? void 0 : _product$origin.holder_config;
|
|
5
|
+
if (config !== null && config !== void 0 && config.status && (config === null || config === void 0 ? void 0 : config.status) !== 'enable') return null;
|
|
6
|
+
if (!(config !== null && config !== void 0 && config.resource_id)) return null;
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
9
|
+
export function getFormIdFromHolderConfig(config) {
|
|
10
|
+
return Number(config === null || config === void 0 ? void 0 : config.resource_id);
|
|
11
|
+
}
|
|
12
|
+
export function normalizeFormId(formId) {
|
|
13
|
+
return Number(formId);
|
|
14
|
+
}
|
|
15
|
+
export function createEmptyFormItemData() {
|
|
16
|
+
return {
|
|
17
|
+
records: [],
|
|
18
|
+
form: {}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function resolveFormMetaFromHolderItem(mapKey, item) {
|
|
22
|
+
var _ref, _ref2, _nestedForm$id, _nestedForm$shop_id;
|
|
23
|
+
var formInfo = item.form || {};
|
|
24
|
+
var nestedForm = formInfo.form || {};
|
|
25
|
+
var form_id = normalizeFormId((_ref = (_ref2 = (_nestedForm$id = nestedForm.id) !== null && _nestedForm$id !== void 0 ? _nestedForm$id : formInfo.form_id) !== null && _ref2 !== void 0 ? _ref2 : formInfo.id) !== null && _ref !== void 0 ? _ref : mapKey);
|
|
26
|
+
var shop_id = (_nestedForm$shop_id = nestedForm.shop_id) !== null && _nestedForm$shop_id !== void 0 ? _nestedForm$shop_id : formInfo.shop_id;
|
|
27
|
+
if (shop_id === undefined || shop_id === null || shop_id === '') {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
form_id: form_id,
|
|
32
|
+
shop_id: shop_id
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -105,12 +105,12 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
105
105
|
key: "fetchOpenData",
|
|
106
106
|
value: function () {
|
|
107
107
|
var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
108
|
-
var _this$appPlugin
|
|
108
|
+
var _this$appPlugin, _this$appPlugin$getDa;
|
|
109
109
|
var getData, shopId, tenantId, headers, response, data;
|
|
110
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
111
111
|
while (1) switch (_context2.prev = _context2.next) {
|
|
112
112
|
case 0:
|
|
113
|
-
getData = (_this$appPlugin
|
|
113
|
+
getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
114
114
|
shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
|
|
115
115
|
if (shopId) {
|
|
116
116
|
_context2.next = 4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams,
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
6
|
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
@@ -147,6 +147,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
147
147
|
isTempOrderPersistEnabled(): boolean;
|
|
148
148
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
|
|
149
149
|
persistTempOrder(): void;
|
|
150
|
+
notifyTempOrderChanged(): void;
|
|
150
151
|
private createDefaultTempOrderInstance;
|
|
151
152
|
private createExternalSaleNumber;
|
|
152
153
|
private ensureExternalSaleNumber;
|
|
@@ -496,6 +497,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
496
497
|
is_deposit: number;
|
|
497
498
|
relation_products: any[];
|
|
498
499
|
relation_forms: any[];
|
|
500
|
+
business_code: string | undefined;
|
|
499
501
|
};
|
|
500
502
|
checkBeforeSubmitOrder(params: {
|
|
501
503
|
cartItems: CartItem[];
|
|
@@ -32,7 +32,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
32
32
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
33
|
import { BaseModule } from "../BaseModule";
|
|
34
34
|
import { OrderHooks } from "./types";
|
|
35
|
-
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
|
|
35
|
+
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
38
|
import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
|
|
@@ -309,8 +309,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
309
309
|
key: "initialize",
|
|
310
310
|
value: function () {
|
|
311
311
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
312
|
-
var _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
313
|
-
var app, otherParams;
|
|
312
|
+
var _appPlugin$getApp, _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
313
|
+
var appPlugin, app, otherParams;
|
|
314
314
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
315
315
|
while (1) switch (_context.prev = _context.next) {
|
|
316
316
|
case 0:
|
|
@@ -326,15 +326,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
326
326
|
this.store.availableWalletIds = [];
|
|
327
327
|
}
|
|
328
328
|
this.request = this.core.getPlugin('request');
|
|
329
|
-
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
break;
|
|
329
|
+
appPlugin = this.core.getPlugin('app');
|
|
330
|
+
if (!appPlugin) {
|
|
331
|
+
console.error('Order 模块需要 app 插件支持');
|
|
333
332
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
app = this.appPlugin.getApp();
|
|
337
|
-
this.logger = app.logger;
|
|
333
|
+
app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
334
|
+
this.logger = app === null || app === void 0 ? void 0 : app.logger;
|
|
338
335
|
this.window = this.core.getPlugin('window');
|
|
339
336
|
otherParams = options.otherParams || {};
|
|
340
337
|
this.cacheId = otherParams.cacheId;
|
|
@@ -345,7 +342,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
345
342
|
this.otherParams = otherParams;
|
|
346
343
|
this.registerDiscountModules(options);
|
|
347
344
|
this.logInfo('OrderModule initialized successfully');
|
|
348
|
-
case
|
|
345
|
+
case 20:
|
|
349
346
|
case "end":
|
|
350
347
|
return _context.stop();
|
|
351
348
|
}
|
|
@@ -1276,6 +1273,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1276
1273
|
value: function persistTempOrder() {
|
|
1277
1274
|
// no-op: OrderModule 的刷新恢复不再依赖 localStorage。
|
|
1278
1275
|
}
|
|
1276
|
+
}, {
|
|
1277
|
+
key: "notifyTempOrderChanged",
|
|
1278
|
+
value: function notifyTempOrderChanged() {
|
|
1279
|
+
if (!this.store.tempOrder) return;
|
|
1280
|
+
this.store.tempOrder = _objectSpread(_objectSpread({}, this.store.tempOrder), {}, {
|
|
1281
|
+
products: _toConsumableArray(this.store.tempOrder.products),
|
|
1282
|
+
bookings: this.store.tempOrder.bookings ? _toConsumableArray(this.store.tempOrder.bookings) : []
|
|
1283
|
+
});
|
|
1284
|
+
this.persistTempOrder();
|
|
1285
|
+
}
|
|
1279
1286
|
|
|
1280
1287
|
// ─── TempOrder: 创建 & 获取 ───
|
|
1281
1288
|
}, {
|
|
@@ -5334,7 +5341,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5334
5341
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
5335
5342
|
var _this31 = this,
|
|
5336
5343
|
_params$confirmPendin;
|
|
5337
|
-
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitResult;
|
|
5344
|
+
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitParams, submitResult;
|
|
5338
5345
|
return _regeneratorRuntime().wrap(function _callee36$(_context39) {
|
|
5339
5346
|
while (1) switch (_context39.prev = _context39.next) {
|
|
5340
5347
|
case 0:
|
|
@@ -5387,8 +5394,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5387
5394
|
case 25:
|
|
5388
5395
|
this.store.syncState = 'submitting';
|
|
5389
5396
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
|
|
5390
|
-
|
|
5391
|
-
return this.submitTempOrder({
|
|
5397
|
+
submitParams = {
|
|
5392
5398
|
payments: effectivePayments,
|
|
5393
5399
|
paymentStatus: paymentStatus,
|
|
5394
5400
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -5401,13 +5407,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5401
5407
|
});
|
|
5402
5408
|
return nextPayload;
|
|
5403
5409
|
}
|
|
5404
|
-
}
|
|
5405
|
-
|
|
5406
|
-
|
|
5410
|
+
};
|
|
5411
|
+
if (!(params.checkoutSyncTaskEnabled === false)) {
|
|
5412
|
+
_context39.next = 34;
|
|
5413
|
+
break;
|
|
5414
|
+
}
|
|
5415
|
+
_context39.next = 31;
|
|
5416
|
+
return this.submitTempOrderAsync(submitParams);
|
|
5417
|
+
case 31:
|
|
5418
|
+
_context39.t1 = _context39.sent;
|
|
5419
|
+
_context39.next = 37;
|
|
5420
|
+
break;
|
|
5421
|
+
case 34:
|
|
5422
|
+
_context39.next = 36;
|
|
5423
|
+
return this.submitTempOrder(submitParams);
|
|
5424
|
+
case 36:
|
|
5425
|
+
_context39.t1 = _context39.sent;
|
|
5426
|
+
case 37:
|
|
5427
|
+
submitResult = _context39.t1;
|
|
5407
5428
|
return _context39.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
|
|
5408
5429
|
submitResult: submitResult
|
|
5409
5430
|
}));
|
|
5410
|
-
case
|
|
5431
|
+
case 39:
|
|
5411
5432
|
case "end":
|
|
5412
5433
|
return _context39.stop();
|
|
5413
5434
|
}
|
|
@@ -5421,6 +5442,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5421
5442
|
}, {
|
|
5422
5443
|
key: "createOrder",
|
|
5423
5444
|
value: function createOrder(params) {
|
|
5445
|
+
var _this32 = this;
|
|
5424
5446
|
var order = _objectSpread({
|
|
5425
5447
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
5426
5448
|
// 要从外面拿,virtual
|
|
@@ -5432,11 +5454,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5432
5454
|
schedule_date: '',
|
|
5433
5455
|
is_deposit: 0,
|
|
5434
5456
|
relation_products: [],
|
|
5435
|
-
relation_forms: []
|
|
5457
|
+
relation_forms: [],
|
|
5458
|
+
business_code: params === null || params === void 0 ? void 0 : params.business_code
|
|
5436
5459
|
}, (params === null || params === void 0 ? void 0 : params.extraData) || {});
|
|
5437
5460
|
var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
|
|
5438
5461
|
if (params.cartItems.length > 0) {
|
|
5439
5462
|
params.cartItems.forEach(function (item) {
|
|
5463
|
+
var _params$extraData;
|
|
5440
5464
|
if (!item._origin.duration) {
|
|
5441
5465
|
var _generateDuration = generateDuration(item),
|
|
5442
5466
|
duration = _generateDuration.duration,
|
|
@@ -5448,6 +5472,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5448
5472
|
var discountList = getAllDiscountList(item);
|
|
5449
5473
|
item._origin.product.discount_list = discountList;
|
|
5450
5474
|
|
|
5475
|
+
// 为预约补齐 holder 信息
|
|
5476
|
+
if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
|
|
5477
|
+
ensureCartItemOriginHolder(item, _this32.window);
|
|
5478
|
+
}
|
|
5479
|
+
|
|
5451
5480
|
// 购物车是否为普通商品
|
|
5452
5481
|
if (isNormalProduct(item._origin)) {
|
|
5453
5482
|
var _order$relation_forms;
|
|
@@ -6105,7 +6134,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6105
6134
|
}, {
|
|
6106
6135
|
key: "normalizeTempOrderForRuntime",
|
|
6107
6136
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
6108
|
-
var
|
|
6137
|
+
var _this33 = this;
|
|
6109
6138
|
var runtimeRaw = this.withoutSyntheticDraftOrderIdForRuntime(raw);
|
|
6110
6139
|
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), runtimeRaw || {});
|
|
6111
6140
|
// ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
|
|
@@ -6129,12 +6158,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6129
6158
|
nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
|
|
6130
6159
|
var rawProducts = Array.isArray(raw.products) ? raw.products : [];
|
|
6131
6160
|
nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
|
|
6132
|
-
return
|
|
6161
|
+
return _this33.normalizeHydratedOrderProduct(p, {
|
|
6133
6162
|
makeEditMark: options === null || options === void 0 ? void 0 : options.makeEditMark
|
|
6134
6163
|
});
|
|
6135
6164
|
}) : [];
|
|
6136
6165
|
nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
|
|
6137
|
-
var booking =
|
|
6166
|
+
var booking = _this33.normalizeHydratedBookingHolder(b || {});
|
|
6138
6167
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
6139
6168
|
is_all: normalizeBookingIsAll(booking),
|
|
6140
6169
|
sub_type: normalizeBookingSubType(booking)
|
|
@@ -6321,7 +6350,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6321
6350
|
}, {
|
|
6322
6351
|
key: "normalizeHydratedOrderProduct",
|
|
6323
6352
|
value: function normalizeHydratedOrderProduct(product, options) {
|
|
6324
|
-
var
|
|
6353
|
+
var _this34 = this;
|
|
6325
6354
|
var row = _objectSpread({}, product || {});
|
|
6326
6355
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
6327
6356
|
row.num = row.product_quantity;
|
|
@@ -6329,7 +6358,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6329
6358
|
var productSku = ensureProductSku(row);
|
|
6330
6359
|
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
6331
6360
|
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
6332
|
-
return
|
|
6361
|
+
return _this34.normalizeHydratedProductOptionItem(optionItem || {});
|
|
6333
6362
|
}))
|
|
6334
6363
|
});
|
|
6335
6364
|
delete row["product_".concat('option', "_item")];
|
|
@@ -414,6 +414,7 @@ export interface CommitOrderParams {
|
|
|
414
414
|
type: 'virtual' | 'appointment_booking';
|
|
415
415
|
platform?: string;
|
|
416
416
|
extraData?: Record<string, any>;
|
|
417
|
+
business_code?: string;
|
|
417
418
|
};
|
|
418
419
|
}
|
|
419
420
|
export interface OrderSubmitBooking {
|
|
@@ -589,6 +590,12 @@ export interface SyncPaymentsToOrderParams {
|
|
|
589
590
|
payments: OrderPaymentSource[];
|
|
590
591
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
591
592
|
submitWhenPaid?: boolean;
|
|
593
|
+
/**
|
|
594
|
+
* Whether the checkout should be queued as the local `sync_sales` task.
|
|
595
|
+
* Defaults to true to preserve the WebPOS retry path. Set to false when
|
|
596
|
+
* the caller must wait for the cloud checkout response before proceeding.
|
|
597
|
+
*/
|
|
598
|
+
checkoutSyncTaskEnabled?: boolean;
|
|
592
599
|
smallTicketDataFlag?: number;
|
|
593
600
|
businessCode?: string;
|
|
594
601
|
channel?: string;
|
|
@@ -751,6 +758,8 @@ export interface OrderModuleAPI {
|
|
|
751
758
|
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
752
759
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
753
760
|
isTempOrderPersistEnabled: () => boolean;
|
|
761
|
+
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
762
|
+
notifyTempOrderChanged: () => void;
|
|
754
763
|
submitTempOrder: <T = any>(params?: {
|
|
755
764
|
cacheId?: string;
|
|
756
765
|
platform?: string;
|
|
@@ -15,6 +15,7 @@ export interface OrderProductsDepositSummary {
|
|
|
15
15
|
deposit_policy_ids: number[];
|
|
16
16
|
hasDeposit: boolean;
|
|
17
17
|
}
|
|
18
|
+
import type { WindowPlugin } from '../../plugins';
|
|
18
19
|
/**
|
|
19
20
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
20
21
|
*
|
|
@@ -177,6 +178,15 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
177
178
|
form_id: number;
|
|
178
179
|
form_record_ids: number[];
|
|
179
180
|
}[];
|
|
181
|
+
export interface CartOrderHolder {
|
|
182
|
+
customer_id?: number;
|
|
183
|
+
form_id: number | string;
|
|
184
|
+
form_record: (number | string)[] | null;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
188
|
+
*/
|
|
189
|
+
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
180
190
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
181
191
|
export { createUuidV4 };
|
|
182
192
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
@@ -20,6 +20,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
20
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
21
|
import dayjs from "dayjs";
|
|
22
22
|
import Decimal from 'decimal.js';
|
|
23
|
+
import { getProductHolderConfig } from "../Holder/utils";
|
|
23
24
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
24
25
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
25
26
|
/**
|
|
@@ -744,10 +745,41 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
|
|
|
744
745
|
return item.form_record_ids.length > 0;
|
|
745
746
|
}); // 过滤掉没有有效记录的表单
|
|
746
747
|
};
|
|
748
|
+
function getCustomerIdFromStorage(window) {
|
|
749
|
+
try {
|
|
750
|
+
var _window$getLocalStora;
|
|
751
|
+
var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
|
|
752
|
+
var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
753
|
+
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
754
|
+
} catch (_unused) {
|
|
755
|
+
return undefined;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
761
|
+
*/
|
|
762
|
+
export function ensureCartItemOriginHolder(cartItem, window) {
|
|
763
|
+
var _cartItem$_origin, _cartItem$_productIni;
|
|
764
|
+
if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
|
|
768
|
+
var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
|
|
769
|
+
if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
cartItem._origin.holder = {
|
|
773
|
+
customer_id: getCustomerIdFromStorage(window),
|
|
774
|
+
form_id: holderConfig.resource_id,
|
|
775
|
+
form_record: [formRecordId]
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
;
|
|
747
779
|
export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
748
|
-
var _cartItem$
|
|
749
|
-
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$
|
|
750
|
-
((cartItem === null || cartItem === void 0 || (_cartItem$
|
|
780
|
+
var _cartItem$_origin2, _cartItem$_origin3;
|
|
781
|
+
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.discount_list) || [];
|
|
782
|
+
((cartItem === null || cartItem === void 0 || (_cartItem$_origin3 = cartItem._origin) === null || _cartItem$_origin3 === void 0 || (_cartItem$_origin3 = _cartItem$_origin3.product) === null || _cartItem$_origin3 === void 0 ? void 0 : _cartItem$_origin3.product_bundle) || []).forEach(function (item) {
|
|
751
783
|
discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
752
784
|
item.discount_list = undefined;
|
|
753
785
|
});
|
|
@@ -157,6 +157,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
157
157
|
userPlugin,
|
|
158
158
|
customer_id,
|
|
159
159
|
_userPlugin$get,
|
|
160
|
+
channelMap,
|
|
161
|
+
rawApplicationCode,
|
|
162
|
+
mappedApplicationCode,
|
|
163
|
+
queryPayload,
|
|
160
164
|
productsData,
|
|
161
165
|
sortedList,
|
|
162
166
|
_args4 = arguments;
|
|
@@ -185,37 +189,52 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
185
189
|
console.error(error);
|
|
186
190
|
}
|
|
187
191
|
// 如果没传schedule_date,则从
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
channelMap = {
|
|
193
|
+
online_store: 'online-store',
|
|
194
|
+
scan_to_order: 'online-store',
|
|
195
|
+
'scan-to-order': 'online-store',
|
|
196
|
+
scan_to_order_2: 'mobile_order',
|
|
197
|
+
scan_to_order_3: 'scantoorder3'
|
|
198
|
+
};
|
|
199
|
+
rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
|
|
200
|
+
mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
201
|
+
queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
190
202
|
open_quotation: 1,
|
|
191
203
|
open_bundle: 0,
|
|
192
204
|
exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
|
|
193
|
-
with: ['category', 'collection', 'resourceRelation'],
|
|
205
|
+
with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
|
|
194
206
|
status: status,
|
|
195
207
|
num: 500,
|
|
196
208
|
skip: 1,
|
|
197
|
-
customer_id: customer_id
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
209
|
+
customer_id: customer_id
|
|
210
|
+
}, Array.isArray(category_ids) && category_ids.length ? {
|
|
211
|
+
category_ids: category_ids
|
|
212
|
+
} : {}), Array.isArray(product_ids) && product_ids.length ? {
|
|
213
|
+
ids: product_ids
|
|
214
|
+
} : {}), Array.isArray(collection) && collection.length ? {
|
|
215
|
+
collection: collection
|
|
216
|
+
} : {}), {}, {
|
|
217
|
+
front_end_cache_id: cacheId
|
|
218
|
+
}, Array.isArray(menu_list_ids) && menu_list_ids.length ? {
|
|
219
|
+
menu_list_ids: menu_list_ids
|
|
220
|
+
} : {}), {}, {
|
|
203
221
|
with_count: with_count,
|
|
204
222
|
// client_schedule_ids: schedule_ids,
|
|
205
223
|
schedule_date: schedule_date,
|
|
206
|
-
application_code:
|
|
224
|
+
application_code: mappedApplicationCode,
|
|
207
225
|
is_eject: 1,
|
|
208
226
|
with_schedule: with_schedule,
|
|
209
227
|
schedule_datetime: schedule_datetime,
|
|
210
|
-
extension_type: extension_type
|
|
211
|
-
|
|
212
|
-
|
|
228
|
+
extension_type: extension_type
|
|
229
|
+
});
|
|
230
|
+
_context4.next = 11;
|
|
231
|
+
return this.request.post("/product/query", queryPayload, {
|
|
213
232
|
osServer: true,
|
|
214
233
|
callback: options === null || options === void 0 ? void 0 : options.callback,
|
|
215
234
|
subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
|
|
216
235
|
customToast: function customToast() {}
|
|
217
236
|
});
|
|
218
|
-
case
|
|
237
|
+
case 11:
|
|
219
238
|
productsData = _context4.sent;
|
|
220
239
|
sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
|
|
221
240
|
return Number(b.sort) - Number(a.sort);
|
|
@@ -228,7 +247,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
228
247
|
// }
|
|
229
248
|
this.addProduct(sortedList);
|
|
230
249
|
return _context4.abrupt("return", sortedList);
|
|
231
|
-
case
|
|
250
|
+
case 15:
|
|
232
251
|
case "end":
|
|
233
252
|
return _context4.stop();
|
|
234
253
|
}
|
|
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
21
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
22
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
23
23
|
*
|
|
24
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
24
|
+
* Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
|
|
25
25
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
26
26
|
* the requested productId wins.
|
|
27
27
|
*/
|
|
@@ -90,7 +90,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
90
90
|
res = _context2.sent;
|
|
91
91
|
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) || [];
|
|
92
92
|
list.sort(function (a, b) {
|
|
93
|
-
return
|
|
93
|
+
return b.sort - a.sort;
|
|
94
94
|
});
|
|
95
95
|
this.store.list = list;
|
|
96
96
|
case 9:
|
|
@@ -151,7 +151,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
151
151
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
152
152
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
153
153
|
*
|
|
154
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
154
|
+
* Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
|
|
155
155
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
156
156
|
* the requested productId wins.
|
|
157
157
|
*/
|