@pisell/pisellos 0.10.19 → 0.10.21
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/OpenData/index.d.ts +10 -1
- package/dist/modules/OpenData/index.js +268 -14
- package/dist/modules/OpenData/types.d.ts +14 -1
- package/dist/modules/OpenData/utils.d.ts +6 -0
- package/dist/modules/OpenData/utils.js +50 -5
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/plugins/request.d.ts +2 -1
- package/dist/plugins/request.js +4 -2
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +80 -41
- package/dist/server/utils/small-ticket.js +52 -0
- package/dist/solution/BaseSales/index.js +23 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/BookingTicket/index.js +25 -18
- package/dist/solution/Sales/index.js +29 -22
- package/dist/solution/UnifiedBookingSales/index.js +25 -18
- package/lib/modules/OpenData/index.d.ts +10 -1
- package/lib/modules/OpenData/index.js +170 -3
- package/lib/modules/OpenData/types.d.ts +14 -1
- package/lib/modules/OpenData/utils.d.ts +6 -0
- package/lib/modules/OpenData/utils.js +40 -5
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/plugins/request.d.ts +2 -1
- package/lib/plugins/request.js +3 -2
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +47 -11
- package/lib/server/utils/small-ticket.js +52 -0
- package/lib/solution/BaseSales/index.js +21 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/BookingTicket/index.js +3 -0
- package/lib/solution/Sales/index.js +3 -0
- package/lib/solution/UnifiedBookingSales/index.js +3 -0
- package/package.json +1 -1
|
@@ -87,6 +87,58 @@ const LABELS = {
|
|
|
87
87
|
rounding: '抹零',
|
|
88
88
|
gross: '重量',
|
|
89
89
|
tare: '去皮'
|
|
90
|
+
},
|
|
91
|
+
ja: {
|
|
92
|
+
contactName: '連絡先名',
|
|
93
|
+
contactMobile: '連絡先電話',
|
|
94
|
+
email: 'メール',
|
|
95
|
+
dineIn: '店内飲食',
|
|
96
|
+
takeAway: 'テイクアウト',
|
|
97
|
+
delivery: '配達',
|
|
98
|
+
pickUp: '受け取り',
|
|
99
|
+
shopService: '店内飲食',
|
|
100
|
+
pickUpTime: '受取時間',
|
|
101
|
+
asap: 'できるだけ早く',
|
|
102
|
+
cash: '現金',
|
|
103
|
+
eftpos: 'カード',
|
|
104
|
+
wallet: 'ウォレット',
|
|
105
|
+
giftCard: 'ギフトカード',
|
|
106
|
+
remainingAmount: '残高',
|
|
107
|
+
redeemPoints: '利用ポイント',
|
|
108
|
+
remainingPoints: '残りポイント',
|
|
109
|
+
table: 'テーブル',
|
|
110
|
+
orderDiscount: '注文割引',
|
|
111
|
+
manualDiscount: '手動割引',
|
|
112
|
+
payProcessingFee: '決済手数料',
|
|
113
|
+
rounding: '端数調整',
|
|
114
|
+
gross: '総重量',
|
|
115
|
+
tare: '風袋'
|
|
116
|
+
},
|
|
117
|
+
pt: {
|
|
118
|
+
contactName: 'Nome de contato',
|
|
119
|
+
contactMobile: 'Celular de contato',
|
|
120
|
+
email: 'e-mail',
|
|
121
|
+
dineIn: 'Consumo no local',
|
|
122
|
+
takeAway: 'Para levar',
|
|
123
|
+
delivery: 'Entrega',
|
|
124
|
+
pickUp: 'Recolha',
|
|
125
|
+
shopService: 'Consumo no local',
|
|
126
|
+
pickUpTime: 'Hora de recolha',
|
|
127
|
+
asap: 'Assim que possível',
|
|
128
|
+
cash: 'Dinheiro',
|
|
129
|
+
eftpos: 'Cartão',
|
|
130
|
+
wallet: 'Carteira',
|
|
131
|
+
giftCard: 'Cartão-presente',
|
|
132
|
+
remainingAmount: 'Saldo restante',
|
|
133
|
+
redeemPoints: 'Pontos utilizados',
|
|
134
|
+
remainingPoints: 'Pontos restantes',
|
|
135
|
+
table: 'Mesa',
|
|
136
|
+
orderDiscount: 'Desconto do pedido',
|
|
137
|
+
manualDiscount: 'Desconto manual',
|
|
138
|
+
payProcessingFee: 'Taxa de processamento',
|
|
139
|
+
rounding: 'Arredondamento',
|
|
140
|
+
gross: 'Peso bruto',
|
|
141
|
+
tare: 'Tara'
|
|
90
142
|
}
|
|
91
143
|
};
|
|
92
144
|
function buildSmallTicketData(params) {
|
|
@@ -257,6 +257,22 @@ function normalizeBaseSalesRecordCollections(sourceRecord, options) {
|
|
|
257
257
|
}
|
|
258
258
|
return normalizedRecord;
|
|
259
259
|
}
|
|
260
|
+
function isValidBaseSalesSmallTicketDataSnapshot(value) {
|
|
261
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
262
|
+
const localeSnapshots = Object.values(value);
|
|
263
|
+
return localeSnapshots.length > 0 && localeSnapshots.some(localeSnapshot => localeSnapshot !== null && typeof localeSnapshot === 'object' && !Array.isArray(localeSnapshot));
|
|
264
|
+
}
|
|
265
|
+
function mergeBaseSalesSmallTicketDataSnapshot(currentValue, loadedValue) {
|
|
266
|
+
if (isValidBaseSalesSmallTicketDataSnapshot(loadedValue)) {
|
|
267
|
+
return (0, _lodashEs.cloneDeep)(loadedValue);
|
|
268
|
+
}
|
|
269
|
+
if (isValidBaseSalesSmallTicketDataSnapshot(currentValue)) {
|
|
270
|
+
return (0, _lodashEs.cloneDeep)(currentValue);
|
|
271
|
+
}
|
|
272
|
+
if (loadedValue !== undefined) return (0, _lodashEs.cloneDeep)(loadedValue);
|
|
273
|
+
if (currentValue !== undefined) return (0, _lodashEs.cloneDeep)(currentValue);
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
260
276
|
function getBaseSalesMetadataUid(item, metadataKey) {
|
|
261
277
|
const uid = item?.metadata?.[metadataKey] ?? item?.[metadataKey];
|
|
262
278
|
if (uid === undefined || uid === null || uid === '') return null;
|
|
@@ -296,6 +312,11 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
296
312
|
});
|
|
297
313
|
const uidRemaps = [];
|
|
298
314
|
const mergedRecord = (0, _lodashEs.mergeWith)(normalizedCurrentTempOrder, normalizedLoadedRecord, (currentValue, loadedValue, key) => {
|
|
315
|
+
// small_ticket_data 是由 Server 一次性生成的完整展示快照,不能递归进入
|
|
316
|
+
// locale 内部继续套用订单集合或普通数组的合并规则。
|
|
317
|
+
if (key === 'small_ticket_data') {
|
|
318
|
+
return mergeBaseSalesSmallTicketDataSnapshot(currentValue, loadedValue);
|
|
319
|
+
}
|
|
299
320
|
const collectionKind = getBaseSalesOrderCollectionKind(key);
|
|
300
321
|
if (collectionKind && Array.isArray(loadedValue)) {
|
|
301
322
|
return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -458,7 +458,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
458
458
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
459
459
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
460
460
|
*/
|
|
461
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
461
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
462
|
+
action: "reloadCatalog";
|
|
463
|
+
} | {
|
|
464
|
+
action: "add";
|
|
465
|
+
cacheItem: any;
|
|
466
|
+
} | {
|
|
467
|
+
action: "requiresDetail";
|
|
468
|
+
payload: AddProductRequiresDetailPayload;
|
|
469
|
+
} | {
|
|
470
|
+
action: "requiresBookingEdit";
|
|
471
|
+
cacheItem: any;
|
|
472
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
473
|
+
};
|
|
462
474
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
463
475
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
464
476
|
/**
|
|
@@ -221,6 +221,9 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
221
221
|
const lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
222
222
|
const cachedData = this.store.openData.getOpenData();
|
|
223
223
|
if (cachedData && this.openDataTarget === target && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL) {
|
|
224
|
+
if (typeof this.store.openData.ensureInvoiceTemplateSettings === 'function') {
|
|
225
|
+
await this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
226
|
+
}
|
|
224
227
|
this.otherParams.openData = cachedData;
|
|
225
228
|
return cachedData;
|
|
226
229
|
}
|
|
@@ -182,6 +182,9 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
182
182
|
const cachedData = this.invoiceOpenDataModule.getOpenData();
|
|
183
183
|
const lastFetchedAt = this.invoiceOpenDataModule.getLastFetchedAt();
|
|
184
184
|
if (cachedData && this.invoiceOpenDataTarget === target && typeof lastFetchedAt === 'number' && Date.now() - lastFetchedAt < INVOICE_OPEN_DATA_CACHE_TTL) {
|
|
185
|
+
if (typeof this.invoiceOpenDataModule.ensureInvoiceTemplateSettings === 'function') {
|
|
186
|
+
await this.invoiceOpenDataModule.ensureInvoiceTemplateSettings(target);
|
|
187
|
+
}
|
|
185
188
|
return cachedData;
|
|
186
189
|
}
|
|
187
190
|
if (this.invoiceOpenDataInFlight) {
|
|
@@ -1479,6 +1479,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1479
1479
|
const cachedData = this.store.openData.getOpenData();
|
|
1480
1480
|
const lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
1481
1481
|
if (!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL) {
|
|
1482
|
+
if (typeof this.store.openData.ensureInvoiceTemplateSettings === 'function') {
|
|
1483
|
+
await this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
1484
|
+
}
|
|
1482
1485
|
return cachedData;
|
|
1483
1486
|
}
|
|
1484
1487
|
if (this.loadOpenDataInFlight) {
|