@pisell/private-materials 3.0.76 → 3.0.78

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 (63) 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.js +6 -6
  8. package/build/lowcode/view.js +8 -8
  9. package/es/components/booking/addons/index.d.ts +1 -1
  10. package/es/components/booking/addons/model.d.ts +2 -1
  11. package/es/components/booking/components/customSelect/index.js +8 -2
  12. package/es/components/booking/components/footer/amount.d.ts +1 -0
  13. package/es/components/booking/components/footer/amount.js +18 -2
  14. package/es/components/booking/components/footer/index.js +7 -1
  15. package/es/components/booking/forms/forms.d.ts +1 -1
  16. package/es/components/booking/forms/index.d.ts +1 -1
  17. package/es/components/booking/forms/model.d.ts +2 -1
  18. package/es/components/booking/forms/serve.d.ts +9 -0
  19. package/es/components/booking/forms/serve.js +25 -0
  20. package/es/components/booking/forms/single/RenderValueById.d.ts +6 -0
  21. package/es/components/booking/forms/single/RenderValueById.js +79 -0
  22. package/es/components/booking/forms/single/index.js +27 -0
  23. package/es/components/booking/index.d.ts +1 -1
  24. package/es/components/booking/info/index.d.ts +1 -1
  25. package/es/components/booking/info/model.d.ts +2 -1
  26. package/es/components/booking/locales.d.ts +3 -0
  27. package/es/components/booking/locales.js +3 -0
  28. package/es/components/booking/model.d.ts +2 -1
  29. package/es/components/booking/notes/index.d.ts +1 -1
  30. package/es/components/booking/notes/model.d.ts +2 -1
  31. package/es/components/booking/payments/index.d.ts +1 -1
  32. package/es/components/booking/payments/model.d.ts +2 -1
  33. package/es/components/productExtension/fields/SelectResourcesTable/index.js +22 -10
  34. package/es/components/schedules/index.d.ts +1 -1
  35. package/es/components/schedules/model.d.ts +2 -1
  36. package/lib/components/booking/addons/index.d.ts +1 -1
  37. package/lib/components/booking/addons/model.d.ts +2 -1
  38. package/lib/components/booking/components/customSelect/index.js +7 -2
  39. package/lib/components/booking/components/footer/amount.d.ts +1 -0
  40. package/lib/components/booking/components/footer/amount.js +11 -2
  41. package/lib/components/booking/components/footer/index.js +5 -0
  42. package/lib/components/booking/forms/forms.d.ts +1 -1
  43. package/lib/components/booking/forms/index.d.ts +1 -1
  44. package/lib/components/booking/forms/model.d.ts +2 -1
  45. package/lib/components/booking/forms/serve.d.ts +9 -0
  46. package/lib/components/booking/forms/serve.js +30 -0
  47. package/lib/components/booking/forms/single/RenderValueById.d.ts +6 -0
  48. package/lib/components/booking/forms/single/RenderValueById.js +106 -0
  49. package/lib/components/booking/forms/single/index.js +12 -0
  50. package/lib/components/booking/index.d.ts +1 -1
  51. package/lib/components/booking/info/index.d.ts +1 -1
  52. package/lib/components/booking/info/model.d.ts +2 -1
  53. package/lib/components/booking/locales.d.ts +3 -0
  54. package/lib/components/booking/locales.js +3 -0
  55. package/lib/components/booking/model.d.ts +2 -1
  56. package/lib/components/booking/notes/index.d.ts +1 -1
  57. package/lib/components/booking/notes/model.d.ts +2 -1
  58. package/lib/components/booking/payments/index.d.ts +1 -1
  59. package/lib/components/booking/payments/model.d.ts +2 -1
  60. package/lib/components/productExtension/fields/SelectResourcesTable/index.js +16 -6
  61. package/lib/components/schedules/index.d.ts +1 -1
  62. package/lib/components/schedules/model.d.ts +2 -1
  63. package/package.json +3 -3
