@pisell/private-materials 3.0.60 → 3.0.61

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 (31) 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 +5 -5
  9. package/es/components/booking/components/customSelect/index.js +40 -7
  10. package/es/components/booking/components/footer/utils.js +12 -7
  11. package/es/components/booking/forms/index.js +136 -63
  12. package/es/components/booking/forms/single/index.js +1 -1
  13. package/es/components/booking/info/client/index.js +124 -31
  14. package/es/components/booking/info/client/serve.d.ts +2 -0
  15. package/es/components/booking/info/client/serve.js +51 -0
  16. package/es/components/booking/info/index.js +8 -5
  17. package/es/components/booking/info/pet/index.js +4 -2
  18. package/es/components/booking/info/service/addService/index.js +0 -1
  19. package/es/components/booking/model.d.ts +1 -0
  20. package/lib/components/booking/components/customSelect/index.js +4 -4
  21. package/lib/components/booking/components/footer/utils.js +8 -5
  22. package/lib/components/booking/forms/index.js +38 -3
  23. package/lib/components/booking/forms/single/index.js +1 -1
  24. package/lib/components/booking/info/client/index.js +40 -9
  25. package/lib/components/booking/info/client/serve.d.ts +2 -0
  26. package/lib/components/booking/info/client/serve.js +39 -0
  27. package/lib/components/booking/info/index.js +5 -2
  28. package/lib/components/booking/info/pet/index.js +2 -1
  29. package/lib/components/booking/info/service/addService/index.js +0 -1
  30. package/lib/components/booking/model.d.ts +1 -0
  31. package/package.json +1 -1
@@ -25,12 +25,12 @@ import PlusCircle from "@pisell/icon/es/PlusCircle";
25
25
  import DotsVertical from "@pisell/icon/es/DotsVertical";
26
26
  import User01 from "@pisell/icon/es/User01";
27
27
  import { Context, walkInData } from "../model";
28
- import { Avatar, Dropdown, Button } from "antd";
28
+ import { Avatar, Dropdown, Button, Spin } from "antd";
29
29
  import CustomSelect from "../../components/customSelect";
30
30
  import "./index.less";
31
31
  import { image, locales } from "@pisell/utils";
32
32
  import { isWalkIn as getIsWalkIn } from "../../utils";
