@pisell/pisellos 2.1.25 → 2.1.27
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/index.d.ts +1 -0
- package/dist/modules/Cart/index.js +1 -0
- package/dist/modules/Order/index.js +8 -13
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/dist/modules/Payment/index.js +58 -36
- package/dist/modules/Payment/types.d.ts +21 -0
- package/dist/modules/Payment/walletpass.js +15 -9
- package/dist/modules/Rules/index.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +16 -1
- package/dist/solution/Checkout/index.js +1094 -758
- package/dist/solution/Checkout/types.d.ts +17 -0
- package/dist/solution/Checkout/types.js +4 -0
- package/dist/solution/ShopDiscount/index.d.ts +6 -1
- package/dist/solution/ShopDiscount/index.js +1 -0
- package/lib/modules/Cart/index.d.ts +1 -0
- package/lib/modules/Cart/index.js +4 -1
- package/lib/modules/Order/index.js +1 -4
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/index.js +22 -5
- package/lib/modules/Payment/types.d.ts +21 -0
- package/lib/modules/Payment/walletpass.js +14 -8
- package/lib/modules/Rules/index.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +16 -1
- package/lib/solution/Checkout/index.js +296 -53
- package/lib/solution/Checkout/types.d.ts +17 -0
- package/lib/solution/ShopDiscount/index.d.ts +6 -1
- package/lib/solution/ShopDiscount/index.js +1 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { CartItem, CartModuleAPI, ECartItemCheckType, ECartItemInfoType, IAddItemParams, IUpdateItemParams } from './types';
|
|
4
4
|
import { Account } from '../Account';
|
|
5
5
|
export * from './types';
|
|
6
|
+
export { getProductDeposit } from './utils';
|
|
6
7
|
/**
|
|
7
8
|
* 购物车模块实现
|
|
8
9
|
*/
|
|
@@ -29,6 +29,7 @@ import { createCartItemOrigin, deleteHolderFromCartItem, deleteRelationFormsFrom
|
|
|
29
29
|
import { cloneDeep } from 'lodash-es';
|
|
30
30
|
import { isNormalProduct } from "../Product/utils";
|
|
31
31
|
export * from "./types";
|
|
32
|
+
export { getProductDeposit } from "./utils";
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* 购物车模块实现
|
|
@@ -292,18 +292,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
292
292
|
bookings: [],
|
|
293
293
|
relation_products: [],
|
|
294
294
|
relation_forms: [],
|
|
295
|
-
payments: []
|
|
295
|
+
payments: [],
|
|
296
|
+
is_full_overwrite_flag: 1
|
|
296
297
|
}, params);
|
|
297
298
|
if ((_orderData$payments = orderData.payments) !== null && _orderData$payments !== void 0 && _orderData$payments.length) {
|
|
298
299
|
orderData.small_ticket_data_flag = 1;
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
// 如果进来的order_id 是真实的,则不需要再传递 bookings 和 relation_products
|
|
302
|
-
if (params.order_id) {
|
|
303
|
-
orderData.bookings = [];
|
|
304
|
-
orderData.relation_products = [];
|
|
305
|
-
}
|
|
306
|
-
|
|
307
302
|
// 兜底策略,如果是第一次下单,没有 order_id,且没有 schedule_date,则设置为当前时间
|
|
308
303
|
if (!params.order_id && !orderData.schedule_date) {
|
|
309
304
|
orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
@@ -350,9 +345,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
350
345
|
});
|
|
351
346
|
|
|
352
347
|
// 调用后端接口
|
|
353
|
-
_context3.next =
|
|
348
|
+
_context3.next = 10;
|
|
354
349
|
return this.request.post('/order/checkout', orderData);
|
|
355
|
-
case
|
|
350
|
+
case 10:
|
|
356
351
|
response = _context3.sent;
|
|
357
352
|
this.logInfo('Order API called successfully', {
|
|
358
353
|
response: response
|
|
@@ -362,19 +357,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
362
357
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
363
358
|
});
|
|
364
359
|
return _context3.abrupt("return", response);
|
|
365
|
-
case
|
|
366
|
-
_context3.prev =
|
|
360
|
+
case 16:
|
|
361
|
+
_context3.prev = 16;
|
|
367
362
|
_context3.t0 = _context3["catch"](2);
|
|
368
363
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
369
364
|
this.logInfo('Order API called failed', {
|
|
370
365
|
error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
371
366
|
});
|
|
372
367
|
throw _context3.t0;
|
|
373
|
-
case
|
|
368
|
+
case 21:
|
|
374
369
|
case "end":
|
|
375
370
|
return _context3.stop();
|
|
376
371
|
}
|
|
377
|
-
}, _callee3, this, [[2,
|
|
372
|
+
}, _callee3, this, [[2, 16]]);
|
|
378
373
|
}));
|
|
379
374
|
function createOrderByCheckout(_x4) {
|
|
380
375
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -19,7 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
*/
|
|
20
20
|
export var CURRENCY_DENOMINATIONS = {
|
|
21
21
|
// 美元
|
|
22
|
-
'USD': [100, 50, 20, 10, 5,
|
|
22
|
+
'USD': [100, 50, 20, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.01],
|
|
23
23
|
// 人民币
|
|
24
24
|
'CNY': [100, 50, 20, 10, 5, 1, 0.5, 0.1, 0.05, 0.01],
|
|
25
25
|
'RMB': [100, 50, 20, 10, 5, 1, 0.5, 0.1, 0.05, 0.01],
|
|
@@ -812,35 +812,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
812
812
|
case 3:
|
|
813
813
|
order = _context9.sent;
|
|
814
814
|
if (!order) {
|
|
815
|
-
_context9.next =
|
|
815
|
+
_context9.next = 13;
|
|
816
816
|
break;
|
|
817
817
|
}
|
|
818
818
|
updatedOrder = _objectSpread(_objectSpread({}, order), params);
|
|
819
|
-
|
|
819
|
+
this.recalculateOrderAmount(updatedOrder);
|
|
820
|
+
_context9.next = 9;
|
|
820
821
|
return this.dbManager.update('order', updatedOrder);
|
|
821
|
-
case
|
|
822
|
-
_context9.next =
|
|
822
|
+
case 9:
|
|
823
|
+
_context9.next = 11;
|
|
823
824
|
return this.core.effects.emit(PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
824
|
-
case
|
|
825
|
-
_context9.next =
|
|
825
|
+
case 11:
|
|
826
|
+
_context9.next = 13;
|
|
826
827
|
return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
|
|
827
828
|
action: 'update',
|
|
828
829
|
order: updatedOrder,
|
|
829
830
|
originalOrder: order
|
|
830
831
|
});
|
|
831
|
-
case
|
|
832
|
-
_context9.next =
|
|
832
|
+
case 13:
|
|
833
|
+
_context9.next = 19;
|
|
833
834
|
break;
|
|
834
|
-
case
|
|
835
|
-
_context9.prev =
|
|
835
|
+
case 15:
|
|
836
|
+
_context9.prev = 15;
|
|
836
837
|
_context9.t0 = _context9["catch"](0);
|
|
837
838
|
console.error('[PaymentModule] 更新订单失败', _context9.t0);
|
|
838
839
|
throw _context9.t0;
|
|
839
|
-
case
|
|
840
|
+
case 19:
|
|
840
841
|
case "end":
|
|
841
842
|
return _context9.stop();
|
|
842
843
|
}
|
|
843
|
-
}, _callee9, this, [[0,
|
|
844
|
+
}, _callee9, this, [[0, 15]]);
|
|
844
845
|
}));
|
|
845
846
|
function updateOrderAsync(_x8, _x9) {
|
|
846
847
|
return _updateOrderAsync.apply(this, arguments);
|
|
@@ -1043,7 +1044,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1043
1044
|
key: "addPaymentItemAsync",
|
|
1044
1045
|
value: (function () {
|
|
1045
1046
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderUuid, paymentItem) {
|
|
1046
|
-
var _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, warningMessage, paymentUuid, newPaymentItem;
|
|
1047
|
+
var _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, newPaymentItem;
|
|
1047
1048
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1048
1049
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1049
1050
|
case 0:
|
|
@@ -1066,8 +1067,15 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1066
1067
|
case 7:
|
|
1067
1068
|
// 🔒 支付锁检查:如果订单待付金额已经为0,不允许继续添加支付项
|
|
1068
1069
|
expectAmount = new Decimal(order.expect_amount);
|
|
1069
|
-
|
|
1070
|
-
|
|
1070
|
+
paidDepositAmount = order.payment.reduce(function (sum, payment) {
|
|
1071
|
+
if (payment.order_payment_type === 'deposit' && payment.status !== 'voided') {
|
|
1072
|
+
return sum.plus(new Decimal(payment.amount));
|
|
1073
|
+
}
|
|
1074
|
+
return sum;
|
|
1075
|
+
}, new Decimal(0));
|
|
1076
|
+
expectedDepositAmount = new Decimal(order.deposit_amount || '0').sub(paidDepositAmount); // 有一种特殊情况,订单金额为 0,但是定金金额>0,且此时是定金状态的,允许添加支付项
|
|
1077
|
+
if (!(expectAmount.lte(0) && expectedDepositAmount.eq(0))) {
|
|
1078
|
+
_context13.next = 15;
|
|
1071
1079
|
break;
|
|
1072
1080
|
}
|
|
1073
1081
|
warningMessage = "\u8BA2\u5355 ".concat(orderUuid, " \u5F85\u4ED8\u91D1\u989D\u5DF2\u4E3A0\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u65B0\u7684\u652F\u4ED8\u9879");
|
|
@@ -1084,7 +1092,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1084
1092
|
paymentItem: paymentItem
|
|
1085
1093
|
});
|
|
1086
1094
|
throw new Error(warningMessage);
|
|
1087
|
-
case
|
|
1095
|
+
case 15:
|
|
1088
1096
|
paymentUuid = getUniqueId('payment_');
|
|
1089
1097
|
newPaymentItem = {
|
|
1090
1098
|
uuid: paymentUuid,
|
|
@@ -1107,15 +1115,15 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1107
1115
|
};
|
|
1108
1116
|
order.payment.push(newPaymentItem);
|
|
1109
1117
|
this.recalculateOrderAmount(order);
|
|
1110
|
-
_context13.next = 19;
|
|
1111
|
-
return this.dbManager.update('order', order);
|
|
1112
|
-
case 19:
|
|
1113
1118
|
_context13.next = 21;
|
|
1119
|
+
return this.dbManager.update('order', order);
|
|
1120
|
+
case 21:
|
|
1121
|
+
_context13.next = 23;
|
|
1114
1122
|
return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
|
|
1115
1123
|
orderUuid: orderUuid,
|
|
1116
1124
|
payment: newPaymentItem
|
|
1117
1125
|
});
|
|
1118
|
-
case
|
|
1126
|
+
case 23:
|
|
1119
1127
|
this.logInfo('addPaymentItemAsync completed successfully', {
|
|
1120
1128
|
orderUuid: orderUuid,
|
|
1121
1129
|
paymentUuid: newPaymentItem.uuid,
|
|
@@ -1129,10 +1137,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1129
1137
|
actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
|
|
1130
1138
|
changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
|
|
1131
1139
|
});
|
|
1132
|
-
_context13.next =
|
|
1140
|
+
_context13.next = 31;
|
|
1133
1141
|
break;
|
|
1134
|
-
case
|
|
1135
|
-
_context13.prev =
|
|
1142
|
+
case 26:
|
|
1143
|
+
_context13.prev = 26;
|
|
1136
1144
|
_context13.t0 = _context13["catch"](1);
|
|
1137
1145
|
console.error('[PaymentModule] 添加支付项失败', _context13.t0);
|
|
1138
1146
|
this.logError('addPaymentItemAsync failed', _context13.t0, {
|
|
@@ -1140,11 +1148,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1140
1148
|
paymentItem: paymentItem
|
|
1141
1149
|
});
|
|
1142
1150
|
throw _context13.t0;
|
|
1143
|
-
case
|
|
1151
|
+
case 31:
|
|
1144
1152
|
case "end":
|
|
1145
1153
|
return _context13.stop();
|
|
1146
1154
|
}
|
|
1147
|
-
}, _callee13, this, [[1,
|
|
1155
|
+
}, _callee13, this, [[1, 26]]);
|
|
1148
1156
|
}));
|
|
1149
1157
|
function addPaymentItemAsync(_x14, _x15) {
|
|
1150
1158
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -1291,9 +1299,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1291
1299
|
}
|
|
1292
1300
|
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
|
|
1293
1301
|
case 7:
|
|
1294
|
-
// 1. 查找所有现有的代金券类支付项(带 voucher_id 且状态不是 voided
|
|
1302
|
+
// 1. 查找所有现有的代金券类支付项(带 voucher_id 且状态不是 voided)并且还没有同步给后端
|
|
1303
|
+
// 如果同步给了后端的voucher 不允许删除
|
|
1295
1304
|
existingVoucherItems = order.payment.filter(function (payment) {
|
|
1296
|
-
return payment.voucher_id && payment.status !== 'voided';
|
|
1305
|
+
return payment.voucher_id && payment.status !== 'voided' && !payment.isSynced;
|
|
1297
1306
|
});
|
|
1298
1307
|
console.log('[PaymentModule] 发现现有代金券支付项:', {
|
|
1299
1308
|
orderUuid: orderUuid,
|
|
@@ -1303,7 +1312,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1303
1312
|
uuid: item.uuid,
|
|
1304
1313
|
code: item.code,
|
|
1305
1314
|
amount: item.amount,
|
|
1306
|
-
voucher_id: item.voucher_id
|
|
1315
|
+
voucher_id: item.voucher_id,
|
|
1316
|
+
isSynced: item.isSynced
|
|
1307
1317
|
};
|
|
1308
1318
|
})
|
|
1309
1319
|
});
|
|
@@ -1805,7 +1815,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1805
1815
|
return sum;
|
|
1806
1816
|
}
|
|
1807
1817
|
}, new Decimal(0));
|
|
1808
|
-
|
|
1818
|
+
// 如果是定金模式,则使用deposit_amount 去减已付款金额
|
|
1819
|
+
var remainingAmount = order.is_deposit === 1 ? new Decimal(order.deposit_amount).minus(paidAmount) : totalAmount.minus(paidAmount);
|
|
1809
1820
|
order.expect_amount = Decimal.max(0, remainingAmount).toFixed(2);
|
|
1810
1821
|
console.log("[PaymentModule] \u91CD\u65B0\u8BA1\u7B97\u8BA2\u5355\u91D1\u989D:", {
|
|
1811
1822
|
orderUuid: order.uuid,
|
|
@@ -2035,7 +2046,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2035
2046
|
key: "roundAmountAsync",
|
|
2036
2047
|
value: function () {
|
|
2037
2048
|
var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(originalAmount, interval, rule) {
|
|
2038
|
-
var amount, roundingInterval, supportedIntervals, intervalValue, baseValue, roundedValue, finalAmount,
|
|
2049
|
+
var amount, roundingInterval, supportedIntervals, intervalValue, baseValue, roundedValue, finalAmount, originalAmountStr, roundedAmountStr, roundingDifference, roundingDifferenceStr;
|
|
2039
2050
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2040
2051
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2041
2052
|
case 0:
|
|
@@ -2083,8 +2094,19 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2083
2094
|
case 22:
|
|
2084
2095
|
// 计算最终金额:roundedValue * interval
|
|
2085
2096
|
finalAmount = roundedValue.mul(roundingInterval);
|
|
2086
|
-
|
|
2087
|
-
|
|
2097
|
+
originalAmountStr = amount.toFixed(2); // 如果最终金额是 0 元,则不采用舍入金额,返回原始金额
|
|
2098
|
+
if (!finalAmount.eq(0)) {
|
|
2099
|
+
_context26.next = 27;
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
console.log("[PaymentModule] \u6700\u7EC8\u91D1\u989D\u4E3A0\uFF0C\u8FD4\u56DE\u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr));
|
|
2103
|
+
return _context26.abrupt("return", {
|
|
2104
|
+
originalAmount: originalAmountStr,
|
|
2105
|
+
roundedAmount: originalAmountStr,
|
|
2106
|
+
roundingDifference: '0.00'
|
|
2107
|
+
});
|
|
2108
|
+
case 27:
|
|
2109
|
+
roundedAmountStr = finalAmount.toFixed(2); // 计算舍入差额
|
|
2088
2110
|
roundingDifference = finalAmount.sub(amount);
|
|
2089
2111
|
roundingDifferenceStr = roundingDifference.toFixed(2);
|
|
2090
2112
|
console.log("[PaymentModule] \u820D\u5165\u7ED3\u679C - \u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr, ", \u820D\u5165\u540E\u91D1\u989D: ").concat(roundedAmountStr, ", \u820D\u5165\u5DEE\u989D: ").concat(roundingDifferenceStr));
|
|
@@ -2093,16 +2115,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2093
2115
|
roundedAmount: roundedAmountStr,
|
|
2094
2116
|
roundingDifference: roundingDifferenceStr
|
|
2095
2117
|
});
|
|
2096
|
-
case
|
|
2097
|
-
_context26.prev =
|
|
2118
|
+
case 34:
|
|
2119
|
+
_context26.prev = 34;
|
|
2098
2120
|
_context26.t1 = _context26["catch"](0);
|
|
2099
2121
|
console.error('[PaymentModule] 金额舍入失败:', _context26.t1);
|
|
2100
2122
|
throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(_context26.t1 instanceof Error ? _context26.t1.message : String(_context26.t1)));
|
|
2101
|
-
case
|
|
2123
|
+
case 38:
|
|
2102
2124
|
case "end":
|
|
2103
2125
|
return _context26.stop();
|
|
2104
2126
|
}
|
|
2105
|
-
}, _callee26, this, [[0,
|
|
2127
|
+
}, _callee26, this, [[0, 34]]);
|
|
2106
2128
|
}));
|
|
2107
2129
|
function roundAmountAsync(_x28, _x29, _x30) {
|
|
2108
2130
|
return _roundAmountAsync.apply(this, arguments);
|
|
@@ -129,6 +129,15 @@ export interface PaymentItem {
|
|
|
129
129
|
origin_amount?: string;
|
|
130
130
|
/** 订单支付类型 */
|
|
131
131
|
order_payment_type?: 'normal' | 'deposit';
|
|
132
|
+
/** 本支付项是否已成功同步到后端 */
|
|
133
|
+
isSynced?: boolean;
|
|
134
|
+
/** 最近一次同步失败信息(存在则代表同步失败过) */
|
|
135
|
+
syncError?: {
|
|
136
|
+
error: string;
|
|
137
|
+
errorCode?: string;
|
|
138
|
+
statusCode?: number;
|
|
139
|
+
timestamp: number;
|
|
140
|
+
};
|
|
132
141
|
}
|
|
133
142
|
/**
|
|
134
143
|
* 订单信息
|
|
@@ -614,6 +623,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
614
623
|
amount: number;
|
|
615
624
|
tag: string;
|
|
616
625
|
}[];
|
|
626
|
+
/** 订单ID */
|
|
627
|
+
payment_order_id?: string;
|
|
617
628
|
}
|
|
618
629
|
/**
|
|
619
630
|
* 钱包初始化业务数据接口
|
|
@@ -626,6 +637,10 @@ export interface WalletInitBusinessData {
|
|
|
626
637
|
amountInfo: {
|
|
627
638
|
totalAmount: string;
|
|
628
639
|
subTotal: string;
|
|
640
|
+
/** 是否是定金订单 */
|
|
641
|
+
isDeposit?: number;
|
|
642
|
+
/** 定金金额 */
|
|
643
|
+
depositAmount?: string;
|
|
629
644
|
};
|
|
630
645
|
/** 商品列表 */
|
|
631
646
|
products: {
|
|
@@ -635,6 +650,8 @@ export interface WalletInitBusinessData {
|
|
|
635
650
|
selling_price: number;
|
|
636
651
|
}[];
|
|
637
652
|
order_wait_pay_amount?: number;
|
|
653
|
+
/** 订单ID */
|
|
654
|
+
payment_order_id?: string;
|
|
638
655
|
}
|
|
639
656
|
/**
|
|
640
657
|
* 查询用户识别码列表请求参数
|
|
@@ -652,6 +669,8 @@ export interface UserIdentificationCodeParams extends WalletDeductionRecommendPa
|
|
|
652
669
|
amount: number;
|
|
653
670
|
tag: string;
|
|
654
671
|
}[];
|
|
672
|
+
/** 订单ID */
|
|
673
|
+
payment_order_id?: string;
|
|
655
674
|
}
|
|
656
675
|
/**
|
|
657
676
|
* 钱包推荐扣款响应数据
|
|
@@ -703,6 +722,8 @@ export interface UserIdentificationCodeItem {
|
|
|
703
722
|
export interface SearchIdentificationCodeParams extends WalletDeductionRecommendParams {
|
|
704
723
|
/** 识别码 */
|
|
705
724
|
code: string;
|
|
725
|
+
/** 订单ID */
|
|
726
|
+
payment_order_id?: string;
|
|
706
727
|
}
|
|
707
728
|
/**
|
|
708
729
|
* 搜索识别码响应数据
|
|
@@ -59,7 +59,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
59
59
|
var customer_id = businessData.customer_id,
|
|
60
60
|
amountInfo = businessData.amountInfo,
|
|
61
61
|
products = businessData.products,
|
|
62
|
-
order_wait_pay_amount = businessData.order_wait_pay_amount
|
|
62
|
+
order_wait_pay_amount = businessData.order_wait_pay_amount,
|
|
63
|
+
payment_order_id = businessData.payment_order_id;
|
|
63
64
|
|
|
64
65
|
// 转换金额为数字类型
|
|
65
66
|
var totalAmount = Number(amountInfo.totalAmount);
|
|
@@ -72,10 +73,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
72
73
|
// 订单小计金额
|
|
73
74
|
order_product_amount: subTotal,
|
|
74
75
|
// 订单待支付金额
|
|
75
|
-
order_wait_pay_amount: order_wait_pay_amount || totalAmount,
|
|
76
|
+
order_wait_pay_amount: order_wait_pay_amount || (amountInfo !== null && amountInfo !== void 0 && amountInfo.isDeposit ? Number(amountInfo === null || amountInfo === void 0 ? void 0 : amountInfo.depositAmount) : totalAmount),
|
|
76
77
|
// order_behavior_count_customer_id: 1,
|
|
77
78
|
products: products,
|
|
78
|
-
prepare_payments: []
|
|
79
|
+
prepare_payments: [],
|
|
80
|
+
payment_order_id: payment_order_id
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
// 存储生成的参数到模块中
|
|
@@ -252,7 +254,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
252
254
|
key: "getWalletPassRecommendListAsync",
|
|
253
255
|
value: function () {
|
|
254
256
|
var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
255
|
-
var response;
|
|
257
|
+
var _this$walletParams, response;
|
|
256
258
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
257
259
|
while (1) switch (_context3.prev = _context3.next) {
|
|
258
260
|
case 0:
|
|
@@ -260,7 +262,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
260
262
|
this.paymentModule.logInfo('[WalletPass] 开始获取钱包推荐列表', {
|
|
261
263
|
customer_id: params.customer_id,
|
|
262
264
|
order_expect_amount: params.order_expect_amount,
|
|
263
|
-
sale_channel: params.sale_channel
|
|
265
|
+
sale_channel: params.sale_channel,
|
|
266
|
+
payment_order_id: (_this$walletParams = this.walletParams) === null || _this$walletParams === void 0 ? void 0 : _this$walletParams.payment_order_id
|
|
264
267
|
});
|
|
265
268
|
_context3.next = 4;
|
|
266
269
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/recommend', params // 将 params 作为请求体数据
|
|
@@ -315,7 +318,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
315
318
|
key: "getUserIdentificationCodeListAsync",
|
|
316
319
|
value: function () {
|
|
317
320
|
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
318
|
-
var _newParams$prepare_pa, newParams, response, sortedData;
|
|
321
|
+
var _newParams$prepare_pa, _this$walletParams2, newParams, response, sortedData;
|
|
319
322
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
320
323
|
while (1) switch (_context4.prev = _context4.next) {
|
|
321
324
|
case 0:
|
|
@@ -325,7 +328,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
325
328
|
customer_id: newParams.customer_id,
|
|
326
329
|
available: newParams.available,
|
|
327
330
|
prepare_payments_count: ((_newParams$prepare_pa = newParams.prepare_payments) === null || _newParams$prepare_pa === void 0 ? void 0 : _newParams$prepare_pa.length) || 0,
|
|
328
|
-
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass
|
|
331
|
+
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
332
|
+
payment_order_id: (_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.payment_order_id
|
|
329
333
|
});
|
|
330
334
|
_context4.next = 5;
|
|
331
335
|
return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
@@ -452,13 +456,15 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
452
456
|
prepare_payments: params.prepare_payments || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.prepare_payments),
|
|
453
457
|
multiple: 1,
|
|
454
458
|
// 搜索特有参数
|
|
455
|
-
code: params.code
|
|
459
|
+
code: params.code,
|
|
460
|
+
payment_order_id: baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.payment_order_id
|
|
456
461
|
};
|
|
457
462
|
this.paymentModule.logInfo('[WalletPass] 搜索普通识别码', {
|
|
458
463
|
code: searchParams.code,
|
|
459
464
|
customer_id: searchParams.customer_id,
|
|
460
465
|
order_expect_amount: searchParams.order_expect_amount,
|
|
461
|
-
multiple: searchParams.multiple
|
|
466
|
+
multiple: searchParams.multiple,
|
|
467
|
+
payment_order_id: baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.payment_order_id
|
|
462
468
|
});
|
|
463
469
|
_context5.next = 19;
|
|
464
470
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
|
|
@@ -536,7 +536,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
536
536
|
} else {
|
|
537
537
|
arr.push(_this3.hooks.setProduct(originProduct, {
|
|
538
538
|
discount_list: [discountDetail],
|
|
539
|
-
_id: product._id.split('___')[0] + "___" + _selectedDiscount.id + index,
|
|
539
|
+
_id: product._id.split('___')[0] + "___" + _selectedDiscount.id + "___" + index,
|
|
540
540
|
price: _selectedDiscount.tag === 'good_pass' ? 0 : product.price,
|
|
541
541
|
quantity: isNeedSplit ? 1 : product.quantity,
|
|
542
542
|
total: targetProductTotal,
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
};
|
|
327
327
|
setOtherData(key: string, value: any): void;
|
|
328
328
|
getOtherData(key: string): any;
|
|
329
|
-
getProductTypeById(id: number): Promise<"
|
|
329
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
330
330
|
/**
|
|
331
331
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
332
332
|
*
|
|
@@ -2,7 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { OrderModule } from '../../modules/Order';
|
|
4
4
|
import { PaymentModule } from '../../modules/Payment';
|
|
5
|
-
import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
|
|
5
|
+
import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, UpdateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
|
|
6
6
|
import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
|
|
7
7
|
export * from './types';
|
|
8
8
|
/**
|
|
@@ -56,6 +56,14 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
56
56
|
initWalletData(params?: {
|
|
57
57
|
order_wait_pay_amount: number;
|
|
58
58
|
}): Promise<void>;
|
|
59
|
+
checkIsNeedDepositAsync(bookings: any[], relationProducts: any[]): {
|
|
60
|
+
total: number;
|
|
61
|
+
protocols: {
|
|
62
|
+
id: number;
|
|
63
|
+
title: string;
|
|
64
|
+
}[];
|
|
65
|
+
hasDeposit: boolean;
|
|
66
|
+
};
|
|
59
67
|
/**
|
|
60
68
|
* 创建本地订单 (前端模拟下单流程)
|
|
61
69
|
*
|
|
@@ -64,6 +72,13 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
64
72
|
* 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
|
|
65
73
|
*/
|
|
66
74
|
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
75
|
+
/**
|
|
76
|
+
* 更新本地订单(已同步后端的订单)并设置为当前订单
|
|
77
|
+
*
|
|
78
|
+
* 通过传入真实的 orderId,对已缓存的订单数据进行更新,
|
|
79
|
+
* 会覆盖 order_info 与金额等字段,并重新计算待付金额,最后设置为 currentOrder。
|
|
80
|
+
*/
|
|
81
|
+
updateLocalOrderAsync(params: UpdateLocalOrderParams): Promise<PaymentOrder>;
|
|
67
82
|
/**
|
|
68
83
|
* 完成结账
|
|
69
84
|
*/
|