@pisell/pisellos 0.0.546 → 0.0.549
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Holder/index.d.ts +42 -0
- package/dist/modules/Holder/index.js +500 -0
- package/dist/modules/Holder/types.d.ts +115 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +9 -0
- package/dist/modules/Holder/utils.js +20 -0
- package/dist/modules/Product/types.d.ts +7 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/solution/BookingByStep/index.d.ts +9 -0
- package/dist/solution/BookingByStep/index.js +32 -2
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/ScanOrder/index.d.ts +6 -5
- package/dist/solution/ScanOrder/index.js +529 -400
- package/lib/modules/Holder/index.d.ts +42 -0
- package/lib/modules/Holder/index.js +329 -0
- package/lib/modules/Holder/types.d.ts +115 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +9 -0
- package/lib/modules/Holder/utils.js +57 -0
- package/lib/modules/Product/types.d.ts +7 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/solution/BookingByStep/index.d.ts +9 -0
- package/lib/solution/BookingByStep/index.js +23 -0
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/ScanOrder/index.d.ts +6 -5
- package/lib/solution/ScanOrder/index.js +114 -56
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
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 | string;
|
|
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 HolderModuleAPI {
|
|
104
|
+
getHolderFormMap: () => HolderFormMap;
|
|
105
|
+
getHolderFormData: (formId: number | string) => IFormItemData | undefined;
|
|
106
|
+
setFormData: (formId: number | string, data: Partial<IFormItemData>) => void;
|
|
107
|
+
fetchFormInfo: (params: IFetchFormInfoParams) => Promise<IFormInfo | IFormInfo[]>;
|
|
108
|
+
fetchRecords: (params: IFetchFormRecordsParams) => Promise<IFormRecord[]>;
|
|
109
|
+
ensureFormData: (params: IEnsureFormDataParams) => Promise<IFormItemData>;
|
|
110
|
+
ensureFormByProduct: (params: IEnsureFormByProductParams) => Promise<IFormItemData | null>;
|
|
111
|
+
addFormRecord: (params: IAddFormRecordParams) => Promise<IFormRecord>;
|
|
112
|
+
appendFormRecord: (params: IAppendFormRecordParams) => IFormRecord;
|
|
113
|
+
removeFormRecord: (formId: number | string, formRecordId: number) => void;
|
|
114
|
+
clearFormData: (formId?: number | string) => void;
|
|
115
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProductData } from '../Product/types';
|
|
2
|
+
import { IHolderConfig } from './types';
|
|
3
|
+
export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
|
|
4
|
+
export declare function getFormIdFromHolderConfig(config: IHolderConfig): string;
|
|
5
|
+
export declare function normalizeFormId(formId: number | string): string;
|
|
6
|
+
export declare function createEmptyFormItemData(): {
|
|
7
|
+
records: any[];
|
|
8
|
+
form: Record<string, any>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 String(config === null || config === void 0 ? void 0 : config.resource_id);
|
|
11
|
+
}
|
|
12
|
+
export function normalizeFormId(formId) {
|
|
13
|
+
return String(formId);
|
|
14
|
+
}
|
|
15
|
+
export function createEmptyFormItemData() {
|
|
16
|
+
return {
|
|
17
|
+
records: [],
|
|
18
|
+
form: {}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -210,6 +210,13 @@ export interface ProductData {
|
|
|
210
210
|
option_group_count: number;
|
|
211
211
|
/** 服务时长 */
|
|
212
212
|
service_times?: any;
|
|
213
|
+
/** holder 表单配置 */
|
|
214
|
+
holder_config?: {
|
|
215
|
+
required?: number;
|
|
216
|
+
resource_id?: number;
|
|
217
|
+
status?: string;
|
|
218
|
+
[key: string]: any;
|
|
219
|
+
};
|
|
213
220
|
}
|
|
214
221
|
/**
|
|
215
222
|
* 商品媒体信息接口
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
+
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
13
14
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
14
15
|
protected defaultName: string;
|
|
15
16
|
protected defaultVersion: string;
|
|
@@ -126,6 +127,14 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
126
127
|
* @param params
|
|
127
128
|
*/
|
|
128
129
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* 获取 holder 表单 map
|
|
132
|
+
*/
|
|
133
|
+
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
+
/**
|
|
135
|
+
* 添加表单记录
|
|
136
|
+
*/
|
|
137
|
+
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
129
138
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
130
139
|
clearDateRange(): void;
|
|
131
140
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -118,7 +118,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
118
118
|
this.otherData = ((_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 || (_data$this$otherParam = _data$this$otherParam[this.name]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam['otherData']) || {};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
|
|
121
|
+
moduleArr = ['accountList', 'holder', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
|
|
122
122
|
moduleArr.forEach(function (step) {
|
|
123
123
|
var targetModule = createModule(step, _this2.name);
|
|
124
124
|
if (targetModule) {
|
|
@@ -644,8 +644,27 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
644
644
|
return _fetchHolderAccountsAsync.apply(this, arguments);
|
|
645
645
|
}
|
|
646
646
|
return fetchHolderAccountsAsync;
|
|
647
|
-
}()
|
|
647
|
+
}()
|
|
648
|
+
/**
|
|
649
|
+
* 获取 holder 表单 map
|
|
650
|
+
*/
|
|
648
651
|
)
|
|
652
|
+
}, {
|
|
653
|
+
key: "getHolderFormMap",
|
|
654
|
+
value: function getHolderFormMap() {
|
|
655
|
+
return this.store.holder.getHolderFormMap();
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* 添加表单记录
|
|
660
|
+
*/
|
|
661
|
+
}, {
|
|
662
|
+
key: "appendFormRecord",
|
|
663
|
+
value: function appendFormRecord(params) {
|
|
664
|
+
return this.store.holder.appendFormRecord(params);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// 设置日期范围,注入到日期模块中
|
|
649
668
|
}, {
|
|
650
669
|
key: "setDateRange",
|
|
651
670
|
value: function () {
|
|
@@ -1193,6 +1212,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1193
1212
|
account = activeAccount;
|
|
1194
1213
|
}
|
|
1195
1214
|
}
|
|
1215
|
+
try {
|
|
1216
|
+
var _account;
|
|
1217
|
+
this.store.holder.ensureFormByProduct({
|
|
1218
|
+
product: productData,
|
|
1219
|
+
customer_id: (_account = account) !== null && _account !== void 0 && _account.id ? Number(account.id) : 16121,
|
|
1220
|
+
shop_id: (productData === null || productData === void 0 ? void 0 : productData.shop_id) || '',
|
|
1221
|
+
useCache: true
|
|
1222
|
+
});
|
|
1223
|
+
} catch (error) {
|
|
1224
|
+
console.error('[BookingByStep] 加载 holder 表单失败', error);
|
|
1225
|
+
}
|
|
1196
1226
|
var flag = this.store.cart.mergeCartItemByRowKey({
|
|
1197
1227
|
rowKey: rowKey,
|
|
1198
1228
|
quantity: quantity,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -16,6 +16,7 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
+
holder: HolderModule;
|
|
19
20
|
}
|
|
20
21
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
21
22
|
export declare enum BookingByStepHooks {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from "../../modules";
|
|
1
|
+
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from "../../modules";
|
|
2
2
|
export function createModule(moduleName, solutionName, name, version) {
|
|
3
3
|
switch (moduleName) {
|
|
4
4
|
case 'cart':
|
|
@@ -23,6 +23,8 @@ export function createModule(moduleName, solutionName, name, version) {
|
|
|
23
23
|
return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
24
24
|
case 'scanOrderLogger':
|
|
25
25
|
return new ScanOrderLoggerModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
26
|
+
case 'holder':
|
|
27
|
+
return new HolderModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
26
28
|
default:
|
|
27
29
|
throw new Error("Unknown module type: ".concat(moduleName));
|
|
28
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
|
|
3
|
+
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult, ScanOrderTempOrder } from './types';
|
|
4
4
|
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
5
5
|
import type { Discount } from '../../modules/Discount/types';
|
|
6
6
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
@@ -69,7 +69,7 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
69
69
|
passed: boolean | null;
|
|
70
70
|
failures: QuantityCheckResult[];
|
|
71
71
|
};
|
|
72
|
-
getTempOrder():
|
|
72
|
+
getTempOrder(): ScanOrderTempOrder | null;
|
|
73
73
|
updateTempOrderNote(note: string): string;
|
|
74
74
|
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
75
|
service_type: 'dine_in';
|
|
@@ -77,8 +77,8 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
77
77
|
};
|
|
78
78
|
setPickupRef(buzzer: string): string;
|
|
79
79
|
private ensureTempOrder;
|
|
80
|
-
addNewOrder(): Promise<
|
|
81
|
-
restoreOrder(): Promise<
|
|
80
|
+
addNewOrder(): Promise<ScanOrderTempOrder>;
|
|
81
|
+
restoreOrder(): Promise<ScanOrderTempOrder>;
|
|
82
82
|
getOrderProducts(): ScanOrderOrderProduct[];
|
|
83
83
|
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
84
84
|
getDiscountList(): Discount[];
|
|
@@ -92,6 +92,7 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
92
92
|
}): Promise<void>;
|
|
93
93
|
private findReservationRuleResource;
|
|
94
94
|
private buildScanOrderResourceMetadata;
|
|
95
|
+
private prepareRetailAvailability;
|
|
95
96
|
private buildSubmitPayloadEnhancer;
|
|
96
97
|
submitScanOrder<T = any>(): Promise<T>;
|
|
97
98
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
@@ -118,7 +119,7 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
118
119
|
private normalizeResourceState;
|
|
119
120
|
private resolveResourceSelectType;
|
|
120
121
|
private fetchResourceOccupyDetailByResourceId;
|
|
121
|
-
checkResourceAvailable(resourceId
|
|
122
|
+
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
122
123
|
getAdditionalOrderInfo(): Promise<{
|
|
123
124
|
orderId: string;
|
|
124
125
|
orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
|