@pisell/pisellos 2.0.8 → 2.0.9

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.
@@ -144,6 +144,8 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
144
144
  end_date: end_date,
145
145
  resource_ids: resource_ids,
146
146
  front_end_cache_id: this.cacheId
147
+ }, {
148
+ useCache: true
147
149
  });
148
150
  case 11:
149
151
  res = _context3.sent;
@@ -50,10 +50,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
50
50
  category_ids?: number[];
51
51
  }): Promise<any>;
52
52
  loadAllSchedule(): Promise<void>;
53
- loadScheduleAvailableDate({ startDate, endDate, custom_page_id, }: {
53
+ loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel }: {
54
54
  startDate: string;
55
55
  endDate: string;
56
56
  custom_page_id?: number;
57
+ channel?: string;
57
58
  }): Promise<ITime[]>;
58
59
  storeProduct(productData: ProductData): Promise<void>;
59
60
  addAccount(account: Account | IHolder, extra?: {
@@ -314,11 +314,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
314
314
  value: function () {
315
315
  var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref3) {
316
316
  var _res$data$date_list;
317
- var startDate, endDate, custom_page_id, dates, res;
317
+ var startDate, endDate, custom_page_id, channel, dates, res;
318
318
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
319
319
  while (1) switch (_context5.prev = _context5.next) {
320
320
  case 0:
321
- startDate = _ref3.startDate, endDate = _ref3.endDate, custom_page_id = _ref3.custom_page_id;
321
+ startDate = _ref3.startDate, endDate = _ref3.endDate, custom_page_id = _ref3.custom_page_id, channel = _ref3.channel;
322
322
  // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
323
323
  if (dayjs(startDate).isBefore(dayjs(), 'day')) {
324
324
  startDate = dayjs().format('YYYY-MM-DD');
@@ -337,7 +337,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
337
337
  return this.request.get("/schedule/product/availability", {
338
338
  start_date: startDate,
339
339
  end_date: endDate,
340
- custom_page_id: custom_page_id
340
+ custom_page_id: custom_page_id,
341
+ channel: channel
341
342
  });
342
343
  case 8:
343
344
  res = _context5.sent;
@@ -350,13 +351,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
350
351
  return _context5.abrupt("return", dates);
351
352
  case 12:
352
353
  res.data.date_list.forEach(function (n) {
353
- if (n.schedule_id && n.schedule_id.length) {
354
- var index = dates.findIndex(function (m) {
355
- return m.date === n.date;
356
- });
357
- if (index !== -1) {
358
- dates[index].status = 'available';
359
- }
354
+ var index = dates.findIndex(function (m) {
355
+ return m.date === n.date;
356
+ });
357
+ if (index !== -1) {
358
+ dates[index].status = 'available';
360
359
  }
361
360
  });
362
361
  dates = disableDatesBeforeOneDay(dates);
@@ -1195,7 +1194,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1195
1194
  });
1196
1195
  n.renderList = n.renderList.filter(function (m) {
1197
1196
  var recordCount = capacityMap[m.id] || 0;
1198
- var canUseTime = m.times.find(function (item) {
1197
+ var canUseArr = m.times.map(function (item) {
1199
1198
  var res = getIsUsableByTimeItem({
1200
1199
  timeSlice: {
1201
1200
  start_time: startTime.format('HH:mm'),
@@ -1213,7 +1212,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1213
1212
  }
1214
1213
  return res.usable;
1215
1214
  });
1216
- return canUseTime;
1215
+ // 在已经选定时间的情况下,只要canUseTime 里有一个 false,那就代表不可用
1216
+ return !canUseArr.some(function (n) {
1217
+ return n === false;
1218
+ });
1219
+ });
1220
+ });
1221
+ } else {
1222
+ productResources.forEach(function (item) {
1223
+ // 如果资源的 capacity 已经小于了当前需要的 capacity ,则需要把资源给过滤掉
1224
+ item.renderList = item.renderList.filter(function (n) {
1225
+ var recordCount = n.capacity || 0;
1226
+ return recordCount >= currentCapacity;
1217
1227
  });
1218
1228
  });
1219
1229
  }
@@ -1510,6 +1520,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1510
1520
  _resources.forEach(function (n) {
1511
1521
  var _n$renderList;
1512
1522
  if ((_n$renderList = n.renderList) !== null && _n$renderList !== void 0 && _n$renderList.length) {
1523
+ // 过滤掉 capacity 小于 currentCapacity 的资源
1524
+ n.renderList = n.renderList.filter(function (m) {
1525
+ var recordCount = m.capacity || 0;
1526
+ return recordCount >= currentCapacity;
1527
+ });
1513
1528
  currentResourcesRenderList.push.apply(currentResourcesRenderList, _toConsumableArray(n.renderList || []));
1514
1529
  }
1515
1530
  });
@@ -1568,7 +1583,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1568
1583
  }, {
1569
1584
  key: "getTimeSlotByAllResources",
1570
1585
  value: function getTimeSlotByAllResources(resources_code) {
1571
- var _this9 = this,
1586
+ var _dateRange,
1587
+ _this9 = this,
1572
1588
  _cartItems$,
1573
1589
  _cartItems$2;
1574
1590
  var dateRange = this.store.date.getDateRange();
@@ -1577,8 +1593,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1577
1593
  var cartItems = cloneDeep(this.store.cart.getItems());
1578
1594
  // if (cartItems?.[0].start_date) return [];
1579
1595
  var resourceIds = [];
1596
+ var resourcesTypeId = undefined;
1580
1597
  cartItems.forEach(function (item) {
1581
- var _item$_productOrigin9;
1598
+ var _item$_productOrigin9, _item$_productOrigin10;
1582
1599
  (_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.product_resource) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.resources) === null || _item$_productOrigin9 === void 0 || _item$_productOrigin9.forEach(function (n) {
1583
1600
  if (n.code === resources_code) {
1584
1601
  resources.push.apply(resources, _toConsumableArray(n.renderList || []));
@@ -1590,7 +1607,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1590
1607
  if (item.resource_id) {
1591
1608
  resourceIds.push(item.resource_id);
1592
1609
  }
1610
+ resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.product_resource) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.resources) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.find(function (n) {
1611
+ return n.code === resources_code;
1612
+ })) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.id;
1593
1613
  });
1614
+ // 保险起见,在这里如果 dateRange 里也有 resources 的话,也 push 进去
1615
+ if ((_dateRange = dateRange) !== null && _dateRange !== void 0 && (_dateRange = _dateRange[0]) !== null && _dateRange !== void 0 && (_dateRange = _dateRange.resource) !== null && _dateRange !== void 0 && _dateRange.length) {
1616
+ // resources.push(...dateRange[0].resource);
1617
+ dateRange[0].resource.forEach(function (n) {
1618
+ if (n.form_id === resourcesTypeId) {
1619
+ resources.push(n);
1620
+ }
1621
+ });
1622
+ }
1594
1623
  var resourcesMap = getResourcesMap(resources);
1595
1624
  var duration = 0;
1596
1625
  // duration = 不同账号的最长时间
@@ -1598,8 +1627,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1598
1627
  var checkDuration = function checkDuration(cartItems) {
1599
1628
  var accountDuration = 0;
1600
1629
  cartItems.forEach(function (item) {
1601
- var _item$_productOrigin$3, _item$_productOrigin10;
1602
- accountDuration += (_item$_productOrigin$3 = (_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.duration) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.value) !== null && _item$_productOrigin$3 !== void 0 ? _item$_productOrigin$3 : 0;
1630
+ var _item$_productOrigin$3, _item$_productOrigin11;
1631
+ accountDuration += (_item$_productOrigin$3 = (_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.duration) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.value) !== null && _item$_productOrigin$3 !== void 0 ? _item$_productOrigin$3 : 0;
1603
1632
  });
1604
1633
  if (accountDuration > duration) {
1605
1634
  duration = accountDuration;
@@ -1668,9 +1697,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1668
1697
  accountItems.forEach(function (item, index) {
1669
1698
  var newResources = cloneDeep(item._origin.resources);
1670
1699
  newResources.forEach(function (resource) {
1671
- var _item$_productOrigin$4, _item$_productOrigin11, _ref11, _item$_productOrigin12;
1700
+ var _item$_productOrigin$4, _item$_productOrigin12, _ref11, _item$_productOrigin13;
1672
1701
  resource.startTime = currentStartTime;
1673
- resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$4 = (_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.duration) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.value) !== null && _item$_productOrigin$4 !== void 0 ? _item$_productOrigin$4 : 0, (_ref11 = (_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.duration) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.type) !== null && _ref11 !== void 0 ? _ref11 : 'minutes').format('YYYY-MM-DD HH:mm');
1702
+ resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$4 = (_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.duration) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.value) !== null && _item$_productOrigin$4 !== void 0 ? _item$_productOrigin$4 : 0, (_ref11 = (_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.type) !== null && _ref11 !== void 0 ? _ref11 : 'minutes').format('YYYY-MM-DD HH:mm');
1674
1703
  delete resource.times;
1675
1704
  });
1676
1705
  _this10.store.cart.updateItem({
@@ -1814,7 +1843,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1814
1843
  if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false) {
1815
1844
  resourcesUseableMap[m.id] = res.usable;
1816
1845
  }
1817
- // 如果资源可用,且是独占资源,remainingCapacity 始终为 1
1818
1846
  if (res.usable && res.remainingCapacity >= count) {
1819
1847
  count = res.remainingCapacity;
1820
1848
  }
@@ -483,21 +483,26 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
483
483
  });
484
484
  case 3:
485
485
  result = _context7.sent;
486
- if (result !== null && result !== void 0 && result.data) {
487
- _result$data = result.data, wallet_pass_list = _result$data.wallet_pass_list, customer = _objectWithoutProperties(_result$data, _excluded);
488
- this.setCustomer(customer);
486
+ if (!(result !== null && result !== void 0 && result.data)) {
487
+ _context7.next = 9;
488
+ break;
489
489
  }
490
- _context7.next = 10;
490
+ _result$data = result.data, wallet_pass_list = _result$data.wallet_pass_list, customer = _objectWithoutProperties(_result$data, _excluded);
491
+ this.setCustomer(customer);
492
+ _context7.next = 9;
493
+ return this.core.effects.emit(ShopDiscountHooks.onScanCustomerChange, customer);
494
+ case 9:
495
+ _context7.next = 14;
491
496
  break;
492
- case 7:
493
- _context7.prev = 7;
497
+ case 11:
498
+ _context7.prev = 11;
494
499
  _context7.t0 = _context7["catch"](0);
495
500
  console.error('[ShopDiscount] 获取客户钱包信息出错:', _context7.t0);
496
- case 10:
501
+ case 14:
497
502
  case "end":
498
503
  return _context7.stop();
499
504
  }
500
- }, _callee7, this, [[0, 7]]);
505
+ }, _callee7, this, [[0, 11]]);
501
506
  }));
