@pisell/pisellos 2.1.91 → 2.1.93
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/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +17 -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/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.d.ts +9 -5
- package/dist/modules/Rules/index.js +538 -118
- package/dist/modules/Rules/types.d.ts +1 -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 +2 -1
- package/dist/solution/Checkout/index.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +146 -92
- package/dist/solution/ShopDiscount/types.d.ts +1 -0
- package/dist/solution/ShopDiscount/types.js +2 -1
- package/dist/solution/ShopDiscount/utils.js +26 -12
- 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/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +17 -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/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.d.ts +9 -5
- package/lib/modules/Rules/index.js +669 -258
- package/lib/modules/Rules/types.d.ts +1 -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 +2 -1
- package/lib/solution/Checkout/index.js +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +36 -8
- package/lib/solution/ShopDiscount/types.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +10 -6
- package/package.json +1 -1
|
@@ -208,6 +208,35 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
208
208
|
}
|
|
209
209
|
return batchSearch;
|
|
210
210
|
}()
|
|
211
|
+
}, {
|
|
212
|
+
key: "batchSearchByProductIds",
|
|
213
|
+
value: function () {
|
|
214
|
+
var _batchSearchByProductIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(productIds) {
|
|
215
|
+
var result;
|
|
216
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
217
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
218
|
+
case 0:
|
|
219
|
+
_context6.next = 2;
|
|
220
|
+
return this.request.get("/machinecode/batch-search", {
|
|
221
|
+
ids: productIds,
|
|
222
|
+
translate_flag: 1,
|
|
223
|
+
tags: ['good_pass', 'product_discount_card'],
|
|
224
|
+
relation_product: 1
|
|
225
|
+
});
|
|
226
|
+
case 2:
|
|
227
|
+
result = _context6.sent;
|
|
228
|
+
return _context6.abrupt("return", (result === null || result === void 0 ? void 0 : result.data) || []);
|
|
229
|
+
case 4:
|
|
230
|
+
case "end":
|
|
231
|
+
return _context6.stop();
|
|
232
|
+
}
|
|
233
|
+
}, _callee6, this);
|
|
234
|
+
}));
|
|
235
|
+
function batchSearchByProductIds(_x8) {
|
|
236
|
+
return _batchSearchByProductIds.apply(this, arguments);
|
|
237
|
+
}
|
|
238
|
+
return batchSearchByProductIds;
|
|
239
|
+
}()
|
|
211
240
|
}, {
|
|
212
241
|
key: "filterEnabledDiscountList",
|
|
213
242
|
value: function filterEnabledDiscountList(discountList) {
|
|
@@ -309,21 +338,21 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
309
338
|
}, {
|
|
310
339
|
key: "destroy",
|
|
311
340
|
value: function () {
|
|
312
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
313
|
-
return _regeneratorRuntime().wrap(function
|
|
314
|
-
while (1) switch (
|
|
341
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
342
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
343
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
315
344
|
case 0:
|
|
316
345
|
this.store.discountList = [];
|
|
317
346
|
this.core.effects.offByModuleDestroy(this.name);
|
|
318
|
-
|
|
347
|
+
_context7.next = 4;
|
|
319
348
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
320
349
|
case 4:
|
|
321
350
|
console.log('[Discount] 已销毁');
|
|
322
351
|
case 5:
|
|
323
352
|
case "end":
|
|
324
|
-
return
|
|
353
|
+
return _context7.stop();
|
|
325
354
|
}
|
|
326
|
-
},
|
|
355
|
+
}, _callee7, this);
|
|
327
356
|
}));
|
|
328
357
|
function destroy() {
|
|
329
358
|
return _destroy.apply(this, arguments);
|
|
@@ -333,18 +362,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
333
362
|
}, {
|
|
334
363
|
key: "clear",
|
|
335
364
|
value: function () {
|
|
336
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
337
|
-
return _regeneratorRuntime().wrap(function
|
|
338
|
-
while (1) switch (
|
|
365
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
366
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
367
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
339
368
|
case 0:
|
|
340
369
|
this.store.discountList = [];
|
|
341
370
|
this.store.originalDiscountList = [];
|
|
342
371
|
console.log('[Discount] clear');
|
|
343
372
|
case 3:
|
|
344
373
|
case "end":
|
|
345
|
-
return
|
|
374
|
+
return _context8.stop();
|
|
346
375
|
}
|
|
347
|
-
},
|
|
376
|
+
}, _callee8, this);
|
|
348
377
|
}));
|
|
349
378
|
function clear() {
|
|
350
379
|
return _clear.apply(this, arguments);
|
|
@@ -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;
|
|
@@ -81,6 +83,7 @@ export interface Discount {
|
|
|
81
83
|
balance: string;
|
|
82
84
|
format_title: Formattitle;
|
|
83
85
|
metadata?: {
|
|
86
|
+
num?: number;
|
|
84
87
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
85
88
|
custom_product_bundle_map_id?: string;
|
|
86
89
|
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
@@ -105,6 +108,19 @@ export interface Discount {
|
|
|
105
108
|
isSelected?: boolean;
|
|
106
109
|
isAvailable?: boolean;
|
|
107
110
|
isUsed?: boolean;
|
|
111
|
+
config?: {
|
|
112
|
+
isAvailable?: boolean;
|
|
113
|
+
/** 最大抵扣金额 */
|
|
114
|
+
maxDeductionAmount?: number;
|
|
115
|
+
/** 每单最多使用张数 */
|
|
116
|
+
maxUsagePerOrder?: number;
|
|
117
|
+
/** 是否抵扣税费与附加费 */
|
|
118
|
+
deductTaxAndFee?: boolean;
|
|
119
|
+
/** 适用粒度(多商品共用) */
|
|
120
|
+
allowCrossProduct?: boolean;
|
|
121
|
+
/** 可用商品数量上限 */
|
|
122
|
+
applicableProductLimit?: number;
|
|
123
|
+
};
|
|
108
124
|
applicableProductIds?: number[];
|
|
109
125
|
applicableProductDetails: ApplicableProductDetails[];
|
|
110
126
|
appliedProductDetails: ApplicableProductDetails[];
|
|
@@ -122,6 +138,7 @@ export interface Discount {
|
|
|
122
138
|
num?: number;
|
|
123
139
|
start_date?: string;
|
|
124
140
|
start_time?: string;
|
|
141
|
+
discount_rule_uncheck_flag?: boolean;
|
|
125
142
|
}
|
|
126
143
|
export interface DiscountState {
|
|
127
144
|
discountList: Discount[];
|
|
@@ -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
|
*/
|