@pisell/pisellos 0.10.52 → 0.10.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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/modules/OpenData/index.js +1 -1
- package/dist/modules/Order/index.js +5 -6
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Schedule/index.js +10 -5
- package/dist/plugins/request.d.ts +3 -0
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2576
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/small-ticket.d.ts +85 -0
- package/dist/shared/receipt/small-ticket.js +2576 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/dist/solution/OrderInvoicePreview/index.js +269 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.js +5 -7
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Schedule/index.js +5 -2
- package/lib/plugins/request.d.ts +3 -0
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2335
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/small-ticket.d.ts +85 -0
- package/lib/shared/receipt/small-ticket.js +2342 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/lib/solution/OrderInvoicePreview/index.js +194 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,3 +10,5 @@ export * from './model';
|
|
|
10
10
|
export { PisellOSCore } from './core';
|
|
11
11
|
import PisellOSCore from './core';
|
|
12
12
|
export default PisellOSCore;
|
|
13
|
+
export * from './shared/receipt/small-ticket';
|
|
14
|
+
export { loadSalesOrderSnapshot } from './shared/sales/loadSalesOrderSnapshot';
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,6 @@ export { PisellOSCore } from "./core";
|
|
|
15
15
|
|
|
16
16
|
// 导出框架主类
|
|
17
17
|
import PisellOSCore from "./core";
|
|
18
|
-
export default PisellOSCore;
|
|
18
|
+
export default PisellOSCore;
|
|
19
|
+
export * from "./shared/receipt/small-ticket";
|
|
20
|
+
export { loadSalesOrderSnapshot } from "./shared/sales/loadSalesOrderSnapshot";
|
|
@@ -132,7 +132,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
132
132
|
key: "shouldSkipInvoiceTemplateDocument",
|
|
133
133
|
value: function shouldSkipInvoiceTemplateDocument() {
|
|
134
134
|
var _this$otherParams;
|
|
135
|
-
return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase() === 'h5';
|
|
135
|
+
return this.otherParams.invoiceDocument !== true && String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase() === 'h5';
|
|
136
136
|
}
|
|
137
137
|
}, {
|
|
138
138
|
key: "fetchOpenData",
|
|
@@ -30,6 +30,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
30
30
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
import { loadSalesOrderSnapshot } from "../../shared/sales/loadSalesOrderSnapshot";
|
|
33
34
|
import { BaseModule } from "../BaseModule";
|
|
34
35
|
import { OrderHooks } from "./types";
|
|
35
36
|
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeOrderMetaList, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, collectPointCardSnapshotCodeCandidates, mergePointCardSnapshotCodes as _mergePointCardSnapshotCodes, buildVirtualCurrencySnapshotFromList, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
@@ -7241,12 +7242,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7241
7242
|
params.forceRemote = false;
|
|
7242
7243
|
}
|
|
7243
7244
|
_context49.next = 6;
|
|
7244
|
-
return this.request
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
forceRemote:
|
|
7248
|
-
} : {}), {
|
|
7249
|
-
osServer: true
|
|
7245
|
+
return loadSalesOrderSnapshot(this.request, {
|
|
7246
|
+
lookup: lookup,
|
|
7247
|
+
transport: 'os-server',
|
|
7248
|
+
forceRemote: params.forceRemote
|
|
7250
7249
|
});
|
|
7251
7250
|
case 6:
|
|
7252
7251
|
res = _context49.sent;
|
|
@@ -20,6 +20,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
20
20
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
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); }
|
|
23
|
+
import { loadPaymentMethods } from "../../shared/payment/loadPaymentMethods";
|
|
23
24
|
import { BaseModule } from "../BaseModule";
|
|
24
25
|
import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
|
|
25
26
|
import { getUniqueId } from "../Cart/utils";
|
|
@@ -367,37 +368,35 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
367
368
|
key: "getPayMethodListAsync",
|
|
368
369
|
value: (function () {
|
|
369
370
|
var _getPayMethodListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
370
|
-
var
|
|
371
|
+
var payMethods;
|
|
371
372
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
372
373
|
while (1) switch (_context3.prev = _context3.next) {
|
|
373
374
|
case 0:
|
|
374
375
|
this.logInfo('Starting getPayMethodListAsync');
|
|
375
376
|
_context3.prev = 1;
|
|
376
377
|
_context3.next = 4;
|
|
377
|
-
return this.request
|
|
378
|
+
return loadPaymentMethods(this.request, {
|
|
379
|
+
transport: 'os-server',
|
|
378
380
|
filterPaymentMethods: true
|
|
379
|
-
}, {
|
|
380
|
-
osServer: true
|
|
381
381
|
});
|
|
382
382
|
case 4:
|
|
383
|
-
|
|
384
|
-
payMethods = (response === null || response === void 0 ? void 0 : response.data) || response || [];
|
|
383
|
+
payMethods = _context3.sent;
|
|
385
384
|
this.logInfo('getPayMethodListAsync completed successfully', {
|
|
386
385
|
payMethods: payMethods
|
|
387
386
|
});
|
|
388
387
|
return _context3.abrupt("return", payMethods);
|
|
389
|
-
case
|
|
390
|
-
_context3.prev =
|
|
388
|
+
case 9:
|
|
389
|
+
_context3.prev = 9;
|
|
391
390
|
_context3.t0 = _context3["catch"](1);
|
|
392
391
|
console.error('[PaymentModule] 获取支付方式列表失败', _context3.t0);
|
|
393
392
|
this.logError('getPayMethodListAsync failed', _context3.t0);
|
|
394
393
|
// 如果所有操作都失败,返回空数组
|
|
395
394
|
return _context3.abrupt("return", []);
|
|
396
|
-
case
|
|
395
|
+
case 14:
|
|
397
396
|
case "end":
|
|
398
397
|
return _context3.stop();
|
|
399
398
|
}
|
|
400
|
-
}, _callee3, this, [[1,
|
|
399
|
+
}, _callee3, this, [[1, 9]]);
|
|
401
400
|
}));
|
|
402
401
|
function getPayMethodListAsync() {
|
|
403
402
|
return _getPayMethodListAsync.apply(this, arguments);
|
|
@@ -57,37 +57,42 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
57
57
|
key: "initialize",
|
|
58
58
|
value: function () {
|
|
59
59
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
60
|
+
var _options$initialState;
|
|
61
|
+
var initialScheduleList, hasInitialScheduleList;
|
|
60
62
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
61
63
|
while (1) switch (_context.prev = _context.next) {
|
|
62
64
|
case 0:
|
|
65
|
+
// The store proxies initialState, so capture its input before resets write through it.
|
|
66
|
+
initialScheduleList = (_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.scheduleList;
|
|
67
|
+
hasInitialScheduleList = Array.isArray(initialScheduleList);
|
|
63
68
|
this.resetScheduleCatalog();
|
|
64
69
|
this.core = core;
|
|
65
70
|
|
|
66
71
|
// 获取依赖的插件
|
|
67
72
|
this.request = core.getPlugin('request');
|
|
68
73
|
if (this.request) {
|
|
69
|
-
_context.next =
|
|
74
|
+
_context.next = 7;
|
|
70
75
|
break;
|
|
71
76
|
}
|
|
72
77
|
throw new Error('ScheduleModule 需要 request 插件支持');
|
|
73
|
-
case
|
|
78
|
+
case 7:
|
|
74
79
|
// if (options?.initialState) {
|
|
75
80
|
// this.state = { ...this.state, ...options.initialState }
|
|
76
81
|
// }
|
|
77
82
|
this.store = options === null || options === void 0 ? void 0 : options.store;
|
|
78
83
|
this.updateOtherParams(options.otherParams || {});
|
|
79
84
|
if (options.initialState) {
|
|
80
|
-
this.store.scheduleList =
|
|
85
|
+
this.store.scheduleList = hasInitialScheduleList ? initialScheduleList : [];
|
|
81
86
|
this.syncScheduleMap();
|
|
82
87
|
this.store.availabilityDateList = options.initialState.availabilityDateList;
|
|
83
|
-
this.hasLoadedScheduleList =
|
|
88
|
+
this.hasLoadedScheduleList = hasInitialScheduleList;
|
|
84
89
|
} else {
|
|
85
90
|
this.store.scheduleList = [];
|
|
86
91
|
this.store.map = new Map();
|
|
87
92
|
this.store.availabilityDateList = [];
|
|
88
93
|
this.hasLoadedScheduleList = false;
|
|
89
94
|
}
|
|
90
|
-
case
|
|
95
|
+
case 10:
|
|
91
96
|
case "end":
|
|
92
97
|
return _context.stop();
|
|
93
98
|
}
|
|
@@ -56,6 +56,9 @@ export interface CacheProps {
|
|
|
56
56
|
* 请求配置
|
|
57
57
|
*/
|
|
58
58
|
export interface RequestOptions {
|
|
59
|
+
/** Let the caller handle read-only preview failures without host navigation/toasts. */
|
|
60
|
+
manualErrorHandling?: boolean;
|
|
61
|
+
skipErrorHandler?: boolean;
|
|
59
62
|
url?: string;
|
|
60
63
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
61
64
|
headers?: Record<string, string>;
|
|
@@ -1,85 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
name?: string;
|
|
3
|
-
phone?: string;
|
|
4
|
-
address?: string;
|
|
5
|
-
address_street?: string;
|
|
6
|
-
address_detail?: string;
|
|
7
|
-
city?: string;
|
|
8
|
-
province?: string;
|
|
9
|
-
country?: string;
|
|
10
|
-
zip?: string;
|
|
11
|
-
tax_number?: string;
|
|
12
|
-
tax_title?: string;
|
|
13
|
-
is_price_include_tax?: 0 | 1 | boolean;
|
|
14
|
-
currency_symbol?: string;
|
|
15
|
-
currency_code?: string;
|
|
16
|
-
primary_locale?: string;
|
|
17
|
-
timezone?: string;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
}
|
|
20
|
-
export interface BuildSmallTicketDataParams {
|
|
21
|
-
order: Record<string, any>;
|
|
22
|
-
shopInfo?: SmallTicketShopInfo | null;
|
|
23
|
-
locales?: string[];
|
|
24
|
-
productMap?: Record<string | number, Record<string, any>>;
|
|
25
|
-
}
|
|
26
|
-
export interface SmallTicketItem {
|
|
27
|
-
item: string;
|
|
28
|
-
value: string;
|
|
29
|
-
size?: number;
|
|
30
|
-
align?: string;
|
|
31
|
-
product_uid?: string | number;
|
|
32
|
-
booking_uid?: string | number;
|
|
33
|
-
}
|
|
34
|
-
export interface SmallTicketProduct {
|
|
35
|
-
product_title: string;
|
|
36
|
-
product_quantity: number;
|
|
37
|
-
selling_price: string;
|
|
38
|
-
total_selling_price: string;
|
|
39
|
-
original_price: string;
|
|
40
|
-
base_price?: string;
|
|
41
|
-
total_original_price: string;
|
|
42
|
-
options_total_price?: string;
|
|
43
|
-
package_items_total_price?: string;
|
|
44
|
-
extension_list: any[];
|
|
45
|
-
product_uid?: string | number;
|
|
46
|
-
booking_uid?: string | number;
|
|
47
|
-
product_note?: string;
|
|
48
|
-
allergy?: string;
|
|
49
|
-
options?: Array<{
|
|
50
|
-
name: string;
|
|
51
|
-
num?: number;
|
|
52
|
-
price?: string;
|
|
53
|
-
total_price: string;
|
|
54
|
-
value?: string;
|
|
55
|
-
}>;
|
|
56
|
-
variant?: string;
|
|
57
|
-
combinations?: any[];
|
|
58
|
-
}
|
|
59
|
-
export type SmallTicketAppointment = SmallTicketItem[];
|
|
60
|
-
export interface SmallTicketLocaleData {
|
|
61
|
-
base_data: Record<string, any>;
|
|
62
|
-
products: SmallTicketProduct[];
|
|
63
|
-
fees: {
|
|
64
|
-
fees: SmallTicketItem[];
|
|
65
|
-
countFee: Record<string, any>;
|
|
66
|
-
};
|
|
67
|
-
customer: SmallTicketItem[];
|
|
68
|
-
appointment: SmallTicketAppointment;
|
|
69
|
-
delivery?: SmallTicketItem[];
|
|
70
|
-
resources: Array<{
|
|
71
|
-
id: string | number;
|
|
72
|
-
code: string;
|
|
73
|
-
title: string;
|
|
74
|
-
form_title: string;
|
|
75
|
-
}>;
|
|
76
|
-
payment_data: SmallTicketItem[][];
|
|
77
|
-
wallets: SmallTicketItem[][];
|
|
78
|
-
tickets: any[];
|
|
79
|
-
source_shop: any[];
|
|
80
|
-
refund_data: SmallTicketItem[][];
|
|
81
|
-
expend_data: any[];
|
|
82
|
-
}
|
|
83
|
-
export type SmallTicketData = Record<string, SmallTicketLocaleData>;
|
|
84
|
-
export declare function buildSmallTicketData(params: BuildSmallTicketDataParams): SmallTicketData;
|
|
85
|
-
export declare function hasSmallTicketData(value: any): boolean;
|
|
1
|
+
export * from '../../shared/receipt/small-ticket';
|