@pisell/private-materials 6.1.33 → 6.1.35

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 (92) 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 +25 -9
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/components/footer/amount.d.ts +16 -1
  13. package/es/components/booking/components/footer/amount.js +73 -47
  14. package/es/components/booking/editBookingModal/index.js +3 -4
  15. package/es/components/booking/forms/model.d.ts +1 -10
  16. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  17. package/es/components/booking/forms/single/RenderValueById.d.ts +1 -0
  18. package/es/components/booking/forms/single/RenderValueById.js +68 -17
  19. package/es/components/booking/forms/single/index.less +67 -1
  20. package/es/components/booking/info/model.d.ts +1 -10
  21. package/es/components/booking/info/service2/utils.d.ts +1 -1
  22. package/es/components/booking/info/utils.js +1 -1
  23. package/es/components/booking/info2/service/addService/utils.js +3 -2
  24. package/es/components/booking/info2/utilsByBooking.js +3 -2
  25. package/es/components/booking/locales.d.ts +3 -0
  26. package/es/components/booking/locales.js +6 -3
  27. package/es/components/booking/materiels/duration/index.js +1 -1
  28. package/es/components/booking/materiels/startTime/index.js +1 -1
  29. package/es/components/booking/model.d.ts +1 -9
  30. package/es/components/booking/notes/model.d.ts +1 -10
  31. package/es/components/booking/payments/model.d.ts +1 -10
  32. package/es/components/booking/utils.js +3 -3
  33. package/es/components/eftposPay/amount.d.ts +1 -1
  34. package/es/components/eftposPay/device.d.ts +1 -1
  35. package/es/components/eftposPay/hooks.d.ts +2 -2
  36. package/es/components/eftposPay/store/index.d.ts +5 -5
  37. package/es/components/pay/toC/model.d.ts +1 -9
  38. package/es/components/schedules/model.d.ts +1 -9
  39. package/es/components/schedules/utils.d.ts +1 -1
  40. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  41. package/es/components/ticketBooking/components/ticketBooking/index.js +4 -1
  42. package/es/components/ticketBooking/utils/index.d.ts +1 -1
  43. package/es/components/wallet/Detail/model.d.ts +1 -13
  44. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  45. package/es/components/wallet/PointCard/model.d.ts +1 -13
  46. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  47. package/es/components/wallet/Voucher/model.d.ts +1 -13
  48. package/es/components/wallet/model.d.ts +1 -9
  49. package/es/pro/pisellPriceRadio/index.js +2 -2
  50. package/es/utils/index.d.ts +1 -1
  51. package/lib/components/booking/addons/model.d.ts +1 -10
  52. package/lib/components/booking/components/footer/amount.d.ts +16 -1
  53. package/lib/components/booking/components/footer/amount.js +31 -33
  54. package/lib/components/booking/editBookingModal/index.js +3 -4
  55. package/lib/components/booking/forms/model.d.ts +1 -10
  56. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  57. package/lib/components/booking/forms/single/RenderValueById.d.ts +1 -0
  58. package/lib/components/booking/forms/single/RenderValueById.js +37 -9
  59. package/lib/components/booking/forms/single/index.less +67 -1
  60. package/lib/components/booking/info/model.d.ts +1 -10
  61. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  62. package/lib/components/booking/info/utils.js +2 -1
  63. package/lib/components/booking/info2/service/addService/utils.js +4 -4
  64. package/lib/components/booking/info2/service/editService/index.js +5 -1
  65. package/lib/components/booking/info2/utilsByBooking.js +4 -4
  66. package/lib/components/booking/locales.d.ts +3 -0
  67. package/lib/components/booking/locales.js +6 -3
  68. package/lib/components/booking/materiels/duration/index.js +1 -1
  69. package/lib/components/booking/materiels/startTime/index.js +1 -1
  70. package/lib/components/booking/model.d.ts +1 -9
  71. package/lib/components/booking/notes/model.d.ts +1 -10
  72. package/lib/components/booking/payments/model.d.ts +1 -10
  73. package/lib/components/booking/utils.js +3 -3
  74. package/lib/components/eftposPay/amount.d.ts +1 -1
  75. package/lib/components/eftposPay/device.d.ts +1 -1
  76. package/lib/components/eftposPay/hooks.d.ts +2 -2
  77. package/lib/components/eftposPay/store/index.d.ts +5 -5
  78. package/lib/components/pay/toC/model.d.ts +1 -9
  79. package/lib/components/schedules/model.d.ts +1 -9
  80. package/lib/components/schedules/utils.d.ts +1 -1
  81. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  82. package/lib/components/ticketBooking/components/ticketBooking/index.js +9 -4
  83. package/lib/components/ticketBooking/utils/index.d.ts +1 -1
  84. package/lib/components/wallet/Detail/model.d.ts +1 -13
  85. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  86. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  87. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  88. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  89. package/lib/components/wallet/model.d.ts +1 -9
  90. package/lib/pro/pisellPriceRadio/index.js +2 -2
  91. package/lib/utils/index.d.ts +1 -1
  92. package/package.json +12 -12
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -10,7 +10,7 @@ export declare const getSumTotal: (state: any, isEdit: boolean) => {
10
10
  duration: string;
11
11
  tax: number;
12
12
  shopDiscount: number;
13
- otherAmount: number;
13
+ otherAmount: number | undefined;
14
14
  sumTotalAmount: number;
15
15
  paidAmount: number;
16
16
  notPaidAmount: number;
@@ -23,3 +23,18 @@ export declare const getSumTotal: (state: any, isEdit: boolean) => {
23
23
  roundingAmount: number;
24
24
  originExpectAmount: number;
25
25
  };
26
+ /**
27
+ *
28
+ {
29
+ schedule[1,2,3,4];
30
+ products:{
31
+ // 全部 , 商品组 , 指定商品
32
+ },
33
+
34
+ // productExpectAmount: 订单小计金额, 如果商品的规则是全部, 就不用一个一个的算商品的了, productExpectAmount * 百分比 + 固定金额
35
+
36
+ // 百分比 + 固定金额
37
+
38
+ // 渠道
39
+ }
40
+ */
@@ -18,8 +18,8 @@ export var getRelationDetailsTotal = function getRelationDetailsTotal(relation_d
18
18
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
19
19
  var item = _step.value;
20
20
  var number = item.product_quantity || item.num;
21
- var price = item.selling_price || item.payment_price || item.price;
22
- total += Number(price) * Number(number);
21
+ var _price = item.selling_price || item.payment_price || item.price;
22
+ total += Number(_price) * Number(number);
23
23
  }
24
24
  } catch (err) {
25
25
  _iterator.e(err);
@@ -33,7 +33,7 @@ export var getRelationDetailsTotal = function getRelationDetailsTotal(relation_d
33
33
  * @param state
34
34
  * @returns
35
35
  */
36
- var getProductAmount = function getProductAmount(state, isEdit) {
36
+ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
37
37
  var price = 0;
38
38
  var duration = 0;
39
39
  // 是否是跨日预约
@@ -103,7 +103,7 @@ var getProductAmount = function getProductAmount(state, isEdit) {
103
103
  }, 0);
104
104
  }
105
105
  return {
106
- price: Number(price),
106
+ productExpectAmount: Number(price),
107
107
  duration: getDiscountTime(duration, isDay)
108
108
  };
109
109
  };
