@pisell/pisellos 2.2.13 → 2.2.15

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 (31) hide show
  1. package/dist/modules/Customer/index.js +1 -1
  2. package/dist/modules/Order/index.js +18 -13
  3. package/dist/modules/Payment/index.d.ts +1 -0
  4. package/dist/modules/Payment/index.js +537 -500
  5. package/dist/modules/Payment/types.d.ts +0 -1
  6. package/dist/modules/Payment/walletpass.js +1 -3
  7. package/dist/modules/ProductList/index.js +9 -8
  8. package/dist/modules/Rules/index.js +34 -66
  9. package/dist/solution/BookingByStep/index.js +8 -29
  10. package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
  11. package/dist/solution/BookingByStep/utils/products.js +0 -10
  12. package/dist/solution/BookingTicket/index.d.ts +1 -1
  13. package/dist/solution/Checkout/index.js +21 -65
  14. package/dist/solution/Checkout/utils/index.d.ts +2 -1
  15. package/dist/solution/Checkout/utils/index.js +6 -4
  16. package/lib/modules/Customer/index.js +1 -1
  17. package/lib/modules/Order/index.js +20 -18
  18. package/lib/modules/Payment/index.d.ts +1 -0
  19. package/lib/modules/Payment/index.js +19 -3
  20. package/lib/modules/Payment/types.d.ts +0 -1
  21. package/lib/modules/Payment/walletpass.js +1 -10
  22. package/lib/modules/ProductList/index.js +7 -0
  23. package/lib/modules/Rules/index.js +36 -46
  24. package/lib/solution/BookingByStep/index.js +2 -15
  25. package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
  26. package/lib/solution/BookingByStep/utils/products.js +2 -8
  27. package/lib/solution/BookingTicket/index.d.ts +1 -1
  28. package/lib/solution/Checkout/index.js +20 -69
  29. package/lib/solution/Checkout/utils/index.d.ts +2 -1
  30. package/lib/solution/Checkout/utils/index.js +6 -4
  31. package/package.json +2 -2
@@ -671,7 +671,6 @@ export interface WalletInitBusinessData {
671
671
  order_wait_pay_amount?: number;
672
672
  /** 订单ID */
673
673
  payment_order_id?: string;
674
- is_price_include_tax: number;
675
674
  }