@@ -13,5 +13,5 @@ export interface InfoProps {
13
13
  setGlobalState: any;
14
14
  }
15
15
  export declare const formatProducts: (values: any) => any;
16
- declare const Addons: (props: any) => JSX.Element;
16
+ declare const Addons: (props: any) => any;
17
17
  export default Addons;
@@ -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: {
@@ -127,11 +127,15 @@ var CustomSelect = function CustomSelect(props, ref) {
127
127
  * @Author: zhiwei.Wang
128
128
  * @Date: 2024-01-30 16:45
129
129
  */
130
- var closeDrawer = function closeDrawer() {
130
+ var closeDrawer = function closeDrawer(reset) {
131
131
  // 关闭
132
132
  setOpen(false);
133
133
  // 清空搜索
134
134
  setSearch("");
135
+ // 如果直接关闭弹窗, 则将value恢复到上一次的数据
136
+ if (reset) {
137
+ initValue();
138
+ }
135
139
  // 回调
136
140
  closeCallback === null || closeCallback === void 0 ? void 0 : closeCallback();
137
141
  };
@@ -395,7 +399,9 @@ var CustomSelect = function CustomSelect(props, ref) {
395
399
  }
396
400
  }) : null) : null, /*#__PURE__*/React.createElement(Drawer, _extends({
397
401
  open: open,
398
- onClose: closeDrawer,
402
+ onClose: function onClose() {
403
+ closeDrawer(true);
404
+ },
399
405
  header: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
400
406
  ref: searchRef,
401
407
  prefix: /*#__PURE__*/React.createElement(SearchLg, null),
@@ -19,4 +19,5 @@ export declare const getSumTotal: (state: any, isEdit: boolean) => {
19
19
  orderPaidAmount: number;
20
20
  totalRefundAmount: number;
21
21
  dueAmount: number;
22
+ roundingAmount: number;
22
23
  };
@@ -263,6 +263,15 @@ var getShopDiscount = function getShopDiscount(state) {
263
263
  var _state$bookingDetail8;
264
264
  return Number((_state$bookingDetail8 = state.bookingDetail) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.shop_discount) || 0;
265
265
  };
266
+ var getRoundingAmount = function getRoundingAmount(state) {
267
+ var _state$bookingDetail9;
268
+ return Number(state === null || state === void 0 ? void 0 : (_state$bookingDetail9 = state.bookingDetail) === null || _state$bookingDetail9 === void 0 ? void 0 : _state$bookingDetail9.rounding_amount) || 0;
269
+ };
270
+ var getSumTotalAmount = function getSumTotalAmount(_ref2) {
271
+ var expectAmount = _ref2.expectAmount,
272
+ roundingAmount = _ref2.roundingAmount;
273
+ return expectAmount + roundingAmount;
274
+ };
266
275
 
267
276
  /**
268
277
  * 总金额
@@ -275,6 +284,9 @@ export var getSumTotal = function getSumTotal(state, isEdit) {
275
284
  price = _getProductAmount.price,
276
285
  duration = _getProductAmount.duration;
277
286
 
287
+ // 舍入金额
288
+ var roundingAmount = getRoundingAmount(state);
289
+
278
290
  // 税费
279
291
  var tax = getTax(state, isEdit);
280
292
 
@@ -307,7 +319,10 @@ export var getSumTotal = function getSumTotal(state, isEdit) {
307
319
  });
308
320
 
309
321
  // 总支付金额 总计
310
- var sumTotalAmount = expectAmount;
322
+ var sumTotalAmount = getSumTotalAmount({
323
+ expectAmount: expectAmount,
324
+ roundingAmount: roundingAmount
325
+ });
311
326
 
312
327
  // 未支付的金额 负数代表着欠款
313
328
  var notPaidAmount = Number(formatAmount(sumTotalAmount, 2, '')) - orderPaidAmount;
@@ -332,6 +347,7 @@ export var getSumTotal = function getSumTotal(state, isEdit) {
332
347
  actualPaidAmount: actualPaidAmount,
333
348
  orderPaidAmount: orderPaidAmount,
334
349
  totalRefundAmount: totalRefundAmount,
335
- dueAmount: dueAmount
350
+ dueAmount: dueAmount,
351
+ roundingAmount: roundingAmount
336
352
  };
337
353
  };
@@ -1083,7 +1083,13 @@ var Footer = function Footer(props) {
1083
1083
  className: "order-total-item-label order-total-item-label-bold"
1084
1084
  }, locales.getText("pisell1.text.total")), /*#__PURE__*/React.createElement("span", {
1085
1085
  className: "order-total-item-value"
1086
- }, formatAmount(total.expectAmount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"))), state.bookingId ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1086
+ }, formatAmount(total.expectAmount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"))), !!total.roundingAmount && /*#__PURE__*/React.createElement("div", {
1087
+ className: "order-total-item"
1088
+ }, /*#__PURE__*/React.createElement("span", {
1089
+ className: "order-total-item-label"
1090
+ }, locales.getText('pisell1.text.rounding')), /*#__PURE__*/React.createElement("span", {
1091
+ className: "order-total-item-value"
1092
+ }, formatAmount(total.roundingAmount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"))), state.bookingId ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1087
1093
  className: "order-total-item-border"
1088
1094
  }), /*#__PURE__*/React.createElement("div", {
1089
1095
  className: "order-total-item"
@@ -21,5 +21,5 @@ export interface InfoProps {
21
21
  * @Author: zhiwei.Wang
22
22
  * @Date: 2024-01-30 17:10
23
23
  */
24
- declare const Forms: (props: any) => JSX.Element;
24
+ declare const Forms: (props: any) => any;
25
25
  export default Forms;
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Forms: (props: any) => JSX.Element;
8
+ declare const Forms: (props: any) => any;
9
9
  export default Forms;
@@ -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: {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 获取表单数据
3
+ */
4
+ export declare const getFormData: (params: {
5
+ form_id: number;
6
+ form_record_ids: number[];
7
+ num: number;
8
+ skip: number;
9
+ }) => Promise<any>;
@@ -0,0 +1,25 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ import { request } from "../utils";
6
+
7
+ /**
8
+ * 获取表单数据
9
+ */
10
+ export var getFormData = /*#__PURE__*/function () {
11
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
12
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
13
+ while (1) switch (_context.prev = _context.next) {
14
+ case 0:
15
+ return _context.abrupt("return", request.getRequest().get("/shop/form/data/v1", params));
16
+ case 1:
17
+ case "end":
18
+ return _context.stop();
19
+ }
20
+ }, _callee);
21
+ }));
22
+ return function getFormData(_x) {
23
+ return _ref.apply(this, arguments);
24
+ };
25
+ }();
@@ -0,0 +1,6 @@
1
+ interface RenderValueByIdProps {
2
+ field: any;
3
+ value: any;
4
+ }
5
+ declare const RenderValueById: (props: RenderValueByIdProps) => any;
6
+ export default RenderValueById;
@@ -0,0 +1,79 @@
1
+ import React, { useEffect, useMemo } from "react";
2
+ import { isArr, isUndefined } from "@pisell/utils";
3
+ import { Tag } from "antd";
4
+ import { useRequest } from "ahooks";
5
+ import useEngineContext from "../../../../hooks/useEngineContext";
6
+ import { getFormData } from "../serve";
7
+ var RenderValueById = function RenderValueById(props) {
8
+ var _field$setting, _field$setting6;
9
+ var field = props.field,
10
+ propsValue = props.value;
11
+ var _useEngineContext = useEngineContext(),
12
+ appHelper = _useEngineContext.appHelper;
13
+ var _getFormData = useRequest(getFormData, {
14
+ manual: true,
15
+ cacheKey: "formOption-".concat((_field$setting = field.setting) === null || _field$setting === void 0 ? void 0 : _field$setting.linkedTable),
16
+ staleTime: 500,
17
+ cacheTime: 5000
18
+ });
19
+ var value = useMemo(function () {
20
+ var v = propsValue;
21
+ if (field.filed_type === "form_to_form") {
22
+ if (isArr(propsValue)) {
23
+ v = propsValue;
24
+ } else if (propsValue !== null && propsValue !== void 0 && propsValue.form_ids) {
25
+ v = propsValue.form_ids;
26
+ } else {
27
+ v = propsValue;
28
+ }
29
+ }
30
+ return v;
31
+ }, [propsValue]);
32
+ useEffect(function () {
33
+ var _field$setting2;
34
+ if (field.filed_type === "form_to_form" && (_field$setting2 = field.setting) !== null && _field$setting2 !== void 0 && _field$setting2.linkedTable) {
35
+ var _field$setting3;
36
+ _getFormData.run({
37
+ form_record_ids: value,
38
+ form_id: (_field$setting3 = field.setting) === null || _field$setting3 === void 0 ? void 0 : _field$setting3.linkedTable,
39
+ skip: 1,
40
+ num: 999
41
+ });
42
+ }
43
+ }, [field.filed_type, value]);
44
+ var options = useMemo(function () {
45
+ 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) {
47
+ var _getFormData$data, _getFormData$data$dat, _getFormData$data$dat2;
48
+ return ((_getFormData$data = _getFormData.data) === null || _getFormData$data === void 0 ? void 0 : (_getFormData$data$dat = _getFormData$data.data) === null || _getFormData$data$dat === void 0 ? void 0 : (_getFormData$data$dat2 = _getFormData$data$dat.list) === null || _getFormData$data$dat2 === void 0 ? void 0 : _getFormData$data$dat2.map(function (item) {
49
+ return {
50
+ title: item.main_field,
51
+ id: item.form_record_id
52
+ };
53
+ })) || [];
54
+ }
55
+ return field === null || field === void 0 ? void 0 : (_field$setting5 = field.setting) === null || _field$setting5 === void 0 ? void 0 : _field$setting5.customTypeList;
56
+ }, [field.filed_type, field === null || field === void 0 ? void 0 : (_field$setting6 = field.setting) === null || _field$setting6 === void 0 ? void 0 : _field$setting6.customTypeList, _getFormData.data]);
57
+ if (isArr(value)) {
58
+ var _list = options === null || options === void 0 ? void 0 : options.filter(function (i) {
59
+ return value === null || value === void 0 ? void 0 : value.includes((i === null || i === void 0 ? void 0 : i.id) || i.value);
60
+ });
61
+ var _str = (_list === null || _list === void 0 ? void 0 : _list.map(function (i) {
62
+ var _appHelper$utils;
63
+ return /*#__PURE__*/React.createElement(Tag, null, appHelper === null || appHelper === void 0 ? 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 || "-");
66
+ }
67
+ 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 || "-");
71
+ }
72
+ var _item = options === null || options === void 0 ? void 0 : options.filter(function (i) {
73
+ return (i === null || i === void 0 ? void 0 : i.id) == value;
74
+ });
75
+ return (appHelper === null || appHelper === void 0 ? void 0 : (_appHelper$utils2 = appHelper.utils) === null || _appHelper$utils2 === void 0 ? void 0 : _appHelper$utils2.translationShop((_item === null || _item === void 0 ? void 0 : (_item$ = _item[0]) === null || _item$ === void 0 ? void 0 : _item$.title) || (_item === null || _item === void 0 ? void 0 : (_item$2 = _item[0]) === null || _item$2 === void 0 ? void 0 : _item$2.label))) || "-";
76
+ }
77
+ return null;
78
+ };
79
+ export default RenderValueById;
@@ -5,6 +5,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
7
  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); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ 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."); }
10
+ 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); }
11
+ 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; }
12
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
14
  import React, { useCallback, useMemo } from "react";
