@pisell/pisellos 2.2.42 → 2.2.43
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 +497 -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 +165 -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/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 +196 -95
- package/dist/modules/Rules/index.d.ts +8 -3
- package/dist/modules/Rules/index.js +143 -23
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +0 -9
- package/dist/modules/Schedule/index.js +2 -18
- 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/Checkout/index.js +24 -23
- package/dist/solution/RegisterAndLogin/config.js +1 -339
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +13 -3
- package/dist/solution/ShopDiscount/types.d.ts +1 -0
- 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 +421 -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 +165 -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/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 +99 -17
- package/lib/modules/Rules/index.d.ts +8 -3
- package/lib/modules/Rules/index.js +352 -187
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +0 -9
- package/lib/modules/Schedule/index.js +0 -11
- 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/Checkout/index.js +3 -3
- package/lib/solution/RegisterAndLogin/config.js +1 -265
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +8 -2
- package/lib/solution/ShopDiscount/types.d.ts +1 -0
- 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;
|
|
@@ -105,6 +107,19 @@ export interface Discount {
|
|
|
105
107
|
isSelected?: boolean;
|
|
106
108
|
isAvailable?: boolean;
|
|
107
109
|
isUsed?: boolean;
|
|
110
|
+
config?: {
|
|
111
|
+
isAvailable?: boolean;
|
|
112
|
+
/** 最大抵扣金额 */
|
|
113
|
+
maxDeductionAmount?: number;
|
|
114
|
+
/** 每单最多使用张数 */
|
|
115
|
+
maxUsagePerOrder?: number;
|
|
116
|
+
/** 是否抵扣税费与附加费 */
|
|
117
|
+
deductTaxAndFee?: boolean;
|
|
118
|
+
/** 适用粒度(多商品共用) */
|
|
119
|
+
allowCrossProduct?: boolean;
|
|
120
|
+
/** 可用商品数量上限 */
|
|
121
|
+
applicableProductLimit?: number;
|
|
122
|
+
};
|
|
108
123
|
applicableProductIds?: number[];
|
|
109
124
|
applicableProductDetails: ApplicableProductDetails[];
|
|
110
125
|
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
|
private voucherUpdateLockByOrderUuid;
|
|
@@ -96,6 +96,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
96
96
|
_defineProperty(_assertThisInitialized(_this), "app", void 0);
|
|
97
97
|
// App instance
|
|
98
98
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
100
|
+
// WindowPlugin 实例
|
|
99
101
|
_defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
|
|
100
102
|
// IndexDBManager 实例
|
|
101
103
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
@@ -170,26 +172,27 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
170
172
|
// 获取依赖的插件
|
|
171
173
|
this.request = core.getPlugin('request');
|
|
172
174
|
appPlugin = core.getPlugin('app');
|
|
175
|
+
this.window = core.getPlugin('window');
|
|
173
176
|
if (this.request) {
|
|
174
|
-
_context.next =
|
|
177
|
+
_context.next = 8;
|
|
175
178
|
break;
|
|
176
179
|
}
|
|
177
180
|
throw new Error('支付模块需要 request 插件支持');
|
|
178
|
-
case
|
|
181
|
+
case 8:
|
|
179
182
|
if (appPlugin) {
|
|
180
|
-
_context.next =
|
|
183
|
+
_context.next = 10;
|
|
181
184
|
break;
|
|
182
185
|
}
|
|
183
186
|
throw new Error('支付模块需要 app 插件支持');
|
|
184
|
-
case
|
|
187
|
+
case 10:
|
|
185
188
|
this.app = appPlugin.getApp();
|
|
186
189
|
this.dbManager = this.app.dbManager;
|
|
187
190
|
this.logger = this.app.logger;
|
|
188
191
|
|
|
189
192
|
// 确保支付模块所需的对象存储已创建
|
|
190
|
-
_context.next =
|
|
193
|
+
_context.next = 15;
|
|
191
194
|
return this.ensurePaymentTables();
|
|
192
|
-
case
|
|
195
|
+
case 15:
|
|
193
196
|
this.registerNetworkHandlers();
|
|
194
197
|
|
|
195
198
|
// // 预连接数据库
|
|
@@ -197,7 +200,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
197
200
|
|
|
198
201
|
console.log('[PaymentModule] 初始化完成');
|
|
199
202
|
this.logInfo('PaymentModule initialized successfully');
|
|
200
|
-
case
|
|
203
|
+
case 18:
|
|
201
204
|
case "end":
|
|
202
205
|
return _context.stop();
|
|
203
206
|
}
|
|
@@ -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
|
*/
|