676
675
  /**
677
676
  * 查询用户识别码列表请求参数
@@ -64,14 +64,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
64
64
  amountInfo = businessData.amountInfo,
65
65
  products = businessData.products,
66
66
  order_wait_pay_amount = businessData.order_wait_pay_amount,
67
- payment_order_id = businessData.payment_order_id,
68
- is_price_include_tax = businessData.is_price_include_tax;
67
+ payment_order_id = businessData.payment_order_id;
69
68
 
70
69
  // 转换金额为数字类型
71
70
  var totalAmount = Number(amountInfo.totalAmount);
72
71
  var subTotal = Number(amountInfo.subTotal);
73
72
  var walletParams = {
74
- is_price_include_tax: is_price_include_tax,
75
73
  sale_channel: 'pos',
76
74
  customer_id: customer_id || 0,
77
75
  // 提供默认值,确保类型为 number
@@ -140,16 +140,17 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
140
140
  productsData = _context3.sent;
141
141
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
142
142
  return Number(b.sort) - Number(a.sort);
143
- }); // if (sortedList.length) {
144
- // sortedList.forEach((n: any) => {
145
- // if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
146
- // n.is_eject = 1
147
- // }
148
- // })
149
- // }
143
+ });
144
+ if (sortedList.length) {
145
+ sortedList.forEach(function (n) {
146
+ if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
147
+ n.is_eject = 1;
148
+ }
149
+ });
150
+ }
150
151
  this.addProduct(sortedList);
151
152
  return _context3.abrupt("return", sortedList);
152
- case 10:
153
+ case 11:
153
154
  case "end":
154
155
  return _context3.stop();
155
156
  }
@@ -24,12 +24,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
25
25
  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); }
26
26
  import { BaseModule } from "../BaseModule";
27
- import { uniqueById, getDiscountAmount, filterDiscountListByBookingTime, getDiscountListAmountTotal, getDiscountListAmount } from "../../solution/ShopDiscount/utils";
27
+ import { uniqueById, getDiscountAmount, getDiscountListAmountTotal, getDiscountListAmount, filterDiscountListByBookingTime } from "../../solution/ShopDiscount/utils";
28
28
  import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
29
29
  import Decimal from 'decimal.js';
30
- import { isBoolean } from 'lodash-es';
31
30
  import dayjs from 'dayjs';
32
-
33
31
  // 临时变量
34
32
  var flatItem;
35
33
  export var RulesModule = /*#__PURE__*/function (_BaseModule) {
@@ -449,7 +447,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
449
447
  var isBundleAvailable = _this3.checkPackageSubItemUsageRules(discount, flatItem);
450
448
 
451
449
  // 判断优惠券是否适用于该商品
452
- if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable) {
450
+ if (isAvailableProduct && isLimitedProduct && isBundleAvailable && timeLimit) {
453
451
  var _discountApplicabilit, _discount$metadata;
454
452
  // 记录此优惠券适用的商品
455
453
  (_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
@@ -490,7 +488,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
490
488
  // 然后再处理应用哪些优惠券,此时只考虑filteredDiscountList中的优惠券
491
489
  // 🔥 使用扁平化后的列表进行处理
492
490
  sortedFlattenedList.forEach(function (flatItem, index) {
493
- var _product5, _product$discount_lis2, _product6;
491
+ var _product5, _product$discount_lis2, _product6, _product$discount_lis10;
494
492
  // 获取商品数据
495
493
  var product, originProduct;
496
494
  if (flatItem.type === 'main') {
@@ -539,7 +537,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
539
537
  })) && (discount.tag || discount.type) === 'good_pass') return false;
540
538
 
541
539
  // 折扣卡商品价格为0时不可用
542
- if ((Number(product.price) <= 0 || !product.price) && !((_product$discount_lis4 = product.discount_list) !== null && _product$discount_lis4 !== void 0 && _product$discount_lis4.find(function (n) {
540
+ if ((Number(product.price) === 0 || !product.price) && !((_product$discount_lis4 = product.discount_list) !== null && _product$discount_lis4 !== void 0 && _product$discount_lis4.find(function (n) {
543
541
  var _n$discount2;
544
542
  return ((_n$discount2 = n.discount) === null || _n$discount2 === void 0 ? void 0 : _n$discount2.resource_id) === discount.id;
545
543
  })) && (discount.tag || discount.type) !== 'good_pass') return false;
@@ -666,9 +664,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
666
664
  }
667
665
  }
668
666
  }
667
+ if (options !== null && options !== void 0 && options.selectedList && (_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.some(function (item) {
668
+ var _options$selectedList4;
669
+ return options === null || options === void 0 || (_options$selectedList4 = options.selectedList) === null || _options$selectedList4 === void 0 ? void 0 : _options$selectedList4.some(function (n) {
670
+ var _item$discount7;
671
+ return n.discountId === ((_item$discount7 = item.discount) === null || _item$discount7 === void 0 ? void 0 : _item$discount7.resource_id);
672
+ });
673
+ })) {
674
+ isManualDiscount = false;
675
+ }
669
676
 
670
677
  // 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
671
- if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
678
+ if (applicableDiscounts.length === 0 || isManualDiscount) {
672
679
  if (flatItem.type === 'main') {
673
680
  // 主商品:保持原有逻辑
674
681
  if (product.isClient) {
@@ -694,10 +701,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
694
701
  discount_list: []
695
702
  }))]);
696
703
  } else {
697
- processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
698
- price: product.price,
699
- main_product_selling_price: product.price
700
- } : {
704
+ processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
701
705
  _id: product._id.split('___')[0] + '___' + index,
702
706
  total: product.origin_total || product.total,
703
707
  price: product.price,
@@ -710,7 +714,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
710
714
  // bundle子商品:保存到扁平化Map
711
715
  processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
712
716
  discount_list: [],
713
- price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
717
+ price: flatItem.bundleItem.original_price,
714
718
  processed: true
715
719
  })]);
716
720
  }
@@ -742,7 +746,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
742
746
  }));
743
747
  }
