@pisell/pisellos 2.3.106 → 2.3.108
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.js +4 -1
- package/dist/modules/Discount/types.d.ts +10 -0
- package/dist/modules/OpenData/index.d.ts +15 -2
- package/dist/modules/OpenData/index.js +307 -19
- package/dist/modules/OpenData/types.d.ts +55 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +21 -1
- package/dist/modules/OpenData/utils.js +138 -0
- package/dist/modules/Order/index.d.ts +4 -2
- package/dist/modules/Order/index.js +69 -16
- package/dist/modules/Order/types.d.ts +13 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +57 -3
- package/dist/plugins/request.d.ts +2 -1
- package/dist/plugins/request.js +4 -2
- package/dist/server/index.d.ts +14 -0
- package/dist/server/index.js +1732 -1285
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +461 -96
- package/dist/solution/BaseSales/index.d.ts +7 -1
- package/dist/solution/BaseSales/index.js +128 -45
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -3
- package/dist/solution/BookingTicket/index.js +558 -443
- package/dist/solution/Sales/index.d.ts +16 -1
- package/dist/solution/Sales/index.js +338 -63
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +526 -447
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/lib/modules/Discount/index.js +4 -1
- package/lib/modules/Discount/types.d.ts +10 -0
- package/lib/modules/OpenData/index.d.ts +15 -2
- package/lib/modules/OpenData/index.js +230 -3
- package/lib/modules/OpenData/types.d.ts +55 -0
- package/lib/modules/OpenData/types.js +9 -1
- package/lib/modules/OpenData/utils.d.ts +21 -1
- package/lib/modules/OpenData/utils.js +126 -0
- package/lib/modules/Order/index.d.ts +4 -2
- package/lib/modules/Order/index.js +52 -1
- package/lib/modules/Order/types.d.ts +13 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +58 -1
- package/lib/plugins/request.d.ts +2 -1
- package/lib/plugins/request.js +3 -2
- package/lib/server/index.d.ts +14 -0
- package/lib/server/index.js +453 -105
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +427 -72
- package/lib/solution/BaseSales/index.d.ts +7 -1
- package/lib/solution/BaseSales/index.js +90 -7
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -3
- package/lib/solution/BookingTicket/index.js +60 -15
- package/lib/solution/Sales/index.d.ts +16 -1
- package/lib/solution/Sales/index.js +168 -1
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +44 -15
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,6 +1,144 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
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); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
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; }
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
13
|
import dayjs from 'dayjs';
|
|
3
14
|
import { getDateIsInSchedule } from "../Schedule/getDateIsInSchedule";
|
|
15
|
+
import { INVOICE_MODULE_KEYS } from "./types";
|
|
16
|
+
function isRecord(value) {
|
|
17
|
+
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
function parseInvoiceRecord(value) {
|
|
20
|
+
var parsed = value;
|
|
21
|
+
if (typeof parsed === 'string') {
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse(parsed);
|
|
24
|
+
} catch (_unused) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return isRecord(parsed) ? parsed : null;
|
|
29
|
+
}
|
|
30
|
+
export function getDefaultInvoiceLayoutConfig() {
|
|
31
|
+
return {
|
|
32
|
+
module: INVOICE_MODULE_KEYS.map(function (key) {
|
|
33
|
+
return {
|
|
34
|
+
key: key,
|
|
35
|
+
is_show: 1
|
|
36
|
+
};
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function getDefaultInvoiceTemplateSettings() {
|
|
41
|
+
return {
|
|
42
|
+
template: 'DEFAULT',
|
|
43
|
+
language: {},
|
|
44
|
+
modules: []
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
var INVOICE_RECEIPT_LOCALE_ORDER = ['en', 'zh_CN', 'zh_HK', 'ja', 'pt'];
|
|
48
|
+
var INVOICE_RECEIPT_LOCALE_MAPPING = {
|
|
49
|
+
en: ['en'],
|
|
50
|
+
zh_cn: ['zh_CN'],
|
|
51
|
+
zh_hk: ['zh_HK'],
|
|
52
|
+
ja: ['ja'],
|
|
53
|
+
pt: ['pt'],
|
|
54
|
+
cn_en: ['en', 'zh_CN']
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 将非 DEFAULT Invoice 模板启用的语言转换为 small_ticket_data locale。
|
|
59
|
+
* cn_en 是中英组合打印模式,因此展开为 en 与 zh_CN 两份数据。
|
|
60
|
+
*/
|
|
61
|
+
export function resolveInvoiceReceiptLocales(settings) {
|
|
62
|
+
if (typeof (settings === null || settings === void 0 ? void 0 : settings.template) !== 'string' || settings.template.trim().length === 0 || settings.template.trim().toUpperCase() === 'DEFAULT' || !isRecord(settings.language)) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
var enabledLocales = new Set();
|
|
66
|
+
Object.entries(settings.language).forEach(function (_ref) {
|
|
67
|
+
var _INVOICE_RECEIPT_LOCA;
|
|
68
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
69
|
+
rawKey = _ref2[0],
|
|
70
|
+
count = _ref2[1];
|
|
71
|
+
if (typeof count !== 'number' || !Number.isFinite(count) || count <= 0) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
var key = rawKey.trim().toLowerCase().replace(/-/g, '_');
|
|
75
|
+
(_INVOICE_RECEIPT_LOCA = INVOICE_RECEIPT_LOCALE_MAPPING[key]) === null || _INVOICE_RECEIPT_LOCA === void 0 || _INVOICE_RECEIPT_LOCA.forEach(function (locale) {
|
|
76
|
+
enabledLocales.add(locale);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
return INVOICE_RECEIPT_LOCALE_ORDER.filter(function (locale) {
|
|
80
|
+
return enabledLocales.has(locale);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function normalizeInvoiceTemplate(value) {
|
|
84
|
+
if (typeof value !== 'string' || value.trim().length === 0) return 'DEFAULT';
|
|
85
|
+
return value.trim().toUpperCase() === 'DEFAULT' ? 'DEFAULT' : value;
|
|
86
|
+
}
|
|
87
|
+
function normalizeInvoiceLanguage(value) {
|
|
88
|
+
if (!isRecord(value)) return {};
|
|
89
|
+
if (Object.values(value).some(function (item) {
|
|
90
|
+
return typeof item !== 'number';
|
|
91
|
+
})) return {};
|
|
92
|
+
return _objectSpread({}, value);
|
|
93
|
+
}
|
|
94
|
+
function normalizeInvoiceModules(value) {
|
|
95
|
+
if (!Array.isArray(value)) return [];
|
|
96
|
+
if (value.some(function (item) {
|
|
97
|
+
return !isRecord(item) || typeof item.key !== 'string';
|
|
98
|
+
})) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
return value.map(function (item) {
|
|
102
|
+
return _objectSpread({}, item);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 规范化已经提取出的公开 template_settings 值,供打印入口复用。
|
|
108
|
+
*/
|
|
109
|
+
export function normalizeRawInvoiceTemplateSettings(value) {
|
|
110
|
+
var parsed = parseInvoiceRecord(value);
|
|
111
|
+
if (!parsed) return getDefaultInvoiceTemplateSettings();
|
|
112
|
+
return _objectSpread(_objectSpread({}, parsed), {}, {
|
|
113
|
+
template: normalizeInvoiceTemplate(parsed.template),
|
|
114
|
+
language: normalizeInvoiceLanguage(parsed.language),
|
|
115
|
+
modules: normalizeInvoiceModules(parsed.modules)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 从 OpenData Documents section 的两个扁平字段中构造 Native Invoice 配置。
|
|
121
|
+
*/
|
|
122
|
+
export function normalizeInvoiceTemplateSettings(config) {
|
|
123
|
+
var parsedEdit = parseInvoiceRecord(config === null || config === void 0 ? void 0 : config['documents.invoice_edit']);
|
|
124
|
+
return normalizeRawInvoiceTemplateSettings(_objectSpread(_objectSpread({}, parsedEdit !== null && parsedEdit !== void 0 ? parsedEdit : {}), {}, {
|
|
125
|
+
template: normalizeInvoiceTemplate(config === null || config === void 0 ? void 0 : config['documents.invoice_template'])
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
export function normalizeInvoiceLayoutFromTemplateSettings(settings) {
|
|
129
|
+
var modules = normalizeRawInvoiceTemplateSettings(settings).modules;
|
|
130
|
+
if (modules.length === 0) return getDefaultInvoiceLayoutConfig();
|
|
131
|
+
return {
|
|
132
|
+
module: modules
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 将 invoice_edit.modules 原样投影为 Web Invoice 使用的 module 字段。
|
|
138
|
+
*/
|
|
139
|
+
export function normalizeInvoiceLayoutConfig(config) {
|
|
140
|
+
return normalizeInvoiceLayoutFromTemplateSettings(normalizeInvoiceTemplateSettings(config));
|
|
141
|
+
}
|
|
4
142
|
function toBoolean(value) {
|
|
5
143
|
if (typeof value === 'boolean') return value;
|
|
6
144
|
if (typeof value === 'string') return value === 'true' || value === '1';
|
|
@@ -176,6 +176,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
176
176
|
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
177
177
|
notifyTempOrderChanged(): void;
|
|
178
178
|
private createDefaultTempOrderInstance;
|
|
179
|
+
private clearTempOrderPointCardSnapshot;
|
|
180
|
+
private writePointCardSnapshotFromPrepareConfig;
|
|
179
181
|
private createExternalSaleNumber;
|
|
180
182
|
private ensureExternalSaleNumber;
|
|
181
183
|
private ensureRequestUniqueIdempotencyToken;
|
|
@@ -555,7 +557,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
555
557
|
generateIdempotencyToken(): string;
|
|
556
558
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
557
559
|
createOrder(params: CommitOrderParams['query']): {
|
|
558
|
-
type: "
|
|
560
|
+
type: "virtual" | "appointment_booking";
|
|
559
561
|
platform: string;
|
|
560
562
|
sales_channel: string;
|
|
561
563
|
order_sales_channel: string;
|
|
@@ -632,4 +634,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
632
634
|
getOrderInfo(order_id: number): Promise<any>;
|
|
633
635
|
getVouchers(): any[];
|
|
634
636
|
}
|
|
635
|
-
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
637
|
+
export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
@@ -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, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
35
|
+
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, buildPointCardSnapshotFromWalletPassList, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
38
|
import { buildSalesNoteText, decodeSalesNotesSnapshot, getSalesNotePolicy } from "./salesNotes";
|
|
@@ -107,6 +107,13 @@ function getVoucherPaymentLifecycleKey(payment) {
|
|
|
107
107
|
if (!isVoucherPaymentRecord(payment)) return null;
|
|
108
108
|
return "".concat(String(payment.voucher_id), "::").concat(String(payment.status || ''));
|
|
109
109
|
}
|
|
110
|
+
function hasPersistedOrderId(orderId) {
|
|
111
|
+
if (orderId === undefined || orderId === null || orderId === '') return false;
|
|
112
|
+
if (typeof orderId === 'string' && orderId.startsWith('LOCAL_')) return false;
|
|
113
|
+
var normalizedOrderId = Number(orderId);
|
|
114
|
+
if (Number.isFinite(normalizedOrderId)) return normalizedOrderId > 0;
|
|
115
|
+
return String(orderId).trim() !== '';
|
|
116
|
+
}
|
|
110
117
|
export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
111
118
|
_inherits(OrderModule, _BaseModule);
|
|
112
119
|
var _super = _createSuper(OrderModule);
|
|
@@ -586,8 +593,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
586
593
|
discountList = prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList;
|
|
587
594
|
this.store.availableWalletIds = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.availableWalletIds) || [];
|
|
588
595
|
this.store.virtualCurrencyList = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.virtualCurrencyList) || [];
|
|
596
|
+
if (prepareConfigResult) {
|
|
597
|
+
this.writePointCardSnapshotFromPrepareConfig({
|
|
598
|
+
orderId: orderId,
|
|
599
|
+
customerId: params.customerId,
|
|
600
|
+
availableWalletPassList: prepareConfigResult.availableWalletPassList || []
|
|
601
|
+
});
|
|
602
|
+
}
|
|
589
603
|
if (!discountList) {
|
|
590
|
-
_context3.next =
|
|
604
|
+
_context3.next = 20;
|
|
591
605
|
break;
|
|
592
606
|
}
|
|
593
607
|
currentDiscountList = ((_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 ? void 0 : _this$store$discount2.getDiscountList()) || [];
|
|
@@ -608,17 +622,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
608
622
|
return true;
|
|
609
623
|
});
|
|
610
624
|
mergedDiscountList = [].concat(_toConsumableArray(currentEditDiscounts), _toConsumableArray(currentScanDiscounts), _toConsumableArray(runtimeDiscounts));
|
|
611
|
-
_context3.next =
|
|
625
|
+
_context3.next = 18;
|
|
612
626
|
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
613
|
-
case
|
|
614
|
-
_context3.next =
|
|
627
|
+
case 18:
|
|
628
|
+
_context3.next = 20;
|
|
615
629
|
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.setDiscountList(mergedDiscountList);
|
|
616
|
-
case
|
|
630
|
+
case 20:
|
|
617
631
|
if (params.apply !== false && (_this$store$tempOrder2 = this.store.tempOrder) !== null && _this$store$tempOrder2 !== void 0 && (_this$store$tempOrder2 = _this$store$tempOrder2.products) !== null && _this$store$tempOrder2 !== void 0 && _this$store$tempOrder2.length) {
|
|
618
632
|
this.applyDiscount();
|
|
619
633
|
}
|
|
620
634
|
return _context3.abrupt("return", this.getDiscountList());
|
|
621
|
-
case
|
|
635
|
+
case 22:
|
|
622
636
|
case "end":
|
|
623
637
|
return _context3.stop();
|
|
624
638
|
}
|
|
@@ -1503,6 +1517,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1503
1517
|
now: formatDateTime(new Date())
|
|
1504
1518
|
});
|
|
1505
1519
|
}
|
|
1520
|
+
}, {
|
|
1521
|
+
key: "clearTempOrderPointCardSnapshot",
|
|
1522
|
+
value: function clearTempOrderPointCardSnapshot(tempOrder) {
|
|
1523
|
+
var orderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
|
|
1524
|
+
if (!orderMetaList) return;
|
|
1525
|
+
var nextOrderMetaList = _objectSpread({}, orderMetaList);
|
|
1526
|
+
delete nextOrderMetaList.point_cards_snapshot;
|
|
1527
|
+
if (Object.keys(nextOrderMetaList).length === 0) {
|
|
1528
|
+
delete tempOrder.order_meta_list;
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
tempOrder.order_meta_list = nextOrderMetaList;
|
|
1532
|
+
}
|
|
1533
|
+
}, {
|
|
1534
|
+
key: "writePointCardSnapshotFromPrepareConfig",
|
|
1535
|
+
value: function writePointCardSnapshotFromPrepareConfig(params) {
|
|
1536
|
+
var _tempOrder$customer_i, _params$orderId;
|
|
1537
|
+
var tempOrder = this.store.tempOrder;
|
|
1538
|
+
if (!tempOrder) return;
|
|
1539
|
+
if (String((_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : '') !== String(params.customerId)) return;
|
|
1540
|
+
var effectiveOrderId = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : tempOrder.order_id;
|
|
1541
|
+
if (hasPersistedOrderId(effectiveOrderId)) return;
|
|
1542
|
+
tempOrder.order_meta_list = _objectSpread(_objectSpread({}, normalizeOrderMetaList(tempOrder.order_meta_list) || {}), {}, {
|
|
1543
|
+
point_cards_snapshot: buildPointCardSnapshotFromWalletPassList(params.availableWalletPassList)
|
|
1544
|
+
});
|
|
1545
|
+
this.persistTempOrder();
|
|
1546
|
+
this.saveDraftInBackground();
|
|
1547
|
+
}
|
|
1506
1548
|
}, {
|
|
1507
1549
|
key: "createExternalSaleNumber",
|
|
1508
1550
|
value: function createExternalSaleNumber() {
|
|
@@ -2718,7 +2760,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2718
2760
|
}, {
|
|
2719
2761
|
key: "getOrderSnapshot",
|
|
2720
2762
|
value: function getOrderSnapshot() {
|
|
2721
|
-
var _tempOrder$
|
|
2763
|
+
var _tempOrder$customer_i2, _tempOrder$products;
|
|
2722
2764
|
var tempOrder = this.store.tempOrder;
|
|
2723
2765
|
if (!tempOrder) return null;
|
|
2724
2766
|
var identity = this.getOrderIdentity();
|
|
@@ -2733,7 +2775,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2733
2775
|
shippingStatus: tempOrder.shipping_status || '',
|
|
2734
2776
|
note: tempOrder.note || '',
|
|
2735
2777
|
customer: {
|
|
2736
|
-
customerId: (_tempOrder$
|
|
2778
|
+
customerId: (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null,
|
|
2737
2779
|
customerName: tempOrder.customer_name || '',
|
|
2738
2780
|
phone: tempOrder.phone || '',
|
|
2739
2781
|
email: tempOrder.email || ''
|
|
@@ -3810,9 +3852,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3810
3852
|
}, {
|
|
3811
3853
|
key: "updateTempOrderCustomer",
|
|
3812
3854
|
value: function updateTempOrderCustomer(customer) {
|
|
3813
|
-
var _tempOrder$
|
|
3855
|
+
var _tempOrder$customer_i3, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i4;
|
|
3814
3856
|
var tempOrder = this.ensureTempOrder();
|
|
3815
|
-
var previousCustomerId = (_tempOrder$
|
|
3857
|
+
var previousCustomerId = (_tempOrder$customer_i3 = tempOrder.customer_id) !== null && _tempOrder$customer_i3 !== void 0 ? _tempOrder$customer_i3 : null;
|
|
3816
3858
|
var customerId = (_ref54 = (_ref55 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref55 !== void 0 ? _ref55 : customer.id) !== null && _ref54 !== void 0 ? _ref54 : null;
|
|
3817
3859
|
var customerName = (_ref56 = (_ref57 = (_ref58 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref58 !== void 0 ? _ref58 : customer.display_name) !== null && _ref57 !== void 0 ? _ref57 : customer.name) !== null && _ref56 !== void 0 ? _ref56 : '';
|
|
3818
3860
|
tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
|
|
@@ -3828,7 +3870,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3828
3870
|
phone: tempOrder.phone,
|
|
3829
3871
|
email: tempOrder.email
|
|
3830
3872
|
});
|
|
3831
|
-
var nextCustomerId = (_tempOrder$
|
|
3873
|
+
var nextCustomerId = (_tempOrder$customer_i4 = tempOrder.customer_id) !== null && _tempOrder$customer_i4 !== void 0 ? _tempOrder$customer_i4 : null;
|
|
3874
|
+
if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '') && !hasPersistedOrderId(tempOrder.order_id)) {
|
|
3875
|
+
this.store.availableWalletIds = [];
|
|
3876
|
+
this.clearTempOrderPointCardSnapshot(tempOrder);
|
|
3877
|
+
}
|
|
3832
3878
|
this.persistTempOrder();
|
|
3833
3879
|
return {
|
|
3834
3880
|
customerId: tempOrder.customer_id,
|
|
@@ -3840,13 +3886,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3840
3886
|
}, {
|
|
3841
3887
|
key: "setOrderCustomer",
|
|
3842
3888
|
value: function setOrderCustomer(patch, snapshot) {
|
|
3843
|
-
var _tempOrder$
|
|
3889
|
+
var _tempOrder$customer_i5, _tempOrder$customer_i6;
|
|
3844
3890
|
if (!patch) {
|
|
3845
3891
|
this.clearOrderCustomer();
|
|
3846
3892
|
return;
|
|
3847
3893
|
}
|
|
3848
3894
|
var tempOrder = this.ensureTempOrder();
|
|
3849
|
-
var previousCustomerId = (_tempOrder$
|
|
3895
|
+
var previousCustomerId = (_tempOrder$customer_i5 = tempOrder.customer_id) !== null && _tempOrder$customer_i5 !== void 0 ? _tempOrder$customer_i5 : null;
|
|
3850
3896
|
tempOrder.customer_id = patch.customer_id || patch.id || null;
|
|
3851
3897
|
tempOrder.customer_name = String(patch.customer_name || '');
|
|
3852
3898
|
tempOrder.country_calling_code = String(patch.country_calling_code || '');
|
|
@@ -3864,10 +3910,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3864
3910
|
var extend = this.ensureExtend(tempOrder);
|
|
3865
3911
|
if (snapshot === null) delete extend.customerSnapshot;else extend.customerSnapshot = cloneDeep(snapshot);
|
|
3866
3912
|
}
|
|
3867
|
-
var nextCustomerId = (_tempOrder$
|
|
3913
|
+
var nextCustomerId = (_tempOrder$customer_i6 = tempOrder.customer_id) !== null && _tempOrder$customer_i6 !== void 0 ? _tempOrder$customer_i6 : null;
|
|
3868
3914
|
if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '')) {
|
|
3869
3915
|
this.store.availableWalletIds = [];
|
|
3870
3916
|
this.store.virtualCurrencyList = [];
|
|
3917
|
+
if (!hasPersistedOrderId(tempOrder.order_id)) {
|
|
3918
|
+
this.clearTempOrderPointCardSnapshot(tempOrder);
|
|
3919
|
+
}
|
|
3871
3920
|
clearTempOrderHolderAssignments(tempOrder);
|
|
3872
3921
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3873
3922
|
this.applyDiscount();
|
|
@@ -3914,6 +3963,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3914
3963
|
if (tempOrder._extend) delete tempOrder._extend.customerSnapshot;
|
|
3915
3964
|
this.store.availableWalletIds = [];
|
|
3916
3965
|
this.store.virtualCurrencyList = [];
|
|
3966
|
+
if (!hasPersistedOrderId(tempOrder.order_id)) {
|
|
3967
|
+
this.clearTempOrderPointCardSnapshot(tempOrder);
|
|
3968
|
+
}
|
|
3917
3969
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3918
3970
|
this.applyDiscount();
|
|
3919
3971
|
this.persistTempOrder();
|
|
@@ -6788,7 +6840,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6788
6840
|
}
|
|
6789
6841
|
_context49.next = 6;
|
|
6790
6842
|
return this.request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
|
|
6791
|
-
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'refunds', 'notes']
|
|
6843
|
+
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'order_meta_list', 'refunds', 'notes']
|
|
6792
6844
|
}, params.forceRemote ? {
|
|
6793
6845
|
forceRemote: true
|
|
6794
6846
|
} : {}), {
|
|
@@ -7154,6 +7206,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7154
7206
|
return _objectSpread({}, c || {});
|
|
7155
7207
|
}) : [];
|
|
7156
7208
|
nextTempOrder.contacts_info = raw.contacts_info && _typeof(raw.contacts_info) === 'object' && !Array.isArray(raw.contacts_info) ? _objectSpread({}, raw.contacts_info) : null;
|
|
7209
|
+
nextTempOrder.order_meta_list = normalizeOrderMetaList(raw.order_meta_list);
|
|
7157
7210
|
nextTempOrder._extend = raw._extend && _typeof(raw._extend) === 'object' ? _objectSpread(_objectSpread({}, raw._extend), {}, {
|
|
7158
7211
|
productsByUid: raw._extend.productsByUid || {}
|
|
7159
7212
|
}) : {
|
|
@@ -195,6 +195,17 @@ export interface OrderProductSku {
|
|
|
195
195
|
export interface OrderLocalizedText {
|
|
196
196
|
[locale: string]: string | null;
|
|
197
197
|
}
|
|
198
|
+
export interface PointCardSnapshotItem {
|
|
199
|
+
id: number | string;
|
|
200
|
+
tag: 'point_card';
|
|
201
|
+
product_id?: number | string;
|
|
202
|
+
product_name: string;
|
|
203
|
+
par_value: string;
|
|
204
|
+
used_par_value: string;
|
|
205
|
+
}
|
|
206
|
+
export interface OrderMetaList {
|
|
207
|
+
point_cards_snapshot?: PointCardSnapshotItem[];
|
|
208
|
+
}
|
|
198
209
|
export interface OrderProduct extends OrderProductIdentity {
|
|
199
210
|
order_detail_id: number | null;
|
|
200
211
|
num: number;
|
|
@@ -361,6 +372,7 @@ export interface OrderTempOrder {
|
|
|
361
372
|
contacts: any[];
|
|
362
373
|
contacts_info: Record<string, any> | null;
|
|
363
374
|
holder: Record<string, any> | null;
|
|
375
|
+
order_meta_list?: OrderMetaList;
|
|
364
376
|
metadata: Record<string, any>;
|
|
365
377
|
summary?: OrderSummary;
|
|
366
378
|
_extend?: {
|
|
@@ -566,6 +578,7 @@ export interface SubmitSalesOrderParams {
|
|
|
566
578
|
contacts: any[];
|
|
567
579
|
contacts_info: Record<string, any> | null;
|
|
568
580
|
holder: Record<string, any> | null;
|
|
581
|
+
order_meta_list?: OrderMetaList;
|
|
569
582
|
metadata: Record<string, any>;
|
|
570
583
|
summary?: OrderSummary;
|
|
571
584
|
small_ticket_data_flag?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Decimal from 'decimal.js';
|
|
2
2
|
import type { CartItem } from "../Cart";
|
|
3
|
-
import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
|
|
3
|
+
import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem } from './types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
5
|
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
6
|
import { createUuidV4 } from './utils/orderCollectionIdentity';
|
|
@@ -16,6 +16,9 @@ export interface OrderProductsDepositSummary {
|
|
|
16
16
|
hasDeposit: boolean;
|
|
17
17
|
}
|
|
18
18
|
import type { WindowPlugin } from '../../plugins';
|
|
19
|
+
export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
|
|
20
|
+
export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
|
|
21
|
+
export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;
|
|
19
22
|
/**
|
|
20
23
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
21
24
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["custom_product_bundle_map_id"],
|
|
2
2
|
_excluded2 = ["unique_identification_number"],
|
|
3
3
|
_excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per", "production_code"],
|
|
4
|
-
_excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "payment_status", "notes"],
|
|
4
|
+
_excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "order_meta_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "payment_status", "notes"],
|
|
5
5
|
_excluded5 = ["collect_pax", "table_occupancy_duration", "cart_settlement_key", "cart_settlement_snapshot", "legal_currency_snapshot"];
|
|
6
6
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -9,7 +9,6 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
9
9
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
14
|
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; }
|
|
@@ -18,12 +17,63 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
18
17
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
19
|
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; }
|
|
20
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
21
21
|
import dayjs from "dayjs";
|
|
22
22
|
import Decimal from 'decimal.js';
|
|
23
23
|
import { getProductHolderConfig } from "../Holder/utils";
|
|
24
24
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
25
25
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
26
26
|
import { encodeSalesNotes } from "./salesNotes";
|
|
27
|
+
var POINT_CARD_SNAPSHOT_TAG = 'point_card';
|
|
28
|
+
function isPlainObject(value) {
|
|
29
|
+
return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
function normalizeSnapshotScalar(value) {
|
|
32
|
+
if (value === undefined || value === null) return undefined;
|
|
33
|
+
if (typeof value === 'string') return value.trim() ? value : undefined;
|
|
34
|
+
if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
export function normalizePointCardSnapshotItem(value) {
|
|
38
|
+
var _value$product_name, _value$par_value, _value$used_par_value;
|
|
39
|
+
if (!isPlainObject(value)) return null;
|
|
40
|
+
var id = normalizeSnapshotScalar(value.id);
|
|
41
|
+
if (id === undefined) return null;
|
|
42
|
+
if (String(value.tag || '').trim().toLowerCase() !== POINT_CARD_SNAPSHOT_TAG) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
var snapshot = {
|
|
46
|
+
id: id,
|
|
47
|
+
tag: 'point_card',
|
|
48
|
+
product_name: String((_value$product_name = value.product_name) !== null && _value$product_name !== void 0 ? _value$product_name : ''),
|
|
49
|
+
par_value: String((_value$par_value = value.par_value) !== null && _value$par_value !== void 0 ? _value$par_value : ''),
|
|
50
|
+
used_par_value: String((_value$used_par_value = value.used_par_value) !== null && _value$used_par_value !== void 0 ? _value$used_par_value : '')
|
|
51
|
+
};
|
|
52
|
+
var productId = normalizeSnapshotScalar(value.product_id);
|
|
53
|
+
if (productId !== undefined) {
|
|
54
|
+
snapshot.product_id = productId;
|
|
55
|
+
}
|
|
56
|
+
return snapshot;
|
|
57
|
+
}
|
|
58
|
+
export function buildPointCardSnapshotFromWalletPassList(value) {
|
|
59
|
+
if (!Array.isArray(value)) return [];
|
|
60
|
+
return value.reduce(function (result, item) {
|
|
61
|
+
var normalized = normalizePointCardSnapshotItem(item);
|
|
62
|
+
if (normalized) result.push(normalized);
|
|
63
|
+
return result;
|
|
64
|
+
}, []);
|
|
65
|
+
}
|
|
66
|
+
export function normalizeOrderMetaList(value) {
|
|
67
|
+
if (value === undefined) return undefined;
|
|
68
|
+
if (!isPlainObject(value)) return undefined;
|
|
69
|
+
var normalized = {};
|
|
70
|
+
if (Object.prototype.hasOwnProperty.call(value, 'point_cards_snapshot')) {
|
|
71
|
+
normalized.point_cards_snapshot = buildPointCardSnapshotFromWalletPassList(value.point_cards_snapshot);
|
|
72
|
+
}
|
|
73
|
+
if (Object.keys(normalized).length > 0) return normalized;
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
|
|
27
77
|
/**
|
|
28
78
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
29
79
|
*
|
|
@@ -1209,6 +1259,7 @@ export function buildSubmitPayload(params) {
|
|
|
1209
1259
|
_startTime = _ref30.start_time,
|
|
1210
1260
|
_customer = _ref30.customer,
|
|
1211
1261
|
_discountList = _ref30.discount_list,
|
|
1262
|
+
_orderMetaList = _ref30.order_meta_list,
|
|
1212
1263
|
_rootTaxFee = _ref30.tax_fee,
|
|
1213
1264
|
_totalAmount = _ref30.total_amount,
|
|
1214
1265
|
_totalRefundAmount = _ref30.total_refund_amount,
|
|
@@ -1218,6 +1269,7 @@ export function buildSubmitPayload(params) {
|
|
|
1218
1269
|
_notes = _ref30.notes,
|
|
1219
1270
|
tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
|
|
1220
1271
|
var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
|
|
1272
|
+
var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
|
|
1221
1273
|
var submitType = resolveSubmitOrderType({
|
|
1222
1274
|
requestedType: type,
|
|
1223
1275
|
tempOrderType: tempOrder.type,
|
|
@@ -1287,7 +1339,9 @@ export function buildSubmitPayload(params) {
|
|
|
1287
1339
|
virtualSettlementMode: virtualSettlementMode
|
|
1288
1340
|
});
|
|
1289
1341
|
})
|
|
1290
|
-
}
|
|
1342
|
+
}, normalizedOrderMetaList !== undefined ? {
|
|
1343
|
+
order_meta_list: normalizedOrderMetaList
|
|
1344
|
+
} : {});
|
|
1291
1345
|
if (!enhance) return payload;
|
|
1292
1346
|
var enhancedPayload = enhance(payload, {
|
|
1293
1347
|
tempOrder: tempOrder,
|
|
@@ -70,6 +70,7 @@ export interface RequestOptions {
|
|
|
70
70
|
cache?: CacheProps;
|
|
71
71
|
cacheUpdateChange?: (data: any) => void;
|
|
72
72
|
osServer?: boolean;
|
|
73
|
+
isNocobase?: boolean;
|
|
73
74
|
prefix?: boolean;
|
|
74
75
|
callback?: (res: any) => void;
|
|
75
76
|
subscriberId?: string;
|
|
@@ -125,7 +126,7 @@ declare class RequestPluginImpl implements RequestPlugin {
|
|
|
125
126
|
/**
|
|
126
127
|
* GET 请求
|
|
127
128
|
*/
|
|
128
|
-
get<T = any>(url: string, options?: RequestOptions): Promise<T>;
|
|
129
|
+
get<T = any>(url: string, dataOrOptions?: any, options?: RequestOptions): Promise<T>;
|
|
129
130
|
/**
|
|
130
131
|
* POST 请求
|
|
131
132
|
*/
|
package/dist/plugins/request.js
CHANGED
|
@@ -147,8 +147,10 @@ var RequestPluginImpl = /*#__PURE__*/function () {
|
|
|
147
147
|
}, {
|
|
148
148
|
key: "get",
|
|
149
149
|
value: function get(url) {
|
|
150
|
-
var
|
|
151
|
-
|
|
150
|
+
var dataOrOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
151
|
+
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
152
|
+
var requestOptions = options !== null && options !== void 0 ? options : dataOrOptions;
|
|
153
|
+
return this.request(_objectSpread(_objectSpread({}, requestOptions), {}, {
|
|
152
154
|
url: url,
|
|
153
155
|
method: 'GET'
|
|
154
156
|
}));
|
package/dist/server/index.d.ts
CHANGED
|
@@ -515,6 +515,10 @@ declare class Server {
|
|
|
515
515
|
private buildCheckoutTaskIdempotencyKey;
|
|
516
516
|
private isBlankCheckoutValue;
|
|
517
517
|
private isLocalCheckoutOrderId;
|
|
518
|
+
private normalizePrintInvoiceLayoutConfig;
|
|
519
|
+
private extractInvoiceLayoutConfig;
|
|
520
|
+
private normalizePrintInvoiceTemplateSettings;
|
|
521
|
+
private extractInvoiceTemplateSettings;
|
|
518
522
|
private applyCheckoutFulfillmentBuzzer;
|
|
519
523
|
private buildCheckoutResourceIdentifierBuzzer;
|
|
520
524
|
private getCheckoutResourceIdentifier;
|
|
@@ -534,7 +538,10 @@ declare class Server {
|
|
|
534
538
|
private dispatchLocalReceiptPrint;
|
|
535
539
|
private shouldLookupLocalPrintOrder;
|
|
536
540
|
private getLocalPrintOrderLookup;
|
|
541
|
+
private mergeLocalPrintOrderInput;
|
|
537
542
|
private handleLocalPrintOrder;
|
|
543
|
+
private normalizeRequestedReceiptLocales;
|
|
544
|
+
private handleLocalOrderReceiptSnapshot;
|
|
538
545
|
private handleMachinecodeBatchMeta;
|
|
539
546
|
private resolveMachinecodeBatchMetadataLookup;
|
|
540
547
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
@@ -543,6 +550,11 @@ declare class Server {
|
|
|
543
550
|
private handleOrderDraftSubmit;
|
|
544
551
|
private handlePendingSyncCheckoutOrder;
|
|
545
552
|
private buildPendingSyncCheckoutOrder;
|
|
553
|
+
/**
|
|
554
|
+
* Checkout 与本地小票必须消费同一份规范化子项快照。
|
|
555
|
+
* 商品/预约只折叠持久化 ID 或协议 UID 相同的行;支付额外兼容 payment_number。
|
|
556
|
+
*/
|
|
557
|
+
private normalizeCheckoutCollections;
|
|
546
558
|
/**
|
|
547
559
|
* Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
|
|
548
560
|
*/
|
|
@@ -572,6 +584,8 @@ declare class Server {
|
|
|
572
584
|
private shouldLookupPaymentMethodNameByCode;
|
|
573
585
|
private enrichPaymentNamesByCode;
|
|
574
586
|
private withLocalSmallTicketData;
|
|
587
|
+
private normalizeRemoteSalesOrderErrorCode;
|
|
588
|
+
private fetchAndPersistSalesOrderByLookup;
|
|
575
589
|
private handleOrderSalesDetail;
|
|
576
590
|
/**
|
|
577
591
|
* 解析 order_ids 入参,兼容 url query / data 字段、字符串(csv) / 数组两种形态。
|