@pisell/pisellos 2.2.211 → 2.2.213
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/server/index.d.ts +7 -0
- package/dist/server/index.js +174 -43
- package/dist/server/modules/order/types.d.ts +12 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +138 -9
- package/lib/server/modules/order/types.d.ts +12 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -405,6 +405,12 @@ declare class Server {
|
|
|
405
405
|
private sumPaidOrderPayments;
|
|
406
406
|
private toAmountNumber;
|
|
407
407
|
private buildSmallTicketProductMap;
|
|
408
|
+
private withPendingSyncProductTitles;
|
|
409
|
+
private buildProductTitleSnapshot;
|
|
410
|
+
private getProductTitleSnapshotCurrentLocale;
|
|
411
|
+
private normalizeProductTitleSnapshotLocale;
|
|
412
|
+
private resolveProductTitleValue;
|
|
413
|
+
private resolveFirstProductTitleValue;
|
|
408
414
|
private withLocalSmallTicketData;
|
|
409
415
|
private handleOrderSalesDetail;
|
|
410
416
|
/**
|
|
@@ -439,6 +445,7 @@ declare class Server {
|
|
|
439
445
|
private extractOrderDataFromCheckoutResponse;
|
|
440
446
|
private getCheckoutExternalSaleNumber;
|
|
441
447
|
private buildCheckoutSyncSuccessPatch;
|
|
448
|
+
private buildSyncedOrderForPrint;
|
|
442
449
|
private isMergeableCheckoutOrder;
|
|
443
450
|
private normalizeCheckoutResponse;
|
|
444
451
|
private isCheckoutResponseRejected;
|
package/dist/server/index.js
CHANGED
|
@@ -50,6 +50,9 @@ import { buildSmallTicketData, hasSmallTicketData } from "./utils/small-ticket";
|
|
|
50
50
|
/** 非当天(远端)预约查询订阅者 */
|
|
51
51
|
|
|
52
52
|
/** 平面图 GET 查询订阅者(列表 / id 详情 / code 详情) */
|
|
53
|
+
|
|
54
|
+
var PRODUCT_TITLE_SNAPSHOT_KEYS = ['en', 'ja', 'pt', 'auto', 'zh-CN', 'zh-HK', 'kitchen', 'original'];
|
|
55
|
+
|
|
53
56
|
/**
|
|
54
57
|
* Server 类
|
|
55
58
|
* 用于注册和管理服务端模块
|
|
@@ -1930,7 +1933,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1930
1933
|
value: function () {
|
|
1931
1934
|
var _handleSyncSalesTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ctx) {
|
|
1932
1935
|
var _ctx$task, _this$app4;
|
|
1933
|
-
var payload, backendPath, data, title, _syncedOrder2, response, message, fresh, externalSaleNumber, shouldMergeRemoteOrder, syncedOrder, _external_sale_number, _syncedOrder$order_id, _syncedOrder, patch, result, _ctx$task2, backendError, _message, errorMessage;
|
|
1936
|
+
var payload, backendPath, data, title, _syncedOrder2, response, message, fresh, externalSaleNumber, shouldMergeRemoteOrder, syncedOrder, _external_sale_number, _syncedOrder$order_id, _syncedOrder, patch, result, printableSyncedOrder, _ctx$task2, backendError, _message, errorMessage;
|
|
1934
1937
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1935
1938
|
while (1) switch (_context26.prev = _context26.next) {
|
|
1936
1939
|
case 0:
|
|
@@ -2023,31 +2026,35 @@ var Server = /*#__PURE__*/function () {
|
|
|
2023
2026
|
order_id: fresh === null || fresh === void 0 ? void 0 : fresh.order_id
|
|
2024
2027
|
});
|
|
2025
2028
|
case 37:
|
|
2026
|
-
|
|
2029
|
+
printableSyncedOrder = syncedOrder ? this.buildSyncedOrderForPrint({
|
|
2030
|
+
syncedOrder: syncedOrder,
|
|
2031
|
+
checkoutResponseOrder: fresh
|
|
2032
|
+
}) : undefined;
|
|
2033
|
+
if (!(printableSyncedOrder && this.shouldPrintSyncedOrder({
|
|
2027
2034
|
checkoutData: data,
|
|
2028
|
-
syncedOrder:
|
|
2035
|
+
syncedOrder: printableSyncedOrder
|
|
2029
2036
|
}))) {
|
|
2030
|
-
_context26.next =
|
|
2037
|
+
_context26.next = 41;
|
|
2031
2038
|
break;
|
|
2032
2039
|
}
|
|
2033
|
-
_context26.next =
|
|
2040
|
+
_context26.next = 41;
|
|
2034
2041
|
return this.dispatchPrintOtherReceiptTask({
|
|
2035
2042
|
checkoutData: data,
|
|
2036
|
-
syncedOrder:
|
|
2043
|
+
syncedOrder: printableSyncedOrder,
|
|
2037
2044
|
response: response,
|
|
2038
2045
|
deviceId: (_ctx$task2 = ctx.task) === null || _ctx$task2 === void 0 ? void 0 : _ctx$task2.device_id
|
|
2039
2046
|
});
|
|
2040
|
-
case
|
|
2047
|
+
case 41:
|
|
2041
2048
|
return _context26.abrupt("return", this.taskOk({
|
|
2042
2049
|
order: (_syncedOrder2 = syncedOrder) !== null && _syncedOrder2 !== void 0 ? _syncedOrder2 : null,
|
|
2043
2050
|
response: this.normalizeCheckoutResponse(response)
|
|
2044
2051
|
}));
|
|
2045
|
-
case
|
|
2046
|
-
_context26.prev =
|
|
2052
|
+
case 44:
|
|
2053
|
+
_context26.prev = 44;
|
|
2047
2054
|
_context26.t0 = _context26["catch"](9);
|
|
2048
2055
|
backendError = this.extractBackendErrorResponse(_context26.t0);
|
|
2049
2056
|
if (!backendError) {
|
|
2050
|
-
_context26.next =
|
|
2057
|
+
_context26.next = 51;
|
|
2051
2058
|
break;
|
|
2052
2059
|
}
|
|
2053
2060
|
_message = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || '后端明确拒绝 checkout';
|
|
@@ -2056,18 +2063,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2056
2063
|
backendError: backendError
|
|
2057
2064
|
});
|
|
2058
2065
|
return _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', _message, backendError));
|
|
2059
|
-
case
|
|
2066
|
+
case 51:
|
|
2060
2067
|
errorMessage = _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0);
|
|
2061
2068
|
this.logError("".concat(title, ": sync_sales \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
2062
2069
|
backendPath: backendPath,
|
|
2063
2070
|
error: errorMessage
|
|
2064
2071
|
});
|
|
2065
2072
|
return _context26.abrupt("return", this.taskTimeout(errorMessage));
|
|
2066
|
-
case
|
|
2073
|
+
case 54:
|
|
2067
2074
|
case "end":
|
|
2068
2075
|
return _context26.stop();
|
|
2069
2076
|
}
|
|
2070
|
-
}, _callee26, this, [[9,
|
|
2077
|
+
}, _callee26, this, [[9, 44]]);
|
|
2071
2078
|
}));
|
|
2072
2079
|
function handleSyncSalesTask(_x29) {
|
|
2073
2080
|
return _handleSyncSalesTask.apply(this, arguments);
|
|
@@ -2614,7 +2621,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2614
2621
|
handler: this.handleOrderCheckout.bind(this)
|
|
2615
2622
|
}, {
|
|
2616
2623
|
method: 'post',
|
|
2617
|
-
path: '/local/print-order',
|
|
2624
|
+
path: '/shop/local/print-order',
|
|
2618
2625
|
handler: this.handleLocalPrintOrder.bind(this)
|
|
2619
2626
|
}]);
|
|
2620
2627
|
this.registerPrefixRoutes([{
|
|
@@ -4135,7 +4142,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4135
4142
|
key: "buildPendingSyncCheckoutOrder",
|
|
4136
4143
|
value: function () {
|
|
4137
4144
|
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(data) {
|
|
4138
|
-
var hasStorageKey;
|
|
4145
|
+
var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
|
|
4139
4146
|
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4140
4147
|
while (1) switch (_context46.prev = _context46.next) {
|
|
4141
4148
|
case 0:
|
|
@@ -4152,12 +4159,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
4152
4159
|
}
|
|
4153
4160
|
return _context46.abrupt("return", null);
|
|
4154
4161
|
case 5:
|
|
4155
|
-
|
|
4162
|
+
pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
|
|
4156
4163
|
need_sync: 1
|
|
4157
|
-
})
|
|
4158
|
-
|
|
4164
|
+
});
|
|
4165
|
+
_context46.next = 8;
|
|
4166
|
+
return this.buildSmallTicketProductMap(pendingOrder);
|
|
4167
|
+
case 8:
|
|
4168
|
+
productMap = _context46.sent;
|
|
4169
|
+
orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
|
|
4170
|
+
return _context46.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
|
|
4171
|
+
requireFullyPaid: true,
|
|
4172
|
+
productMap: productMap
|
|
4159
4173
|
}));
|
|
4160
|
-
case
|
|
4174
|
+
case 11:
|
|
4161
4175
|
case "end":
|
|
4162
4176
|
return _context46.stop();
|
|
4163
4177
|
}
|
|
@@ -4303,11 +4317,93 @@ var Server = /*#__PURE__*/function () {
|
|
|
4303
4317
|
}
|
|
4304
4318
|
return buildSmallTicketProductMap;
|
|
4305
4319
|
}()
|
|
4320
|
+
}, {
|
|
4321
|
+
key: "withPendingSyncProductTitles",
|
|
4322
|
+
value: function withPendingSyncProductTitles(order, productMap) {
|
|
4323
|
+
var _this12 = this;
|
|
4324
|
+
var products = Array.isArray(order.products) ? order.products : null;
|
|
4325
|
+
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
4326
|
+
return _objectSpread(_objectSpread({}, order), {}, {
|
|
4327
|
+
products: products.map(function (product) {
|
|
4328
|
+
return _objectSpread(_objectSpread({}, product), {}, {
|
|
4329
|
+
product_title: _this12.buildProductTitleSnapshot(product, productMap)
|
|
4330
|
+
});
|
|
4331
|
+
})
|
|
4332
|
+
});
|
|
4333
|
+
}
|
|
4334
|
+
}, {
|
|
4335
|
+
key: "buildProductTitleSnapshot",
|
|
4336
|
+
value: function buildProductTitleSnapshot(product, productMap) {
|
|
4337
|
+
var _product$product_id2,
|
|
4338
|
+
_product$product,
|
|
4339
|
+
_fallbackProduct$prod,
|
|
4340
|
+
_this13 = this;
|
|
4341
|
+
var productId = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product.id;
|
|
4342
|
+
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
4343
|
+
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
4344
|
+
var fallbackTitle = (fallbackProduct === null || fallbackProduct === void 0 ? void 0 : fallbackProduct.product_title) || (fallbackProduct === null || fallbackProduct === void 0 ? void 0 : fallbackProduct.title) || (fallbackProduct === null || fallbackProduct === void 0 ? void 0 : fallbackProduct.name) || (fallbackProduct === null || fallbackProduct === void 0 ? void 0 : fallbackProduct.format_title) || (fallbackProduct === null || fallbackProduct === void 0 || (_fallbackProduct$prod = fallbackProduct.product) === null || _fallbackProduct$prod === void 0 ? void 0 : _fallbackProduct$prod.title);
|
|
4345
|
+
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
4346
|
+
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
4347
|
+
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
4348
|
+
snapshot[key] = _this13.resolveProductTitleValue(ownTitle, key, currentLocale) || _this13.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
4349
|
+
return snapshot;
|
|
4350
|
+
}, {});
|
|
4351
|
+
}
|
|
4352
|
+
}, {
|
|
4353
|
+
key: "getProductTitleSnapshotCurrentLocale",
|
|
4354
|
+
value: function getProductTitleSnapshotCurrentLocale() {
|
|
4355
|
+
var _this$core$context2, _this$core$context3;
|
|
4356
|
+
var shopInfo = this.getSmallTicketShopInfo();
|
|
4357
|
+
var rawLocale = shopInfo.primary_locale || this.getAppData('locale') || this.getAppData('language') || ((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 ? void 0 : _this$core$context2.locale) || ((_this$core$context3 = this.core.context) === null || _this$core$context3 === void 0 ? void 0 : _this$core$context3.language);
|
|
4358
|
+
return this.normalizeProductTitleSnapshotLocale(rawLocale);
|
|
4359
|
+
}
|
|
4360
|
+
}, {
|
|
4361
|
+
key: "normalizeProductTitleSnapshotLocale",
|
|
4362
|
+
value: function normalizeProductTitleSnapshotLocale(value) {
|
|
4363
|
+
if (typeof value !== 'string' || !value) return null;
|
|
4364
|
+
var normalized = value.replace('_', '-');
|
|
4365
|
+
var matchedKey = PRODUCT_TITLE_SNAPSHOT_KEYS.find(function (key) {
|
|
4366
|
+
return key === normalized;
|
|
4367
|
+
});
|
|
4368
|
+
return matchedKey !== null && matchedKey !== void 0 ? matchedKey : null;
|
|
4369
|
+
}
|
|
4370
|
+
}, {
|
|
4371
|
+
key: "resolveProductTitleValue",
|
|
4372
|
+
value: function resolveProductTitleValue(value, key, currentLocale) {
|
|
4373
|
+
var _ref56, _ref57, _value$key;
|
|
4374
|
+
if (value === undefined || value === null || value === '') return null;
|
|
4375
|
+
if (_typeof(value) !== 'object') {
|
|
4376
|
+
if (key === 'auto' || key === 'original' || key === currentLocale) return String(value);
|
|
4377
|
+
return null;
|
|
4378
|
+
}
|
|
4379
|
+
var normalizedKey = key.replace('-', '_');
|
|
4380
|
+
var dashedKey = key.replace('_', '-');
|
|
4381
|
+
var rawValue = (_ref56 = (_ref57 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref57 !== void 0 ? _ref57 : value[dashedKey]) !== null && _ref56 !== void 0 ? _ref56 : key === 'auto' ? value.default : undefined;
|
|
4382
|
+
if (rawValue === undefined || rawValue === null || rawValue === '') return null;
|
|
4383
|
+
if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
|
|
4384
|
+
return String(rawValue);
|
|
4385
|
+
}
|
|
4386
|
+
}, {
|
|
4387
|
+
key: "resolveFirstProductTitleValue",
|
|
4388
|
+
value: function resolveFirstProductTitleValue(value) {
|
|
4389
|
+
if (value === undefined || value === null || value === '') return null;
|
|
4390
|
+
if (_typeof(value) !== 'object') return String(value);
|
|
4391
|
+
var preferredKeys = ['auto', 'en', 'original', 'zh-CN', 'zh_CN', 'zh-HK', 'zh_HK', 'kitchen', 'ja', 'pt', 'default'];
|
|
4392
|
+
for (var _i2 = 0, _preferredKeys = preferredKeys; _i2 < _preferredKeys.length; _i2++) {
|
|
4393
|
+
var _key5 = _preferredKeys[_i2];
|
|
4394
|
+
var rawValue = value[_key5];
|
|
4395
|
+
if (rawValue !== undefined && rawValue !== null && rawValue !== '') return String(rawValue);
|
|
4396
|
+
}
|
|
4397
|
+
var firstValue = Object.values(value).find(function (item) {
|
|
4398
|
+
return item !== undefined && item !== null && item !== '';
|
|
4399
|
+
});
|
|
4400
|
+
return firstValue === undefined ? null : String(firstValue);
|
|
4401
|
+
}
|
|
4306
4402
|
}, {
|
|
4307
4403
|
key: "withLocalSmallTicketData",
|
|
4308
4404
|
value: function () {
|
|
4309
4405
|
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(order, options) {
|
|
4310
|
-
var productMap, smallTicketData;
|
|
4406
|
+
var _options$productMap, productMap, smallTicketData;
|
|
4311
4407
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4312
4408
|
while (1) switch (_context49.prev = _context49.next) {
|
|
4313
4409
|
case 0:
|
|
@@ -4324,10 +4420,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
4324
4420
|
return _context49.abrupt("return", order);
|
|
4325
4421
|
case 4:
|
|
4326
4422
|
_context49.prev = 4;
|
|
4327
|
-
|
|
4423
|
+
if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
|
|
4424
|
+
_context49.next = 9;
|
|
4425
|
+
break;
|
|
4426
|
+
}
|
|
4427
|
+
_context49.t0 = _options$productMap;
|
|
4428
|
+
_context49.next = 12;
|
|
4429
|
+
break;
|
|
4430
|
+
case 9:
|
|
4431
|
+
_context49.next = 11;
|
|
4328
4432
|
return this.buildSmallTicketProductMap(order);
|
|
4329
|
-
case
|
|
4330
|
-
|
|
4433
|
+
case 11:
|
|
4434
|
+
_context49.t0 = _context49.sent;
|
|
4435
|
+
case 12:
|
|
4436
|
+
productMap = _context49.t0;
|
|
4331
4437
|
smallTicketData = buildSmallTicketData({
|
|
4332
4438
|
order: order,
|
|
4333
4439
|
shopInfo: this.getSmallTicketShopInfo(),
|
|
@@ -4338,18 +4444,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
4338
4444
|
small_ticket_data: smallTicketData
|
|
4339
4445
|
})
|
|
4340
4446
|
}));
|
|
4341
|
-
case
|
|
4342
|
-
_context49.prev =
|
|
4343
|
-
_context49.
|
|
4447
|
+
case 17:
|
|
4448
|
+
_context49.prev = 17;
|
|
4449
|
+
_context49.t1 = _context49["catch"](4);
|
|
4344
4450
|
this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
|
|
4345
|
-
error: _context49.
|
|
4451
|
+
error: _context49.t1 instanceof Error ? _context49.t1.message : String(_context49.t1)
|
|
4346
4452
|
});
|
|
4347
4453
|
return _context49.abrupt("return", order);
|
|
4348
|
-
case
|
|
4454
|
+
case 21:
|
|
4349
4455
|
case "end":
|
|
4350
4456
|
return _context49.stop();
|
|
4351
4457
|
}
|
|
4352
|
-
}, _callee49, this, [[4,
|
|
4458
|
+
}, _callee49, this, [[4, 17]]);
|
|
4353
4459
|
}));
|
|
4354
4460
|
function withLocalSmallTicketData(_x52, _x53) {
|
|
4355
4461
|
return _withLocalSmallTicketData.apply(this, arguments);
|
|
@@ -4393,8 +4499,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
4393
4499
|
pushRaw(this.extractQueryParam(url, 'order_ids'));
|
|
4394
4500
|
var seen = new Set();
|
|
4395
4501
|
var result = [];
|
|
4396
|
-
for (var
|
|
4397
|
-
var id = _collected[
|
|
4502
|
+
for (var _i3 = 0, _collected = collected; _i3 < _collected.length; _i3++) {
|
|
4503
|
+
var id = _collected[_i3];
|
|
4398
4504
|
if (seen.has(id)) continue;
|
|
4399
4505
|
seen.add(id);
|
|
4400
4506
|
result.push(id);
|
|
@@ -4672,8 +4778,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
4672
4778
|
value: function extractOrderDataFromCheckoutResponse(response) {
|
|
4673
4779
|
var _response$data5, _response$data6;
|
|
4674
4780
|
var candidates = [response === null || response === void 0 || (_response$data5 = response.data) === null || _response$data5 === void 0 ? void 0 : _response$data5.order, response === null || response === void 0 || (_response$data6 = response.data) === null || _response$data6 === void 0 ? void 0 : _response$data6.sales, response === null || response === void 0 ? void 0 : response.data, response === null || response === void 0 ? void 0 : response.order, response === null || response === void 0 ? void 0 : response.sales, response];
|
|
4675
|
-
for (var
|
|
4676
|
-
var candidate = _candidates[
|
|
4781
|
+
for (var _i4 = 0, _candidates = candidates; _i4 < _candidates.length; _i4++) {
|
|
4782
|
+
var candidate = _candidates[_i4];
|
|
4677
4783
|
if (!candidate || _typeof(candidate) !== 'object') continue;
|
|
4678
4784
|
if (candidate.order_id !== undefined && candidate.order_id !== null) {
|
|
4679
4785
|
return candidate;
|
|
@@ -4702,6 +4808,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
4702
4808
|
}
|
|
4703
4809
|
return patch;
|
|
4704
4810
|
}
|
|
4811
|
+
}, {
|
|
4812
|
+
key: "buildSyncedOrderForPrint",
|
|
4813
|
+
value: function buildSyncedOrderForPrint(params) {
|
|
4814
|
+
var syncedOrder = params.syncedOrder,
|
|
4815
|
+
checkoutResponseOrder = params.checkoutResponseOrder;
|
|
4816
|
+
if (!checkoutResponseOrder || _typeof(checkoutResponseOrder) !== 'object') return syncedOrder;
|
|
4817
|
+
var printableOrder = _objectSpread({}, syncedOrder);
|
|
4818
|
+
var responseOrder = checkoutResponseOrder;
|
|
4819
|
+
if (responseOrder.order_id !== undefined && responseOrder.order_id !== null) {
|
|
4820
|
+
printableOrder.order_id = responseOrder.order_id;
|
|
4821
|
+
}
|
|
4822
|
+
if (responseOrder.payment_status !== undefined && responseOrder.payment_status !== null) {
|
|
4823
|
+
printableOrder.payment_status = responseOrder.payment_status;
|
|
4824
|
+
}
|
|
4825
|
+
if (responseOrder.expect_amount !== undefined && responseOrder.expect_amount !== null) {
|
|
4826
|
+
printableOrder.expect_amount = responseOrder.expect_amount;
|
|
4827
|
+
}
|
|
4828
|
+
if (responseOrder.machine_code_print_info_v2 !== undefined) {
|
|
4829
|
+
printableOrder.machine_code_print_info_v2 = responseOrder.machine_code_print_info_v2;
|
|
4830
|
+
}
|
|
4831
|
+
if (responseOrder.payment_info && _typeof(responseOrder.payment_info) === 'object') {
|
|
4832
|
+
printableOrder.payment_info = _objectSpread(_objectSpread({}, syncedOrder.payment_info || {}), responseOrder.payment_info);
|
|
4833
|
+
}
|
|
4834
|
+
return printableOrder;
|
|
4835
|
+
}
|
|
4705
4836
|
}, {
|
|
4706
4837
|
key: "isMergeableCheckoutOrder",
|
|
4707
4838
|
value: function isMergeableCheckoutOrder(order, externalSaleNumber) {
|
|
@@ -4742,10 +4873,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4742
4873
|
value: function extractBackendErrorResponse(error) {
|
|
4743
4874
|
var _error$response,
|
|
4744
4875
|
_error$response2,
|
|
4745
|
-
|
|
4876
|
+
_this14 = this;
|
|
4746
4877
|
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
4747
4878
|
return candidates.find(function (candidate) {
|
|
4748
|
-
return
|
|
4879
|
+
return _this14.isExplicitBackendErrorResponse(candidate);
|
|
4749
4880
|
}) || null;
|
|
4750
4881
|
}
|
|
4751
4882
|
}, {
|
|
@@ -5057,7 +5188,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5057
5188
|
value: (function () {
|
|
5058
5189
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(context, options) {
|
|
5059
5190
|
var _menu_list_ids$length3,
|
|
5060
|
-
|
|
5191
|
+
_this15 = this;
|
|
5061
5192
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
5062
5193
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5063
5194
|
while (1) switch (_context54.prev = _context54.next) {
|
|
@@ -5207,8 +5338,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
5207
5338
|
tMenu = performance.now();
|
|
5208
5339
|
menuList = this.menu.getMenuByIds(menu_list_ids);
|
|
5209
5340
|
activeMenuList = menuList.filter(function (menu) {
|
|
5210
|
-
var
|
|
5211
|
-
return ((
|
|
5341
|
+
var _this15$schedule;
|
|
5342
|
+
return ((_this15$schedule = _this15.schedule) === null || _this15$schedule === void 0 ? void 0 : _this15$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
5212
5343
|
});
|
|
5213
5344
|
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
5214
5345
|
totalMenu: menuList.length,
|
|
@@ -5477,7 +5608,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5477
5608
|
}, {
|
|
5478
5609
|
key: "notifySalesSearchSubscribers",
|
|
5479
5610
|
value: function notifySalesSearchSubscribers(payload) {
|
|
5480
|
-
var
|
|
5611
|
+
var _this16 = this;
|
|
5481
5612
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
5482
5613
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
5483
5614
|
if (changedOrders.length === 0) {
|
|
@@ -5492,21 +5623,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
5492
5623
|
subscriber = _step19$value[1];
|
|
5493
5624
|
try {
|
|
5494
5625
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
5495
|
-
var orderId =
|
|
5626
|
+
var orderId = _this16.getSalesSearchOrderId(order);
|
|
5496
5627
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
5497
5628
|
});
|
|
5498
5629
|
if (changedVisibleOrders.length === 0) {
|
|
5499
5630
|
return 1; // continue
|
|
5500
5631
|
}
|
|
5501
|
-
subscriber.callback(
|
|
5502
|
-
|
|
5632
|
+
subscriber.callback(_this16.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
5633
|
+
_this16.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
5503
5634
|
subscriberId: subscriberId,
|
|
5504
5635
|
kind: subscriber.kind,
|
|
5505
5636
|
count: changedVisibleOrders.length
|
|
5506
5637
|
});
|
|
5507
5638
|
} catch (error) {
|
|
5508
5639
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
5509
|
-
|
|
5640
|
+
_this16.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
5510
5641
|
subscriberId: subscriberId,
|
|
5511
5642
|
error: errorMessage
|
|
5512
5643
|
});
|
|
@@ -80,6 +80,16 @@ export interface OrderProductMetadata {
|
|
|
80
80
|
unique_identification_number?: string;
|
|
81
81
|
[key: string]: unknown;
|
|
82
82
|
}
|
|
83
|
+
export interface OrderProductTitleSnapshot {
|
|
84
|
+
en: string | null;
|
|
85
|
+
ja: string | null;
|
|
86
|
+
pt: string | null;
|
|
87
|
+
auto: string | null;
|
|
88
|
+
'zh-CN': string | null;
|
|
89
|
+
'zh-HK': string | null;
|
|
90
|
+
kitchen: string | null;
|
|
91
|
+
original: string | null;
|
|
92
|
+
}
|
|
83
93
|
/**
|
|
84
94
|
* 订单级商品行(3.3 products)。
|
|
85
95
|
* 订单级别的非预约关联商品;预约关联商品在 bookings 内。
|
|
@@ -92,6 +102,8 @@ export interface OrderProductLineItem {
|
|
|
92
102
|
product_id?: number | null;
|
|
93
103
|
/** 数量。创建/更新时必填。来源:Detail.product_quantity */
|
|
94
104
|
num: number;
|
|
105
|
+
/** 商品标题快照;本地待同步订单会补齐为多语言对象。 */
|
|
106
|
+
product_title?: OrderProductTitleSnapshot | string | null;
|
|
95
107
|
/** 多规格 ID。来源:Detail.product_variant_id */
|
|
96
108
|
product_variant_id?: number;
|
|
97
109
|
/**
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 6 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
package/lib/server/index.d.ts
CHANGED
|
@@ -405,6 +405,12 @@ declare class Server {
|
|
|
405
405
|
private sumPaidOrderPayments;
|
|
406
406
|
private toAmountNumber;
|
|
407
407
|
private buildSmallTicketProductMap;
|
|
408
|
+
private withPendingSyncProductTitles;
|
|
409
|
+
private buildProductTitleSnapshot;
|
|
410
|
+
private getProductTitleSnapshotCurrentLocale;
|
|
411
|
+
private normalizeProductTitleSnapshotLocale;
|
|
412
|
+
private resolveProductTitleValue;
|
|
413
|
+
private resolveFirstProductTitleValue;
|
|
408
414
|
private withLocalSmallTicketData;
|
|
409
415
|
private handleOrderSalesDetail;
|
|
410
416
|
/**
|
|
@@ -439,6 +445,7 @@ declare class Server {
|
|
|
439
445
|
private extractOrderDataFromCheckoutResponse;
|
|
440
446
|
private getCheckoutExternalSaleNumber;
|
|
441
447
|
private buildCheckoutSyncSuccessPatch;
|
|
448
|
+
private buildSyncedOrderForPrint;
|
|
442
449
|
private isMergeableCheckoutOrder;
|
|
443
450
|
private normalizeCheckoutResponse;
|
|
444
451
|
private isCheckoutResponseRejected;
|
package/lib/server/index.js
CHANGED
|
@@ -51,6 +51,16 @@ var import_filterOrders = require("./modules/order/utils/filterOrders");
|
|
|
51
51
|
var import_filterBookings = require("./modules/order/utils/filterBookings");
|
|
52
52
|
var import_small_ticket = require("./utils/small-ticket");
|
|
53
53
|
__reExport(server_exports, require("./modules"), module.exports);
|
|
54
|
+
var PRODUCT_TITLE_SNAPSHOT_KEYS = [
|
|
55
|
+
"en",
|
|
56
|
+
"ja",
|
|
57
|
+
"pt",
|
|
58
|
+
"auto",
|
|
59
|
+
"zh-CN",
|
|
60
|
+
"zh-HK",
|
|
61
|
+
"kitchen",
|
|
62
|
+
"original"
|
|
63
|
+
];
|
|
54
64
|
var Server = class {
|
|
55
65
|
constructor(core) {
|
|
56
66
|
this.quotationAvailableCache = /* @__PURE__ */ new Map();
|
|
@@ -1170,10 +1180,14 @@ var Server = class {
|
|
|
1170
1180
|
order_id: fresh == null ? void 0 : fresh.order_id
|
|
1171
1181
|
});
|
|
1172
1182
|
}
|
|
1173
|
-
|
|
1183
|
+
const printableSyncedOrder = syncedOrder ? this.buildSyncedOrderForPrint({
|
|
1184
|
+
syncedOrder,
|
|
1185
|
+
checkoutResponseOrder: fresh
|
|
1186
|
+
}) : void 0;
|
|
1187
|
+
if (printableSyncedOrder && this.shouldPrintSyncedOrder({ checkoutData: data, syncedOrder: printableSyncedOrder })) {
|
|
1174
1188
|
await this.dispatchPrintOtherReceiptTask({
|
|
1175
1189
|
checkoutData: data,
|
|
1176
|
-
syncedOrder,
|
|
1190
|
+
syncedOrder: printableSyncedOrder,
|
|
1177
1191
|
response,
|
|
1178
1192
|
deviceId: (_c = ctx.task) == null ? void 0 : _c.device_id
|
|
1179
1193
|
});
|
|
@@ -1570,7 +1584,7 @@ var Server = class {
|
|
|
1570
1584
|
},
|
|
1571
1585
|
{
|
|
1572
1586
|
method: "post",
|
|
1573
|
-
path: "/local/print-order",
|
|
1587
|
+
path: "/shop/local/print-order",
|
|
1574
1588
|
handler: this.handleLocalPrintOrder.bind(this)
|
|
1575
1589
|
}
|
|
1576
1590
|
]);
|
|
@@ -2537,12 +2551,18 @@ var Server = class {
|
|
|
2537
2551
|
const hasStorageKey = data.external_sale_number !== void 0 && data.external_sale_number !== null && data.external_sale_number !== "" ? true : data.order_id !== void 0 && data.order_id !== null && data.order_id !== "";
|
|
2538
2552
|
if (!hasStorageKey)
|
|
2539
2553
|
return null;
|
|
2554
|
+
const pendingOrder = {
|
|
2555
|
+
...data,
|
|
2556
|
+
need_sync: 1
|
|
2557
|
+
};
|
|
2558
|
+
const productMap = await this.buildSmallTicketProductMap(pendingOrder);
|
|
2559
|
+
const orderWithProductTitles = this.withPendingSyncProductTitles(
|
|
2560
|
+
pendingOrder,
|
|
2561
|
+
productMap
|
|
2562
|
+
);
|
|
2540
2563
|
return this.withLocalSmallTicketData(
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
need_sync: 1
|
|
2544
|
-
},
|
|
2545
|
-
{ requireFullyPaid: true }
|
|
2564
|
+
orderWithProductTitles,
|
|
2565
|
+
{ requireFullyPaid: true, productMap }
|
|
2546
2566
|
);
|
|
2547
2567
|
}
|
|
2548
2568
|
shouldBuildSmallTicketData(order) {
|
|
@@ -2635,13 +2655,96 @@ var Server = class {
|
|
|
2635
2655
|
return map;
|
|
2636
2656
|
}, {});
|
|
2637
2657
|
}
|
|
2658
|
+
withPendingSyncProductTitles(order, productMap) {
|
|
2659
|
+
const products = Array.isArray(order.products) ? order.products : null;
|
|
2660
|
+
if (!(products == null ? void 0 : products.length))
|
|
2661
|
+
return order;
|
|
2662
|
+
return {
|
|
2663
|
+
...order,
|
|
2664
|
+
products: products.map((product) => ({
|
|
2665
|
+
...product,
|
|
2666
|
+
product_title: this.buildProductTitleSnapshot(product, productMap)
|
|
2667
|
+
}))
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
buildProductTitleSnapshot(product, productMap) {
|
|
2671
|
+
var _a, _b;
|
|
2672
|
+
const productId = product.product_id ?? product.id;
|
|
2673
|
+
const fallbackProduct = productId !== void 0 && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
2674
|
+
const ownTitle = product.product_title || product.title || product.name || ((_a = product.product) == null ? void 0 : _a.title);
|
|
2675
|
+
const fallbackTitle = (fallbackProduct == null ? void 0 : fallbackProduct.product_title) || (fallbackProduct == null ? void 0 : fallbackProduct.title) || (fallbackProduct == null ? void 0 : fallbackProduct.name) || (fallbackProduct == null ? void 0 : fallbackProduct.format_title) || ((_b = fallbackProduct == null ? void 0 : fallbackProduct.product) == null ? void 0 : _b.title);
|
|
2676
|
+
const currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
2677
|
+
const autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
2678
|
+
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce((snapshot, key) => {
|
|
2679
|
+
snapshot[key] = this.resolveProductTitleValue(ownTitle, key, currentLocale) || this.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === "auto" || key === "original" ? autoTitle : null);
|
|
2680
|
+
return snapshot;
|
|
2681
|
+
}, {});
|
|
2682
|
+
}
|
|
2683
|
+
getProductTitleSnapshotCurrentLocale() {
|
|
2684
|
+
var _a, _b;
|
|
2685
|
+
const shopInfo = this.getSmallTicketShopInfo();
|
|
2686
|
+
const rawLocale = shopInfo.primary_locale || this.getAppData("locale") || this.getAppData("language") || ((_a = this.core.context) == null ? void 0 : _a.locale) || ((_b = this.core.context) == null ? void 0 : _b.language);
|
|
2687
|
+
return this.normalizeProductTitleSnapshotLocale(rawLocale);
|
|
2688
|
+
}
|
|
2689
|
+
normalizeProductTitleSnapshotLocale(value) {
|
|
2690
|
+
if (typeof value !== "string" || !value)
|
|
2691
|
+
return null;
|
|
2692
|
+
const normalized = value.replace("_", "-");
|
|
2693
|
+
const matchedKey = PRODUCT_TITLE_SNAPSHOT_KEYS.find((key) => key === normalized);
|
|
2694
|
+
return matchedKey ?? null;
|
|
2695
|
+
}
|
|
2696
|
+
resolveProductTitleValue(value, key, currentLocale) {
|
|
2697
|
+
if (value === void 0 || value === null || value === "")
|
|
2698
|
+
return null;
|
|
2699
|
+
if (typeof value !== "object") {
|
|
2700
|
+
if (key === "auto" || key === "original" || key === currentLocale)
|
|
2701
|
+
return String(value);
|
|
2702
|
+
return null;
|
|
2703
|
+
}
|
|
2704
|
+
const normalizedKey = key.replace("-", "_");
|
|
2705
|
+
const dashedKey = key.replace("_", "-");
|
|
2706
|
+
const rawValue = value[key] ?? value[normalizedKey] ?? value[dashedKey] ?? (key === "auto" ? value.default : void 0);
|
|
2707
|
+
if (rawValue === void 0 || rawValue === null || rawValue === "")
|
|
2708
|
+
return null;
|
|
2709
|
+
if (typeof rawValue === "object")
|
|
2710
|
+
return this.resolveFirstProductTitleValue(rawValue);
|
|
2711
|
+
return String(rawValue);
|
|
2712
|
+
}
|
|
2713
|
+
resolveFirstProductTitleValue(value) {
|
|
2714
|
+
if (value === void 0 || value === null || value === "")
|
|
2715
|
+
return null;
|
|
2716
|
+
if (typeof value !== "object")
|
|
2717
|
+
return String(value);
|
|
2718
|
+
const preferredKeys = [
|
|
2719
|
+
"auto",
|
|
2720
|
+
"en",
|
|
2721
|
+
"original",
|
|
2722
|
+
"zh-CN",
|
|
2723
|
+
"zh_CN",
|
|
2724
|
+
"zh-HK",
|
|
2725
|
+
"zh_HK",
|
|
2726
|
+
"kitchen",
|
|
2727
|
+
"ja",
|
|
2728
|
+
"pt",
|
|
2729
|
+
"default"
|
|
2730
|
+
];
|
|
2731
|
+
for (const key of preferredKeys) {
|
|
2732
|
+
const rawValue = value[key];
|
|
2733
|
+
if (rawValue !== void 0 && rawValue !== null && rawValue !== "")
|
|
2734
|
+
return String(rawValue);
|
|
2735
|
+
}
|
|
2736
|
+
const firstValue = Object.values(value).find(
|
|
2737
|
+
(item) => item !== void 0 && item !== null && item !== ""
|
|
2738
|
+
);
|
|
2739
|
+
return firstValue === void 0 ? null : String(firstValue);
|
|
2740
|
+
}
|
|
2638
2741
|
async withLocalSmallTicketData(order, options) {
|
|
2639
2742
|
if (!this.shouldBuildSmallTicketData(order))
|
|
2640
2743
|
return order;
|
|
2641
2744
|
if ((options == null ? void 0 : options.requireFullyPaid) && !this.isSalesOrderFullyPaid(order))
|
|
2642
2745
|
return order;
|
|
2643
2746
|
try {
|
|
2644
|
-
const productMap = await this.buildSmallTicketProductMap(order);
|
|
2747
|
+
const productMap = (options == null ? void 0 : options.productMap) ?? await this.buildSmallTicketProductMap(order);
|
|
2645
2748
|
const smallTicketData = (0, import_small_ticket.buildSmallTicketData)({
|
|
2646
2749
|
order,
|
|
2647
2750
|
shopInfo: this.getSmallTicketShopInfo(),
|
|
@@ -2874,6 +2977,32 @@ var Server = class {
|
|
|
2874
2977
|
}
|
|
2875
2978
|
return patch;
|
|
2876
2979
|
}
|
|
2980
|
+
buildSyncedOrderForPrint(params) {
|
|
2981
|
+
const { syncedOrder, checkoutResponseOrder } = params;
|
|
2982
|
+
if (!checkoutResponseOrder || typeof checkoutResponseOrder !== "object")
|
|
2983
|
+
return syncedOrder;
|
|
2984
|
+
const printableOrder = { ...syncedOrder };
|
|
2985
|
+
const responseOrder = checkoutResponseOrder;
|
|
2986
|
+
if (responseOrder.order_id !== void 0 && responseOrder.order_id !== null) {
|
|
2987
|
+
printableOrder.order_id = responseOrder.order_id;
|
|
2988
|
+
}
|
|
2989
|
+
if (responseOrder.payment_status !== void 0 && responseOrder.payment_status !== null) {
|
|
2990
|
+
printableOrder.payment_status = responseOrder.payment_status;
|
|
2991
|
+
}
|
|
2992
|
+
if (responseOrder.expect_amount !== void 0 && responseOrder.expect_amount !== null) {
|
|
2993
|
+
printableOrder.expect_amount = responseOrder.expect_amount;
|
|
2994
|
+
}
|
|
2995
|
+
if (responseOrder.machine_code_print_info_v2 !== void 0) {
|
|
2996
|
+
printableOrder.machine_code_print_info_v2 = responseOrder.machine_code_print_info_v2;
|
|
2997
|
+
}
|
|
2998
|
+
if (responseOrder.payment_info && typeof responseOrder.payment_info === "object") {
|
|
2999
|
+
printableOrder.payment_info = {
|
|
3000
|
+
...syncedOrder.payment_info || {},
|
|
3001
|
+
...responseOrder.payment_info
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
return printableOrder;
|
|
3005
|
+
}
|
|
2877
3006
|
isMergeableCheckoutOrder(order, externalSaleNumber) {
|
|
2878
3007
|
if (!order || typeof order !== "object")
|
|
2879
3008
|
return false;
|
|
@@ -80,6 +80,16 @@ export interface OrderProductMetadata {
|
|
|
80
80
|
unique_identification_number?: string;
|
|
81
81
|
[key: string]: unknown;
|
|
82
82
|
}
|
|
83
|
+
export interface OrderProductTitleSnapshot {
|
|
84
|
+
en: string | null;
|
|
85
|
+
ja: string | null;
|
|
86
|
+
pt: string | null;
|
|
87
|
+
auto: string | null;
|
|
88
|
+
'zh-CN': string | null;
|
|
89
|
+
'zh-HK': string | null;
|
|
90
|
+
kitchen: string | null;
|
|
91
|
+
original: string | null;
|
|
92
|
+
}
|
|
83
93
|
/**
|
|
84
94
|
* 订单级商品行(3.3 products)。
|
|
85
95
|
* 订单级别的非预约关联商品;预约关联商品在 bookings 内。
|
|
@@ -92,6 +102,8 @@ export interface OrderProductLineItem {
|
|
|
92
102
|
product_id?: number | null;
|
|
93
103
|
/** 数量。创建/更新时必填。来源:Detail.product_quantity */
|
|
94
104
|
num: number;
|
|
105
|
+
/** 商品标题快照;本地待同步订单会补齐为多语言对象。 */
|
|
106
|
+
product_title?: OrderProductTitleSnapshot | string | null;
|
|
95
107
|
/** 多规格 ID。来源:Detail.product_variant_id */
|
|
96
108
|
product_variant_id?: number;
|
|
97
109
|
/**
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 6 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|