@pisell/pisellos 2.2.10 → 2.2.12

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.
@@ -154,7 +154,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
154
154
  skip: skip,
155
155
  num: num,
156
156
  sort_by: SORT_BY,
157
- with: ['latestWalletDetail.wallet', 'contactsInfo'],
157
+ with: ['latestWalletDetail.wallet'],
158
158
  search_wallet_flag: 1,
159
159
  search_wallet_pass_flag: 1
160
160
  }, search && {
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
22
22
  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); }
23
23
  import { BaseModule } from "../BaseModule";
24
- import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
24
+ import { PaymentStatus, PaymentHooks, PaymentMethodType, RoundingRule } from "./types";
25
25
  import { getUniqueId } from "../Cart/utils";
26
26
  import { CashPaymentImpl } from "./cash";
27
27
  import { EftposPaymentImpl } from "./eftpos";
@@ -1200,7 +1200,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1200
1200
  this.logInfo('更新订单支付项完成', {
1201
1201
  orderUuid: orderUuid
1202
1202
  });
1203
- this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
1203
+ this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
1204
1204
  orderUuid: orderUuid,
1205
1205
  payment: newPaymentItem
1206
1206
  });
@@ -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
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -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
  };
@@ -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;
@@ -751,7 +707,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
751
707
  key: "updateLocalOrderAsync",
