@pisell/pisellos 0.0.201 → 0.0.202

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.
@@ -64,7 +64,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
64
64
  var order = {
65
65
  type: params.type || 'appointment_booking',
66
66
  // 要从外面拿,virtual
67
- platform: 'H5',
67
+ platform: params.platform === 'pc' ? 'PC' : 'H5',
68
68
  sales_channel: 'my_pisel',
69
69
  order_sales_channel: 'online_store',
70
70
  bookings: [],
@@ -15,6 +15,7 @@ export interface CommitOrderParams {
15
15
  query: {
16
16
  cartItems: CartItem[];
17
17
  type: 'virtual' | 'appointment_booking';
18
+ platform?: 'pc' | 'h5';
18
19
  };
19
20
  }
20
21
  /**
@@ -954,6 +954,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
954
954
  key: "submitOrder",
955
955
  value: function () {
956
956
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
957
+ var _this$otherParams3;
957
958
  var cartItems, newCartItems, type;
958
959
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
959
960
  while (1) switch (_context19.prev = _context19.next) {
@@ -989,7 +990,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
989
990
  return _context19.abrupt("return", this.store.order.submitOrder({
990
991
  query: {
991
992
  cartItems: newCartItems,
992
- type: type
993
+ type: type,
994
+ platform: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform
993
995
  }
994
996
  }));
995
997
  case 6:
@@ -41,7 +41,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
41
41
  const order = {
42
42
  type: params.type || "appointment_booking",
43
43
  // 要从外面拿,virtual
44
- platform: "H5",
44
+ platform: params.platform === "pc" ? "PC" : "H5",
45
45
  sales_channel: "my_pisel",
46
46
  order_sales_channel: "online_store",
47
47
  bookings: [],
@@ -72,7 +72,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
72
72
  }
73
73
  });
74
74
  if (order.type === "appointment_booking") {
75
- const firstAppointmentCartItem = (_a = params.cartItems.filter((n) => !(0, import_utils2.isNormalProduct)(n._productOrigin))) == null ? void 0 : _a[0];
75
+ const firstAppointmentCartItem = (_a = params.cartItems.filter(
76
+ (n) => !(0, import_utils2.isNormalProduct)(n._productOrigin)
77
+ )) == null ? void 0 : _a[0];
76
78
  if (firstAppointmentCartItem) {
77
79
  order.schedule_date = firstAppointmentCartItem.start_date + " " + firstAppointmentCartItem.start_time + ":00";
78
80
  }
@@ -15,6 +15,7 @@ export interface CommitOrderParams {
15
15
  query: {
16
16
  cartItems: CartItem[];
17
17
  type: 'virtual' | 'appointment_booking';
18
+ platform?: 'pc' | 'h5';
18
19
  };
19
20
  }
20
21
  /**
@@ -501,10 +501,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
501
501
  }
502
502
  // 购物车提交订单
503
503
  async submitOrder() {
504
+ var _a;
504
505
  const cartItems = this.store.cart.getItems();
505
506
  const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
506
507
  newCartItems.forEach((item) => {
507
- var _a;
508
+ var _a2;
508
509
  if (item._origin.resources && item._origin.resources.length) {
509
510
  item._origin.resources = item._origin.resources.map((n) => {
510
511
  const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
@@ -514,7 +515,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
514
515
  return { ...newResourcesItem };
515
516
  });
516
517
  const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
517
- if (!((_a = item._origin) == null ? void 0 : _a.metadata)) {
518
+ if (!((_a2 = item._origin) == null ? void 0 : _a2.metadata)) {
518
519
  item._origin.metadata = {};
519
520
  }
520
521
  item._origin.metadata.capacity = formatCapacity;
@@ -528,7 +529,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
528
529
  type = "virtual";
529
530
  }
530
531
  return this.store.order.submitOrder({
531
- query: { cartItems: newCartItems, type }
532
+ query: {
533
+ cartItems: newCartItems,
534
+ type,
535
+ platform: (_a = this.otherParams) == null ? void 0 : _a.platform
536
+ }
532
537
  });
533
538
  }
534
539
  // 拉起支付模块
@@ -833,7 +838,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
833
838
  if (!resources.length) {
834
839
  const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
835
840
  if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
836
- const dateResources = this.store.date.getResourcesListByDate(firstDateCartItem.start_date);
841
+ const dateResources = this.store.date.getResourcesListByDate(
842
+ firstDateCartItem.start_date
843
+ );
837
844
  resources.push(...dateResources || []);
838
845
  } else {
839
846
  const dateList = this.store.date.getDateList();
@@ -1057,7 +1064,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1057
1064
  if (!AllResources.length) {
1058
1065
  const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
1059
1066
  if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
1060
- const dateResources = this.store.date.getResourcesListByDate(firstDateCartItem.start_date);
1067
+ const dateResources = this.store.date.getResourcesListByDate(
1068
+ firstDateCartItem.start_date
1069
+ );
1061
1070
  AllResources.push(...dateResources || []);
1062
1071
  } else {
1063
1072
  const dateList = this.store.date.getDateList();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.201",
4
+ "version": "0.0.202",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",