33
- import useEngineContext from "../../../../hooks/useEngineContext";
33
+ import { getFranchiseeCustomerInfo, getFranchiseeCustomerList } from "./serve";
34
34
  var Info = function Info() {
35
35
  var _state$client$value2, _state$client$value3, _state$client$value4, _state$client$value5, _state$client$value6, _state$client$value7;
36
36
  var modalRef = useRef();
@@ -45,16 +45,19 @@ var Info = function Info() {
45
45
  var _useContext = useContext(Context),
46
46
  state = _useContext.state,
47
47
  dispatch = _useContext.dispatch;
48
- var _useState5 = useState({
48
+ var _useState5 = useState(0),
49
+ _useState6 = _slicedToArray(_useState5, 2),
50
+ franchiseeLoading = _useState6[0],
51
+ setFranchiseeLoading = _useState6[1];
52
+ var _useState7 = useState({
49
53
  skip: 1,
50
54
  num: 50,
51
55
  total: 0,
52
56
  search: ""
53
57
  }),
54
- _useState6 = _slicedToArray(_useState5, 2),
55
- params = _useState6[0],
56
- setParams = _useState6[1];
57
- var context = useEngineContext();
58
+ _useState8 = _slicedToArray(_useState7, 2),
59
+ params = _useState8[0],
60
+ setParams = _useState8[1];
58
61
  var menus = useMemo(function () {
59
62
  var list = [{
60
63
  key: "view",
@@ -75,22 +78,27 @@ var Info = function Info() {
75
78
  }, [state.disabledEdit]);
76
79
  var getClients = /*#__PURE__*/function () {
77
80
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
78
- var customer_id, resetParams, _setLoading, data, list, _payload, customerItem, totalList;
81
+ var customer_id, resetParams, _setLoading, api, data, list, _payload, customerItem, totalList;
79
82
  return _regeneratorRuntime().wrap(function _callee$(_context) {
80
83
  while (1) switch (_context.prev = _context.next) {
81
84
  case 0:
82
85
  customer_id = _ref.customer_id, resetParams = _objectWithoutProperties(_ref, _excluded);
83
86
  _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
84
87
  _setLoading(true);
85
- _context.next = 5;
86
- return state.apis.getClients(_objectSpread(_objectSpread({}, resetParams), {}, {
88
+ api = state.isFranchisee ? getFranchiseeCustomerList : state.apis.getClients;
89
+ _context.next = 6;
90
+ return api(_objectSpread(_objectSpread({}, resetParams), !state.isFranchisee ? {
87
91
  _config: {
88
92
  abort: true
89
93
  }
90
- }));
91
- case 5:
94
+ } : {}));
95
+ case 6:
92
96
  data = _context.sent;
93
- list = (data === null || data === void 0 ? void 0 : data.list) || [];
97
+ list = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (d) {
98
+ return _objectSpread(_objectSpread({}, d), {}, {
99
+ id: d.franchisee_customer_id || d.id
100
+ });
101
+ });
94
102
  _payload = {
95
103
  clients: list
96
104
  }; // 有传递, 则表示新增客户之后刷新列表的, 应该默认选中
@@ -119,7 +127,7 @@ var Info = function Info() {
119
127
  });
120
128
  _setLoading(false);
121
129
  return _context.abrupt("return", {});
122
- case 16:
130
+ case 17:
123
131
  case "end":
124
132
  return _context.stop();
125
133
  }
@@ -146,21 +154,103 @@ var Info = function Info() {
146
154
  }
147
155
  return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
148
156
  }, [locales.localeMap]);
149
- var handleSelectClient = function handleSelectClient(value) {
150
- var _value = (value === null || value === void 0 ? void 0 : value[value.length - 1]) || walkInData;
151
- if (_value.loading) {
152
- return;
153
- }
154
- dispatch({
155
- type: "setClient",
156
- payload: {
157
- value: _objectSpread(_objectSpread({}, _value), {}, {
158
- name: getNickname(_value)
159
- }),
160
- edit: true
161
- }
162
- });
163
- };
157
+
158
+ /**
159
+ * @title: 置换客户id到子店铺
160
+ * @description:
161
+ * @param {number} id
162
+ * @return {*}
163
+ * @Author: zhiwei.Wang
164
+ * @Date: 2024-05-29 17:26
165
+ */
166
+ var _getFranchiseeCustomerInfo = /*#__PURE__*/function () {
167
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(customer) {
168
+ var res;
169
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
170
+ while (1) switch (_context2.prev = _context2.next) {
171
+ case 0:
172
+ _context2.prev = 0;
173
+ setFranchiseeLoading(customer.id);
174
+ _context2.next = 4;
175
+ return getFranchiseeCustomerInfo({
176
+ franchisor_customer_id: customer.id
177
+ });
178
+ case 4:
179
+ res = _context2.sent;
180
+ setFranchiseeLoading(0);
181
+ return _context2.abrupt("return", _objectSpread(_objectSpread({}, customer), {}, {
182
+ id: res.franchisee_customer_id
183
+ }));
184
+ case 9:
185
+ _context2.prev = 9;
186
+ _context2.t0 = _context2["catch"](0);
187
+ setFranchiseeLoading(0);
188
+ case 12:
189
+ case "end":
190
+ return _context2.stop();
191
+ }
192
+ }, _callee2, null, [[0, 9]]);
193
+ }));
194
+ return function _getFranchiseeCustomerInfo(_x3) {
195
+ return _ref3.apply(this, arguments);
196
+ };
197
+ }();
198
+ var handleSelectClient = /*#__PURE__*/function () {
199
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(value) {
200
+ var _value;
201
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
202
+ while (1) switch (_context3.prev = _context3.next) {
203
+ case 0:
204
+ _value = (value === null || value === void 0 ? void 0 : value[value.length - 1]) || walkInData;
205
+ if (!_value.loading) {
206
+ _context3.next = 3;
207
+ break;
208
+ }
209
+ return _context3.abrupt("return");
210
+ case 3:
211
+ if (!(state.isFranchisee && _value.franchisee_customer_id === 0)) {
212
+ _context3.next = 14;
213
+ break;
214
+ }
215
+ _context3.prev = 4;
216
+ _context3.next = 7;
217
+ return _getFranchiseeCustomerInfo(_value);
218
+ case 7:
219
+ _value = _context3.sent;
220
+ _context3.next = 12;
221
+ break;
222
+ case 10:
223
+ _context3.prev = 10;
224
+ _context3.t0 = _context3["catch"](4);
225
+ case 12:
226
+ if (_value) {
227
+ _context3.next = 14;
228
+ break;
229
+ }
230
+ return _context3.abrupt("return");
231
+ case 14:
232
+ dispatch({
233
+ type: "setClient",
234
+ payload: {
235
+ value: _objectSpread(_objectSpread({}, _value), {}, {
236
+ name: getNickname(_value)
237
+ }),
238
+ edit: true
239
+ }
240
+ });
241
+ return _context3.abrupt("return", new Promise(function (resolve) {
242
+ resolve(0);
243
+ }));
244
+ case 16:
245
+ case "end":
246
+ return _context3.stop();
247
+ }
248
+ }, _callee3, null, [[4, 10]]);
249
+ }));
250
+ return function handleSelectClient(_x4) {
251
+ return _ref4.apply(this, arguments);
252
+ };
253
+ }();
164
254
  var handleViewClient = function handleViewClient() {
165
255
  state.action({
166
256
  type: "pisell1.handleOpenCustomerModal",
@@ -216,7 +306,6 @@ var Info = function Info() {
216
306
  var _state$client$value;
217
307
  return getIsWalkIn((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id);
218
308
  }, [(_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.id]);
219
- useEffect(function () {}, []);
220
309
  useEffect(function () {
221
310
  if (state.action) {
222
311
  state.action({
@@ -352,7 +441,11 @@ var Info = function Info() {
352
441
  className: ""
353
442
  }, item.email) : null, item.phone ? /*#__PURE__*/React.createElement("div", {
354
443
  className: ""
355
- }, item.phone) : null)));
444
+ }, item.phone) : null)), /*#__PURE__*/React.createElement("div", {
445
+ className: "pisell-lowcode__booking-client-list-item-loading"
446
+ }, /*#__PURE__*/React.createElement(Spin, {
447
+ spinning: franchiseeLoading === item.id
448
+ })));
356
449
  },
