@pisell/pisellos 2.1.104 → 2.1.106

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.
@@ -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
  }
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -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
  /**
@@ -45,12 +45,14 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
45
45
  searchParams: {}
46
46
  };
47
47
  this.openCache = false;
48
+ this.otherParams = {};
48
49
  }
49
50
  async initialize(core, options) {
50
51
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
51
52
  this.core = core;
52
53
  this.store = options == null ? void 0 : options.store;
53
54
  this.request = this.core.getPlugin("request");
55
+ this.otherParams = (options == null ? void 0 : options.otherParams) || {};
54
56
  if (Array.isArray((_a = options == null ? void 0 : options.initialState) == null ? void 0 : _a.customerList)) {
55
57
  const customerList = (0, import_lodash_es.cloneDeep)(options.initialState.customerList || []);
56
58
  this.store.customerList = customerList;
@@ -94,9 +96,12 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
94
96
  * @returns API响应数据
95
97
  */
96
98
  async fetchCustomerListData(params = {}) {
97
- var _a, _b;
98
- const url = "/customer/select-list";
99
- const { skip = 1, num = import_constants.DEFAULT_PAGE_SIZE, search, ...otherParams } = params;
99
+ var _a, _b, _c, _d;
100
+ let url = "/customer/select-list";
101
+ if ((_a = this.otherParams) == null ? void 0 : _a.isFranchisee) {
102
+ url = "/franchisee/customer/select-list";
103
+ }
104
+ const { skip = 1, num = import_constants.DEFAULT_PAGE_SIZE, search, ..._otherParams } = params;
100
105
  const queryParams = {
101
106
  skip,
102
107
  num,
@@ -105,15 +110,25 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
105
110
  search_wallet_flag: 1,
106
111
  search_wallet_pass_flag: 1,
107
112
  ...search && { search },
108
- ...otherParams
113
+ ..._otherParams
109
114
  };
110
115
  const res = await this.request.get(url, queryParams);
111
116
  if ((res == null ? void 0 : res.code) !== 200) {
112
117
  throw new Error(res == null ? void 0 : res.message);
113
118
  }
119
+ let _customerList = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || [];
120
+ if (((_c = this.otherParams) == null ? void 0 : _c.isFranchisee) && (_customerList == null ? void 0 : _customerList.length) > 0) {
121
+ _customerList = _customerList == null ? void 0 : _customerList.map((item) => {
122
+ return {
123
+ ...item || {},
124
+ is_franchisor_customer: 1
125
+ // 标识是总店的客户
126
+ };
127
+ });
128
+ }
114
129
  return {
115
- customerList: ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [],
116
- total: ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.count) || 0,
130
+ customerList: _customerList,
131
+ total: ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.count) || 0,
117
132
  page: skip,
118
133
  pageSize: num
119
134
  };
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.104",
4
+ "version": "2.1.106",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",