@pisell/pisellos 2.2.325 → 2.2.327
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 +0 -9
- package/dist/model/strategy/adapter/walletPass/locales.js +9 -0
- package/dist/modules/OpenData/index.d.ts +8 -1
- package/dist/modules/OpenData/index.js +276 -95
- package/dist/modules/Payment/utils.d.ts +2 -0
- package/dist/modules/Payment/utils.js +6 -6
- package/dist/modules/Payment/walletpass.d.ts +2 -0
- package/dist/modules/Payment/walletpass.js +75 -34
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +883 -611
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +51 -51
- package/dist/server/modules/products/index.d.ts +6 -2
- package/dist/server/modules/products/index.js +476 -400
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +6 -5
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -1
- package/dist/solution/Sales/index.d.ts +2 -5
- package/dist/solution/Sales/index.js +117 -143
- package/dist/solution/Sales/types.d.ts +6 -0
- package/dist/solution/Sales/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.js +34 -23
- package/lib/model/strategy/adapter/walletPass/locales.js +9 -0
- package/lib/modules/OpenData/index.d.ts +8 -1
- package/lib/modules/OpenData/index.js +123 -21
- package/lib/modules/Payment/utils.d.ts +2 -0
- package/lib/modules/Payment/utils.js +7 -7
- package/lib/modules/Payment/walletpass.d.ts +2 -0
- package/lib/modules/Payment/walletpass.js +42 -11
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +164 -22
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +4 -3
- package/lib/server/modules/products/index.d.ts +6 -2
- package/lib/server/modules/products/index.js +40 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -1
- package/lib/solution/Sales/index.d.ts +2 -5
- package/lib/solution/Sales/index.js +32 -66
- package/lib/solution/Sales/types.d.ts +6 -0
- package/lib/solution/Sales/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.js +3 -2
- package/package.json +1 -1
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 | 2 | 1 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -630,7 +630,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
630
630
|
value: function () {
|
|
631
631
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
632
632
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
633
|
-
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
|
|
633
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9, _openDataConfig10;
|
|
634
634
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
635
635
|
while (1) switch (_context10.prev = _context10.next) {
|
|
636
636
|
case 0:
|
|
@@ -686,12 +686,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
686
686
|
return idGenerator.configure({
|
|
687
687
|
biz: businessCode,
|
|
688
688
|
config: {
|
|
689
|
+
enableShortNumber: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.enable_short_number']) !== false,
|
|
689
690
|
prefix: prefix,
|
|
690
691
|
deviceCode: deviceId,
|
|
691
|
-
padReceiptSequence: ((
|
|
692
|
+
padReceiptSequence: ((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.pad_with_leading_zeros']) === true,
|
|
692
693
|
receiptSequenceLength: receiptSequenceLength,
|
|
693
|
-
receiptSequenceMax: this.normalizeShortNumberMaximum((
|
|
694
|
-
randomReceiptSequence: ((
|
|
694
|
+
receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.maximum_number']),
|
|
695
|
+
randomReceiptSequence: ((_openDataConfig10 = openDataConfig) === null || _openDataConfig10 === void 0 ? void 0 : _openDataConfig10['sale.short_number_random']) === true,
|
|
695
696
|
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
696
697
|
receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
|
|
697
698
|
receiptSequenceStart: receiptSequenceStart,
|
|
@@ -3498,7 +3499,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3498
3499
|
_context44.next = 9;
|
|
3499
3500
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3500
3501
|
case 9:
|
|
3501
|
-
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3502
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || Object.prototype.hasOwnProperty.call(params !== null && params !== void 0 ? params : {}, 'openData'))) {
|
|
3502
3503
|
_context44.next = 12;
|
|
3503
3504
|
break;
|
|
3504
3505
|
}
|
|
@@ -474,7 +474,7 @@ function _applyGlobalScan() {
|
|
|
474
474
|
case 15:
|
|
475
475
|
// 已识别为 Wallet 支付资产但当前不可用:保留禁用展示,不回退优惠码。
|
|
476
476
|
if (!bindResult.resolveFailed) {
|
|
477
|
-
bridge === null || bridge === void 0 || (_bridge$onNotify11 = bridge.onNotify) === null || _bridge$onNotify11 === void 0 || _bridge$onNotify11.call(bridge, 'fail', 'pisell2.text.goodpass.code-invalid-cart');
|
|
477
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify11 = bridge.onNotify) === null || _bridge$onNotify11 === void 0 || _bridge$onNotify11.call(bridge, 'fail', walletResult.asset.reasonCode === 'empty_cart' ? 'pisell2.sale-detail.promotion-panel.add-items-first' : 'pisell2.text.goodpass.code-invalid-cart');
|
|
478
478
|
}
|
|
479
479
|
return _context5.abrupt("return", {
|
|
480
480
|
status: 'failed',
|
|
@@ -2,7 +2,7 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
3
3
|
import { BaseModule } from '../../modules/BaseModule';
|
|
4
4
|
import type { RequestPlugin } from '../../plugins/request';
|
|
5
|
-
import { SalesState, SalesModuleAPI, Reservation, SalesResourceBookingItem, SalesResourceBookingItemWithGroups, SalesTimelineHighlights, ChangeBookingStatusParams, GetResourceBookingItemParams, SalesPrintLocalOrderReceiptOptions } from './types';
|
|
5
|
+
import { SalesState, SalesModuleAPI, Reservation, SalesResourceBookingItem, SalesResourceBookingItemWithGroups, SalesTimelineHighlights, ChangeBookingStatusParams, GetResourceBookingItemParams, SalesPrintLocalOrderReceiptOptions, CloudOrderInvoiceRequest } from './types';
|
|
6
6
|
import type { BookingData } from '../../server/modules/order/types';
|
|
7
7
|
export * from './types';
|
|
8
8
|
/**
|
|
@@ -27,9 +27,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
27
27
|
protected request: RequestPlugin;
|
|
28
28
|
private logger;
|
|
29
29
|
private invoiceOpenDataModule;
|
|
30
|
-
private invoiceOpenDataTarget;
|
|
31
|
-
private invoiceOpenDataInFlight;
|
|
32
|
-
private invoiceOpenDataInFlightTarget;
|
|
33
30
|
constructor(name?: string, version?: string);
|
|
34
31
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
35
32
|
/** 获取当前 store 快照 */
|
|
@@ -51,10 +48,10 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
51
48
|
* Legacy Sales 的系统上下文没有可打印的 system target,因此统一回退 pos。
|
|
52
49
|
*/
|
|
53
50
|
private getInvoiceSalesChannel;
|
|
54
|
-
private loadInvoiceOpenData;
|
|
55
51
|
private logInvoiceOpenDataFallback;
|
|
56
52
|
private resolveInvoiceConfigs;
|
|
57
53
|
printLocalOrderReceipt<T = any>(lookup: string | number, options: SalesPrintLocalOrderReceiptOptions): Promise<T>;
|
|
54
|
+
printCloudOrderInvoice(input: CloudOrderInvoiceRequest): Promise<void>;
|
|
58
55
|
/** 清除独立 Documents 缓存;下一次打印会按当前 target 重新获取。 */
|
|
59
56
|
clearOpenDataCache(): void;
|
|
60
57
|
destroy(): Promise<void>;
|
|
@@ -29,12 +29,9 @@ import dayjs from 'dayjs';
|
|
|
29
29
|
import { cloneDeep } from 'lodash-es';
|
|
30
30
|
import { BaseModule } from "../../modules/BaseModule";
|
|
31
31
|
import { SalesHooks } from "./types";
|
|
32
|
-
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, OpenDataModule } from "../../modules/OpenData";
|
|
32
|
+
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, OpenDataModule, normalizeInvoiceLayoutFromTemplateSettings } from "../../modules/OpenData";
|
|
33
33
|
export * from "./types";
|
|
34
34
|
var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
|
|
35
|
-
var INVOICE_OPEN_DATA_SECTION_CODES = ['documents'];
|
|
36
|
-
var INVOICE_OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
37
|
-
|
|
38
35
|
/**
|
|
39
36
|
* Sales 解决方案基础骨架
|
|
40
37
|
*
|
|
@@ -64,9 +61,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
64
61
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
65
62
|
// LoggerManager 实例
|
|
66
63
|
_defineProperty(_assertThisInitialized(_this), "invoiceOpenDataModule", null);
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "invoiceOpenDataTarget", null);
|
|
68
|
-
_defineProperty(_assertThisInitialized(_this), "invoiceOpenDataInFlight", null);
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "invoiceOpenDataInFlightTarget", null);
|
|
70
64
|
return _this;
|
|
71
65
|
}
|
|
72
66
|
_createClass(SalesImpl, [{
|
|
@@ -110,9 +104,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
110
104
|
// 在这里补充从 Server/Order 读取 currentDay 原始数据并转换为预约列表。
|
|
111
105
|
|
|
112
106
|
this.logger = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp().logger;
|
|
113
|
-
this.invoiceOpenDataTarget = null;
|
|
114
|
-
this.invoiceOpenDataInFlight = null;
|
|
115
|
-
this.invoiceOpenDataInFlightTarget = null;
|
|
116
107
|
this.invoiceOpenDataModule = new OpenDataModule("".concat(this.name, "_invoiceOpenData"));
|
|
117
108
|
this.core.registerModule(this.invoiceOpenDataModule, {
|
|
118
109
|
initialState: {},
|
|
@@ -122,9 +113,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
122
113
|
platform: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform
|
|
123
114
|
}
|
|
124
115
|
});
|
|
125
|
-
_context.next =
|
|
116
|
+
_context.next = 15;
|
|
126
117
|
return this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
127
|
-
case
|
|
118
|
+
case 15:
|
|
128
119
|
case "end":
|
|
129
120
|
return _context.stop();
|
|
130
121
|
}
|
|
@@ -259,93 +250,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
259
250
|
var normalized = String((_ref = channel !== null && channel !== void 0 ? channel : contextChannel) !== null && _ref !== void 0 ? _ref : '').trim();
|
|
260
251
|
return !normalized || normalized === 'system' ? 'pos' : normalized;
|
|
261
252
|
}
|
|
262
|
-
}, {
|
|
263
|
-
key: "loadInvoiceOpenData",
|
|
264
|
-
value: function () {
|
|
265
|
-
var _loadInvoiceOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessCode, channel) {
|
|
266
|
-
var target, cachedData, lastFetchedAt, request, openData;
|
|
267
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
268
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
269
|
-
case 0:
|
|
270
|
-
if (this.invoiceOpenDataModule) {
|
|
271
|
-
_context4.next = 2;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
throw new Error('Sales Invoice OpenData 模块未初始化');
|
|
275
|
-
case 2:
|
|
276
|
-
target = "".concat(businessCode, "+").concat(channel);
|
|
277
|
-
cachedData = this.invoiceOpenDataModule.getOpenData();
|
|
278
|
-
lastFetchedAt = this.invoiceOpenDataModule.getLastFetchedAt();
|
|
279
|
-
if (!(cachedData && this.invoiceOpenDataTarget === target && typeof lastFetchedAt === 'number' && Date.now() - lastFetchedAt < INVOICE_OPEN_DATA_CACHE_TTL)) {
|
|
280
|
-
_context4.next = 10;
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
if (!(typeof this.invoiceOpenDataModule.ensureInvoiceTemplateSettings === 'function')) {
|
|
284
|
-
_context4.next = 9;
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
_context4.next = 9;
|
|
288
|
-
return this.invoiceOpenDataModule.ensureInvoiceTemplateSettings(target);
|
|
289
|
-
case 9:
|
|
290
|
-
return _context4.abrupt("return", cachedData);
|
|
291
|
-
case 10:
|
|
292
|
-
if (!this.invoiceOpenDataInFlight) {
|
|
293
|
-
_context4.next = 21;
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
if (!(this.invoiceOpenDataInFlightTarget === target)) {
|
|
297
|
-
_context4.next = 13;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
return _context4.abrupt("return", this.invoiceOpenDataInFlight);
|
|
301
|
-
case 13:
|
|
302
|
-
_context4.prev = 13;
|
|
303
|
-
_context4.next = 16;
|
|
304
|
-
return this.invoiceOpenDataInFlight;
|
|
305
|
-
case 16:
|
|
306
|
-
_context4.next = 20;
|
|
307
|
-
break;
|
|
308
|
-
case 18:
|
|
309
|
-
_context4.prev = 18;
|
|
310
|
-
_context4.t0 = _context4["catch"](13);
|
|
311
|
-
case 20:
|
|
312
|
-
return _context4.abrupt("return", this.loadInvoiceOpenData(businessCode, channel));
|
|
313
|
-
case 21:
|
|
314
|
-
request = this.invoiceOpenDataModule.fetchOpenData({
|
|
315
|
-
scope: 'board',
|
|
316
|
-
target: target,
|
|
317
|
-
section_code: [].concat(INVOICE_OPEN_DATA_SECTION_CODES)
|
|
318
|
-
});
|
|
319
|
-
this.invoiceOpenDataInFlight = request;
|
|
320
|
-
this.invoiceOpenDataInFlightTarget = target;
|
|
321
|
-
_context4.prev = 24;
|
|
322
|
-
_context4.next = 27;
|
|
323
|
-
return request;
|
|
324
|
-
case 27:
|
|
325
|
-
openData = _context4.sent;
|
|
326
|
-
// clearOpenDataCache() 或后续请求接管后,旧响应不得复活 target 归属。
|
|
327
|
-
if (this.invoiceOpenDataInFlight === request) {
|
|
328
|
-
this.invoiceOpenDataTarget = target;
|
|
329
|
-
}
|
|
330
|
-
return _context4.abrupt("return", openData);
|
|
331
|
-
case 30:
|
|
332
|
-
_context4.prev = 30;
|
|
333
|
-
if (this.invoiceOpenDataInFlight === request) {
|
|
334
|
-
this.invoiceOpenDataInFlight = null;
|
|
335
|
-
this.invoiceOpenDataInFlightTarget = null;
|
|
336
|
-
}
|
|
337
|
-
return _context4.finish(30);
|
|
338
|
-
case 33:
|
|
339
|
-
case "end":
|
|
340
|
-
return _context4.stop();
|
|
341
|
-
}
|
|
342
|
-
}, _callee4, this, [[13, 18], [24,, 30, 33]]);
|
|
343
|
-
}));
|
|
344
|
-
function loadInvoiceOpenData(_x4, _x5) {
|
|
345
|
-
return _loadInvoiceOpenData.apply(this, arguments);
|
|
346
|
-
}
|
|
347
|
-
return loadInvoiceOpenData;
|
|
348
|
-
}()
|
|
349
253
|
}, {
|
|
350
254
|
key: "logInvoiceOpenDataFallback",
|
|
351
255
|
value: function logInvoiceOpenDataFallback(error) {
|
|
@@ -366,43 +270,41 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
366
270
|
}, {
|
|
367
271
|
key: "resolveInvoiceConfigs",
|
|
368
272
|
value: function () {
|
|
369
|
-
var _resolveInvoiceConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
370
|
-
var
|
|
371
|
-
return _regeneratorRuntime().wrap(function
|
|
372
|
-
while (1) switch (
|
|
273
|
+
var _resolveInvoiceConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessCode, channel) {
|
|
274
|
+
var templateSettings;
|
|
275
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
276
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
373
277
|
case 0:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
case 3:
|
|
378
|
-
if (!(this.invoiceOpenDataTarget !== "".concat(businessCode, "+").concat(channel))) {
|
|
379
|
-
_context5.next = 5;
|
|
278
|
+
_context4.prev = 0;
|
|
279
|
+
if (this.invoiceOpenDataModule) {
|
|
280
|
+
_context4.next = 3;
|
|
380
281
|
break;
|
|
381
282
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
283
|
+
throw new Error('Sales Invoice OpenData 模块未初始化');
|
|
284
|
+
case 3:
|
|
285
|
+
_context4.next = 5;
|
|
286
|
+
return this.invoiceOpenDataModule.loadPrintInvoiceTemplate("".concat(businessCode, "+").concat(channel), 'manual');
|
|
386
287
|
case 5:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
288
|
+
templateSettings = _context4.sent;
|
|
289
|
+
return _context4.abrupt("return", {
|
|
290
|
+
invoice: normalizeInvoiceLayoutFromTemplateSettings(templateSettings),
|
|
291
|
+
templateSettings: templateSettings
|
|
390
292
|
});
|
|
391
|
-
case
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
this.logInvoiceOpenDataFallback(
|
|
395
|
-
return
|
|
293
|
+
case 9:
|
|
294
|
+
_context4.prev = 9;
|
|
295
|
+
_context4.t0 = _context4["catch"](0);
|
|
296
|
+
this.logInvoiceOpenDataFallback(_context4.t0);
|
|
297
|
+
return _context4.abrupt("return", {
|
|
396
298
|
invoice: getDefaultInvoiceLayoutConfig(),
|
|
397
299
|
templateSettings: getDefaultInvoiceTemplateSettings()
|
|
398
300
|
});
|
|
399
|
-
case
|
|
301
|
+
case 13:
|
|
400
302
|
case "end":
|
|
401
|
-
return
|
|
303
|
+
return _context4.stop();
|
|
402
304
|
}
|
|
403
|
-
},
|
|
305
|
+
}, _callee4, this, [[0, 9]]);
|
|
404
306
|
}));
|
|
405
|
-
function resolveInvoiceConfigs(
|
|
307
|
+
function resolveInvoiceConfigs(_x4, _x5) {
|
|
406
308
|
return _resolveInvoiceConfigs.apply(this, arguments);
|
|
407
309
|
}
|
|
408
310
|
return resolveInvoiceConfigs;
|
|
@@ -410,31 +312,31 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
410
312
|
}, {
|
|
411
313
|
key: "printLocalOrderReceipt",
|
|
412
314
|
value: function () {
|
|
413
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
315
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(lookup, options) {
|
|
414
316
|
var _options$businessCode;
|
|
415
317
|
var normalizedLookup, businessCode, channel, _yield$this$resolveIn, invoice, templateSettings, lookupPayload;
|
|
416
|
-
return _regeneratorRuntime().wrap(function
|
|
417
|
-
while (1) switch (
|
|
318
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
319
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
418
320
|
case 0:
|
|
419
321
|
normalizedLookup = typeof lookup === 'string' ? lookup.trim() : lookup;
|
|
420
322
|
if (!(normalizedLookup === '' || normalizedLookup === null || normalizedLookup === undefined)) {
|
|
421
|
-
|
|
323
|
+
_context5.next = 3;
|
|
422
324
|
break;
|
|
423
325
|
}
|
|
424
326
|
throw new Error('Sales 本地小票打印需要订单标识');
|
|
425
327
|
case 3:
|
|
426
328
|
businessCode = String((_options$businessCode = options === null || options === void 0 ? void 0 : options.businessCode) !== null && _options$businessCode !== void 0 ? _options$businessCode : '').trim();
|
|
427
329
|
if (businessCode) {
|
|
428
|
-
|
|
330
|
+
_context5.next = 6;
|
|
429
331
|
break;
|
|
430
332
|
}
|
|
431
333
|
throw new Error('Sales 本地小票打印需要 businessCode');
|
|
432
334
|
case 6:
|
|
433
335
|
channel = this.getInvoiceSalesChannel(options === null || options === void 0 ? void 0 : options.channel);
|
|
434
|
-
|
|
336
|
+
_context5.next = 9;
|
|
435
337
|
return this.resolveInvoiceConfigs(businessCode, channel);
|
|
436
338
|
case 9:
|
|
437
|
-
_yield$this$resolveIn =
|
|
339
|
+
_yield$this$resolveIn = _context5.sent;
|
|
438
340
|
invoice = _yield$this$resolveIn.invoice;
|
|
439
341
|
templateSettings = _yield$this$resolveIn.templateSettings;
|
|
440
342
|
lookupPayload = typeof normalizedLookup === 'number' ? {
|
|
@@ -442,7 +344,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
442
344
|
} : {
|
|
443
345
|
external_sale_number: normalizedLookup
|
|
444
346
|
};
|
|
445
|
-
return
|
|
347
|
+
return _context5.abrupt("return", this.request.post('/shop/local/print-order', _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
446
348
|
lookup_order_from_db: 1,
|
|
447
349
|
small_ticket_data_flag: 1,
|
|
448
350
|
business_code: businessCode,
|
|
@@ -455,23 +357,95 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
455
357
|
}));
|
|
456
358
|
case 14:
|
|
457
359
|
case "end":
|
|
458
|
-
return
|
|
360
|
+
return _context5.stop();
|
|
459
361
|
}
|
|
460
|
-
},
|
|
362
|
+
}, _callee5, this);
|
|
461
363
|
}));
|
|
462
|
-
function printLocalOrderReceipt(
|
|
364
|
+
function printLocalOrderReceipt(_x6, _x7) {
|
|
463
365
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
464
366
|
}
|
|
465
367
|
return printLocalOrderReceipt;
|
|
368
|
+
}()
|
|
369
|
+
}, {
|
|
370
|
+
key: "printCloudOrderInvoice",
|
|
371
|
+
value: function () {
|
|
372
|
+
var _printCloudOrderInvoice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(input) {
|
|
373
|
+
var _lookup$data;
|
|
374
|
+
var orderId, channel, openData, requestOptions, lookup, businessCode, settings, result;
|
|
375
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
376
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
377
|
+
case 0:
|
|
378
|
+
orderId = input === null || input === void 0 ? void 0 : input.order_id;
|
|
379
|
+
channel = typeof (input === null || input === void 0 ? void 0 : input.channel) === 'string' ? input.channel.trim() : '';
|
|
380
|
+
if (channel) {
|
|
381
|
+
_context6.next = 4;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
throw new Error('Cloud Invoice requires a channel');
|
|
385
|
+
case 4:
|
|
386
|
+
openData = this.invoiceOpenDataModule;
|
|
387
|
+
if (openData) {
|
|
388
|
+
_context6.next = 7;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
throw new Error('Cloud Invoice is not initialized');
|
|
392
|
+
case 7:
|
|
393
|
+
requestOptions = {
|
|
394
|
+
osServer: true,
|
|
395
|
+
customToast: function customToast() {}
|
|
396
|
+
};
|
|
397
|
+
_context6.next = 10;
|
|
398
|
+
return this.request.post('/shop/local/cloud-order-invoice/lookup', {
|
|
399
|
+
order_id: orderId
|
|
400
|
+
}, requestOptions);
|
|
401
|
+
case 10:
|
|
402
|
+
lookup = _context6.sent;
|
|
403
|
+
if (!((lookup === null || lookup === void 0 ? void 0 : lookup.status) !== true || lookup.code !== 200)) {
|
|
404
|
+
_context6.next = 13;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
throw new Error((lookup === null || lookup === void 0 ? void 0 : lookup.message) || 'Cloud Invoice order lookup failed');
|
|
408
|
+
case 13:
|
|
409
|
+
businessCode = (_lookup$data = lookup.data) === null || _lookup$data === void 0 || (_lookup$data = _lookup$data.business_code) === null || _lookup$data === void 0 ? void 0 : _lookup$data.trim();
|
|
410
|
+
if (businessCode) {
|
|
411
|
+
_context6.next = 16;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
throw new Error('Cloud Invoice order has no business_code');
|
|
415
|
+
case 16:
|
|
416
|
+
_context6.next = 18;
|
|
417
|
+
return openData.loadCloudInvoiceTemplate("".concat(businessCode, "+").concat(channel));
|
|
418
|
+
case 18:
|
|
419
|
+
settings = _context6.sent;
|
|
420
|
+
_context6.next = 21;
|
|
421
|
+
return this.request.post('/shop/local/cloud-order-invoice/submit', {
|
|
422
|
+
order_id: orderId,
|
|
423
|
+
business_code: businessCode,
|
|
424
|
+
template_settings: settings
|
|
425
|
+
}, requestOptions);
|
|
426
|
+
case 21:
|
|
427
|
+
result = _context6.sent;
|
|
428
|
+
if (!((result === null || result === void 0 ? void 0 : result.status) !== true || result.code !== 200)) {
|
|
429
|
+
_context6.next = 24;
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
throw new Error((result === null || result === void 0 ? void 0 : result.message) || 'Cloud Invoice dispatch failed');
|
|
433
|
+
case 24:
|
|
434
|
+
case "end":
|
|
435
|
+
return _context6.stop();
|
|
436
|
+
}
|
|
437
|
+
}, _callee6, this);
|
|
438
|
+
}));
|
|
439
|
+
function printCloudOrderInvoice(_x8) {
|
|
440
|
+
return _printCloudOrderInvoice.apply(this, arguments);
|
|
441
|
+
}
|
|
442
|
+
return printCloudOrderInvoice;
|
|
466
443
|
}() /** 清除独立 Documents 缓存;下一次打印会按当前 target 重新获取。 */
|
|
467
444
|
}, {
|
|
468
445
|
key: "clearOpenDataCache",
|
|
469
446
|
value: function clearOpenDataCache() {
|
|
470
|
-
var _this$
|
|
471
|
-
this.
|
|
472
|
-
this.invoiceOpenDataInFlightTarget = null;
|
|
473
|
-
this.invoiceOpenDataTarget = null;
|
|
474
|
-
(_this$invoiceOpenData5 = this.invoiceOpenDataModule) === null || _this$invoiceOpenData5 === void 0 || _this$invoiceOpenData5.clearCache();
|
|
447
|
+
var _this$invoiceOpenData;
|
|
448
|
+
(_this$invoiceOpenData = this.invoiceOpenDataModule) === null || _this$invoiceOpenData === void 0 || _this$invoiceOpenData.clearCache();
|
|
475
449
|
}
|
|
476
450
|
|
|
477
451
|
// -------------------------------------------------------------------------
|
|
@@ -1197,7 +1171,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1197
1171
|
}
|
|
1198
1172
|
}, _callee8, this);
|
|
1199
1173
|
}));
|
|
1200
|
-
function getResourceBookingList(
|
|
1174
|
+
function getResourceBookingList(_x9) {
|
|
1201
1175
|
return _getResourceBookingList.apply(this, arguments);
|
|
1202
1176
|
}
|
|
1203
1177
|
return getResourceBookingList;
|
|
@@ -1320,7 +1294,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1320
1294
|
}
|
|
1321
1295
|
}, _callee9, this);
|
|
1322
1296
|
}));
|
|
1323
|
-
function getResourceBookingItem(
|
|
1297
|
+
function getResourceBookingItem(_x10) {
|
|
1324
1298
|
return _getResourceBookingItem.apply(this, arguments);
|
|
1325
1299
|
}
|
|
1326
1300
|
return getResourceBookingItem;
|
|
@@ -56,6 +56,11 @@ export interface SalesPrintLocalOrderReceiptOptions {
|
|
|
56
56
|
/** 当前销售入口;缺失或为 system 时按 pos 处理。 */
|
|
57
57
|
channel?: string;
|
|
58
58
|
}
|
|
59
|
+
/** Native cloud-order notification. */
|
|
60
|
+
export interface CloudOrderInvoiceRequest {
|
|
61
|
+
order_id: string | number;
|
|
62
|
+
channel: string;
|
|
63
|
+
}
|
|
59
64
|
/**
|
|
60
65
|
* Sales 解决方案状态
|
|
61
66
|
*
|
|
@@ -90,6 +95,7 @@ export interface SalesModuleAPI {
|
|
|
90
95
|
changeBookingStatus: (params: ChangeBookingStatusParams) => Promise<any>;
|
|
91
96
|
/** 按本地订单标识打印小票;本地未命中时由 OS Server 负责远端兜底。 */
|
|
92
97
|
printLocalOrderReceipt: <T = any>(lookup: string | number, options: SalesPrintLocalOrderReceiptOptions) => Promise<T>;
|
|
98
|
+
printCloudOrderInvoice: (request: CloudOrderInvoiceRequest) => Promise<void>;
|
|
93
99
|
/** 清除 Legacy Sales 独立维护的 Documents OpenData 缓存。 */
|
|
94
100
|
clearOpenDataCache: () => void;
|
|
95
101
|
/** 获取资源维度的预约占用列表 */
|
|
@@ -2507,8 +2507,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2507
2507
|
key: "ensureLocalOrderNumbersForCheckout",
|
|
2508
2508
|
value: (function () {
|
|
2509
2509
|
var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
2510
|
-
var _this$otherParams19, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
|
|
2511
|
-
var order, tempOrder, biz, idGenerator;
|
|
2510
|
+
var _this$otherParams19, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2, _idGenerator$getConfi;
|
|
2511
|
+
var order, tempOrder, biz, idGenerator, useLongNumber;
|
|
2512
2512
|
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
2513
2513
|
while (1) switch (_context10.prev = _context10.next) {
|
|
2514
2514
|
case 0:
|
|
@@ -2540,56 +2540,67 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2540
2540
|
throw new Error('当前订单缺少业务类型,无法生成订单编号');
|
|
2541
2541
|
case 11:
|
|
2542
2542
|
idGenerator = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getAp = _this$appPlugin.getApp) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp = _this$appPlugin$getAp.call(_this$appPlugin)) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp2 = _this$appPlugin$getAp.getPlugin) === null || _this$appPlugin$getAp2 === void 0 ? void 0 : _this$appPlugin$getAp2.call(_this$appPlugin$getAp, 'idGenerator');
|
|
2543
|
-
|
|
2544
|
-
|
|
2543
|
+
useLongNumber = (idGenerator === null || idGenerator === void 0 || (_idGenerator$getConfi = idGenerator.getConfig) === null || _idGenerator$getConfi === void 0 || (_idGenerator$getConfi = _idGenerator$getConfi.call(idGenerator, biz)) === null || _idGenerator$getConfi === void 0 ? void 0 : _idGenerator$getConfi.enableShortNumber) === false;
|
|
2544
|
+
if (!(!tempOrder.shop_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateShopOrderNumber) !== 'function' || !tempOrder.shop_full_order_number && !useLongNumber && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateReceiptId) !== 'function')) {
|
|
2545
|
+
_context10.next = 15;
|
|
2545
2546
|
break;
|
|
2546
2547
|
}
|
|
2547
2548
|
throw new Error('订单编号生成器不可用,请重启应用后重试');
|
|
2548
|
-
case
|
|
2549
|
-
_context10.prev =
|
|
2549
|
+
case 15:
|
|
2550
|
+
_context10.prev = 15;
|
|
2550
2551
|
if (tempOrder.shop_order_number) {
|
|
2551
|
-
_context10.next =
|
|
2552
|
+
_context10.next = 20;
|
|
2552
2553
|
break;
|
|
2553
2554
|
}
|
|
2554
|
-
_context10.next =
|
|
2555
|
+
_context10.next = 19;
|
|
2555
2556
|
return idGenerator.generateShopOrderNumber({
|
|
2556
2557
|
biz: biz
|
|
2557
2558
|
});
|
|
2558
|
-
case 18:
|
|
2559
|
-
tempOrder.shop_order_number = _context10.sent;
|
|
2560
2559
|
case 19:
|
|
2560
|
+
tempOrder.shop_order_number = _context10.sent;
|
|
2561
|
+
case 20:
|
|
2561
2562
|
if (tempOrder.shop_full_order_number) {
|
|
2562
|
-
_context10.next =
|
|
2563
|
+
_context10.next = 29;
|
|
2563
2564
|
break;
|
|
2564
2565
|
}
|
|
2565
|
-
|
|
2566
|
+
if (!useLongNumber) {
|
|
2567
|
+
_context10.next = 25;
|
|
2568
|
+
break;
|
|
2569
|
+
}
|
|
2570
|
+
_context10.t0 = tempOrder.shop_order_number;
|
|
2571
|
+
_context10.next = 28;
|
|
2572
|
+
break;
|
|
2573
|
+
case 25:
|
|
2574
|
+
_context10.next = 27;
|
|
2566
2575
|
return idGenerator.generateReceiptId({
|
|
2567
2576
|
biz: biz
|
|
2568
2577
|
});
|
|
2569
|
-
case
|
|
2570
|
-
|
|
2571
|
-
case
|
|
2578
|
+
case 27:
|
|
2579
|
+
_context10.t0 = _context10.sent;
|
|
2580
|
+
case 28:
|
|
2581
|
+
tempOrder.shop_full_order_number = _context10.t0;
|
|
2582
|
+
case 29:
|
|
2572
2583
|
if (!(order.getTempOrder() !== tempOrder)) {
|
|
2573
|
-
_context10.next =
|
|
2584
|
+
_context10.next = 31;
|
|
2574
2585
|
break;
|
|
2575
2586
|
}
|
|
2576
2587
|
throw new Error('当前订单已切换,请重新发起支付');
|
|
2577
|
-
case
|
|
2588
|
+
case 31:
|
|
2578
2589
|
if (!(!tempOrder.shop_order_number || !tempOrder.shop_full_order_number)) {
|
|
2579
|
-
_context10.next =
|
|
2590
|
+
_context10.next = 33;
|
|
2580
2591
|
break;
|
|
2581
2592
|
}
|
|
2582
2593
|
throw new Error('订单编号生成失败,请重试');
|
|
2583
|
-
case
|
|
2584
|
-
_context10.prev =
|
|
2594
|
+
case 33:
|
|
2595
|
+
_context10.prev = 33;
|
|
2585
2596
|
// 部分生成成功时也保留号码,后续只补仍然缺失的字段。
|
|
2586
2597
|
if (order.getTempOrder() === tempOrder) order.persistTempOrder();
|
|
2587
|
-
return _context10.finish(
|
|
2588
|
-
case
|
|
2598
|
+
return _context10.finish(33);
|
|
2599
|
+
case 36:
|
|
2589
2600
|
case "end":
|
|
2590
2601
|
return _context10.stop();
|
|
2591
2602
|
}
|
|
2592
|
-
}, _callee9, this, [[
|
|
2603
|
+
}, _callee9, this, [[15,, 33, 36]]);
|
|
2593
2604
|
}));
|
|
2594
2605
|
function ensureLocalOrderNumbersForCheckout() {
|
|
2595
2606
|
return _ensureLocalOrderNumbersForCheckout.apply(this, arguments);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.locales = void 0;
|
|
7
7
|
const locales = exports.locales = {
|
|
8
8
|
'zh-CN': {
|
|
9
|
+
'empty_cart': '请先添加商品到购物车',
|
|
9
10
|
'not_meet_the_required_conditions': '未达到使用条件',
|
|
10
11
|
'exceeds_the_maximum_deduction_limit': '超出最大抵扣金额限制',
|
|
11
12
|
'usage_limit_reached': '已达到使用次数上限',
|
|
@@ -17,6 +18,7 @@ const locales = exports.locales = {
|
|
|
17
18
|
'applicable_product_count_not_enough': '至少 {value} 件'
|
|
18
19
|
},
|
|
19
20
|
'en': {
|
|
21
|
+
'empty_cart': 'Add items to the cart first.',
|
|
20
22
|
'not_meet_the_required_conditions': 'Not meet the required conditions.',
|
|
21
23
|
'exceeds_the_maximum_deduction_limit': 'Exceeds the maximum deduction limit.',
|
|
22
24
|
'usage_limit_reached': 'Usage limit reached.',
|
|
@@ -28,6 +30,7 @@ const locales = exports.locales = {
|
|
|
28
30
|
'applicable_product_count_not_enough': 'Min. Qty {value}'
|
|
29
31
|
},
|
|
30
32
|
'zh-HK': {
|
|
33
|
+
'empty_cart': '請先添加商品到購物車',
|
|
31
34
|
'not_meet_the_required_conditions': '未達使用條件',
|
|
32
35
|
'exceeds_the_maximum_deduction_limit': '超出最大抵扣金額限制',
|
|
33
36
|
'usage_limit_reached': '已達使用次數上限',
|
|
@@ -37,5 +40,11 @@ const locales = exports.locales = {
|
|
|
37
40
|
'order_total_amount_not_enough': '滿 {currency}{value} 可用',
|
|
38
41
|
'applicable_product_total_amount_not_enough': '滿 {currency}{value} 可用',
|
|
39
42
|
'applicable_product_count_not_enough': '至少 {value} 件'
|
|
43
|
+
},
|
|
44
|
+
'ja': {
|
|
45
|
+
'empty_cart': '先に商品をカートに追加してください。'
|
|
46
|
+
},
|
|
47
|
+
'pt': {
|
|
48
|
+
'empty_cart': 'Adicione produtos ao carrinho primeiro.'
|
|
40
49
|
}
|
|
41
50
|
};
|