357
450
  searchChange: searchChange,
358
451
  searchValue: params.search
@@ -0,0 +1,2 @@
1
+ export declare const getFranchiseeCustomerInfo: (params: any) => Promise<any>;
2
+ export declare const getFranchiseeCustomerList: (params: any) => Promise<any>;
@@ -0,0 +1,51 @@
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
+ export var getFranchiseeCustomerInfo = /*#__PURE__*/function () {
7
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
8
+ var _yield$request$getReq, data;
9
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10
+ while (1) switch (_context.prev = _context.next) {
11
+ case 0:
12
+ _context.next = 2;
13
+ return request.getRequest().get("/shop/franchisee/customer/id", params);
14
+ case 2:
15
+ _yield$request$getReq = _context.sent;
16
+ data = _yield$request$getReq.data;
17
+ return _context.abrupt("return", data);
18
+ case 5:
19
+ case "end":
20
+ return _context.stop();
21
+ }
22
+ }, _callee);
23
+ }));
24
+ return function getFranchiseeCustomerInfo(_x) {
25
+ return _ref.apply(this, arguments);
26
+ };
27
+ }();
28
+ export var getFranchiseeCustomerList = /*#__PURE__*/function () {
29
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
30
+ var _yield$request$getReq2, data;
31
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
32
+ while (1) switch (_context2.prev = _context2.next) {
33
+ case 0:
34
+ _context2.next = 2;
35
+ return request.getRequest().get("/shop/franchisee/customer/select-list", params, {
36
+ abort: true
37
+ });
38
+ case 2:
39
+ _yield$request$getReq2 = _context2.sent;
40
+ data = _yield$request$getReq2.data;
41
+ return _context2.abrupt("return", data);
42
+ case 5:
43
+ case "end":
44
+ return _context2.stop();
45
+ }
46
+ }, _callee2);
47
+ }));
48
+ return function getFranchiseeCustomerList(_x2) {
49
+ return _ref2.apply(this, arguments);
50
+ };
51
+ }();
@@ -16,7 +16,7 @@ import AddNote from "../notes/addNote";
16
16
  import Header from "./header";
