@pisell/pisellos 2.2.163 → 2.2.165
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/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +157 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +191 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.js +23 -22
- package/dist/modules/Discount/index.js +4 -3
- package/dist/modules/Order/index.d.ts +25 -7
- package/dist/modules/Order/index.js +608 -291
- package/dist/modules/Order/types.d.ts +46 -14
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +76 -23
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +46 -7
- package/dist/solution/BaseSales/index.js +928 -312
- package/dist/solution/BaseSales/types.d.ts +51 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +159 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
- package/dist/solution/BaseSales/utils.js +36 -7
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +124 -1
- package/dist/solution/BookingTicket/index.js +488 -90
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +334 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +36 -7
- package/dist/solution/VenueBooking/index.d.ts +4 -2
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +174 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +177 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.js +8 -8
- package/lib/modules/Discount/index.js +5 -1
- package/lib/modules/Order/index.d.ts +25 -7
- package/lib/modules/Order/index.js +268 -72
- package/lib/modules/Order/types.d.ts +46 -14
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +66 -15
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/solution/BaseSales/index.d.ts +46 -7
- package/lib/solution/BaseSales/index.js +369 -17
- package/lib/solution/BaseSales/types.d.ts +51 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +201 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
- package/lib/solution/BaseSales/utils.js +37 -5
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +124 -1
- package/lib/solution/BookingTicket/index.js +255 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +308 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +37 -5
- package/lib/solution/VenueBooking/index.d.ts +4 -2
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +1 -1
|
@@ -30,12 +30,16 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
30
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
31
31
|
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); }
|
|
32
32
|
import { createBookingTicketModule } from "./types";
|
|
33
|
+
import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
|
|
33
34
|
import { BaseSalesImpl } from "../BaseSales";
|
|
34
35
|
import Scan from "./utils/scan";
|
|
35
36
|
import { formatOrderCustomerPatch } from "./utils/orderCustomer";
|
|
36
37
|
import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
|
|
37
38
|
import scanCache from "./utils/scan/scanCache";
|
|
38
39
|
import { buildCartView } from "./utils/cartView";
|
|
40
|
+
import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
|
|
41
|
+
import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
|
|
42
|
+
import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
|
|
39
43
|
import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
|
|
40
44
|
export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
41
45
|
_inherits(BookingTicketImpl, _BaseSalesImpl);
|
|
@@ -57,16 +61,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
57
61
|
_defineProperty(_assertThisInitialized(_this), "platform", void 0);
|
|
58
62
|
_defineProperty(_assertThisInitialized(_this), "scan", void 0);
|
|
59
63
|
_defineProperty(_assertThisInitialized(_this), "productCatalog", []);
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
60
66
|
return _this;
|
|
61
67
|
}
|
|
62
68
|
_createClass(BookingTicketImpl, [{
|
|
63
69
|
key: "getRegisteredModuleNames",
|
|
64
70
|
value:
|
|
65
71
|
/**
|
|
66
|
-
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
|
|
72
|
+
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
|
|
73
|
+
* bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
|
|
67
74
|
*/
|
|
68
75
|
function getRegisteredModuleNames() {
|
|
69
|
-
return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer']);
|
|
76
|
+
return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext']);
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "getSubmitOrderSalesChannel",
|
|
80
|
+
value: function getSubmitOrderSalesChannel() {
|
|
81
|
+
return 'pos';
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
/**
|
|
@@ -125,7 +137,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
125
137
|
key: "loadSalesDetail",
|
|
126
138
|
value: (function () {
|
|
127
139
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIdOrParams) {
|
|
128
|
-
var
|
|
140
|
+
var _ref;
|
|
141
|
+
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref2, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
129
142
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
130
143
|
while (1) switch (_context2.prev = _context2.next) {
|
|
131
144
|
case 0:
|
|
@@ -136,21 +149,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
136
149
|
console.log(sales, '1234sales');
|
|
137
150
|
customerModule = this.store.customer;
|
|
138
151
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
153
|
+
protocolCustomerId = sales === null || sales === void 0 ? void 0 : sales.customer_id;
|
|
154
|
+
protocolCustomer = protocolCustomerId !== undefined && protocolCustomerId !== null ? {
|
|
155
|
+
id: protocolCustomerId,
|
|
156
|
+
name: String((sales === null || sales === void 0 ? void 0 : sales.customer_name) || ''),
|
|
157
|
+
phone: sales === null || sales === void 0 ? void 0 : sales.phone,
|
|
158
|
+
email: sales === null || sales === void 0 ? void 0 : sales.email,
|
|
159
|
+
country_calling_code: sales === null || sales === void 0 ? void 0 : sales.country_calling_code
|
|
160
|
+
} : null;
|
|
161
|
+
selectedCustomer = (_ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref !== void 0 ? _ref : protocolCustomer;
|
|
162
|
+
if (!(customerModule && selectedCustomer)) {
|
|
163
|
+
_context2.next = 18;
|
|
164
|
+
break;
|
|
151
165
|
}
|
|
166
|
+
_ref2 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref2.id, detailCustomerRest = _objectWithoutProperties(_ref2, _excluded);
|
|
167
|
+
rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
|
|
168
|
+
customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
|
|
169
|
+
id: rawId == null ? '' : rawId,
|
|
170
|
+
name: (_selectedCustomer$nam = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.name) !== null && _selectedCustomer$nam !== void 0 ? _selectedCustomer$nam : '',
|
|
171
|
+
phone: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.phone,
|
|
172
|
+
email: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.email,
|
|
173
|
+
country_calling_code: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.country_calling_code
|
|
174
|
+
});
|
|
175
|
+
customerModule.setSelectedCustomer(customer);
|
|
176
|
+
this.setOrderCustomer(customer);
|
|
177
|
+
_context2.next = 18;
|
|
178
|
+
return this.store.order.saveDraft();
|
|
179
|
+
case 18:
|
|
152
180
|
return _context2.abrupt("return", sales);
|
|
153
|
-
case
|
|
181
|
+
case 19:
|
|
154
182
|
case "end":
|
|
155
183
|
return _context2.stop();
|
|
156
184
|
}
|
|
@@ -304,6 +332,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
304
332
|
customer_id,
|
|
305
333
|
menu_list_ids,
|
|
306
334
|
schedule_datetime,
|
|
335
|
+
bookingDate,
|
|
307
336
|
_result,
|
|
308
337
|
_args5 = arguments;
|
|
309
338
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
@@ -311,30 +340,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
311
340
|
case 0:
|
|
312
341
|
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
313
342
|
options = _args5.length > 1 ? _args5[1] : undefined;
|
|
314
|
-
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
|
|
315
|
-
|
|
316
|
-
|
|
343
|
+
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 与 products 格式化器对齐日历日(YYYY-MM-DD);勿写入 schedule_datetime 全串,
|
|
344
|
+
// 否则 requiresDetail 会把带时分秒的 date 传给弹窗,handleOpenProductModal 无法打开。
|
|
345
|
+
bookingDate = schedule_date || (schedule_datetime ? String(schedule_datetime).slice(0, 10) : '');
|
|
346
|
+
if (bookingDate) {
|
|
347
|
+
this.setBookingDate(bookingDate);
|
|
348
|
+
}
|
|
349
|
+
_context5.prev = 5;
|
|
350
|
+
_context5.next = 8;
|
|
317
351
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
318
352
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
319
353
|
with_schedule: 1
|
|
320
354
|
}, params), {}, {
|
|
321
355
|
cacheId: this.cacheId
|
|
322
356
|
}), options);
|
|
323
|
-
case
|
|
357
|
+
case 8:
|
|
324
358
|
_result = _context5.sent;
|
|
325
359
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
326
360
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
327
361
|
return _context5.abrupt("return", _result);
|
|
328
|
-
case
|
|
329
|
-
_context5.prev =
|
|
330
|
-
_context5.t0 = _context5["catch"](
|
|
362
|
+
case 14:
|
|
363
|
+
_context5.prev = 14;
|
|
364
|
+
_context5.t0 = _context5["catch"](5);
|
|
331
365
|
console.error('Failed to load products:', _context5.t0);
|
|
332
366
|
throw _context5.t0;
|
|
333
|
-
case
|
|
367
|
+
case 18:
|
|
334
368
|
case "end":
|
|
335
369
|
return _context5.stop();
|
|
336
370
|
}
|
|
337
|
-
}, _callee5, this, [[
|
|
371
|
+
}, _callee5, this, [[5, 14]]);
|
|
338
372
|
}));
|
|
339
373
|
function loadProducts() {
|
|
340
374
|
return _loadProducts.apply(this, arguments);
|
|
@@ -662,6 +696,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
662
696
|
this.store.order.setOrderCustomer(patch, customer);
|
|
663
697
|
var next = this.buildOrderCustomerPayload();
|
|
664
698
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
|
|
699
|
+
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
665
700
|
}
|
|
666
701
|
|
|
667
702
|
/**
|
|
@@ -692,7 +727,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
692
727
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
|
|
693
728
|
}
|
|
694
729
|
|
|
695
|
-
/**
|
|
730
|
+
/**
|
|
731
|
+
* 重置 tempOrder,并同步清空下单客户运行态。
|
|
732
|
+
*
|
|
733
|
+
* OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
|
|
734
|
+
* - emit BookingTicket `onOrderCustomerChange`
|
|
735
|
+
* - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
|
|
736
|
+
*
|
|
737
|
+
* 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
|
|
738
|
+
*/
|
|
739
|
+
}, {
|
|
740
|
+
key: "restoreOrder",
|
|
741
|
+
value: (function () {
|
|
742
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
743
|
+
var _this$store$customer;
|
|
744
|
+
var tempOrder;
|
|
745
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
746
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
747
|
+
case 0:
|
|
748
|
+
_context11.next = 2;
|
|
749
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
750
|
+
case 2:
|
|
751
|
+
tempOrder = _context11.sent;
|
|
752
|
+
this.clearOrderCustomer();
|
|
753
|
+
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
754
|
+
return _context11.abrupt("return", tempOrder);
|
|
755
|
+
case 6:
|
|
756
|
+
case "end":
|
|
757
|
+
return _context11.stop();
|
|
758
|
+
}
|
|
759
|
+
}, _callee11, this);
|
|
760
|
+
}));
|
|
761
|
+
function restoreOrder() {
|
|
762
|
+
return _restoreOrder.apply(this, arguments);
|
|
763
|
+
}
|
|
764
|
+
return restoreOrder;
|
|
765
|
+
}() /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */)
|
|
696
766
|
}, {
|
|
697
767
|
key: "buildOrderCustomerPayload",
|
|
698
768
|
value: function buildOrderCustomerPayload() {
|
|
@@ -703,6 +773,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
703
773
|
snapshot: this.store.order.getOrderCustomerSnapshot()
|
|
704
774
|
};
|
|
705
775
|
}
|
|
776
|
+
}, {
|
|
777
|
+
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
778
|
+
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
779
|
+
var _this2 = this;
|
|
780
|
+
if (!customerId || customerId === 1) return;
|
|
781
|
+
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
785
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
786
|
+
var currentCustomer;
|
|
787
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
788
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
789
|
+
case 0:
|
|
790
|
+
if (!previousRefresh) {
|
|
791
|
+
_context12.next = 3;
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
_context12.next = 3;
|
|
795
|
+
return previousRefresh.catch(function () {
|
|
796
|
+
return undefined;
|
|
797
|
+
});
|
|
798
|
+
case 3:
|
|
799
|
+
currentCustomer = _this2.store.order.getOrderCustomer();
|
|
800
|
+
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
801
|
+
_context12.next = 6;
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
return _context12.abrupt("return");
|
|
805
|
+
case 6:
|
|
806
|
+
_context12.next = 8;
|
|
807
|
+
return _this2.loadDiscountConfig({
|
|
808
|
+
customerId: customerId
|
|
809
|
+
});
|
|
810
|
+
case 8:
|
|
811
|
+
case "end":
|
|
812
|
+
return _context12.stop();
|
|
813
|
+
}
|
|
814
|
+
}, _callee12);
|
|
815
|
+
}))();
|
|
816
|
+
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
817
|
+
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
818
|
+
refreshTask.catch(function (error) {
|
|
819
|
+
console.error('Failed to load discount config after customer change:', error);
|
|
820
|
+
}).finally(function () {
|
|
821
|
+
if (_this2.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
822
|
+
_this2.orderCustomerDiscountRefreshInFlight = null;
|
|
823
|
+
_this2.orderCustomerDiscountRefreshCustomerId = null;
|
|
824
|
+
});
|
|
825
|
+
}
|
|
706
826
|
|
|
707
827
|
/**
|
|
708
828
|
* 获取客户分页信息
|
|
@@ -744,27 +864,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
744
864
|
}, {
|
|
745
865
|
key: "changeCustomerPage",
|
|
746
866
|
value: (function () {
|
|
747
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
867
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(page, pageSize) {
|
|
748
868
|
var _result3;
|
|
749
|
-
return _regeneratorRuntime().wrap(function
|
|
750
|
-
while (1) switch (
|
|
869
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
870
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
751
871
|
case 0:
|
|
752
|
-
|
|
753
|
-
|
|
872
|
+
_context13.prev = 0;
|
|
873
|
+
_context13.next = 3;
|
|
754
874
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
755
875
|
case 3:
|
|
756
|
-
_result3 =
|
|
757
|
-
return
|
|
876
|
+
_result3 = _context13.sent;
|
|
877
|
+
return _context13.abrupt("return", _result3);
|
|
758
878
|
case 7:
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
console.error('Failed to change customer page:',
|
|
762
|
-
throw
|
|
879
|
+
_context13.prev = 7;
|
|
880
|
+
_context13.t0 = _context13["catch"](0);
|
|
881
|
+
console.error('Failed to change customer page:', _context13.t0);
|
|
882
|
+
throw _context13.t0;
|
|
763
883
|
case 11:
|
|
764
884
|
case "end":
|
|
765
|
-
return
|
|
885
|
+
return _context13.stop();
|
|
766
886
|
}
|
|
767
|
-
},
|
|
887
|
+
}, _callee13, this, [[0, 7]]);
|
|
768
888
|
}));
|
|
769
889
|
function changeCustomerPage(_x8, _x9) {
|
|
770
890
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -779,28 +899,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
779
899
|
}, {
|
|
780
900
|
key: "loadMoreCustomers",
|
|
781
901
|
value: (function () {
|
|
782
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
902
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
783
903
|
var _result4;
|
|
784
|
-
return _regeneratorRuntime().wrap(function
|
|
785
|
-
while (1) switch (
|
|
904
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
905
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
786
906
|
case 0:
|
|
787
|
-
|
|
788
|
-
|
|
907
|
+
_context14.prev = 0;
|
|
908
|
+
_context14.next = 3;
|
|
789
909
|
return this.store.customer.loadMoreCustomers();
|
|
790
910
|
case 3:
|
|
791
|
-
_result4 =
|
|
911
|
+
_result4 = _context14.sent;
|
|
792
912
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
|
|
793
|
-
return
|
|
913
|
+
return _context14.abrupt("return", _result4);
|
|
794
914
|
case 8:
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
console.error('Failed to load more customers:',
|
|
798
|
-
throw
|
|
915
|
+
_context14.prev = 8;
|
|
916
|
+
_context14.t0 = _context14["catch"](0);
|
|
917
|
+
console.error('Failed to load more customers:', _context14.t0);
|
|
918
|
+
throw _context14.t0;
|
|
799
919
|
case 12:
|
|
800
920
|
case "end":
|
|
801
|
-
return
|
|
921
|
+
return _context14.stop();
|
|
802
922
|
}
|
|
803
|
-
},
|
|
923
|
+
}, _callee14, this, [[0, 8]]);
|
|
804
924
|
}));
|
|
805
925
|
function loadMoreCustomers() {
|
|
806
926
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -816,31 +936,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
816
936
|
}, {
|
|
817
937
|
key: "resetAndLoadCustomers",
|
|
818
938
|
value: (function () {
|
|
819
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
939
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
820
940
|
var params,
|
|
821
941
|
_result5,
|
|
822
|
-
|
|
823
|
-
return _regeneratorRuntime().wrap(function
|
|
824
|
-
while (1) switch (
|
|
942
|
+
_args15 = arguments;
|
|
943
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
944
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
825
945
|
case 0:
|
|
826
|
-
params =
|
|
827
|
-
|
|
828
|
-
|
|
946
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
947
|
+
_context15.prev = 1;
|
|
948
|
+
_context15.next = 4;
|
|
829
949
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
830
950
|
case 4:
|
|
831
|
-
_result5 =
|
|
951
|
+
_result5 = _context15.sent;
|
|
832
952
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
|
|
833
|
-
return
|
|
953
|
+
return _context15.abrupt("return", _result5);
|
|
834
954
|
case 9:
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
console.error('Failed to reset and load customers:',
|
|
838
|
-
throw
|
|
955
|
+
_context15.prev = 9;
|
|
956
|
+
_context15.t0 = _context15["catch"](1);
|
|
957
|
+
console.error('Failed to reset and load customers:', _context15.t0);
|
|
958
|
+
throw _context15.t0;
|
|
839
959
|
case 13:
|
|
840
960
|
case "end":
|
|
841
|
-
return
|
|
961
|
+
return _context15.stop();
|
|
842
962
|
}
|
|
843
|
-
},
|
|
963
|
+
}, _callee15, this, [[1, 9]]);
|
|
844
964
|
}));
|
|
845
965
|
function resetAndLoadCustomers() {
|
|
846
966
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -885,9 +1005,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
885
1005
|
}, {
|
|
886
1006
|
key: "scanGlobalListener",
|
|
887
1007
|
value: function scanGlobalListener(callback) {
|
|
888
|
-
var
|
|
1008
|
+
var _this3 = this;
|
|
889
1009
|
var localSearch = function localSearch(v) {
|
|
890
|
-
return
|
|
1010
|
+
return _this3.store.products.findProductsByCodeOrBarcode(v);
|
|
891
1011
|
};
|
|
892
1012
|
var scanCallback = handleGlobalScan(this.request, localSearch);
|
|
893
1013
|
var safeCallback = function safeCallback(d) {
|
|
@@ -1002,15 +1122,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1002
1122
|
}, {
|
|
1003
1123
|
key: "setOtherParams",
|
|
1004
1124
|
value: (function () {
|
|
1005
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1125
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1126
|
+
var _ref4,
|
|
1127
|
+
_ref4$cover,
|
|
1008
1128
|
cover,
|
|
1009
|
-
|
|
1010
|
-
return _regeneratorRuntime().wrap(function
|
|
1011
|
-
while (1) switch (
|
|
1129
|
+
_args16 = arguments;
|
|
1130
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1131
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1012
1132
|
case 0:
|
|
1013
|
-
|
|
1133
|
+
_ref4 = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
1014
1134
|
if (cover) {
|
|
1015
1135
|
this.otherParams = params;
|
|
1016
1136
|
} else {
|
|
@@ -1018,9 +1138,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1018
1138
|
}
|
|
1019
1139
|
case 2:
|
|
1020
1140
|
case "end":
|
|
1021
|
-
return
|
|
1141
|
+
return _context16.stop();
|
|
1022
1142
|
}
|
|
1023
|
-
},
|
|
1143
|
+
}, _callee16, this);
|
|
1024
1144
|
}));
|
|
1025
1145
|
function setOtherParams(_x10) {
|
|
1026
1146
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -1035,21 +1155,299 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1035
1155
|
}, {
|
|
1036
1156
|
key: "getOtherParams",
|
|
1037
1157
|
value: (function () {
|
|
1038
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1039
|
-
return _regeneratorRuntime().wrap(function
|
|
1040
|
-
while (1) switch (
|
|
1158
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1159
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1160
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1041
1161
|
case 0:
|
|
1042
|
-
return
|
|
1162
|
+
return _context17.abrupt("return", this.otherParams);
|
|
1043
1163
|
case 1:
|
|
1044
1164
|
case "end":
|
|
1045
|
-
return
|
|
1165
|
+
return _context17.stop();
|
|
1046
1166
|
}
|
|
1047
|
-
},
|
|
1167
|
+
}, _callee17, this);
|
|
1048
1168
|
}));
|
|
1049
1169
|
function getOtherParams() {
|
|
1050
1170
|
return _getOtherParams.apply(this, arguments);
|
|
1051
1171
|
}
|
|
1052
1172
|
return getOtherParams;
|
|
1173
|
+
}() // ─── BookingContext API(透传给 BookingContextModule) ──────────────────────
|
|
1174
|
+
// SalesSdkProvider 挂载时默认调 initBookingContext;也可由 UI 显式 set* 灌入已有数据。
|
|
1175
|
+
/** 拉取 board config 并写入 BookingContext。 */
|
|
1176
|
+
)
|
|
1177
|
+
}, {
|
|
1178
|
+
key: "loadBookingConfig",
|
|
1179
|
+
value: function loadBookingConfig(params) {
|
|
1180
|
+
return this.store.bookingContext.loadBookingConfig(params);
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/** 拉取资源全集并写入 BookingContext。 */
|
|
1184
|
+
}, {
|
|
1185
|
+
key: "loadBookingResources",
|
|
1186
|
+
value: function loadBookingResources(params) {
|
|
1187
|
+
return this.store.bookingContext.loadResources(params);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/** 初始化 BookingContext(date + config + resources)。 */
|
|
1191
|
+
}, {
|
|
1192
|
+
key: "initBookingContext",
|
|
1193
|
+
value: function initBookingContext(params) {
|
|
1194
|
+
return this.store.bookingContext.initBookingContext(params);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
|
|
1198
|
+
}, {
|
|
1199
|
+
key: "isBookingContextReady",
|
|
1200
|
+
value: function isBookingContextReady(params) {
|
|
1201
|
+
return this.store.bookingContext.isBookingContextReady(params);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/** 写入 booking config(来源:`/core/board/management/config`)。 */
|
|
1205
|
+
}, {
|
|
1206
|
+
key: "setBookingConfig",
|
|
1207
|
+
value: function setBookingConfig(config) {
|
|
1208
|
+
this.store.bookingContext.setBookingConfig(config);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/** 读取当前 booking config。 */
|
|
1212
|
+
}, {
|
|
1213
|
+
key: "getBookingConfig",
|
|
1214
|
+
value: function getBookingConfig() {
|
|
1215
|
+
return this.store.bookingContext.getBookingConfig();
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
1219
|
+
}, {
|
|
1220
|
+
key: "setResources",
|
|
1221
|
+
value: function setResources(resources) {
|
|
1222
|
+
this.store.bookingContext.setResources(resources);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/** 读取资源全集(浅克隆)。 */
|
|
1226
|
+
}, {
|
|
1227
|
+
key: "getResourcesOrigin",
|
|
1228
|
+
value: function getResourcesOrigin() {
|
|
1229
|
+
return this.store.bookingContext.getResourcesOrigin();
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
/** 读取资源全集 map(id → resource)。 */
|
|
1233
|
+
}, {
|
|
1234
|
+
key: "getResourcesOriginMap",
|
|
1235
|
+
value: function getResourcesOriginMap() {
|
|
1236
|
+
return this.store.bookingContext.getResourcesOriginMap();
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/** 写入当前选择的日期;支持 dayjs / Date / string。 */
|
|
1240
|
+
}, {
|
|
1241
|
+
key: "setBookingDate",
|
|
1242
|
+
value: function setBookingDate(date) {
|
|
1243
|
+
this.store.bookingContext.setDate(date);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/** 读取当前选择的日期(统一 string)。 */
|
|
1247
|
+
}, {
|
|
1248
|
+
key: "getBookingDate",
|
|
1249
|
+
value: function getBookingDate() {
|
|
1250
|
+
return this.store.bookingContext.getDate();
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
|
|
1254
|
+
}, {
|
|
1255
|
+
key: "getBookingContextState",
|
|
1256
|
+
value: function getBookingContextState() {
|
|
1257
|
+
return this.store.bookingContext.getState();
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/** 清空 BookingContext(切租户 / destroy 场景)。 */
|
|
1261
|
+
}, {
|
|
1262
|
+
key: "clearBookingContext",
|
|
1263
|
+
value: function clearBookingContext() {
|
|
1264
|
+
this.store.bookingContext.clear();
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
|
|
1269
|
+
*/
|
|
1270
|
+
}, {
|
|
1271
|
+
key: "buildBookingCalcContext",
|
|
1272
|
+
value: function buildBookingCalcContext(extra) {
|
|
1273
|
+
var _extra$date, _extra$presetStartTim;
|
|
1274
|
+
var state = this.store.bookingContext.getState();
|
|
1275
|
+
var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
|
|
1276
|
+
return _objectSpread({
|
|
1277
|
+
bookingConfig: state.bookingConfig,
|
|
1278
|
+
resourcesOrigin: state.resourcesOrigin,
|
|
1279
|
+
resourcesOriginMap: state.resourcesOriginMap,
|
|
1280
|
+
date: date,
|
|
1281
|
+
presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
|
|
1282
|
+
}, extra || {});
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
|
|
1287
|
+
* `extraResources` 用于把拖入未绑定的资源也展示出来。
|
|
1288
|
+
*/
|
|
1289
|
+
}, {
|
|
1290
|
+
key: "getResourcesForProduct",
|
|
1291
|
+
value: function getResourcesForProduct(product, options) {
|
|
1292
|
+
var _ctx$bookingConfig;
|
|
1293
|
+
var ctx = this.buildBookingCalcContext();
|
|
1294
|
+
return getResourceByIdsUtil(ctx.resourcesOriginMap || {}, product, {
|
|
1295
|
+
resourceTab: (_ctx$bookingConfig = ctx.bookingConfig) === null || _ctx$bookingConfig === void 0 || (_ctx$bookingConfig = _ctx$bookingConfig.config) === null || _ctx$bookingConfig === void 0 ? void 0 : _ctx$bookingConfig.resource_tab,
|
|
1296
|
+
resourcesOrigin: ctx.resourcesOrigin,
|
|
1297
|
+
extraResources: (options === null || options === void 0 ? void 0 : options.extraResources) || []
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
|
|
1303
|
+
*/
|
|
1304
|
+
}, {
|
|
1305
|
+
key: "getProductExtend",
|
|
1306
|
+
value: function getProductExtend(cacheItem, extra) {
|
|
1307
|
+
return getProductExtendUtil({
|
|
1308
|
+
cacheItem: cacheItem,
|
|
1309
|
+
ctx: this.buildBookingCalcContext(extra)
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
|
|
1315
|
+
*/
|
|
1316
|
+
}, {
|
|
1317
|
+
key: "getResourceErrors",
|
|
1318
|
+
value: function getResourceErrors(resource, cacheItem) {
|
|
1319
|
+
return getResourceErrorsUtil(resource, cacheItem);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// ─── addProduct 决策 / 转换 API(SDK 加车下沉所需) ─────────────────────────
|
|
1323
|
+
// 这一组方法是 SalesSdkCartContext.addProduct / confirmDetail 的 OS 后端。
|
|
1324
|
+
// 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
|
|
1325
|
+
// 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* 拼装 addProductDecision 通用上下文(从 store 自取)。
|
|
1329
|
+
*/
|
|
1330
|
+
}, {
|
|
1331
|
+
key: "buildAddProductCtx",
|
|
1332
|
+
value: function buildAddProductCtx(extra) {
|
|
1333
|
+
var _extra$date2, _ref5, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get3, _extra$presetStartTim2;
|
|
1334
|
+
var bookingContextState = this.store.bookingContext.getState();
|
|
1335
|
+
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
1336
|
+
var orderCustomerId = (_ref5 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get3 = this.store.order.getTempOrder()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id) !== null && _ref5 !== void 0 ? _ref5 : undefined;
|
|
1337
|
+
return _objectSpread({
|
|
1338
|
+
bookingConfig: bookingContextState.bookingConfig,
|
|
1339
|
+
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
1340
|
+
resourcesOriginMap: bookingContextState.resourcesOriginMap,
|
|
1341
|
+
date: date,
|
|
1342
|
+
presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
|
|
1343
|
+
customerId: orderCustomerId
|
|
1344
|
+
}, extra || {});
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
1349
|
+
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
1350
|
+
*/
|
|
1351
|
+
}, {
|
|
1352
|
+
key: "decideAddProduct",
|
|
1353
|
+
value: function decideAddProduct(item, options) {
|
|
1354
|
+
return decideAddProductUtil(item, this.buildAddProductCtx(options));
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
/** 规格弹窗 callback 后的第二段决策。 */
|
|
1358
|
+
}, {
|
|
1359
|
+
key: "decideAfterDetail",
|
|
1360
|
+
value: function decideAfterDetail(cacheItem, options) {
|
|
1361
|
+
return decideAfterDetailUtil(cacheItem, this.buildAddProductCtx(options));
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
|
|
1366
|
+
*/
|
|
1367
|
+
}, {
|
|
1368
|
+
key: "decideAutoClose",
|
|
1369
|
+
value: function decideAutoClose(item, options) {
|
|
1370
|
+
return decideAutoCloseUtil(item, this.buildAddProductCtx(options));
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
/** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
|
|
1374
|
+
}, {
|
|
1375
|
+
key: "getIsEject",
|
|
1376
|
+
value: function getIsEject(item) {
|
|
1377
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
|
|
1378
|
+
return getIsEjectUtil(item, type);
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/** 仅 session 商品(无 variant/option/package)→ true。 */
|
|
1382
|
+
}, {
|
|
1383
|
+
key: "getIsOnlySession",
|
|
1384
|
+
value: function getIsOnlySession(item) {
|
|
1385
|
+
return getIsOnlySessionUtil(item);
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
|
|
1390
|
+
*/
|
|
1391
|
+
}, {
|
|
1392
|
+
key: "buildRequiresDetailPayload",
|
|
1393
|
+
value: function buildRequiresDetailPayload(item, options) {
|
|
1394
|
+
return _buildRequiresDetailPayload(item, this.buildAddProductCtx(options));
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
/**
|
|
1398
|
+
* 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
|
|
1399
|
+
* 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
|
|
1400
|
+
*/
|
|
1401
|
+
}, {
|
|
1402
|
+
key: "transformDetailToProductAndBooking",
|
|
1403
|
+
value: function transformDetailToProductAndBooking(input) {
|
|
1404
|
+
var item = input.item,
|
|
1405
|
+
preparedCacheItem = input.cacheItem,
|
|
1406
|
+
detailResult = input.detailResult,
|
|
1407
|
+
options = input.options;
|
|
1408
|
+
var ctx = this.buildAddProductCtx(options);
|
|
1409
|
+
var cacheItem = preparedCacheItem || (detailResult ? buildCacheItemFromDetail(item, detailResult, ctx) : buildCacheItemFromCartDetail(item, ctx));
|
|
1410
|
+
return transformDetailToProductAndBookingUtil(cacheItem, ctx);
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
|
|
1415
|
+
* 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
|
|
1416
|
+
*/
|
|
1417
|
+
}, {
|
|
1418
|
+
key: "buildCacheItemFromOrderLine",
|
|
1419
|
+
value: function buildCacheItemFromOrderLine(input) {
|
|
1420
|
+
return buildCacheItemFromOrderLineUtil(input);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
1425
|
+
*/
|
|
1426
|
+
}, {
|
|
1427
|
+
key: "buildNormalProductCacheItemFromOrderLine",
|
|
1428
|
+
value: function buildNormalProductCacheItemFromOrderLine(input) {
|
|
1429
|
+
return buildNormalProductCacheItemFromOrderLineUtil(input);
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
/** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
|
|
1433
|
+
}, {
|
|
1434
|
+
key: "updateProductInOrder",
|
|
1435
|
+
value: (function () {
|
|
1436
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1437
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1438
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1439
|
+
case 0:
|
|
1440
|
+
return _context18.abrupt("return", this.updateOrderProduct(params));
|
|
1441
|
+
case 1:
|
|
1442
|
+
case "end":
|
|
1443
|
+
return _context18.stop();
|
|
1444
|
+
}
|
|
1445
|
+
}, _callee18, this);
|
|
1446
|
+
}));
|
|
1447
|
+
function updateProductInOrder(_x11) {
|
|
1448
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
1449
|
+
}
|
|
1450
|
+
return updateProductInOrder;
|
|
1053
1451
|
}()
|
|
1054
1452
|
/**
|
|
1055
1453
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
@@ -1059,12 +1457,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1059
1457
|
}, {
|
|
1060
1458
|
key: "destroy",
|
|
1061
1459
|
value: (function () {
|
|
1062
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1460
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1063
1461
|
var _this$scan;
|
|
1064
|
-
return _regeneratorRuntime().wrap(function
|
|
1065
|
-
while (1) switch (
|
|
1462
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1463
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1066
1464
|
case 0:
|
|
1067
|
-
|
|
1465
|
+
_context19.next = 2;
|
|
1068
1466
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
1069
1467
|
case 2:
|
|
1070
1468
|
try {
|
|
@@ -1075,9 +1473,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1075
1473
|
scanCache.clear();
|
|
1076
1474
|
case 4:
|
|
1077
1475
|
case "end":
|
|
1078
|
-
return
|
|
1476
|
+
return _context19.stop();
|
|
1079
1477
|
}
|
|
1080
|
-
},
|
|
1478
|
+
}, _callee19, this);
|
|
1081
1479
|
}));
|
|
1082
1480
|
function destroy() {
|
|
1083
1481
|
return _destroy.apply(this, arguments);
|