@pisell/pisellos 2.2.8 → 2.2.10
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.
- package/dist/modules/Cart/utils/cartProduct.js +41 -26
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Discount/index.d.ts +3 -0
- package/dist/modules/Discount/index.js +70 -37
- package/dist/modules/Discount/types.d.ts +16 -0
- package/dist/modules/Order/index.js +4 -1
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +9 -0
- package/dist/modules/Payment/cash.js +1 -1
- package/dist/modules/Payment/eftpos.js +1 -1
- package/dist/modules/Payment/index.js +101 -31
- package/dist/modules/Payment/types.d.ts +22 -2
- package/dist/modules/Payment/walletpass.js +8 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +8 -9
- package/dist/modules/Rules/index.d.ts +16 -2
- package/dist/modules/Rules/index.js +1102 -200
- package/dist/modules/Rules/types.d.ts +8 -1
- package/dist/solution/BookingByStep/index.js +30 -8
- package/dist/solution/BookingByStep/utils/products.d.ts +6 -0
- package/dist/solution/BookingByStep/utils/products.js +10 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +2 -0
- package/dist/solution/Checkout/index.js +277 -88
- package/dist/solution/Checkout/types.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +5 -0
- package/dist/solution/ShopDiscount/index.js +96 -24
- package/dist/solution/ShopDiscount/types.d.ts +9 -1
- package/dist/solution/ShopDiscount/utils.d.ts +55 -0
- package/dist/solution/ShopDiscount/utils.js +432 -3
- package/lib/modules/Cart/utils/cartProduct.js +35 -22
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Discount/index.d.ts +3 -0
- package/lib/modules/Discount/index.js +20 -5
- package/lib/modules/Discount/types.d.ts +16 -0
- package/lib/modules/Order/index.js +2 -0
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +11 -0
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +71 -11
- package/lib/modules/Payment/types.d.ts +22 -2
- package/lib/modules/Payment/walletpass.js +15 -4
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +0 -7
- package/lib/modules/Rules/index.d.ts +16 -2
- package/lib/modules/Rules/index.js +857 -184
- package/lib/modules/Rules/types.d.ts +8 -1
- package/lib/solution/BookingByStep/index.js +19 -2
- package/lib/solution/BookingByStep/utils/products.d.ts +6 -0
- package/lib/solution/BookingByStep/utils/products.js +8 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +2 -0
- package/lib/solution/Checkout/index.js +185 -25
- package/lib/solution/Checkout/types.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +5 -0
- package/lib/solution/ShopDiscount/index.js +67 -13
- package/lib/solution/ShopDiscount/types.d.ts +9 -1
- package/lib/solution/ShopDiscount/utils.d.ts +55 -0
- package/lib/solution/ShopDiscount/utils.js +266 -3
- package/package.json +2 -2
|
@@ -43,6 +43,21 @@ function formatAmount(amount) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* 格式化日期时间为字符串
|
|
48
|
+
* 格式: YYYY-MM-DD HH:mm:ss
|
|
49
|
+
* 示例: 2025-12-10 16:14:50
|
|
50
|
+
*/
|
|
51
|
+
function formatDateTime(date) {
|
|
52
|
+
var year = date.getFullYear();
|
|
53
|
+
var month = String(date.getMonth() + 1).padStart(2, '0');
|
|
54
|
+
var day = String(date.getDate()).padStart(2, '0');
|
|
55
|
+
var hours = String(date.getHours()).padStart(2, '0');
|
|
56
|
+
var minutes = String(date.getMinutes()).padStart(2, '0');
|
|
57
|
+
var seconds = String(date.getSeconds()).padStart(2, '0');
|
|
58
|
+
return "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
59
|
+
}
|
|
60
|
+
|
|
46
61
|
/**
|
|
47
62
|
* 生成请求唯一ID
|
|
48
63
|
* 格式: 年月日时分秒毫秒+4位随机数
|
|
@@ -634,7 +649,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
634
649
|
case 0:
|
|
635
650
|
_context6.prev = 0;
|
|
636
651
|
_context6.next = 3;
|
|
637
|
-
return this.dbManager.get('order', orderUuid);
|
|
652
|
+
return this.dbManager.get('order', orderUuid, true);
|
|
638
653
|
case 3:
|
|
639
654
|
return _context6.abrupt("return", _context6.sent);
|
|
640
655
|
case 6:
|
|
@@ -662,7 +677,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
662
677
|
value: (function () {
|
|
663
678
|
var _createPaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
664
679
|
var _this3 = this;
|
|
665
|
-
var newOrder, dbAddStartTime, dbAddDuration;
|
|
680
|
+
var newOrder, currentTime, dbAddStartTime, dbAddDuration;
|
|
666
681
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
667
682
|
while (1) switch (_context7.prev = _context7.next) {
|
|
668
683
|
case 0:
|
|
@@ -720,11 +735,45 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
720
735
|
tax_fee: '0.00',
|
|
721
736
|
is_deposit: params.is_deposit || 0,
|
|
722
737
|
deposit_amount: params.deposit_amount || '0.00'
|
|
723
|
-
}; //
|
|
738
|
+
}; // 🔧 新增: 处理云端已存在的支付项
|
|
739
|
+
if (params.existPayment && params.existPayment.length > 0) {
|
|
740
|
+
currentTime = formatDateTime(new Date());
|
|
741
|
+
newOrder.payment = params.existPayment.map(function (payment) {
|
|
742
|
+
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
743
|
+
isSynced: true,
|
|
744
|
+
// 标记为已同步
|
|
745
|
+
status: payment.status || 'active',
|
|
746
|
+
// 如果云端支付项已有时间戳,则保留;否则使用当前时间
|
|
747
|
+
created_at: payment.created_at || currentTime,
|
|
748
|
+
updated_at: payment.updated_at || currentTime
|
|
749
|
+
});
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
// 重新计算待付金额
|
|
753
|
+
this.recalculateOrderAmount(newOrder);
|
|
754
|
+
this.logInfo('创建订单时包含云端支付项', {
|
|
755
|
+
orderId: params.order_id,
|
|
756
|
+
existPaymentCount: params.existPayment.length,
|
|
757
|
+
totalAmount: newOrder.total_amount,
|
|
758
|
+
expectAmount: newOrder.expect_amount,
|
|
759
|
+
paymentDetails: params.existPayment.map(function (p) {
|
|
760
|
+
return {
|
|
761
|
+
uuid: p.uuid,
|
|
762
|
+
code: p.code,
|
|
763
|
+
amount: p.amount,
|
|
764
|
+
status: p.status,
|
|
765
|
+
created_at: p.created_at,
|
|
766
|
+
updated_at: p.updated_at
|
|
767
|
+
};
|
|
768
|
+
})
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// 🚀 性能监控:记录数据库添加操作耗时
|
|
724
773
|
dbAddStartTime = Date.now();
|
|
725
|
-
_context7.next =
|
|
726
|
-
return this.dbManager.add('order', newOrder);
|
|
727
|
-
case
|
|
774
|
+
_context7.next = 7;
|
|
775
|
+
return this.dbManager.add('order', newOrder, true);
|
|
776
|
+
case 7:
|
|
728
777
|
dbAddDuration = Date.now() - dbAddStartTime;
|
|
729
778
|
this.logInfo('Database add operation completed', {
|
|
730
779
|
operation: 'dbManager.add',
|
|
@@ -738,19 +787,19 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
738
787
|
_this3.core.effects.emit("".concat(_this3.name, ":onOrderAdded"), newOrder);
|
|
739
788
|
}, 0);
|
|
740
789
|
return _context7.abrupt("return", newOrder);
|
|
741
|
-
case
|
|
742
|
-
_context7.prev =
|
|
790
|
+
case 13:
|
|
791
|
+
_context7.prev = 13;
|
|
743
792
|
_context7.t0 = _context7["catch"](1);
|
|
744
793
|
console.error('[PaymentModule] 创建支付订单失败', _context7.t0);
|
|
745
794
|
this.logError('createPaymentOrderAsync failed', _context7.t0, {
|
|
746
795
|
orderId: params.order_id
|
|
747
796
|
});
|
|
748
797
|
throw _context7.t0;
|
|
749
|
-
case
|
|
798
|
+
case 18:
|
|
750
799
|
case "end":
|
|
751
800
|
return _context7.stop();
|
|
752
801
|
}
|
|
753
|
-
}, _callee7, this, [[1,
|
|
802
|
+
}, _callee7, this, [[1, 13]]);
|
|
754
803
|
}));
|
|
755
804
|
function createPaymentOrderAsync(_x6) {
|
|
756
805
|
return _createPaymentOrderAsync.apply(this, arguments);
|
|
@@ -1054,7 +1103,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1054
1103
|
key: "addPaymentItemAsync",
|
|
1055
1104
|
value: (function () {
|
|
1056
1105
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderUuid, paymentItem) {
|
|
1057
|
-
var _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, newPaymentItem;
|
|
1106
|
+
var _paymentItem$metadata, _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, currentTime, newPaymentItem;
|
|
1058
1107
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1059
1108
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1060
1109
|
case 0:
|
|
@@ -1065,16 +1114,23 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1065
1114
|
orderPaymentType: paymentItem.order_payment_type
|
|
1066
1115
|
});
|
|
1067
1116
|
_context13.prev = 1;
|
|
1068
|
-
|
|
1117
|
+
this.logInfo('准备获取订单', {
|
|
1118
|
+
orderUuid: orderUuid
|
|
1119
|
+
});
|
|
1120
|
+
_context13.next = 5;
|
|
1069
1121
|
return this.getPaymentOrderByUuidAsync(orderUuid);
|
|
1070
|
-
case
|
|
1122
|
+
case 5:
|
|
1071
1123
|
order = _context13.sent;
|
|
1124
|
+
this.logInfo('获取订单信息成功', {
|
|
1125
|
+
orderUuid: orderUuid,
|
|
1126
|
+
order: order
|
|
1127
|
+
});
|
|
1072
1128
|
if (order) {
|
|
1073
|
-
_context13.next =
|
|
1129
|
+
_context13.next = 9;
|
|
1074
1130
|
break;
|
|
1075
1131
|
}
|
|
1076
1132
|
throw new Error("Order not found: ".concat(orderUuid));
|
|
1077
|
-
case
|
|
1133
|
+
case 9:
|
|
1078
1134
|
// 🔒 支付锁检查:如果订单待付金额已经为0,不允许继续添加支付项
|
|
1079
1135
|
expectAmount = new Decimal(order.expect_amount);
|
|
1080
1136
|
paidDepositAmount = order.payment.reduce(function (sum, payment) {
|
|
@@ -1085,7 +1141,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1085
1141
|
}, new Decimal(0));
|
|
1086
1142
|
expectedDepositAmount = new Decimal(order.deposit_amount || '0').sub(paidDepositAmount); // 有一种特殊情况,订单金额为 0,但是定金金额>0,且此时是定金状态的,允许添加支付项
|
|
1087
1143
|
if (!(expectAmount.lte(0) && expectedDepositAmount.eq(0))) {
|
|
1088
|
-
_context13.next =
|
|
1144
|
+
_context13.next = 17;
|
|
1089
1145
|
break;
|
|
1090
1146
|
}
|
|
1091
1147
|
warningMessage = "\u8BA2\u5355 ".concat(orderUuid, " \u5F85\u4ED8\u91D1\u989D\u5DF2\u4E3A0\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u65B0\u7684\u652F\u4ED8\u9879");
|
|
@@ -1102,11 +1158,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1102
1158
|
paymentItem: paymentItem
|
|
1103
1159
|
});
|
|
1104
1160
|
throw new Error(warningMessage);
|
|
1105
|
-
case
|
|
1106
|
-
|
|
1161
|
+
case 17:
|
|
1162
|
+
if ((_paymentItem$metadata = paymentItem.metadata) !== null && _paymentItem$metadata !== void 0 && _paymentItem$metadata.unique_payment_number) {
|
|
1163
|
+
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
1164
|
+
} else {
|
|
1165
|
+
paymentUuid = getUniqueId('payment_');
|
|
1166
|
+
}
|
|
1167
|
+
currentTime = formatDateTime(new Date());
|
|
1107
1168
|
newPaymentItem = {
|
|
1108
1169
|
uuid: paymentUuid,
|
|
1109
|
-
|
|
1170
|
+
custom_payment_id: paymentItem.custom_payment_id || 0,
|
|
1110
1171
|
name: paymentItem.name,
|
|
1111
1172
|
code: paymentItem.code,
|
|
1112
1173
|
type: paymentItem.type,
|
|
@@ -1118,6 +1179,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1118
1179
|
// 新支付项默认为活跃状态
|
|
1119
1180
|
order_payment_type: paymentItem.order_payment_type || 'normal',
|
|
1120
1181
|
// 默认为正常支付
|
|
1182
|
+
created_at: currentTime,
|
|
1183
|
+
// 创建时间
|
|
1184
|
+
updated_at: currentTime,
|
|
1185
|
+
// 更新时间
|
|
1121
1186
|
metadata: _objectSpread(_objectSpread({}, paymentItem.metadata), {}, {
|
|
1122
1187
|
// 保留传入的所有 metadata 字段
|
|
1123
1188
|
unique_payment_number: paymentUuid // 设置唯一支付号为支付项的 uuid
|
|
@@ -1125,15 +1190,20 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1125
1190
|
};
|
|
1126
1191
|
order.payment.push(newPaymentItem);
|
|
1127
1192
|
this.recalculateOrderAmount(order);
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1193
|
+
this.logInfo('开始更新订单支付项', {
|
|
1194
|
+
orderUuid: orderUuid,
|
|
1195
|
+
order: order
|
|
1196
|
+
});
|
|
1197
|
+
_context13.next = 25;
|
|
1198
|
+
return this.dbManager.update('order', order, true);
|
|
1199
|
+
case 25:
|
|
1200
|
+
this.logInfo('更新订单支付项完成', {
|
|
1201
|
+
orderUuid: orderUuid
|
|
1202
|
+
});
|
|
1203
|
+
this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
|
|
1133
1204
|
orderUuid: orderUuid,
|
|
1134
1205
|
payment: newPaymentItem
|
|
1135
1206
|
});
|
|
1136
|
-
case 23:
|
|
1137
1207
|
this.logInfo('addPaymentItemAsync completed successfully', {
|
|
1138
1208
|
orderUuid: orderUuid,
|
|
1139
1209
|
paymentUuid: newPaymentItem.uuid,
|
|
@@ -1147,10 +1217,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1147
1217
|
actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
|
|
1148
1218
|
changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
|
|
1149
1219
|
});
|
|
1150
|
-
_context13.next =
|
|
1220
|
+
_context13.next = 35;
|
|
1151
1221
|
break;
|
|
1152
|
-
case
|
|
1153
|
-
_context13.prev =
|
|
1222
|
+
case 30:
|
|
1223
|
+
_context13.prev = 30;
|
|
1154
1224
|
_context13.t0 = _context13["catch"](1);
|
|
1155
1225
|
console.error('[PaymentModule] 添加支付项失败', _context13.t0);
|
|
1156
1226
|
this.logError('addPaymentItemAsync failed', _context13.t0, {
|
|
@@ -1158,11 +1228,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1158
1228
|
paymentItem: paymentItem
|
|
1159
1229
|
});
|
|
1160
1230
|
throw _context13.t0;
|
|
1161
|
-
case
|
|
1231
|
+
case 35:
|
|
1162
1232
|
case "end":
|
|
1163
1233
|
return _context13.stop();
|
|
1164
1234
|
}
|
|
1165
|
-
}, _callee13, this, [[1,
|
|
1235
|
+
}, _callee13, this, [[1, 30]]);
|
|
1166
1236
|
}));
|
|
1167
1237
|
function addPaymentItemAsync(_x14, _x15) {
|
|
1168
1238
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -1624,7 +1694,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1624
1694
|
uuid: payment.uuid,
|
|
1625
1695
|
amount: payment.amount,
|
|
1626
1696
|
code: payment.code,
|
|
1627
|
-
|
|
1697
|
+
custom_payment_id: payment.custom_payment_id,
|
|
1628
1698
|
name: payment.name,
|
|
1629
1699
|
type: payment.type,
|
|
1630
1700
|
voucher_id: payment.voucher_id,
|
|
@@ -96,7 +96,7 @@ export interface PaymentItem {
|
|
|
96
96
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
97
97
|
code: string;
|
|
98
98
|
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
99
|
-
|
|
99
|
+
custom_payment_id: number;
|
|
100
100
|
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
101
101
|
name: string;
|
|
102
102
|
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -138,6 +138,10 @@ export interface PaymentItem {
|
|
|
138
138
|
statusCode?: number;
|
|
139
139
|
timestamp: number;
|
|
140
140
|
};
|
|
141
|
+
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
142
|
+
created_at?: string;
|
|
143
|
+
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
144
|
+
updated_at?: string;
|
|
141
145
|
}
|
|
142
146
|
/**
|
|
143
147
|
* 订单信息
|
|
@@ -200,6 +204,8 @@ export interface PushOrderParams {
|
|
|
200
204
|
deposit_amount?: string;
|
|
201
205
|
/** 原始订单数据(可选,由 Checkout 模块传入) */
|
|
202
206
|
order_info?: any;
|
|
207
|
+
/** 云端已存在的支付项(可选,用于处理订单在其他设备或云端生成的场景) */
|
|
208
|
+
existPayment?: PaymentItem[];
|
|
203
209
|
}
|
|
204
210
|
/**
|
|
205
211
|
* 更新订单参数
|
|
@@ -219,7 +225,7 @@ export interface PaymentItemInput {
|
|
|
219
225
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
220
226
|
code: string;
|
|
221
227
|
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
222
|
-
|
|
228
|
+
custom_payment_id: number;
|
|
223
229
|
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
224
230
|
name: string;
|
|
225
231
|
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -248,6 +254,10 @@ export interface PaymentItemInput {
|
|
|
248
254
|
/** 找零金额(现金支付时的找零金额) */
|
|
249
255
|
change_given_amount?: number;
|
|
250
256
|
};
|
|
257
|
+
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
258
|
+
created_at?: string;
|
|
259
|
+
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
260
|
+
updated_at?: string;
|
|
251
261
|
}
|
|
252
262
|
/**
|
|
253
263
|
* 推送支付项参数
|
|
@@ -598,6 +608,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
598
608
|
expect_columns?: string[];
|
|
599
609
|
/** 客户id */
|
|
600
610
|
customer_id?: number;
|
|
611
|
+
/** 客户holder_id */
|
|
612
|
+
holder_id?: number;
|
|
601
613
|
/** 订单总计金额 */
|
|
602
614
|
order_expect_amount: number;
|
|
603
615
|
/** 订单小计金额 */
|
|
@@ -616,6 +628,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
616
628
|
quantity: number;
|
|
617
629
|
/** 商品使用了所有优惠后的最终价格 */
|
|
618
630
|
selling_price: number;
|
|
631
|
+
/** 客户holder_id */
|
|
632
|
+
holder_id?: number;
|
|
619
633
|
}[];
|
|
620
634
|
/** 预备支付 */
|
|
621
635
|
prepare_payments?: {
|
|
@@ -633,6 +647,10 @@ export interface WalletDeductionRecommendParams {
|
|
|
633
647
|
export interface WalletInitBusinessData {
|
|
634
648
|
/** 客户ID(可选) */
|
|
635
649
|
customer_id?: number;
|
|
650
|
+
/** 客户 holder */
|
|
651
|
+
holder?: {
|
|
652
|
+
form_record: number[];
|
|
653
|
+
};
|
|
636
654
|
/** 金额信息 */
|
|
637
655
|
amountInfo: {
|
|
638
656
|
totalAmount: string;
|
|
@@ -648,10 +666,12 @@ export interface WalletInitBusinessData {
|
|
|
648
666
|
product_variant_id: string;
|
|
649
667
|
quantity: number;
|
|
650
668
|
selling_price: number;
|
|
669
|
+
holder_id?: number;
|
|
651
670
|
}[];
|
|
652
671
|
order_wait_pay_amount?: number;
|
|
653
672
|
/** 订单ID */
|
|
654
673
|
payment_order_id?: string;
|
|
674
|
+
is_price_include_tax: number;
|
|
655
675
|
}
|
|
656
676
|
/**
|
|
657
677
|
* 查询用户识别码列表请求参数
|
|
@@ -58,20 +58,24 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
58
58
|
}, {
|
|
59
59
|
key: "generateWalletParams",
|
|
60
60
|
value: function generateWalletParams(businessData) {
|
|
61
|
-
var _walletParams$product;
|
|
61
|
+
var _holder$form_record, _walletParams$product;
|
|
62
62
|
var customer_id = businessData.customer_id,
|
|
63
|
+
holder = businessData.holder,
|
|
63
64
|
amountInfo = businessData.amountInfo,
|
|
64
65
|
products = businessData.products,
|
|
65
66
|
order_wait_pay_amount = businessData.order_wait_pay_amount,
|
|
66
|
-
payment_order_id = businessData.payment_order_id
|
|
67
|
+
payment_order_id = businessData.payment_order_id,
|
|
68
|
+
is_price_include_tax = businessData.is_price_include_tax;
|
|
67
69
|
|
|
68
70
|
// 转换金额为数字类型
|
|
69
71
|
var totalAmount = Number(amountInfo.totalAmount);
|
|
70
72
|
var subTotal = Number(amountInfo.subTotal);
|
|
71
73
|
var walletParams = {
|
|
74
|
+
is_price_include_tax: is_price_include_tax,
|
|
72
75
|
sale_channel: 'pos',
|
|
73
76
|
customer_id: customer_id || 0,
|
|
74
77
|
// 提供默认值,确保类型为 number
|
|
78
|
+
holder_id: (holder === null || holder === void 0 || (_holder$form_record = holder.form_record) === null || _holder$form_record === void 0 ? void 0 : _holder$form_record[0]) || undefined,
|
|
75
79
|
order_expect_amount: totalAmount,
|
|
76
80
|
// 订单小计金额
|
|
77
81
|
order_product_amount: subTotal,
|
|
@@ -87,6 +91,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
87
91
|
this.walletParams = walletParams;
|
|
88
92
|
this.paymentModule.logInfo('[WalletPass] 钱包默认参数已生成并存储', {
|
|
89
93
|
customer_id: walletParams.customer_id,
|
|
94
|
+
holder_id: walletParams.holder_id,
|
|
90
95
|
order_expect_amount: walletParams.order_expect_amount,
|
|
91
96
|
order_product_amount: walletParams.order_product_amount,
|
|
92
97
|
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
@@ -563,7 +568,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
563
568
|
paymentItem = {
|
|
564
569
|
amount: amount.toString(),
|
|
565
570
|
code: walletMethod.code,
|
|
566
|
-
|
|
571
|
+
custom_payment_id: walletMethod.id,
|
|
567
572
|
name: walletMethod.name,
|
|
568
573
|
type: walletMethod.type,
|
|
569
574
|
voucher_id: voucherId || ''
|
|
@@ -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(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -140,17 +140,16 @@ 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
|
-
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
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
|
+
// }
|
|
151
150
|
this.addProduct(sortedList);
|
|
152
151
|
return _context3.abrupt("return", sortedList);
|
|
153
|
-
case
|
|
152
|
+
case 10:
|
|
154
153
|
case "end":
|
|
155
154
|
return _context3.stop();
|
|
156
155
|
}
|
|
@@ -12,24 +12,38 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
12
12
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
13
13
|
setRulesList(rulesList: Rules[]): Promise<void>;
|
|
14
14
|
getRulesList(): Rules[];
|
|
15
|
-
|
|
15
|
+
private checkHolderMatch;
|
|
16
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, }: {
|
|
16
17
|
oldDiscountList: Discount[];
|
|
17
18
|
newDiscountList: Discount[];
|
|
18
19
|
productList: any[];
|
|
20
|
+
holders: {
|
|
21
|
+
form_record_id: number;
|
|
22
|
+
}[];
|
|
19
23
|
}): {
|
|
20
24
|
isAvailable: boolean;
|
|
21
25
|
discountList: Discount[];
|
|
22
26
|
productList: any[];
|
|
23
27
|
};
|
|
24
|
-
calcDiscount({ discountList, productList, }: {
|
|
28
|
+
calcDiscount({ discountList, productList, holders, }: {
|
|
25
29
|
discountList: Discount[];
|
|
26
30
|
productList: any[];
|
|
31
|
+
holders: {
|
|
32
|
+
form_record_id: number;
|
|
33
|
+
}[];
|
|
27
34
|
}, options?: {
|
|
28
35
|
isSelected?: boolean;
|
|
29
36
|
discountId?: number;
|
|
30
37
|
selectedList?: SetDiscountSelectedParams[];
|
|
31
38
|
scan?: boolean;
|
|
32
39
|
}): DiscountResult;
|
|
40
|
+
/**
|
|
41
|
+
* 检查优惠是否符合 PackageSubItemUsageRules 配置
|
|
42
|
+
* @param discount 优惠券
|
|
43
|
+
* @param flatItem 扁平化后的商品项(可能是主商品或bundle子商品)
|
|
44
|
+
* @returns 是否可用
|
|
45
|
+
*/
|
|
46
|
+
private checkPackageSubItemUsageRules;
|
|
33
47
|
destroy(): Promise<void>;
|
|
34
48
|
clear(): Promise<void>;
|
|
35
49
|
}
|