17
17
  import localeTexts from "../locales";
18
18
  import { locales } from "@pisell/utils";
19
- import { findNextDuration, flexibleObj, formatResource, getErrorList, sliceDayIntoFiveMinutes } from "../utils";
19
+ import { findNextDuration, flexibleObj, formatResource, getErrorList, sliceDayIntoFiveMinutes, request } from "../utils";
20
20
  import { updateServiceDate } from "./date";
21
21
  import useEngineContext from "../../../hooks/useEngineContext";
22
22
  import Notes from "./notes";
@@ -30,7 +30,7 @@ var defaultModules = {
30
30
  };
31
31
  locales.init(localeTexts, localStorage.getItem("umi_locale") || "en");
32
32
  var Info = Provider(function (props) {
33
- var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state4, _modal$state4$notes, _context$appHelper2, _context$appHelper2$u, _modal$state5, _React$createElement;
33
+ var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state4, _modal$state4$notes, _context$appHelper3, _context$appHelper3$u, _modal$state5, _React$createElement;
34
34
  // return <Payments {...props} />;
35
35
  var style = props.style,
36
36
  globalState = props.globalState,
@@ -39,6 +39,7 @@ var Info = Provider(function (props) {
39
39
  slot = props.slot;
40
40
  var modal = useContext(Context);
41
41
  var context = useEngineContext();
42
+ request.setRequest(context.appHelper.utils.request);
42
43
  var params = useMemo(function () {
43
44
  var _modal$state, _modal$state$bookingC, _modal$state$bookingC2, _modal$state$bookingC3;
44
45
  return ((_modal$state = modal.state) === null || _modal$state === void 0 ? void 0 : (_modal$state$bookingC = _modal$state.bookingConfig) === null || _modal$state$bookingC === void 0 ? void 0 : (_modal$state$bookingC2 = _modal$state$bookingC.config) === null || _modal$state$bookingC2 === void 0 ? void 0 : (_modal$state$bookingC3 = _modal$state$bookingC2.basic) === null || _modal$state$bookingC3 === void 0 ? void 0 : _modal$state$bookingC3.appointment_subject) || {};
@@ -60,13 +61,15 @@ var Info = Provider(function (props) {
60
61
  }
61
62
  }, []);
62
63
  useEffect(function () {
63
- var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2;
64
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2;
65
+ var isFranchisee = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.businessUtils) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.getAppByModal) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2, "franchisee");
64
66
  modal.dispatch({
65
67
  type: "setState",
66
68
  payload: _objectSpread(_objectSpread({
67
69
  setGlobalState: props.setGlobalState
68
70
  }, globalState), {}, {
69
- isTerminal: context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.isTerminal) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.call(_context$appHelper$ut)
71
+ isTerminal: context === null || context === void 0 ? void 0 : (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : (_context$appHelper2$u = _context$appHelper2.utils) === null || _context$appHelper2$u === void 0 ? void 0 : (_context$appHelper2$u2 = _context$appHelper2$u.isTerminal) === null || _context$appHelper2$u2 === void 0 ? void 0 : _context$appHelper2$u2.call(_context$appHelper2$u),
72
+ isFranchisee: isFranchisee
70
73
  })
71
74
  });
72
75
  }, [globalState]);
@@ -112,7 +115,7 @@ var Info = Provider(function (props) {
112
115
  source: "info"
113
116
  })
114
117
  }, _defineProperty(_React$createElement, "style", {
115
- height: context !== null && context !== void 0 && (_context$appHelper2 = context.appHelper) !== null && _context$appHelper2 !== void 0 && (_context$appHelper2$u = _context$appHelper2.utils) !== null && _context$appHelper2$u !== void 0 && _context$appHelper2$u.isMobile ? "100%" : "100vh"
118
+ height: context !== null && context !== void 0 && (_context$appHelper3 = context.appHelper) !== null && _context$appHelper3 !== void 0 && (_context$appHelper3$u = _context$appHelper3.utils) !== null && _context$appHelper3$u !== void 0 && _context$appHelper3$u.isMobile ? "100%" : "100vh"
116
119
  }), _defineProperty(_React$createElement, "bodyClassName", "booking-info-warp"), _React$createElement), /*#__PURE__*/React.createElement("div", {
117
120
  className: "booking-info"
118
121
  }, modules.client ? /*#__PURE__*/React.createElement(Client, null) : null, modules.holder && !((_modal$state5 = modal.state) !== null && _modal$state5 !== void 0 && _modal$state5.disabledEdit) ? /*#__PURE__*/React.createElement(React.Fragment, null, params.type === "form" ? /*#__PURE__*/React.createElement(Pet, null) : null) : null, modules.date ? /*#__PURE__*/React.createElement(DateCom, null) : null, modules.service ? /*#__PURE__*/React.createElement(React.Fragment, null, modal.state.date.value ? /*#__PURE__*/React.createElement(Service, null) : null) : null, notes, slot ? slot : null)) : null);
