@pisell/pisellos 0.0.371 → 0.0.373
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/effects/index.d.ts +2 -2
- package/dist/model/strategy/type.d.ts +1 -1
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/index.js +32 -20
- package/dist/modules/Payment/types.d.ts +16 -7
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +20 -17
- package/dist/modules/Rules/types.d.ts +2 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +2 -0
- package/dist/solution/Checkout/index.js +66 -48
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/core/index.js +27 -28
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +3 -7
- package/lib/model/strategy/adapter/walletPass/evaluator.js +3 -2
- package/lib/model/strategy/adapter/walletPass/example.js +21 -21
- package/lib/model/strategy/adapter/walletPass/index.js +2 -4
- package/lib/model/strategy/adapter/walletPass/locales.js +10 -10
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -6
- package/lib/model/strategy/index.js +7 -10
- package/lib/model/strategy/strategy-example.js +19 -19
- package/lib/model/strategy/type.d.ts +1 -1
- package/lib/modules/Account/index.js +9 -10
- package/lib/modules/AccountList/index.js +14 -11
- package/lib/modules/BaseModule.js +6 -3
- package/lib/modules/Cart/index.js +14 -9
- package/lib/modules/Cart/utils/cartProduct.js +3 -6
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/modules/Customer/index.js +19 -16
- package/lib/modules/Customer/types.d.ts +1 -1
- package/lib/modules/Date/index.js +10 -6
- package/lib/modules/Date/types.js +1 -0
- package/lib/modules/Discount/index.js +11 -6
- package/lib/modules/Guests/index.js +10 -15
- package/lib/modules/Order/index.js +11 -9
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +100 -73
- package/lib/modules/Payment/types.d.ts +16 -7
- package/lib/modules/Payment/utils.js +3 -6
- package/lib/modules/Payment/walletpass.js +38 -35
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/index.js +6 -5
- package/lib/modules/ProductList/index.js +5 -3
- package/lib/modules/Resource/index.js +8 -12
- package/lib/modules/Rules/index.js +24 -28
- package/lib/modules/Rules/types.d.ts +2 -1
- package/lib/modules/Schedule/index.js +8 -5
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +2 -4
- package/lib/modules/Step/index.js +7 -4
- package/lib/modules/Summary/index.js +9 -4
- package/lib/plugins/request.js +34 -33
- package/lib/plugins/window.js +101 -113
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingByStep/index.js +86 -129
- package/lib/solution/BookingByStep/utils/capacity.js +10 -15
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +4 -8
- package/lib/solution/BookingByStep/utils/stock.js +3 -6
- package/lib/solution/BookingByStep/utils/timeslots.js +24 -27
- package/lib/solution/BookingTicket/index.js +25 -14
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/Checkout/index.d.ts +2 -0
- package/lib/solution/Checkout/index.js +242 -215
- package/lib/solution/Checkout/utils/index.js +18 -22
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +114 -110
- package/lib/solution/RegisterAndLogin/utils.js +9 -9
- package/lib/solution/ShopDiscount/index.js +16 -13
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/task.js +3 -3
- package/lib/utils/watch.d.ts +2 -2
- package/lib/utils/watch.js +5 -7
- package/package.json +17 -18
package/dist/effects/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
type EffectCallback = (payload: any) => void | Promise<void | {
|
|
1
|
+
declare type EffectCallback = (payload: any) => void | Promise<void | {
|
|
2
2
|
status: boolean;
|
|
3
3
|
message?: string;
|
|
4
4
|
}>;
|
|
5
|
-
type UnsubscribeFunction = () => void;
|
|
5
|
+
declare type UnsubscribeFunction = () => void;
|
|
6
6
|
declare class EffectsManager {
|
|
7
7
|
private listeners;
|
|
8
8
|
on(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
@@ -225,4 +225,4 @@ export interface EngineOptions {
|
|
|
225
225
|
/**
|
|
226
226
|
* 运算符处理器
|
|
227
227
|
*/
|
|
228
|
-
export type OperatorHandler = (fieldValue: any, compareValue: any, rule: ConditionRule) => boolean;
|
|
228
|
+
export declare type OperatorHandler = (fieldValue: any, compareValue: any, rule: ConditionRule) => boolean;
|
|
@@ -153,7 +153,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
153
|
skip: skip,
|
|
154
154
|
num: num,
|
|
155
155
|
sort_by: SORT_BY,
|
|
156
|
-
with: ['latestWalletDetail.wallet', 'contactsInfo'],
|
|
156
|
+
with: ['latestWalletDetail.wallet', 'contactsInfo', 'formRecord'],
|
|
157
157
|
search_wallet_flag: 1,
|
|
158
158
|
search_wallet_pass_flag: 1
|
|
159
159
|
}, search && {
|
|
@@ -33,7 +33,7 @@ export interface ShopCustomer extends ICustomer {
|
|
|
33
33
|
* walletDetails.wallet: 用户所有wallet
|
|
34
34
|
* latestWalletDetail.wallet: 用户最新wallet
|
|
35
35
|
*/
|
|
36
|
-
type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
|
|
36
|
+
declare type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
|
|
37
37
|
/**
|
|
38
38
|
* 获取客户列表参数
|
|
39
39
|
*/
|
|
@@ -637,7 +637,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
637
637
|
case 0:
|
|
638
638
|
_context6.prev = 0;
|
|
639
639
|
_context6.next = 3;
|
|
640
|
-
return this.dbManager.get('order', orderUuid);
|
|
640
|
+
return this.dbManager.get('order', orderUuid, true);
|
|
641
641
|
case 3:
|
|
642
642
|
return _context6.abrupt("return", _context6.sent);
|
|
643
643
|
case 6:
|
|
@@ -726,7 +726,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
726
726
|
}; // 🚀 性能监控:记录数据库添加操作耗时
|
|
727
727
|
dbAddStartTime = Date.now();
|
|
728
728
|
_context7.next = 6;
|
|
729
|
-
return this.dbManager.add('order', newOrder);
|
|
729
|
+
return this.dbManager.add('order', newOrder, true);
|
|
730
730
|
case 6:
|
|
731
731
|
dbAddDuration = Date.now() - dbAddStartTime;
|
|
732
732
|
this.logInfo('Database add operation completed', {
|
|
@@ -1068,16 +1068,23 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1068
1068
|
orderPaymentType: paymentItem.order_payment_type
|
|
1069
1069
|
});
|
|
1070
1070
|
_context13.prev = 1;
|
|
1071
|
-
|
|
1071
|
+
this.logInfo('准备获取订单', {
|
|
1072
|
+
orderUuid: orderUuid
|
|
1073
|
+
});
|
|
1074
|
+
_context13.next = 5;
|
|
1072
1075
|
return this.getPaymentOrderByUuidAsync(orderUuid);
|
|
1073
|
-
case
|
|
1076
|
+
case 5:
|
|
1074
1077
|
order = _context13.sent;
|
|
1078
|
+
this.logInfo('获取订单信息成功', {
|
|
1079
|
+
orderUuid: orderUuid,
|
|
1080
|
+
order: order
|
|
1081
|
+
});
|
|
1075
1082
|
if (order) {
|
|
1076
|
-
_context13.next =
|
|
1083
|
+
_context13.next = 9;
|
|
1077
1084
|
break;
|
|
1078
1085
|
}
|
|
1079
1086
|
throw new Error("Order not found: ".concat(orderUuid));
|
|
1080
|
-
case
|
|
1087
|
+
case 9:
|
|
1081
1088
|
// 🔒 支付锁检查:如果订单待付金额已经为0,不允许继续添加支付项
|
|
1082
1089
|
expectAmount = new Decimal(order.expect_amount);
|
|
1083
1090
|
paidDepositAmount = order.payment.reduce(function (sum, payment) {
|
|
@@ -1086,9 +1093,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1086
1093
|
}
|
|
1087
1094
|
return sum;
|
|
1088
1095
|
}, new Decimal(0));
|
|
1089
|
-
expectedDepositAmount = new Decimal(order.deposit_amount || '0').sub(paidDepositAmount); // 有一种特殊情况,订单金额为 0
|
|
1096
|
+
expectedDepositAmount = new Decimal(order.deposit_amount || '0').sub(paidDepositAmount); // 有一种特殊情况,订单金额为 0,但是定金金额>0,且此时是定金状态的,允许添加支付项
|
|
1090
1097
|
if (!(expectAmount.lte(0) && expectedDepositAmount.eq(0))) {
|
|
1091
|
-
_context13.next =
|
|
1098
|
+
_context13.next = 17;
|
|
1092
1099
|
break;
|
|
1093
1100
|
}
|
|
1094
1101
|
warningMessage = "\u8BA2\u5355 ".concat(orderUuid, " \u5F85\u4ED8\u91D1\u989D\u5DF2\u4E3A0\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u65B0\u7684\u652F\u4ED8\u9879");
|
|
@@ -1105,7 +1112,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1105
1112
|
paymentItem: paymentItem
|
|
1106
1113
|
});
|
|
1107
1114
|
throw new Error(warningMessage);
|
|
1108
|
-
case
|
|
1115
|
+
case 17:
|
|
1109
1116
|
if ((_paymentItem$metadata = paymentItem.metadata) !== null && _paymentItem$metadata !== void 0 && _paymentItem$metadata.unique_payment_number) {
|
|
1110
1117
|
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
1111
1118
|
} else {
|
|
@@ -1132,15 +1139,20 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1132
1139
|
};
|
|
1133
1140
|
order.payment.push(newPaymentItem);
|
|
1134
1141
|
this.recalculateOrderAmount(order);
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1142
|
+
this.logInfo('开始更新订单支付项', {
|
|
1143
|
+
orderUuid: orderUuid,
|
|
1144
|
+
order: order
|
|
1145
|
+
});
|
|
1146
|
+
_context13.next = 24;
|
|
1147
|
+
return this.dbManager.update('order', order, true);
|
|
1148
|
+
case 24:
|
|
1149
|
+
this.logInfo('更新订单支付项完成', {
|
|
1150
|
+
orderUuid: orderUuid
|
|
1151
|
+
});
|
|
1152
|
+
this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
|
|
1140
1153
|
orderUuid: orderUuid,
|
|
1141
1154
|
payment: newPaymentItem
|
|
1142
1155
|
});
|
|
1143
|
-
case 23:
|
|
1144
1156
|
this.logInfo('addPaymentItemAsync completed successfully', {
|
|
1145
1157
|
orderUuid: orderUuid,
|
|
1146
1158
|
paymentUuid: newPaymentItem.uuid,
|
|
@@ -1154,10 +1166,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1154
1166
|
actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
|
|
1155
1167
|
changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
|
|
1156
1168
|
});
|
|
1157
|
-
_context13.next =
|
|
1169
|
+
_context13.next = 34;
|
|
1158
1170
|
break;
|
|
1159
|
-
case
|
|
1160
|
-
_context13.prev =
|
|
1171
|
+
case 29:
|
|
1172
|
+
_context13.prev = 29;
|
|
1161
1173
|
_context13.t0 = _context13["catch"](1);
|
|
1162
1174
|
console.error('[PaymentModule] 添加支付项失败', _context13.t0);
|
|
1163
1175
|
this.logError('addPaymentItemAsync failed', _context13.t0, {
|
|
@@ -1165,11 +1177,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1165
1177
|
paymentItem: paymentItem
|
|
1166
1178
|
});
|
|
1167
1179
|
throw _context13.t0;
|
|
1168
|
-
case
|
|
1180
|
+
case 34:
|
|
1169
1181
|
case "end":
|
|
1170
1182
|
return _context13.stop();
|
|
1171
1183
|
}
|
|
1172
|
-
}, _callee13, this, [[1,
|
|
1184
|
+
}, _callee13, this, [[1, 29]]);
|
|
1173
1185
|
}));
|
|
1174
1186
|
function addPaymentItemAsync(_x14, _x15) {
|
|
1175
1187
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -581,12 +581,12 @@ export declare enum PaymentHooks {
|
|
|
581
581
|
OnOrderAmountChanged = "payment:onOrderAmountChanged",
|
|
582
582
|
OnPaymentSyncError = "payment:onPaymentSyncError",
|
|
583
583
|
OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess",
|
|
584
|
-
OnWalletRecommendListUpdated =
|
|
585
|
-
OnWalletRecommendListCleared =
|
|
586
|
-
OnUserIdentificationCodesUpdated =
|
|
587
|
-
OnUserIdentificationCodesCleared =
|
|
588
|
-
OnWalletCacheCleared =
|
|
589
|
-
OnSearchIdentificationCodeCompleted =
|
|
584
|
+
OnWalletRecommendListUpdated = 0,
|
|
585
|
+
OnWalletRecommendListCleared = 0,
|
|
586
|
+
OnUserIdentificationCodesUpdated = 0,
|
|
587
|
+
OnUserIdentificationCodesCleared = 0,
|
|
588
|
+
OnWalletCacheCleared = 0,
|
|
589
|
+
OnSearchIdentificationCodeCompleted = 0
|
|
590
590
|
}
|
|
591
591
|
/**
|
|
592
592
|
* 钱包推荐扣款请求参数
|
|
@@ -598,6 +598,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
598
598
|
expect_columns?: string[];
|
|
599
599
|
/** 客户id */
|
|
600
600
|
customer_id?: number;
|
|
601
|
+
/** 客户holder_id */
|
|
602
|
+
holder_id?: number;
|
|
601
603
|
/** 订单总计金额 */
|
|
602
604
|
order_expect_amount: number;
|
|
603
605
|
/** 订单小计金额 */
|
|
@@ -616,6 +618,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
616
618
|
quantity: number;
|
|
617
619
|
/** 商品使用了所有优惠后的最终价格 */
|
|
618
620
|
selling_price: number;
|
|
621
|
+
/** 客户holder_id */
|
|
622
|
+
holder_id?: number;
|
|
619
623
|
}[];
|
|
620
624
|
/** 预备支付 */
|
|
621
625
|
prepare_payments?: {
|
|
@@ -633,6 +637,10 @@ export interface WalletDeductionRecommendParams {
|
|
|
633
637
|
export interface WalletInitBusinessData {
|
|
634
638
|
/** 客户ID(可选) */
|
|
635
639
|
customer_id?: number;
|
|
640
|
+
/** 客户 holder */
|
|
641
|
+
holder?: {
|
|
642
|
+
form_record: number[];
|
|
643
|
+
};
|
|
636
644
|
/** 金额信息 */
|
|
637
645
|
amountInfo: {
|
|
638
646
|
totalAmount: string;
|
|
@@ -648,6 +656,7 @@ export interface WalletInitBusinessData {
|
|
|
648
656
|
product_variant_id: string;
|
|
649
657
|
quantity: number;
|
|
650
658
|
selling_price: number;
|
|
659
|
+
holder_id?: number;
|
|
651
660
|
}[];
|
|
652
661
|
order_wait_pay_amount?: number;
|
|
653
662
|
/** 订单ID */
|
|
@@ -740,7 +749,7 @@ export interface SearchIdentificationCodeResponse {
|
|
|
740
749
|
/**
|
|
741
750
|
* 搜索识别码结果类型
|
|
742
751
|
*/
|
|
743
|
-
export type SearchIdentificationCodeResult = {
|
|
752
|
+
export declare type SearchIdentificationCodeResult = {
|
|
744
753
|
type: 'walletCode';
|
|
745
754
|
data: SearchIdentificationCodeItem[];
|
|
746
755
|
} | {
|
|
@@ -63,8 +63,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
63
63
|
}, {
|
|
64
64
|
key: "generateWalletParams",
|
|
65
65
|
value: function generateWalletParams(businessData) {
|
|
66
|
-
var _walletParams$product;
|
|
66
|
+
var _holder$form_record, _walletParams$product;
|
|
67
67
|
var customer_id = businessData.customer_id,
|
|
68
|
+
holder = businessData.holder,
|
|
68
69
|
amountInfo = businessData.amountInfo,
|
|
69
70
|
products = businessData.products,
|
|
70
71
|
order_wait_pay_amount = businessData.order_wait_pay_amount,
|
|
@@ -79,6 +80,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
79
80
|
sale_channel: 'pos',
|
|
80
81
|
customer_id: customer_id || 0,
|
|
81
82
|
// 提供默认值,确保类型为 number
|
|
83
|
+
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,
|
|
82
84
|
order_expect_amount: totalAmount,
|
|
83
85
|
// 订单小计金额
|
|
84
86
|
order_product_amount: subTotal,
|
|
@@ -94,6 +96,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
94
96
|
this.walletParams = walletParams;
|
|
95
97
|
this.paymentModule.logInfo('[WalletPass] 钱包默认参数已生成并存储', {
|
|
96
98
|
customer_id: walletParams.customer_id,
|
|
99
|
+
holder_id: walletParams.holder_id,
|
|
97
100
|
order_expect_amount: walletParams.order_expect_amount,
|
|
98
101
|
order_product_amount: walletParams.order_product_amount,
|
|
99
102
|
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
@@ -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
|
}
|
|
@@ -587,7 +587,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
587
587
|
|
|
588
588
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
589
589
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
590
|
-
var _product$discount_lis3, _flatItem$parentProdu2, _flatItem$product2;
|
|
590
|
+
var _product$discount_lis3, _product$discount_lis4, _flatItem$parentProdu2, _flatItem$product2;
|
|
591
591
|
// 🔥 检查策略可用性(针对 good_pass 和折扣卡)
|
|
592
592
|
var discountType = discount.tag || discount.type;
|
|
593
593
|
if (['good_pass', 'discount_card', 'product_discount_card'].includes(discountType)) {
|
|
@@ -600,12 +600,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
600
600
|
|
|
601
601
|
// 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
|
|
602
602
|
// 商品券时主商品价格为0不可用
|
|
603
|
-
if ((Number(product.price) <= 0 || !product.price) &&
|
|
604
|
-
|
|
605
|
-
// 折扣卡时总价为0时不可用
|
|
606
|
-
if ((Number(product.total) <= 0 || !product.total) && !((_product$discount_lis3 = product.discount_list) !== null && _product$discount_lis3 !== void 0 && _product$discount_lis3.find(function (n) {
|
|
603
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_product$discount_lis3 = product.discount_list) !== null && _product$discount_lis3 !== void 0 && _product$discount_lis3.find(function (n) {
|
|
607
604
|
var _n$discount;
|
|
608
605
|
return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
|
|
606
|
+
})) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
607
|
+
|
|
608
|
+
// 折扣卡商品价格为0时不可用
|
|
609
|
+
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) {
|
|
610
|
+
var _n$discount2;
|
|
611
|
+
return ((_n$discount2 = n.discount) === null || _n$discount2 === void 0 ? void 0 : _n$discount2.resource_id) === discount.id;
|
|
609
612
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
610
613
|
// 如果优惠券已被使用,则跳过
|
|
611
614
|
var targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
@@ -654,12 +657,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
654
657
|
// 如果是手动折扣,则不适用优惠券
|
|
655
658
|
var isManualDiscount = false;
|
|
656
659
|
if (flatItem.type === 'main') {
|
|
657
|
-
var _product$
|
|
660
|
+
var _product$discount_lis5, _product7, _product7$every;
|
|
658
661
|
// 主商品:判断自身是否手动折扣
|
|
659
662
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
660
663
|
var _ref3;
|
|
661
664
|
return !((_ref3 = item.discount_list || []) !== null && _ref3 !== void 0 && _ref3.length);
|
|
662
|
-
}) && (!((_product$
|
|
665
|
+
}) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((_product7 = product) === null || _product7 === void 0 || (_product7 = _product7.discount_list) === null || _product7 === void 0 || (_product7$every = _product7.every) === null || _product7$every === void 0 ? void 0 : _product7$every.call(_product7, function (item) {
|
|
663
666
|
return item.type === 'product';
|
|
664
667
|
})));
|
|
665
668
|
} else {
|
|
@@ -678,9 +681,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
678
681
|
|
|
679
682
|
// 勾选时覆盖手动折扣
|
|
680
683
|
if (options !== null && options !== void 0 && options.discountId) {
|
|
681
|
-
var _product$
|
|
684
|
+
var _product$discount_lis6;
|
|
682
685
|
// 主商品:检查自己的 discount_list
|
|
683
|
-
if (flatItem.type === 'main' && (_product$
|
|
686
|
+
if (flatItem.type === 'main' && (_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.some(function (item) {
|
|
684
687
|
var _item$discount;
|
|
685
688
|
return ((_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.resource_id) === options.discountId;
|
|
686
689
|
})) {
|
|
@@ -688,8 +691,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
688
691
|
}
|
|
689
692
|
// bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
|
|
690
693
|
if (flatItem.type === 'bundle') {
|
|
691
|
-
var _product$
|
|
692
|
-
if ((_product$
|
|
694
|
+
var _product$discount_lis7, _flatItem$parentProdu3;
|
|
695
|
+
if ((_product$discount_lis7 = product.discount_list) !== null && _product$discount_lis7 !== void 0 && _product$discount_lis7.some(function (item) {
|
|
693
696
|
var _item$discount2;
|
|
694
697
|
return ((_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.resource_id) === options.discountId;
|
|
695
698
|
}) || (_flatItem$parentProdu3 = flatItem.parentProduct) !== null && _flatItem$parentProdu3 !== void 0 && (_flatItem$parentProdu3 = _flatItem$parentProdu3.discount_list) !== null && _flatItem$parentProdu3 !== void 0 && _flatItem$parentProdu3.some(function (item) {
|
|
@@ -701,9 +704,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
701
704
|
}
|
|
702
705
|
}
|
|
703
706
|
if (options !== null && options !== void 0 && options.selectedList) {
|
|
704
|
-
var _product$
|
|
707
|
+
var _product$discount_lis8;
|
|
705
708
|
// 主商品:检查自己的 discount_list
|
|
706
|
-
if (flatItem.type === 'main' && (_product$
|
|
709
|
+
if (flatItem.type === 'main' && (_product$discount_lis8 = product.discount_list) !== null && _product$discount_lis8 !== void 0 && _product$discount_lis8.some(function (item) {
|
|
707
710
|
var _options$selectedList;
|
|
708
711
|
return options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.some(function (n) {
|
|
709
712
|
var _item$discount4;
|
|
@@ -714,8 +717,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
714
717
|
}
|
|
715
718
|
// bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
|
|
716
719
|
if (flatItem.type === 'bundle') {
|
|
717
|
-
var _product$
|
|
718
|
-
if ((_product$
|
|
720
|
+
var _product$discount_lis9, _flatItem$parentProdu4;
|
|
721
|
+
if ((_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
|
|
719
722
|
var _options$selectedList2;
|
|
720
723
|
return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
|
|
721
724
|
var _item$discount5;
|
|
@@ -812,7 +815,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
812
815
|
}));
|
|
813
816
|
}
|
|
814
817
|
for (var i = 0; i < splitCount; i++) {
|
|
815
|
-
var _product$
|
|
818
|
+
var _product$discount_lis10, _originProduct, _selectedDiscount$met;
|
|
816
819
|
// 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
|
|
817
820
|
var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
|
|
818
821
|
// 标记优惠券为已使用
|
|
@@ -824,7 +827,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
824
827
|
// 优先从 origin_total拿,可能会拿不到(比如用户端预约在没有配置 original_price 的情况下)
|
|
825
828
|
var productOriginTotal = product.origin_total || product.total || 0;
|
|
826
829
|
// 如果当前 product 有 discount_list,则先从 origin_total 拿
|
|
827
|
-
if ((_product$
|
|
830
|
+
if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.length && product.origin_total) {
|
|
828
831
|
productOriginTotal = product.origin_total;
|
|
829
832
|
}
|
|
830
833
|
// 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
|
|
@@ -28,7 +28,7 @@ export interface RulesModuleAPI {
|
|
|
28
28
|
}[];
|
|
29
29
|
}) => DiscountResult;
|
|
30
30
|
}
|
|
31
|
-
type ProductDetail = {
|
|
31
|
+
declare type ProductDetail = {
|
|
32
32
|
isClient?: boolean;
|
|
33
33
|
isManualDiscount?: boolean;
|
|
34
34
|
booking_id: any;
|
|
@@ -45,6 +45,7 @@ type ProductDetail = {
|
|
|
45
45
|
quantity: number;
|
|
46
46
|
vouchersApplicable?: boolean;
|
|
47
47
|
startDate?: any;
|
|
48
|
+
holder_id?: number | string;
|
|
48
49
|
};
|
|
49
50
|
export interface RulesParamsHooks {
|
|
50
51
|
getProduct: (product: Record<string, any>) => ProductDetail;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ScheduleItem = {
|
|
1
|
+
export declare type ScheduleItem = {
|
|
2
2
|
/** 颜色 */
|
|
3
3
|
color: string;
|
|
4
4
|
/** 创建时间 */
|
|
@@ -65,7 +65,7 @@ export type ScheduleItem = {
|
|
|
65
65
|
schedule_id: number;
|
|
66
66
|
}[];
|
|
67
67
|
};
|
|
68
|
-
export type ScheduleFormOtherValue = {
|
|
68
|
+
export declare type ScheduleFormOtherValue = {
|
|
69
69
|
/** 截止模式
|
|
70
70
|
* 1: 永不截止
|
|
71
71
|
* 2: 按日期截止
|
|
@@ -79,11 +79,11 @@ export type ScheduleFormOtherValue = {
|
|
|
79
79
|
includeStatus: boolean;
|
|
80
80
|
type: 'standard' | 'time-slots' | 'designation';
|
|
81
81
|
};
|
|
82
|
-
export type ExcIncDate = {
|
|
82
|
+
export declare type ExcIncDate = {
|
|
83
83
|
start: string;
|
|
84
84
|
end: string;
|
|
85
85
|
};
|
|
86
|
-
export type ScheduleFormData = {
|
|
86
|
+
export declare type ScheduleFormData = {
|
|
87
87
|
/** 颜色 */
|
|
88
88
|
color: string;
|
|
89
89
|
/** 日程名称 */
|
|
@@ -131,20 +131,20 @@ export type ScheduleFormData = {
|
|
|
131
131
|
start_time: any;
|
|
132
132
|
end_time: any;
|
|
133
133
|
};
|
|
134
|
-
export type CalendarDataItem = {
|
|
134
|
+
export declare type CalendarDataItem = {
|
|
135
135
|
date: string;
|
|
136
136
|
color: string[];
|
|
137
137
|
isExcluded: boolean;
|
|
138
138
|
schedule_ids?: number[];
|
|
139
139
|
[key: string]: any;
|
|
140
140
|
};
|
|
141
|
-
export type RequestData<Data> = {
|
|
141
|
+
export declare type RequestData<Data> = {
|
|
142
142
|
data: Data;
|
|
143
143
|
status: boolean;
|
|
144
144
|
message: string;
|
|
145
145
|
code: number;
|
|
146
146
|
};
|
|
147
|
-
export type ResponseListData<Data> = {
|
|
147
|
+
export declare type ResponseListData<Data> = {
|
|
148
148
|
status: boolean;
|
|
149
149
|
message: string;
|
|
150
150
|
code: number;
|
|
@@ -4,7 +4,7 @@ export interface ScheduleState {
|
|
|
4
4
|
availabilityDateList: ScheduleAvailabilityDateItem[];
|
|
5
5
|
otherProductsIds: number[];
|
|
6
6
|
}
|
|
7
|
-
export type ScheduleAvailabilityDateItem = {
|
|
7
|
+
export declare type ScheduleAvailabilityDateItem = {
|
|
8
8
|
date: string;
|
|
9
9
|
schedule_id: number[];
|
|
10
10
|
product_ids: number[];
|
|
@@ -24,7 +24,7 @@ export interface LoadScheduleAvailableDateParams {
|
|
|
24
24
|
}
|
|
25
25
|
export interface ScheduleModuleAPI {
|
|
26
26
|
}
|
|
27
|
-
export type ScheduleItem = {
|
|
27
|
+
export declare type ScheduleItem = {
|
|
28
28
|
/** 颜色 */
|
|
29
29
|
color: string;
|
|
30
30
|
/** 创建时间 */
|
|
@@ -91,7 +91,7 @@ export type ScheduleItem = {
|
|
|
91
91
|
schedule_id: number;
|
|
92
92
|
}[];
|
|
93
93
|
};
|
|
94
|
-
export type ScheduleFormOtherValue = {
|
|
94
|
+
export declare type ScheduleFormOtherValue = {
|
|
95
95
|
/** 截止模式
|
|
96
96
|
* 1: 永不截止
|
|
97
97
|
* 2: 按日期截止
|
|
@@ -105,11 +105,11 @@ export type ScheduleFormOtherValue = {
|
|
|
105
105
|
includeStatus: boolean;
|
|
106
106
|
type: 'standard' | 'time-slots' | 'designation';
|
|
107
107
|
};
|
|
108
|
-
export type ExcIncDate = {
|
|
108
|
+
export declare type ExcIncDate = {
|
|
109
109
|
start: string;
|
|
110
110
|
end: string;
|
|
111
111
|
};
|
|
112
|
-
export type ScheduleFormData = {
|
|
112
|
+
export declare type ScheduleFormData = {
|
|
113
113
|
/** 颜色 */
|
|
114
114
|
color: string;
|
|
115
115
|
/** 日程名称 */
|
|
@@ -157,20 +157,20 @@ export type ScheduleFormData = {
|
|
|
157
157
|
start_time: any;
|
|
158
158
|
end_time: any;
|
|
159
159
|
};
|
|
160
|
-
export type CalendarDataItem = {
|
|
160
|
+
export declare type CalendarDataItem = {
|
|
161
161
|
date: string;
|
|
162
162
|
color: string[];
|
|
163
163
|
isExcluded: boolean;
|
|
164
164
|
schedule_ids?: number[];
|
|
165
165
|
[key: string]: any;
|
|
166
166
|
};
|
|
167
|
-
export type RequestData<Data> = {
|
|
167
|
+
export declare type RequestData<Data> = {
|
|
168
168
|
data: Data;
|
|
169
169
|
status: boolean;
|
|
170
170
|
message: string;
|
|
171
171
|
code: number;
|
|
172
172
|
};
|
|
173
|
-
export type ResponseListData<Data> = {
|
|
173
|
+
export declare type ResponseListData<Data> = {
|
|
174
174
|
status: boolean;
|
|
175
175
|
message: string;
|
|
176
176
|
code: number;
|
|
@@ -181,7 +181,7 @@ export type ResponseListData<Data> = {
|
|
|
181
181
|
skip: number;
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
|
-
export type ScheduleAllMap = Record<string, {
|
|
184
|
+
export declare type ScheduleAllMap = Record<string, {
|
|
185
185
|
minTime: dayjs.Dayjs | null;
|
|
186
186
|
maxTime: dayjs.Dayjs | null;
|
|
187
187
|
minTimeStr: string | null;
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -353,7 +353,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
353
353
|
};
|
|
354
354
|
setOtherData(key: string, value: any): void;
|
|
355
355
|
getOtherData(key: string): any;
|
|
356
|
-
getProductTypeById(id: number): Promise<"
|
|
356
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
357
357
|
/**
|
|
358
358
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
359
359
|
*
|
|
@@ -6,7 +6,7 @@ import { CartItem, ProductData } from '../../../modules';
|
|
|
6
6
|
* 3. 格式化资源相关 格式化资源列表 --> 格式化资源 --> 获取时间切片列表 --> 判断单个时间切片是否可用 formatResources
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
type DateType = Dayjs;
|
|
9
|
+
declare type DateType = Dayjs;
|
|
10
10
|
export interface TimeSliceItem {
|
|
11
11
|
start_time: string;
|
|
12
12
|
end_time: string;
|
|
@@ -48,11 +48,13 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
48
48
|
* 初始化结账流程
|
|
49
49
|
*/
|
|
50
50
|
initializeCheckoutAsync(params: CheckoutInitParams): Promise<void>;
|
|
51
|
+
getHolderIdFromBooking(obj: any): number | undefined;
|
|
51
52
|
getProductListByOrder(): {
|
|
52
53
|
product_id: number;
|
|
53
54
|
product_variant_id: string;
|
|
54
55
|
quantity: number;
|
|
55
56
|
selling_price: number;
|
|
57
|
+
holder_id?: number;
|
|
56
58
|
}[];
|
|
57
59
|
initWalletData(params?: {
|
|
58
60
|
order_wait_pay_amount: number;
|