@pisell/private-materials 3.0.149 → 3.0.151-gray

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 (79) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +12 -12
  11. package/es/components/booking/addons/model.d.ts +2 -1
  12. package/es/components/booking/components/footer/index.js +3 -3
  13. package/es/components/booking/dashboard/index.d.ts +10 -0
  14. package/es/components/booking/dashboard/index.js +242 -0
  15. package/es/components/booking/dashboard/serve.d.ts +1 -0
  16. package/es/components/booking/dashboard/serve.js +27 -0
  17. package/es/components/booking/forms/forms.d.ts +1 -0
  18. package/es/components/booking/forms/forms.js +4 -2
  19. package/es/components/booking/forms/model.d.ts +2 -1
  20. package/es/components/booking/forms/single/index.d.ts +1 -1
  21. package/es/components/booking/forms/single/index.js +4 -3
  22. package/es/components/booking/info/addServiceVariant/index.d.ts +7 -0
  23. package/es/components/booking/info/addServiceVariant/index.js +33 -0
  24. package/es/components/booking/info/index.js +2 -1
  25. package/es/components/booking/info/index.less +9 -0
  26. package/es/components/booking/info/pet/index.js +1 -1
  27. package/es/components/booking/info/service/addService/index.d.ts +8 -2
  28. package/es/components/booking/info/service/addService/index.js +82 -36
  29. package/es/components/booking/info/service/addService/index.less +27 -1
  30. package/es/components/booking/info/service/editService/index.js +7 -9
  31. package/es/components/booking/locales.d.ts +48 -0
  32. package/es/components/booking/locales.js +51 -3
  33. package/es/components/booking/model.d.ts +2 -0
  34. package/es/components/booking/notes/index.d.ts +1 -1
  35. package/es/components/booking/notes/model.d.ts +2 -1
  36. package/es/components/booking/payments/model.d.ts +2 -1
  37. package/es/components/booking/utils.d.ts +1 -1
  38. package/es/components/booking/utils.js +54 -51
  39. package/es/components/schedules/index.d.ts +1 -1
  40. package/es/components/schedules/model.d.ts +2 -1
  41. package/es/index.d.ts +2 -0
  42. package/es/index.js +3 -1
  43. package/lib/components/booking/addons/model.d.ts +2 -1
  44. package/lib/components/booking/components/footer/index.js +3 -3
  45. package/lib/components/booking/dashboard/index.d.ts +10 -0
  46. package/lib/components/booking/dashboard/index.js +225 -0
  47. package/lib/components/booking/dashboard/serve.d.ts +1 -0
  48. package/lib/components/booking/dashboard/serve.js +33 -0
  49. package/lib/components/booking/forms/forms.d.ts +1 -0
  50. package/lib/components/booking/forms/forms.js +5 -2
  51. package/lib/components/booking/forms/model.d.ts +2 -1
  52. package/lib/components/booking/forms/single/index.d.ts +1 -1
  53. package/lib/components/booking/forms/single/index.js +4 -2
  54. package/lib/components/booking/info/addServiceVariant/index.d.ts +7 -0
  55. package/lib/components/booking/info/addServiceVariant/index.js +58 -0
  56. package/lib/components/booking/info/client/index.js +1 -8
  57. package/lib/components/booking/info/index.js +4 -1
  58. package/lib/components/booking/info/index.less +9 -0
  59. package/lib/components/booking/info/pet/index.js +2 -1
  60. package/lib/components/booking/info/service/addService/index.d.ts +8 -2
  61. package/lib/components/booking/info/service/addService/index.js +67 -29
  62. package/lib/components/booking/info/service/addService/index.less +27 -1
  63. package/lib/components/booking/info/service/editService/index.js +6 -3
  64. package/lib/components/booking/locales.d.ts +48 -0
  65. package/lib/components/booking/locales.js +51 -3
  66. package/lib/components/booking/model.d.ts +2 -0
  67. package/lib/components/booking/notes/index.d.ts +1 -1
  68. package/lib/components/booking/notes/model.d.ts +2 -1
  69. package/lib/components/booking/payments/model.d.ts +2 -1
  70. package/lib/components/booking/utils.d.ts +1 -1
  71. package/lib/components/booking/utils.js +57 -22
  72. package/lib/components/schedules/index.d.ts +1 -1
  73. package/lib/components/schedules/model.d.ts +2 -1
  74. package/lib/index.d.ts +2 -0
  75. package/lib/index.js +6 -0
  76. package/lowcode/booking-dashboard/meta.ts +130 -0
  77. package/lowcode/booking-vertical-add-service/meta.ts +124 -0
  78. package/lowcode/vertical-add-service/meta.ts +71 -0
  79. package/package.json +2 -2
