@pisell/pisellos 2.1.104 → 2.1.105

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.
Files changed (102) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/modules/Cart/types.d.ts +0 -2
  4. package/dist/modules/Cart/utils/cartProduct.js +0 -11
  5. package/dist/modules/Customer/index.d.ts +1 -0
  6. package/dist/modules/Customer/index.js +28 -12
  7. package/dist/modules/Discount/types.d.ts +0 -16
  8. package/dist/modules/Payment/index.d.ts +1 -2
  9. package/dist/modules/Payment/index.js +7 -10
  10. package/dist/modules/Payment/utils.js +0 -3
  11. package/dist/modules/Payment/walletpass.d.ts +0 -23
  12. package/dist/modules/Payment/walletpass.js +95 -191
  13. package/dist/modules/Rules/index.d.ts +5 -9
  14. package/dist/modules/Rules/index.js +123 -538
  15. package/dist/modules/Rules/types.d.ts +0 -1
  16. package/dist/modules/Summary/types.d.ts +0 -2
  17. package/dist/modules/Summary/utils.d.ts +0 -6
  18. package/dist/modules/Summary/utils.js +0 -21
  19. package/dist/plugins/window.d.ts +0 -2
  20. package/dist/solution/BookingByStep/index.d.ts +0 -1
  21. package/dist/solution/BookingTicket/index.d.ts +1 -1
  22. package/dist/solution/Checkout/index.js +0 -2
  23. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  24. package/dist/solution/ShopDiscount/index.js +7 -23
  25. package/dist/solution/ShopDiscount/types.d.ts +0 -1
  26. package/dist/solution/ShopDiscount/types.js +1 -2
  27. package/dist/solution/ShopDiscount/utils.js +12 -26
  28. package/lib/index.d.ts +0 -1
  29. package/lib/index.js +1 -3
  30. package/lib/modules/Cart/types.d.ts +0 -2
  31. package/lib/modules/Cart/utils/cartProduct.js +0 -9
  32. package/lib/modules/Customer/index.d.ts +1 -0
  33. package/lib/modules/Customer/index.js +21 -6
  34. package/lib/modules/Discount/types.d.ts +0 -16
  35. package/lib/modules/Payment/index.d.ts +1 -2
  36. package/lib/modules/Payment/index.js +0 -1
  37. package/lib/modules/Payment/utils.js +0 -3
  38. package/lib/modules/Payment/walletpass.d.ts +0 -23
  39. package/lib/modules/Payment/walletpass.js +17 -94
  40. package/lib/modules/Rules/index.d.ts +5 -9
  41. package/lib/modules/Rules/index.js +258 -666
  42. package/lib/modules/Rules/types.d.ts +0 -1
  43. package/lib/modules/Summary/types.d.ts +0 -2
  44. package/lib/modules/Summary/utils.d.ts +0 -6
  45. package/lib/modules/Summary/utils.js +0 -15
  46. package/lib/plugins/window.d.ts +0 -2
  47. package/lib/solution/BookingByStep/index.d.ts +0 -1
  48. package/lib/solution/BookingTicket/index.d.ts +1 -1
  49. package/lib/solution/Checkout/index.js +0 -2
  50. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  51. package/lib/solution/ShopDiscount/index.js +8 -22
  52. package/lib/solution/ShopDiscount/types.d.ts +0 -1
  53. package/lib/solution/ShopDiscount/utils.js +6 -10
  54. package/package.json +1 -1
  55. package/dist/model/index.d.ts +0 -1
  56. package/dist/model/index.js +0 -1
  57. package/dist/model/strategy/adapter/index.d.ts +0 -3
  58. package/dist/model/strategy/adapter/index.js +0 -4
  59. package/dist/model/strategy/adapter/type.d.ts +0 -28
  60. package/dist/model/strategy/adapter/type.js +0 -1
  61. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  62. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -498
  63. package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
  64. package/dist/model/strategy/adapter/walletPass/example.js +0 -258
  65. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  66. package/dist/model/strategy/adapter/walletPass/index.js +0 -182
  67. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  68. package/dist/model/strategy/adapter/walletPass/locales.js +0 -26
  69. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -169
  70. package/dist/model/strategy/adapter/walletPass/type.js +0 -1
  71. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  72. package/dist/model/strategy/adapter/walletPass/utils.js +0 -1064
  73. package/dist/model/strategy/index.d.ts +0 -94
  74. package/dist/model/strategy/index.js +0 -551
  75. package/dist/model/strategy/strategy-example.d.ts +0 -5
  76. package/dist/model/strategy/strategy-example.js +0 -331
  77. package/dist/model/strategy/type.d.ts +0 -228
  78. package/dist/model/strategy/type.js +0 -94
  79. package/lib/model/index.d.ts +0 -1
  80. package/lib/model/index.js +0 -23
  81. package/lib/model/strategy/adapter/index.d.ts +0 -3
  82. package/lib/model/strategy/adapter/index.js +0 -45
  83. package/lib/model/strategy/adapter/type.d.ts +0 -28
  84. package/lib/model/strategy/adapter/type.js +0 -17
  85. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  86. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -422
  87. package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
  88. package/lib/model/strategy/adapter/walletPass/example.js +0 -207
  89. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  90. package/lib/model/strategy/adapter/walletPass/index.js +0 -142
  91. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  92. package/lib/model/strategy/adapter/walletPass/locales.js +0 -54
  93. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -169
  94. package/lib/model/strategy/adapter/walletPass/type.js +0 -17
  95. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  96. package/lib/model/strategy/adapter/walletPass/utils.js +0 -720
  97. package/lib/model/strategy/index.d.ts +0 -94
  98. package/lib/model/strategy/index.js +0 -413
  99. package/lib/model/strategy/strategy-example.d.ts +0 -5
  100. package/lib/model/strategy/strategy-example.js +0 -318
  101. package/lib/model/strategy/type.d.ts +0 -228
  102. package/lib/model/strategy/type.js +0 -44
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './types';
6
6
  export * from './modules';
