@pisell/pisellos 2.1.52 → 2.1.54
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +3 -0
- package/dist/model/strategy/adapter/index.js +4 -0
- package/dist/model/strategy/adapter/type.d.ts +28 -0
- package/dist/model/strategy/adapter/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +496 -0
- package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/dist/model/strategy/adapter/walletPass/example.js +258 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/index.js +182 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/locales.js +23 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +163 -0
- package/dist/model/strategy/adapter/walletPass/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +965 -0
- package/dist/model/strategy/index.d.ts +94 -0
- package/dist/model/strategy/index.js +551 -0
- package/dist/model/strategy/strategy-example.d.ts +5 -0
- package/dist/model/strategy/strategy-example.js +331 -0
- package/dist/model/strategy/type.d.ts +228 -0
- package/dist/model/strategy/type.js +94 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +11 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Discount/types.d.ts +15 -0
- package/dist/modules/Payment/index.d.ts +2 -1
- package/dist/modules/Payment/index.js +10 -7
- package/dist/modules/Payment/utils.js +3 -0
- package/dist/modules/Payment/walletpass.d.ts +23 -0
- package/dist/modules/Payment/walletpass.js +191 -95
- package/dist/modules/Rules/index.d.ts +15 -3
- package/dist/modules/Rules/index.js +194 -28
- package/dist/modules/Rules/types.d.ts +5 -0
- package/dist/modules/Summary/types.d.ts +2 -0
- package/dist/modules/Summary/utils.d.ts +6 -0
- package/dist/modules/Summary/utils.js +21 -0
- package/dist/plugins/window.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -0
- package/dist/solution/BookingByStep/utils/capacity.js +1 -2
- package/dist/solution/Checkout/index.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +4 -0
- package/dist/solution/ShopDiscount/index.js +26 -5
- package/dist/solution/ShopDiscount/types.d.ts +6 -0
- package/dist/solution/ShopDiscount/utils.js +26 -11
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/model/index.d.ts +1 -0
- package/lib/model/index.js +23 -0
- package/lib/model/strategy/adapter/index.d.ts +3 -0
- package/lib/model/strategy/adapter/index.js +45 -0
- package/lib/model/strategy/adapter/type.d.ts +28 -0
- package/lib/model/strategy/adapter/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +420 -0
- package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/lib/model/strategy/adapter/walletPass/example.js +207 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/index.js +142 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/locales.js +51 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +163 -0
- package/lib/model/strategy/adapter/walletPass/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +660 -0
- package/lib/model/strategy/index.d.ts +94 -0
- package/lib/model/strategy/index.js +413 -0
- package/lib/model/strategy/strategy-example.d.ts +5 -0
- package/lib/model/strategy/strategy-example.js +318 -0
- package/lib/model/strategy/type.d.ts +228 -0
- package/lib/model/strategy/type.js +44 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +9 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Discount/types.d.ts +15 -0
- package/lib/modules/Payment/index.d.ts +2 -1
- package/lib/modules/Payment/index.js +1 -0
- package/lib/modules/Payment/utils.js +3 -0
- package/lib/modules/Payment/walletpass.d.ts +23 -0
- package/lib/modules/Payment/walletpass.js +94 -17
- package/lib/modules/Rules/index.d.ts +15 -3
- package/lib/modules/Rules/index.js +409 -195
- package/lib/modules/Rules/types.d.ts +5 -0
- package/lib/modules/Summary/types.d.ts +2 -0
- package/lib/modules/Summary/utils.d.ts +6 -0
- package/lib/modules/Summary/utils.js +15 -0
- package/lib/plugins/window.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -0
- package/lib/solution/BookingByStep/utils/capacity.js +1 -2
- package/lib/solution/Checkout/index.js +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +4 -0
- package/lib/solution/ShopDiscount/index.js +18 -4
- package/lib/solution/ShopDiscount/types.d.ts +6 -0
- package/lib/solution/ShopDiscount/utils.js +10 -6
- package/package.json +1 -1
|
@@ -25,6 +25,8 @@ interface Limitedrelationproductdata {
|
|
|
25
25
|
product_ids: number[];
|
|
26
26
|
product_collection_id: number[];
|
|
27
27
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
28
|
+
filter: 0 | 1;
|
|
29
|
+
exclude_product_ids: number[];
|
|
28
30
|
}
|
|
29
31
|
interface ApplicableProductDetails {
|
|
30
32
|
amount: string;
|
|
@@ -96,6 +98,19 @@ export interface Discount {
|
|
|
96
98
|
isSelected?: boolean;
|
|
97
99
|
isAvailable?: boolean;
|
|
98
100
|
isUsed?: boolean;
|
|
101
|
+
config?: {
|
|
102
|
+
isAvailable?: boolean;
|
|
103
|
+
/** 最大抵扣金额 */
|
|
104
|
+
maxDeductionAmount?: number;
|
|
105
|
+
/** 每单最多使用张数 */
|
|
106
|
+
maxUsagePerOrder?: number;
|
|
107
|
+
/** 是否抵扣税费与附加费 */
|
|
108
|
+
deductTaxAndFee?: boolean;
|
|
109
|
+
/** 适用粒度(多商品共用) */
|
|
110
|
+
allowCrossProduct?: boolean;
|
|
111
|
+
/** 可用商品数量上限 */
|
|
112
|
+
applicableProductLimit?: number;
|
|
113
|
+
};
|
|
99
114
|
applicableProductIds?: number[];
|
|
100
115
|
applicableProductDetails: ApplicableProductDetails[];
|
|
101
116
|
appliedProductDetails: ApplicableProductDetails[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
-
import { RequestPlugin } from '../../plugins';
|
|
2
|
+
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
4
|
import { PaymentModuleAPI, PaymentMethod, PaymentOrder, PaymentItem, PaymentItemInput, PaymentUpdateFields, PushOrderParams, CashPayment, EftposPayment, WalletPassPayment, RoundingRule, RoundingInterval, RoundingResult } from './types';
|
|
5
5
|
export * from './types';
|
|
@@ -21,6 +21,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
21
21
|
request: RequestPlugin;
|
|
22
22
|
private app;
|
|
23
23
|
private store;
|
|
24
|
+
window: WindowPlugin;
|
|
24
25
|
private dbManager;
|
|
25
26
|
private logger;
|
|
26
27
|
protected otherParams: any;
|
|
@@ -81,6 +81,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
81
81
|
_defineProperty(_assertThisInitialized(_this), "app", void 0);
|
|
82
82
|
// App instance
|
|
83
83
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
84
|
+
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
85
|
+
// WindowPlugin 实例
|
|
84
86
|
_defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
|
|
85
87
|
// IndexDBManager 实例
|
|
86
88
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
@@ -110,26 +112,27 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
110
112
|
// 获取依赖的插件
|
|
111
113
|
this.request = core.getPlugin('request');
|
|
112
114
|
appPlugin = core.getPlugin('app');
|
|
115
|
+
this.window = core.getPlugin('window');
|
|
113
116
|
if (this.request) {
|
|
114
|
-
_context.next =
|
|
117
|
+
_context.next = 8;
|
|
115
118
|
break;
|
|
116
119
|
}
|
|
117
120
|
throw new Error('支付模块需要 request 插件支持');
|
|
118
|
-
case
|
|
121
|
+
case 8:
|
|
119
122
|
if (appPlugin) {
|
|
120
|
-
_context.next =
|
|
123
|
+
_context.next = 10;
|
|
121
124
|
break;
|
|
122
125
|
}
|
|
123
126
|
throw new Error('支付模块需要 app 插件支持');
|
|
124
|
-
case
|
|
127
|
+
case 10:
|
|
125
128
|
this.app = appPlugin.getApp();
|
|
126
129
|
this.dbManager = this.app.dbManager;
|
|
127
130
|
this.logger = this.app.logger;
|
|
128
131
|
|
|
129
132
|
// 确保支付模块所需的对象存储已创建
|
|
130
|
-
_context.next =
|
|
133
|
+
_context.next = 15;
|
|
131
134
|
return this.ensurePaymentTables();
|
|
132
|
-
case
|
|
135
|
+
case 15:
|
|
133
136
|
this.registerNetworkHandlers();
|
|
134
137
|
|
|
135
138
|
// // 预连接数据库
|
|
@@ -137,7 +140,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
137
140
|
|
|
138
141
|
console.log('[PaymentModule] 初始化完成');
|
|
139
142
|
this.logInfo('PaymentModule initialized successfully');
|
|
140
|
-
case
|
|
143
|
+
case 18:
|
|
141
144
|
case "end":
|
|
142
145
|
return _context.stop();
|
|
143
146
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// 获取walletPass可用最大金额
|
|
2
2
|
export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
|
|
3
|
+
if (typeof data._available_max_amount === 'number') {
|
|
4
|
+
return data._available_max_amount;
|
|
5
|
+
}
|
|
3
6
|
return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
|
|
4
7
|
};
|
|
5
8
|
|
|
@@ -9,6 +9,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
9
9
|
private userIdentificationCodes;
|
|
10
10
|
private searchResults;
|
|
11
11
|
private walletParams;
|
|
12
|
+
private walletInitData;
|
|
12
13
|
constructor(paymentModule: PaymentModule);
|
|
13
14
|
/**
|
|
14
15
|
* 发送事件的辅助方法
|
|
@@ -37,7 +38,14 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
37
38
|
initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
|
|
38
39
|
walletRecommendList: WalletRecommendItem[];
|
|
39
40
|
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
41
|
+
transformList: any[];
|
|
42
|
+
noApplicableVoucher: any[];
|
|
43
|
+
products: any[];
|
|
40
44
|
}>;
|
|
45
|
+
/**
|
|
46
|
+
* 获取订单基础详情
|
|
47
|
+
*/
|
|
48
|
+
getOrderBasicDetailAsync(orderId: string): Promise<any>;
|
|
41
49
|
/**
|
|
42
50
|
* 初始化钱包数据
|
|
43
51
|
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
@@ -45,6 +53,9 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
45
53
|
initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
|
|
46
54
|
walletRecommendList: WalletRecommendItem[];
|
|
47
55
|
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
56
|
+
transformList: any[];
|
|
57
|
+
noApplicableVoucher: any[];
|
|
58
|
+
products: any[];
|
|
48
59
|
}>;
|
|
49
60
|
getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
|
|
50
61
|
formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
|
|
@@ -92,6 +103,18 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
92
103
|
* 清除搜索结果缓存
|
|
93
104
|
*/
|
|
94
105
|
clearSearchResults(): void;
|
|
106
|
+
/**
|
|
107
|
+
* 获取存储的钱包初始化数据
|
|
108
|
+
*/
|
|
109
|
+
getStoredWalletInitData(): {
|
|
110
|
+
transformList: any[];
|
|
111
|
+
noApplicableVoucher: any[];
|
|
112
|
+
products: any[];
|
|
113
|
+
} | null;
|
|
114
|
+
/**
|
|
115
|
+
* 清除存储的钱包初始化数据
|
|
116
|
+
*/
|
|
117
|
+
clearStoredWalletInitData(): void;
|
|
95
118
|
/**
|
|
96
119
|
* 清除所有缓存数据
|
|
97
120
|
*/
|