@pisell/pisellos 2.3.114 → 2.3.116

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.
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 3 | 1 | 5 | 6 | 4;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -8,6 +8,7 @@ import { BaseSalesImpl } from '../BaseSales';
8
8
  import type { BaseSalesScanCodeResult } from '../BaseSales/types';
9
9
  import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
10
10
  import type { LoadSalesDetailParams } from '../../modules/Order/types';
11
+ import type { GlobalScanSearchType } from './utils/scan/formatGlobalScan';
11
12
  import type { AddAddTimeProductToBookingInput, AddAddTimeProductsToBookingInput, GlobalScanHandleResult, GlobalScanHostBridge } from './types';
12
13
  import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
13
14
  import { type BuildCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildCacheItemFromOrderLine';
@@ -29,6 +30,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
29
30
  private addTimeProductsCatalog;
30
31
  private orderCustomerDiscountRefreshInFlight;
31
32
  private orderCustomerDiscountRefreshCustomerId;
33
+ private orderCustomerDiscountRefreshTarget;
32
34
  private orderCustomerPromotionRefreshInFlight;
33
35
  protected loadOpenDataInFlight: Promise<OpenDataConfig> | null;
34
36
  protected loadOpenDataInFlightTarget: string | null;
@@ -537,6 +539,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
537
539
  * ```
538
540
  */
539
541
  handleGlobalScanCode(code: string, bridge?: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
542
+ /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */
543
+ getGlobalScanCodeType(code: string): Promise<GlobalScanSearchType | null>;
540
544
  resolveBestAddTimePlan(addTimeProducts: any[], targetMinutes: number): any;
541
545
  /**
542
546
  * 构造一条绑定到已有 booking 的加时商品行。
@@ -180,6 +180,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
180
180
  _defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
181
181
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
182
182
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
183
+ _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
183
184
  _defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
184
185
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
185
186
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
@@ -1890,15 +1891,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1890
1891
  }, {
1891
1892
  key: "refreshDiscountConfigAfterOrderCustomerChange",
1892
1893
  value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
1893
- var _this5 = this;
1894
+ var _this$store$order$get4,
1895
+ _this$store$order6,
1896
+ _this$getOrderIdentit,
1897
+ _this5 = this;
1894
1898
  if (!customerId || customerId === 1) return Promise.resolve();
1895
- if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
1899
+ var tempOrder = (_this$store$order$get4 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order6);
1900
+ var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
1901
+ var orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.orderId);
1902
+ var action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
1903
+ var orderTarget = orderId ? "order:".concat(String(orderId)) : "external:".concat(String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.externalSaleNumber) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.localId) || 'new'));
1904
+ var refreshTarget = "".concat(customerId, ":").concat(action, ":").concat(orderTarget);
1905
+ if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshTarget === refreshTarget) {
1896
1906
  return this.orderCustomerDiscountRefreshInFlight;
1897
1907
  }
1898
1908
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1899
1909
  var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1900
1910
  var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
1901
- var currentCustomer, tempOrder, orderId, action;
1911
+ var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
1902
1912
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1903
1913
  while (1) switch (_context25.prev = _context25.next) {
1904
1914
  case 0:
@@ -1918,15 +1928,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1918
1928
  }
1919
1929
  return _context25.abrupt("return");
1920
1930
  case 6:
1921
- tempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
1922
- orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 || (_this5$getOrderIdenti = _this5$getOrderIdenti.call(_this5)) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.orderId);
1923
- action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
1924
- _context25.next = 11;
1931
+ currentTempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
1932
+ currentOrderIdentity = (_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.call(_this5);
1933
+ currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
1934
+ currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
1935
+ currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
1936
+ if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
1937
+ _context25.next = 13;
1938
+ break;
1939
+ }
1940
+ return _context25.abrupt("return");
1941
+ case 13:
1942
+ _context25.next = 15;
1925
1943
  return _this5.loadDiscountConfig({
1926
1944
  customerId: customerId,
1927
- action: action
1945
+ action: action,
1946
+ force: true
1928
1947
  });
1929
- case 11:
1948
+ case 15:
1930
1949
  case "end":
1931
1950
  return _context25.stop();
1932
1951
  }
@@ -1934,12 +1953,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1934
1953
  }))();
1935
1954
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1936
1955
  this.orderCustomerDiscountRefreshCustomerId = customerId;
1956
+ this.orderCustomerDiscountRefreshTarget = refreshTarget;
1937
1957
  refreshTask.catch(function (error) {
1938
1958
  console.error('Failed to load discount config after customer change:', error);
1939
1959
  }).finally(function () {
1940
1960
  if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
1941
1961
  _this5.orderCustomerDiscountRefreshInFlight = null;
1942
1962
  _this5.orderCustomerDiscountRefreshCustomerId = null;
1963
+ _this5.orderCustomerDiscountRefreshTarget = null;
1943
1964
  });
1944
1965
  return refreshTask;
1945
1966
  }
@@ -2503,10 +2524,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2503
2524
  }, {
2504
2525
  key: "buildAddProductCtx",
2505
2526
  value: function buildAddProductCtx(extra) {
2506
- var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
2527
+ var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2507
2528
  var bookingContextState = this.store.bookingContext.getState();
2508
2529
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2509
- var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2530
+ var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2510
2531
  return _objectSpread(_objectSpread({
2511
2532
  bookingConfig: bookingContextState.bookingConfig,
2512
2533
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2744,6 +2765,46 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2744
2765
  return _handleGlobalScanCode.apply(this, arguments);
2745
2766
  }
2746
2767
  return handleGlobalScanCode;
2768
+ }() /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */)
2769
+ }, {
2770
+ key: "getGlobalScanCodeType",
2771
+ value: (function () {
2772
+ var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code) {
2773
+ var _this8 = this,
2774
+ _formatGlobalScanResu,
2775
+ _formatGlobalScanResu2;
2776
+ var trimmed, scan, raw;
2777
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2778
+ while (1) switch (_context33.prev = _context33.next) {
2779
+ case 0:
2780
+ trimmed = typeof code === 'string' ? code.trim() : '';
2781
+ if (trimmed) {
2782
+ _context33.next = 3;
2783
+ break;
2784
+ }
2785
+ return _context33.abrupt("return", null);
2786
+ case 3:
2787
+ scan = handleGlobalScan(this.request, function (value) {
2788
+ return _this8.store.products.findProductsByCodeOrBarcode(value);
2789
+ }, this.getSubmitOrderSalesChannel());
2790
+ _context33.next = 6;
2791
+ return scan({
2792
+ type: 'nativeScanner',
2793
+ value: trimmed
2794
+ });
2795
+ case 6:
2796
+ raw = _context33.sent;
2797
+ return _context33.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
2798
+ case 8:
2799
+ case "end":
2800
+ return _context33.stop();
2801
+ }
2802
+ }, _callee33, this);
2803
+ }));
2804
+ function getGlobalScanCodeType(_x23) {
2805
+ return _getGlobalScanCodeType.apply(this, arguments);
2806
+ }
2807
+ return getGlobalScanCodeType;
2747
2808
  }())
2748
2809
  }, {
2749
2810
  key: "resolveBestAddTimePlan",
@@ -2822,11 +2883,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2822
2883
  }, {
2823
2884
  key: "addAddTimeProductToBooking",
2824
2885
  value: (function () {
2825
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(input) {
2826
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2827
- while (1) switch (_context33.prev = _context33.next) {
2886
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
2887
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2888
+ while (1) switch (_context34.prev = _context34.next) {
2828
2889
  case 0:
2829
- return _context33.abrupt("return", this.addAddTimeProductsToBooking({
2890
+ return _context34.abrupt("return", this.addAddTimeProductsToBooking({
2830
2891
  booking: input.booking,
2831
2892
  products: [input],
2832
2893
  coveredMinutes: input.coveredMinutes,
@@ -2834,11 +2895,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2834
2895
  }));
2835
2896
  case 1:
2836
2897
  case "end":
2837
- return _context33.stop();
2898
+ return _context34.stop();
2838
2899
  }
2839
- }, _callee33, this);
2900
+ }, _callee34, this);
2840
2901
  }));
2841
- function addAddTimeProductToBooking(_x23) {
2902
+ function addAddTimeProductToBooking(_x24) {
2842
2903
  return _addAddTimeProductToBooking.apply(this, arguments);
2843
2904
  }
2844
2905
  return addAddTimeProductToBooking;
@@ -2856,27 +2917,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2856
2917
  }, {
2857
2918
  key: "addAddTimeProductsToBooking",
2858
2919
  value: (function () {
2859
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
2860
- var _this8 = this,
2920
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
2921
+ var _this9 = this,
2861
2922
  _input$bookingPatch;
2862
2923
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2863
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2864
- while (1) switch (_context34.prev = _context34.next) {
2924
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2925
+ while (1) switch (_context35.prev = _context35.next) {
2865
2926
  case 0:
2866
2927
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2867
2928
  if (bookingUid) {
2868
- _context34.next = 3;
2929
+ _context35.next = 3;
2869
2930
  break;
2870
2931
  }
2871
2932
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2872
2933
  case 3:
2873
2934
  orderLines = (input.products || []).map(function (line) {
2874
2935
  return {
2875
- product: _this8.buildAddTimeOrderLine(line, bookingUid)
2936
+ product: _this9.buildAddTimeOrderLine(line, bookingUid)
2876
2937
  };
2877
2938
  });
2878
2939
  if (this.store.order) {
2879
- _context34.next = 6;
2940
+ _context35.next = 6;
2880
2941
  break;
2881
2942
  }
2882
2943
  throw new Error('order 模块未初始化');
@@ -2890,55 +2951,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2890
2951
  });
2891
2952
  }
2892
2953
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2893
- _context34.next = 11;
2954
+ _context35.next = 11;
2894
2955
  break;
2895
2956
  }
2896
- return _context34.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2957
+ return _context35.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2897
2958
  case 11:
2898
2959
  result = [];
2899
2960
  _iterator2 = _createForOfIteratorHelper(orderLines);
2900
- _context34.prev = 13;
2961
+ _context35.prev = 13;
2901
2962
  _iterator2.s();
2902
2963
  case 15:
2903
2964
  if ((_step2 = _iterator2.n()).done) {
2904
- _context34.next = 29;
2965
+ _context35.next = 29;
2905
2966
  break;
2906
2967
  }
2907
2968
  line = _step2.value;
2908
- _context34.t0 = result.splice;
2909
- _context34.t1 = result;
2910
- _context34.t2 = [0, result.length];
2911
- _context34.t3 = _toConsumableArray;
2912
- _context34.next = 23;
2969
+ _context35.t0 = result.splice;
2970
+ _context35.t1 = result;
2971
+ _context35.t2 = [0, result.length];
2972
+ _context35.t3 = _toConsumableArray;
2973
+ _context35.next = 23;
2913
2974
  return this.addProductToOrder(line.product);
2914
2975
  case 23:
2915
- _context34.t4 = _context34.sent;
2916
- _context34.t5 = (0, _context34.t3)(_context34.t4);
2917
- _context34.t6 = _context34.t2.concat.call(_context34.t2, _context34.t5);
2918
- _context34.t0.apply.call(_context34.t0, _context34.t1, _context34.t6);
2976
+ _context35.t4 = _context35.sent;
2977
+ _context35.t5 = (0, _context35.t3)(_context35.t4);
2978
+ _context35.t6 = _context35.t2.concat.call(_context35.t2, _context35.t5);
2979
+ _context35.t0.apply.call(_context35.t0, _context35.t1, _context35.t6);
2919
2980
  case 27:
2920
- _context34.next = 15;
2981
+ _context35.next = 15;
2921
2982
  break;
2922
2983
  case 29:
2923
- _context34.next = 34;
2984
+ _context35.next = 34;
2924
2985
  break;
2925
2986
  case 31:
2926
- _context34.prev = 31;
2927
- _context34.t7 = _context34["catch"](13);
2928
- _iterator2.e(_context34.t7);
2987
+ _context35.prev = 31;
2988
+ _context35.t7 = _context35["catch"](13);
2989
+ _iterator2.e(_context35.t7);
2929
2990
  case 34:
2930
- _context34.prev = 34;
2991
+ _context35.prev = 34;
2931
2992
  _iterator2.f();
2932
- return _context34.finish(34);
2993
+ return _context35.finish(34);
2933
2994
  case 37:
2934
- return _context34.abrupt("return", result);
2995
+ return _context35.abrupt("return", result);
2935
2996
  case 38:
2936
2997
  case "end":
2937
- return _context34.stop();
2998
+ return _context35.stop();
2938
2999
  }
2939
- }, _callee34, this, [[13, 31, 34, 37]]);
3000
+ }, _callee35, this, [[13, 31, 34, 37]]);
2940
3001
  }));
2941
- function addAddTimeProductsToBooking(_x24) {
3002
+ function addAddTimeProductsToBooking(_x25) {
2942
3003
  return _addAddTimeProductsToBooking.apply(this, arguments);
2943
3004
  }
2944
3005
  return addAddTimeProductsToBooking;
@@ -2946,42 +3007,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2946
3007
  }, {
2947
3008
  key: "setOtherParams",
2948
3009
  value: function () {
2949
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
3010
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
2950
3011
  var _ref19,
2951
3012
  _ref19$cover,
2952
3013
  cover,
2953
3014
  invoiceContextChanged,
2954
- _args35 = arguments;
2955
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2956
- while (1) switch (_context35.prev = _context35.next) {
3015
+ _args36 = arguments;
3016
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3017
+ while (1) switch (_context36.prev = _context36.next) {
2957
3018
  case 0:
2958
- _ref19 = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2959
- _context35.next = 3;
3019
+ _ref19 = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
3020
+ _context36.next = 3;
2960
3021
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2961
3022
  cover: cover
2962
3023
  });
2963
3024
  case 3:
2964
3025
  invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
2965
3026
  if (!invoiceContextChanged) {
2966
- _context35.next = 7;
3027
+ _context36.next = 7;
2967
3028
  break;
2968
3029
  }
2969
- _context35.next = 7;
3030
+ _context36.next = 7;
2970
3031
  return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
2971
3032
  case 7:
2972
3033
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2973
- _context35.next = 10;
3034
+ _context36.next = 10;
2974
3035
  break;
2975
3036
  }
2976
- _context35.next = 10;
3037
+ _context36.next = 10;
2977
3038
  return this.configureIdGeneratorFromOpenData();
2978
3039
  case 10:
2979
3040
  case "end":
2980
- return _context35.stop();
3041
+ return _context36.stop();
2981
3042
  }
2982
- }, _callee35, this);
3043
+ }, _callee36, this);
2983
3044
  }));
2984
- function setOtherParams(_x25) {
3045
+ function setOtherParams(_x26) {
2985
3046
  return _setOtherParams.apply(this, arguments);
2986
3047
  }
2987
3048
  return setOtherParams;
@@ -2998,15 +3059,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2998
3059
  }, {
2999
3060
  key: "handlePrintWristband",
3000
3061
  value: function () {
3001
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3002
- var _this$getOrderIdentit;
3062
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3063
+ var _this$getOrderIdentit2;
3003
3064
  var deviceTask, deviceId, idempotencyKey;
3004
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3005
- while (1) switch (_context36.prev = _context36.next) {
3065
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3066
+ while (1) switch (_context37.prev = _context37.next) {
3006
3067
  case 0:
3007
3068
  deviceTask = this.getDeviceTaskPlugin();
3008
3069
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3009
- _context36.next = 4;
3070
+ _context37.next = 4;
3010
3071
  break;
3011
3072
  }
3012
3073
  this.logger.addLog({
@@ -3016,7 +3077,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3016
3077
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3017
3078
  }
3018
3079
  });
3019
- return _context36.abrupt("return");
3080
+ return _context37.abrupt("return");
3020
3081
  case 4:
3021
3082
  this.logger.addLog({
3022
3083
  type: 'info',
@@ -3025,10 +3086,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3025
3086
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3026
3087
  }
3027
3088
  });
3028
- _context36.next = 7;
3089
+ _context37.next = 7;
3029
3090
  return this.getShortNumberOrDeviceId();
3030
3091
  case 7:
3031
- deviceId = _context36.sent;
3092
+ deviceId = _context37.sent;
3032
3093
  idempotencyKey = createUuidV4();
3033
3094
  deviceTask.dispatch({
3034
3095
  action: 'print_all',
@@ -3036,7 +3097,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3036
3097
  payload: {
3037
3098
  type: 'WRISTBAND',
3038
3099
  data: {
3039
- order_id: (_this$getOrderIdentit = this.getOrderIdentity()) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.orderId,
3100
+ order_id: (_this$getOrderIdentit2 = this.getOrderIdentity()) === null || _this$getOrderIdentit2 === void 0 ? void 0 : _this$getOrderIdentit2.orderId,
3040
3101
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3041
3102
  }
3042
3103
  },
@@ -3048,11 +3109,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3048
3109
  });
3049
3110
  case 10:
3050
3111
  case "end":
3051
- return _context36.stop();
3112
+ return _context37.stop();
3052
3113
  }
3053
- }, _callee36, this);
3114
+ }, _callee37, this);
3054
3115
  }));
3055
- function handlePrintWristband(_x26) {
3116
+ function handlePrintWristband(_x27) {
3056
3117
  return _handlePrintWristband.apply(this, arguments);
3057
3118
  }
3058
3119
  return handlePrintWristband;
@@ -3060,11 +3121,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3060
3121
  }, {
3061
3122
  key: "handleRedeem",
3062
3123
  value: function () {
3063
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3064
- var _this$store$order6, _this$store$order6$ge, _this$store$order7, _ref20, _tempOrder$order_id2;
3124
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
3125
+ var _this$store$order7, _this$store$order7$ge, _this$store$order8, _ref20, _tempOrder$order_id2;
3065
3126
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
3066
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3067
- while (1) switch (_context37.prev = _context37.next) {
3127
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3128
+ while (1) switch (_context38.prev = _context38.next) {
3068
3129
  case 0:
3069
3130
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
3070
3131
  status = params.is_checkin ? 'used' : 'unused';
@@ -3077,8 +3138,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3077
3138
  }
3078
3139
  });
3079
3140
  voucherIdSet = new Set(voucherIds);
3080
- tempOrder = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getTempOrder) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6);
3081
- vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getVouchers()) || [];
3141
+ tempOrder = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getTempOrder) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
3142
+ vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getVouchers()) || [];
3082
3143
  hasUpdatedVoucher = false;
3083
3144
  nextVouchers = vouchers.map(function (voucher) {
3084
3145
  if (!voucherIdSet.has(voucher.voucher_id)) return voucher;
@@ -3088,20 +3149,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3088
3149
  });
3089
3150
  });
3090
3151
  if (!(tempOrder && hasUpdatedVoucher)) {
3091
- _context37.next = 11;
3152
+ _context38.next = 11;
3092
3153
  break;
3093
3154
  }
3094
- _context37.next = 11;
3155
+ _context38.next = 11;
3095
3156
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3096
3157
  vouchers: nextVouchers
3097
3158
  }));
3098
3159
  case 11:
3099
3160
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3100
3161
  if (!(voucherIds.length === 0)) {
3101
- _context37.next = 14;
3162
+ _context38.next = 14;
3102
3163
  break;
3103
3164
  }
3104
- return _context37.abrupt("return", {
3165
+ return _context38.abrupt("return", {
3105
3166
  code: 200,
3106
3167
  status: true,
3107
3168
  message: '',
@@ -3112,7 +3173,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3112
3173
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
3113
3174
  orderId = (_ref20 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref20 !== void 0 ? _ref20 : undefined;
3114
3175
  orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
3115
- return _context37.abrupt("return", this.request.post('/machinecode/batch', {
3176
+ return _context38.abrupt("return", this.request.post('/machinecode/batch', {
3116
3177
  ids: voucherIds,
3117
3178
  status: status,
3118
3179
  order_lookup: orderLookup,
@@ -3123,11 +3184,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3123
3184
  }));
3124
3185
  case 19:
3125
3186
  case "end":
3126
- return _context37.stop();
3187
+ return _context38.stop();
3127
3188
  }
3128
- }, _callee37, this);
3189
+ }, _callee38, this);
3129
3190
  }));
3130
- function handleRedeem(_x27) {
3191
+ function handleRedeem(_x28) {
3131
3192
  return _handleRedeem.apply(this, arguments);
3132
3193
  }
3133
3194
  return handleRedeem;
@@ -3139,12 +3200,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3139
3200
  }, {
3140
3201
  key: "destroy",
3141
3202
  value: (function () {
3142
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3203
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3143
3204
  var _this$scan;
3144
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3145
- while (1) switch (_context38.prev = _context38.next) {
3205
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3206
+ while (1) switch (_context39.prev = _context39.next) {
3146
3207
  case 0:
3147
- _context38.next = 2;
3208
+ _context39.next = 2;
3148
3209
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
3149
3210
  case 2:
3150
3211
  try {
@@ -3155,9 +3216,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3155
3216
  scanCache.clear();
3156
3217
  case 4:
3157
3218
  case "end":
3158
- return _context38.stop();
3219
+ return _context39.stop();
3159
3220
  }
3160
- }, _callee38, this);
3221
+ }, _callee39, this);
3161
3222
  }));
3162
3223
  function destroy() {
3163
3224
  return _destroy.apply(this, arguments);
@@ -20,6 +20,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
20
20
  private openCache;
21
21
  private sessionStoragePersistEnabled;
22
22
  private sessionStorageRestoreRecord;
23
+ /** 只允许当前订单最新的 prepare/config 请求回写客户资产态。 */
24
+ private customerWalletPrepareConfigEpoch;
23
25
  private salesSummaryModuleName;
24
26
  private rulesHooksOverride?;
25
27
  private moduleHooksOverride?;
@@ -78,6 +80,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
78
80
  private logError;
79
81
  private registerDiscountModules;
80
82
  private createDefaultRulesHooks;
83
+ /**
84
+ * Stable across notifyTempOrderChanged's immutable copy, but changes when a
85
+ * different local/server order becomes current.
86
+ */
87
+ private getDiscountConfigOrderIdentityKey;
81
88
  loadDiscountConfig(params: {
82
89
  customerId: number;
83
90
  action?: 'create' | 'edit';
@@ -87,6 +94,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
87
94
  getDiscountList(): Discount[];
88
95
  getAvailableWalletIds(): number[];
89
96
  getVirtualCurrencyList(): import("../Discount/types").VirtualCurrencyAsset[];
97
+ getCustomerWalletPrepareConfigEpoch(): number;
90
98
  private syncScannedDiscountsToOriginalDiscountList;
91
99
  private ensureEditDiscountConfigForProductChange;
92
100
  scanCode(code: string, customerId?: number): Promise<{
@@ -176,8 +184,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
176
184
  consumeSessionStorageRestore(): Record<string, any> | null;
177
185
  notifyTempOrderChanged(): void;
178
186
  private createDefaultTempOrderInstance;
179
- private clearTempOrderPointCardSnapshot;
180
- private writePointCardSnapshotFromPrepareConfig;
187
+ private clearTempOrderCustomerWalletSnapshots;
188
+ private clearCustomerWalletState;
189
+ private clearCustomerWalletRuntimeState;
190
+ private writeCustomerWalletSnapshotsFromPrepareConfig;
181
191
  private createExternalSaleNumber;
182
192
  private ensureExternalSaleNumber;
183
193
  private ensureRequestUniqueIdempotencyToken;
@@ -635,4 +645,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
635
645
  getOrderInfo(order_id: number): Promise<any>;
636
646
  getVouchers(): any[];
637
647
  }
638
- export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
648
+ export type { AddProductToOrderOptions, OrderMetaList, PointCardSnapshotItem, VirtualCurrencySnapshotItem, RemoveProductsFromOrderOptions, SalesNote, SalesNoteDraftInput, SalesNoteLocalizedSelection, SalesNoteLocalizedText, SalesNoteRelation, SalesNoteTextInput, SetSalesNoteInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';