@pisell/pisellos 0.0.410 → 0.0.411

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.
@@ -3,12 +3,12 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
3
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
4
  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; } }
5
5
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
6
+ 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; } } }; }
6
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
9
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
10
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
11
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
- 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; } } }; }
12
12
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
13
13
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
14
  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); }
@@ -153,7 +153,12 @@ export var getTax = function getTax(_ref, options) {
153
153
  if (service || addons) {
154
154
  // 处理服务商品
155
155
  if (service !== null && service !== void 0 && service.length) {
156
- var serviceResult = processItemsTax(service, {
156
+ var serviceResult = processItemsTax(service.map(function (item) {
157
+ return _objectSpread(_objectSpread({}, item), {}, {
158
+ option: (item === null || item === void 0 ? void 0 : item.option) || (item === null || item === void 0 ? void 0 : item.options) || [],
159
+ bundle: (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || []
160
+ });
161
+ }), {
157
162
  bookingDetail: bookingDetail,
158
163
  bookingId: bookingId
159
164
  }, {
@@ -222,7 +227,10 @@ var processItemsTax = function processItemsTax(items, _ref2, options) {
222
227
  var item = _step.value;
223
228
  var quantity = new Decimal(item.num || 1);
224
229
  var unitPrice = new Decimal(item.total || 0);
225
- var mainProductPrice = new Decimal(getMainProductTotal(item) || 0);
230
+ var mainProductPrice = new Decimal(getMainProductTotal(_objectSpread(_objectSpread({}, item), {}, {
231
+ option: (item === null || item === void 0 ? void 0 : item.option) || (item === null || item === void 0 ? void 0 : item.options) || [],
232
+ bundle: (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || []
233
+ })) || 0);
226
234
 
227
235
  // 计算原始税费(折扣前)- 单个商品(精确值)
228
236
  var originalTaxPerItemPrecise = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
@@ -895,7 +903,10 @@ export var getSurcharge = function getSurcharge(_ref10, options) {
895
903
  isInScheduleByDate: isInScheduleByDate
896
904
  })) {
897
905
  // 主商品加价减价后的总价
898
- var total = getMainProductTotal(item);
906
+ var total = getMainProductTotal(_objectSpread(_objectSpread({}, item), {}, {
907
+ option: (item === null || item === void 0 ? void 0 : item.option) || (item === null || item === void 0 ? void 0 : item.options) || [],
908
+ bundle: (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || []
909
+ }));
899
910
  var mainQuantity = item.num || 1;
900
911
  matchedItems.push({
901
912
  total: total,
@@ -99,7 +99,13 @@ var getTax = ({ service, addons, bookingDetail, bookingId }, options) => {
99
99
  let totalTax = new import_decimal.default(0);
100
100
  if (service || addons) {
101
101
  if (service == null ? void 0 : service.length) {
102
- const serviceResult = processItemsTax(service, { bookingDetail, bookingId }, {
102
+ const serviceResult = processItemsTax(service.map((item) => {
103
+ return {
104
+ ...item,
105
+ option: (item == null ? void 0 : item.option) || (item == null ? void 0 : item.options) || [],
106
+ bundle: (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || []
107
+ };
108
+ }), { bookingDetail, bookingId }, {
103
109
  tax_rate,
104
110
  is_price_include_tax,
105
111
  computed
@@ -133,7 +139,11 @@ var processItemsTax = (items, { bookingDetail, bookingId }, options) => {
133
139
  for (let item of items) {
134
140
  const quantity = new import_decimal.default(item.num || 1);
135
141
  const unitPrice = new import_decimal.default(item.total || 0);
136
- const mainProductPrice = new import_decimal.default(getMainProductTotal(item) || 0);
142
+ const mainProductPrice = new import_decimal.default(getMainProductTotal({
143
+ ...item,
144
+ option: (item == null ? void 0 : item.option) || (item == null ? void 0 : item.options) || [],
145
+ bundle: (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || []
146
+ }) || 0);
137
147
  let originalTaxPerItemPrecise = getProductItemTax(
138
148
  {
139
149
  ...item,
@@ -531,7 +541,11 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
531
541
  isInScheduleByDate
532
542
  }
533
543
  )) {
534
- const total = getMainProductTotal(item);
544
+ const total = getMainProductTotal({
545
+ ...item,
546
+ option: (item == null ? void 0 : item.option) || (item == null ? void 0 : item.options) || [],
547
+ bundle: (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || []
548
+ });
535
549
  const mainQuantity = item.num || 1;
536
550
  matchedItems.push({
537
551
  total,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.410",
4
+ "version": "0.0.411",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",