@pisell/pisellos 0.0.422 → 0.0.424

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.
@@ -33,6 +33,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
33
33
  is_deposit: number;
34
34
  relation_products: any[];
35
35
  relation_forms: any[];
36
+ business_code: string | undefined;
36
37
  };
37
38
  checkBeforeSubmitOrder(params: {
38
39
  cartItems: CartItem[];
@@ -130,7 +130,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
130
130
  schedule_date: '',
131
131
  is_deposit: 0,
132
132
  relation_products: [],
133
- relation_forms: []
133
+ relation_forms: [],
134
+ business_code: params === null || params === void 0 ? void 0 : params.business_code
134
135
  }, (params === null || params === void 0 ? void 0 : params.extraData) || {});
135
136
  var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
136
137
  if (params.cartItems.length > 0) {
@@ -17,6 +17,7 @@ export interface CommitOrderParams {
17
17
  type: 'virtual' | 'appointment_booking';
18
18
  platform?: 'pc' | 'h5';
19
19
  extraData?: Record<string, any>;
20
+ business_code?: string;
20
21
  };
21
22
  }
22
23
  /**
@@ -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(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -678,8 +678,10 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
678
678
  * 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
679
679
  */
680
680
  var getMainProductTotal = function getMainProductTotal(item) {
681
- var _ref7, _ref8, _item$main_product_se, _item$metadata;
681
+ var _ref7, _ref8, _item$main_product_se, _item$metadata, _item$_origin3, _item$_originData$pro;
682
682
  var total = new Decimal((_ref7 = (_ref8 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref8 !== void 0 ? _ref8 : item.price) !== null && _ref7 !== void 0 ? _ref7 : 0);
683
+ var mainProductDiscountAmount = getDiscountAmount((item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData$pro = item._originData.product) === null || _item$_originData$pro === void 0 ? void 0 : _item$_originData$pro.discount_list) || []);
684
+ total = total.minus(mainProductDiscountAmount);
683
685
 
684
686
  // 单规格
685
687
  if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
358
358
  };
359
359
  setOtherData(key: string, value: any): void;
360
360
  getOtherData(key: string): any;
361
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
361
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
362
362
  /**
363
363
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
364
364
  *
@@ -978,6 +978,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
978
978
  key: "submitOrder",
979
979
  value: function () {
980
980
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(extraData) {
981
+ var _this$otherParams4;
981
982
  var cartItems, newCartItems, type;
982
983
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
983
984
  while (1) switch (_context19.prev = _context19.next) {
@@ -1015,6 +1016,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1015
1016
  cartItems: newCartItems,
1016
1017
  type: type,
1017
1018
  platform: this.platform,
1019
+ business_code: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
1018
1020
  extraData: extraData
1019
1021
  }
1020
1022
  }));
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -33,6 +33,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
33
33
  is_deposit: number;
34
34
  relation_products: any[];
35
35
  relation_forms: any[];
36
+ business_code: string | undefined;
36
37
  };
37
38
  checkBeforeSubmitOrder(params: {
38
39
  cartItems: CartItem[];
@@ -106,6 +106,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
106
106
  is_deposit: 0,
107
107
  relation_products: [],
108
108
  relation_forms: [],
109
+ business_code: params == null ? void 0 : params.business_code,
109
110
  ...(params == null ? void 0 : params.extraData) || {}
110
111
  };
111
112
  let is_deposit = 0;
@@ -17,6 +17,7 @@ export interface CommitOrderParams {
17
17
  type: 'virtual' | 'appointment_booking';
18
18
  platform?: 'pc' | 'h5';
19
19
  extraData?: Record<string, any>;
20
+ business_code?: string;
20
21
  };
21
22
  }
22
23
  /**
@@ -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(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -409,8 +409,10 @@ var getDiscountAmount = (discounts) => {
409
409
  }, new import_decimal.default(0)).toNumber();
410
410
  };
411
411
  var getMainProductTotal = (item) => {
412
- var _a;
412
+ var _a, _b, _c, _d;
413
413
  let total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? item.price ?? 0);
414
+ const mainProductDiscountAmount = getDiscountAmount(((_c = (_b = item == null ? void 0 : item._origin) == null ? void 0 : _b.product) == null ? void 0 : _c.discount_list) || ((_d = item == null ? void 0 : item._originData.product) == null ? void 0 : _d.discount_list) || []);
415
+ total = total.minus(mainProductDiscountAmount);
414
416
  if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
415
417
  total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
416
418
  return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
358
358
  };
359
359
  setOtherData(key: string, value: any): void;
360
360
  getOtherData(key: string): any;
361
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
361
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
362
362
  /**
363
363
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
364
364
  *
@@ -512,10 +512,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
512
512
  }
513
513
  // 购物车提交订单
514
514
  async submitOrder(extraData) {
515
+ var _a;
515
516
  const cartItems = this.store.cart.getItems();
516
517
  const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
517
518
  newCartItems.forEach((item) => {
518
- var _a;
519
+ var _a2;
519
520
  if (item._origin.resources && item._origin.resources.length) {
520
521
  item._origin.resources = item._origin.resources.map((n) => {
521
522
  const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
@@ -525,7 +526,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
525
526
  return { ...newResourcesItem };
526
527
  });
527
528
  const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
528
- if (!((_a = item._origin) == null ? void 0 : _a.metadata)) {
529
+ if (!((_a2 = item._origin) == null ? void 0 : _a2.metadata)) {
529
530
  item._origin.metadata = {};
530
531
  }
531
532
  item._origin.metadata.capacity = formatCapacity;
@@ -543,6 +544,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
543
544
  cartItems: newCartItems,
544
545
  type,
545
546
  platform: this.platform,
547
+ business_code: (_a = this.otherParams) == null ? void 0 : _a.business_code,
546
548
  extraData
547
549
  }
548
550
  });
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.422",
4
+ "version": "0.0.424",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",