744
748
  for (var i = 0; i < splitCount; i++) {
745
- var _product$discount_lis10, _originProduct, _selectedDiscount$met;
749
+ var _product$discount_lis11, _originProduct, _selectedDiscount$met;
746
750
  // 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
747
751
  var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
748
752
  // 标记优惠券为已使用
@@ -754,7 +758,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
754
758
  // 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
755
759
  var productOriginTotal = product.origin_total || product.total || 0;
756
760
  // 如果当前 product 有 discount_list,则先从 origin_total 拿
757
- if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.length && product.origin_total) {
761
+ if ((_product$discount_lis11 = product.discount_list) !== null && _product$discount_lis11 !== void 0 && _product$discount_lis11.length && product.origin_total) {
758
762
  productOriginTotal = product.origin_total;
759
763
  }
760
764
  // 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
@@ -1110,18 +1114,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1110
1114
  var allDiscountAmount = getDiscountListAmountTotal(mainDiscountList);
1111
1115
  newTotalWithDiscount = (_Decimal$minus$toNumb = new Decimal(mainProductData.price || 0).minus(allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb !== void 0 ? _Decimal$minus$toNumb : newTotalWithDiscount;
1112
1116
  newOriginTotalWithDiscount = (_mainProductData$orig = mainProductData.origin_total) !== null && _mainProductData$orig !== void 0 ? _mainProductData$orig : newOriginTotalWithDiscount;
1113
- }
1114
-
1115
- // 累加bundle的价格(只累加一次)
1116
- if (newBundleWithDiscount.length > 0) {
1117
- newBundleWithDiscount.forEach(function (item) {
1118
- newTotalWithDiscount += Number(item.price) * Number(item.num);
1119
- });
1120
- newBundleWithDiscount.forEach(function (item) {
1121
- var _item$discount_list2;
1122
- var originalPrice = ((_item$discount_list2 = item.discount_list) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2[0]) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2.discount) === null || _item$discount_list2 === void 0 ? void 0 : _item$discount_list2.original_amount) || item.price;
1123
- newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
1124
- });
1117
+ if (newBundleWithDiscount.length > 0) {
1118
+ newBundleWithDiscount.forEach(function (item) {
1119
+ var _item$discount_list2;
1120
+ newTotalWithDiscount += Number(item.price) * Number(item.num);
1121
+ var originalPrice = ((_item$discount_list2 = item.discount_list) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2[0]) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2.discount) === null || _item$discount_list2 === void 0 ? void 0 : _item$discount_list2.original_amount) || item.price;
1122
+ newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
1123
+ });
1124
+ }
1125
1125
  }
1126
1126
 
1127
1127
  // 累加options的价格(options不参与折扣,在最终设置total时处理)
@@ -1184,14 +1184,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1184
1184
  var _allDiscountAmount = getDiscountListAmount(mainDiscountListOriginal);
1185
1185
  newTotalOriginal = (_Decimal$minus$toNumb2 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb2 !== void 0 ? _Decimal$minus$toNumb2 : newTotalOriginal;
1186
1186
  newOriginTotalOriginal = (_mainProductData$orig2 = mainProductData.origin_total) !== null && _mainProductData$orig2 !== void 0 ? _mainProductData$orig2 : newOriginTotalOriginal;
1187
- }
1188
-
1189
- // 累加bundle的价格(只累加一次)
1190
- if (newBundleOriginal.length > 0) {
1191
- newBundleOriginal.forEach(function (item) {
1192
- newTotalOriginal += Number(item.price) * Number(item.num);
1193
- newOriginTotalOriginal += Number(item.price) * Number(item.num);
1194
- });
1187
+ if (newBundleOriginal.length > 0) {
1188
+ newBundleOriginal.forEach(function (item) {
1189
+ newTotalOriginal += Number(item.price) * Number(item.num);
1190
+ newOriginTotalOriginal += Number(item.price) * Number(item.num);
1191
+ });
1192
+ }
1195
1193
  }
1196
1194
 
1197
1195
  // 累加options的价格(options不参与折扣,在最终设置total时处理)
@@ -1285,13 +1283,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1285
1283
 
1286
1284
  // 累加bundle的价格(只累加一次)