9
15
  import FileDownload02 from "@pisell/icon/es/FileDownload02";
10
16
  import { image, locales } from "@pisell/utils";
@@ -12,6 +18,9 @@ import { Avatar } from "antd";
12
18
  import CustomSelect from "../../components/customSelect";
13
19
  import CollapsibleList from "../../components/collapsibleList";
14
20
  import "./index.less";
21
+ import RenderValueById from "./RenderValueById";
22
+ import useComponents from "../../../../hooks/useComponents";
23
+ var queryValueById = ['checkbox', 'radioButton', 'select', 'form_to_form'];
15
24
 
16
25
  /**
17
26
  * @title: 表单选择器
@@ -37,6 +46,12 @@ var Single = function Single(_ref) {
37
46
  // return field.field[0]?.key || "";
38
47
  // }, [field]);
39
48
 
49
+ var _useComponents = useComponents({
50
+ components: ["HumanBodySelector"]
51
+ }),
52
+ _useComponents2 = _slicedToArray(_useComponents, 1),
53
+ HumanBodySelector = _useComponents2[0];
54
+
40
55
  /**
41
56
  * @title: 渲染表单内容
42
57
  * @description:
@@ -103,6 +118,18 @@ var Single = function Single(_ref) {
103
118
  return "(+".concat(val.country_calling_code, ") ").concat(val.phone);
104
119
  }
105
120
  }
121
+ if (field.filed_type === "body_hotspot_image") {
122
+ return HumanBodySelector ? /*#__PURE__*/React.createElement(HumanBodySelector, {
123
+ value: val,
124
+ disable: true
125
+ }) : val;
126
+ }
127
+ if (queryValueById.includes(field === null || field === void 0 ? void 0 : field.filed_type)) {
128
+ return /*#__PURE__*/React.createElement(RenderValueById, {
129
+ field: field,
130
+ value: val
131
+ });
132
+ }
106
133
  return val || "-";