@@ -14,7 +14,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
14
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
15
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
16
  import dayjs from 'dayjs';
17
- import { locales } from "@pisell/utils";
17
+ import { locales } from '@pisell/utils';
18
18
  import { intersectionBy } from 'lodash';
19
19
  var Request = /*#__PURE__*/function () {
20
20
  function Request() {
@@ -38,7 +38,7 @@ export var request = new Request();
38
38
 
39
39
  /**
40
40
  * @title: 格式化持续时长用于展示
41
- * @description:
41
+ * @description:
42
42
  * @param {number} service_times
43
43
  * @return {*}
44
44
  * @Author: zhiwei.Wang
@@ -46,12 +46,12 @@ export var request = new Request();
46
46
  */
47
47
  export var getDiscountTime = function getDiscountTime(service_times) {
48
48
  if (!service_times) {
49
- return "";
49
+ return '';
50
50
  }
51
51
  if (service_times < 60) {
52
52
  return "".concat(service_times, " ").concat(locales.getText('pisell2.text.min'));
53
53
  } else {
54
- var str = "";
54
+ var str = '';
55
55
  var hours = Math.floor(service_times / 60);
56
56
  var minutes = service_times % 60;
57
57
  str += "".concat(hours).concat(locales.getText('pisell2.text.h'));
@@ -64,7 +64,7 @@ export var getDiscountTime = function getDiscountTime(service_times) {
64
64
 
65
65
  /**
66
66
  * @title: 时间切片
67
- * @description:
67
+ * @description:
68
68
  * @param {any} config
69
69
  * @param {string} locale
70
70
  * @return {*}
@@ -75,22 +75,22 @@ export var sliceDayIntoFiveMinutes = function sliceDayIntoFiveMinutes(config, lo
75
75
  var _locale = locale;
76
76
  var dayjsLocale = _locale === 'en-US' || _locale === 'en' ? 'en' : 'zh-cn';
77
77
  dayjs.locale(dayjsLocale);
78
- var startTime = dayjs().startOf("day");
79
- var endTime = dayjs().endOf("day");
78
+ var startTime = dayjs().startOf('day');
79
+ var endTime = dayjs().endOf('day');
80
80
  var timeSlice = (config === null || config === void 0 ? void 0 : config.value) || 5; // 切片时间间隔(分钟)
81
81
 
82
82
  var timeSlices = [];
83
83
  var durationSlicesBasedOnTime = [];
84
84
  var currentTime = startTime;
85
85
  while (currentTime.isBefore(endTime)) {
86
- var timeLabel = currentTime.format("hh:mm A");
87
- var timeValue = currentTime.format("HH:mm");
86
+ var timeLabel = currentTime.format('hh:mm A');
87
+ var timeValue = currentTime.format('HH:mm');
88
88
  timeSlices.push({
89
89
  label: timeLabel,
90
90
  value: timeValue
91
91
  });
92
- var nextTime = currentTime.add(timeSlice, "minute");
93
- var durationValue = nextTime.diff(startTime, "minute");
92
+ var nextTime = currentTime.add(timeSlice, 'minute');
93
+ var durationValue = nextTime.diff(startTime, 'minute');
94
94
  if (durationValue > 60) {
95
95
  var durationLabel = getDiscountTime(durationValue);
96
96
  durationSlicesBasedOnTime.push({
@@ -114,7 +114,7 @@ export var sliceDayIntoFiveMinutes = function sliceDayIntoFiveMinutes(config, lo
114
114
 
115
115
  // 获取当前时间
116
116
  export var getNowTime = function getNowTime() {
117
- return dayjs().format("HH:mm");
117
+ return dayjs().format('HH:mm');
118
118
  };
119
119
  export var isNowTime = function isNowTime(time) {
120
120
  return time === 'now';
@@ -122,7 +122,7 @@ export var isNowTime = function isNowTime(time) {
122
122
 
123
123
  /**
124
124
  * @title: 获取服务的开始时间, 如果是now 转换为当前的时间
125
- * @description:
125
+ * @description:
126
126
  * @param {string} start_time
127
127
  * @return {*}
128
128
  * @Author: zhiwei.Wang
@@ -137,7 +137,7 @@ export var getServeStartTime = function getServeStartTime(start_time) {
137
137
 
138
138
  /**
139
139
  * @title: 格式化服务的 开始时间-结束时间-时长, 用于展示
140
- * @description:
140
+ * @description:
141
141
  * @param {any} item
142
142
  * @param {any} currentDate
143
143
  * @return {*}
@@ -146,8 +146,8 @@ export var getServeStartTime = function getServeStartTime(start_time) {
146
146
  */
147
147
  export var getServiceTime = function getServiceTime(item, currentDate) {
148
148
  var startDate = dayjs(currentDate.format('YYYY-MM-DD') + ' ' + getServeStartTime(item._extend.start_time));
149
- var startTime = startDate.format("HH:mm");
150
- var endTime = startDate.add(flexibleObj.getValue(item._extend.duration), "minute").format("HH:mm");
149
+ var startTime = startDate.format('HH:mm');
150
+ var endTime = startDate.add(flexibleObj.getValue(item._extend.duration), 'minute').format('HH:mm');
151
151
  var duration = getDiscountTime(flexibleObj.getValue(item._extend.duration));
152
152
  return "".concat(startTime, " - ").concat(endTime, " ( ").concat(duration, " )");
153
153
  };
@@ -203,17 +203,17 @@ export var formatProductListByCategory = function formatProductListByCategory(li
203
203
  });
204
204
  }
205
205
  } else {
206
- if (!categoryObject["other"]) {
207
- categoryObject["other"] = {
206
+ if (!categoryObject['other']) {
207
+ categoryObject['other'] = {
208
208
  id: 0,
209
209
  title: locales.getText('pisell2.text.other'),
210
210
  name: locales.getText('pisell2.text.other'),
211
- cover: "",
211
+ cover: '',
212
212
  products: []
213
213
  };
214
214
  }
215
- categoryObject["other"] = _objectSpread(_objectSpread({}, categoryObject["other"]), {}, {
216
- products: [].concat(_toConsumableArray(categoryObject["other"].products), [productItem])
215
+ categoryObject['other'] = _objectSpread(_objectSpread({}, categoryObject['other']), {}, {
216
+ products: [].concat(_toConsumableArray(categoryObject['other'].products), [productItem])
217
217
  });
218
218
  }
219
219
  }
@@ -222,7 +222,7 @@ export var formatProductListByCategory = function formatProductListByCategory(li
222
222
  });
223
223
  };
224
224
  export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cacheItem) {
225
- var startDate = dayjs(cacheItem._extend.start_date.format("YYYY-MM-DD") + ' ' + getServeStartTime(cacheItem._extend.start_time));
225
+ var startDate = dayjs(cacheItem._extend.start_date.format('YYYY-MM-DD') + ' ' + getServeStartTime(cacheItem._extend.start_time));
226
226
  var isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
227
227
 
228
228
  // 是否在最大预约数量的区间内
@@ -236,10 +236,10 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
236
236
  isMaxLimitRange = true;
237
237
  } else {
238
238
  // unknown 为 未知的, 需要掉接口确认是否可用
239
- isMaxLimitRange = "unknown";
239
+ isMaxLimitRange = 'unknown';
240
240
  }
241
- var timeStartDate = dayjs(time.start_date + " " + time.start_time).subtract(1, "second");
242
- var timeEndDate = dayjs(time.end_date + " " + time.end_time).add(1, "second");
241
+ var timeStartDate = dayjs(time.start_date + ' ' + time.start_time).subtract(1, 'second');
242
+ var timeEndDate = dayjs(time.end_date + ' ' + time.end_time).add(1, 'second');
243
243
  var bol;
244
244
 
245
245
  // 灵活时长的 只判断开始时间是否在范围内
@@ -247,7 +247,7 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
247
247
  bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
248
248
  } else {
249
249
  // 其余判断 开始时间 和 结束时间 是否都在范围内
250
- var endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), "minute");
250
+ var endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), 'minute');
251
251
  bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
