@pisell/private-materials 6.6.59 → 6.6.60

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.
Files changed (49) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.js +9 -9
  8. package/build/lowcode/view.js +9 -9
  9. package/es/components/booking/components/footer/amount.js +4 -3
  10. package/es/components/booking/components/footer/utils.js +10 -3
  11. package/es/components/booking/components/voucher/index.js +1 -1
  12. package/es/components/booking/dashboard/index.d.ts +0 -5
  13. package/es/components/booking/dashboard/index.js +6 -9
  14. package/es/components/booking/info/service2/Group/utils.js +1 -30
  15. package/es/components/booking/info2/service/editService/index.js +49 -6
  16. package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
  17. package/es/components/booking/info2/service/editService/utils.js +16 -0
  18. package/es/components/booking/payments/index.js +1 -1
  19. package/es/components/checkout/hooks/useWalletPass.js +15 -23
  20. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
  21. package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +0 -2
  22. package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +2 -5
  23. package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +0 -2
  24. package/es/components/ticketBooking/components/bookingDataPanel/index.js +2 -5
  25. package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +1 -2
  26. package/es/components/ticketBooking/components/ticketBooking/index.js +37 -156
  27. package/es/components/ticketBooking/index.js +1 -7
  28. package/es/pro/Login2.0/components/phoneValidation.js +58 -65
  29. package/lib/components/booking/components/footer/amount.js +3 -3
  30. package/lib/components/booking/components/footer/utils.js +12 -5
  31. package/lib/components/booking/components/voucher/index.js +1 -1
  32. package/lib/components/booking/dashboard/index.d.ts +0 -5
  33. package/lib/components/booking/dashboard/index.js +5 -6
  34. package/lib/components/booking/info/service2/Group/utils.js +3 -42
  35. package/lib/components/booking/info2/service/editService/index.js +39 -5
  36. package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
  37. package/lib/components/booking/info2/service/editService/utils.js +16 -0
  38. package/lib/components/booking/payments/index.js +1 -1
  39. package/lib/components/checkout/hooks/useWalletPass.js +16 -23
  40. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
  41. package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +0 -2
  42. package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +2 -3
  43. package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +0 -2
  44. package/lib/components/ticketBooking/components/bookingDataPanel/index.js +3 -10
  45. package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +1 -10
  46. package/lib/components/ticketBooking/components/ticketBooking/index.js +14 -114
  47. package/lib/components/ticketBooking/index.js +1 -11
  48. package/lib/pro/Login2.0/components/phoneValidation.js +2 -4
  49. package/package.json +4 -4
@@ -519,7 +519,8 @@ var processItemsTax = function processItemsTax(items, state, options) {
519
519
  }
520
520
  return {
521
521
  originTax: expectedOriginTax,
522
- tax: expectedTax
522
+ tax: expectedTax,
523
+ taxDecimal: preciseTax
523
524
  };
524
525
  };
525
526
 
@@ -651,7 +652,7 @@ var getTax = function getTax(state, options) {
651
652
  computed: computed
652
653
  });
653
654
  totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
654
- totalTax = totalTax.plus(serviceResult.tax);
655
+ totalTax = totalTax.plus(serviceResult.taxDecimal);
655
656
  }
656
657
 
657
658
  // 处理附加商品
@@ -662,7 +663,7 @@ var getTax = function getTax(state, options) {
662
663
  computed: computed
663
664
  });
664
665
  totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
665
- totalTax = totalTax.plus(addonsResult.tax);
666
+ totalTax = totalTax.plus(addonsResult.taxDecimal);
666
667
  }
667
668
  }
668
669
  return {
@@ -108,6 +108,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
108
108
  }
109
109
  } catch (error) {}