1287
1285
  if (newBundle.length > 0) {
1288
- newBundle.forEach(function (item) {
1289
- newTotal += Number(item.price) * Number(item.num);
1290
- });
1291
-
1292
- // 计算原始总价(不考虑折扣)
1293
1286
  newBundle.forEach(function (item) {
1294
1287
  var _item$discount_list3;
1288
+ newTotal += Number(item.price) * Number(item.num);
1295
1289
  var originalPrice = ((_item$discount_list3 = item.discount_list) === null || _item$discount_list3 === void 0 || (_item$discount_list3 = _item$discount_list3[0]) === null || _item$discount_list3 === void 0 || (_item$discount_list3 = _item$discount_list3.discount) === null || _item$discount_list3 === void 0 ? void 0 : _item$discount_list3.original_amount) || item.price;
1296
1290
  newOriginTotal += Number(originalPrice) * Number(item.num);
1297
1291
  });
@@ -1470,34 +1464,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1470
1464
  // 套餐中购买时,判断是否为原价
1471
1465
  var _priceType = (_flatItem$bundleItem7 = flatItem.bundleItem) === null || _flatItem$bundleItem7 === void 0 ? void 0 : _flatItem$bundleItem7.price_type;
1472
1466
  var _priceTypeExt = (_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.price_type_ext;
1473
-
1474
- // original_price 对应:
1475
- // 1. price_type: "markup" && price_type_ext: "product_price"
1476
- // markup_price 对应:
1477
- // price_type: "markup" && price_type_ext: ""
1478
- /** 原价 */
1479
- var _isOriginalPrice = _priceType === 'markup' && _priceTypeExt === 'product_price';
1480
- /** 加价 */
1481
- var _isMarkupPrice = _priceType === 'markup' && (_priceTypeExt === '' || !_priceTypeExt);
1482
-
1483
- // 检查 rules
1484
- if (rules.length > 0) {
1485
- // 检查原价
1486
- if (_isOriginalPrice && rules.includes('original_price')) {
1487
- return true;
1488
- }
1489
-
1490
- // 检查加价
1491
- if (_isMarkupPrice && rules.includes('markup_price')) {
1492
- return true;
1493
- }
1494
-
1495
- // 如果都不匹配,则不可用
1496
- return false;
1497
- }
1498
-
1499
1467
  // 原价包括:price_type: "markup" && price_type_ext: "product_price"
1500
- return _isOriginalPrice;
1468
+ return _priceType === 'markup' && _priceTypeExt === 'product_price';
1501
1469
  }
1502
1470
  return false;
1503
1471
  }
@@ -31,7 +31,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
31
31
  import { BaseModule } from "../../modules/BaseModule";
32
32
  import { createModule } from "./types";
33
33
  import { formatProductToCartItem, createCartItemOrigin, getUniqueId, handleVariantProduct, formatDateToCartItem, formatAccountToCartItem } from "../../modules/Cart/utils";
34
- import { getAvailableProductResources, isSessionProduct } from "./utils/products";
34
+ import { getAvailableProductResources } from "./utils/products";
35
35
  import { getResourcesByProduct, getTimeSlicesByResource, getTimeSlicesByResources, getIsUsableByTimeItem, getOthersSelectedResources, getOthersCartSelectedResources, filterScheduleByDateRange, checkSessionProductLeadTime, sortCombinedResources, filterResourcesByFormItem, checkTwoResourcesIntersection, isConflict } from "./utils/resources";
36
36
  import dayjs from 'dayjs';
37
37
  import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
@@ -238,29 +238,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
238
238
  key: "loadProducts",
