@pisell/pisellos 2.1.83 → 2.1.84

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.
@@ -57,6 +57,12 @@ function _updateAllCartItemPrice() {
57
57
  if (targetBundleItem.price_type === 'markdown') {
58
58
  targetBundleItem.price = new Decimal(targetBundleItem.price || 0).mul(-1).toNumber();
59
59
  }
60
+ // 如果有选择 option,还需要加上 option 的价格
61
+ if (n.option) {
62
+ targetBundleItem.price = new Decimal(targetBundleItem.price || 0).add(n.option.reduce(function (pre, cur) {
63
+ return pre + new Decimal(cur.price || 0).mul(cur.num || 1).toNumber();
64
+ }, 0)).toNumber();
65
+ }
60
66
  if (targetBundleItem) {
61
67
  return _objectSpread(_objectSpread({}, n), {}, {
62
68
  price: targetBundleItem.price,
@@ -1,4 +1,7 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2
5
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
6
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -86,7 +89,7 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
86
89
  while (1) switch (_context2.prev = _context2.next) {
87
90
  case 0:
88
91
  _context2.next = 2;
89
- return this.request.get('/order/custom-surcharge/available', {
92
+ return this.request.get('/order/custom-surcharge/available/v2', {
90
93
  channel: 'online-store',
91
94
  is_assemble_product_data: 1,
92
95
  is_assemble_schedule_data: 1,
@@ -111,15 +114,34 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
111
114
  value: function () {
112
115
  var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(cartItems) {
113
116
  var _this$shopStore$get;
114
- var shopInfo, summary;
117
+ var shopInfo, scheduleModule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary;
115
118
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
116
119
  while (1) switch (_context3.prev = _context3.next) {
117
120
  case 0:
118
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) || {};
119
- summary = calculatePriceDetails(shopInfo, cartItems, ScheduleModule.isInScheduleByDate, this.store.surchargeList);
122
+ scheduleModule = this.core.getModule('appointmentBooking_schedule');
123
+ needScheduleIds = this.store.surchargeList.map(function (item) {
124
+ return item.available_schedule_ids;
125
+ }).flat();
126
+ scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
127
+ scheduleById = {};
128
+ if (Array.isArray(scheduleList)) {
129
+ _iterator = _createForOfIteratorHelper(scheduleList);
130
+ try {
131
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
132
+ item = _step.value;
133
+ scheduleById[item.id] = item;
134
+ }
135
+ } catch (err) {
136
+ _iterator.e(err);
137
+ } finally {
138
+ _iterator.f();
139
+ }
140
+ }
141
+ summary = calculatePriceDetails(shopInfo, cartItems, ScheduleModule === null || ScheduleModule === void 0 ? void 0 : ScheduleModule.isInScheduleByDate, this.store.surchargeList, scheduleById);
120
142
  this.store.summary = summary;
121
143
  return _context3.abrupt("return", this.store.summary);
122
- case 4:
144
+ case 9:
123
145
  case "end":
124
146
  return _context3.stop();
125
147
  }
@@ -187,6 +209,26 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
187
209
  key: "getSurchargeforUtils",
188
210
  value: function getSurchargeforUtils(items) {
189
211
  // const surchargeList = this.store.surchargeList;
212
+ var scheduleModule = this.core.getModule('appointmentBooking_schedule');
213
+ var needScheduleIds = this.store.surchargeList.map(function (item) {
214
+ return item.available_schedule_ids;
215
+ }).flat();
216
+ var scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
217
+ var scheduleById = {};
218
+ if (Array.isArray(scheduleList)) {
219
+ var _iterator2 = _createForOfIteratorHelper(scheduleList),
220
+ _step2;
221
+ try {
222
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
223
+ var item = _step2.value;
224
+ scheduleById[item.id] = item;
225
+ }
226
+ } catch (err) {
227
+ _iterator2.e(err);
228
+ } finally {
229
+ _iterator2.f();
230
+ }
231
+ }
190
232
  var surchargeList = getSurcharge({
191
233
  service: items,
192
234
  addons: [],
@@ -196,7 +238,7 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
196
238
  isEdit: false,
197
239
  isInScheduleByDate: ScheduleModule.isInScheduleByDate,
198
240
  surcharge_list: this.store.surchargeList,
199
- scheduleById: {}
241
+ scheduleById: scheduleById
200
242
  });
201
243
  var surchargeAmount = new Decimal(getSurchargeAmount({
202
244
  bookingDetail: null,
@@ -1,7 +1,7 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import { CartItem } from '../Cart/types';
3
3
  import { ISummaryState } from './types';
4
- export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[]) => ISummaryState['summary'];
4
+ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[], scheduleById: Record<string, any>) => ISummaryState['summary'];
5
5
  /**
6
6
  * 获取子商品折扣信息
7
7
  * @param item
@@ -16,7 +16,9 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
16
16
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17
17
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
18
  import Decimal from 'decimal.js';
19
- export var calculatePriceDetails = function calculatePriceDetails(shopInfo, items, isInScheduleByDate, surchargeList) {
19
+ import { isNormalProduct } from "../Product/utils";
20
+ import dayjs from 'dayjs';
21
+ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) {
20
22
  var subtotal = new Decimal(calculateSubtotal(items));
21
23
  var totalTaxFee = new Decimal(calculateTaxFee(shopInfo, items));
22
24
  // 订单附加费列表
@@ -29,7 +31,7 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
29
31
  isEdit: false,
30
32
  isInScheduleByDate: isInScheduleByDate,
31
33
  surcharge_list: surchargeList,
32
- scheduleById: {}
34
+ scheduleById: scheduleById
33
35
  });
34
36
  // 订单附加费金额
35
37
  var surchargeAmount = new Decimal(getSurchargeAmount({
@@ -841,6 +843,7 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
841
843
  * @returns 附加费列表(仅返回金额 > 0 的项)
842
844
  */
843
845
  export var getSurcharge = function getSurcharge(_ref11, options) {
846
+ var _service$filter;
844
847
  var service = _ref11.service,
845
848
  addons = _ref11.addons,
846
849
  bookingDetail = _ref11.bookingDetail,
@@ -849,6 +852,16 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
849
852
  isInScheduleByDate = options.isInScheduleByDate,
850
853
  surcharge_list = options.surcharge_list,
851
854
  scheduleById = options.scheduleById;
855
+ // 在所有商品里试着找 start_date,如果没有则用当前时间
856
+ var firstAppointmentCartItem = (_service$filter = service.filter(function (n) {
857
+ return !isNormalProduct(n._productOrigin);
858
+ })) === null || _service$filter === void 0 ? void 0 : _service$filter[0];
859
+ var startDate = '';
860
+ if (firstAppointmentCartItem) {
861
+ startDate = firstAppointmentCartItem.start_date + ' ' + firstAppointmentCartItem.start_time + ':00';
862
+ } else {
863
+ startDate = dayjs().format('YYYY-MM-DD HH:mm:ss');
864
+ }
852
865
  // 编辑状态, 且未修改商品时直接从详情取出
853
866
  if (!isEdit && bookingId) {
854
867
  if (Array.isArray(bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.surcharge)) {
@@ -915,7 +928,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
915
928
  // 主商品符合附加费条件
916
929
  if (isProductMatchSurchargeCondition({
917
930
  isCustomItem: item.isCustomItem,
918
- startDate: (item === null || item === void 0 ? void 0 : item.startDate) || '',
931
+ startDate: startDate,
919
932
  product_id: item.id
920
933
  }, {
921
934
  surchargeConfig: surchargeConfig,
@@ -949,7 +962,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
949
962
  // bundle商品是原价且符合附加费条件
950
963
  if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition({
951
964
  isCustomItem: false,
952
- startDate: item.startDate,
965
+ startDate: startDate,
953
966
  product_id: bundleItem._bundle_product_id
954
967
  }, {
955
968
  surchargeConfig: surchargeConfig,
@@ -981,7 +994,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
981
994
  var relationDetail = _step7.value;
982
995
  if (isProductMatchSurchargeCondition({
983
996
  isCustomItem: false,
984
- startDate: item.startDate,
997
+ startDate: startDate,
985
998
  product_id: relationDetail.product_id
986
999
  }, {
987
1000
  surchargeConfig: surchargeConfig,
@@ -1018,7 +1031,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
1018
1031
  try {
1019
1032
  for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1020
1033
  var _item = _step8.value;
1021
- if (isProductMatchSurchargeCondition(_item, {
1034
+ if (isProductMatchSurchargeCondition(_objectSpread(_objectSpread({}, _item), {}, {
1035
+ startDate: startDate
1036
+ }), {
1022
1037
  surchargeConfig: surchargeConfig,
1023
1038
  scheduleById: scheduleById || {},
1024
1039
  isInScheduleByDate: isInScheduleByDate
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
313
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -2552,14 +2552,63 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2552
2552
  var targetResourceTimes = allResources === null || allResources === void 0 || (_allResources$find = allResources.find(function (n) {
2553
2553
  return n.id === resource.id;
2554
2554
  })) === null || _allResources$find === void 0 ? void 0 : _allResources$find.times;
2555
+ // 找到最晚的 end_at 还没用,因为可能存在资源工作时间是 10:00-19:00,但是资源的 times 里有 16:30-19:00 被 block 的情况
2556
+ // 所以还需要排除掉 block 时间
2557
+ function getEarliestBlockedStartTime(_ref11) {
2558
+ var _earliestBlockStart;
2559
+ var currentStartTime = _ref11.currentStartTime,
2560
+ times = _ref11.times;
2561
+ var currentStart = dayjs(currentStartTime);
2562
+ var earliestBlockStart;
2563
+ var _iterator3 = _createForOfIteratorHelper(times || []),
2564
+ _step3;
2565
+ try {
2566
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2567
+ var time = _step3.value;
2568
+ var _iterator4 = _createForOfIteratorHelper(time.event_list || []),
2569
+ _step4;
2570
+ try {
2571
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2572
+ var event = _step4.value;
2573
+ var eventStart = dayjs(event.start_at);
2574
+ var eventEnd = dayjs(event.end_at);
2575
+ if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
2576
+ return currentStart.format('YYYY-MM-DD HH:mm');
2577
+ }
2578
+ if (eventStart.isAfter(currentStart)) {
2579
+ if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
2580
+ earliestBlockStart = eventStart;
2581
+ }
2582
+ }
2583
+ }
2584
+ } catch (err) {
2585
+ _iterator4.e(err);
2586
+ } finally {
2587
+ _iterator4.f();
2588
+ }
2589
+ }
2590
+ } catch (err) {
2591
+ _iterator3.e(err);
2592
+ } finally {
2593
+ _iterator3.f();
2594
+ }
2595
+ return (_earliestBlockStart = earliestBlockStart) === null || _earliestBlockStart === void 0 ? void 0 : _earliestBlockStart.format('YYYY-MM-DD HH:mm');
2596
+ }
2555
2597
  var resourcesEndTime = targetResourceTimes.reduce(function (acc, curr) {
2556
2598
  return dayjs(curr.end_at).isAfter(dayjs(acc.end_at)) ? curr : acc;
2557
2599
  }, targetResourceTimes[0]);
2600
+ var earliestBlockedStartTime = getEarliestBlockedStartTime({
2601
+ currentStartTime: currentStartTime,
2602
+ times: targetResourceTimes
2603
+ });
2558
2604
 
2559
2605
  // 将 operating_day_boundary 转换为与 resourcesEndTime.end_at 相同日期的完整日期时间
2560
2606
  var resourceDate = dayjs(resourcesEndTime.end_at).format('YYYY-MM-DD');
2561
2607
  var operatingBoundaryDateTime = "".concat(resourceDate, " ").concat(operating_day_boundary.type === 'start_time' ? '23:59' : operating_day_boundary.time);
2562
- var endTime = dayjs(resourcesEndTime.end_at).isBefore(dayjs(operatingBoundaryDateTime)) ? resourcesEndTime.end_at : operatingBoundaryDateTime;
2608
+ var endTimeCandidates = [resourcesEndTime.end_at, operatingBoundaryDateTime].concat(_toConsumableArray(earliestBlockedStartTime ? [earliestBlockedStartTime] : []));
2609
+ var endTime = endTimeCandidates.reduce(function (earliest, value) {
2610
+ return dayjs(value).isBefore(dayjs(earliest)) ? value : earliest;
2611
+ }, endTimeCandidates[0]);
2563
2612
  // 修复:如果 endTime 只是时间格式(如 "17:00"),需要加上日期
2564
2613
  var formattedEndTime;
2565
2614
  if (typeof endTime === 'string' && endTime.includes(':') && !endTime.includes(' ') && !endTime.includes('T')) {
@@ -2700,14 +2749,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2700
2749
  // 通过商品和 schedule 来获取视频可用的时间片、时间片内资源可用的数据
2701
2750
  }, {
2702
2751
  key: "getTimeslotBySchedule",
2703
- value: function getTimeslotBySchedule(_ref11) {
2752
+ value: function getTimeslotBySchedule(_ref12) {
2704
2753
  var _this$store$currentPr2,
2705
2754
  _targetProductData$pr,
2706
2755
  _this15 = this;
2707
- var date = _ref11.date,
2708
- scheduleIds = _ref11.scheduleIds,
2709
- resources = _ref11.resources,
2710
- product = _ref11.product;
2756
+ var date = _ref12.date,
2757
+ scheduleIds = _ref12.scheduleIds,
2758
+ resources = _ref12.resources,
2759
+ product = _ref12.product;
2711
2760
  var targetProduct = this.store.currentProduct;
2712
2761
  // 如果外面传递了product 优先用外面的
2713
2762
  var targetProductData = product || targetProduct;
@@ -3266,12 +3315,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3266
3315
  // 检查资源类型(单个预约 vs 多个预约)
3267
3316
  // 从商品配置中获取资源类型信息
3268
3317
  var resourceTypeConfig = null;
3269
- var _iterator3 = _createForOfIteratorHelper(items),
3270
- _step3;
3318
+ var _iterator5 = _createForOfIteratorHelper(items),
3319
+ _step5;
3271
3320
  try {
3272
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3321
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3273
3322
  var _cartItem$_productOri12;
3274
- var cartItem = _step3.value;
3323
+ var cartItem = _step5.value;
3275
3324
  if ((_cartItem$_productOri12 = cartItem._productOrigin) !== null && _cartItem$_productOri12 !== void 0 && (_cartItem$_productOri12 = _cartItem$_productOri12.product_resource) !== null && _cartItem$_productOri12 !== void 0 && _cartItem$_productOri12.resources) {
3276
3325
  resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
3277
3326
  return r.code === resourceCode && r.status === 1;
@@ -3280,9 +3329,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3280
3329
  }
3281
3330
  }
3282
3331
  } catch (err) {
3283
- _iterator3.e(err);
3332
+ _iterator5.e(err);
3284
3333
  } finally {
3285
- _iterator3.f();
3334
+ _iterator5.f();
3286
3335
  }
3287
3336
  var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
3288
3337
  var totalAvailable;
@@ -3485,17 +3534,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3485
3534
  */
3486
3535
  }, {
3487
3536
  key: "convertProductToCartItem",
3488
- value: function convertProductToCartItem(_ref12) {
3489
- var product = _ref12.product,
3490
- date = _ref12.date,
3491
- account = _ref12.account;
3492
- var _ref13 = product || {},
3493
- bundle = _ref13.bundle,
3494
- options = _ref13.options,
3495
- origin = _ref13.origin,
3496
- product_variant_id = _ref13.product_variant_id,
3497
- _ref13$quantity = _ref13.quantity,
3498
- quantity = _ref13$quantity === void 0 ? 1 : _ref13$quantity;
3537
+ value: function convertProductToCartItem(_ref13) {
3538
+ var product = _ref13.product,
3539
+ date = _ref13.date,
3540
+ account = _ref13.account;
3541
+ var _ref14 = product || {},
3542
+ bundle = _ref14.bundle,
3543
+ options = _ref14.options,
3544
+ origin = _ref14.origin,
3545
+ product_variant_id = _ref14.product_variant_id,
3546
+ _ref14$quantity = _ref14.quantity,
3547
+ quantity = _ref14$quantity === void 0 ? 1 : _ref14$quantity;
3499
3548
 
3500
3549
  // 处理商品数据,类似 addProductToCart 中的逻辑
3501
3550
  var productData = _objectSpread(_objectSpread({}, origin), {}, {
@@ -3550,11 +3599,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3550
3599
  }
3551
3600
  }, {
3552
3601
  key: "checkMaxDurationCapacityForDetailNums",
3553
- value: function checkMaxDurationCapacityForDetailNums(_ref14) {
3602
+ value: function checkMaxDurationCapacityForDetailNums(_ref15) {
3554
3603
  var _this17 = this;
3555
- var product = _ref14.product,
3556
- date = _ref14.date,
3557
- account = _ref14.account;
3604
+ var product = _ref15.product,
3605
+ date = _ref15.date,
3606
+ account = _ref15.account;
3558
3607
  var cartItems = this.store.cart.getItems().filter(function (item) {
3559
3608
  return !isNormalProduct(item._productOrigin);
3560
3609
  });
@@ -3699,12 +3748,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3699
3748
  // 检查资源类型(单个预约 vs 多个预约)
3700
3749
  // 从商品配置中获取资源类型信息
3701
3750
  var resourceTypeConfig = null;
3702
- var _iterator4 = _createForOfIteratorHelper(items),
3703
- _step4;
3751
+ var _iterator6 = _createForOfIteratorHelper(items),
3752
+ _step6;
3704
3753
  try {
3705
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3754
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
3706
3755
  var _cartItem$_productOri15;
3707
- var cartItem = _step4.value;
3756
+ var cartItem = _step6.value;
3708
3757
  if ((_cartItem$_productOri15 = cartItem._productOrigin) !== null && _cartItem$_productOri15 !== void 0 && (_cartItem$_productOri15 = _cartItem$_productOri15.product_resource) !== null && _cartItem$_productOri15 !== void 0 && _cartItem$_productOri15.resources) {
3709
3758
  resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
3710
3759
  return r.code === resourceCode && r.status === 1;
@@ -3713,9 +3762,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
3713
3762
  }
3714
3763
  }
3715
3764
  } catch (err) {
3716
- _iterator4.e(err);
3765
+ _iterator6.e(err);
3717
3766
  } finally {
3718
- _iterator4.f();
3767
+ _iterator6.f();
3719
3768
  }
3720
3769
  var isMultipleBooking = ((_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type) === 'multiple';
3721
3770
  var totalAvailable;
@@ -4086,12 +4135,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
4086
4135
  }, {
4087
4136
  key: "getTimeslotsScheduleByDateRange",
4088
4137
  value: (function () {
4089
- var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref15) {
4138
+ var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
4090
4139
  var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
4091
4140
  return _regeneratorRuntime().wrap(function _callee27$(_context28) {
4092
4141
  while (1) switch (_context28.prev = _context28.next) {
4093
4142
  case 0:
4094
- startDate = _ref15.startDate, endDate = _ref15.endDate, scheduleIds = _ref15.scheduleIds, resources = _ref15.resources;
4143
+ startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
4095
4144
  console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
4096
4145
  startDate: startDate,
4097
4146
  endDate: endDate,
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -60,6 +60,11 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
60
60
  if (targetBundleItem.price_type === "markdown") {
61
61
  targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).mul(-1).toNumber();
62
62
  }
63
+ if (n.option) {
64
+ targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).add(n.option.reduce((pre, cur) => {
65
+ return pre + new import_decimal.default(cur.price || 0).mul(cur.num || 1).toNumber();
66
+ }, 0)).toNumber();
67
+ }
63
68
  if (targetBundleItem) {
64
69
  return {
65
70
  ...n,
@@ -65,7 +65,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
65
65
  this.getSurchargeList();
66
66
  }
67
67
  async getSurchargeList() {
68
- const surchargeList = await this.request.get("/order/custom-surcharge/available", {
68
+ const surchargeList = await this.request.get("/order/custom-surcharge/available/v2", {
69
69
  channel: "online-store",
70
70
  is_assemble_product_data: 1,
71
71
  is_assemble_schedule_data: 1,
@@ -74,14 +74,18 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
74
74
  this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
75
75
  }
76
76
  async getSummary(cartItems) {
77
- var _a, _b;
77
+ var _a, _b, _c;
78
78
  const shopInfo = ((_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.shop) || {};
79
- const summary = (0, import_utils.calculatePriceDetails)(
80
- shopInfo,
81
- cartItems,
82
- import_Schedule.ScheduleModule.isInScheduleByDate,
83
- this.store.surchargeList
84
- );
79
+ const scheduleModule = this.core.getModule("appointmentBooking_schedule");
80
+ const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
81
+ const scheduleList = scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
82
+ const scheduleById = {};
83
+ if (Array.isArray(scheduleList)) {
84
+ for (let item of scheduleList) {
85
+ scheduleById[item.id] = item;
86
+ }
87
+ }
88
+ const summary = (0, import_utils.calculatePriceDetails)(shopInfo, cartItems, (_c = import_Schedule.ScheduleModule) == null ? void 0 : _c.isInScheduleByDate, this.store.surchargeList, scheduleById);
85
89
  this.store.summary = summary;
86
90
  return this.store.summary;
87
91
  }
@@ -115,7 +119,16 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
115
119
  });
116
120
  }
117
121
  getSurchargeforUtils(items) {
118
- const surchargeList = (0, import_utils.getSurcharge)({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate: import_Schedule.ScheduleModule.isInScheduleByDate, surcharge_list: this.store.surchargeList, scheduleById: {} });
122
+ const scheduleModule = this.core.getModule("appointmentBooking_schedule");
123
+ const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
124
+ const scheduleList = scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
125
+ const scheduleById = {};
126
+ if (Array.isArray(scheduleList)) {
127
+ for (let item of scheduleList) {
128
+ scheduleById[item.id] = item;
129
+ }
130
+ }
131
+ const surchargeList = (0, import_utils.getSurcharge)({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate: import_Schedule.ScheduleModule.isInScheduleByDate, surcharge_list: this.store.surchargeList, scheduleById });
119
132
  const surchargeAmount = new import_decimal.default((0, import_utils.getSurchargeAmount)({ bookingDetail: null, bookingId: void 0 }, surchargeList, { isEdit: false }));
120
133
  return {
121
134
  surchargeList,
@@ -1,7 +1,7 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import { CartItem } from '../Cart/types';
3
3
  import { ISummaryState } from './types';
4
- export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[]) => ISummaryState['summary'];
4
+ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[], scheduleById: Record<string, any>) => ISummaryState['summary'];
5
5
  /**
6
6
  * 获取子商品折扣信息
7
7
  * @param item
@@ -42,10 +42,12 @@ __export(utils_exports, {
42
42
  });
43
43
  module.exports = __toCommonJS(utils_exports);
44
44
  var import_decimal = __toESM(require("decimal.js"));
45
- var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList) => {
45
+ var import_utils = require("../Product/utils");
46
+ var import_dayjs = __toESM(require("dayjs"));
47
+ var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) => {
46
48
  const subtotal = new import_decimal.default(calculateSubtotal(items));
47
49
  const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
48
- const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById: {} });
50
+ const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById });
49
51
  const surchargeAmount = new import_decimal.default(getSurchargeAmount({ bookingDetail: null, bookingId: void 0 }, surcharge, { isEdit: false }));
50
52
  const { tax, originTax } = getTax({ service: items, bookingDetail: null, bookingId: void 0 }, {
51
53
  computed: {
@@ -508,8 +510,17 @@ var isProductMatchSurchargeCondition = (item, options) => {
508
510
  return isProductMatch && isScheduleMatch;
509
511
  };
510
512
  var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
511
- var _a, _b, _c;
513
+ var _a, _b, _c, _d;
512
514
  const { isEdit, isInScheduleByDate, surcharge_list, scheduleById } = options;
515
+ const firstAppointmentCartItem = (_a = service.filter(
516
+ (n) => !(0, import_utils.isNormalProduct)(n._productOrigin)
517
+ )) == null ? void 0 : _a[0];
518
+ let startDate = "";
519
+ if (firstAppointmentCartItem) {
520
+ startDate = firstAppointmentCartItem.start_date + " " + firstAppointmentCartItem.start_time + ":00";
521
+ } else {
522
+ startDate = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
523
+ }
513
524
  if (!isEdit && bookingId) {
514
525
  if (Array.isArray(bookingDetail == null ? void 0 : bookingDetail.surcharge)) {
515
526
  return ((bookingDetail == null ? void 0 : bookingDetail.surcharge) || []).filter((d) => Number(d.amount) > 0).map(
@@ -556,7 +567,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
556
567
  if (isProductMatchSurchargeCondition(
557
568
  {
558
569
  isCustomItem: item.isCustomItem,
559
- startDate: (item == null ? void 0 : item.startDate) || "",
570
+ startDate,
560
571
  product_id: item.id
561
572
  },
562
573
  {
@@ -588,7 +599,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
588
599
  if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition(
589
600
  {
590
601
  isCustomItem: false,
591
- startDate: item.startDate,
602
+ startDate,
592
603
  product_id: bundleItem._bundle_product_id
593
604
  },
594
605
  {
@@ -614,7 +625,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
614
625
  if (isProductMatchSurchargeCondition(
615
626
  {
616
627
  isCustomItem: false,
617
- startDate: item.startDate,
628
+ startDate,
618
629
  product_id: relationDetail.product_id
619
630
  },
620
631
  {
@@ -626,7 +637,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
626
637
  matchedItems.push({
627
638
  isMain: false,
628
639
  total: Number(
629
- (relationDetail == null ? void 0 : relationDetail.price) || ((_a = relationDetail == null ? void 0 : relationDetail.metadata) == null ? void 0 : _a.main_product_attached_bundle_selling_price)
640
+ (relationDetail == null ? void 0 : relationDetail.price) || ((_b = relationDetail == null ? void 0 : relationDetail.metadata) == null ? void 0 : _b.main_product_attached_bundle_selling_price)
630
641
  ),
631
642
  quantity: relationDetail.num || relationDetail.quantity || 1,
632
643
  item: relationDetail,
@@ -639,7 +650,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
639
650
  }
640
651
  if (Array.isArray(addons == null ? void 0 : addons.value)) {
641
652
  for (let item of addons.value) {
642
- if (isProductMatchSurchargeCondition(item, {
653
+ if (isProductMatchSurchargeCondition({ ...item, startDate }, {
643
654
  surchargeConfig,
644
655
  scheduleById: scheduleById || {},
645
656
  isInScheduleByDate
@@ -700,13 +711,13 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
700
711
  const surchargeFee = originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toNumber();
701
712
  productTotalSurcharge = productTotalSurcharge.plus(new import_decimal.default(surchargeFee).times(itemQuantity).toNumber());
702
713
  item.item.surcharge_fee = surchargeFee;
703
- item.item.relation_surcharge_ids = [...((_b = item.item) == null ? void 0 : _b.relation_surcharge_ids) || [], id];
714
+ item.item.relation_surcharge_ids = [...((_c = item.item) == null ? void 0 : _c.relation_surcharge_ids) || [], id];
704
715
  } else {
705
716
  const originSurchargeFee = new import_decimal.default(item.item.surcharge_fee || 0);
706
717
  const surchargeFee = originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toNumber();
707
718
  productTotalSurcharge = productTotalSurcharge.plus(new import_decimal.default(surchargeFee).times(itemQuantity).toNumber());
708
719
  item.item.surcharge_fee = surchargeFee;
709
- item.item.relation_surcharge_ids = [...((_c = item.item) == null ? void 0 : _c.relation_surcharge_ids) || [], id];
720
+ item.item.relation_surcharge_ids = [...((_d = item.item) == null ? void 0 : _d.relation_surcharge_ids) || [], id];
710
721
  }
711
722
  }
712
723
  if (isLast && configTotal.minus(productTotalSurcharge).gt(0)) {
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
313
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -1766,6 +1766,28 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1766
1766
  newResources.forEach((resource) => {
1767
1767
  var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1768
1768
  if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
1769
+ let getEarliestBlockedStartTime = function({
1770
+ currentStartTime: currentStartTime2,
1771
+ times
1772
+ }) {
1773
+ const currentStart = (0, import_dayjs.default)(currentStartTime2);
1774
+ let earliestBlockStart;
1775
+ for (const time of times || []) {
1776
+ for (const event of time.event_list || []) {
1777
+ const eventStart = (0, import_dayjs.default)(event.start_at);
1778
+ const eventEnd = (0, import_dayjs.default)(event.end_at);
1779
+ if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
1780
+ return currentStart.format("YYYY-MM-DD HH:mm");
1781
+ }
1782
+ if (eventStart.isAfter(currentStart)) {
1783
+ if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
1784
+ earliestBlockStart = eventStart;
1785
+ }
1786
+ }
1787
+ }
1788
+ }
1789
+ return earliestBlockStart == null ? void 0 : earliestBlockStart.format("YYYY-MM-DD HH:mm");
1790
+ };
1769
1791
  item.duration = {
1770
1792
  type: "minutes",
1771
1793
  value: 10
@@ -1780,13 +1802,22 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1780
1802
  },
1781
1803
  targetResourceTimes[0]
1782
1804
  );
1805
+ const earliestBlockedStartTime = getEarliestBlockedStartTime({
1806
+ currentStartTime,
1807
+ times: targetResourceTimes
1808
+ });
1783
1809
  const resourceDate = (0, import_dayjs.default)(resourcesEndTime.end_at).format(
1784
1810
  "YYYY-MM-DD"
1785
1811
  );
1786
1812
  const operatingBoundaryDateTime = `${resourceDate} ${operating_day_boundary.type === "start_time" ? "23:59" : operating_day_boundary.time}`;
1787
- const endTime = (0, import_dayjs.default)(resourcesEndTime.end_at).isBefore(
1788
- (0, import_dayjs.default)(operatingBoundaryDateTime)
1789
- ) ? resourcesEndTime.end_at : operatingBoundaryDateTime;
1813
+ const endTimeCandidates = [
1814
+ resourcesEndTime.end_at,
1815
+ operatingBoundaryDateTime,
1816
+ ...earliestBlockedStartTime ? [earliestBlockedStartTime] : []
1817
+ ];
1818
+ const endTime = endTimeCandidates.reduce((earliest, value) => {
1819
+ return (0, import_dayjs.default)(value).isBefore((0, import_dayjs.default)(earliest)) ? value : earliest;
1820
+ }, endTimeCandidates[0]);
1790
1821
  let formattedEndTime;
1791
1822
  if (typeof endTime === "string" && endTime.includes(":") && !endTime.includes(" ") && !endTime.includes("T")) {
1792
1823
  const currentDate = timeSlots.start_at.format("YYYY-MM-DD");
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.83",
4
+ "version": "2.1.84",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",