@pisell/pisellos 0.0.397 → 0.0.399

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.
@@ -188,7 +188,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
188
188
  tags: ['good_pass', 'product_discount_card'],
189
189
  available: 1,
190
190
  relation_product: 1,
191
- with: ['extensionData', 'holder.detail'],
191
+ with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
192
192
  order_behavior_count: 1,
193
193
  order_behavior_count_customer_id: customerId || 1
194
194
  });
@@ -13,6 +13,7 @@ export declare class SummaryModule extends BaseModule implements Module, ISummar
13
13
  private fatherModule;
14
14
  constructor(name?: string, version?: string);
15
15
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
16
+ getSurchargeList(): Promise<void>;
16
17
  getSummary(cartItems: CartItem[]): Promise<ISummaryState['summary']>;
17
18
  /**
18
19
  * 获取协议
@@ -62,6 +62,9 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
62
62
  }
63
63
  throw new Error('SummaryModule 需要 shopStore 插件支持');
64
64
  case 9:
65
+ // 加载当前店铺附加费
66
+ this.getSurchargeList();
67
+ case 10:
65
68
  case "end":
66
69
  return _context.stop();
67
70
  }
@@ -73,24 +76,54 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
73
76
  return initialize;
74
77
  }()
75
78
  }, {
76
- key: "getSummary",
79
+ key: "getSurchargeList",
77
80
  value: function () {
78
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cartItems) {
79
- var _this$shopStore$get;
80
- var shopInfo, summary;
81
+ var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
82
+ var surchargeList;
81
83
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
82
84
  while (1) switch (_context2.prev = _context2.next) {
83
85
  case 0:
84
- shopInfo = ((_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.shop) || {};
85
- summary = calculatePriceDetails(shopInfo, cartItems);
86
- this.store.summary = summary;
87
- return _context2.abrupt("return", this.store.summary);
86
+ _context2.next = 2;
87
+ return this.request.get('/order/custom-surcharge/available', {
88
+ channel: 'online-store',
89
+ is_assemble_product_data: 1,
90
+ is_assemble_schedule_data: 1,
91
+ with: ['relationSchedule']
92
+ });
93
+ case 2:
94
+ surchargeList = _context2.sent;
95
+ this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
88
96
  case 4:
89
97
  case "end":
90
98
  return _context2.stop();
91
99
  }
92
100
  }, _callee2, this);
93
101
  }));
102
+ function getSurchargeList() {
103
+ return _getSurchargeList.apply(this, arguments);
104
+ }
105
+ return getSurchargeList;
106
+ }()
107
+ }, {
108
+ key: "getSummary",
109
+ value: function () {
110
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(cartItems) {
111
+ var _this$shopStore$get;
112
+ var shopInfo, scheduleModule, summary;
113
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
114
+ while (1) switch (_context3.prev = _context3.next) {
115
+ case 0:
116
+ shopInfo = ((_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.shop) || {};
117
+ scheduleModule = this.core.getModule('appointmentBooking_schedule');
118
+ summary = calculatePriceDetails(shopInfo, cartItems, scheduleModule, this.store.surchargeList);
119
+ this.store.summary = summary;
120
+ return _context3.abrupt("return", this.store.summary);
121
+ case 5:
122
+ case "end":
123
+ return _context3.stop();
124
+ }
125
+ }, _callee3, this);
126
+ }));
94
127
  function getSummary(_x3) {
95
128
  return _getSummary.apply(this, arguments);
96
129
  }
@@ -104,16 +137,16 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
104
137
  }, {
105
138
  key: "getProtocol",
106
139
  value: (function () {
107
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(protocolId) {
108
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
109
- while (1) switch (_context3.prev = _context3.next) {
140
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(protocolId) {
141
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
142
+ while (1) switch (_context4.prev = _context4.next) {
110
143
  case 0:
111
- return _context3.abrupt("return", this.request.get("/shop-policy/".concat(protocolId)));
144
+ return _context4.abrupt("return", this.request.get("/shop-policy/".concat(protocolId)));
112
145
  case 1:
113
146
  case "end":
114
- return _context3.stop();
147
+ return _context4.stop();
115
148
  }
116
- }, _callee3, this);
149
+ }, _callee4, this);
117
150
  }));
118
151
  function getProtocol(_x4) {
119
152
  return _getProtocol.apply(this, arguments);
@@ -1,5 +1,6 @@
1
1
  import { CartItem } from '../Cart/types';
2
2
  export interface ISummaryState {
3
+ surchargeList: any[];
3
4
  summary: {
4
5
  /** 商品总价 */
5
6
  subtotal: string | number;
@@ -13,6 +14,8 @@ export interface ISummaryState {
13
14
  totalTaxFee?: string | number;
14
15
  /** 商品价格是否包含费率 */
15
16
  isPriceIncludeTax?: 0 | 1;
17
+ /** 附加费金额 */
18
+ surchargeAmount?: string | number;
16
19
  /** 定金 */
17
20
  deposit?: {
18
21
  /** 定金总价 */
@@ -1,7 +1,8 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import { CartItem } from '../Cart/types';
3
3
  import { ISummaryState } from './types';
4
- export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[]) => ISummaryState['summary'];
4
+ import { ScheduleModule } from '../Schedule';
5
+ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], scheduleModule: ScheduleModule, surchargeList: any[]) => ISummaryState['summary'];
5
6
  /**
6
7
  * 获取子商品折扣信息
7
8
  * @param item
@@ -38,3 +39,23 @@ export declare const calculateDeposit: (items: CartItem[]) => {
38
39
  protocols: any[];
39
40
  hasDeposit: never;
40
41
  } | undefined;
42
+ export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
43
+ bookingDetail?: any;
44
+ bookingId?: number | undefined;
45
+ }, surcharge: any[], options: any) => any;
46
+ /**
47
+ * 订单附加费各项信息
48
+ * @param state
49
+ * @param options 包含 ScheduleModule 和其他附加费计算所需参数
50
+ */
51
+ export declare const getSurcharge: ({ service, addons, bookingDetail, bookingId }: {
52
+ service: any;
53
+ addons: any;
54
+ bookingDetail?: any;
55
+ bookingId?: number | undefined;
56
+ }, options: {
57
+ isEdit: boolean;
58
+ ScheduleModule: any;
59
+ surcharge_list?: any[];
60
+ scheduleById?: Record<string, any>;
61
+ } & Record<string, any>) => any;