@pisell/pisellos 0.0.66 → 0.0.68

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.
@@ -1,7 +1,7 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import { Rules, RulesModuleAPI, DiscountResult } from './types';
4
- import { Discount } from '../Discount/types';
4
+ import { Discount } from "../Discount/types";
5
5
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -277,35 +277,34 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
277
277
  }
278
278
 
279
279
  // 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
280
- if (applicableDiscounts.length === 0 || isManualDiscount) {
281
- if (product.isClient) {
282
- processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
283
- origin_total: getProductOriginTotalPrice({
284
- product: {
285
- original_price: product.original_price
286
- },
287
- bundle: product.bundle,
288
- options: product.options
289
- }),
290
- total: getProductTotalPrice({
291
- product: {
292
- price: product.price
293
- },
294
- bundle: product.bundle,
295
- options: product.options
296
- }),
297
- price: product.price
298
- }), {}, {
299
- discount_list: []
300
- })));
301
- } else {
302
- processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
303
- total: product.origin_total || product.total,
304
- price: product.price
305
- }), {}, {
306
- discount_list: []
307
- })));
308
- }
280
+ if (applicableDiscounts.length === 0 || isManualDiscount) {}
281
+ if (product.isClient) {
282
+ processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
283
+ origin_total: getProductOriginTotalPrice({
284
+ product: {
285
+ original_price: product.original_price
286
+ },
287
+ bundle: product.bundle,
288
+ options: product.options
289
+ }),
290
+ total: getProductTotalPrice({
291
+ product: {
292
+ price: product.price
293
+ },
294
+ bundle: product.bundle,
295
+ options: product.options
296
+ }),
297
+ price: product.price
298
+ }), {}, {
299
+ discount_list: []
300
+ })));
301
+ } else {
302
+ processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
303
+ total: product.origin_total || product.total,
304
+ price: product.price
305
+ }), {}, {
306
+ discount_list: []
307
+ })));
309
308
  return;
310
309
  }
311
310
  if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined') {