@@ -119,9 +119,11 @@ var Pet = function Pet() {
119
119
  _context.next = 14;
120
120
  break;
121
121
  }
122
- _values = _objectSpread({
122
+ _values = _objectSpread(_objectSpread({
123
123
  form_id: boardParams.form_id
124
- }, _params);
124
+ }, _params), {}, {
125
+ source_shop_customer: petForm === null || petForm === void 0 ? void 0 : petForm.is_franchisor
126
+ });
125
127
  if (formData.data_range === "customer") {
126
128
  _values.customer_id = (_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : (_state$client2$value = _state$client2.value) === null || _state$client2$value === void 0 ? void 0 : _state$client2$value.id;
127
129
  }
@@ -360,7 +360,6 @@ var Info = function Info() {
360
360
  }
361
361
  });
362
362
  }, [state.renderType, showAddButton, isService, state.service.value, loading]);
363
- console.log(state.service.addModal, "state.service.addModal");
364
363
  return /*#__PURE__*/React.createElement(React.Fragment, null, ((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$cache = _state$service3.cacheItem) === null || _state$service3$cache === void 0 ? void 0 : _state$service3$cache.autoClose) && /*#__PURE__*/React.createElement(Skeleton, {
365
364
  loading: true,
366
365
  active: true,
@@ -73,6 +73,7 @@ export interface FormState {
73
73
  renderType?: "eventBooking";
74
74
  modalOpen?: boolean;
75
75
  isTerminal?: boolean;
76
+ isFranchisee?: boolean;
76
77
  eventOtherParams?: {
77
78
  relation_id: number;
78
79
  number: number;
@@ -118,8 +118,8 @@ var CustomSelect = (props, ref) => {
118
118
  }, 100);
119
119
  }
120
120
  };
121
- const _onValueChange = (_val) => {
122
- onValueChange(_val);
121
+ const _onValueChange = async (_val) => {
122
+ await onValueChange(_val);
123
123
  };
124
124
  const handleSelectItem = (item) => {
125
125
  let _val = (0, import_utils.changeArray)(_value, item, rowKey);
@@ -162,8 +162,8 @@ var CustomSelect = (props, ref) => {
162
162
  const isMore = (0, import_react.useMemo)(() => {
163
163
  return _value.length > 0;
164
164
  }, [_value]);
165
- const handleApply = (_val) => {
166
- _onValueChange(_val || _value);
165
+ const handleApply = async (_val) => {
166
+ await _onValueChange(_val || _value);
167
167
  closeDrawer();
168
168
  };
169
169
  (0, import_react.useImperativeHandle)(ref, () => {
@@ -124,17 +124,20 @@ var formatBookings = (data) => {
124
124
  });
125
125
  return bookings;
126
126
  };
127
- var formatHolder = (data, values) => {
127
+ var formatHolder = (state, values) => {
128
128
  var _a, _b, _c, _d, _e, _f, _g, _h;
129
- const form_id = ((_d = (_c = (_b = (_a = data == null ? void 0 : data.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
130
- const petValue = ((_e = data.pet.value) == null ? void 0 : _e[form_id]) || [];
129
+ const form_id = ((_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
130
+ const petValue = ((_e = state.pet.value) == null ? void 0 : _e[form_id]) || [];
131
131
  let obj = {
132
132
  customer_id: values.customer_id,
133
133
  form_id,
134
134
  form_record: petValue.map((d) => d.form_record_id)
135
135
  };
136
- if (!petValue.length && ((_h = (_g = (_f = data.pet) == null ? void 0 : _f.originValue) == null ? void 0 : _g.form_record) == null ? void 0 : _h.length)) {
137
- obj.form_record = data.pet.originValue.form_record;
136
+ if (!petValue.length && ((_h = (_g = (_f = state.pet) == null ? void 0 : _f.originValue) == null ? void 0 : _g.form_record) == null ? void 0 : _h.length)) {
137
+ obj.form_record = state.pet.originValue.form_record;
138
+ }
139
+ if (state.isFranchisee) {
140
+ obj.is_source_shop = 1;
138
141
  }
139
142
  return obj;
140
143
  };
@@ -60,12 +60,43 @@ var Forms = (0, import_model.Provider)((props) => {
60
60
  geForms();
61
61
  }
62
62
  }, [(_f = (_e = state.bookingDetail) == null ? void 0 : _e.bookings) == null ? void 0 : _f.id, (_h = (_g = state.client) == null ? void 0 : _g.value) == null ? void 0 : _h.id]);
63
+ const getFranchiseeCompositeData = async ({ request, params: params2 }) => {
64
+ let arr = [];
65
+ arr.push(request(params2));
66
+ if (state.isFranchisee) {
67
+ arr.push(request({ ...params2, source_shop_customer: 1 }));
68
+ }
69
+ const res = await Promise.all(arr);
70
+ return res;
71
+ };
72
+ const getFranchiseeForms = async (params2) => {
73
+ const res = await getFranchiseeCompositeData({
74
+ request: state.apis.getForms,
75
+ params: params2
76
+ });
77
+ if (state.isFranchisee) {
78
+ let arr = [];
79
+ res.forEach((item, index) => {
80
+ arr = arr.concat(
81
+ item.map((d) => {
82
+ return {
83
+ ...d,
84
+ is_franchisor: index === 1 ? 1 : 0
85
+ };
86
+ })
87
+ );
88
+ });
89
+ return arr;
90
+ }
91
+ return res[0];
92
+ };
63
93
  const getFormDataById = async (item) => {
64
94
  var _a2, _b2;
65
95
  let _params = {
66
96
  form_id: item.form_id,
67
97
  skip: 1,
68
- num: 999
98
+ num: 999,
99
+ source_shop_customer: item.is_franchisor ? 1 : 0
69
100
  };
70
101
  let options = [];
71
102
  const isCustomerForm = item.data_range === "customer" && !(0, import_utils2.isWalkIn)((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id);
@@ -96,7 +127,7 @@ var Forms = (0, import_model.Provider)((props) => {
96
127
  const geForms = async () => {
97
128
  setLoading(true);
98
129
  try {
99
- let data = await state.apis.getForms({
130
+ let data = await getFranchiseeForms({
100
131
  relation_type,
101
132
  relation_id: state.bookingDetail.bookings.id
102
133
  // _config: { useCache: true },
@@ -105,6 +136,7 @@ var Forms = (0, import_model.Provider)((props) => {
105
136
  if (params.type === "form") {
106
137
  data = data.filter((d) => d.form_id !== (params == null ? void 0 : params.form_id));
107
138
  }
139
+ console.log("datadata", data);
108
140
  const formData = await getFormData(data);
109
141
  dispatch({
110
142
  type: "setForm",
@@ -131,10 +163,13 @@ var Forms = (0, import_model.Provider)((props) => {
131
163
  });
132
164
  }, []);
133
165
  (0, import_react.useEffect)(() => {
166
+ var _a2, _b2, _c2, _d2;
167
+ const isFranchisee = (_d2 = (_c2 = (_b2 = (_a2 = context == null ? void 0 : context.appHelper) == null ? void 0 : _a2.utils) == null ? void 0 : _b2.businessUtils) == null ? void 0 : _c2.getAppByModal) == null ? void 0 : _d2.call(_c2, "franchisee");
134
168
  dispatch({
135
169
  type: "setState",
136
170
  payload: {
137
- ...globalState
171
+ ...globalState,
172
+ isFranchisee
138
173
  }
139
174
  });
140
175
  }, [globalState]);
@@ -122,7 +122,7 @@ var Single = ({
122
122
  if (optionRender) {
123
123
  return optionRender(item);
124
124
  }
125
- return /* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1 } }, item["main_field"] || "-");
125
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1 } }, item["main_field"] || item[form.option_key] || "-");
126
126
  };
127
127
  const _addButtonProps = (0, import_react.useMemo)(() => {
128
128
  var _a2, _b2;
@@ -42,20 +42,20 @@ var import_customSelect = __toESM(require("../../components/customSelect"));
42
42
  var import_index = require("./index.less");
43
43
  var import_utils = require("@pisell/utils");
44
44
  var import_utils2 = require("../../utils");
45
- var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
45
+ var import_serve = require("./serve");
46
46
  var Info = () => {
47
47
  var _a, _b, _c, _d, _e, _f;
48
48
  const modalRef = (0, import_react.useRef)();
49
49
  const [loadLoading, setLoadLoading] = (0, import_react.useState)(false);
50
50
  const [loading, setLoading] = (0, import_react.useState)(false);
51
51
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
52
+ const [franchiseeLoading, setFranchiseeLoading] = (0, import_react.useState)(0);
52
53
  const [params, setParams] = (0, import_react.useState)({
53
54
  skip: 1,
54
55
  num: 50,
55
56
  total: 0,
56
57
  search: ""
57
58
  });
58
- const context = (0, import_useEngineContext.default)();
59
59
  const menus = (0, import_react.useMemo)(() => {
60
60
  let list = [
61
61
  { key: "view", label: import_utils.locales.getText("pisell2.text.view-profile") },
@@ -73,11 +73,17 @@ var Info = () => {
73
73
  }) => {
74
74
  let _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
75
75
  _setLoading(true);
76
- const data = await state.apis.getClients({
76
+ const api = state.isFranchisee ? import_serve.getFranchiseeCustomerList : state.apis.getClients;
77
+ const data = await api({
77
78
  ...resetParams,
78
- _config: { abort: true }
79
+ ...!state.isFranchisee ? { _config: { abort: true } } : {}
80
+ });
81
+ const list = ((data == null ? void 0 : data.list) || []).map((d) => {
82
+ return {
83
+ ...d,
84
+ id: d.franchisee_customer_id || d.id
85
+ };
79
86
  });
80
- const list = (data == null ? void 0 : data.list) || [];
81
87
  let _payload = {
82
88
  clients: list
83
89
  };
@@ -124,11 +130,35 @@ var Info = () => {
124
130
  },
125
131
  [import_utils.locales.localeMap]
126
132
  );
127
- const handleSelectClient = (value) => {
133
+ const _getFranchiseeCustomerInfo = async (customer) => {
134
+ try {
135
+ setFranchiseeLoading(customer.id);
136
+ const res = await (0, import_serve.getFranchiseeCustomerInfo)({
137
+ franchisor_customer_id: customer.id
138
+ });
139
+ setFranchiseeLoading(0);
140
+ return {
141
+ ...customer,
142
+ id: res.franchisee_customer_id
143
+ };
144
+ } catch (err) {
145
+ setFranchiseeLoading(0);
146
+ }
147
+ };
148
+ const handleSelectClient = async (value) => {
128
149
  let _value = (value == null ? void 0 : value[value.length - 1]) || import_model.walkInData;
129
150
  if (_value.loading) {
130
151
  return;
131
152
  }
153
+ if (state.isFranchisee && _value.franchisee_customer_id === 0) {
154
+ try {
155
+ _value = await _getFranchiseeCustomerInfo(_value);
156
+ } catch (err) {
157
+ }
158
+ if (!_value) {
159
+ return;
160
+ }
161
+ }
132
162
  dispatch({
133
163
  type: "setClient",
134
164
  payload: {
@@ -139,6 +169,9 @@ var Info = () => {
139
169
  edit: true
140
170
  }
141
171
  });
172
+ return new Promise((resolve) => {
173
+ resolve(0);
174
+ });
142
175
  };
143
176
  const handleViewClient = () => {
144
177
  state.action({
@@ -195,8 +228,6 @@ var Info = () => {
195
228
  var _a2;
196
229
  return (0, import_utils2.isWalkIn)((_a2 = state.client.value) == null ? void 0 : _a2.id);
197
230
  }, [(_a = state.client.value) == null ? void 0 : _a.id]);
198
- (0, import_react.useEffect)(() => {
199
- }, []);
200
231
  (0, import_react.useEffect)(() => {
201
232
  if (state.action) {
202
233
  state.action({
@@ -296,7 +327,7 @@ var Info = () => {
296
327
  src: import_utils.image.ali(item.cover, 100) || void 0,
297
328
  icon: /* @__PURE__ */ import_react.default.createElement(import_User01.default, { className: "pisell-lowcode__booking-client-list-item-avatar-icon" })
298
329
  }
299
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-info-name" }, getNickname(item)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-info-desc" }, item.email ? /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, item.email) : null, item.phone ? /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, item.phone) : null)));
330
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-info-name" }, getNickname(item)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-info-desc" }, item.email ? /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, item.email) : null, item.phone ? /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, item.phone) : null)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-list-item-loading" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { spinning: franchiseeLoading === item.id })));
300
331
  },
301
332
  searchChange,
302
333
  searchValue: params.search,
@@ -0,0 +1,2 @@
1
+ export declare const getFranchiseeCustomerInfo: (params: any) => Promise<any>;
2
+ export declare const getFranchiseeCustomerList: (params: any) => Promise<any>;