@pisell/pisellos 2.1.103 → 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.
- package/dist/modules/Customer/index.d.ts +1 -0
- package/dist/modules/Customer/index.js +28 -12
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +7 -6
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/Checkout/index.js +1 -1
- package/lib/modules/Customer/index.d.ts +1 -0
- package/lib/modules/Customer/index.js +21 -6
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +5 -4
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/Checkout/index.js +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
|
/**
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}),
|
|
162
|
-
_context2.next =
|
|
168
|
+
}), _otherParams);
|
|
169
|
+
_context2.next = 7;
|
|
163
170
|
return this.request.get(url, queryParams);
|
|
164
|
-
case
|
|
171
|
+
case 7:
|
|
165
172
|
res = _context2.sent;
|
|
166
173
|
if (!((res === null || res === void 0 ? void 0 : res.code) !== 200)) {
|
|
167
|
-
_context2.next =
|
|
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
|
|
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:
|
|
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
|
|
194
|
+
case 13:
|
|
179
195
|
case "end":
|
|
180
196
|
return _context2.stop();
|
|
181
197
|
}
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -1058,22 +1058,23 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1058
1058
|
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1059
1059
|
}))]);
|
|
1060
1060
|
} else {
|
|
1061
|
-
var _ref8, _product$_promotion$f, _product13, _product$origin_total, _product$
|
|
1061
|
+
var _ref8, _product$_promotion$f, _product13, _product$origin_total, _product$price2;
|
|
1062
1062
|
var total = product.inPromotion ? (_ref8 = (_product$_promotion$f = (_product13 = product) === null || _product13 === void 0 || (_product13 = _product13._promotion) === null || _product13 === void 0 ? void 0 : _product13.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref8 !== void 0 ? _ref8 : product.total : (_product$origin_total = product.origin_total) !== null && _product$origin_total !== void 0 ? _product$origin_total : product.total;
|
|
1063
|
+
var main_product_selling_price = (_product$price2 = product.price) !== null && _product$price2 !== void 0 ? _product$price2 : product.main_product_selling_price;
|
|
1063
1064
|
if ((product.discount_list || []).some(function (item) {
|
|
1064
1065
|
return item.type === 'promotion';
|
|
1065
|
-
})) {
|
|
1066
|
-
var _product$total;
|
|
1066
|
+
}) || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
1067
|
+
var _product$total, _product$main_product;
|
|
1067
1068
|
total = (_product$total = product.total) !== null && _product$total !== void 0 ? _product$total : product.origin_total;
|
|
1069
|
+
main_product_selling_price = (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : main_product_selling_price;
|
|
1068
1070
|
}
|
|
1069
1071
|
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
|
|
1070
|
-
price: product.price
|
|
1071
|
-
main_product_selling_price: (_product$main_product = product.main_product_selling_price) !== null && _product$main_product !== void 0 ? _product$main_product : product.price
|
|
1072
|
+
price: product.price
|
|
1072
1073
|
} : {
|
|
1073
1074
|
_id: product._id.split('___')[0] + '___' + index,
|
|
1074
1075
|
total: total,
|
|
1075
1076
|
price: product.price,
|
|
1076
|
-
main_product_selling_price:
|
|
1077
|
+
main_product_selling_price: main_product_selling_price
|
|
1077
1078
|
}), {}, {
|
|
1078
1079
|
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1079
1080
|
}))]);
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -425,7 +425,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
425
425
|
// 可选,附加费均摊舍入金额
|
|
426
426
|
"surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
|
|
427
427
|
},
|
|
428
|
-
product_bundle: item.product_bundle.map(function (bundle) {
|
|
428
|
+
product_bundle: (item.product_bundle || []).map(function (bundle) {
|
|
429
429
|
return {
|
|
430
430
|
bundle_id: bundle.bundle_id,
|
|
431
431
|
bundle_product_id: bundle.bundle_product_id,
|
|
@@ -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
|
-
|
|
99
|
-
|
|
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
|
-
...
|
|
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:
|
|
116
|
-
total: ((
|
|
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
|
};
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -738,20 +738,21 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
738
738
|
);
|
|
739
739
|
} else {
|
|
740
740
|
let total = product.inPromotion ? ((_u = product == null ? void 0 : product._promotion) == null ? void 0 : _u.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
|
|
741
|
-
|
|
741
|
+
let main_product_selling_price = product.price ?? product.main_product_selling_price;
|
|
742
|
+
if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
742
743
|
total = product.total ?? product.origin_total;
|
|
744
|
+
main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
|
|
743
745
|
}
|
|
744
746
|
processedProductsMap.set(
|
|
745
747
|
product._id,
|
|
746
748
|
[this.hooks.setProduct(originProduct, {
|
|
747
749
|
...isManualDiscount ? {
|
|
748
|
-
price: product.price
|
|
749
|
-
main_product_selling_price: product.main_product_selling_price ?? product.price
|
|
750
|
+
price: product.price
|
|
750
751
|
} : {
|
|
751
752
|
_id: product._id.split("___")[0] + "___" + index,
|
|
752
753
|
total,
|
|
753
754
|
price: product.price,
|
|
754
|
-
main_product_selling_price
|
|
755
|
+
main_product_selling_price
|
|
755
756
|
},
|
|
756
757
|
discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
|
|
757
758
|
})]
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -244,7 +244,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
244
244
|
// 可选,附加费均摊舍入金额
|
|
245
245
|
"surcharge_rounding_remainder": item.metadata.surcharge_rounding_remainder
|
|
246
246
|
},
|
|
247
|
-
product_bundle: item.product_bundle.map((bundle) => {
|
|
247
|
+
product_bundle: (item.product_bundle || []).map((bundle) => {
|
|
248
248
|
return {
|
|
249
249
|
bundle_id: bundle.bundle_id,
|
|
250
250
|
bundle_product_id: bundle.bundle_product_id,
|