@@ -1182,17 +1182,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1182
1182
  if (cartItem._origin.start_time) {
1183
1183
  var startTime = dayjs("".concat(cartItem._origin.start_date, " ").concat(cartItem._origin.start_time));
1184
1184
  var endTime = dayjs("".concat(cartItem._origin.end_date, " ").concat(cartItem._origin.end_time));
1185
- // 资源排下序,把单个资源靠前,组合资源排在后面
1186
- productResources.sort(function (a, b) {
1187
- var _a$metadata, _b$metadata;
1188
- var aIsCombined = ((_a$metadata = a.metadata) === null || _a$metadata === void 0 || (_a$metadata = _a$metadata.combined_resource) === null || _a$metadata === void 0 ? void 0 : _a$metadata.status) === 1;
1189
- var bIsCombined = ((_b$metadata = b.metadata) === null || _b$metadata === void 0 || (_b$metadata = _b$metadata.combined_resource) === null || _b$metadata === void 0 ? void 0 : _b$metadata.status) === 1;
1190
- if (aIsCombined && !bIsCombined) return 1;
1191
- if (!aIsCombined && bIsCombined) return -1;
1192
- return 0;
1193
- });
1194
1185
  var resourcesUseableMap = {};
1195
1186
  productResources.forEach(function (n) {
1187
+ // 资源排下序,把单个资源靠前,组合资源排在后面
1188
+ n.renderList = n.renderList.sort(function (a, b) {
1189
+ var _a$metadata, _b$metadata;
1190
+ var aIsCombined = ((_a$metadata = a.metadata) === null || _a$metadata === void 0 || (_a$metadata = _a$metadata.combined_resource) === null || _a$metadata === void 0 ? void 0 : _a$metadata.status) === 1;
1191
+ var bIsCombined = ((_b$metadata = b.metadata) === null || _b$metadata === void 0 || (_b$metadata = _b$metadata.combined_resource) === null || _b$metadata === void 0 ? void 0 : _b$metadata.status) === 1;
1192
+ if (aIsCombined && !bIsCombined) return 1;
1193
+ if (!aIsCombined && bIsCombined) return -1;
1194
+ return 0;
1195
+ });
1196
1196
  n.renderList = n.renderList.filter(function (m) {
1197
1197
  var recordCount = capacityMap[m.id] || 0;
1198
1198
  var canUseTime = m.times.find(function (item) {
@@ -1,7 +1,7 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import { Rules, RulesModuleAPI, DiscountResult } from './types';
4
- import { Discount } from '../Discount/types';
4
+ import { Discount } from "../Discount/types";
5
5
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -175,42 +175,42 @@ var RulesModule = class extends import_BaseModule.BaseModule {
175
175
  isManualDiscount = false;
176
176
  }
177
177
  if (applicableDiscounts.length === 0 || isManualDiscount) {
178
- if (product.isClient) {
179
- processedProductsMap.set(
180
- product._id,
181
- this.hooks.setProduct(originProduct, {
182
- ...isManualDiscount ? {} : {
183
- origin_total: (0, import_utils2.getProductOriginTotalPrice)({
184
- product: {
185
- original_price: product.original_price
186
- },
187
- bundle: product.bundle,
188
- options: product.options
189
- }),
190
- total: (0, import_utils2.getProductTotalPrice)({
191
- product: {
192
- price: product.price
193
- },
194
- bundle: product.bundle,
195
- options: product.options
196
- }),
197
- price: product.price
198
- },
199
- discount_list: []
200
- })
201
- );
202
- } else {
203
- processedProductsMap.set(
204
- product._id,
205
- this.hooks.setProduct(originProduct, {
206
- ...isManualDiscount ? {} : {
207
- total: product.origin_total || product.total,
208
- price: product.price
209
- },
210
- discount_list: []
211
- })
212
- );
213
- }
178
+ }
179
+ if (product.isClient) {
180
+ processedProductsMap.set(
181
+ product._id,
182
+ this.hooks.setProduct(originProduct, {
183
+ ...isManualDiscount ? {} : {
184
+ origin_total: (0, import_utils2.getProductOriginTotalPrice)({
185
+ product: {
186
+ original_price: product.original_price
187
+ },
188
+ bundle: product.bundle,
189
+ options: product.options
190
+ }),
191
+ total: (0, import_utils2.getProductTotalPrice)({
192
+ product: {
193
+ price: product.price
194
+ },
195
+ bundle: product.bundle,
196
+ options: product.options
197
+ }),
198
+ price: product.price
199
+ },
200
+ discount_list: []
201
+ })
202
+ );
203
+ } else {
204
+ processedProductsMap.set(
205
+ product._id,
206
+ this.hooks.setProduct(originProduct, {
207
+ ...isManualDiscount ? {} : {
208
+ total: product.origin_total || product.total,
209
+ price: product.price
210
+ },
211
+ discount_list: []
212
+ })
213
+ );
214
214
  return;
215
215
  }
216
216
  if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined") {
@@ -632,18 +632,18 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
632
632
  const endTime = (0, import_dayjs.default)(
633
633
  `${cartItem._origin.end_date} ${cartItem._origin.end_time}`
634
634
  );
635
- productResources.sort((a, b) => {
636
- var _a2, _b2, _c2, _d;
637
- const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
638
- const bIsCombined = ((_d = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d.status) === 1;
639
- if (aIsCombined && !bIsCombined)
640
- return 1;
641
- if (!aIsCombined && bIsCombined)
642
- return -1;
643
- return 0;
644
- });
645
635
  const resourcesUseableMap = {};
646
636
  productResources.forEach((n) => {
637
+ n.renderList = n.renderList.sort((a, b) => {
638
+ var _a2, _b2, _c2, _d;
639
+ const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
640
+ const bIsCombined = ((_d = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d.status) === 1;
641
+ if (aIsCombined && !bIsCombined)
642
+ return 1;
643
+ if (!aIsCombined && bIsCombined)
644
+ return -1;
645
+ return 0;
646
+ });
647
647
  n.renderList = n.renderList.filter((m) => {
648
648
  const recordCount = capacityMap[m.id] || 0;
649
649
  const canUseTime = m.times.find((item) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.66",
4
+ "version": "0.0.68",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",