@@ -112,6 +112,7 @@ var getProductItemTax = function getProductItemTax(item, bookingDetail) {
112
112
  // 折扣后的金额 = 商品金额 - 商品折扣
113
113
  var productDiscountPrice = Number(item.total);
114
114
  // 店铺税 = 折扣后的金额 * 店铺税率 * 商品是否收税 (is_charge_tax 0 为不收税)
115
+ // todo: tax_rate 和 is_price_include_tax 优先从bookingDetail取,快照, 取不到从getData取,
115
116
  var shopTax = productDiscountPrice * Number(bookingDetail.tax_rate) * Number(item.is_charge_tax);
116
117
  // 店铺税率 = 1 + 店铺税率 * 是否含税
117
118
  var shopTaxRate = 1 + bookingDetail.tax_rate * bookingDetail.is_price_include_tax;
@@ -131,6 +132,7 @@ var getProductItemTax = function getProductItemTax(item, bookingDetail) {
131
132
  * @Date: 2024-02-28 10:56
132
133
  */
133
134
  var getTotal = function getTotal(item) {
135
+ // 改为只使用item._extend.total, 不采用均摊逻辑. 税费的钱根据整单折扣的百分比进行换算
134
136
  return item._extend.payment_price !== undefined ? item._extend.payment_price : item._extend.total;
135
137
  };
136
138
 
@@ -140,12 +142,14 @@ var getTotal = function getTotal(item) {
140
142
  * @returns
141
143
  */
142
144
  var getTax = function getTax(state, isEdit) {
143
- var price = 0;
145
+ var tax = 0;
144
146
 
145
147
  // 新建不计算税费
146
148
  if (!state.bookingId || !state.bookingDetail) {
147
149
  return 0;
148
150
  }
151
+
152
+ // 详情时未编辑的状态下, 取后端的值
149
153
  if (!isEdit) {
150
154
  var _state$bookingDetail2;
151
155
  return Number((_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : _state$bookingDetail2.tax_fee);
@@ -156,7 +160,7 @@ var getTax = function getTax(state, isEdit) {
156
160
  try {
157
161
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
158
162
  var item = _step4.value;
159
- price += getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
163
+ tax += getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
160
164
  total: getTotal(item),
161
165
  price: item._extend.price,
162
166
  quantity: item._extend.quantity
@@ -172,7 +176,7 @@ var getTax = function getTax(state, isEdit) {
172
176
  try {
173
177
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
174
178
  var _item2 = _step5.value;
175
- price += getProductItemTax(_objectSpread(_objectSpread({}, _item2), {}, {
179
+ tax += getProductItemTax(_objectSpread(_objectSpread({}, _item2), {}, {
176
180
  total: getTotal(_item2),
177
181
  price: _item2._extend.price,
178
182
  quantity: _item2._extend.quantity
@@ -184,7 +188,9 @@ var getTax = function getTax(state, isEdit) {
184
188
  _iterator5.f();
185
189
  }
186
190
  }
187
- return price;
191
+
192
+ // todo: tax * (1 - shopDiscount / productExpectAmount)
193
+ return tax;
188
194
  };
189
195
  var getPaySurchargeFee = function getPaySurchargeFee(state) {
190
196
  var bookingDetail = state.bookingDetail,
@@ -216,16 +222,20 @@ var getPaySurchargeFee = function getPaySurchargeFee(state) {
216
222
  // }
217
223
 
218
224
  /**
219
- * 其他金额
225
+ * 订单附加费
220
226
  * @param state
221
227
  * @returns
222
228
  */
223
- var getOtherAmount = function getOtherAmount(state) {
229
+ var getSurchargeAmount = function getSurchargeAmount(state) {
224
230
  var bookingDetail = state.bookingDetail,
225
231
  bookingId = state.bookingId;
226
232
 
233
+ // todo:编辑场景下附加费计算问题?
227
234
  // 新增为 0
228
- if (!bookingDetail || !bookingId) return 0;
235
+ if (!bookingDetail || !bookingId) {
236
+ return;
237
+ }
238
+ // 方案1: 只处理新增时, 编辑时附加费直接使用后端的数据.
229
239
  return Number(bookingDetail.surcharge_fee);
230
240
  };
231
241
 
@@ -263,35 +273,30 @@ export var is_price_include_tax = function is_price_include_tax(state) {
263
273
  var getExpectAmount = function getExpectAmount(_ref) {
264
274
  var price = _ref.price,
265
275
  tax = _ref.tax,
266
- otherAmount = _ref.otherAmount,
276
+ surchargeAmount = _ref.surchargeAmount,
267
277
  shopDiscount = _ref.shopDiscount,
268
- state = _ref.state,
269
- isEdit = _ref.isEdit;
270
- if (!isEdit) {
271
- var _state$bookingDetail6;
272
- return Number((_state$bookingDetail6 = state.bookingDetail) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.expect_amount) || 0;
273
- }
278
+ state = _ref.state;
274
279
  var _tax = tax;
275
280
 
276
- // 新增时, 税费为0
277
- if (state.bookingDetail && is_price_include_tax(state)) {
281
+ // 如果价格含税, 则将税费改为0
282
+ if (is_price_include_tax(state)) {
278
283
  _tax = 0;
279
284
  }
280
- // 商品价格 + 税费 + 其他金额 - 整单折扣
281
- return price + _tax + otherAmount - shopDiscount;
285
+ // 商品价格 + 税费 + 附加费 - 整单折扣
286
+ return price + _tax + surchargeAmount - shopDiscount;
282
287
  };
283
288
  var getTotalRefundAmount = function getTotalRefundAmount(state) {
284
- var _state$bookingDetail7;
285
- return Number((_state$bookingDetail7 = state.bookingDetail) === null || _state$bookingDetail7 === void 0 ? void 0 : _state$bookingDetail7.total_refund_amount) || 0;
289
+ var _state$bookingDetail6;
290
+ return Number((_state$bookingDetail6 = state.bookingDetail) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.total_refund_amount) || 0;
286
291
  };
287
292
  var getShopDiscount = function getShopDiscount(state) {
288
- var _state$bookingDetail8;
293
+ var _state$bookingDetail7;
289
294
  // 优先使用手动设置的折扣(字符串格式),否则使用bookingDetail中的折扣
290
- return Number(state.shop_discount) || Number((_state$bookingDetail8 = state.bookingDetail) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.shop_discount) || 0;
295
+ return Number(state.shop_discount) || Number((_state$bookingDetail7 = state.bookingDetail) === null || _state$bookingDetail7 === void 0 ? void 0 : _state$bookingDetail7.shop_discount) || 0;
291
296
  };
292
297
  var getRoundingAmount = function getRoundingAmount(state) {
293
- var _state$bookingDetail9;
294
- return Number(state === null || state === void 0 || (_state$bookingDetail9 = state.bookingDetail) === null || _state$bookingDetail9 === void 0 ? void 0 : _state$bookingDetail9.rounding_amount) || 0;
298
+ var _state$bookingDetail8;
299
+ return Number(state === null || state === void 0 || (_state$bookingDetail8 = state.bookingDetail) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.rounding_amount) || 0;
295
300
  };
296
301
  var getSumTotalAmount = function getSumTotalAmount(_ref2) {
297
302
  var expectAmount = _ref2.expectAmount,
@@ -305,22 +310,27 @@ var getSumTotalAmount = function getSumTotalAmount(_ref2) {
305
310
  * @returns
306
311
  */
307
312
  export var getSumTotal = function getSumTotal(state, isEdit) {
308
- // 商品金额
309
- var _getProductAmount = getProductAmount(state, isEdit),
310
- price = _getProductAmount.price,
311
- duration = _getProductAmount.duration;
313
+ // 商品总金额, 包含 商品折扣 报价单 子商品
314
+ var _getProductExpectAmou = getProductExpectAmount(state, isEdit),
315
+ productExpectAmount = _getProductExpectAmou.productExpectAmount,
316
+ duration = _getProductExpectAmou.duration;
312
317
 
313
- // 舍入金额
314
- var roundingAmount = getRoundingAmount(state);
318
+ // 整单折扣金额
319
+ var shopDiscount = getShopDiscount(state);
315
320
 
316
- // 税费
317
- var tax = getTax(state, isEdit);
321
+ // 舍入金额, 新增时不处理, 支付后才会产生
322
+ var roundingAmount = getRoundingAmount(state);
318
323
 
319
- // 支付手续费
324
+ // 支付手续费, 新增时不处理, 支付后才会产生
320
325
  var paySurchargeFee = getPaySurchargeFee(state);
321
326
 
322
- // 其他金额
323
- var otherAmount = getOtherAmount(state);
327
+ // 订单附加费金额
328
+ var surchargeAmount = getSurchargeAmount(state);
329
+
330
+ // 算出整单折扣的百分比 shopDiscount / productExpectAmount
331
+
332
+ // 税费
333
+ var tax = getTax(state, isEdit);
324
334
 
325
335
  // 已付金额 (包含手续费)
326
336
  var paidAmount = getPaidAmount(state);
@@ -331,19 +341,19 @@ export var getSumTotal = function getSumTotal(state, isEdit) {
331
341
  // 退款金额
332
342
  var totalRefundAmount = getTotalRefundAmount(state);
333
343
 
334
- // 整单折扣
335
- var shopDiscount = getShopDiscount(state);
336
-
337
344
  // 总计(总订单金额) 商品金额 + 税费 + 附加费
338
345
  var expectAmount = getExpectAmount({
339
- price: price,
346
+ price: productExpectAmount,
340
347
  tax: tax,
341
- otherAmount: otherAmount,
348
+ surchargeAmount: surchargeAmount,
342
349
  shopDiscount: shopDiscount,
343
350
  state: state,
344
351
  isEdit: isEdit
345
352
  });
346
353
 
354
+ // 订单原价(不包含整单折扣的价格)
355
+ // const originExpectAmount = getExpectAmount({ price: productExpectAmount, tax, shopDiscount: 0, surchargeAmount, state, isEdit });
356
+
347
357
  // 订单原价(不包含整单折扣的价格)
348
358
  var originExpectAmount = getExpectAmount({
349
359
  price: price,
@@ -369,12 +379,12 @@ export var getSumTotal = function getSumTotal(state, isEdit) {
369
379
  // 欠款金额
370
380
  var dueAmount = notPaidAmount < 0 ? Number(formatAmount(notPaidAmount + totalRefundAmount, 2, '')) : 0;
371
381
  return {
372
- productAmount: price,
382
+ productAmount: productExpectAmount,
373
383
  duration: duration,
374
384
  tax: tax,
375
385
  shopDiscount: shopDiscount,
376
386
  // taxText,
377
- otherAmount: otherAmount,
387
+ otherAmount: surchargeAmount,
378
388
  sumTotalAmount: sumTotalAmount,
379
389
  paidAmount: paidAmount,
380
390
  notPaidAmount: notPaidAmount,
@@ -387,4 +397,20 @@ export var getSumTotal = function getSumTotal(state, isEdit) {
387
397
  roundingAmount: roundingAmount,
388
398
  originExpectAmount: originExpectAmount
389
399
  };
390
- };
400
+ };
401
+
402
+ /**
403
+ *
404
+ {
405
+ schedule[1,2,3,4];
406
+ products:{
407
+ // 全部 , 商品组 , 指定商品
408
+ },
409
+
410
+ // productExpectAmount: 订单小计金额, 如果商品的规则是全部, 就不用一个一个的算商品的了, productExpectAmount * 百分比 + 固定金额
411
+
412
+ // 百分比 + 固定金额
413
+
414
+ // 渠道
415
+ }
416
+ */
@@ -62,6 +62,7 @@ var EditBookingModal = function EditBookingModal(props, ref) {
62
62
  return {
63
63
  open: function open(params) {
64
64
  console.log('change', params);
65
+ form.resetFields();
65
66
  setParams(params);
66
67
  setOpen(true);
67
68
  }
@@ -173,9 +174,7 @@ var EditBookingModal = function EditBookingModal(props, ref) {
173
174
  });
174
175
  }, [data]);
175
176
  var updateResource = function updateResource(resource) {
176
- form.setFieldsValue({
177
- resource: resource
178
- });
177
+ form.setFieldValue('resource', resource);
179
178
  };
180
179
  var originCacheItem = useMemo(function () {
181
180
  if (!data) {
@@ -224,9 +223,9 @@ var EditBookingModal = function EditBookingModal(props, ref) {
224
223
  });
225
224
  }, [data, useToDate, useResource]);
226
225
  var initState = function initState() {
227
- form.resetFields();
228
226
  setData(null);
229
227
  setOpen(false);
228
+ form.resetFields();
230
229
  };
231
230
  var onCancel = function onCancel() {
232
231
  initState();
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -4,6 +4,6 @@ declare const useSendModal: (bookingId?: number) => {
4
4
  setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
5
5
  handleOpen: () => void;
6
6
  handleValuesChange: (val: any) => void;
7
- handleOk: (values: SendModalValues) => Promise<any>;
7
+ handleOk: (values: SendModalValues) => Promise<boolean | undefined>;
8
8
  };
9
9
  export default useSendModal;
@@ -1,3 +1,4 @@
1
+ import './index.less';
1
2
  interface RenderValueByIdProps {
2
3
  field: any;
3
4
  value: any;
@@ -1,24 +1,38 @@
1
- import React, { useEffect, useMemo } from "react";
2
- import { isArr, isUndefined } from "@pisell/utils";
3
- import { Tag } from "antd";
4
- import { useRequest } from "ahooks";
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useEffect, useMemo, useState } from 'react';
8
+ import { isArr, isUndefined, locales } from '@pisell/utils';
9
+ import { Iconfont } from '@pisell/materials';
10
+ import { Tag, Tooltip } from 'antd';
11
+ import { useRequest } from 'ahooks';
5
12
  import useEngineContext from "../../../../hooks/useEngineContext";
6
13
  import { getFormData } from "../serve";
14
+ import "./index.less";
7
15
  var RenderValueById = function RenderValueById(props) {
8
- var _field$setting, _field$setting6;
16
+ var _field$setting, _ref, _ref$toString, _field$setting6;
9
17
  var field = props.field,
10
18
  propsValue = props.value;
11
19
  var _useEngineContext = useEngineContext(),
12
20
  appHelper = _useEngineContext.appHelper;
21
+
22
+ // 关联表单展示数量
23
+ var _useState = useState(10),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ displayCount = _useState2[0],
26
+ setDisplayCount = _useState2[1];
13
27
  var _getFormData = useRequest(getFormData, {
14
28
  manual: true,
15
- cacheKey: "formOption-".concat((_field$setting = field.setting) === null || _field$setting === void 0 ? void 0 : _field$setting.linkedTable),
29
+ cacheKey: "formOption-".concat((_field$setting = field.setting) === null || _field$setting === void 0 ? void 0 : _field$setting.linkedTable, "-").concat((_ref = propsValue || []) === null || _ref === void 0 || (_ref$toString = _ref.toString) === null || _ref$toString === void 0 ? void 0 : _ref$toString.call(_ref)),
16
30
  staleTime: 500,
17
31
  cacheTime: 5000
18
32
  });
19
33
  var value = useMemo(function () {
20
34
  var v = propsValue;
21
- if (field.filed_type === "form_to_form") {
35
+ if (field.filed_type === 'form_to_form') {
22
36
  if (isArr(propsValue)) {
23
37
  v = propsValue;
24
38
  } else if (propsValue !== null && propsValue !== void 0 && propsValue.form_ids) {
@@ -31,7 +45,7 @@ var RenderValueById = function RenderValueById(props) {
31
45
  }, [propsValue]);
32
46
  useEffect(function () {
33
47
  var _field$setting2;
34
- if (field.filed_type === "form_to_form" && (_field$setting2 = field.setting) !== null && _field$setting2 !== void 0 && _field$setting2.linkedTable) {
48
+ if (field.filed_type === 'form_to_form' && (_field$setting2 = field.setting) !== null && _field$setting2 !== void 0 && _field$setting2.linkedTable) {
35
49
  var _field$setting3;
36
50
  _getFormData.run({
37
51
  form_record_ids: value,
@@ -43,7 +57,7 @@ var RenderValueById = function RenderValueById(props) {
43
57
  }, [field.filed_type, value]);
44
58
  var options = useMemo(function () {
45
59
  var _field$setting4, _field$setting5;
46
- if (field.filed_type === "form_to_form" && field !== null && field !== void 0 && (_field$setting4 = field.setting) !== null && _field$setting4 !== void 0 && _field$setting4.linkedTable) {
60
+ if (field.filed_type === 'form_to_form' && field !== null && field !== void 0 && (_field$setting4 = field.setting) !== null && _field$setting4 !== void 0 && _field$setting4.linkedTable) {
47
61
  var _getFormData$data;
48
62
  return ((_getFormData$data = _getFormData.data) === null || _getFormData$data === void 0 || (_getFormData$data = _getFormData$data.data) === null || _getFormData$data === void 0 || (_getFormData$data = _getFormData$data.list) === null || _getFormData$data === void 0 ? void 0 : _getFormData$data.map(function (item) {
49
63
  return {
@@ -55,24 +69,61 @@ var RenderValueById = function RenderValueById(props) {
55
69
  return field === null || field === void 0 || (_field$setting5 = field.setting) === null || _field$setting5 === void 0 ? void 0 : _field$setting5.customTypeList;
56
70
  }, [field.filed_type, field === null || field === void 0 || (_field$setting6 = field.setting) === null || _field$setting6 === void 0 ? void 0 : _field$setting6.customTypeList, _getFormData.data]);
57
71
  if (isArr(value)) {
72
+ var _field$setting7;
73
+ // 是否是关联表单列表展示样式
74
+ var formListDisplay = (field === null || field === void 0 || (_field$setting7 = field.setting) === null || _field$setting7 === void 0 ? void 0 : _field$setting7.displayStyle) === 'list' && (field === null || field === void 0 ? void 0 : field.filed_type) === 'form_to_form';
58
75
  var _list = options === null || options === void 0 ? void 0 : options.filter(function (i) {
59
76
  return value === null || value === void 0 ? void 0 : value.includes((i === null || i === void 0 ? void 0 : i.id) || i.value);
60
77
  });
61
- var _str = (_list === null || _list === void 0 ? void 0 : _list.map(function (i) {
78
+ var _str = !formListDisplay && (_list === null || _list === void 0 ? void 0 : _list.map(function (i) {
62
79
  var _appHelper$utils;
63
- return /*#__PURE__*/React.createElement(Tag, null, appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.translationShop((i === null || i === void 0 ? void 0 : i.title) || (i === null || i === void 0 ? void 0 : i.label)));
64
- })) || "-";
65
- return /*#__PURE__*/React.createElement("span", null, _str || "-");
80
+ var title = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.translationShop((i === null || i === void 0 ? void 0 : i.title) || (i === null || i === void 0 ? void 0 : i.label));
81
+ return /*#__PURE__*/React.createElement(Tooltip, {
82
+ title: title
83
+ }, /*#__PURE__*/React.createElement(Tag, {
84
+ className: "pisell-lowcode__booking-form-link-tag-title"
85
+ }, title));
86
+ })) || '-';
87
+
88
+ // 如果列表式展示
89
+ if (formListDisplay) {
90
+ var displayList = (_list === null || _list === void 0 ? void 0 : _list.slice(0, displayCount)) || [];
91
+ _str = (displayList === null || displayList === void 0 ? void 0 : displayList.map(function (i, index) {
92
+ var _appHelper$utils2;
93
+ var title = appHelper === null || appHelper === void 0 || (_appHelper$utils2 = appHelper.utils) === null || _appHelper$utils2 === void 0 ? void 0 : _appHelper$utils2.translationShop((i === null || i === void 0 ? void 0 : i.title) || (i === null || i === void 0 ? void 0 : i.label));
94
+ return /*#__PURE__*/React.createElement("div", {
95
+ className: "pisell-lowcode__booking-form-link-to-list-item"
96
+ }, /*#__PURE__*/React.createElement("span", {
97
+ className: "pisell-lowcode__booking-form-link-to-list-item-index"
98
+ }, index + 1), /*#__PURE__*/React.createElement(Tooltip, {
99
+ title: title
100
+ }, /*#__PURE__*/React.createElement("span", {
101
+ className: "pisell-lowcode__booking-form-link-to-list-item-title"
102
+ }, title)));
103
+ })) || '-';
104
+ }
105
+ return /*#__PURE__*/React.createElement("span", {
106
+ className: formListDisplay ? 'pisell-lowcode__booking-form-link-to-list-wrap' : ''
107
+ }, _str || '-', formListDisplay && (_list === null || _list === void 0 ? void 0 : _list.length) > displayCount && /*#__PURE__*/React.createElement("div", {
108
+ className: "pisell-lowcode__booking-form-link-to-list-item-more",
109
+ onClick: function onClick() {
110
+ return setDisplayCount(function (prev) {
111
+ return Math.min(prev + 10, (_list === null || _list === void 0 ? void 0 : _list.length) || 0);
112
+ });
113
+ }
114
+ }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.text.form.link.to.another.record.more')), /*#__PURE__*/React.createElement(Iconfont, {
115
+ type: "icona-IconStroke"
116
+ })));
66
117
  }
67
118
  if (!isUndefined(value)) {
68
- var _field$setting7, _appHelper$utils2, _item$, _item$2;
69
- if ((field === null || field === void 0 ? void 0 : field.filed_type) === "select" && !(field !== null && field !== void 0 && (_field$setting7 = field.setting) !== null && _field$setting7 !== void 0 && _field$setting7.version)) {
70
- return /*#__PURE__*/React.createElement("span", null, value || "-");
119
+ var _field$setting8, _appHelper$utils3, _item$, _item$2;
120
+ if ((field === null || field === void 0 ? void 0 : field.filed_type) === 'select' && !(field !== null && field !== void 0 && (_field$setting8 = field.setting) !== null && _field$setting8 !== void 0 && _field$setting8.version)) {
121
+ return /*#__PURE__*/React.createElement("span", null, value || '-');
71
122
  }
72
123
  var _item = options === null || options === void 0 ? void 0 : options.filter(function (i) {
73
124
  return (i === null || i === void 0 ? void 0 : i.id) == value;
74
125
  });
75
- return (appHelper === null || appHelper === void 0 || (_appHelper$utils2 = appHelper.utils) === null || _appHelper$utils2 === void 0 ? void 0 : _appHelper$utils2.translationShop((_item === null || _item === void 0 || (_item$ = _item[0]) === null || _item$ === void 0 ? void 0 : _item$.title) || (_item === null || _item === void 0 || (_item$2 = _item[0]) === null || _item$2 === void 0 ? void 0 : _item$2.label))) || "-";
126
+ return (appHelper === null || appHelper === void 0 || (_appHelper$utils3 = appHelper.utils) === null || _appHelper$utils3 === void 0 ? void 0 : _appHelper$utils3.translationShop((_item === null || _item === void 0 || (_item$ = _item[0]) === null || _item$ === void 0 ? void 0 : _item$.title) || (_item === null || _item === void 0 || (_item$2 = _item[0]) === null || _item$2 === void 0 ? void 0 : _item$2.label))) || '-';
76
127
  }
77
128
  return null;
78
129
  };
@@ -1,3 +1,69 @@
1
1
  .attachment-item {
2
2
  width: 100%;
3
- }
3
+ }
4
+
5
+ .pisell-lowcode__booking-form-link-tag-title {
6
+ overflow: hidden;
7
+ text-overflow: ellipsis;
8
+ white-space: nowrap;
9
+ display: inline-block;
10
+ max-width: 100%;
11
+ }
12
+
13
+ .pisell-lowcode__booking-form-link-to-list-wrap {
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 12px;
17
+
18
+
19
+ .pisell-lowcode__booking-form-link-to-list-item-more {
20
+ padding: 4px 6px;
21
+ color: #705dff;
22
+ font-size: 14px;
23
+ cursor: pointer;
24
+ background-color: #f9fafb;
25
+ border-radius: 8px;
26
+ border: 1px solid #eaecf0;
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ gap: 4px;
31
+ }
32
+
33
+ .pisell-lowcode__booking-form-link-to-list-item {
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 8px;
37
+ background-color: #f9fafb;
38
+ padding: 12px 14px;
39
+ border-radius: 8px;
40
+ border: 1px solid #eaecf0;
41
+ color: #101828;
42
+ font-size: 16px;
43
+ font-weight: 500;
44
+ white-space: normal;
45
+
46
+ .pisell-lowcode__booking-form-link-to-list-item-index {
47
+ padding: 0 5px;
48
+ min-width: 20px;
49
+ min-height: 20px;
50
+ line-height: 20px;
51
+ border-radius: 20px;
52
+ font-size: 14px;
53
+ font-weight: 600;
54
+ background-color: #705dff;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ color: #fff;
59
+ }
60
+
61
+ .pisell-lowcode__booking-form-link-to-list-item-title {
62
+ flex: 1;
63
+ overflow: hidden;
64
+ text-overflow: ellipsis;
65
+ white-space: nowrap;
66
+ display: block;
67
+ }
68
+ }
69
+ }
@@ -1,14 +1,5 @@
1
- /// <reference types="react" />
2
- import { FormState } from '../model';
3
1
  export declare const walkInData: {
4
2
  id: number;
5
3
  nickname: string;
6
4
  };
7
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
- state: FormState;
9
- } & {
10
- dispatch: (params: {
11
- type: string;
12
- payload: any;
13
- }) => void;
14
- }>;
5
+ export declare const Provider: any, Context: any;
@@ -248,4 +248,4 @@ export declare const updateAppointmentServicePrice: (state: any, { start_date, e
248
248
  * @Author: WangHan
249
249
  * @Date: 2024-12-24 11:32
250
250
  */
251
- export declare const updateServicePrice: (state: any) => Promise<any> | never[];
251
+ export declare const updateServicePrice: (state: any) => never[] | Promise<any>;
@@ -95,7 +95,7 @@ export var isBooking4Shop = function isBooking4Shop(shopId, renderType, business
95
95
  if (renderType === 'eventBooking') {
96
96
  return false;
97
97
  }
98
- var booking4Shops = [8390, 1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191, 6812, 6813, 6814, 7651, 8586, 8581, 9, 2155, 8030, 1749, 8194, 2327, 8609, 8610, 8782, 1285, 6124, 8727, 5538, 6988, 8872, 6930, 8824, 8913, 8918, 6413];
98
+ var booking4Shops = [8390, 1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191, 6812, 6813, 6814, 7651, 8586, 8581, 9, 2155, 8030, 1749, 8194, 2327, 8609, 8610, 8782, 1285, 6124, 8727, 5538, 6988, 8872, 6930, 8824, 8913, 8918, 6413, 8943];
99
99
 
100
100
  // 固定的shopId 或者安装 Resource Kit 应用,则认为是booking4Shop
101
101
  return booking4Shops.includes(shopId) || (businessUtils === null || businessUtils === void 0 ? void 0 : businessUtils.getAppByModal('resourcekit'));
@@ -278,7 +278,7 @@ export var setDefaultResource = function setDefaultResource(_ref6) {
278
278
  var _loop2 = function _loop2() {
279
279
  var item = _step.value;
280
280
  var renderList = item.renderList.filter(function (d) {
281
- return d.is_default == 1 || d.id === resourceId;
281
+ return d.id === resourceId;
282
282
  });
283
283
  var defaultOriginalResource = [];
284
284
  if (renderList.length === 0) {
@@ -584,7 +584,8 @@ export var getProductExtend = function getProductExtend(_ref11) {
584
584
  state: state
585
585
  });
586
586
  if (getDuration(_cacheItem === null || _cacheItem === void 0 ? void 0 : _cacheItem.duration) === 'flexible') {
587
- _cacheItem._extend.duration = _cacheItem._data.timeObj.durationSlicesBasedOnTime[0].value;
587
+ var _cacheItem$_data$time;
588
+ _cacheItem._extend.duration = (_cacheItem$_data$time = _cacheItem._data.timeObj) === null || _cacheItem$_data$time === void 0 || (_cacheItem$_data$time = _cacheItem$_data$time.durationSlicesBasedOnTime) === null || _cacheItem$_data$time === void 0 || (_cacheItem$_data$time = _cacheItem$_data$time[0]) === null || _cacheItem$_data$time === void 0 ? void 0 : _cacheItem$_data$time.value;
588
589
 
589
590
  // 计算服务的开始和结束时间
590
591
  var _getServiceTimes = getServiceTimes({
@@ -338,7 +338,7 @@ export var getServiceStartTimeAndEndTime = function getServiceStartTimeAndEndTim
338
338
  // 下一个商品的扩展参数
339
339
  var _extend = {
340
340
  // 时长: 当前商品时长 > 第一个时长
341
- duration: findNextDuration(cacheItem.duration, timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 || (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value)
341
+ duration: findNextDuration(cacheItem.duration, timeObj === null || timeObj === void 0 ? void 0 : timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 || (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value)
342
342
  };
343
343
 
344
344
  // 如果有上一个商品, 将上一个商品的某些参数 设置到新商品上
@@ -352,7 +352,8 @@ export var getServiceStartTimeAndEndTime = function getServiceStartTimeAndEndTim
352
352
  } else {
353
353
  // 如果上个服务商品的结束时间跨天, 那么设置为最后一个时间段, 不跨天则取上一个的结束时间
354
354
  if (dayjs(lastServerEndDate).isAfter(lastServerStartDate, "day")) {
355
- _extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
355
+ var _timeObj$timeSlices;
356
+ _extend.start_time = timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices[(timeObj === null || timeObj === void 0 || (_timeObj$timeSlices = timeObj.timeSlices) === null || _timeObj$timeSlices === void 0 ? void 0 : _timeObj$timeSlices.length) - 1].value;
356
357
  } else {
357
358
  _extend.start_time = lastServerEndDate.format("HH:mm");
358
359
  }