7
7
  export * from './plugins';
8
8
  export * from './solution';
9
- export * from './model';
10
9
  export { PisellOSCore } from './core';
11
10
  import PisellOSCore from './core';
12
11
  export default PisellOSCore;
package/dist/index.js CHANGED
@@ -8,7 +8,6 @@ export * from "./types";
8
8
  export * from "./modules";
9
9
  export * from "./plugins";
10
10
  export * from "./solution";
11
- export * from "./model";
12
11
 
13
12
  // 导出核心实现
14
13
  export { PisellOSCore } from "./core";
@@ -75,8 +75,6 @@ export interface CartItem {
75
75
  summaryTotal?: number | string;
76
76
  /** 商品原价总价,排除原始价格为0的场景 */
77
77
  origin_total?: number | string;
78
- /** 基于 origin_total 乘以 商品数量的价格 */
79
- summaryOriginTotal?: number | string;
80
78
  /** 商品数量 */
81
79
  num?: number;
82
80
  /** 商品图片 */
@@ -58,7 +58,6 @@ export var formatProductToCartItem = function formatProductToCartItem(params) {
58
58
  quantity = _params$quantity === void 0 ? 1 : _params$quantity,
59
59
  discounts = params.discounts;
60
60
  var num = quantity; // 当前按照单个商品加入购物车
61
-
62
61
  if (product) {
63
62
  cartItem.id = product === null || product === void 0 ? void 0 : product.id;
64
63
  cartItem.name = product === null || product === void 0 ? void 0 : product.title;
@@ -84,15 +83,6 @@ export var formatProductToCartItem = function formatProductToCartItem(params) {
84
83
  num: num,
85
84
  discounts: discounts
86
85
  });
87
- // 不包含折扣卡商品券的总价
88
- var origin_total = getProductTotalPrice({
89
- product: cartItem._productInit || cartItem._productOrigin,
90
- bundle: bundle,
91
- options: options,
92
- num: num,
93
- discounts: []
94
- });
95
- cartItem.summaryOriginTotal = (origin_total || 0) * (num || 1);
96
86
  cartItem.image = product === null || product === void 0 ? void 0 : product.cover;
97
87
  cartItem.like_status = 'common';
98
88
  cartItem.duration = product === null || product === void 0 ? void 0 : product.duration;
@@ -213,7 +203,6 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
213
203
  amount: currentValue.amount,
214
204
  tag: currentValue.type,
215
205
  par_value: currentValue.discount.percent,
216
- config: currentValue.config,
217
206
  metadata: {
218
207
  discount_card_type: currentValue === null || currentValue === void 0 || (_currentValue$discoun = currentValue.discount) === null || _currentValue$discoun === void 0 ? void 0 : _currentValue$discoun.discount_card_type
219
208
  }
@@ -9,6 +9,7 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
9
9
  private cacheId;
10
10
  private openCache;
11
11
  private fatherModule;
12
+ private otherParams;
12
13
  constructor(name?: string, version?: string);
13
14
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
14
15
  /**
@@ -55,6 +55,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
55
55
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
56
56
  _defineProperty(_assertThisInitialized(_this), "openCache", false);
57
57
  _defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
58
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
58
59
  return _this;
59
60
  }
60
61
  _createClass(CustomerModule, [{
@@ -69,6 +70,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
69
70
  this.core = core;
70
71
  this.store = options === null || options === void 0 ? void 0 : options.store;
71
72
  this.request = this.core.getPlugin('request');
73
+ this.otherParams = (options === null || options === void 0 ? void 0 : options.otherParams) || {};
72
74
 
73
75
  // 初始化状态
74
76
  if (Array.isArray(options === null || options === void 0 || (_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.customerList)) {
@@ -111,7 +113,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
111
113
  if (options !== null && options !== void 0 && (_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
112
114
  this.fatherModule = options.otherParams.fatherModule;
113
115
  }
114
- case 13:
116
+ case 14:
115
117
  case "end":
116
118
  return _context.stop();
117
119
  }
@@ -131,7 +133,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
131
133
  key: "fetchCustomerListData",
132
134
  value: (function () {
133
135
  var _fetchCustomerListData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
134
- var _res$data, _res$data2;
136
+ var _this$otherParams, _res$data, _this$otherParams2, _customerList2, _res$data2;
135
137
  var params,
136
138
  url,
137
139
  _params$skip,
@@ -139,16 +141,21 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
139
141
  _params$num,
140
142
  num,
141
143
  search,
142
- otherParams,
144
+ _otherParams,
143
145
  queryParams,
144
146
  res,
147
+ _customerList,
148
+ _customerList3,
145
149
  _args2 = arguments;
146
150
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
147
151
  while (1) switch (_context2.prev = _context2.next) {
148
152
  case 0:
149
153
  params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
150
- url = '/customer/select-list';
151
- _params$skip = params.skip, skip = _params$skip === void 0 ? 1 : _params$skip, _params$num = params.num, num = _params$num === void 0 ? DEFAULT_PAGE_SIZE : _params$num, search = params.search, otherParams = _objectWithoutProperties(params, _excluded);
154
+ url = '/customer/select-list'; // 如果是加盟子店铺,则使用加盟商的客户列表接口
155
+ if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.isFranchisee) {
156
+ url = '/franchisee/customer/select-list';
157
+ }
158
+ _params$skip = params.skip, skip = _params$skip === void 0 ? 1 : _params$skip, _params$num = params.num, num = _params$num === void 0 ? DEFAULT_PAGE_SIZE : _params$num, search = params.search, _otherParams = _objectWithoutProperties(params, _excluded);
152
159
  queryParams = _objectSpread(_objectSpread({
153
160
  skip: skip,
154
161
  num: num,
@@ -158,24 +165,33 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
158
165
  search_wallet_pass_flag: 1
159
166
  }, search && {
160
167
  search: search
161
- }), otherParams);
162
- _context2.next = 6;
168
+ }), _otherParams);
169
+ _context2.next = 7;
163
170
  return this.request.get(url, queryParams);
164
- case 6:
171
+ case 7:
165
172
  res = _context2.sent;
166
173
  if (!((res === null || res === void 0 ? void 0 : res.code) !== 200)) {
167
- _context2.next = 9;
174
+ _context2.next = 10;
168
175
  break;
169
176
  }
170
177
  throw new Error(res === null || res === void 0 ? void 0 : res.message);
171
- case 9:
178
+ case 10:
179
+ // 如果是加盟子店铺,查询的接口返回的数据都是总店的客户数据,需要加上标识
180
+ _customerList = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
181
+ if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.isFranchisee && ((_customerList2 = _customerList) === null || _customerList2 === void 0 ? void 0 : _customerList2.length) > 0) {
182
+ _customerList = (_customerList3 = _customerList) === null || _customerList3 === void 0 ? void 0 : _customerList3.map(function (item) {
183
+ return _objectSpread(_objectSpread({}, item || {}), {}, {
184
+ is_franchisor_customer: 1 // 标识是总店的客户
185
+ });
186
+ });
187
+ }
172
188
  return _context2.abrupt("return", {
173
- customerList: (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [],
189
+ customerList: _customerList,
174
190
  total: (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.count) || 0,
175
191
  page: skip,
176
192
  pageSize: num
177
193
  });
178
- case 10:
194
+ case 13:
179
195
  case "end":
180
196
  return _context2.stop();
181
197
  }
@@ -25,8 +25,6 @@ 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[];
30
28
  }
31
29
  interface ApplicableProductDetails {
32
30
  amount: string;
@@ -83,7 +81,6 @@ export interface Discount {
83
81
  balance: string;
84
82
  format_title: Formattitle;
85
83
  metadata?: {
86
- num?: number;
87
84
  discount_card_type?: 'fixed_amount' | 'percent';
88
85
  custom_product_bundle_map_id?: string;
89
86
  validity_type?: "custom_schedule_validity" | "fixed_validity";
@@ -108,19 +105,6 @@ export interface Discount {
108
105
  isSelected?: boolean;
109
106
  isAvailable?: boolean;
110
107
  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
- };
124
108
  applicableProductIds?: number[];
125
109
  applicableProductDetails: ApplicableProductDetails[];
126
110
  appliedProductDetails: ApplicableProductDetails[];
@@ -1,5 +1,5 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
- import { RequestPlugin, WindowPlugin } from '../../plugins';
2
+ import { RequestPlugin } 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,7 +21,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
21
21
  request: RequestPlugin;
22
22
  private app;
23
23
  private store;
24
- window: WindowPlugin;
25
24
  private dbManager;
26
25
  private logger;
27
26
  protected otherParams: any;
@@ -81,8 +81,6 @@ 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 实例
86
84
  _defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
87
85
  // IndexDBManager 实例
88
86
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
@@ -112,27 +110,26 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
112
110
  // 获取依赖的插件
113
111
  this.request = core.getPlugin('request');
114
112
  appPlugin = core.getPlugin('app');
115
- this.window = core.getPlugin('window');
116
113
  if (this.request) {
117
- _context.next = 8;
114
+ _context.next = 7;
118
115
  break;
119
116
  }
120
117
  throw new Error('支付模块需要 request 插件支持');
121
- case 8:
118
+ case 7:
122
119
  if (appPlugin) {
123
- _context.next = 10;
120
+ _context.next = 9;
124
121
  break;
125
122
  }
126
123
  throw new Error('支付模块需要 app 插件支持');
127
- case 10:
124
+ case 9:
128
125
  this.app = appPlugin.getApp();
129
126
  this.dbManager = this.app.dbManager;
130
127
  this.logger = this.app.logger;
131
128
 
132
129
  // 确保支付模块所需的对象存储已创建
133
- _context.next = 15;
130
+ _context.next = 14;
134
131
  return this.ensurePaymentTables();
135
- case 15:
132
+ case 14:
136
133
  this.registerNetworkHandlers();
137
134
 
138
135
  // // 预连接数据库
@@ -140,7 +137,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
140
137
 
141
138
  console.log('[PaymentModule] 初始化完成');
142
139
  this.logInfo('PaymentModule initialized successfully');
143
- case 18:
140
+ case 17:
144
141
  case "end":
145
142
  return _context.stop();
146
143
  }
@@ -1,8 +1,5 @@
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
- }
6
3
  return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
7
4
  };
8
5
 
@@ -9,7 +9,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
9
9
  private userIdentificationCodes;
10
10
  private searchResults;
11
11
  private walletParams;
12
- private walletInitData;
13
12
  constructor(paymentModule: PaymentModule);
14
13
  /**
15
14
  * 发送事件的辅助方法
@@ -38,14 +37,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
38
37
  initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
39
38
  walletRecommendList: WalletRecommendItem[];
40
39
  userIdentificationCodes: UserIdentificationCodeItem[];
41
- transformList: any[];
42
- noApplicableVoucher: any[];
43
- products: any[];
44
40
  }>;
45
- /**
46
- * 获取订单基础详情
47
- */
48
- getOrderBasicDetailAsync(orderId: string): Promise<any>;
49
41
  /**
50
42
  * 初始化钱包数据
51
43
  * 先获取推荐列表,再获取用户识别码列表(顺序执行)
@@ -53,9 +45,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
53
45
  initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
54
46
  walletRecommendList: WalletRecommendItem[];
55
47
  userIdentificationCodes: UserIdentificationCodeItem[];
56
- transformList: any[];
57
- noApplicableVoucher: any[];
58
- products: any[];
59
48
  }>;
60
49
  getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
61
50
  formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
@@ -103,18 +92,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
103
92
  * 清除搜索结果缓存
104
93
  */
105
94
  clearSearchResults(): void;
106
- /**
107
- * 获取存储的钱包初始化数据
108
- */
109
- getStoredWalletInitData(): {
110
- transformList: any[];
111
- noApplicableVoucher: any[];
112
- products: any[];
113
- } | null;
114
- /**
115
- * 清除存储的钱包初始化数据
116
- */
117
- clearStoredWalletInitData(): void;
118
95
  /**
119
96
  * 清除所有缓存数据
120
97
  */