502
507
  function getCustomerWallet(_x6) {
503
508
  return _getCustomerWallet.apply(this, arguments);
@@ -5,6 +5,7 @@ export declare enum ShopDiscountHooks {
5
5
  onDestroy = "shopDiscount:onDestroy",
6
6
  onLoadDiscountList = "shopDiscount:onLoadDiscountList",
7
7
  onCustomerChange = "shopDiscount:onCustomerChange",
8
+ onScanCustomerChange = "shopDiscount:onScanCustomerChange",
8
9
  onDiscountListChange = "shopDiscount:onDiscountListChange",
9
10
  onRulesListChange = "shopDiscount:onRulesListChange",
10
11
  onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
@@ -3,6 +3,7 @@ export var ShopDiscountHooks = /*#__PURE__*/function (ShopDiscountHooks) {
3
3
  ShopDiscountHooks["onDestroy"] = "shopDiscount:onDestroy";
4
4
  ShopDiscountHooks["onLoadDiscountList"] = "shopDiscount:onLoadDiscountList";
5
5
  ShopDiscountHooks["onCustomerChange"] = "shopDiscount:onCustomerChange";
6
+ ShopDiscountHooks["onScanCustomerChange"] = "shopDiscount:onScanCustomerChange";
6
7
  ShopDiscountHooks["onDiscountListChange"] = "shopDiscount:onDiscountListChange";
7
8
  ShopDiscountHooks["onRulesListChange"] = "shopDiscount:onRulesListChange";
8
9
  ShopDiscountHooks["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
@@ -83,6 +83,8 @@ var DateModule = class extends import_BaseModule.BaseModule {
83
83
  end_date,
84
84
  resource_ids,
85
85
  front_end_cache_id: this.cacheId
86
+ }, {
87
+ useCache: true
86
88
  });
87
89
  if (!((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.length)) {
88
90
  return (0, import_utils.disableAllDates)(dates);
@@ -50,10 +50,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
50
50
  category_ids?: number[];
51
51
  }): Promise<any>;
52
52
  loadAllSchedule(): Promise<void>;
53
- loadScheduleAvailableDate({ startDate, endDate, custom_page_id, }: {
53
+ loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel }: {
54
54
  startDate: string;
55
55
  endDate: string;
56
56
  custom_page_id?: number;
57
+ channel?: string;
57
58
  }): Promise<ITime[]>;
58
59
  storeProduct(productData: ProductData): Promise<void>;
59
60
  addAccount(account: Account | IHolder, extra?: {
@@ -208,7 +208,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
208
208
  async loadScheduleAvailableDate({
209
209
  startDate,
210
210
  endDate,
211
- custom_page_id
211
+ custom_page_id,
212
+ channel
212
213
  }) {
213
214
  var _a;
214
215
  if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
@@ -224,7 +225,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
224
225
  {
225
226
  start_date: startDate,
226
227
  end_date: endDate,
227
- custom_page_id
228
+ custom_page_id,
229
+ channel
228
230
  }
229
231
  );
230
232
  this.store.schedule.setAvailabilityScheduleDateList(res.data.date_list);
@@ -232,11 +234,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
232
234
  return dates;
233
235
  }
234
236
  res.data.date_list.forEach((n) => {
235
- if (n.schedule_id && n.schedule_id.length) {
236
- const index = dates.findIndex((m) => m.date === n.date);
237
- if (index !== -1) {
238
- dates[index].status = "available";
239
- }
237
+ const index = dates.findIndex((m) => m.date === n.date);
238
+ if (index !== -1) {
239
+ dates[index].status = "available";
240
240
  }
241
241
  });
242
242
  dates = (0, import_utils3.disableDatesBeforeOneDay)(dates);
@@ -646,7 +646,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
646
646
  });
647
647
  n.renderList = n.renderList.filter((m) => {
648
648
  const recordCount = capacityMap[m.id] || 0;
649
- const canUseTime = m.times.find((item) => {
649
+ const canUseArr = m.times.map((item) => {
650
650
  const res = (0, import_resources.getIsUsableByTimeItem)({
651
651
  timeSlice: {
652
652
  start_time: startTime.format("HH:mm"),
@@ -664,7 +664,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
664
664
  }
665
665
  return res.usable;
666
666
  });
667
- return canUseTime;
667
+ return !canUseArr.some((n2) => n2 === false);
668
+ });
669
+ });
670
+ } else {
671
+ productResources.forEach((item) => {
672
+ item.renderList = item.renderList.filter((n) => {
673
+ const recordCount = n.capacity || 0;
674
+ return recordCount >= currentCapacity;
668
675
  });
669
676
  });
670
677
  }
@@ -918,6 +925,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
918
925
  resources2.forEach((n) => {
919
926
  var _a3;
920
927
  if ((_a3 = n.renderList) == null ? void 0 : _a3.length) {
928
+ n.renderList = n.renderList.filter((m) => {
929
+ const recordCount = m.capacity || 0;
930
+ return recordCount >= currentCapacity;
931
+ });
921
932
  currentResourcesRenderList.push(...n.renderList || []);
922
933
  }
923
934
  });
@@ -981,13 +992,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
981
992
  }
982
993
  // 从购物车中获取已经分配好第一步资源的所有时间片
983
994
  getTimeSlotByAllResources(resources_code) {
984
- var _a, _b, _c, _d;
995
+ var _a, _b, _c, _d, _e, _f;
985
996
  let dateRange = this.store.date.getDateRange();
986
997
  const resources = [];
987
998
  const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
988
999
  const resourceIds = [];
1000
+ let resourcesTypeId = void 0;
989
1001
  cartItems.forEach((item) => {
990
- var _a2, _b2, _c2;
1002
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
991
1003
  (_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.forEach((n) => {
992
1004
  if (n.code === resources_code) {
993
1005
  resources.push(...n.renderList || []);
@@ -996,7 +1008,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
996
1008
  if (item.resource_id) {
997
1009
  resourceIds.push(item.resource_id);
998
1010
  }
1011
+ resourcesTypeId = (_g = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find((n) => n.code === resources_code)) == null ? void 0 : _g.id;
999
1012
  });
1013
+ if ((_b = (_a = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _a.resource) == null ? void 0 : _b.length) {
1014
+ dateRange[0].resource.forEach((n) => {
1015
+ if (n.form_id === resourcesTypeId) {
1016
+ resources.push(n);
1017
+ }
1018
+ });
1019
+ }
1000
1020
  const resourcesMap = (0, import_utils.getResourcesMap)(resources);
1001
1021
  let duration = 0;
1002
1022
  const accountList = this.store.accountList.getAccounts();
@@ -1018,7 +1038,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1018
1038
  } else {
1019
1039
  checkDuration(cartItems);
1020
1040
  }
1021
- if (!((_a = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _a.start_date) && !((_b = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _b.resource_id) || !(cartItems == null ? void 0 : cartItems[0].duration)) {
1041
+ if (!((_c = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _c.start_date) && !((_d = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _d.resource_id) || !(cartItems == null ? void 0 : cartItems[0].duration)) {
1022
1042
  return [];
1023
1043
  }
1024
1044
  if ((cartItems == null ? void 0 : cartItems[0].start_date) && !dateRange) {
@@ -1030,7 +1050,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1030
1050
  weekNum: 0
1031
1051
  },
1032
1052
  {
1033
- date: ((_c = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _c.end_date) || ((_d = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _d.start_date) || "",
1053
+ date: ((_e = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _e.end_date) || ((_f = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _f.start_date) || "",
1034
1054
  status: "available",
1035
1055
  week: "",
1036
1056
  weekNum: 0
@@ -313,6 +313,10 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
313
313
  if (result == null ? void 0 : result.data) {
314
314
  const { wallet_pass_list, ...customer } = result.data;
315
315
  this.setCustomer(customer);
316
+ await this.core.effects.emit(
317
+ import_types.ShopDiscountHooks.onScanCustomerChange,
318
+ customer
319
+ );
316
320
  }
317
321
  } catch (error) {
318
322
  console.error("[ShopDiscount] 获取客户钱包信息出错:", error);
@@ -5,6 +5,7 @@ export declare enum ShopDiscountHooks {
5
5
  onDestroy = "shopDiscount:onDestroy",
6
6
  onLoadDiscountList = "shopDiscount:onLoadDiscountList",
7
7
  onCustomerChange = "shopDiscount:onCustomerChange",
8
+ onScanCustomerChange = "shopDiscount:onScanCustomerChange",
8
9
  onDiscountListChange = "shopDiscount:onDiscountListChange",
9
10
  onRulesListChange = "shopDiscount:onRulesListChange",
10
11
  onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
@@ -27,6 +27,7 @@ var ShopDiscountHooks = /* @__PURE__ */ ((ShopDiscountHooks2) => {
27
27
  ShopDiscountHooks2["onDestroy"] = "shopDiscount:onDestroy";
28
28
  ShopDiscountHooks2["onLoadDiscountList"] = "shopDiscount:onLoadDiscountList";
29
29
  ShopDiscountHooks2["onCustomerChange"] = "shopDiscount:onCustomerChange";
30
+ ShopDiscountHooks2["onScanCustomerChange"] = "shopDiscount:onScanCustomerChange";
30
31
  ShopDiscountHooks2["onDiscountListChange"] = "shopDiscount:onDiscountListChange";
31
32
  ShopDiscountHooks2["onRulesListChange"] = "shopDiscount:onRulesListChange";
32
33
  ShopDiscountHooks2["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.8",
4
+ "version": "2.0.9",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",