@pisell/pisellos 2.2.221 → 2.2.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Customer/index.d.ts +7 -0
- package/dist/modules/Customer/index.js +27 -0
- package/dist/modules/OpenData/index.js +1 -1
- package/dist/modules/Order/index.js +17 -11
- package/dist/modules/Order/types.d.ts +3 -0
- package/dist/modules/Order/utils.js +6 -5
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/SalesSummary/index.js +3 -3
- package/dist/modules/Schedule/index.js +3 -1
- package/dist/modules/Summary/index.js +4 -3
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +48 -18
- package/dist/server/modules/order/index.js +3 -2
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/modules/order/utils/filterBookings.js +1 -1
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +99 -83
- package/dist/server/utils/small-ticket.d.ts +3 -1
- package/dist/server/utils/small-ticket.js +106 -18
- package/dist/solution/BaseSales/index.js +7 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +3 -1
- package/dist/solution/BookingTicket/index.js +12 -8
- package/lib/modules/Customer/index.d.ts +7 -0
- package/lib/modules/Customer/index.js +26 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.js +7 -3
- package/lib/modules/Order/types.d.ts +3 -0
- package/lib/modules/Order/utils.js +2 -1
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/SalesSummary/index.js +2 -1
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/Summary/index.js +5 -4
- package/lib/server/index.d.ts +2 -0
- package/lib/server/index.js +37 -7
- package/lib/server/modules/order/index.js +1 -0
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/modules/order/utils/filterBookings.js +7 -3
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +45 -39
- package/lib/server/utils/small-ticket.d.ts +3 -1
- package/lib/server/utils/small-ticket.js +85 -11
- package/lib/solution/BaseSales/index.js +6 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +3 -1
- package/lib/solution/BookingTicket/index.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -7,6 +7,13 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
7
7
|
private store;
|
|
8
8
|
private request;
|
|
9
9
|
private cacheId;
|
|
10
|
+
/**
|
|
11
|
+
* 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* this.isSameSelectedCustomer(currentCustomer, nextCustomer);
|
|
15
|
+
*/
|
|
16
|
+
private isSameSelectedCustomer;
|
|
10
17
|
private openCache;
|
|
11
18
|
private fatherModule;
|
|
12
19
|
private otherParams;
|
|
@@ -60,6 +60,30 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
60
|
return _this;
|
|
61
61
|
}
|
|
62
62
|
_createClass(CustomerModule, [{
|
|
63
|
+
key: "isSameSelectedCustomer",
|
|
64
|
+
value:
|
|
65
|
+
/**
|
|
66
|
+
* 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* this.isSameSelectedCustomer(currentCustomer, nextCustomer);
|
|
70
|
+
*/
|
|
71
|
+
function isSameSelectedCustomer(current, next) {
|
|
72
|
+
var _id, _id2;
|
|
73
|
+
var normalizedNext = !next ? DEFAULT_CUSTOMER : next;
|
|
74
|
+
var normalizedCurrent = current || null;
|
|
75
|
+
if (!normalizedCurrent) return false;
|
|
76
|
+
// Walk-In 是默认客户,展示文案 / 默认区号可能来自不同入口;同为 id=1 时视为同一客户。
|
|
77
|
+
if (String((_id = normalizedCurrent === null || normalizedCurrent === void 0 ? void 0 : normalizedCurrent.id) !== null && _id !== void 0 ? _id : '') === '1' && String((_id2 = normalizedNext === null || normalizedNext === void 0 ? void 0 : normalizedNext.id) !== null && _id2 !== void 0 ? _id2 : '') === '1') {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
var keys = ['id', 'name', 'phone', 'email', 'country_calling_code'];
|
|
81
|
+
return keys.every(function (key) {
|
|
82
|
+
var _key, _key2;
|
|
83
|
+
return String((_key = normalizedCurrent === null || normalizedCurrent === void 0 ? void 0 : normalizedCurrent[key]) !== null && _key !== void 0 ? _key : '') === String((_key2 = normalizedNext === null || normalizedNext === void 0 ? void 0 : normalizedNext[key]) !== null && _key2 !== void 0 ? _key2 : '');
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
63
87
|
key: "initialize",
|
|
64
88
|
value: function () {
|
|
65
89
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
@@ -396,6 +420,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
396
420
|
}, {
|
|
397
421
|
key: "setSelectedCustomer",
|
|
398
422
|
value: function setSelectedCustomer(customer) {
|
|
423
|
+
if (this.isSameSelectedCustomer(this.store.selectedCustomer, customer)) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
399
426
|
this.store.selectedCustomer = !customer ? DEFAULT_CUSTOMER : cloneDeep(customer);
|
|
400
427
|
this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), this.store.selectedCustomer);
|
|
401
428
|
this.storeChange();
|
|
@@ -155,7 +155,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
155
155
|
key: "checkAvailability",
|
|
156
156
|
value: function checkAvailability(scheduleModule) {
|
|
157
157
|
var _this$store$data;
|
|
158
|
-
var scheduleList = scheduleModule ? scheduleModule.getScheduleListByIds(((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['availability.operating_hours']) || []) : undefined;
|
|
158
|
+
var scheduleList = scheduleModule ? scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['availability.operating_hours']) || []) : undefined;
|
|
159
159
|
return computeAvailability({
|
|
160
160
|
config: this.store.data,
|
|
161
161
|
scheduleList: scheduleList
|
|
@@ -4236,8 +4236,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4236
4236
|
key: "hydrateTempOrderFromRecord",
|
|
4237
4237
|
value: (function () {
|
|
4238
4238
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(record, options) {
|
|
4239
|
-
var _this$store$discount13
|
|
4240
|
-
var raw, nextTempOrder, rawSummary, summarySurcharges, hydratedEditDiscounts;
|
|
4239
|
+
var _this$store$discount13;
|
|
4240
|
+
var raw, nextTempOrder, rawSummary, summarySurcharges, hydratedEditDiscounts, currentDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount14, _this$store$discount15;
|
|
4241
4241
|
return _regeneratorRuntime().wrap(function _callee34$(_context36) {
|
|
4242
4242
|
while (1) switch (_context36.prev = _context36.next) {
|
|
4243
4243
|
case 0:
|
|
@@ -4262,24 +4262,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4262
4262
|
});
|
|
4263
4263
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
4264
4264
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
_context36.next = 13;
|
|
4269
|
-
return (_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.setDiscountList(hydratedEditDiscounts);
|
|
4270
|
-
case 13:
|
|
4271
|
-
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
4265
|
+
currentDiscounts = typeof ((_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.getDiscountList) === 'function' ? this.store.discount.getDiscountList() || [] : [];
|
|
4266
|
+
shouldSkipEmptyDiscountSync = hydratedEditDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
4267
|
+
if (shouldSkipEmptyDiscountSync) {
|
|
4272
4268
|
_context36.next = 16;
|
|
4273
4269
|
break;
|
|
4274
4270
|
}
|
|
4271
|
+
_context36.next = 14;
|
|
4272
|
+
return (_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.setOriginalDiscountList(hydratedEditDiscounts);
|
|
4273
|
+
case 14:
|
|
4275
4274
|
_context36.next = 16;
|
|
4275
|
+
return (_this$store$discount15 = this.store.discount) === null || _this$store$discount15 === void 0 ? void 0 : _this$store$discount15.setDiscountList(hydratedEditDiscounts);
|
|
4276
|
+
case 16:
|
|
4277
|
+
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
4278
|
+
_context36.next = 19;
|
|
4279
|
+
break;
|
|
4280
|
+
}
|
|
4281
|
+
_context36.next = 19;
|
|
4276
4282
|
return this.recalculateSummary({
|
|
4277
4283
|
createIfMissing: false
|
|
4278
4284
|
});
|
|
4279
|
-
case
|
|
4285
|
+
case 19:
|
|
4280
4286
|
this.persistTempOrder();
|
|
4281
4287
|
return _context36.abrupt("return", nextTempOrder);
|
|
4282
|
-
case
|
|
4288
|
+
case 21:
|
|
4283
4289
|
case "end":
|
|
4284
4290
|
return _context36.stop();
|
|
4285
4291
|
}
|
|
@@ -434,6 +434,8 @@ export interface PaymentItemData {
|
|
|
434
434
|
name: string;
|
|
435
435
|
/** 支付类型 */
|
|
436
436
|
type: string;
|
|
437
|
+
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
438
|
+
payment_time?: string;
|
|
437
439
|
/** @deprecated BaseSales/Sales 协议不提交该字段;旧 Checkout/Payment 内部仍可能使用 */
|
|
438
440
|
isSynced?: boolean;
|
|
439
441
|
}
|
|
@@ -456,6 +458,7 @@ export interface OrderPaymentData {
|
|
|
456
458
|
origin_amount?: string;
|
|
457
459
|
service_fee?: string;
|
|
458
460
|
status?: 'active' | 'voided' | string;
|
|
461
|
+
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
459
462
|
payment_time?: string;
|
|
460
463
|
wallet_pass_usage_unit?: unknown;
|
|
461
464
|
wallet_pass_use_value?: string | number | null;
|
|
@@ -896,7 +896,7 @@ export function buildSubmitPayload(params) {
|
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
898
|
export function mapPaymentItemToOrderPayment(paymentItem) {
|
|
899
|
-
var _item$custom_payment_, _item$amount;
|
|
899
|
+
var _item$custom_payment_, _item$payment_time, _item$amount;
|
|
900
900
|
var item = paymentItem;
|
|
901
901
|
var customPaymentId = (_item$custom_payment_ = item.custom_payment_id) !== null && _item$custom_payment_ !== void 0 ? _item$custom_payment_ : item.id;
|
|
902
902
|
var metadata = item.metadata && _typeof(item.metadata) === 'object' ? _objectSpread({}, item.metadata) : {};
|
|
@@ -910,7 +910,8 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
910
910
|
metadata[key] = item[key];
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
|
|
913
|
+
var paymentTime = (_item$payment_time = item.payment_time) !== null && _item$payment_time !== void 0 ? _item$payment_time : dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
914
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, item.order_payment_id !== undefined ? {
|
|
914
915
|
order_payment_id: item.order_payment_id
|
|
915
916
|
} : {}), {}, {
|
|
916
917
|
amount: String((_item$amount = item.amount) !== null && _item$amount !== void 0 ? _item$amount : '0.00'),
|
|
@@ -926,9 +927,9 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
926
927
|
service_fee: String(item.service_fee)
|
|
927
928
|
} : {}), item.status !== undefined ? {
|
|
928
929
|
status: item.status
|
|
929
|
-
} : {}),
|
|
930
|
-
payment_time:
|
|
931
|
-
}
|
|
930
|
+
} : {}), {}, {
|
|
931
|
+
payment_time: paymentTime
|
|
932
|
+
}, item.wallet_pass_usage_unit !== undefined ? {
|
|
932
933
|
wallet_pass_usage_unit: item.wallet_pass_usage_unit
|
|
933
934
|
} : {}), item.wallet_pass_use_value !== undefined ? {
|
|
934
935
|
wallet_pass_use_value: item.wallet_pass_use_value
|
|
@@ -135,6 +135,8 @@ export interface PaymentItem {
|
|
|
135
135
|
origin_amount?: string;
|
|
136
136
|
/** 订单支付类型 */
|
|
137
137
|
order_payment_type?: 'normal' | 'deposit';
|
|
138
|
+
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
139
|
+
payment_time?: string;
|
|
138
140
|
/** 本支付项是否已成功同步到后端 */
|
|
139
141
|
isSynced?: boolean;
|
|
140
142
|
/** 最近一次同步失败信息(存在则代表同步失败过) */
|
|
@@ -158,7 +158,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
158
158
|
key: "getSummary",
|
|
159
159
|
value: function () {
|
|
160
160
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
161
|
-
var _ref;
|
|
161
|
+
var _this$store$surcharge, _ref;
|
|
162
162
|
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
163
163
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
164
164
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -166,9 +166,9 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
166
166
|
_params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount;
|
|
167
167
|
taxConfig = this.getTaxConfig();
|
|
168
168
|
summarySchedule = this.core.getModule("".concat(this.name.split('_')[0], "_schedule"));
|
|
169
|
-
needScheduleIds = this.store.surchargeList.map(function (item) {
|
|
169
|
+
needScheduleIds = (_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
|
|
170
170
|
return item.available_schedule_ids;
|
|
171
|
-
}).flat();
|
|
171
|
+
})) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat();
|
|
172
172
|
scheduleList = summarySchedule === null || summarySchedule === void 0 ? void 0 : summarySchedule.getScheduleListByIds(needScheduleIds);
|
|
173
173
|
scheduleById = {};
|
|
174
174
|
if (Array.isArray(scheduleList)) {
|
|
@@ -205,10 +205,12 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
205
|
}, {
|
|
206
206
|
key: "getScheduleListByIds",
|
|
207
207
|
value: function getScheduleListByIds(ids) {
|
|
208
|
+
var _this$store$scheduleL;
|
|
208
209
|
var idSet = new Set(ids.map(function (id) {
|
|
209
210
|
return String(id);
|
|
210
211
|
}));
|
|
211
|
-
|
|
212
|
+
console.log('getScheduleListByIds', this.store.scheduleList);
|
|
213
|
+
var list = (_this$store$scheduleL = this.store.scheduleList) === null || _this$store$scheduleL === void 0 ? void 0 : _this$store$scheduleL.filter(function (n) {
|
|
212
214
|
return idSet.has(String(n.id));
|
|
213
215
|
});
|
|
214
216
|
return list;
|
|
@@ -113,14 +113,14 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
113
113
|
key: "getSummary",
|
|
114
114
|
value: function () {
|
|
115
115
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(cartItems) {
|
|
116
|
-
var _this$shopStore$get;
|
|
116
|
+
var _this$shopStore$get, _this$store$surcharge;
|
|
117
117
|
var shopInfo, scheduleModule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary;
|
|
118
118
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
119
119
|
while (1) switch (_context3.prev = _context3.next) {
|
|
120
120
|
case 0:
|
|
121
121
|
shopInfo = ((_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.shop) || {};
|
|
122
122
|
scheduleModule = this.core.getModule('appointmentBooking_schedule');
|
|
123
|
-
needScheduleIds = this.store.surchargeList.map(function (item) {
|
|
123
|
+
needScheduleIds = (_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.map(function (item) {
|
|
124
124
|
return item.available_schedule_ids;
|
|
125
125
|
}).flat();
|
|
126
126
|
scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
|
|
@@ -208,9 +208,10 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
208
208
|
}, {
|
|
209
209
|
key: "getSurchargeforUtils",
|
|
210
210
|
value: function getSurchargeforUtils(items) {
|
|
211
|
+
var _this$store$surcharge2;
|
|
211
212
|
// const surchargeList = this.store.surchargeList;
|
|
212
213
|
var scheduleModule = this.core.getModule('appointmentBooking_schedule');
|
|
213
|
-
var needScheduleIds = this.store.surchargeList.map(function (item) {
|
|
214
|
+
var needScheduleIds = (_this$store$surcharge2 = this.store.surchargeList) === null || _this$store$surcharge2 === void 0 ? void 0 : _this$store$surcharge2.map(function (item) {
|
|
214
215
|
return item.available_schedule_ids;
|
|
215
216
|
}).flat();
|
|
216
217
|
var scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
|
package/dist/server/index.d.ts
CHANGED
|
@@ -412,6 +412,8 @@ declare class Server {
|
|
|
412
412
|
private getProductTitleSnapshotCurrentLocale;
|
|
413
413
|
private normalizeProductTitleSnapshotLocale;
|
|
414
414
|
private resolveProductTitleValue;
|
|
415
|
+
private canAssignStringProductTitleToLocale;
|
|
416
|
+
private hasCjkText;
|
|
415
417
|
private resolveFirstProductTitleValue;
|
|
416
418
|
private withLocalSmallTicketData;
|
|
417
419
|
private handleOrderSalesDetail;
|
package/dist/server/index.js
CHANGED
|
@@ -4216,9 +4216,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4216
4216
|
expect_amount: pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$summary2 = pendingOrder.summary) === null || _pendingOrder$summary2 === void 0 ? void 0 : _pendingOrder$summary2.expect_amount,
|
|
4217
4217
|
total_amount: pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$summary3 = pendingOrder.summary) === null || _pendingOrder$summary3 === void 0 ? void 0 : _pendingOrder$summary3.total_amount,
|
|
4218
4218
|
payment_status: pendingOrder === null || pendingOrder === void 0 ? void 0 : pendingOrder.payment_status,
|
|
4219
|
-
payment_info: {
|
|
4219
|
+
payment_info: _objectSpread(_objectSpread({}, (pendingOrder === null || pendingOrder === void 0 ? void 0 : pendingOrder.payment_info) || {}), {}, {
|
|
4220
4220
|
current_change_given_amount: changeGivenAmount
|
|
4221
|
-
}
|
|
4221
|
+
})
|
|
4222
4222
|
})
|
|
4223
4223
|
});
|
|
4224
4224
|
case 18:
|
|
@@ -4357,26 +4357,38 @@ var Server = /*#__PURE__*/function () {
|
|
|
4357
4357
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(order) {
|
|
4358
4358
|
var _this$products,
|
|
4359
4359
|
_this12 = this;
|
|
4360
|
-
var products, productIds, entries;
|
|
4360
|
+
var products, productIdSet, productIds, entries;
|
|
4361
4361
|
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4362
4362
|
while (1) switch (_context48.prev = _context48.next) {
|
|
4363
4363
|
case 0:
|
|
4364
4364
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
|
|
4365
|
-
|
|
4365
|
+
productIdSet = new Set();
|
|
4366
|
+
products.forEach(function (product) {
|
|
4366
4367
|
var _product$product_id;
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4368
|
+
var productId = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id;
|
|
4369
|
+
if (productId !== undefined && productId !== null && productId !== '') {
|
|
4370
|
+
productIdSet.add(productId);
|
|
4371
|
+
}
|
|
4372
|
+
if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
|
|
4373
|
+
product.product_bundle.forEach(function (bundle) {
|
|
4374
|
+
var _ref57, _bundle$bundle_produc;
|
|
4375
|
+
var bundleProductId = (_ref57 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref57 !== void 0 ? _ref57 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
|
|
4376
|
+
if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
|
|
4377
|
+
productIdSet.add(bundleProductId);
|
|
4378
|
+
}
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
});
|
|
4382
|
+
productIds = Array.from(productIdSet);
|
|
4371
4383
|
if (!(!productIds.length || typeof ((_this$products = this.products) === null || _this$products === void 0 ? void 0 : _this$products.getProductById) !== 'function')) {
|
|
4372
|
-
_context48.next =
|
|
4384
|
+
_context48.next = 6;
|
|
4373
4385
|
break;
|
|
4374
4386
|
}
|
|
4375
4387
|
return _context48.abrupt("return", {});
|
|
4376
|
-
case
|
|
4377
|
-
_context48.next =
|
|
4388
|
+
case 6:
|
|
4389
|
+
_context48.next = 8;
|
|
4378
4390
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
4379
|
-
var
|
|
4391
|
+
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(id) {
|
|
4380
4392
|
var _this12$products, _this12$products$getP, product;
|
|
4381
4393
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4382
4394
|
while (1) switch (_context47.prev = _context47.next) {
|
|
@@ -4402,10 +4414,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4402
4414
|
}, _callee47, null, [[0, 7]]);
|
|
4403
4415
|
}));
|
|
4404
4416
|
return function (_x51) {
|
|
4405
|
-
return
|
|
4417
|
+
return _ref58.apply(this, arguments);
|
|
4406
4418
|
};
|
|
4407
4419
|
}()));
|
|
4408
|
-
case
|
|
4420
|
+
case 8:
|
|
4409
4421
|
entries = _context48.sent;
|
|
4410
4422
|
return _context48.abrupt("return", entries.reduce(function (map, entry) {
|
|
4411
4423
|
if (!entry) return map;
|
|
@@ -4415,7 +4427,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4415
4427
|
map[id] = product;
|
|
4416
4428
|
return map;
|
|
4417
4429
|
}, {}));
|
|
4418
|
-
case
|
|
4430
|
+
case 10:
|
|
4419
4431
|
case "end":
|
|
4420
4432
|
return _context48.stop();
|
|
4421
4433
|
}
|
|
@@ -4479,19 +4491,37 @@ var Server = /*#__PURE__*/function () {
|
|
|
4479
4491
|
}, {
|
|
4480
4492
|
key: "resolveProductTitleValue",
|
|
4481
4493
|
value: function resolveProductTitleValue(value, key, currentLocale) {
|
|
4482
|
-
var
|
|
4494
|
+
var _ref59, _ref60, _value$key;
|
|
4483
4495
|
if (value === undefined || value === null || value === '') return null;
|
|
4484
4496
|
if (_typeof(value) !== 'object') {
|
|
4485
|
-
|
|
4497
|
+
var title = String(value);
|
|
4498
|
+
if (key === 'auto' || key === 'original') return title;
|
|
4499
|
+
if (key === currentLocale && this.canAssignStringProductTitleToLocale(title, currentLocale)) return title;
|
|
4486
4500
|
return null;
|
|
4487
4501
|
}
|
|
4488
4502
|
var normalizedKey = key.replace('-', '_');
|
|
4489
4503
|
var dashedKey = key.replace('_', '-');
|
|
4490
|
-
var rawValue = (
|
|
4504
|
+
var rawValue = (_ref59 = (_ref60 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref60 !== void 0 ? _ref60 : value[dashedKey]) !== null && _ref59 !== void 0 ? _ref59 : key === 'auto' ? value.default : undefined;
|
|
4491
4505
|
if (rawValue === undefined || rawValue === null || rawValue === '') return null;
|
|
4492
4506
|
if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
|
|
4493
4507
|
return String(rawValue);
|
|
4494
4508
|
}
|
|
4509
|
+
}, {
|
|
4510
|
+
key: "canAssignStringProductTitleToLocale",
|
|
4511
|
+
value: function canAssignStringProductTitleToLocale(title, locale) {
|
|
4512
|
+
if (!locale) return false;
|
|
4513
|
+
if (locale === 'zh-CN' || locale === 'zh-HK' || locale === 'kitchen') {
|
|
4514
|
+
return this.hasCjkText(title);
|
|
4515
|
+
}
|
|
4516
|
+
if (locale === 'ja') return /[\u3040-\u30ff]/.test(title) || this.hasCjkText(title);
|
|
4517
|
+
if (locale === 'en' || locale === 'pt') return !this.hasCjkText(title);
|
|
4518
|
+
return false;
|
|
4519
|
+
}
|
|
4520
|
+
}, {
|
|
4521
|
+
key: "hasCjkText",
|
|
4522
|
+
value: function hasCjkText(value) {
|
|
4523
|
+
return /[\u3400-\u9fff]/.test(value);
|
|
4524
|
+
}
|
|
4495
4525
|
}, {
|
|
4496
4526
|
key: "resolveFirstProductTitleValue",
|
|
4497
4527
|
value: function resolveFirstProductTitleValue(value) {
|
|
@@ -101,6 +101,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
101
101
|
case 0:
|
|
102
102
|
changedOrders = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
103
103
|
source = _args.length > 1 ? _args[1] : undefined;
|
|
104
|
+
console.log('触发emitOrdersChanged');
|
|
104
105
|
payload = {
|
|
105
106
|
list: this.store.list,
|
|
106
107
|
changedOrders: changedOrders.map(function (order) {
|
|
@@ -108,9 +109,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
108
109
|
}),
|
|
109
110
|
source: source
|
|
110
111
|
};
|
|
111
|
-
_context.next =
|
|
112
|
+
_context.next = 6;
|
|
112
113
|
return this.core.effects.emit(OrderHooks.onOrdersChanged, payload);
|
|
113
|
-
case
|
|
114
|
+
case 6:
|
|
114
115
|
case "end":
|
|
115
116
|
return _context.stop();
|
|
116
117
|
}
|
|
@@ -239,7 +239,7 @@ export interface OrderPaymentItem {
|
|
|
239
239
|
rounding_amount?: OrderMoneyString;
|
|
240
240
|
/** 支付状态:paid / voided / payment_pending 等 */
|
|
241
241
|
status?: OrderPaymentRecordStatus;
|
|
242
|
-
/**
|
|
242
|
+
/** 支付时间(输入/输出均保留)。来源:OrderPayment.payment_time */
|
|
243
243
|
payment_time?: string | null;
|
|
244
244
|
/** 手续费配置。来源:OrderPayment.service_charge */
|
|
245
245
|
service_charge?: Record<string, unknown> | null;
|
|
@@ -151,7 +151,7 @@ function matchOrder(order, ctx) {
|
|
|
151
151
|
// ─────────────────────────────────────────────────────────────────
|
|
152
152
|
|
|
153
153
|
function matchBooking(booking, orderInfo, ctx) {
|
|
154
|
-
if (ctx.enableChildBookingFilter) {
|
|
154
|
+
if (ctx.enableChildBookingFilter && booking.booking_id) {
|
|
155
155
|
var _parent_id, _item_type;
|
|
156
156
|
var parentId = Number((_parent_id = booking.parent_id) !== null && _parent_id !== void 0 ? _parent_id : 0);
|
|
157
157
|
var itemType = String((_item_type = booking.item_type) !== null && _item_type !== void 0 ? _item_type : '');
|
|
@@ -64,15 +64,15 @@ export declare class ScheduleModuleEx extends BaseModule implements Module, Sche
|
|
|
64
64
|
*/
|
|
65
65
|
getDateIsInSchedule(date: string, scheduleList: (ScheduleItem | number)[]): boolean;
|
|
66
66
|
/**
|
|
67
|
-
* 从
|
|
67
|
+
* 从 SQLite 加载日程数据
|
|
68
68
|
* @private
|
|
69
69
|
*/
|
|
70
|
-
private
|
|
70
|
+
private loadScheduleFromSQLite;
|
|
71
71
|
/**
|
|
72
|
-
* 保存日程数据到
|
|
72
|
+
* 保存日程数据到 SQLite
|
|
73
73
|
* @private
|
|
74
74
|
*/
|
|
75
|
-
private
|
|
75
|
+
private saveScheduleToSQLite;
|
|
76
76
|
/**
|
|
77
77
|
* 预加载模块数据(统一接口)
|
|
78
78
|
* 在模块注册后自动调用
|