752
708
  value: (function () {
753
709
  var _updateLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
754
- var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8;
710
+ var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8, _this$store$currentOr9, _this$store$currentOr10;
755
711
  var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment2, _existingOrder$paymen, _updated$payment, currentTime, formattedExistPayments, _isNeedDeposit, _updated, syncedPayments, _syncedAmount, _totalAmount, _remainingExpectAmount, _depositDiffAmount, totalAmount, activePayments, paidAmount, remaining, _isNeedDeposit2, updated, syncedAmount, remainingExpectAmount, depositDiffAmount, isNeedDeposit, created, _syncedPayments, _syncedAmount2;
756
712
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
757
713
  while (1) switch (_context10.prev = _context10.next) {
@@ -1003,7 +959,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1003
959
  this.store.currentOrder = created;
1004
960
 
1005
961
  // 🔧 新增: 如果有云端支付项,需要计算正确的待付金额
1006
- if (params.existPayment && params.existPayment.length > 0) {
962
+ if (params.existPayment && params.existPayment.length > 0 || (_this$store$currentOr9 = this.store.currentOrder) !== null && _this$store$currentOr9 !== void 0 && _this$store$currentOr9.order_id && !isVirtualOrderId((_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.order_id)) {
1007
963
  // 标记订单已同步(因为订单和支付项都来自云端)
1008
964
  this.store.isOrderSynced = true;
1009
965
 
@@ -1117,8 +1073,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1117
1073
  }, {
1118
1074
  key: "getOrderOriginalData",
1119
1075
  value: function getOrderOriginalData() {
1120
- var _this$store$currentOr9;
1121
- return (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.order_info;
1076
+ var _this$store$currentOr11;
1077
+ return (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.order_info;
1122
1078
  }
1123
1079
 
1124
1080
  /**
@@ -1967,7 +1923,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1967
1923
  key: "setDepositAmountAsync",
1968
1924
  value: (function () {
1969
1925
  var _setDepositAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(depositAmount) {
1970
- var _this$store$currentOr10, _this$store$currentOr11;
1926
+ var _this$store$currentOr12, _this$store$currentOr13;
1971
1927
  var depositValue, formattedDepositAmount, oldDepositAmount, updateParams;
1972
1928
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1973
1929
  while (1) switch (_context20.prev = _context20.next) {
@@ -1975,8 +1931,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1975
1931
  this.logInfo('setDepositAmountAsync called', {
1976
1932
  depositAmount: depositAmount,
1977
1933
  hasCurrentOrder: !!this.store.currentOrder,
1978
- currentOrderId: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.order_id,
1979
- currentTotalAmount: (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.total_amount
1934
+ currentOrderId: (_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.order_id,
1935
+ currentTotalAmount: (_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.total_amount
1980
1936
  });
1981
1937
  _context20.prev = 1;
1982
1938
  // 验证定金金额格式
@@ -2096,17 +2052,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2096
2052
  key: "manualSyncOrderAsync",
2097
2053
  value: (function () {
2098
2054
  var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2099
- var _this$store$currentOr12, _this$store$currentOr13, _this$store$currentOr14;
2100
- var _this$store$currentOr15, orderUuid, oldOrderId, syncResult, finalOrderId, finalIsVirtual, newRes, _this$store$currentOr16, errorMessage;
2055
+ var _this$store$currentOr14, _this$store$currentOr15, _this$store$currentOr16;
2056
+ var _this$store$currentOr17, orderUuid, oldOrderId, syncResult, finalOrderId, finalIsVirtual, newRes, _this$store$currentOr18, errorMessage;
2101
2057
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2102
2058
  while (1) switch (_context21.prev = _context21.next) {
2103
2059
  case 0:
2104
2060
  console.log('manualSyncOrderAsync called');
2105
2061
  this.logInfo('manualSyncOrderAsync called', {
2106
2062
  hasCurrentOrder: !!this.store.currentOrder,
2107
- currentOrderId: (_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.order_id,
2108
- orderUuid: (_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.uuid,
2109
- totalAmount: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.total_amount,
2063
+ currentOrderId: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.order_id,
2064
+ orderUuid: (_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.uuid,
2065
+ totalAmount: (_this$store$currentOr16 = this.store.currentOrder) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.total_amount,
2110
2066
  isOrderSynced: this.store.isOrderSynced,
2111
2067
  isVirtualOrderId: this.store.currentOrder ? isVirtualOrderId(this.store.currentOrder.order_id) : false
2112
2068
  });
@@ -2166,7 +2122,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2166
2122
  this.logError('[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!');
2167
2123
  }
2168
2124
  newRes = _objectSpread(_objectSpread({}, syncResult), {}, {
2169
- is_deposit: ((_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.is_deposit) || 0
2125
+ is_deposit: ((_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.is_deposit) || 0
2170
2126
  });
2171
2127
  _context21.next = 30;
2172
2128
  return this.updateStateAmountToRemaining(false);
@@ -2180,7 +2136,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2180
2136
  return _context21.abrupt("return", {
2181
2137
  success: false,
2182
2138
  message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
2183
- orderUuid: (_this$store$currentOr16 = this.store.currentOrder) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.uuid
2139
+ orderUuid: (_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.uuid
2184
2140
  });
2185
2141
  case 38:
2186
2142
  case "end":
@@ -2257,15 +2213,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2257
2213
  key: "cancelCurrentOrderAsync",
2258
2214
  value: (function () {
2259
2215
  var _cancelCurrentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(cancelReason) {
2260
- var _this$store$currentOr17, _this$store$currentOr18, currentOrderUuid, currentOrderId, isOrderSynced, errorMessage;
2216
+ var _this$store$currentOr19, _this$store$currentOr20, currentOrderUuid, currentOrderId, isOrderSynced, errorMessage;
2261
2217
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2262
2218
  while (1) switch (_context22.prev = _context22.next) {
2263
2219
  case 0:
2264
2220
  _context22.prev = 0;
2265
2221
  this.logInfo('开始取消当前本地订单:', {
2266
2222
  hasCurrentOrder: !!this.store.currentOrder,
2267
- orderUuid: (_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.uuid,
2268
- orderId: (_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.order_id,
2223
+ orderUuid: (_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.uuid,
2224
+ orderId: (_this$store$currentOr20 = this.store.currentOrder) === null || _this$store$currentOr20 === void 0 ? void 0 : _this$store$currentOr20.order_id,
2269
2225
  isOrderSynced: this.store.isOrderSynced,
2270
2226
  cancelReason: cancelReason
2271
2227
  });
@@ -2376,7 +2332,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2376
2332
  key: "saveForLaterPaymentAsync",
2377
2333
  value: (function () {
2378
2334
  var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2379
- var orderUuid, currentOrderId, allPaymentItems, syncResult, _this$store$currentOr19, errorMessage;
2335
+ var orderUuid, currentOrderId, allPaymentItems, syncResult, _this$store$currentOr21, errorMessage;
2380
2336
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2381
2337
  while (1) switch (_context23.prev = _context23.next) {
2382
2338
  case 0:
@@ -2430,7 +2386,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2430
2386
  return _context23.abrupt("return", {
2431
2387
  success: false,
2432
2388
  message: "\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ".concat(errorMessage),
2433
- orderUuid: (_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.uuid
2389
+ orderUuid: (_this$store$currentOr21 = this.store.currentOrder) === null || _this$store$currentOr21 === void 0 ? void 0 : _this$store$currentOr21.uuid
2434
2390
  });
2435
2391
  case 21:
2436
2392
  case "end":
@@ -2453,7 +2409,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2453
2409
  key: "updateOrderNoteAsync",
2454
2410
  value: (function () {
2455
2411
  var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(note) {
2456
- var _this$store$currentOr20, _this$store$currentOr21, oldNote, orderInPayment;
2412
+ var _this$store$currentOr22, _this$store$currentOr23, oldNote, orderInPayment;
2457
2413
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2458
2414
  while (1) switch (_context24.prev = _context24.next) {
2459
2415
  case 0:
@@ -2465,7 +2421,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2465
2421
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
2466
2422
  case 3:
2467
2423
  console.log('[Checkout] 更新订单备注:', {
2468
- orderUuid: (_this$store$currentOr20 = this.store.currentOrder) === null || _this$store$currentOr20 === void 0 ? void 0 : _this$store$currentOr20.uuid,
2424
+ orderUuid: (_this$store$currentOr22 = this.store.currentOrder) === null || _this$store$currentOr22 === void 0 ? void 0 : _this$store$currentOr22.uuid,
2469
2425
  oldNote: this.store.localOrderData.shop_note,
2470
2426
  newNote: note
2471
2427
  });
@@ -2498,7 +2454,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2498
2454
  case 17:
2499
2455
  _context24.next = 19;
2500
2456
  return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
2501
- orderUuid: (_this$store$currentOr21 = this.store.currentOrder) === null || _this$store$currentOr21 === void 0 ? void 0 : _this$store$currentOr21.uuid,
2457
+ orderUuid: (_this$store$currentOr23 = this.store.currentOrder) === null || _this$store$currentOr23 === void 0 ? void 0 : _this$store$currentOr23.uuid,
2502
2458
  oldNote: oldNote,
2503
2459
  newNote: note,
2504
2460
  timestamp: Date.now()
@@ -2570,7 +2526,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2570
2526
  key: "handlePaymentSuccess",
2571
2527
  value: (function () {
2572
2528
  var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
2573
- var _this$store$currentOr22;
2529
+ var _this$store$currentOr24;
2574
2530
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2575
2531
  while (1) switch (_context26.prev = _context26.next) {
2576
2532
  case 0:
@@ -2581,7 +2537,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2581
2537
  return this.core.effects.emit("".concat(this.name, ":onPaymentSuccess"), {
2582
2538
  orderUuid: data.orderUuid,
2583
2539
  paymentMethodCode: '',
2584
- amount: ((_this$store$currentOr22 = this.store.currentOrder) === null || _this$store$currentOr22 === void 0 ? void 0 : _this$store$currentOr22.total_amount) || '0',
2540
+ amount: ((_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.total_amount) || '0',
2585
2541
  timestamp: data.timestamp
2586
2542
  });
2587
2543
  case 4:
@@ -2606,7 +2562,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2606
2562
  key: "handlePaymentError",
2607
2563
  value: (function () {
2608
2564
  var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
2609
- var _this$store$currentOr23;
2565
+ var _this$store$currentOr25;
2610
2566
  var error;
2611
2567
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2612
2568
  while (1) switch (_context27.prev = _context27.next) {
@@ -2619,7 +2575,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2619
2575
  return this.core.effects.emit("".concat(this.name, ":onPaymentFailed"), {
2620
2576
  orderUuid: data.orderUuid,
2621
2577
  paymentMethodCode: '',
2622
- amount: ((_this$store$currentOr23 = this.store.currentOrder) === null || _this$store$currentOr23 === void 0 ? void 0 : _this$store$currentOr23.total_amount) || '0',
2578
+ amount: ((_this$store$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.total_amount) || '0',
2623
2579
  timestamp: data.timestamp
2624
2580
  });
2625
2581
  case 5:
@@ -3742,10 +3698,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3742
3698
  value: (function () {
3743
3699
  var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3744
3700
  var _this6 = this,
3745
- _this$store$currentOr24,
3746
- _this$store$currentOr25,
3747
- _this$store$currentCu2,
3748
3701
  _this$store$currentOr26,
3702
+ _this$store$currentOr27,
3703
+ _this$store$currentCu2,
3704
+ _this$store$currentOr28,
3749
3705
  _this$store$localOrde,
3750
3706
  _this$store$localOrde2,
3751
3707
  _checkoutResponse3,
@@ -3827,7 +3783,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3827
3783
  })
3828
3784
  });
3829
3785
  }); // 确定最终的定金金额:优先使用手动设置的值,否则从支付项中计算
3830
- manualDepositAmount = ((_this$store$currentOr24 = this.store.currentOrder) === null || _this$store$currentOr24 === void 0 ? void 0 : _this$store$currentOr24.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
3786
+ manualDepositAmount = ((_this$store$currentOr26 = this.store.currentOrder) === null || _this$store$currentOr26 === void 0 ? void 0 : _this$store$currentOr26.deposit_amount) || '0.00'; // 优先级逻辑:手动设置的定金金额 > 从支付项计算的金额
3831
3787
  manualDepositValue = new Decimal(manualDepositAmount);
3832
3788
  if (manualDepositValue.gt(0)) {
3833
3789
  // 如果手动设置了定金金额且大于0,使用手动设置的值
@@ -3887,7 +3843,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3887
3843
  }),
3888
3844
  manualDepositAmount: manualDepositAmount,
3889
3845
  finalDepositAmount: finalDepositAmount,
3890
- isDeposit: ((_this$store$currentOr25 = this.store.currentOrder) === null || _this$store$currentOr25 === void 0 ? void 0 : _this$store$currentOr25.is_deposit) || 0
3846
+ isDeposit: ((_this$store$currentOr27 = this.store.currentOrder) === null || _this$store$currentOr27 === void 0 ? void 0 : _this$store$currentOr27.is_deposit) || 0
3891
3847
  });
3892
3848
 
3893
3849
  // 构造订单参数,直接使用 localOrderData 中已处理好的数据
@@ -3909,7 +3865,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3909
3865
  currency_code: this.otherParams.currency_code,
3910
3866
  currency_symbol: this.otherParams.currency_symbol,
3911
3867
  currency_format: this.otherParams.currency_format,
3912
- is_deposit: ((_this$store$currentOr26 = this.store.currentOrder) !== null && _this$store$currentOr26 !== void 0 && _this$store$currentOr26.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
3868
+ is_deposit: ((_this$store$currentOr28 = this.store.currentOrder) !== null && _this$store$currentOr28 !== void 0 && _this$store$currentOr28.is_deposit || Number(finalDepositAmount) > 0 ? 1 : 0) || 0,
3913
3869
  deposit_amount: finalDepositAmount,
3914
3870
  // 使用最终确定的定金金额(手动设置优先)
3915
3871
  product_tax_fee: this.store.localOrderData.tax_fee,
@@ -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 },
@@ -623,7 +623,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
623
623
  this.logInfo("更新订单支付项完成", {
624
624
  orderUuid
625
625
  });
626
- this.core.effects.emit(`${this.name}:onPaymentAdded`, {
626
+ this.core.effects.emit(import_types.PaymentHooks.OnPaymentAdded, {
627
627
  orderUuid,
628
628
  payment: newPaymentItem
629
629
  });
@@ -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
  * 查询用户识别码列表请求参数
@@ -51,19 +51,10 @@ var WalletPassPaymentImpl = class {
51
51
  */
52
52
  generateWalletParams(businessData) {
53
53
  var _a, _b;
54
- const {
55
- customer_id,
56
- holder,
57
- amountInfo,
58
- products,
59
- order_wait_pay_amount,
60
- payment_order_id,
61
- is_price_include_tax
62
- } = businessData;
54
+ const { customer_id, holder, amountInfo, products, order_wait_pay_amount, payment_order_id } = businessData;
63
55
  const totalAmount = Number(amountInfo.totalAmount);
64
56
  const subTotal = Number(amountInfo.subTotal);
65
57
  const walletParams = {
66
- is_price_include_tax,
67
58
  sale_channel: "pos",
68
59
  customer_id: customer_id || 0,
69
60
  // 提供默认值,确保类型为 number
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -103,6 +103,13 @@ var ProductList = class extends import_BaseModule.BaseModule {
103
103
  { osServer: true }
104
104
  );
105
105
  const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
106
+ if (sortedList.length) {
107
+ sortedList.forEach((n) => {
108
+ if (n.is_eject !== 1 && n["schedule.ids"] && n["schedule.ids"].length) {
109
+ n.is_eject = 1;
110
+ }
111
+ });
112
+ }
106
113
  this.addProduct(sortedList);
107
114
  return sortedList;
108
115
  }
@@ -36,7 +36,6 @@ var import_BaseModule = require("../BaseModule");
36
36
  var import_utils = require("../../solution/ShopDiscount/utils");
37
37
  var import_utils2 = require("../Cart/utils");
38
38
  var import_decimal = __toESM(require("decimal.js"));
39
- var import_lodash_es = require("lodash-es");
40
39
  var import_dayjs = __toESM(require("dayjs"));
41
40
  var RulesModule = class extends import_BaseModule.BaseModule {
42
41
  constructor(name, version) {
@@ -297,7 +296,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
297
296
  const isLimitedProduct = (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
298
297
  const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.length) && ((_d = product == null ? void 0 : product.discount_list) == null ? void 0 : _d.every((discount2) => discount2.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount2.tag || discount2.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.metadata) == null ? void 0 : _f.custom_product_bundle_map_id));
299
298
  const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
300
- if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable) {
299
+ if (isAvailableProduct && isLimitedProduct && isBundleAvailable && timeLimit) {
301
300
  (_g = discountApplicability.get(discount.id)) == null ? void 0 : _g.push(product.id);
302
301
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
303
302
  const discountType = discount.tag || discount.type;
@@ -327,7 +326,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
327
326
  });
328
327
  const processedFlatItemsMap = /* @__PURE__ */ new Map();
329
328
  sortedFlattenedList.forEach((flatItem, index) => {
330
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
329
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
331
330
  let product, originProduct;
332
331
  if (flatItem.type === "main") {
333
332
  product = flatItem.product;
@@ -365,7 +364,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
365
364
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
366
365
  })) && (discount.tag || discount.type) === "good_pass")
367
366
  return false;
368
- if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
367
+ if ((Number(product.price) === 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
369
368
  var _a3;
370
369
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
371
370
  })) && (discount.tag || discount.type) !== "good_pass")
@@ -465,7 +464,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
465
464
  }
466
465
  }
467
466
  }
468
- if (applicableDiscounts.length === 0 || isManualDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
467
+ if ((options == null ? void 0 : options.selectedList) && ((_t = product.discount_list) == null ? void 0 : _t.some((item) => {
468
+ var _a2;
469
+ return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
470
+ var _a3;
471
+ return n.discountId === ((_a3 = item.discount) == null ? void 0 : _a3.resource_id);
472
+ });
473
+ }))) {
474
+ isManualDiscount = false;
475
+ }
476
+ if (applicableDiscounts.length === 0 || isManualDiscount) {
469
477
  if (flatItem.type === "main") {
470
478
  if (product.isClient) {
471
479
  processedProductsMap.set(
@@ -497,10 +505,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
497
505
  processedProductsMap.set(
498
506
  product._id,
499
507
  [this.hooks.setProduct(originProduct, {
500
- ...isManualDiscount ? {
501
- price: product.price,
502
- main_product_selling_price: product.price
503
- } : {
508
+ ...isManualDiscount ? {} : {
504
509
  _id: product._id.split("___")[0] + "___" + index,
505
510
  total: product.origin_total || product.total,
506
511
  price: product.price,
@@ -514,7 +519,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
514
519
  processedFlatItemsMap.set(flatItem._id, [{
515
520
  ...flatItem,
516
521
  discount_list: [],
517
- price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
522
+ price: flatItem.bundleItem.original_price,
518
523
  processed: true
519
524
  }]);
520
525
  }
@@ -541,10 +546,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
541
546
  usedDiscounts.set(selectedDiscount2.id, true);
542
547
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
543
548
  let productOriginTotal = product.origin_total || product.total || 0;
544
- if (((_t = product.discount_list) == null ? void 0 : _t.length) && product.origin_total) {
549
+ if (((_u = product.discount_list) == null ? void 0 : _u.length) && product.origin_total) {
545
550
  productOriginTotal = product.origin_total;
546
551
  }
547
- if (Number(((_u = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _u.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
552
+ if (Number(((_v = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _v.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
548
553
  productOriginTotal = product.total;
549
554
  }
550
555
  const targetProductTotal = (0, import_utils.getDiscountAmount)(selectedDiscount2, product.price, product.price);
@@ -555,7 +560,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
555
560
  amount,
556
561
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
557
562
  discount: {
558
- discount_card_type: (_v = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _v.discount_card_type,
563
+ discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
559
564
  fixed_amount: amount,
560
565
  resource_id: selectedDiscount2.id,
561
566
  title: selectedDiscount2.format_title,
@@ -677,7 +682,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
677
682
  amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber() * (product.num || 1),
678
683
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
679
684
  discount: {
680
- discount_card_type: (_w = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _w.discount_card_type,
685
+ discount_card_type: (_x = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _x.discount_card_type,
681
686
  fixed_amount: new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber(),
682
687
  resource_id: selectedDiscount2.id,
683
688
  title: selectedDiscount2.format_title,
@@ -690,7 +695,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
690
695
  custom_product_bundle_map_id: uniqueId,
691
696
  num: product.num || 1
692
697
  },
693
- _num: (product.num || 1) * (((_x = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _x.num) || 1)
698
+ _num: (product.num || 1) * (((_y = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _y.num) || 1)
694
699
  };
695
700
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
696
701
  appliedProducts.push(discountDetail);
@@ -854,16 +859,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
854
859
  const allDiscountAmount = (0, import_utils.getDiscountListAmountTotal)(mainDiscountList);
855
860
  newTotalWithDiscount = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalWithDiscount;
856
861
  newOriginTotalWithDiscount = mainProductData.origin_total ?? newOriginTotalWithDiscount;
857
- }
858
- if (newBundleWithDiscount.length > 0) {
859
- newBundleWithDiscount.forEach((item) => {
860
- newTotalWithDiscount += Number(item.price) * Number(item.num);
861
- });
862
- newBundleWithDiscount.forEach((item) => {
863
- var _a, _b, _c;
864
- const originalPrice = ((_c = (_b = (_a = item.discount_list) == null ? void 0 : _a[0]) == null ? void 0 : _b.discount) == null ? void 0 : _c.original_amount) || item.price;
865
- newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
866
- });
862
+ if (newBundleWithDiscount.length > 0) {
863
+ newBundleWithDiscount.forEach((item) => {
864
+ var _a, _b, _c;
865
+ newTotalWithDiscount += Number(item.price) * Number(item.num);
866
+ const originalPrice = ((_c = (_b = (_a = item.discount_list) == null ? void 0 : _a[0]) == null ? void 0 : _b.discount) == null ? void 0 : _c.original_amount) || item.price;
867
+ newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
868
+ });
869
+ }
867
870
  }
868
871
  if (product == null ? void 0 : product.options) {
869
872
  newTotalWithDiscount = product.options.reduce((accumulator, currentValue) => {
@@ -915,12 +918,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
915
918
  const allDiscountAmount = (0, import_utils.getDiscountListAmount)(mainDiscountListOriginal);
916
919
  newTotalOriginal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotalOriginal;
917
920
  newOriginTotalOriginal = mainProductData.origin_total ?? newOriginTotalOriginal;
918
- }
919
- if (newBundleOriginal.length > 0) {
920
- newBundleOriginal.forEach((item) => {
921
- newTotalOriginal += Number(item.price) * Number(item.num);
922
- newOriginTotalOriginal += Number(item.price) * Number(item.num);
923
- });
921
+ if (newBundleOriginal.length > 0) {
922
+ newBundleOriginal.forEach((item) => {
923
+ newTotalOriginal += Number(item.price) * Number(item.num);
924
+ newOriginTotalOriginal += Number(item.price) * Number(item.num);
925
+ });
926
+ }
924
927
  }
925
928
  if (product == null ? void 0 : product.options) {
926
929
  newTotalOriginal = product.options.reduce((accumulator, currentValue) => {
@@ -994,11 +997,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
994
997
  newOriginTotal = mainProductData.origin_total ?? newOriginTotal;
995
998
  }
996
999
  if (newBundle.length > 0) {
997
- newBundle.forEach((item) => {
998
- newTotal += Number(item.price) * Number(item.num);
999
- });
1000
1000
  newBundle.forEach((item) => {
1001
1001
  var _a2, _b2, _c2;
1002
+ newTotal += Number(item.price) * Number(item.num);
1002
1003
  const originalPrice = ((_c2 = (_b2 = (_a2 = item.discount_list) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.discount) == null ? void 0 : _c2.original_amount) || item.price;
1003
1004
  newOriginTotal += Number(originalPrice) * Number(item.num);
1004
1005
  });
@@ -1139,18 +1140,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1139
1140
  if (isBundleItem) {
1140
1141
  const priceType = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type;
1141
1142
  const priceTypeExt = (_d = flatItem.bundleItem) == null ? void 0 : _d.price_type_ext;
1142
- const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1143
- const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1144
- if (rules.length > 0) {
1145
- if (isOriginalPrice && rules.includes("original_price")) {
1146
- return true;
1147
- }
1148
- if (isMarkupPrice && rules.includes("markup_price")) {
1149
- return true;
1150
- }
1151
- return false;
1152
- }
1153
- return isOriginalPrice;
1143
+ return priceType === "markup" && priceTypeExt === "product_price";
1154
1144
  }
1155
1145
  return false;
1156
1146
  }
@@ -185,19 +185,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
185
185
  collection = [],
186
186
  schedule_date
187
187
  }) {
188
- const res = await this.store.products.loadProducts({
188
+ return this.store.products.loadProducts({
189
189
  category_ids,
190
190
  product_ids,
191
191
  collection,
192
192
  schedule_date,
193
193
  cacheId: this.cacheId
194
194
  });
195
- this.getAvailableDate({
196
- startDate: schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD"),
197
- endDate: schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD"),
198
- products: [...res]
199
- });
200
- return res;
201
195
  }
202
196
  /**
203
197
  * 通过 schedule 来读取商品,适用于 session 类商品
@@ -234,12 +228,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
234
228
  const allProductIds = [...newProductIds, ...otherProductsIds].filter(
235
229
  (n, index, self) => self.indexOf(n) === index
236
230
  );
237
- const res = await this.loadProducts({
231
+ return await this.loadProducts({
238
232
  product_ids: allProductIds,
239
233
  category_ids,
240
234
  schedule_date: date
241
235
  });
242
- return res;
243
236
  }
244
237
  /**
245
238
  * 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
@@ -606,12 +599,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
606
599
  quantity = 1
607
600
  } = product || {};
608
601
  const productData = { ...origin, product_variant_id };
609
- debugger;
610
- if ((0, import_products.isSessionProduct)(productData)) {
611
- if (!date || !date.startTime || !date.endTime) {
612
- return { success: false, errorCode: "date_or_time_required" };
613
- }
614
- }
615
602
  const currentCartItems = this.store.cart.getItems();
616
603
  const stockCheckResult = (0, import_stock.checkProductStock)({
617
604
  productData,
@@ -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;
@@ -19,8 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/solution/BookingByStep/utils/products.ts
20
20
  var products_exports = {};
21
21
  __export(products_exports, {
22
- getAvailableProductResources: () => getAvailableProductResources,
23
- isSessionProduct: () => isSessionProduct
22
+ getAvailableProductResources: () => getAvailableProductResources
24
23
  });
25
24
  module.exports = __toCommonJS(products_exports);
26
25
  var getAvailableProductResources = (products) => {
@@ -58,12 +57,7 @@ var getAvailableProductResources = (products) => {
58
57
  });
59
58
  return { resourceIds: [...new Set(resourceIds)], rules, resourcesMap };
60
59
  };
61
- var isSessionProduct = (product) => {
62
- var _a;
63
- return (((_a = product == null ? void 0 : product["schedule.ids"]) == null ? void 0 : _a.length) ?? 0) > 0;
64
- };
65
60
  // Annotate the CommonJS export names for ESM import in node:
66
61
  0 && (module.exports = {
67
- getAvailableProductResources,
68
- isSessionProduct
62
+ getAvailableProductResources
69
63
  });
@@ -216,70 +216,23 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
216
216
  return pre + (item.amount || 0);
217
217
  }, 0);
218
218
  };
219
- const formatProduct = (items) => {
220
- return items.map(
221
- (item) => ({
222
- product_id: item.product_id,
223
- product_variant_id: item.product_variant_id,
224
- quantity: item.num,
225
- // 商品是否含税:1;0
226
- is_charge_tax: item.is_charge_tax ?? 0,
227
- // 若商品不含税,计算得到的税费,单位(元)
228
- tax_fee: item.tax_fee,
229
- // 整个商品折扣后的总金额
230
- selling_price: item.calculated_selling_price,
231
- // 使用者id
232
- holder_id: item.holder_id,
233
- // 整个商品折扣前的总金额
234
- original_price: item.calculated_original_price,
235
- // 主商品折扣前金额,不包含套餐子商品
236
- main_product_original_price: item.price,
237
- // 主商品折扣后金额,不包含套餐子商品
238
- main_product_selling_price: item.main_product_selling_price,
239
- metadata: {
240
- // 主商品+非原价(加减价)子商品税费
241
- "main_product_attached_bundle_tax_fee": item.metadata.main_product_attached_bundle_tax_fee,
242
- // 主商品+非原价(加减价)子商品附加费
243
- "main_product_attached_bundle_surcharge_fee": item.metadata.main_product_attached_bundle_surcharge_fee,
244
- // 可选,附加费均摊舍入金额
245
- "surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
246
- },
247
- product_bundle: item.product_bundle.map((bundle) => {
248
- return {
249
- bundle_id: bundle.bundle_id,
250
- bundle_product_id: bundle.bundle_product_id,
251
- bundle_variant_id: bundle.bundle_variant_id,
252
- price_type: bundle.price_type,
253
- price_type_ext: bundle.price_type_ext,
254
- // 套餐子商品总价,不包含折扣金额
255
- bundle_sum_price: bundle.bundle_sum_price,
256
- // 套餐子商品折扣后金额
257
- bundle_selling_price: bundle.bundle_selling_price,
258
- num: bundle.num,
259
- is_charge_tax: bundle.is_charge_tax,
260
- tax_fee: bundle.tax_fee,
261
- metadata: {
262
- // 子商品单数量附加费
263
- "surcharge_fee": bundle.metadata.surcharge_fee,
264
- // 可选,附加费均摊舍入金额
265
- "surcharge_rounding_remainder": bundle.metadata.surcharge_rounding_remainder
266
- }
267
- };
268
- })
269
- })
270
- ) || [];
271
- };
272
- const productList = formatProduct(
273
- ((_c = (_b = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data) == null ? void 0 : _b.bookings) == null ? void 0 : _c.map(
274
- (item) => {
275
- return {
276
- ...item.product,
277
- holder_id: this.getHolderIdFromBooking(item)
278
- };
279
- }
280
- )) || []
281
- );
282
- const relationProducts = formatProduct(((_e = (_d = this.store.currentOrder.order_info) == null ? void 0 : _d.original_order_data) == null ? void 0 : _e.relation_products) || []);
219
+ const productList = ((_b = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data.bookings) == null ? void 0 : _b.map(
220
+ (item) => ({
221
+ product_id: item.product.product_id,
222
+ product_variant_id: item.product.product_variant_id,
223
+ quantity: item.product.num,
224
+ selling_price: item.product.calculated_selling_price,
225
+ holder_id: this.getHolderIdFromBooking(item)
226
+ })
227
+ )) || [];
228
+ const relationProducts = ((_e = (_d = (_c = this.store.currentOrder.order_info) == null ? void 0 : _c.original_order_data) == null ? void 0 : _d.relation_products) == null ? void 0 : _e.map(
229
+ (item) => ({
230
+ product_id: item.product_id,
231
+ product_variant_id: item.product_variant_id,
232
+ quantity: item.num,
233
+ selling_price: item.source_product_price
234
+ })
235
+ )) || [];
283
236
  return [...productList, ...relationProducts];
284
237
  }
285
238
  async initWalletData(params) {
@@ -304,8 +257,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
304
257
  isDeposit: (_h = this.store.currentOrder) == null ? void 0 : _h.is_deposit
305
258
  },
306
259
  products: this.getProductListByOrder(),
307
- is_price_include_tax: this.otherParams.is_price_include_tax,
308
- // core 有
309
260
  ...params
310
261
  };
311
262
  if (this.store.isOrderSynced) {
@@ -502,7 +453,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
502
453
  * 会覆盖 order_info 与金额等字段,并重新计算待付金额,最后设置为 currentOrder。
503
454
  */
504
455
  async updateLocalOrderAsync(params) {
505
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
456
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
506
457
  this.logInfo("updateLocalOrderAsync called", {
507
458
  orderId: params.orderId,
508
459
  orderDataType: (_a = params.orderData) == null ? void 0 : _a.type,
@@ -709,7 +660,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
709
660
  }
710
661
  });
711
662
  this.store.currentOrder = created;
712
- if (params.existPayment && params.existPayment.length > 0) {
663
+ if (params.existPayment && params.existPayment.length > 0 || ((_p = this.store.currentOrder) == null ? void 0 : _p.order_id) && !(0, import_utils.isVirtualOrderId)((_q = this.store.currentOrder) == null ? void 0 : _q.order_id)) {
713
664
  this.store.isOrderSynced = true;
714
665
  const syncedPayments = created.payment.filter((p) => p.isSynced && p.status !== "voided");
715
666
  const syncedAmount = syncedPayments.reduce((sum, p) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.10",
4
+ "version": "2.2.12",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -69,4 +69,4 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  }
72
- }
72
+ }