107
134
  };
108
135
 
@@ -1,2 +1,2 @@
1
- declare const Booking: (props: any) => JSX.Element;
1
+ declare const Booking: (props: any) => any;
2
2
  export default Booking;
@@ -8,5 +8,5 @@ export interface InfoProps {
8
8
  slot: any;
9
9
  setState: any;
10
10
  }
11
- declare const Info: (props: any) => JSX.Element;
11
+ declare const Info: (props: any) => any;
12
12
  export default Info;
@@ -1,9 +1,10 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
3
  export declare const walkInData: {
3
4
  id: number;
4
5
  nickname: string;
5
6
  };
6
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
7
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
7
8
  state: FormState;
8
9
  } & {
9
10
  dispatch: (params: {
@@ -96,6 +96,7 @@ declare const _default: {
96
96
  'pisell1.text.subtotal': string;
97
97
  'pisell1.text.tax': string;
98
98
  'pisell1.text.total': string;
99
+ 'pisell1.text.rounding': string;
99
100
  'pisell1.text.payment-fee': string;
100
101
  'pisell1.text.tomorrow': string;
101
102
  'pisell1.text.resource-error-message-1': (x: string, y: string) => string;
@@ -259,6 +260,7 @@ declare const _default: {
259
260
  'pisell1.text.subtotal': string;
260
261
  'pisell1.text.tax': string;
261
262
  'pisell1.text.total': string;
263
+ 'pisell1.text.rounding': string;
262
264
  'pisell1.text.payment-fee': string;
263
265
  'pisell1.text.tomorrow': string;
264
266
  'pisell1.text.no-addons': string;
@@ -417,6 +419,7 @@ declare const _default: {
417
419
  'pisell1.text.subtotal': string;
418
420
  'pisell1.text.tax': string;
419
421
  'pisell1.text.total': string;
422
+ 'pisell1.text.rounding': string;
420
423
  'pisell1.text.payment-fee': string;
421
424
  'pisell1.text.tomorrow': string;
422
425
  'pisell1.text.no-addons': string;
@@ -105,6 +105,7 @@ export default {
105
105
  'pisell1.text.subtotal': 'Subtotal',
106
106
  'pisell1.text.tax': 'Tax',
107
107
  'pisell1.text.total': 'Total',
108
+ 'pisell1.text.rounding': 'Rounding',
108
109
  'pisell1.text.payment-fee': 'Payment fee',
109
110
  'pisell1.text.tomorrow': 'Tomorrow ',
110
111
  'pisell1.text.resource-error-message-1': function pisell1TextResourceErrorMessage1(x, y) {
@@ -288,6 +289,7 @@ export default {
288
289
  'pisell1.text.subtotal': '小计',
289
290
  'pisell1.text.tax': '税费',
290
291
  'pisell1.text.total': '总计',
292
+ 'pisell1.text.rounding': '舍入',
291
293
  'pisell1.text.payment-fee': '支付手续费',
292
294
  'pisell1.text.tomorrow': '明天',
293
295
  'pisell1.text.no-addons': '没有添加商品',
@@ -466,6 +468,7 @@ export default {
466
468
  'pisell1.text.subtotal': '小計',
467
469
  'pisell1.text.tax': '稅費',
468
470
  'pisell1.text.total': '總計',
471
+ 'pisell1.text.rounding': '舍入',
469
472
  'pisell1.text.payment-fee': '支付手續費',
470
473
  'pisell1.text.tomorrow': '明天',
471
474
  'pisell1.text.no-addons': '没有添加商品',
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface FormState {
2
3
  amountSymbol: string;
3
4
  apis: {
@@ -93,7 +94,7 @@ export declare const walkInData: {
93
94
  id: number;
94
95
  nickname: string;
95
96
  };
96
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
97
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
97
98
  state: FormState;
98
99
  } & {
99
100
  dispatch: (params: {
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => JSX.Element;
7
+ declare const Notes: (props: any) => any;
8
8
  export default Notes;
@@ -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: {
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Payments: (props: any) => JSX.Element;
8
+ declare const Payments: (props: any) => any;
9
9
  export default Payments;
@@ -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: {
@@ -94,18 +94,30 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
94
94
  }();
95
95
  var _dataSource = useMemo(function () {
96
96
  if (value) {
97
- return (data || []).sort(function (a, b) {
98
- var _a = value.findIndex(function (item) {
99
- return item.form_id === a.form_id;
100
- });
101
- var _b = value.findIndex(function (item) {
102
- return item.form_id === b.form_id;
103
- });
104
- if (_a === -1 || _b === -1) {
105
- return 999;
97
+ // 创建一个排序键对象
98
+ var sortOrder = {};
99
+ // 创建 arr1 的副本
100
+ var arr1Copy = data.slice();
101
+ value.forEach(function (item, index) {
102
+ sortOrder[item.form_id] = index;
103
+ });
104
+ arr1Copy.sort(function (a, b) {
105
+ // 如果 a 和 b 都在 sortOrder 中,则按 sortOrder 中的顺序排序
106
+ if (sortOrder[a.form_id] !== undefined && sortOrder[b.form_id] !== undefined) {
107
+ return sortOrder[a.form_id] - sortOrder[b.form_id];
108
+ }
109
+ // 如果只有 a 在 sortOrder 中,则 a 排在前面
110
+ if (sortOrder[a.form_id] !== undefined) {
111
+ return -1;
112
+ }
113
+ // 如果只有 b 在 sortOrder 中,则 b 排在前面
114
+ if (sortOrder[b.form_id] !== undefined) {
115
+ return 1;
106
116
  }
107
- return _a - _b;
117
+ // 如果 a 和 b 都不在 sortOrder 中,则保持原顺序
118
+ return 0;
108
119
  });
120
+ return arr1Copy;
109
121
  }
110
122
  return data;
111
123
  }, [data, value]);
@@ -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: {
@@ -13,5 +13,5 @@ export interface InfoProps {
13
13
  setGlobalState: any;
14
14
  }
15
15
  export declare const formatProducts: (values: any) => any;
16
- declare const Addons: (props: any) => JSX.Element;
16
+ declare const Addons: (props: any) => any;
17
17
  export default Addons;
@@ -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: {
@@ -98,9 +98,12 @@ var CustomSelect = (props, ref) => {
98
98
  }
99
99
  set_value(_val);
100
100
  };
101
- const closeDrawer = () => {
101
+ const closeDrawer = (reset) => {
102
102
  setOpen(false);
103
103
  setSearch("");
104
+ if (reset) {
105
+ initValue();
106
+ }
104
107
  closeCallback == null ? void 0 : closeCallback();
105
108
  };
106
109
  const handleOpenModal = () => {
@@ -247,7 +250,9 @@ var CustomSelect = (props, ref) => {
247
250
  import_drawer.default,
248
251
  {
249
252
  open,
250
- onClose: closeDrawer,
253
+ onClose: () => {
254
+ closeDrawer(true);
255
+ },
251
256
  header: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
252
257
  import_antd.Input,
253
258
  {
@@ -19,4 +19,5 @@ export declare const getSumTotal: (state: any, isEdit: boolean) => {
19
19
  orderPaidAmount: number;
20
20
  totalRefundAmount: number;
21
21
  dueAmount: number;
22
+ roundingAmount: number;
22
23
  };
@@ -154,8 +154,16 @@ var getShopDiscount = (state) => {
154
154
  var _a;
155
155
  return Number((_a = state.bookingDetail) == null ? void 0 : _a.shop_discount) || 0;
156
156
  };
157
+ var getRoundingAmount = (state) => {
158
+ var _a;
159
+ return Number((_a = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a.rounding_amount) || 0;
160
+ };
161
+ var getSumTotalAmount = ({ expectAmount, roundingAmount }) => {
162
+ return expectAmount + roundingAmount;
163
+ };
157
164
  var getSumTotal = (state, isEdit) => {
158
165
  const { price, duration } = getProductAmount(state, isEdit);
166
+ const roundingAmount = getRoundingAmount(state);
159
167
  const tax = getTax(state, isEdit);
160
168
  const paySurchargeFee = getPaySurchargeFee(state);
161
169
  const otherAmount = getOtherAmount(state);
@@ -164,7 +172,7 @@ var getSumTotal = (state, isEdit) => {
164
172
  const totalRefundAmount = getTotalRefundAmount(state);
165
173
  const shopDiscount = getShopDiscount(state);
166
174
  const expectAmount = getExpectAmount({ price, tax, otherAmount, shopDiscount, state, isEdit });
167
- const sumTotalAmount = expectAmount;
175
+ const sumTotalAmount = getSumTotalAmount({ expectAmount, roundingAmount });
168
176
  const notPaidAmount = Number((0, import_utils2.formatAmount)(sumTotalAmount, 2, "")) - orderPaidAmount;
169
177
  const actualPaidAmount = paidAmount;
170
178
  const dueAmount = notPaidAmount < 0 ? Number((0, import_utils2.formatAmount)(notPaidAmount + totalRefundAmount, 2, "")) : 0;
@@ -183,7 +191,8 @@ var getSumTotal = (state, isEdit) => {
183
191
  actualPaidAmount,
184
192
  orderPaidAmount,
185
193
  totalRefundAmount,
186
- dueAmount
194
+ dueAmount,
195
+ roundingAmount
187
196
  };
188
197
  };
189
198
  // Annotate the CommonJS export names for ESM import in node: