@pisell/private-materials 6.11.55 → 6.11.57

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.
Files changed (33) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/booking/components/footer/amount.js +5 -0
  10. package/es/components/booking/hooks/usePromotion.js +4 -2
  11. package/es/components/checkout/PaymentModal.js +6 -11
  12. package/es/components/list/hooks/useListState.js +3 -15
  13. package/es/components/shoppingCart/components/Cart/Product.js +8 -3
  14. package/es/components/shoppingCart/components/Cart/index.js +35 -16
  15. package/es/components/shoppingCart/components/Cart/index.less +3 -2
  16. package/es/components/shoppingCart/hooks/usePromotionModal.js +1 -1
  17. package/es/components/shoppingCart/type.d.ts +1 -0
  18. package/es/components/shoppingCart/utils.js +4 -1
  19. package/es/components/ticketBooking/components/ticketBooking/index.less +1 -0
  20. package/es/components/ticketBooking/hooks/pisellos/useProducts.js +1 -18
  21. package/lib/components/booking/components/footer/amount.js +5 -0
  22. package/lib/components/booking/hooks/usePromotion.js +3 -3
  23. package/lib/components/checkout/PaymentModal.js +1 -4
  24. package/lib/components/list/hooks/useListState.js +0 -9
  25. package/lib/components/shoppingCart/components/Cart/Product.js +4 -3
  26. package/lib/components/shoppingCart/components/Cart/index.js +42 -40
  27. package/lib/components/shoppingCart/components/Cart/index.less +3 -2
  28. package/lib/components/shoppingCart/hooks/usePromotionModal.js +1 -1
  29. package/lib/components/shoppingCart/type.d.ts +1 -0
  30. package/lib/components/shoppingCart/utils.js +3 -1
  31. package/lib/components/ticketBooking/components/ticketBooking/index.less +1 -0
  32. package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +1 -17
  33. package/package.json +3 -3
@@ -863,6 +863,7 @@ var clearSurchargeFee = function clearSurchargeFee(state) {
863
863
  var _item$_extend$other7;
864
864
  var item = _step14.value;
865
865
  item._extend.surcharge_fee = 0;
866
+ item._extend.surcharge_rounding_remainder = undefined;
866
867
  item._extend.relation_surcharge_ids = [];
867
868
  var _iterator15 = _createForOfIteratorHelper(((_item$_extend$other7 = item._extend.other) === null || _item$_extend$other7 === void 0 ? void 0 : _item$_extend$other7.bundle) || []),
868
869
  _step15;
@@ -870,6 +871,7 @@ var clearSurchargeFee = function clearSurchargeFee(state) {
870
871
  for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
871
872
  var bundleItem = _step15.value;
872
873
  bundleItem.surcharge_fee = 0;
874
+ bundleItem.surcharge_rounding_remainder = undefined;
873
875
  bundleItem.relation_surcharge_ids = [];
874
876
  }
875
877
  } catch (err) {
@@ -883,6 +885,7 @@ var clearSurchargeFee = function clearSurchargeFee(state) {
883
885
  for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
884
886
  var relationDetail = _step16.value;
885
887
  relationDetail.surcharge_fee = 0;
888
+ relationDetail.surcharge_rounding_remainder = undefined;
886
889
  relationDetail.relation_surcharge_ids = [];
887
890
  }
888
891
  } catch (err) {
@@ -905,6 +908,7 @@ var clearSurchargeFee = function clearSurchargeFee(state) {
905
908
  var _item3$_extend$other;
906
909
  var _item3 = _step17.value;
907
910
  _item3._extend.surcharge_fee = 0;
911
+ _item3._extend.surcharge_rounding_remainder = undefined;
908
912
  _item3._extend.relation_surcharge_ids = [];
909
913
  var _iterator18 = _createForOfIteratorHelper(((_item3$_extend$other = _item3._extend.other) === null || _item3$_extend$other === void 0 ? void 0 : _item3$_extend$other.bundle) || []),
910
914
  _step18;
@@ -912,6 +916,7 @@ var clearSurchargeFee = function clearSurchargeFee(state) {
912
916
  for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
913
917
  var _bundleItem2 = _step18.value;
914
918
  _bundleItem2.surcharge_fee = 0;
919
+ _bundleItem2.surcharge_rounding_remainder = undefined;
915
920
  _bundleItem2.relation_surcharge_ids = [];
916
921
  }
917
922
  } catch (err) {
@@ -1060,9 +1060,11 @@ var usePromotion = function usePromotion(state, dispatch, options) {
1060
1060
  _giftInfo: _giftData
1061
1061
  }, priceParams), {}, {
1062
1062
  quantity: (giftData === null || giftData === void 0 ? void 0 : giftData.giftCount) || 1
1063
- }),
1064
- discount_list: formatDiscountLists(cacheItem, giftData === null || giftData === void 0 ? void 0 : giftData.strategyName)
1063
+ })
1065
1064
  });
1065
+
1066
+ // 设置赠品折扣信息
1067
+ product.discount_list = formatDiscountLists(product, giftData === null || giftData === void 0 ? void 0 : giftData.strategyName);
1066
1068
  resolve(product);
1067
1069
  });
1068
1070
  }));
@@ -1275,7 +1275,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1275
1275
  };
1276
1276
  var handleSendCustomerPaymentLink = /*#__PURE__*/function () {
1277
1277
  var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(data) {
1278
- var order, stateAmount, isCurrentOrderSynced, res;
1278
+ var order, stateAmount, res;
1279
1279
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1280
1280
  while (1) switch (_context13.prev = _context13.next) {
1281
1281
  case 0:
@@ -1290,20 +1290,15 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1290
1290
  _context13.next = 5;
1291
1291
  return checkoutModule.setDepositAmountAsync(stateAmount);
1292
1292
  case 5:
1293
- isCurrentOrderSynced = checkoutModule.isCurrentOrderSynced();
1294
- if (isCurrentOrderSynced) {
1295
- _context13.next = 9;
1296
- break;
1297
- }
1298
- _context13.next = 9;
1293
+ _context13.next = 7;
1299
1294
  return checkoutModule.manualSyncOrderAsync();
1300
- case 9:
1301
- _context13.next = 11;
1295
+ case 7:
1296
+ _context13.next = 9;
1302
1297
  return checkoutModule.sendCustomerPayLinkAsync({
1303
1298
  emails: data.emails,
1304
1299
  order_ids: [checkoutModule.getCurrentOrderId()]
1305
1300
  });
1306
- case 11:
1301
+ case 9:
1307
1302
  res = _context13.sent;
1308
1303
  // 支付链接发送成功 转 toC,这边可以关掉了
1309
1304
  if (res.success) {
@@ -1312,7 +1307,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
1312
1307
  } else {
1313
1308
  Toast === null || Toast === void 0 || Toast.error(res.message || locales.getText('pisell2.checkout.send-payment-link.error'));
1314
1309
  }
1315
- case 13:
1310
+ case 11:
1316
1311
  case "end":
1317
1312
  return _context13.stop();
1318
1313
  }
@@ -10,7 +10,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
- import { useReducer, useCallback, useEffect, useRef } from 'react';
13
+ import { useReducer, useCallback, useEffect } from 'react';
14
14
 
15
15
  // 状态接口
16
16
 
@@ -61,31 +61,19 @@ export var useListState = function useListState(_ref) {
61
61
  _useReducer2 = _slicedToArray(_useReducer, 2),
62
62
  state = _useReducer2[0],
63
63
  dispatch = _useReducer2[1];
64
-
65
- // 用 ref 追踪最新的 activeTab,避免将 state.activeTab 加入 useEffect 依赖导致循环触发
66
- var activeTabRef = useRef(initialState.activeTab);
67
- activeTabRef.current = state.activeTab;
68
64
  useEffect(function () {
69
- debugger;
70
65
  if (!isTreeTab) {
71
66
  setActiveTab(['0']);
72
67
  return;
73
68
  }
74
69
  if (tabStyle === 'switch' && tabItems.length > 0) {
75
70
  var _tabItems$;
76
- // 取当前 activeTab 的首层 key 判断是否仍存在于新的 tabItems 中
77
- var currentActive = activeTabRef.current;
78
- var currentActiveKey = Array.isArray(currentActive) ? currentActive[0] : currentActive;
79
- var isCurrentTabStillValid = currentActiveKey && tabItems.some(function (tab) {
80
- return tab.key == currentActiveKey;
81
- });
82
- if (isCurrentTabStillValid) {
83
- return;
84
- }
85
71
  var defaultTab = [tabItems[0].key];
86
72
  if (((_tabItems$ = tabItems[0]) === null || _tabItems$ === void 0 || (_tabItems$ = _tabItems$.children) === null || _tabItems$ === void 0 ? void 0 : _tabItems$.length) > 0) {
87
73
  defaultTab.push('0');
88
74
  }
75
+ // setActiveTab(defaultTab);
76
+ // const defaultTab = PisellTabbar.getDefaultActiveKey(tabItems, 'id');
89
77
  setActiveTab(defaultTab);
90
78
  }
91
79
  }, [tabItems, isTreeTab]);
@@ -28,7 +28,9 @@ var Product = function Product(props) {
28
28
  lists = props.lists,
29
29
  _props$isAdd = props.isAdd,
30
30
  isAdd = _props$isAdd === void 0 ? true : _props$isAdd,
31
- openPromotionModal = props.openPromotionModal;
31
+ openPromotionModal = props.openPromotionModal,
32
+ _props$isShowPromotio = props.isShowPromotionAlert,
33
+ isShowPromotionAlert = _props$isShowPromotio === void 0 ? false : _props$isShowPromotio;
32
34
  var _useContext = useContext(),
33
35
  state = _useContext.state,
34
36
  _onAction = _useContext.onAction,
@@ -203,7 +205,10 @@ var Product = function Product(props) {
203
205
  return useMemo(function () {
204
206
  console.log('render cart', lists);
205
207
  return /*#__PURE__*/React.createElement("div", {
206
- className: "pisell-lowcode__shopping-cart-content"
208
+ className: "pisell-lowcode__shopping-cart-content",
209
+ style: {
210
+ paddingBottom: isShowPromotionAlert ? '66px' : 0
211
+ }
207
212
  }, clearCart, normalItems.map(renderProductItem), editItems.length > 0 && /*#__PURE__*/React.createElement("div", {
208
213
  className: "pisell-lowcode__shopping-cart-edit"
209
214
  }, /*#__PURE__*/React.createElement("div", {
@@ -232,6 +237,6 @@ var Product = function Product(props) {
232
237
  transition: 'max-height 0.3s ease'
233
238
  }
234
239
  }, editItems.map(renderProductItem))), !hideAddBtn && platform !== 'h5' && isAdd ? useAddService(id, 'more') : null);
235
- }, [clearCart, editItems, normalItems, productParams, hideAddBtn, isAdd, platform, isEditExpanded]);
240
+ }, [clearCart, editItems, normalItems, productParams, hideAddBtn, isAdd, platform, isEditExpanded, isShowPromotionAlert]);
236
241
  };
237
242
  export default Product;
@@ -75,6 +75,26 @@ var Cart = function Cart() {
75
75
  openModal = _usePromotionModal.openModal,
76
76
  MarketingModal = _usePromotionModal.MarketingModal;
77
77
 
78
+ /**
79
+ * @description: 是否显示营销提示
80
+ * @param {*} useMemo
81
+ * @return {*}
82
+ */
83
+ var _isShowPromotionAlert = useMemo(function () {
84
+ var _ref3 = cartInfo || {},
85
+ promotions = _ref3.promotions,
86
+ _ref3$isShowPromotion = _ref3.isShowPromotionAlert,
87
+ isShowPromotionAlert = _ref3$isShowPromotion === void 0 ? true : _ref3$isShowPromotion;
88
+ if (!isShowPromotionAlert || !(promotions !== null && promotions !== void 0 && promotions.length)) return false;
89
+
90
+ // 过滤只有买几送几的营销才显示
91
+ var _promotions = (promotions || []).filter(function (item) {
92
+ return (item === null || item === void 0 ? void 0 : item.actionType) === 'X_ITEMS_FOR_Y_PRICE';
93
+ });
94
+ if (!(_promotions !== null && _promotions !== void 0 && _promotions.length)) return false;
95
+ return true;
96
+ }, [JSON.stringify(cartInfo)]);
97
+
78
98
  /**
79
99
  * @title: 折叠面板
80
100
  * @description:
@@ -95,14 +115,15 @@ var Cart = function Cart() {
95
115
  id: item === null || item === void 0 ? void 0 : item.key,
96
116
  lists: item === null || item === void 0 ? void 0 : item.products,
97
117
  isAdd: state.maxLength > _length,
98
- openPromotionModal: openModal
118
+ openPromotionModal: openModal,
119
+ isShowPromotionAlert: _isShowPromotionAlert
99
120
  }) : /*#__PURE__*/React.createElement(Empty, {
100
121
  id: item === null || item === void 0 ? void 0 : item.key
101
122
  }),
102
123
  showArrow: platform === 'shop'
103
124
  });
104
125
  });
105
- }, [carts, platform, openModal, state.maxLength]);
126
+ }, [carts, platform, openModal, state.maxLength, _isShowPromotionAlert]);
106
127
  var handleOpenPromotionModal = useMemoizedFn(function (item) {
107
128
  var _item$giftData, _currentItem, _currentItem2, _currentItem3, _item$giftData2;
108
129
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'gift';
@@ -133,8 +154,8 @@ var Cart = function Cart() {
133
154
  return _id && ((_currentItem4 = currentItem) === null || _currentItem4 === void 0 || (_currentItem4 = _currentItem4.sourceProductId) === null || _currentItem4 === void 0 ? void 0 : _currentItem4.includes(_id));
134
155
  });
135
156
  if (isMultiple) {
136
- var _ref3;
137
- selected = (_ref3 = selectedProducts || []) === null || _ref3 === void 0 ? void 0 : _ref3.map(function (option) {
157
+ var _ref4;
158
+ selected = (_ref4 = selectedProducts || []) === null || _ref4 === void 0 ? void 0 : _ref4.map(function (option) {
138
159
  var _option$_extend;
139
160
  return {
140
161
  value: option === null || option === void 0 ? void 0 : option.id,
@@ -167,16 +188,13 @@ var Cart = function Cart() {
167
188
  * @return {*}
168
189
  */
169
190
  var promotionAlert = useMemo(function () {
170
- var _ref5;
171
- var _ref4 = cartInfo || {},
172
- promotions = _ref4.promotions,
173
- _ref4$isShowPromotion = _ref4.isShowPromotionAlert,
174
- isShowPromotionAlert = _ref4$isShowPromotion === void 0 ? true : _ref4$isShowPromotion;
175
- if (!isShowPromotionAlert) return null;
191
+ var _ref5 = cartInfo || {},
192
+ promotions = _ref5.promotions;
193
+ if (!_isShowPromotionAlert) return null;
176
194
  return /*#__PURE__*/React.createElement("div", {
177
195
  className: "".concat(prefixCls, "-promotion-alert")
178
- }, /*#__PURE__*/React.createElement("div", null, (_ref5 = promotions || []) === null || _ref5 === void 0 ? void 0 : _ref5.map(function (item) {
179
- return (item === null || item === void 0 ? void 0 : item.actionType) === 'X_ITEMS_FOR_Y_PRICE' ? /*#__PURE__*/React.createElement(PisellAlert, {
196
+ }, /*#__PURE__*/React.createElement("div", null, promotions === null || promotions === void 0 ? void 0 : promotions.map(function (item) {
197
+ return /*#__PURE__*/React.createElement(PisellAlert, {
180
198
  description: locales.getText('pisell2.text.shopping-cart.marketing.alert')(item === null || item === void 0 ? void 0 : item.needQuantity, translationOriginal === null || translationOriginal === void 0 ? void 0 : translationOriginal(item === null || item === void 0 ? void 0 : item.strategyName)),
181
199
  type: "error",
182
200
  action: /*#__PURE__*/React.createElement(Button, {
@@ -186,9 +204,9 @@ var Cart = function Cart() {
186
204
  }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.text.shopping-cart.marketing.browse.items')), /*#__PURE__*/React.createElement(Iconfont, {
187
205
  type: "pisell2-arrow-right"
188
206
  }))
189
- }) : null;
207
+ });
190
208
  })));
191
- }, [JSON.stringify(cartInfo)]);
209
+ }, [JSON.stringify(cartInfo), _isShowPromotionAlert]);
192
210
  return useMemo(function () {
193
211
  console.log('render cart 22222', state.prodcuts);
194
212
  return /*#__PURE__*/React.createElement("div", {
@@ -196,7 +214,8 @@ var Cart = function Cart() {
196
214
  }, isProductList ? /*#__PURE__*/React.createElement(Product, {
197
215
  id: undefined,
198
216
  lists: state === null || state === void 0 ? void 0 : state.products,
199
- openPromotionModal: handleOpenPromotionModal
217
+ openPromotionModal: handleOpenPromotionModal,
218
+ isShowPromotionAlert: _isShowPromotionAlert
200
219
  }) : /*#__PURE__*/React.createElement(Collapse, _extends({
201
220
  items: cartsMap,
202
221
  showHeader: true,
@@ -210,6 +229,6 @@ var Cart = function Cart() {
210
229
  onActiveKey(key);
211
230
  }
212
231
  }, collapseParams)), promotionAlert, MarketingModal);
213
- }, [isProductList, cartsMap, platform, collapseParams, state === null || state === void 0 ? void 0 : state.products, promotionAlert, MarketingModal, handleOpenPromotionModal]);
232
+ }, [isProductList, cartsMap, platform, collapseParams, state === null || state === void 0 ? void 0 : state.products, promotionAlert, MarketingModal, handleOpenPromotionModal, _isShowPromotionAlert]);
214
233
  };
215
234
  export default Cart;
@@ -110,9 +110,10 @@
110
110
  //}
111
111
 
112
112
  &-promotion-alert {
113
- margin-top: 16px;
113
+ flex-shrink: 0;
114
+ margin-top: 0 !important;
114
115
  z-index: 10;
115
- position: sticky;
116
+ position: absolute !important;
116
117
  bottom: 0;
117
118
  background: transparent;
118
119
 
@@ -523,7 +523,7 @@ export var usePromotionModal = function usePromotionModal(options) {
523
523
  var selectedIds = Array.isArray(selected) ? selected.map(function (item) {
524
524
  return (item === null || item === void 0 ? void 0 : item.value) || item;
525
525
  }) : [selected];
526
- var _selectedProduct = findSelectedProductsFromList(products, selectedIds);
526
+ var _selectedProduct = findSelectedProductsFromList(productsRef.current, selectedIds);
527
527
  if (!(_selectedProduct !== null && _selectedProduct !== void 0 && _selectedProduct.length)) return;
528
528
  var promotionInfo = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.promotionInfo) || {};
529
529
  promotionInfo.lastEvaluatedGiftCount = (currentItem === null || currentItem === void 0 || (_currentItem$selected = currentItem.selectedProducts) === null || _currentItem$selected === void 0 || (_currentItem$selected = _currentItem$selected[0]) === null || _currentItem$selected === void 0 || (_currentItem$selected = _currentItem$selected._giftInfo) === null || _currentItem$selected === void 0 ? void 0 : _currentItem$selected.lastEvaluatedGiftCount) || 1;
@@ -54,5 +54,6 @@ export interface ProductProps {
54
54
  isAdd?: boolean;
55
55
  openPromotionModal?: (products: any[]) => void;
56
56
  promotionProducts?: any[];
57
+ isShowPromotionAlert?: boolean;
57
58
  }
58
59
  export {};
@@ -439,7 +439,10 @@ var updateProductInList = function updateProductInList(props) {
439
439
  cacheItem = props.cacheItem;
440
440
  var _products = (products || []).map(function (item) {
441
441
  if (item.id === productId) {
442
- return _objectSpread({}, cacheItem);
442
+ return _objectSpread(_objectSpread({}, cacheItem), {}, {
443
+ // 增加初始价格,用于赠品处理
444
+ _initPrice: item === null || item === void 0 ? void 0 : item._initPrice
445
+ });
443
446
  }
444
447
  return item;
445
448
  });
@@ -20,6 +20,7 @@
20
20
  padding-top: 10px;
21
21
  display: flex;
22
22
  flex-direction: column;
23
+ position: relative;
23
24
 
24
25
  .pisell-lowcode__booking-service-wrap {
25
26
  flex: 1;
@@ -20,7 +20,6 @@ import useEngineContext, { usePlatform } from "../../../../hooks/useEngineContex
20
20
  import dayjs from 'dayjs';
21
21
  import useLogger from "../../../../hooks/useLogger";
22
22
  import usePromotion from "../../../booking/hooks/usePromotion";
23
- import { getUniqueId } from "@pisell/utils";
24
23
  // 等待函数
25
24
  var sleep = function sleep(ms) {
26
25
  return new Promise(function (resolve) {
@@ -47,7 +46,6 @@ export var useProducts = function useProducts(notAvailableRef) {
47
46
  var logger = useLogger();
48
47
  var _usePromotion = usePromotion(),
49
48
  formatProductList = _usePromotion.formatProductList;
50
- var useCurrentId = useRef(getUniqueId());
51
49
  var app = getApp();
52
50
 
53
51
  // 日程时间段列表 HH:mm格式
@@ -73,17 +71,7 @@ export var useProducts = function useProducts(notAvailableRef) {
73
71
  }
74
72
  });
75
73
  _context.next = 6;
76
- return bookingTicket.loadProducts(params, {
77
- callback: function callback(res) {
78
- var _res$data;
79
- console.log(res, '1234321');
80
- if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.list) {
81
- var _res$data2;
82
- setProducts(formatProductList(res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list));
83
- }
84
- },
85
- subscriberId: useCurrentId
86
- });
74
+ return bookingTicket.loadProducts(params);
87
75
  case 6:
88
76
  _products = _context.sent;
89
77
  logger.addLog({
@@ -122,11 +110,6 @@ export var useProducts = function useProducts(notAvailableRef) {
122
110
  return _ref2.apply(this, arguments);
123
111
  };
124
112
  }());
125
- useEffect(function () {
126
- return function () {
127
- bookingTicket.unsubscribeProductQuery(useCurrentId);
128
- };
129
- }, []);
130
113
 
131
114
  // 注册任务函数并在 scheduleTimePoints 改变时添加定时任务
132
115
  useEffect(function () {
@@ -511,13 +511,16 @@ var clearSurchargeFee = (state) => {
511
511
  if (Array.isArray(service == null ? void 0 : service.value)) {
512
512
  for (let item of service.value) {
513
513
  item._extend.surcharge_fee = 0;
514
+ item._extend.surcharge_rounding_remainder = void 0;
514
515
  item._extend.relation_surcharge_ids = [];
515
516
  for (let bundleItem of ((_a = item._extend.other) == null ? void 0 : _a.bundle) || []) {
516
517
  bundleItem.surcharge_fee = 0;
518
+ bundleItem.surcharge_rounding_remainder = void 0;
517
519
  bundleItem.relation_surcharge_ids = [];
518
520
  }
519
521
  for (let relationDetail of item._extend.relation_details || []) {
520
522
  relationDetail.surcharge_fee = 0;
523
+ relationDetail.surcharge_rounding_remainder = void 0;
521
524
  relationDetail.relation_surcharge_ids = [];
522
525
  }
523
526
  }
@@ -525,9 +528,11 @@ var clearSurchargeFee = (state) => {
525
528
  if (Array.isArray(addons == null ? void 0 : addons.value)) {
526
529
  for (let item of addons.value) {
527
530
  item._extend.surcharge_fee = 0;
531
+ item._extend.surcharge_rounding_remainder = void 0;
528
532
  item._extend.relation_surcharge_ids = [];
529
533
  for (let bundleItem of ((_b = item._extend.other) == null ? void 0 : _b.bundle) || []) {
530
534
  bundleItem.surcharge_fee = 0;
535
+ bundleItem.surcharge_rounding_remainder = void 0;
531
536
  bundleItem.relation_surcharge_ids = [];
532
537
  }
533
538
  }
@@ -578,7 +578,7 @@ var usePromotion = (state, dispatch, options) => {
578
578
  origin_total: ((_b2 = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b2.price) || (cacheItem == null ? void 0 : cacheItem.price) || 0,
579
579
  _initPrice: (cacheItem == null ? void 0 : cacheItem.price) || 0
580
580
  };
581
- const product = {
581
+ let product = {
582
582
  ...cacheItem,
583
583
  ...priceParams,
584
584
  _giftInfo: _giftData,
@@ -587,9 +587,9 @@ var usePromotion = (state, dispatch, options) => {
587
587
  _giftInfo: _giftData,
588
588
  ...priceParams,
589
589
  quantity: (giftData == null ? void 0 : giftData.giftCount) || 1
590
- },
591
- discount_list: (0, import_utils2.formatDiscountLists)(cacheItem, giftData == null ? void 0 : giftData.strategyName)
590
+ }
592
591
  };
592
+ product.discount_list = (0, import_utils2.formatDiscountLists)(product, giftData == null ? void 0 : giftData.strategyName);
593
593
  resolve(product);
594
594
  });
595
595
  });
@@ -899,10 +899,7 @@ var PaymentContent = (0, import_react.forwardRef)(
899
899
  const stateAmount = checkoutModule.getStateAmount();
900
900
  await checkoutModule.setDepositAmountAsync(stateAmount);
901
901
  }
902
- const isCurrentOrderSynced = checkoutModule.isCurrentOrderSynced();
903
- if (!isCurrentOrderSynced) {
904
- await checkoutModule.manualSyncOrderAsync();
905
- }
902
+ await checkoutModule.manualSyncOrderAsync();
906
903
  const res = await checkoutModule.sendCustomerPayLinkAsync({
907
904
  emails: data.emails,
908
905
  order_ids: [checkoutModule.getCurrentOrderId()]
@@ -51,22 +51,13 @@ var useListState = ({
51
51
  isStickyActive: false
52
52
  };
53
53
  const [state, dispatch] = (0, import_react.useReducer)(listStateReducer, initialState);
54
- const activeTabRef = (0, import_react.useRef)(initialState.activeTab);
55
- activeTabRef.current = state.activeTab;
56
54
  (0, import_react.useEffect)(() => {
57
55
  var _a, _b;
58
- debugger;
59
56
  if (!isTreeTab) {
60
57
  setActiveTab(["0"]);
61
58
  return;
62
59
  }
63
60
  if (tabStyle === "switch" && tabItems.length > 0) {
64
- const currentActive = activeTabRef.current;
65
- const currentActiveKey = Array.isArray(currentActive) ? currentActive[0] : currentActive;
66
- const isCurrentTabStillValid = currentActiveKey && tabItems.some((tab) => tab.key == currentActiveKey);
67
- if (isCurrentTabStillValid) {
68
- return;
69
- }
70
61
  const defaultTab = [tabItems[0].key];
71
62
  if (((_b = (_a = tabItems[0]) == null ? void 0 : _a.children) == null ? void 0 : _b.length) > 0) {
72
63
  defaultTab.push("0");
@@ -48,7 +48,8 @@ var Product = (props) => {
48
48
  id,
49
49
  lists,
50
50
  isAdd = true,
51
- openPromotionModal
51
+ openPromotionModal,
52
+ isShowPromotionAlert = false
52
53
  } = props;
53
54
  const { state, onAction, onChange } = (0, import_useContext.useContext)();
54
55
  const {
@@ -195,7 +196,7 @@ var Product = (props) => {
195
196
  });
196
197
  return (0, import_react.useMemo)(() => {
197
198
  console.log("render cart", lists);
198
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__shopping-cart-content" }, clearCart, normalItems.map(renderProductItem), editItems.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__shopping-cart-edit" }, /* @__PURE__ */ import_react.default.createElement(
199
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__shopping-cart-content", style: { paddingBottom: isShowPromotionAlert ? "66px" : 0 } }, clearCart, normalItems.map(renderProductItem), editItems.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__shopping-cart-edit" }, /* @__PURE__ */ import_react.default.createElement(
199
200
  "div",
200
201
  {
201
202
  className: "pisell-lowcode__shopping-cart-edit-header",
@@ -226,6 +227,6 @@ var Product = (props) => {
226
227
  },
227
228
  editItems.map(renderProductItem)
228
229
  )), !hideAddBtn && platform !== "h5" && isAdd ? (0, import_useAddService.default)(id, "more") : null);
229
- }, [clearCart, editItems, normalItems, productParams, hideAddBtn, isAdd, platform, isEditExpanded]);
230
+ }, [clearCart, editItems, normalItems, productParams, hideAddBtn, isAdd, platform, isEditExpanded, isShowPromotionAlert]);
230
231
  };
231
232
  var Product_default = Product;
@@ -50,13 +50,7 @@ import_utils.locales.init(import_locales.default, localStorage.getItem("umi_loca
50
50
  var prefixCls = "pisell-lowcode__shopping-cart";
51
51
  var Cart = () => {
52
52
  const { state, updateState, onActiveKey, onChange, externalState } = (0, import_useContext.useContext)();
53
- const {
54
- platform,
55
- carts,
56
- isProductList,
57
- collapseParams,
58
- cartInfo
59
- } = state;
53
+ const { platform, carts, isProductList, collapseParams, cartInfo } = state;
60
54
  const translationOriginal = (0, import_useTranslationOriginal.default)();
61
55
  const { openModal, MarketingModal } = (0, import_usePromotionModal.usePromotionModal)({
62
56
  onConfirm: async (selectedProduct) => {
@@ -71,6 +65,15 @@ var Cart = () => {
71
65
  onChange(params, key);
72
66
  }
73
67
  });
68
+ const _isShowPromotionAlert = (0, import_react.useMemo)(() => {
69
+ const { promotions, isShowPromotionAlert = true } = cartInfo || {};
70
+ if (!isShowPromotionAlert || !(promotions == null ? void 0 : promotions.length)) return false;
71
+ const _promotions = (promotions || []).filter(
72
+ (item) => (item == null ? void 0 : item.actionType) === "X_ITEMS_FOR_Y_PRICE"
73
+ );
74
+ if (!(_promotions == null ? void 0 : _promotions.length)) return false;
75
+ return true;
76
+ }, [JSON.stringify(cartInfo)]);
74
77
  const cartsMap = (0, import_react.useMemo)(() => {
75
78
  return carts == null ? void 0 : carts.map((item) => {
76
79
  var _a, _b, _c;
@@ -86,13 +89,14 @@ var Cart = () => {
86
89
  id: item == null ? void 0 : item.key,
87
90
  lists: item == null ? void 0 : item.products,
88
91
  isAdd: state.maxLength > _length,
89
- openPromotionModal: openModal
92
+ openPromotionModal: openModal,
93
+ isShowPromotionAlert: _isShowPromotionAlert
90
94
  }
91
95
  ) : /* @__PURE__ */ import_react.default.createElement(import_Empty.default, { id: item == null ? void 0 : item.key }),
92
96
  showArrow: platform === "shop"
93
97
  };
94
98
  });
95
- }, [carts, platform, openModal, state.maxLength]);
99
+ }, [carts, platform, openModal, state.maxLength, _isShowPromotionAlert]);
96
100
  const handleOpenPromotionModal = (0, import_ahooks.useMemoizedFn)(
97
101
  (item, type = "gift") => {
98
102
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -118,7 +122,9 @@ var Cart = () => {
118
122
  const services = ((_f = externalState == null ? void 0 : externalState.service) == null ? void 0 : _f.value) || [];
119
123
  selectedProducts = services == null ? void 0 : services.filter((option) => {
120
124
  var _a2, _b2;
121
- const _id = (0, import_utils2.getPureSourceProductId)((_a2 = option == null ? void 0 : option._giftInfo) == null ? void 0 : _a2.sourceProductId);
125
+ const _id = (0, import_utils2.getPureSourceProductId)(
126
+ (_a2 = option == null ? void 0 : option._giftInfo) == null ? void 0 : _a2.sourceProductId
127
+ );
122
128
  return _id && ((_b2 = currentItem == null ? void 0 : currentItem.sourceProductId) == null ? void 0 : _b2.includes(_id));
123
129
  });
124
130
  if (isMultiple) {
@@ -150,34 +156,28 @@ var Cart = () => {
150
156
  }
151
157
  );
152
158
  const promotionAlert = (0, import_react.useMemo)(() => {
153
- var _a;
154
- const { promotions, isShowPromotionAlert = true } = cartInfo || {};
155
- if (!isShowPromotionAlert) return null;
156
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-promotion-alert` }, /* @__PURE__ */ import_react.default.createElement("div", null, (_a = promotions || []) == null ? void 0 : _a.map(
157
- (item) => (item == null ? void 0 : item.actionType) === "X_ITEMS_FOR_Y_PRICE" ? /* @__PURE__ */ import_react.default.createElement(
158
- import_materials.PisellAlert,
159
- {
160
- description: import_utils.locales.getText(
161
- "pisell2.text.shopping-cart.marketing.alert"
162
- )(
163
- item == null ? void 0 : item.needQuantity,
164
- translationOriginal == null ? void 0 : translationOriginal(item == null ? void 0 : item.strategyName)
165
- ),
166
- type: "error",
167
- action: /* @__PURE__ */ import_react.default.createElement(
168
- import_materials.Button,
169
- {
170
- onClick: () => handleOpenPromotionModal(item, "promotion")
171
- },
172
- /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText(
173
- "pisell2.text.shopping-cart.marketing.browse.items"
174
- )),
175
- /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-arrow-right" })
176
- )
177
- }
178
- ) : null
179
- )));
180
- }, [JSON.stringify(cartInfo)]);
159
+ const { promotions } = cartInfo || {};
160
+ if (!_isShowPromotionAlert) return null;
161
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-promotion-alert` }, /* @__PURE__ */ import_react.default.createElement("div", null, promotions == null ? void 0 : promotions.map((item) => /* @__PURE__ */ import_react.default.createElement(
162
+ import_materials.PisellAlert,
163
+ {
164
+ description: import_utils.locales.getText(
165
+ "pisell2.text.shopping-cart.marketing.alert"
166
+ )(item == null ? void 0 : item.needQuantity, translationOriginal == null ? void 0 : translationOriginal(item == null ? void 0 : item.strategyName)),
167
+ type: "error",
168
+ action: /* @__PURE__ */ import_react.default.createElement(
169
+ import_materials.Button,
170
+ {
171
+ onClick: () => handleOpenPromotionModal(item, "promotion")
172
+ },
173
+ /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText(
174
+ "pisell2.text.shopping-cart.marketing.browse.items"
175
+ )),
176
+ /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-arrow-right" })
177
+ )
178
+ }
179
+ ))));
180
+ }, [JSON.stringify(cartInfo), _isShowPromotionAlert]);
181
181
  return (0, import_react.useMemo)(() => {
182
182
  console.log("render cart 22222", state.prodcuts);
183
183
  return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__shopping-cart") }, isProductList ? /* @__PURE__ */ import_react.default.createElement(
@@ -185,7 +185,8 @@ var Cart = () => {
185
185
  {
186
186
  id: void 0,
187
187
  lists: state == null ? void 0 : state.products,
188
- openPromotionModal: handleOpenPromotionModal
188
+ openPromotionModal: handleOpenPromotionModal,
189
+ isShowPromotionAlert: _isShowPromotionAlert
189
190
  }
190
191
  ) : /* @__PURE__ */ import_react.default.createElement(
191
192
  import_materials.Collapse,
@@ -210,7 +211,8 @@ var Cart = () => {
210
211
  state == null ? void 0 : state.products,
211
212
  promotionAlert,
212
213
  MarketingModal,
213
- handleOpenPromotionModal
214
+ handleOpenPromotionModal,
215
+ _isShowPromotionAlert
214
216
  ]);
215
217
  };
216
218
  var Cart_default = Cart;
@@ -110,9 +110,10 @@
110
110
  //}
111
111
 
112
112
  &-promotion-alert {
113
- margin-top: 16px;
113
+ flex-shrink: 0;
114
+ margin-top: 0 !important;
114
115
  z-index: 10;
115
- position: sticky;
116
+ position: absolute !important;
116
117
  bottom: 0;
117
118
  background: transparent;
118
119