@pisell/pisellos 2.2.92 → 2.2.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/modules/Customer/index.d.ts +1 -0
- package/dist/modules/Customer/index.js +28 -12
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/modules/Customer/index.d.ts +1 -0
- package/lib/modules/Customer/index.js +21 -6
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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
|
/**
|
|
@@ -56,6 +56,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
56
56
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
57
57
|
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
58
58
|
_defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
59
60
|
return _this;
|
|
60
61
|
}
|
|
61
62
|
_createClass(CustomerModule, [{
|
|
@@ -70,6 +71,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
70
71
|
this.core = core;
|
|
71
72
|
this.store = options === null || options === void 0 ? void 0 : options.store;
|
|
72
73
|
this.request = this.core.getPlugin('request');
|
|
74
|
+
this.otherParams = (options === null || options === void 0 ? void 0 : options.otherParams) || {};
|
|
73
75
|
|
|
74
76
|
// 初始化状态
|
|
75
77
|
if (Array.isArray(options === null || options === void 0 || (_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.customerList)) {
|
|
@@ -112,7 +114,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
112
114
|
if (options !== null && options !== void 0 && (_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
|
|
113
115
|
this.fatherModule = options.otherParams.fatherModule;
|
|
114
116
|
}
|
|
115
|
-
case
|
|
117
|
+
case 14:
|
|
116
118
|
case "end":
|
|
117
119
|
return _context.stop();
|
|
118
120
|
}
|
|
@@ -132,7 +134,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
132
134
|
key: "fetchCustomerListData",
|
|
133
135
|
value: (function () {
|
|
134
136
|
var _fetchCustomerListData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
135
|
-
var _res$data, _res$data2;
|
|
137
|
+
var _this$otherParams, _res$data, _this$otherParams2, _customerList2, _res$data2;
|
|
136
138
|
var params,
|
|
137
139
|
url,
|
|
138
140
|
_params$skip,
|
|
@@ -140,16 +142,21 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
140
142
|
_params$num,
|
|
141
143
|
num,
|
|
142
144
|
search,
|
|
143
|
-
|
|
145
|
+
_otherParams,
|
|
144
146
|
queryParams,
|
|
145
147
|
res,
|
|
148
|
+
_customerList,
|
|
149
|
+
_customerList3,
|
|
146
150
|
_args2 = arguments;
|
|
147
151
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
148
152
|
while (1) switch (_context2.prev = _context2.next) {
|
|
149
153
|
case 0:
|
|
150
154
|
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
151
|
-
url = '/customer/select-list';
|
|
152
|
-
|
|
155
|
+
url = '/customer/select-list'; // 如果是加盟子店铺,则使用加盟商的客户列表接口
|
|
156
|
+
if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.isFranchisee) {
|
|
157
|
+
url = '/franchisee/customer/select-list';
|
|
158
|
+
}
|
|
159
|
+
_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);
|
|
153
160
|
queryParams = _objectSpread(_objectSpread({
|
|
154
161
|
skip: skip,
|
|
155
162
|
num: num,
|
|
@@ -159,29 +166,38 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
159
166
|
search_wallet_pass_flag: 1
|
|
160
167
|
}, search && {
|
|
161
168
|
search: search
|
|
162
|
-
}),
|
|
163
|
-
_context2.next =
|
|
169
|
+
}), _otherParams);
|
|
170
|
+
_context2.next = 7;
|
|
164
171
|
return this.request.get(url, queryParams, {
|
|
165
172
|
cache: {
|
|
166
173
|
mode: RequestModeENUM.REMOTE_LOCAL,
|
|
167
174
|
type: "memory"
|
|
168
175
|
}
|
|
169
176
|
});
|
|
170
|
-
case
|
|
177
|
+
case 7:
|
|
171
178
|
res = _context2.sent;
|
|
172
179
|
if (!((res === null || res === void 0 ? void 0 : res.code) !== 200)) {
|
|
173
|
-
_context2.next =
|
|
180
|
+
_context2.next = 10;
|
|
174
181
|
break;
|
|
175
182
|
}
|
|
176
183
|
throw new Error(res === null || res === void 0 ? void 0 : res.message);
|
|
177
|
-
case
|
|
184
|
+
case 10:
|
|
185
|
+
// 如果是加盟子店铺,查询的接口返回的数据都是总店的客户数据,需要加上标识
|
|
186
|
+
_customerList = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
|
|
187
|
+
if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.isFranchisee && ((_customerList2 = _customerList) === null || _customerList2 === void 0 ? void 0 : _customerList2.length) > 0) {
|
|
188
|
+
_customerList = (_customerList3 = _customerList) === null || _customerList3 === void 0 ? void 0 : _customerList3.map(function (item) {
|
|
189
|
+
return _objectSpread(_objectSpread({}, item || {}), {}, {
|
|
190
|
+
is_franchisor_customer: 1 // 标识是总店的客户
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
}
|
|
178
194
|
return _context2.abrupt("return", {
|
|
179
|
-
customerList:
|
|
195
|
+
customerList: _customerList,
|
|
180
196
|
total: (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.count) || 0,
|
|
181
197
|
page: skip,
|
|
182
198
|
pageSize: num
|
|
183
199
|
});
|
|
184
|
-
case
|
|
200
|
+
case 13:
|
|
185
201
|
case "end":
|
|
186
202
|
return _context2.stop();
|
|
187
203
|
}
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @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
|
/**
|
|
@@ -46,12 +46,14 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
46
46
|
searchParams: {}
|
|
47
47
|
};
|
|
48
48
|
this.openCache = false;
|
|
49
|
+
this.otherParams = {};
|
|
49
50
|
}
|
|
50
51
|
async initialize(core, options) {
|
|
51
52
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
52
53
|
this.core = core;
|
|
53
54
|
this.store = options == null ? void 0 : options.store;
|
|
54
55
|
this.request = this.core.getPlugin("request");
|
|
56
|
+
this.otherParams = (options == null ? void 0 : options.otherParams) || {};
|
|
55
57
|
if (Array.isArray((_a = options == null ? void 0 : options.initialState) == null ? void 0 : _a.customerList)) {
|
|
56
58
|
const customerList = (0, import_lodash_es.cloneDeep)(options.initialState.customerList || []);
|
|
57
59
|
this.store.customerList = customerList;
|
|
@@ -95,9 +97,12 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
95
97
|
* @returns API响应数据
|
|
96
98
|
*/
|
|
97
99
|
async fetchCustomerListData(params = {}) {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
var _a, _b, _c, _d;
|
|
101
|
+
let url = "/customer/select-list";
|
|
102
|
+
if ((_a = this.otherParams) == null ? void 0 : _a.isFranchisee) {
|
|
103
|
+
url = "/franchisee/customer/select-list";
|
|
104
|
+
}
|
|
105
|
+
const { skip = 1, num = import_constants.DEFAULT_PAGE_SIZE, search, ..._otherParams } = params;
|
|
101
106
|
const queryParams = {
|
|
102
107
|
skip,
|
|
103
108
|
num,
|
|
@@ -106,7 +111,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
106
111
|
search_wallet_flag: 1,
|
|
107
112
|
search_wallet_pass_flag: 1,
|
|
108
113
|
...search && { search },
|
|
109
|
-
...
|
|
114
|
+
..._otherParams
|
|
110
115
|
};
|
|
111
116
|
const res = await this.request.get(url, queryParams, {
|
|
112
117
|
cache: {
|
|
@@ -117,9 +122,19 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
117
122
|
if ((res == null ? void 0 : res.code) !== 200) {
|
|
118
123
|
throw new Error(res == null ? void 0 : res.message);
|
|
119
124
|
}
|
|
125
|
+
let _customerList = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || [];
|
|
126
|
+
if (((_c = this.otherParams) == null ? void 0 : _c.isFranchisee) && (_customerList == null ? void 0 : _customerList.length) > 0) {
|
|
127
|
+
_customerList = _customerList == null ? void 0 : _customerList.map((item) => {
|
|
128
|
+
return {
|
|
129
|
+
...item || {},
|
|
130
|
+
is_franchisor_customer: 1
|
|
131
|
+
// 标识是总店的客户
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
}
|
|
120
135
|
return {
|
|
121
|
-
customerList:
|
|
122
|
-
total: ((
|
|
136
|
+
customerList: _customerList,
|
|
137
|
+
total: ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.count) || 0,
|
|
123
138
|
page: skip,
|
|
124
139
|
pageSize: num
|
|
125
140
|
};
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|