110
110
  return bundle.map(function (d) {
111
+ var _d$metadata;
111
112
  var option = formatProductOption(d.option);
112
113
  var option_price = option.reduce(function (temp, item) {
113
114
  return temp + Number(item.num) * item.custom_add_price;
@@ -135,7 +136,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
135
136
  "bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
136
137
  // "bundle_sum_price": d?.original_price || d?.original_total,
137
138
  "metadata": {
138
- custom_product_bundle_map_id: d._id,
139
+ custom_product_bundle_map_id: (d === null || d === void 0 || (_d$metadata = d.metadata) === null || _d$metadata === void 0 ? void 0 : _d$metadata.custom_product_bundle_map_id) || d._id,
139
140
  // 子商品单数量附加费
140
141
  "surcharge_fee": d.surcharge_fee,
141
142
  // 可选,附加费均摊舍入金额
@@ -477,7 +478,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
477
478
  * @Author: WangHan
478
479
  * @Date: 2024-12-07 14:21
479
480
  */
480
- var formatProducts = function formatProducts(item, quantity) {
481
+ var formatProducts = function formatProducts(item, quantity, options) {
481
482
  var _item$_extend36, _getMainProductSellin, _item$_extend37, _item$_extend38, _item$_extend39, _item$_extend40;
482
483
  var total = Number(item._extend.total);
483
484
  var origin_total = Number(item._extend.origin_total);
@@ -492,6 +493,9 @@ var formatProducts = function formatProducts(item, quantity) {
492
493
  d.metadata = _objectSpread(_objectSpread({}, d.metadata), {}, {
493
494
  unique_identification_number: "".concat(item._extend.unique_identification_number, "_").concat(d.discount.resource_id)
494
495
  });
496
+ if (options !== null && options !== void 0 && options.isServiceEdit && options !== null && options !== void 0 && options.isMultiDay) {
497
+ delete d.id;
498
+ }
495
499
  });
496
500
 
497
501
  // 非手动折扣
@@ -714,7 +718,10 @@ var formatBookings = function formatBookings(data, values) {
714
718
  item._extend.unique_identification_number = unique_identification_number;
715
719
  }
716
720
  var booking = _objectSpread(_objectSpread({
717
- product: formatProducts(item),
721
+ product: formatProducts(item, undefined, {
722
+ isServiceEdit: data.service.edit,
723
+ isMultiDay: isMultiDay
724
+ }),
718
725
  relation_products: formatRelationDetails(item._extend.relation_details),
719
726
  id: item.booking_id || 0,
720
727
  relation_id: item._extend.relation_id || 0,
@@ -128,7 +128,7 @@ var VoucherCard = function VoucherCard(props) {
128
128
  var val = (_ref = state.service.value || []) === null || _ref === void 0 ? void 0 : _ref.map(function (value) {
129
129
  var _value$_extend, _value$_extend2, _value$_extend3;
130
130
  return {
131
- booking_id: value.booking_id,
131
+ // booking_id: value.booking_id,
132
132
  id: value.id,
133
133
  price: value.price,
134
134
  total: value === null || value === void 0 || (_value$_extend = value._extend) === null || _value$_extend === void 0 ? void 0 : _value$_extend.total,
@@ -5,11 +5,6 @@ export interface BookingDashboardProps extends React.HTMLAttributes<HTMLDivEleme
5
5
  valueColor?: string;
6
6
  otherParams?: Record<string, any>;
7
7
  refreshKey?: string;
8
- /**
9
- * 组件是否可见。为 false 时会暂停内部的定时刷新 interval,避免后台无意义地拉数据。
10
- * 默认 true,保持原有行为向后兼容。
11
- */
12
- isVisible?: boolean;
13
8
  onDataChange?: (data: {
14
9
  groupsOnSiteNow: string | number;
15
10
  peopleOnSiteNow: string | number;
@@ -1,5 +1,5 @@
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
- var _excluded = ["otherParams", "backgroundColors", "labelColor", "valueColor", "refreshKey", "isVisible", "onDataChange"];
2
+ var _excluded = ["otherParams", "backgroundColors", "labelColor", "valueColor", "refreshKey", "onDataChange"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  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; }
5
5
  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); } }
@@ -51,8 +51,6 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
51
51
  labelColor = props.labelColor,
52
52
  valueColor = props.valueColor,
53
53
  refreshKey = props.refreshKey,
54
- _props$isVisible = props.isVisible,
55
- isVisible = _props$isVisible === void 0 ? true : _props$isVisible,
56
54
  onDataChange = props.onDataChange,
57
55
  others = _objectWithoutProperties(props, _excluded);
58
56
  var context = useEngineContext();
@@ -171,7 +169,7 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
171
169
  };
172
170
  }();
173
171
  var calcBookingDataCount = function calcBookingDataCount() {
174
- var _statisticData$total_, _statisticData$total_2, _statisticData$ongoin, _statisticData$ongoin2, _statisticData$upcomi, _statisticData$upcomi2, _statisticData$comple, _statisticData$comple2;
172
+ var _statisticData$total_, _statisticData$total_2, _statisticData$ongoin, _statisticData$ongoin2, _statisticData$upcomi, _statisticData$upcomi2;
175
173
  // 当前在场团体
176
174
  var groupsOnSiteNow = statisticData.groups_today_num || 0;
177
175
  // 当前在场人数
@@ -191,9 +189,9 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
191
189
  // 超时的游客
192
190
  var overdue = statisticData.overdue_visitors_num || (hasTurnstileApp ? 0 : '-');
193
191
  // 已完成的游客
194
- var completed = ((_statisticData$comple = statisticData.completed_visitors) === null || _statisticData$comple === void 0 ? void 0 : _statisticData$comple.num) || 0;
192
+ var completed = statisticData.completed_visitors.num || 0;
195
193
  // 已完成的游客二级数据
196
- var completedChildren = ((_statisticData$comple2 = statisticData.completed_visitors) === null || _statisticData$comple2 === void 0 ? void 0 : _statisticData$comple2.statistics) || [];
194
+ var completedChildren = statisticData.completed_visitors.statistics || [];
197
195
  // 已离场的游客
198
196
  var departed = statisticData.departed_visitors_num || (hasTurnstileApp ? 0 : '-');
199
197
  onDataChange === null || onDataChange === void 0 || onDataChange({
@@ -261,8 +259,6 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
261
259
  }]);
262
260
  };
263
261
  useEffect(function () {
264
- // 不可见时不拉数据、不启动 interval,避免后台浪费内存和请求
265
- if (!isVisible) return;
266
262
  getData();
267
263
 
268
264
  // 每分钟更新一次数据
@@ -272,10 +268,11 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
272
268
  return function () {
273
269
  clearInterval(timer);
274
270
  };
275
- }, [JSON.stringify(otherParams), refreshKey, isVisible]);
271
+ }, [JSON.stringify(otherParams), refreshKey]);
276
272
  useImperativeHandle(ref, function () {
277
273
  return {
278
274
  refresh: function refresh() {
275
+ debugger;
279
276
  getData();
280
277
  }
281
278
  };
@@ -7,9 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { getUniqueId } from "@pisell/utils";
8
8
  import { getProductTotalPrice } from "../../../utils";
9
9
  import { distributeDiscountOrIncrease } from "../../service/serviceManager/distributeDiscount";
10
- import { setProductPrice } from "../../../info2/service/editService/utils";
11
10
  import { genServiceKey } from "../../../../ticketBooking/utils";
12
- import Decimal from "decimal.js";
13
11
 
14
12
  // 创建group
15
13
 
@@ -123,34 +121,7 @@ export var createBookingItemsByGroup = function createBookingItemsByGroup(item,
123
121
  // 折扣金额 转成负数
124
122
  var discountAmount = (groupOriginTotalPrice - groupTotalPrice) * -1;
125
123
  if (discountAmount !== 0) {
126
- if (groupOriginTotalPrice !== 0) {
127
- bookings = distributeDiscountOrIncrease(bookings, discountAmount, groupOriginTotalPrice);
128
- bookings = bookings.map(function (booking) {
129
- var _booking$_extend, _booking$_extend2;
130
- return setProductPrice(booking, {
131
- newTotal: booking === null || booking === void 0 || (_booking$_extend = booking._extend) === null || _booking$_extend === void 0 ? void 0 : _booking$_extend.total,
132
- origin_total: booking === null || booking === void 0 || (_booking$_extend2 = booking._extend) === null || _booking$_extend2 === void 0 ? void 0 : _booking$_extend2.origin_total
133
- });
134
- });
135
- } else {
136
- // 原价为 0 无法按比例分摊(会除零),按 booking 数量均摊手动改价后的 groupTotalPrice
137
- // 最后一个 booking 吸收两位小数的精度误差,确保总和等于 groupTotalPrice
138
- var count = bookings.length;
139
- var avgTotal = new Decimal(groupTotalPrice).div(count).toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
140
- var assignedSum = new Decimal(0);
141
- bookings = bookings.map(function (booking, i) {
142
- var newTotal = i === count - 1 ? new Decimal(groupTotalPrice).sub(assignedSum).toNumber() : avgTotal.toNumber();
143
- if (i !== count - 1) {
144
- assignedSum = assignedSum.add(avgTotal);
145
- }
146
- return _objectSpread(_objectSpread({}, booking), {}, {
147
- _extend: _objectSpread(_objectSpread({}, booking._extend), {}, {
148
- total: newTotal,
149
- price: newTotal
150
- })
151
- });
152
- });
153
- }
124
+ bookings = distributeDiscountOrIncrease(bookings, discountAmount, groupOriginTotalPrice);
154
125
  }
155
126
  }
156
127
  console.log('bookings', bookings);
@@ -19,7 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
19
19
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
  import Delete_wght300_24px from '@pisell/icon/es/Delete_wght300_24px';
22
- import { formatAmount, getUniqueId, locales } from '@pisell/utils';
22
+ import { formatAmount, getUniqueId, locales, sendWarningLog } from '@pisell/utils';
23
23
  import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
24
24
  import Drawer from "../../../components/drawer";
25
25
  import { Context } from "../../../info/model";
@@ -41,7 +41,7 @@ import { editSessionProduct } from "../../../info/utils";
41
41
  import { deleteCacheParams, getDays, getProductOriginTotalPrice, getProductTotalPrice, getServiceTimes, isSessionProduct, isWalkIn } from "../../../utils";
42
42
  import { getErrorList, getIsNoSpecAndPackage } from "../../utilsByBooking";
43
43
  import { formatResources, getDurationProps, getFlexibleOption, getMultiDay, getTimeObj, setDefaultCapacitys } from "../addService/utils";
44
- import { getProductAllDiscountList, mergeBundleWithOriginalPrice, setProductPrice } from "./utils";
44
+ import { getProductAllDiscountList, mergeBundles, setProductPrice, mergeBundleWithOriginalPrice } from "./utils";
45
45
  import NoteModal from "../../../../../plus/noteModal";
46
46
  import { DiscountKeyboard } from "../../../../../pro/priceKeyboard";
47
47
  import EditTabs from "../../../info/service/editService/EditTabs";
@@ -51,6 +51,7 @@ import { createBookingItemsByGroup, getGroupTotalPrice } from "../../../info/ser
51
51
  import { useShopDiscountModule } from "../../../../ticketBooking/hooks/pisellos/useShopDiscountModule";
52
52
  import DiscountChangeModal from "./DiscountChangeModal";
53
53
  import Decimal from "decimal.js";
54
+ import useEngineContext from "../../../../../hooks/useEngineContext";
54
55
  var submitLock = false;
55
56
  var Info = function Info(_, ref) {
56
57
  var _state$service4, _state$bookingConfig2, _state$bookingConfig3, _state$service$cacheI5, _state$service$cacheI7, _state$service6, _window$BaseMaterials, _state$service8, _state$service$cacheI12, _state$bookingConfig5, _state$service$cacheI13, _state$service$cacheI14, _state$service9, _state$service$resour2, _state$service$cacheI16, _state$service$cacheI17, _state$client2;
@@ -71,6 +72,7 @@ var Info = function Info(_, ref) {
71
72
  _useState2 = _slicedToArray(_useState, 2),
72
73
  discountChangeModalOpen = _useState2[0],
73
74
  setDiscountChangeModalOpen = _useState2[1];
75
+ var context = useEngineContext();
74
76
  var _useContext = useContext(Context),
75
77
  state = _useContext.state,
76
78
  dispatch = _useContext.dispatch;
@@ -663,13 +665,19 @@ var Info = function Info(_, ref) {
663
665
  var values = form.getFieldsValue();
664
666
  var isSession = isSessionProduct(item);
665
667
  var sessionValue = {};
668
+ var oldSession = {};
666
669
  if (isSession) {
667
- var _item$_extend7, _item$_extend8, _item$_extend9;
670
+ var _item$_extend7, _item$_extend8, _item$_extend9, _item$_extend10, _item$_extend11, _item$_extend12;
668
671
  sessionValue.startEndTime = {
669
672
  startDate: item === null || item === void 0 || (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.start_date,
670
673
  endDate: item === null || item === void 0 || (_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.end_date,
671
674
  duration: item === null || item === void 0 || (_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.duration
672
675
  };
676
+ oldSession = {
677
+ start_date: dayjs(item === null || item === void 0 || (_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.start_date).format('YYYY-MM-DD'),
678
+ end_date: dayjs(item === null || item === void 0 || (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.end_date).format('YYYY-MM-DD'),
679
+ duration: item === null || item === void 0 || (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.duration
680
+ };
673
681
  }
674
682
 
675
683
  // 打开商品详情弹窗
@@ -687,7 +695,9 @@ var Info = function Info(_, ref) {
687
695
  },
688
696
  isOS: isSession,
689
697
  customer_id: (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id,
690
- value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), sessionValue), {}, {
698
+ value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), {}, {
699
+ bundle: mergeBundles(item._extend.other)
700
+ }, sessionValue), {}, {
691
701
  quantity: values.quantity || item._extend.quantity
692
702
  })
693
703
  },
@@ -700,8 +710,8 @@ var Info = function Info(_, ref) {
700
710
 
701
711
  // 手动折扣时 合并 bundle price,优先使用编辑前的价格
702
712
  if (item.discount_amount) {
703
- var _item$_extend10;
704
- other = mergeBundleWithOriginalPrice(other, ((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.other) || {});
713
+ var _item$_extend13;
714
+ other = mergeBundleWithOriginalPrice(other, ((_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.other) || {});
705
715
  }
706
716
  other.session = e.session;
707
717
 
@@ -736,6 +746,37 @@ var Info = function Info(_, ref) {
736
746
  });
737
747
  } catch (err) {}
738
748
  var sessionDetail = editSessionProduct(cacheItem, e.session);
749
+ try {
750
+ var _e$session, _e$session2, _e$session3, _e$session4, _e$session5, _context$appHelper, _context$appHelper$ge;
751
+ sendWarningLog({
752
+ title: '修改商品数据',
753
+ content: [{
754
+ key: 'productId',
755
+ value: item.id
756
+ }, {
757
+ key: "isSession",
758
+ value: isSession
759
+ }, {
760
+ key: 'oldSession',
761
+ value: JSON.stringify(oldSession)
762
+ }, {
763
+ key: 'sessionValue',
764
+ value: JSON.stringify({
765
+ startTime: (_e$session = e.session) === null || _e$session === void 0 ? void 0 : _e$session.start_time,
766
+ endTime: (_e$session2 = e.session) === null || _e$session2 === void 0 ? void 0 : _e$session2.end_time,
767
+ startDate: dayjs((_e$session3 = e.session) === null || _e$session3 === void 0 ? void 0 : _e$session3.start_at).format('YYYY-MM-DD'),
768
+ endDate: dayjs((_e$session4 = e.session) === null || _e$session4 === void 0 ? void 0 : _e$session4.end_at).format('YYYY-MM-DD'),
769
+ duration: (_e$session5 = e.session) === null || _e$session5 === void 0 ? void 0 : _e$session5.duration
770
+ })
771
+ }, {
772
+ key: '日期',
773
+ value: dayjs().format('YYYY-MM-DD HH:mm')
774
+ }, {
775
+ key: '店铺id',
776
+ value: (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.store) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getState) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.call(_context$appHelper)) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.global) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.globalConfig) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.id
777
+ }]
778
+ });
779
+ } catch (err) {}
739
780
  if (sessionDetail) {
740
781
  setTimeout(function () {
741
782
  form.setFieldsValue({
@@ -1223,6 +1264,8 @@ var Info = function Info(_, ref) {
1223
1264
  var _cacheItem$_extend$ot, _cacheItem$_extend$ot2;
1224
1265
  delete cacheItem.discount_list;
1225
1266
  (_cacheItem$_extend$ot = cacheItem._extend.other) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot = _cacheItem$_extend$ot.bundle) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot2 = _cacheItem$_extend$ot.forEach) === null || _cacheItem$_extend$ot2 === void 0 || _cacheItem$_extend$ot2.call(_cacheItem$_extend$ot, function (bundle) {
1267
+ var _bundle$metadata;
1268
+ bundle === null || bundle === void 0 || (_bundle$metadata = bundle.metadata) === null || _bundle$metadata === void 0 || delete _bundle$metadata.custom_product_bundle_map_id;
1226
1269
  bundle === null || bundle === void 0 || delete bundle.discount_list;
1227
1270
  bundle === null || bundle === void 0 || delete bundle.booking_id;
1228
1271
  bundle === null || bundle === void 0 || delete bundle.bundle_selling_price;
@@ -32,6 +32,7 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
32
32
  * @returns 折扣列表
33
33
  */
34
34
  export declare const getProductAllDiscountList: (cacheItem: any) => any;
35
+ export declare const mergeBundles: (other: any) => any[];
35
36
  /**
36
37
  * 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
37
38
  * @param other - callback 返回的新数据
@@ -149,6 +149,22 @@ export var getProductAllDiscountList = function getProductAllDiscountList(cacheI
149
149
  (_discountList = discountList).push.apply(_discountList, _toConsumableArray(bundleDiscountList));
150
150
  return discountList;
151
151
  };
152
+ export var mergeBundles = function mergeBundles(other) {
153
+ var bundle = (other === null || other === void 0 ? void 0 : other.bundle) || [];
154
+ var newBundle = [];
155
+ bundle.forEach(function (item) {
156
+ var newItem = newBundle.find(function (newItem) {
157
+ return newItem.id === item.id;
158
+ });
159
+ if (newItem) {
160
+ newItem.num += item.num || 1;
161
+ newItem.quantity += item.quantity || 1;
162
+ } else {
163
+ newBundle.push(_objectSpread({}, item));
164
+ }
165
+ });
166
+ return newBundle;
167
+ };
152
168
 
153
169
  /**
154
170
  * 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
@@ -189,7 +189,7 @@ var Payments = Provider(function (props) {
189
189
  className: "payment-list-item-surcharge"
190
190
  }, "(", locales.getText("pisell2.text.surcharge"), " ", formatAmount(item.service_fee, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"), ")") : null, /*#__PURE__*/React.createElement("div", {
191
191
  className: "payment-list-item-date"
192
- }, dayjs(item.payment_time).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
192
+ }, dayjs(item.payment_time || item.created_at).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
193
193
  className: "payment-list-item-platform-type"
194
194
  }, item.platform && locales.getText("pisell2.text.platform.type")(item.platform))))))));
195
195
  }
@@ -29,8 +29,6 @@ import usePaymentLogger from "./usePaymentLogger";
29
29
  import { isWalkIn } from "../../booking/utils";
30
30
  import { useActiveExecute } from "../../ticketBooking/hooks/pisellos";
31
31
  import { useShopDiscountModule } from "../../ticketBooking/hooks/pisellos/useShopDiscountModule";
32
- import { useOsKey } from "../../ticketBooking/context";
33
- import { getShopDiscountKey } from "../../ticketBooking/utils";
34
32
 
35
33
  /**
36
34
  * 自定义Hook:使用WalletPass功能
@@ -42,10 +40,6 @@ export var useWalletPass = function useWalletPass(props) {
42
40
  var logger = usePaymentLogger();
43
41
  var _useActiveExecute = useActiveExecute(),
44
42
  executeIfActive = _useActiveExecute.executeIfActive;
45
- var osKey = useOsKey();
46
-
47
- // 根据 osKey 生成模块名称
48
- var moduleKey = getShopDiscountKey(osKey || 'ticket');
49
43
 
50
44
  // 钱包推荐列表
51
45
  var _useState = useState([]),
@@ -679,7 +673,7 @@ export var useWalletPass = function useWalletPass(props) {
679
673
  // 保持初始顺序设置折扣列表
680
674
  var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
681
675
  setDiscountList(sortedDiscountList);
682
- pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.emit("".concat(moduleKey, ":onSelectedDiscountListChange"), detail);
676
+ pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.emit('shopDiscount:onSelectedDiscountListChange', detail);
683
677
  return;
684
678
  }
685
679
  setWalletSelect([]);
@@ -779,25 +773,23 @@ export var useWalletPass = function useWalletPass(props) {
779
773
  }
780
774
  });
781
775
  var handleSelectDiscount = useMemoizedFn(function (value, option) {
776
+ var _detail$discountList, _pisellos$effects2;
782
777
  setLoading(true);
783
- try {
784
- var _pisellos$effects2;
785
- var isSelected = value.includes(option.id);
786
- var detail = shopDiscount.setDiscountSelected({
787
- discountId: option.id,
788
- isSelected: isSelected
789
- });
790
-
791
- // 保持初始顺序设置折扣列表
792
- var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
793
- setDiscountList(sortedDiscountList);
794
- pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.emit("".concat(moduleKey, ":onSelectedDiscountListChange"), detail);
795
- } catch (err) {
796
- console.log(err, '1234err');
797
- } finally {
798
- // 商品券选择流程结束后统一回收loading,避免出现转圈不停止
778
+ var isSelected = value.includes(option.id);
779
+ var detail = shopDiscount.setDiscountSelected({
780
+ discountId: option.id,
781
+ isSelected: isSelected
782
+ });
783
+ if (!(detail !== null && detail !== void 0 && (_detail$discountList = detail.discountList) !== null && _detail$discountList !== void 0 && (_detail$discountList = _detail$discountList.find(function (item) {
784
+ return item.id === option.id;
785
+ })) !== null && _detail$discountList !== void 0 && _detail$discountList.isSelected)) {
799
786
  setLoading(false);
800
787
  }
788
+
789
+ // 保持初始顺序设置折扣列表
790
+ var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
791
+ setDiscountList(sortedDiscountList);
792
+ pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.emit('shopDiscount:onSelectedDiscountListChange', detail);
801
793
  });
802
794
 
803
795
  // 清空不可用钱包数据
@@ -122,6 +122,7 @@ var AddSerivce = function AddSerivce(props) {
122
122
  var handler = function handler(event) {
123
123
  var _event$detail;
124
124
  var cacheItem = event === null || event === void 0 || (_event$detail = event.detail) === null || _event$detail === void 0 ? void 0 : _event$detail.cacheItem;
125
+ console.log('Modal closed with result:', event.detail.cacheItem);
125
126
  if (!(cacheItem !== null && cacheItem !== void 0 && cacheItem.id)) return;
126
127
  addServiceScroll(String(cacheItem.id), cacheItem);
127
128
  };
@@ -2,8 +2,6 @@ import React from 'react';
2
2
  import './index.less';
3
3
  interface BookingDashboardProps {
4
4
  bookingTimeStartBetween: string[];
5
- /** 组件是否可见,不可见时内部会暂停 interval,默认 true */
6
- isVisible?: boolean;
7
5
  }
8
6
  declare const BookingDashboard: React.ForwardRefExoticComponent<BookingDashboardProps & React.RefAttributes<unknown>>;
9
7
  export default BookingDashboard;
@@ -4,9 +4,7 @@ import { useImperativeHandle } from 'react';
4
4
  import BookingDashboardComponent from "../../../../booking/dashboard";
5
5
  import "./index.less";
6
6
  var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
7
- var bookingTimeStartBetween = props.bookingTimeStartBetween,
8
- _props$isVisible = props.isVisible,
9
- isVisible = _props$isVisible === void 0 ? true : _props$isVisible;
7
+ var bookingTimeStartBetween = props.bookingTimeStartBetween;
10
8
  var bookingDashboardRef = useRef(null);
11
9
  var cptProps = useMemo(function () {
12
10
  return {
@@ -16,10 +14,9 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
16
14
  otherParams: {
17
15
  booking_time_start_between: bookingTimeStartBetween
18
16
  },
19
- isVisible: isVisible,
20
17
  backgroundColors: ['rgba(224, 79, 22, 0.20)', 'rgba(217, 45, 32, 0.14)', 'rgba(127, 86, 217, 0.22)', 'rgba(7, 148, 85, 0.20)', 'rgba(21, 112, 239, 0.23)', 'rgba(202, 133, 4, 0.20)', 'var(--Gray-800, #1D2939)', 'var(--Gray-true-800, #292929)']
21
18
  };
22
- }, [bookingTimeStartBetween, isVisible]);
19
+ }, [bookingTimeStartBetween]);
23
20
  useImperativeHandle(ref, function () {
24
21
  return {
25
22
  refresh: function refresh() {
@@ -4,8 +4,6 @@ interface BookingDataPanelProps {
4
4
  currentDate: string;
5
5
  onBookingClick: (booking: any) => void;
6
6
  bookingId?: number;
7
- /** 面板是否可见,透传给内部 Dashboard 控制 interval 是否启动 */
8
- isVisible?: boolean;
9
7
  }
10
8
  declare const BookingDataPanel: React.ForwardRefExoticComponent<BookingDataPanelProps & React.RefAttributes<unknown>>;
11
9
  export default BookingDataPanel;
@@ -9,9 +9,7 @@ import "./index.less";
9
9
  var BookingDataPanel = /*#__PURE__*/forwardRef(function (props, ref) {
10
10
  var currentDate = props.currentDate,
11
11
  onBookingClick = props.onBookingClick,
12
- bookingId = props.bookingId,
13
- _props$isVisible = props.isVisible,
14
- isVisible = _props$isVisible === void 0 ? true : _props$isVisible;
12
+ bookingId = props.bookingId;
15
13
  var Toast = useToast();
16
14
  var bookingListRef = useRef(null);
17
15
  var bookingDashboardRef = useRef(null);
@@ -24,7 +22,6 @@ var BookingDataPanel = /*#__PURE__*/forwardRef(function (props, ref) {
24
22
  key: 'data-board',
25
23
  children: /*#__PURE__*/React.createElement(BookingDashboard, {
26
24
  bookingTimeStartBetween: bookingTimeStartBetween,
27
- isVisible: isVisible,
28
25
  ref: bookingDashboardRef
29
26
  })
30
27
  }, {
@@ -37,7 +34,7 @@ var BookingDataPanel = /*#__PURE__*/forwardRef(function (props, ref) {
37
34
  ref: bookingListRef
38
35
  })
39
36
  }];
40
- }, [currentDate, bookingId, isVisible]);
37
+ }, [currentDate, bookingId]);
41
38
  useImperativeHandle(ref, function () {
42
39
  return {
43
40
  refresh: function refresh() {
@@ -61,11 +61,10 @@ var PisellFloatingPanel = /*#__PURE__*/forwardRef(function (props, ref) {
61
61
  });
62
62
  return /*#__PURE__*/React.createElement(PisellFloatingPanelComponent, _extends({}, floationgPanelProps, {
63
63
  open: isOpen
64
- }), isOpen && /*#__PURE__*/React.createElement(BookingDataPanel, {
64
+ }), /*#__PURE__*/React.createElement(BookingDataPanel, {
65
65
  currentDate: currentDate,
66
66
  bookingId: bookingId,
67
67
  onBookingClick: onBookingClick,
68
- isVisible: isOpen,
69
68
  ref: bookingDataPanelRef
70
69
  }));
71
70
  });