239
239
  value: (function () {
240
240
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
241
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, res;
241
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date;
242
242
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
243
243
  while (1) switch (_context2.prev = _context2.next) {
244
244
  case 0:
245
245
  _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date;
246
- _context2.next = 3;
247
- return this.store.products.loadProducts({
246
+ return _context2.abrupt("return", this.store.products.loadProducts({
248
247
  category_ids: category_ids,
249
248
  product_ids: product_ids,
250
249
  collection: collection,
251
250
  schedule_date: schedule_date,
252
251
  cacheId: this.cacheId
253
- });
254
- case 3:
255
- res = _context2.sent;
256
- // 预拉取当天的资源数据
257
- this.getAvailableDate({
258
- startDate: schedule_date || dayjs().format('YYYY-MM-DD'),
259
- endDate: schedule_date || dayjs().format('YYYY-MM-DD'),
260
- products: _toConsumableArray(res)
261
- });
262
- return _context2.abrupt("return", res);
263
- case 6:
252
+ }));
253
+ case 2:
264
254
  case "end":
265
255
  return _context2.stop();
266
256
  }
@@ -292,7 +282,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
292
282
  value: (function () {
293
283
  var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
294
284
  var _schedule$product_ids;
295
- var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds, res;
285
+ var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds;
296
286
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
297
287
  while (1) switch (_context3.prev = _context3.next) {
298
288
  case 0:
@@ -339,9 +329,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
339
329
  schedule_date: date
340
330
  });
341
331
  case 10:
342
- res = _context3.sent;
343
- return _context3.abrupt("return", res);
344
- case 12:
332
+ return _context3.abrupt("return", _context3.sent);
333
+ case 11:
345
334
  case "end":
346
335
  return _context3.stop();
347
336
  }
@@ -1161,16 +1150,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1161
1150
  var productData = _objectSpread(_objectSpread({}, origin), {}, {
1162
1151
  product_variant_id: product_variant_id
1163
1152
  });
1164
- debugger;
1165
- // 保护,如果进来的是 session 商品,则必须要有 date 和时间片,否则不允许添加
1166
- if (isSessionProduct(productData)) {
1167
- if (!date || !date.startTime || !date.endTime) {
1168
- return {
1169
- success: false,
1170
- errorCode: 'date_or_time_required'
1171
- };
1172
- }
1173
- }
1174
1153
 
1175
1154
  // 库存检测
1176
1155
  var currentCartItems = this.store.cart.getItems();
@@ -9,9 +9,3 @@ export declare const getAvailableProductResources: (products: ProductData[]) =>
9
9
  rules: any[];
10
10
  resourcesMap: Record<number, ProductResourceItem>;
11
11
  };
12
- /**
13
- * 判断商品是否是 session 商品
14
- * @param product 商品数据
15
- * @returns 是否是 session 商品
16
- */
17
- export declare const isSessionProduct: (product: ProductData) => boolean;
@@ -47,14 +47,4 @@ export var getAvailableProductResources = function getAvailableProductResources(
47
47
  rules: rules,
48
48
  resourcesMap: resourcesMap
49
49
  };
50
- };
51
-
52
- /**
53
- * 判断商品是否是 session 商品
54
- * @param product 商品数据
55
- * @returns 是否是 session 商品
56
- */
57
- export var isSessionProduct = function isSessionProduct(product) {
58
- var _product$scheduleIds, _product$scheduleIds2;
59
- return ((_product$scheduleIds = product === null || product === void 0 || (_product$scheduleIds2 = product['schedule.ids']) === null || _product$scheduleIds2 === void 0 ? void 0 : _product$scheduleIds2.length) !== null && _product$scheduleIds !== void 0 ? _product$scheduleIds : 0) > 0;
60
50
  };
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -396,66 +396,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
396
396
  return pre + (item.amount || 0);
397
397
  }, 0);
398
398
  };
399
- var formatProduct = function formatProduct(items) {
400
- return items.map(function (item) {
401
- var _item$is_charge_tax;
402
- return {
403
- product_id: item.product_id,
404
- product_variant_id: item.product_variant_id,
405
- quantity: item.num,
406
- // 商品是否含税:1;0
407
- is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
408
- // 若商品不含税,计算得到的税费,单位(元)
409
- tax_fee: item.tax_fee,
410
- // 整个商品折扣后的总金额
411
- selling_price: item.calculated_selling_price,
412
- // 使用者id
413
- holder_id: item.holder_id,
414
- // 整个商品折扣前的总金额
415
- original_price: item.calculated_original_price,
416
- // 主商品折扣前金额,不包含套餐子商品
417
- main_product_original_price: item.price,
418
- // 主商品折扣后金额,不包含套餐子商品
419
- main_product_selling_price: item.main_product_selling_price,
420
- metadata: {
421
- // 主商品+非原价(加减价)子商品税费
422
- "main_product_attached_bundle_tax_fee": item.metadata.main_product_attached_bundle_tax_fee,
423
- // 主商品+非原价(加减价)子商品附加费
424
- "main_product_attached_bundle_surcharge_fee": item.metadata.main_product_attached_bundle_surcharge_fee,
425
- // 可选,附加费均摊舍入金额
426
- "surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
427
- },
428
- product_bundle: item.product_bundle.map(function (bundle) {
429
- return {
430
- bundle_id: bundle.bundle_id,
431
- bundle_product_id: bundle.bundle_product_id,
432
- bundle_variant_id: bundle.bundle_variant_id,
433
- price_type: bundle.price_type,
434
- price_type_ext: bundle.price_type_ext,
435
- // 套餐子商品总价,不包含折扣金额
436
- bundle_sum_price: bundle.bundle_sum_price,
437
- // 套餐子商品折扣后金额
438
- bundle_selling_price: bundle.bundle_selling_price,
439
- num: bundle.num,
440
- is_charge_tax: bundle.is_charge_tax,
441
- tax_fee: bundle.tax_fee,
442
- metadata: {
443
- // 子商品单数量附加费
444
- "surcharge_fee": bundle.metadata.surcharge_fee,
445
- // 可选,附加费均摊舍入金额
446
- "surcharge_rounding_remainder": bundle.metadata.surcharge_rounding_remainder
447
- }
448
- };
449
- })
450
- };
451
- }) || [];
452
- };
453
- var productList = formatProduct(((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
454
- return _objectSpread(_objectSpread({}, item.product), {}, {
399
+ var productList = ((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
400
+ return {
401
+ product_id: item.product.product_id,
402
+ product_variant_id: item.product.product_variant_id,
403
+ quantity: item.product.num,
404
+ selling_price: item.product.calculated_selling_price,
455
405
  holder_id: _this3.getHolderIdFromBooking(item)
456
- });
457
- })) || []);
458
- var relationProducts = formatProduct(((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.relation_products) || []);
406
+ };
407
+ })) || [];
408
+ var relationProducts = ((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.relation_products) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.map(function (item) {
409
+ return {
410
+ product_id: item.product_id,
411
+ product_variant_id: item.product_variant_id,
412
+ quantity: item.num,
413
+ selling_price: item.source_product_price
414
+ };
415
+ })) || [];
459
416
  return [].concat(_toConsumableArray(productList), _toConsumableArray(relationProducts));
