@pisell/pisellos 2.2.57 → 2.2.59

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.
@@ -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, "num" | "skip">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -1909,7 +1909,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1909
1909
  case 41:
1910
1910
  _context18.prev = 41;
1911
1911
  _context18.t0 = _context18["catch"](0);
1912
- this.logError('[Checkout] 批量更新代金券支付项失败:', _context18.t0);
1912
+ this.logInfo('[Checkout] 批量更新代金券支付项失败:', {
1913
+ error: _context18.t0
1914
+ });
1913
1915
  _context18.next = 46;
1914
1916
  return this.handleError(_context18.t0, CheckoutErrorType.PaymentFailed);
1915
1917
  case 46:
@@ -3128,13 +3130,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3128
3130
  return payment.status !== 'voided';
3129
3131
  }) // 只计算未撤销的支付项
3130
3132
  .reduce(function (sum, payment) {
3131
- var amount = new Decimal(payment.amount || '0');
3132
- var roundingAmount = new Decimal(payment.rounding_amount || '0');
3133
-
3134
- // 使用 Decimal.js 计算实际支付有效金额:
3135
- // rounding_amount 为负数时,表示抹掉的金额,应该按绝对值加到实际支付中
3136
- // 例如:amount=15, rounding_amount=-0.2,实际相当于支付了15.2(抹掉了0.2元的零头)
3137
- var effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
3133
+ // const amount = new Decimal(payment.amount || '0');
3134
+ // 计算有效支付金额:支付金额 + 抹零金额的绝对值
3135
+ // 当 rounding_amount 为负数时,表示抹掉的金额,按绝对值计算有效支付
3136
+ // 例如:amount=15, rounding_amount=-0.2,有效支付=15.2(抹掉0.2元零头)
3137
+ // 例2:amount=15,rounding_amount=0.2,有效支付 14.8
3138
+ var paymentAmount = new Decimal(payment.amount || 0);
3139
+ var roundingAmount = new Decimal(payment.rounding_amount || 0);
3140
+ var effectiveAmount = paymentAmount.minus(roundingAmount);
3138
3141
  return sum.add(effectiveAmount);
3139
3142
  }, new Decimal(0));
3140
3143
  return paidAmount.toFixed(2);
@@ -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, "num" | "skip">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -1289,7 +1289,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1289
1289
  });
1290
1290
  this.logInfo("代金券支付项批量更新成功");
1291
1291
  } catch (error) {
1292
- this.logError("[Checkout] 批量更新代金券支付项失败:", error);
1292
+ this.logInfo("[Checkout] 批量更新代金券支付项失败:", { error });
1293
1293
  await this.handleError(error, import_types.CheckoutErrorType.PaymentFailed);
1294
1294
  throw error;
1295
1295
  }
@@ -2029,9 +2029,9 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2029
2029
  */
2030
2030
  calculatePaidAmountFromItems(payments) {
2031
2031
  const paidAmount = payments.filter((payment) => payment.status !== "voided").reduce((sum, payment) => {
2032
- const amount = new import_decimal.default(payment.amount || "0");
2033
- const roundingAmount = new import_decimal.default(payment.rounding_amount || "0");
2034
- const effectiveAmount = amount.add(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
2032
+ const paymentAmount = new import_decimal.default(payment.amount || 0);
2033
+ const roundingAmount = new import_decimal.default(payment.rounding_amount || 0);
2034
+ const effectiveAmount = paymentAmount.minus(roundingAmount);
2035
2035
  return sum.add(effectiveAmount);
2036
2036
  }, new import_decimal.default(0));
2037
2037
  return paidAmount.toFixed(2);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.57",
4
+ "version": "2.2.59",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",