252
252
  }
253
253
 
@@ -291,8 +291,8 @@ export var formatTimes = function formatTimes(resourceItem, cacheItem) {
291
291
 
292
292
  // 获取第一个最佳的time
293
293
  var _time = (usableTimes || []).sort(function (a, b) {
294
- var aEndDate = dayjs(a.end_date + " " + a.end_time).valueOf();
295
- var bEndDate = dayjs(b.end_date + " " + b.end_time).valueOf();
294
+ var aEndDate = dayjs(a.end_date + ' ' + a.end_time).valueOf();
295
+ var bEndDate = dayjs(b.end_date + ' ' + b.end_time).valueOf();
296
296
  return aEndDate - bEndDate;
297
297
  })[0];
298
298
  resourceItem._extend = _objectSpread(_objectSpread({}, resourceItem._extend), {}, {
@@ -317,21 +317,21 @@ var formatResourceProducts = function formatResourceProducts(resourceItem, curre
317
317
  var type = _resourceItem.partyroom_package.type;
318
318
 
319
319
  // 全部商品
320
- if (type === "product_all") {
320
+ if (type === 'product_all') {
321
321
  usableProduct = true;
322
322
  } else {
323
- if (type === "product_collection") {
323
+ if (type === 'product_collection') {
324
324
  var _resourceItem$partyro;
325
325
  // 取交集 intersectionBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); // => [{ 'x': 2 }]
326
326
  usableProduct = !!intersectionBy(((_resourceItem$partyro = _resourceItem.partyroom_package) === null || _resourceItem$partyro === void 0 ? void 0 : _resourceItem$partyro.products.map(function (item) {
327
327
  return _objectSpread(_objectSpread({}, item), {}, {
328
328
  id: item.product_collection_id
329
329
  });
330
- })) || [], currentItem.collection || [], "id").length;
330
+ })) || [], currentItem.collection || [], 'id').length;
331
331
  } else {
332
332
  usableProduct = _resourceItem.partyroom_package.products.some(function (item) {
333
333
  // 判断商品
334
- if (type === "products") {
334
+ if (type === 'products') {
335
335
  if (item.product_id == currentItem.product_id) {
336
336
  return true;
337
337
  }
@@ -348,7 +348,7 @@ var formatResourceProducts = function formatResourceProducts(resourceItem, curre
348
348
 
349
349
  /**
350
350
  * @title: 获取店铺的营业结束时间
351
- * @description:
351
+ * @description:
352
352
  * @return {*}
353
353
  * @Author: zhiwei.Wang
354
354
  * @Date: 2024-02-23 10:00
@@ -359,7 +359,7 @@ export var getShopOpeningHours = function getShopOpeningHours() {
359
359
 
360
360
  /**
361
361
  * @title: 对灵活时长进行处理
362
- * @description:
362
+ * @description:
363
363
  * @return {*}
364
364
  * @Author: zhiwei.Wang
365
365
  * @Date: 2024-02-23 10:00
@@ -405,7 +405,7 @@ export var flexibleObj = {
405
405
  export var getEndDate = function getEndDate(startDate, duration, endDate) {
406
406
  if (duration === 'flexible') {
407
407
  // 店铺营业结束时间
408
- var openingDate = dayjs(startDate.format("YYYY-MM-DD") + ' ' + getShopOpeningHours());
408
+ var openingDate = dayjs(startDate.format('YYYY-MM-DD') + ' ' + getShopOpeningHours());
409
409
 
410
410
  // 如果选择的开始时间 > 店铺的营业时间, 店铺营业时间向后推一天
411
411
  if (dayjs(startDate).isAfter(openingDate)) {
@@ -421,14 +421,14 @@ export var getEndDate = function getEndDate(startDate, duration, endDate) {
421
421
  }
422
422
  return endDate;
423
423
  }
424
- return startDate.add(duration, "minute");
424
+ return startDate.add(duration, 'minute');
425
425
  };
426
426
 
427
427
  // export const get
428
428
 
429
429
  export var getServiceTimes = function getServiceTimes(service) {
430
- var startDate = dayjs(dayjs(service._extend.start_date).format("YYYY-MM-DD ") + getServeStartTime(service._extend.start_time));
431
- var endDate = startDate.add(flexibleObj.getValue(service._extend.duration), "minute");
430
+ var startDate = dayjs(dayjs(service._extend.start_date).format('YYYY-MM-DD ') + getServeStartTime(service._extend.start_time));
431
+ var endDate = startDate.add(flexibleObj.getValue(service._extend.duration), 'minute');
432
432
  return {
433
433
  startDate: startDate,
434
434
  endDate: endDate
@@ -438,7 +438,7 @@ export var getErrorList = function getErrorList(resource, cacheItem) {
438
438
  if (!(cacheItem !== null && cacheItem !== void 0 && cacheItem.id)) {
439
439
  return [{
440
440
  label: locales.getText('pisell2.text.no-product-added'),
441
- type: "products"
441
+ type: 'products'
442
442
  }];
443
443
  }
444
444
  if (!resource || !resource._extend || !cacheItem) {
@@ -452,29 +452,29 @@ export var getErrorList = function getErrorList(resource, cacheItem) {
452
452
  if (!(resource !== null && resource !== void 0 && (_resource$_extend = resource._extend) !== null && _resource$_extend !== void 0 && _resource$_extend.usableProduct)) {
453
453
  list.push({
454
454
  label: locales.getText('pisell1.text.resource-error-message-1')(resource.labelText, cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.title),
455
- type: "product"
455
+ type: 'product'
456
456
  });
457
457
  }
458
458
  var _getServiceTimes = getServiceTimes(cacheItem),
459
459
  startDate = _getServiceTimes.startDate,
460
460
  endDate = _getServiceTimes.endDate;
461
461
  // 如果跨天 结束时间前面加一个明天
462
- var startText = startDate.format("hh:mm A");
463
- var endText = endDate.format("hh:mm A");
464
- if (dayjs(endDate).isAfter(startDate, "day")) {
462
+ var startText = startDate.format('hh:mm A');
463
+ var endText = endDate.format('hh:mm A');
464
+ if (dayjs(endDate).isAfter(startDate, 'day')) {
465
465
  endText = locales.getText('pisell1.text.tomorrow') + endText;
466
466
  }
467
467
  if (!((_resource$_extend2 = resource._extend) !== null && _resource$_extend2 !== void 0 && _resource$_extend2.usableTime)) {
468
468
  list.push({
469
469
  label: locales.getText('pisell1.text.resource-error-message-2')(resource.labelText, startText, endText),
470
- type: "time"
470
+ type: 'time'
471
471
  });
472
472
  } else {
473
473
  var _resource$_extend3;
474
474
  if (!((_resource$_extend3 = resource._extend) !== null && _resource$_extend3 !== void 0 && _resource$_extend3.usableTime._extend.isMaxLimitRange)) {
475
475
  list.push({
476
476
  label: locales.getText('pisell1.text.resource-error-message-3')(resource.labelText, startText, endText),
477
- type: "limit"
477
+ type: 'limit'
478
478
  });
479
479
  }
480
480
  }
@@ -526,7 +526,7 @@ export var deleteCacheParams = function deleteCacheParams() {
526
526
 
527
527
  /**
528
528
  * @title: 创建一个服务商品
529
- * @description:
529
+ * @description:
530
530
  * @param {any} state
531
531
  * @param {any} item
532
532
  * @return {*}
@@ -555,10 +555,10 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
555
555
  var lastServerStartDate = lastServer._extend.startDate;
556
556
  var lastServerEndDate = lastServer._extend.endDate;
557
557
  // 如果上个服务商品的结束时间跨天, 那么设置为最后一个时间段, 不跨天则取上一个的结束时间
558
- if (dayjs(lastServerEndDate).isAfter(lastServerStartDate, "day")) {
558
+ if (dayjs(lastServerEndDate).isAfter(lastServerStartDate, 'day')) {
559
559
  _extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
560
560
  } else {
561
- _extend.start_time = lastServerEndDate.format("HH:mm");
561
+ _extend.start_time = lastServerEndDate.format('HH:mm');
562
562
  }
563
563
  } else {
564
564
  // 没有上一个商品 资源为 0
@@ -584,14 +584,17 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
584
584
  _extend.resource = resourceId;
585
585
  }
586
586
  }
587
- console.log("_extend", findNextSliceProps);
588
587
 
589
588
  // 只有选择了带 HH:mm的日期才选中, 否则使用当前日期
590
589
  if (findNextSliceProps.date && findNextSliceProps.date !== '00:00') {
591
590
  _extend.start_time = findNextSlice(findNextSliceProps);
592
591
  } else {
593
- // 没有预设日期, 则使用当前 https://www.yuque.com/feg4xm/manual/tzvrnt05ifihkndg
594
- _extend.start_time = dayjs().format('HH:mm');
592
+ if (cacheItem.currentDefaultTime) {
593
+ _extend.start_time = cacheItem.currentDefaultTime;
594
+ } else {
595
+ // 没有预设日期, 则使用当前 https://www.yuque.com/feg4xm/manual/tzvrnt05ifihkndg
596
+ _extend.start_time = dayjs().format('HH:mm');
597
+ }
595
598
  }
596
599
  }
597
600
  _extend = _objectSpread(_objectSpread({}, _extend), cacheItem._extend);
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => JSX.Element;
2
+ declare const Schedules: (props: any) => any;
3
3
  export default Schedules;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CalendarDataItem, ScheduleItem } from "./type";
2
3
  import dayjs from "dayjs";
3
4
  export interface FormState {
@@ -68,7 +69,7 @@ export interface FormState {
68
69
  };
69
70
  setGlobalState: Function | null;
70
71
  }
71
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
72
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
72
73
  state: FormState;
73
74
  } & {
74
75
  dispatch: (params: {
package/es/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { default as BookingStartTime } from './components/booking/materiels/star
12
12
  export { default as BookingDuration } from './components/booking/materiels/duration';
13
13
  export { default as BookingContacts } from './components/booking/materiels/contacts';
14
14
  export { VerticalClient } from './components/booking/info/clientVariant';
15
+ export { default as VerticalAddService } from './components/booking/info/addServiceVariant';
15
16
  export { default as ProductExtension } from './components/productExtension';
16
17
  export { default as BookingDeposit } from './components/booking/deposit';
17
18
  export { default as RuleSetting } from './components/ruleSetting';
@@ -19,3 +20,4 @@ export { default as TaxSelect } from './components/taxSelect';
19
20
  export { default as ToCPay } from './components/pay/toC';
20
21
  export { default as Eftpos } from './components/eftpos';
21
22
  export { default as EftposPay } from './components/eftposPay';
23
+ export { default as BookingDashboard } from './components/booking/dashboard';
package/es/index.js CHANGED
@@ -16,10 +16,12 @@ export { default as BookingStartTime } from "./components/booking/materiels/star
16
16
  export { default as BookingDuration } from "./components/booking/materiels/duration";
17
17
  export { default as BookingContacts } from "./components/booking/materiels/contacts";
18
18
  export { VerticalClient } from "./components/booking/info/clientVariant";
19
+ export { default as VerticalAddService } from "./components/booking/info/addServiceVariant";
19
20
  export { default as ProductExtension } from "./components/productExtension";
20
21
  export { default as BookingDeposit } from "./components/booking/deposit";
21
22
  export { default as RuleSetting } from "./components/ruleSetting";
22
23
  export { default as TaxSelect } from "./components/taxSelect";
23
24
  export { default as ToCPay } from "./components/pay/toC";
24
25
  export { default as Eftpos } from "./components/eftpos";
25
- export { default as EftposPay } from "./components/eftposPay";
26
+ export { default as EftposPay } from "./components/eftposPay";
27
+ export { default as BookingDashboard } from "./components/booking/dashboard";
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
4
  state: FormState;
4
5
  } & {
5
6
  dispatch: (params: {
@@ -595,7 +595,7 @@ var Footer = (props) => {
595
595
  }
596
596
  if (transaction_habit_selection.button_rows == 1) {
597
597
  if (state.appointment_status !== "cancelled") {
598
- if (!state.disabledEdit) {
598
+ if (!state.disabledEdit && !state.isBookingCreatePage) {
599
599
  arr.push(actionMap.sale);
600
600
  }
601
601
  }
@@ -695,7 +695,7 @@ var Footer = (props) => {
695
695
  if (!state.bookingDetail) {
696
696
  return true;
697
697
  }
698
- if (!((_a2 = state.addons) == null ? void 0 : _a2.load) && state.renderType !== "eventBooking") {
698
+ if (!((_a2 = state.addons) == null ? void 0 : _a2.load) && state.renderType !== "eventBooking" && !state.isBookingCreatePage) {
699
699
  return true;
700
700
  }
701
701
  }
@@ -809,7 +809,7 @@ var Footer = (props) => {
809
809
  className: "pisell-lowcode__booking-footer-buttons",
810
810
  style: { marginTop: 12 }
811
811
  },
812
- state.appointment_status !== "cancelled" ? /* @__PURE__ */ import_react.default.createElement(
812
+ state.appointment_status !== "cancelled" && !state.isBookingCreatePage ? /* @__PURE__ */ import_react.default.createElement(
813
813
  import_antd2.Button,
814
814
  {
815
815
  onClick: () => handleSale(),
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface BookingDashboardProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ backgroundColors?: string[];
4
+ labelColor?: string;
5
+ valueColor?: string;
6
+ otherParams?: Record<string, any>;
7
+ refreshKey?: string;
8
+ }
9
+ declare const BookingDashboard: (props: BookingDashboardProps) => React.JSX.Element;
10
+ export default BookingDashboard;
@@ -0,0 +1,225 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/booking/dashboard/index.tsx
30
+ var dashboard_exports = {};
31
+ __export(dashboard_exports, {
32
+ default: () => dashboard_default
33
+ });
34
+ module.exports = __toCommonJS(dashboard_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_materials = require("@pisell/materials");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_dayjs = __toESM(require("dayjs"));
39
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
40
+ var import_utils2 = require("../utils");
41
+ var import_serve = require("./serve");
42
+ var import_locales = __toESM(require("../locales"));
43
+ import_utils.locales.init(import_locales.default, localStorage.getItem("umi_locale") || "en");
44
+ var BookingDashboard = (props) => {
45
+ const {
46
+ otherParams = {},
47
+ backgroundColors,
48
+ labelColor,
49
+ valueColor,
50
+ refreshKey,
51
+ ...others
52
+ } = props;
53
+ const context = (0, import_useEngineContext.default)();
54
+ import_utils2.request.setRequest(context.appHelper.utils.request);
55
+ const [data, setData] = (0, import_react.useState)([
56
+ // 当前在场团体
57
+ {
58
+ label: import_utils.locales.getText("pisell2.booking.dashboard.groups-on-site-now"),
59
+ value: "-",
60
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.groups-on-site-now-tip")
61
+ },
62
+ // 当前在场人数
63
+ {
64
+ label: import_utils.locales.getText("pisell2.booking.dashboard.people-on-site-now"),
65
+ value: "-",
66
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.people-on-site-now-tip")
67
+ },
68
+ // 今日游客总数
69
+ {
70
+ label: import_utils.locales.getText("pisell2.booking.dashboard.total-visitors-today"),
71
+ value: "-",
72
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.total-visitors-today-tip")
73
+ },
74
+ // 正在进行中的游客
75
+ {
76
+ label: import_utils.locales.getText("pisell2.booking.dashboard.ongoing-visitors"),
77
+ value: "-",
78
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.ongoing-visitors-tip")
79
+ },
80
+ // 即将到达的游客
81
+ {
82
+ label: import_utils.locales.getText("pisell2.booking.dashboard.upcoming-visitors"),
83
+ value: "-",
84
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.upcoming-visitors-tip")
85
+ },
86
+ // 超时的游客
87
+ {
88
+ label: import_utils.locales.getText("pisell2.booking.dashboard.overdue-visitors"),
89
+ value: "-",
90
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.overdue-visitors-tip")
91
+ },
92
+ // 已完成的游客
93
+ {
94
+ label: import_utils.locales.getText("pisell2.booking.dashboard.completed-visitors"),
95
+ value: "-",
96
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.completed-visitors-tip")
97
+ },
98
+ // 已离场的游客
99
+ {
100
+ label: import_utils.locales.getText("pisell2.booking.dashboard.departed-visitors"),
101
+ value: "-",
102
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.departed-visitors-tip")
103
+ }
104
+ ]);
105
+ const [bookingData, setBookingData] = (0, import_react.useState)([]);
106
+ const getData = async () => {
107
+ const data2 = await (0, import_serve.getBookingList)({
108
+ ...otherParams,
109
+ item_type: "appointment_booking",
110
+ parent_id: 0,
111
+ with: ["children"],
112
+ child_booking: 0,
113
+ skip: 1,
114
+ num: 1e3
115
+ });
116
+ setBookingData(data2.list);
117
+ };
118
+ const calcBookingDataCount = (data2) => {
119
+ let groupsOnSiteNow = "-";
120
+ let peopleOnSiteNow = "-";
121
+ let totalVisitorsToday = 0;
122
+ let ongoing = 0;
123
+ let upcoming = 0;
124
+ let overdue = "-";
125
+ let completed = 0;
126
+ let departed = "-";
127
+ data2.forEach((item) => {
128
+ if ((0, import_utils.isArr)(item.children)) {
129
+ item.children.forEach((child) => {
130
+ const start = (0, import_dayjs.default)(`${child.start_date} ${child.start_time}`);
131
+ const end = (0, import_dayjs.default)(`${child.end_date} ${child.end_time}`);
132
+ totalVisitorsToday += child.number;
133
+ if (start < (0, import_dayjs.default)() && end > (0, import_dayjs.default)()) {
134
+ ongoing += child.number || 1;
135
+ }
136
+ if ((0, import_dayjs.default)() < start) {
137
+ upcoming += child.number || 1;
138
+ }
139
+ if ((0, import_dayjs.default)() > end) {
140
+ completed += child.number || 1;
141
+ }
142
+ });
143
+ }
144
+ });
145
+ setData([
146
+ // 当前在场团体
147
+ {
148
+ label: import_utils.locales.getText("pisell2.booking.dashboard.groups-on-site-now"),
149
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.groups-on-site-now-tip"),
150
+ value: `${groupsOnSiteNow}`
151
+ },
152
+ // 当前在场人数
153
+ {
154
+ label: import_utils.locales.getText("pisell2.booking.dashboard.people-on-site-now"),
155
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.people-on-site-now-tip"),
156
+ value: `${peopleOnSiteNow}`
157
+ },
158
+ // 今日游客总数
159
+ {
160
+ label: import_utils.locales.getText("pisell2.booking.dashboard.total-visitors-today"),
161
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.total-visitors-today-tip"),
162
+ value: `${totalVisitorsToday}`
163
+ },
164
+ // 正在进行中的游客
165
+ {
166
+ label: import_utils.locales.getText("pisell2.booking.dashboard.ongoing-visitors"),
167
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.ongoing-visitors-tip"),
168
+ value: `${ongoing}`
169
+ },
170
+ // 即将到达的游客
171
+ {
172
+ label: import_utils.locales.getText("pisell2.booking.dashboard.upcoming-visitors"),
173
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.upcoming-visitors-tip"),
174
+ value: `${upcoming}`
175
+ },
176
+ // 超时的游客
177
+ {
178
+ label: import_utils.locales.getText("pisell2.booking.dashboard.overdue-visitors"),
179
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.overdue-visitors-tip"),
180
+ value: `${overdue}`
181
+ },
182
+ // 已完成的游客
183
+ {
184
+ label: import_utils.locales.getText("pisell2.booking.dashboard.completed-visitors"),
185
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.completed-visitors-tip"),
186
+ value: `${completed}`
187
+ },
188
+ // 已离场的游客
189
+ {
190
+ label: import_utils.locales.getText("pisell2.booking.dashboard.departed-visitors"),
191
+ tip: import_utils.locales.getText("pisell2.booking.dashboard.departed-visitors-tip"),
192
+ value: `${departed}`
193
+ }
194
+ ]);
195
+ };
196
+ (0, import_react.useEffect)(() => {
197
+ calcBookingDataCount(bookingData);
198
+ const timer = setInterval(() => {
199
+ calcBookingDataCount(bookingData);
200
+ }, 60 * 1e3);
201
+ return () => {
202
+ clearInterval(timer);
203
+ };
204
+ }, [bookingData]);
205
+ (0, import_react.useEffect)(() => {
206
+ getData();
207
+ const timer = setInterval(() => {
208
+ getData();
209
+ }, 10 * 60 * 1e3);
210
+ return () => {
211
+ clearInterval(timer);
212
+ };
213
+ }, [JSON.stringify(otherParams), refreshKey]);
214
+ return /* @__PURE__ */ import_react.default.createElement(
215
+ import_materials.PisellStatisticList,
216
+ {
217
+ ...others,
218
+ data,
219
+ backgroundColors,
220
+ labelColor,
221
+ valueColor
222
+ }
223
+ );
224
+ };
225
+ var dashboard_default = BookingDashboard;
@@ -0,0 +1 @@
1
+ export declare const getBookingList: (params: any) => Promise<any>;