460
417
  }
461
418
  }, {
@@ -490,8 +447,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
490
447
  depositAmount: (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.deposit_amount,
491
448
  isDeposit: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.is_deposit
492
449
  },
493
- products: this.getProductListByOrder(),
494
- is_price_include_tax: this.otherParams.is_price_include_tax
450
+ products: this.getProductListByOrder()
495
451
  }, params); // 判断订单是否已经同步,如果是则追加payment_order_id参数
496
452
  if (this.store.isOrderSynced) {
497
453
  walletBusinessData.payment_order_id = (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.order_id;
@@ -1487,7 +1443,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1487
1443
  key: "addPaymentItemAsync",
1488
1444
  value: (function () {
1489
1445
  var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(paymentItem) {
1490
- var orderPaymentType, processedPaymentItem, metadata, paymentItemWithType, remainingAmount, _paymentItem$type, _paymentItem$code, isEftposPayment, _isCashPayment, isCustomePayment, syncResult;
1446
+ var orderPaymentType, processedPaymentItem, metadata, paymentItemWithType, remainingAmount, _paymentItem$type, _paymentItem$code, isEftposPayment, isCash, isCustomePayment, syncResult;
1491
1447
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1492
1448
  while (1) switch (_context16.prev = _context16.next) {
1493
1449
  case 0:
@@ -1537,7 +1493,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1537
1493
  this.logInfo('订单金额还有待付的,同步 EFTPOS 支付');
1538
1494
  // 检查是否是 EFTPOS 支付,如果是则立即同步订单
1539
1495
  isEftposPayment = ((_paymentItem$type = paymentItem.type) === null || _paymentItem$type === void 0 ? void 0 : _paymentItem$type.toLowerCase()) === 'eftpos' || ((_paymentItem$code = paymentItem.code) === null || _paymentItem$code === void 0 ? void 0 : _paymentItem$code.toUpperCase().includes('EFTPOS'));
1540
- _isCashPayment = paymentItem.code === 'CASHMANUAL';
1496
+ isCash = isCashPayment(paymentItem);
1541
1497
  isCustomePayment = paymentItem.type === 'custom';
1542
1498
  this.logInfo('EFTPOS 支付检查:', {
1543
1499
  paymentCode: paymentItem.code,
@@ -1545,7 +1501,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1545
1501
  isEftposPayment: isEftposPayment,
1546
1502
  currentOrderSynced: this.store.isOrderSynced
1547
1503
  });
1548
- if (!(isEftposPayment || _isCashPayment || isCustomePayment)) {
1504
+ if (!(isEftposPayment || isCash || isCustomePayment)) {
1549
1505
  _context16.next = 39;
1550
1506
  break;
1551
1507
  }
@@ -2658,7 +2614,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2658
2614
  while (1) switch (_context28.prev = _context28.next) {
2659
2615
  case 0:
2660
2616
  // 检查是否是现金支付
2661
- cashPayment = isCashPayment(paymentItem.code, paymentItem.type);
2617
+ cashPayment = isCashPayment(paymentItem);
2662
2618
  if (cashPayment) {
2663
2619
  _context28.next = 3;
2664
2620
  break;
@@ -1,5 +1,6 @@
1
1
  import { CheckoutInitParams, CheckoutError, CheckoutErrorType, LocalOrderData, CartSummaryItem, ExtractedAmountInfo } from '../types';
2
2
  import { CartItem } from '../../../modules/Cart/types';
3
+ import { PaymentItemInput } from '../../../modules/Payment/types';
3
4
  /**
4
5
  * 验证结账数据
5
6
  */
@@ -118,4 +119,4 @@ export declare function shouldSyncOrderForPayment(paymentCode: string, paymentTy
118
119
  * @param paymentType 支付方式类型
119
120
  * @returns 是否为现金支付
120
121
  */
121
- export declare function isCashPayment(paymentCode?: string, paymentType?: string): boolean;
122
+ export declare function isCashPayment(paymentItem: PaymentItemInput): boolean;
@@ -499,13 +499,15 @@ export function shouldSyncOrderForPayment(paymentCode, paymentType) {
499
499
  * @param paymentType 支付方式类型
500
500
  * @returns 是否为现金支付
501
501
  */
502
- export function isCashPayment(paymentCode, paymentType) {
503
- var codeUpper = (paymentCode === null || paymentCode === void 0 ? void 0 : paymentCode.toUpperCase()) || '';
504
- var typeUpper = (paymentType === null || paymentType === void 0 ? void 0 : paymentType.toUpperCase()) || '';
502
+ export function isCashPayment(paymentItem) {
503
+ var _paymentItem$code, _paymentItem$type, _paymentItem$name;
504
+ var codeUpper = ((_paymentItem$code = paymentItem.code) === null || _paymentItem$code === void 0 ? void 0 : _paymentItem$code.toUpperCase()) || '';
505
+ var typeUpper = ((_paymentItem$type = paymentItem.type) === null || _paymentItem$type === void 0 ? void 0 : _paymentItem$type.toUpperCase()) || '';
506
+ var isNameCash = (_paymentItem$name = paymentItem.name) === null || _paymentItem$name === void 0 ? void 0 : _paymentItem$name.toLowerCase().includes('cash');
505
507
 
506
508
  // 现金支付识别规则
507
509
  var cashIdentifiers = ['CASH', 'CASHMANUAL', 'MANUAL'];
508
510
  return cashIdentifiers.some(function (identifier) {
509
511
  return codeUpper.includes(identifier) || typeUpper.includes(identifier);
510
- });
512
+ }) || isNameCash;
511
513
  }
@@ -102,7 +102,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
102
102
  skip,
103
103
  num,
104
104
  sort_by: import_constants.SORT_BY,
105
- with: ["latestWalletDetail.wallet", "contactsInfo"],
105
+ with: ["latestWalletDetail.wallet"],
106
106
  search_wallet_flag: 1,
107
107
  search_wallet_pass_flag: 1,
108
108
  ...search && { search },
@@ -193,31 +193,33 @@ var OrderModule = class extends import_BaseModule.BaseModule {
193
193
  * @returns 后端返回的订单数据(包含订单ID等)
194
194
  */
195
195
  async createOrderByCheckout(params) {
196
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
197
+ const onlineStorePaymentCodeList = ["WXPAY", "WECHAT", "ALIPAY", "APPLE_PAY", "CREDIT_CARD_3DS", "CREDIT_CARD_TOKEN", "GOOGLE_PAY", "GOOGLE_PAY_3DS", "CREDIT_CARD"];
198
+ params.payments = (_a = params.payments) == null ? void 0 : _a.filter((p) => !onlineStorePaymentCodeList.includes(p.code));
197
199
  this.logInfo("createOrderByCheckout called", {
198
200
  type: params.type,
199
201
  platform: params.platform,
200
202
  is_deposit: params.is_deposit,
201
203
  customer_id: params.customer_id,
202
- bookingsCount: ((_a = params.bookings) == null ? void 0 : _a.length) || 0,
203
- relationProductsCount: ((_b = params.relation_products) == null ? void 0 : _b.length) || 0,
204
- paymentsCount: ((_c = params.payments) == null ? void 0 : _c.length) || 0,
204
+ bookingsCount: ((_b = params.bookings) == null ? void 0 : _b.length) || 0,
205
+ relationProductsCount: ((_c = params.relation_products) == null ? void 0 : _c.length) || 0,
206
+ paymentsCount: ((_d = params.payments) == null ? void 0 : _d.length) || 0,
205
207
  depositAmount: params.deposit_amount,
206
208
  productTaxFee: params.product_tax_fee,
207
209
  note: params.note,
208
210
  scheduleDate: params.schedule_date,
209
211
  hasOrderId: !!params.order_id,
210
212
  orderIdIncluded: params.order_id,
211
- paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
213
+ paymentMethods: ((_e = params.payments) == null ? void 0 : _e.map((p) => p.code)) || []
212
214
  });
213
215
  console.log("[Order] createOrderByCheckout 开始创建订单:", {
214
216
  type: params.type,
215
217
  platform: params.platform,
216
218
  is_deposit: params.is_deposit,
217
219
  customer_id: params.customer_id,
218
- bookingsCount: ((_e = params.bookings) == null ? void 0 : _e.length) || 0,
219
- relationProductsCount: ((_f = params.relation_products) == null ? void 0 : _f.length) || 0,
220
- paymentsCount: ((_g = params.payments) == null ? void 0 : _g.length) || 0
220
+ bookingsCount: ((_f = params.bookings) == null ? void 0 : _f.length) || 0,
221
+ relationProductsCount: ((_g = params.relation_products) == null ? void 0 : _g.length) || 0,
222
+ paymentsCount: ((_h = params.payments) == null ? void 0 : _h.length) || 0
221
223
  });
222
224
  try {
223
225
  const orderData = {
@@ -234,7 +236,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
234
236
  ...params
235
237
  // 使用传入的参数覆盖默认值
236
238
  };
237
- if ((_h = orderData.payments) == null ? void 0 : _h.length) {
239
+ if ((_i = orderData.payments) == null ? void 0 : _i.length) {
238
240
  orderData.small_ticket_data_flag = 1;
239
241
  }
240
242
  if (!params.order_id && !orderData.schedule_date) {
@@ -246,10 +248,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
246
248
  platform: orderData.platform,
247
249
  isDeposit: orderData.is_deposit,
248
250
  customerId: orderData.customer_id,
249
- bookingsCount: ((_i = orderData.bookings) == null ? void 0 : _i.length) || 0,
250
- relationProductsCount: ((_j = orderData.relation_products) == null ? void 0 : _j.length) || 0,
251
- paymentsCount: ((_k = orderData.payments) == null ? void 0 : _k.length) || 0,
252
- paymentsMethods: ((_l = orderData.payments) == null ? void 0 : _l.map((p) => p.code)) || []
251
+ bookingsCount: ((_j = orderData.bookings) == null ? void 0 : _j.length) || 0,
252
+ relationProductsCount: ((_k = orderData.relation_products) == null ? void 0 : _k.length) || 0,
253
+ paymentsCount: ((_l = orderData.payments) == null ? void 0 : _l.length) || 0,
254
+ paymentsMethods: ((_m = orderData.payments) == null ? void 0 : _m.map((p) => p.code)) || []
253
255
  });
254
256
  this.logInfo("Calling backend checkout API", {
255
257
  url: "/order/checkout",
@@ -258,10 +260,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
258
260
  isDeposit: orderData.is_deposit,
259
261
  customerId: orderData.customer_id,
260
262
  depositAmount: orderData.deposit_amount,
261
- bookingsCount: ((_m = orderData.bookings) == null ? void 0 : _m.length) || 0,
262
- relationProductsCount: ((_n = orderData.relation_products) == null ? void 0 : _n.length) || 0,
263
- paymentsCount: ((_o = orderData.payments) == null ? void 0 : _o.length) || 0,
264
- paymentMethods: ((_p = orderData.payments) == null ? void 0 : _p.map((p) => ({
263
+ bookingsCount: ((_n = orderData.bookings) == null ? void 0 : _n.length) || 0,
264
+ relationProductsCount: ((_o = orderData.relation_products) == null ? void 0 : _o.length) || 0,
265
+ paymentsCount: ((_p = orderData.payments) == null ? void 0 : _p.length) || 0,
266
+ paymentMethods: ((_q = orderData.payments) == null ? void 0 : _q.map((p) => ({
265
267
  code: p.code,
266
268
  amount: p.amount,
267
269
  type: p.type,
@@ -280,7 +282,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
280
282
  });
281
283
  console.log("[Order] 订单创建成功,后端响应:", {
282
284
  success: !!response,
283
- hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
285
+ hasOrderId: !!(((_r = response == null ? void 0 : response.data) == null ? void 0 : _r.order_id) || (response == null ? void 0 : response.order_id))
284
286
  });
285
287
  return response;
286
288
  } catch (error) {