@pisell/pisellos 2.2.60 → 2.2.61

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.
@@ -332,7 +332,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
332
332
  // 1. 筛选 status === 1 && disable === 0的数据
333
333
  // 2. 检查列表里是否有 code=WALLET_PASS的数据,如果没有,则列表里如果有 PRODUCTVOUCHER 、 GIFTCARD 、 POINTCARD 则删除他们
334
334
  // 如果有 code = WALLET_PASS的数据,则列表里PRODUCTVOUCHER 、 GIFTCARD 、 POINTCARD 的channel_application 指向 WALLET_PASS 的 channel_application
335
- payMethods.filter(function (method) {
335
+ payMethods = payMethods.filter(function (method) {
336
336
  return method.status === 1 && method.disable === 0;
337
337
  });
338
338
  walletPassMethod = payMethods.find(function (method) {
@@ -442,8 +442,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
442
442
  return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsLoaded"), payMethods);
443
443
  case 46:
444
444
  this.logInfo('getPayMethodListAsync completed successfully', {
445
- methodCount: payMethods.length,
446
- hasCache: cachedMethods.length > 0
445
+ payMethods: payMethods
447
446
  });
448
447
  return _context4.abrupt("return", payMethods);
449
448
  case 50:
@@ -2014,9 +2013,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2014
2013
  // 计算有效支付金额:支付金额 + 抹零金额的绝对值
2015
2014
  // 当 rounding_amount 为负数时,表示抹掉的金额,按绝对值计算有效支付
2016
2015
  // 例如:amount=15, rounding_amount=-0.2,有效支付=15.2(抹掉0.2元零头)
2016
+ // 例2:amount=15,rounding_amount=0.2,有效支付 14.8
2017
2017
  var paymentAmount = new Decimal(payment.amount || 0);
2018
2018
  var roundingAmount = new Decimal(payment.rounding_amount || 0);
2019
- var effectiveAmount = paymentAmount.plus(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
2019
+ var effectiveAmount = paymentAmount.minus(roundingAmount);
2020
2020
  return sum.plus(effectiveAmount);
2021
2021
  } catch (error) {
2022
2022
  console.warn("[PaymentModule] \u65E0\u6548\u7684\u652F\u4ED8\u91D1\u989D: amount=".concat(payment.amount, ", rounding_amount=").concat(payment.rounding_amount, "\uFF0C\u8DF3\u8FC7\u8BA1\u7B97"));
@@ -2044,7 +2044,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2044
2044
  code: p.code,
2045
2045
  amount: p.amount,
2046
2046
  rounding_amount: p.rounding_amount || '0.00',
2047
- effective_amount: new Decimal(p.amount || 0).plus(new Decimal(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || 0).abs()).toFixed(2)
2047
+ effective_amount: new Decimal(p.amount || 0).minus(new Decimal(p.rounding_amount || 0)).toFixed(2)
2048
2048
  };
2049
2049
  }),
2050
2050
  说明: '有效支付金额包含抹零计算(amount + |rounding_amount|)'
@@ -1579,8 +1579,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1579
1579
  quantity: 1,
1580
1580
  discount_list: updatedMainDiscountList,
1581
1581
  bundle: newBundleWithDiscount,
1582
- total: newTotalWithDiscount,
1583
- origin_total: newOriginTotalWithDiscount
1582
+ total: new Decimal(newTotalWithDiscount).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber(),
1583
+ origin_total: new Decimal(newOriginTotalWithDiscount).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber()
1584
1584
  })));
1585
1585
 
1586
1586
  // 第二个:包含原始bundle (qty=原quantity-1)
@@ -1642,6 +1642,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1642
1642
  return accumulator.add(currentPrice.mul(currentNum));
1643
1643
  }, new Decimal(newTotalOriginal)).toNumber();
1644
1644
  }
1645
+ newTotalOriginal = new Decimal(newTotalOriginal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
1646
+ newOriginTotalOriginal = new Decimal(newOriginTotalOriginal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
1645
1647
 
1646
1648
  // 添加第二个主商品:qty=原quantity-1,包含原始bundle
1647
1649
  result.push(_this3.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
@@ -1746,6 +1748,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1746
1748
  return accumulator.add(currentPrice.mul(currentNum));
1747
1749
  }, new Decimal(newTotal)).toNumber();
1748
1750
  }
1751
+ newTotal = new Decimal(newTotal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
1752
+ newOriginTotal = new Decimal(newOriginTotal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
1749
1753
 
1750
1754
  // 生成最终的主商品
1751
1755
  result.push(_this3.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
@@ -0,0 +1,32 @@
1
+ import dayjs from "dayjs";
2
+ import { ScheduleItem } from "./types";
3
+ export declare const getDateIsInSchedule: (dateTime: string, scheduleList: ScheduleItem[]) => boolean;
4
+ export type ScheduleTimeSlot = {
5
+ /** 开始时间 HH:mm */
6
+ start_time: string;
7
+ /** 结束时间 HH:mm */
8
+ end_time: string;
9
+ /** 开始日期时间 YYYY-MM-DD HH:mm:ss */
10
+ start_at: dayjs.Dayjs;
11
+ /** 结束日期时间 YYYY-MM-DD HH:mm:ss */
12
+ end_at: dayjs.Dayjs;
13
+ };
14
+ /**
15
+ * 获取当前日期日程时间点
16
+ * @param date 日期 YYYY-MM-DD
17
+ * @param scheduleList 日程列表
18
+ * @returns 当前日期日程时间点 结构,数组 [{
19
+ *
20
+ * // HH:mm
21
+ * end_time: string,
22
+ * // HH:mm
23
+ * start_time: string,
24
+ * // 日期时间
25
+ * // YYYY-MM-DD HH:mm:ss
26
+ * end_at: Dayjs,
27
+ * // YYYY-MM-DD HH:mm:ss
28
+ * start_at: Dayjs,
29
+ *
30
+ * }]
31
+ */
32
+ export declare const getScheduleStartEndTimePoints: (date: string, scheduleList: ScheduleItem[]) => ScheduleTimeSlot[];