@pisell/private-materials 3.0.199 → 3.0.201
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/addons/model.d.ts +1 -1
- package/es/components/booking/components/customSelect/index.d.ts +1 -0
- package/es/components/booking/components/customSelect/index.js +6 -2
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +38 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/components/footer/amount.js +45 -22
- package/es/components/booking/components/footer/index.js +84 -40
- package/es/components/booking/components/footer/utils.js +243 -32
- package/es/components/booking/info/addServiceVariant/index.js +8 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +14 -13
- package/es/components/booking/info/clientVariant/vertical/index.js +33 -4
- package/es/components/booking/info/dateRange/index.d.ts +5 -0
- package/es/components/booking/info/dateRange/index.js +98 -0
- package/es/components/booking/info/dateRange/index.less +21 -0
- package/es/components/booking/info/main.js +20 -8
- package/es/components/booking/info/model.js +3 -0
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/es/components/booking/info/pet/ChangePetModal/index.js +119 -0
- package/es/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/es/components/booking/info/pet/index.js +54 -5
- package/es/components/booking/info/service/addService/index.js +142 -22
- package/es/components/booking/info/service/addService/index.less +13 -3
- package/es/components/booking/info/service/addService/utils.d.ts +11 -2
- package/es/components/booking/info/service/addService/utils.js +49 -24
- package/es/components/booking/info/service/editService/index.js +255 -44
- package/es/components/booking/info/service/editService/index.less +18 -13
- package/es/components/booking/info/service2/Lists.d.ts +3 -0
- package/es/components/booking/info/service2/Lists.js +158 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.js +54 -0
- package/es/components/booking/info/service2/index.d.ts +3 -0
- package/es/components/booking/info/service2/index.js +58 -0
- package/es/components/booking/info/service2/status.d.ts +31 -0
- package/es/components/booking/info/service2/status.js +78 -0
- package/es/components/booking/info/service2/utils.d.ts +145 -0
- package/es/components/booking/info/service2/utils.js +438 -0
- package/es/components/booking/info/utils.d.ts +9 -0
- package/es/components/booking/info/utils.js +13 -0
- package/es/components/booking/locales.d.ts +60 -0
- package/es/components/booking/locales.js +75 -3
- package/es/components/booking/materiels/holder/index.d.ts +7 -0
- package/es/components/booking/materiels/holder/index.js +51 -0
- package/es/components/booking/model.d.ts +4 -1
- package/es/components/booking/model.js +4 -2
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/utils.d.ts +12 -3
- package/es/components/booking/utils.js +139 -23
- package/es/components/eftpos/form/index.js +6 -12
- package/es/components/eftpos/group/index.d.ts +2 -1
- package/es/components/eftpos/group/index.js +2 -1
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftposPay/helper.d.ts +0 -1
- package/es/components/eftposPay/helper.js +0 -14
- package/es/components/eftposPay/tyro/index.js +20 -51
- package/es/components/shoppingCart/Provider.d.ts +3 -0
- package/es/components/shoppingCart/Provider.js +86 -0
- package/es/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/Product.js +96 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/index.js +72 -0
- package/es/components/shoppingCart/components/Cart/index.less +68 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Empty/index.js +14 -0
- package/es/components/shoppingCart/components/Empty/index.less +19 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Render/index.js +68 -0
- package/es/components/shoppingCart/components/Render/index.less +2 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +124 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/es/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useAddService.js +23 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +54 -0
- package/es/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useContext.js +5 -0
- package/es/components/shoppingCart/index.d.ts +4 -0
- package/es/components/shoppingCart/index.js +24 -0
- package/es/components/shoppingCart/locales.d.ts +33 -0
- package/es/components/shoppingCart/locales.js +38 -0
- package/es/components/shoppingCart/mock.d.ts +40 -0
- package/es/components/shoppingCart/mock.js +40 -0
- package/es/components/shoppingCart/status.d.ts +2 -0
- package/es/components/shoppingCart/status.js +22 -0
- package/es/components/shoppingCart/type.d.ts +39 -0
- package/es/components/shoppingCart/type.js +1 -0
- package/es/components/shoppingCart/utils.d.ts +63 -0
- package/es/components/shoppingCart/utils.js +119 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/booking/addons/model.d.ts +1 -1
- package/lib/components/booking/components/customSelect/index.d.ts +1 -0
- package/lib/components/booking/components/customSelect/index.js +6 -2
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +60 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/components/footer/amount.js +26 -8
- package/lib/components/booking/components/footer/index.js +25 -4
- package/lib/components/booking/components/footer/utils.js +157 -31
- package/lib/components/booking/info/addServiceVariant/index.js +5 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +8 -7
- package/lib/components/booking/info/clientVariant/vertical/index.js +36 -10
- package/lib/components/booking/info/dateRange/index.d.ts +5 -0
- package/lib/components/booking/info/dateRange/index.js +111 -0
- package/lib/components/booking/info/dateRange/index.less +21 -0
- package/lib/components/booking/info/main.js +11 -4
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.js +111 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/lib/components/booking/info/pet/index.js +61 -25
- package/lib/components/booking/info/service/addService/index.js +107 -34
- package/lib/components/booking/info/service/addService/index.less +13 -3
- package/lib/components/booking/info/service/addService/utils.d.ts +11 -2
- package/lib/components/booking/info/service/addService/utils.js +31 -10
- package/lib/components/booking/info/service/editService/index.js +293 -125
- package/lib/components/booking/info/service/editService/index.less +18 -13
- package/lib/components/booking/info/service2/Lists.d.ts +3 -0
- package/lib/components/booking/info/service2/Lists.js +113 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +50 -0
- package/lib/components/booking/info/service2/index.d.ts +3 -0
- package/lib/components/booking/info/service2/index.js +75 -0
- package/lib/components/booking/info/service2/status.d.ts +31 -0
- package/lib/components/booking/info/service2/status.js +81 -0
- package/lib/components/booking/info/service2/utils.d.ts +145 -0
- package/lib/components/booking/info/service2/utils.js +322 -0
- package/lib/components/booking/info/utils.d.ts +9 -0
- package/lib/components/booking/info/utils.js +6 -0
- package/lib/components/booking/locales.d.ts +60 -0
- package/lib/components/booking/locales.js +63 -3
- package/lib/components/booking/materiels/holder/index.d.ts +7 -0
- package/lib/components/booking/materiels/holder/index.js +65 -0
- package/lib/components/booking/model.d.ts +4 -1
- package/lib/components/booking/model.js +4 -2
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/utils.d.ts +12 -3
- package/lib/components/booking/utils.js +87 -15
- package/lib/components/eftpos/form/index.js +6 -12
- package/lib/components/eftpos/group/index.d.ts +2 -1
- package/lib/components/eftpos/group/index.js +1 -0
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +0 -1
- package/lib/components/eftposPay/helper.js +0 -21
- package/lib/components/eftposPay/tyro/index.js +7 -36
- package/lib/components/shoppingCart/Provider.d.ts +3 -0
- package/lib/components/shoppingCart/Provider.js +110 -0
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/Product.js +89 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/index.js +77 -0
- package/lib/components/shoppingCart/components/Cart/index.less +68 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Empty/index.js +43 -0
- package/lib/components/shoppingCart/components/Empty/index.less +19 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Render/index.js +79 -0
- package/lib/components/shoppingCart/components/Render/index.less +2 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +116 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useAddService.js +55 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +71 -0
- package/lib/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useContext.js +31 -0
- package/lib/components/shoppingCart/index.d.ts +4 -0
- package/lib/components/shoppingCart/index.js +60 -0
- package/lib/components/shoppingCart/locales.d.ts +33 -0
- package/lib/components/shoppingCart/locales.js +56 -0
- package/lib/components/shoppingCart/mock.d.ts +40 -0
- package/lib/components/shoppingCart/mock.js +76 -0
- package/lib/components/shoppingCart/status.d.ts +2 -0
- package/lib/components/shoppingCart/status.js +60 -0
- package/lib/components/shoppingCart/type.d.ts +39 -0
- package/lib/components/shoppingCart/type.js +17 -0
- package/lib/components/shoppingCart/utils.d.ts +63 -0
- package/lib/components/shoppingCart/utils.js +92 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/shopping-cart/meta.ts +98 -0
- package/package.json +4 -4
- package/es/components/eftpos/receipt/index.d.ts +0 -24
- package/es/components/eftpos/receipt/index.js +0 -96
- package/lib/components/eftpos/receipt/index.d.ts +0 -24
- package/lib/components/eftpos/receipt/index.js +0 -88
|
@@ -0,0 +1,119 @@
|
|
|
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
/**
|
|
8
|
+
* @title: 格式化购物车列表
|
|
9
|
+
* @description:
|
|
10
|
+
* @param {any} state
|
|
11
|
+
* @return {*}
|
|
12
|
+
* @Author: WangHan
|
|
13
|
+
* @Date: 2024-11-28 16:52
|
|
14
|
+
*/
|
|
15
|
+
export var formatCartList = function formatCartList(state) {
|
|
16
|
+
var products = state.products,
|
|
17
|
+
holders = state.holders;
|
|
18
|
+
return holders === null || holders === void 0 ? void 0 : holders.map(function (holder) {
|
|
19
|
+
return _objectSpread(_objectSpread({}, holder), {}, {
|
|
20
|
+
products: products === null || products === void 0 ? void 0 : products.filter(function (product) {
|
|
21
|
+
var _product$_extend;
|
|
22
|
+
return (product === null || product === void 0 ? void 0 : (_product$_extend = product._extend) === null || _product$_extend === void 0 ? void 0 : _product$_extend.holder_id) === (holder === null || holder === void 0 ? void 0 : holder.key);
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @title: 是否是空页面
|
|
30
|
+
* @description:
|
|
31
|
+
* @param {any} state
|
|
32
|
+
* @return {*}
|
|
33
|
+
* @Author: WangHan
|
|
34
|
+
* @Date: 2024-11-28 16:47
|
|
35
|
+
*/
|
|
36
|
+
export var isEmptyStatus = function isEmptyStatus(state) {
|
|
37
|
+
var products = state.products,
|
|
38
|
+
holders = state.holders,
|
|
39
|
+
isOpenGroup = state.isOpenGroup;
|
|
40
|
+
// 没开启分组并且没有商品数据
|
|
41
|
+
if (!isOpenGroup && !(products !== null && products !== void 0 && products.length)) return true;
|
|
42
|
+
|
|
43
|
+
// 开启分组没有holders
|
|
44
|
+
if (isOpenGroup && !(holders !== null && holders !== void 0 && holders.length)) return true;
|
|
45
|
+
return false;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @title: 是否是商品列表页面
|
|
50
|
+
* @description:
|
|
51
|
+
* @param {any} state
|
|
52
|
+
* @return {*}
|
|
53
|
+
* @Author: WangHan
|
|
54
|
+
* @Date: 2024-11-28 17:23
|
|
55
|
+
*/
|
|
56
|
+
export var isProductList = function isProductList(state) {
|
|
57
|
+
var holders = state.holders,
|
|
58
|
+
isOpenGroup = state.isOpenGroup;
|
|
59
|
+
|
|
60
|
+
// 开启分组并且有holders, 则是购物车列表
|
|
61
|
+
if (isOpenGroup && holders !== null && holders !== void 0 && holders.length) return false;
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @title: 格式化数据最终结果
|
|
67
|
+
* @description:
|
|
68
|
+
* @param {any} state
|
|
69
|
+
* @return {*}
|
|
70
|
+
* @Author: WangHan
|
|
71
|
+
* @Date: 2024-11-28 18:35
|
|
72
|
+
*/
|
|
73
|
+
export var formatState = function formatState(state) {
|
|
74
|
+
// 默认数据格式化holder数据
|
|
75
|
+
var _default = _objectSpread({}, state);
|
|
76
|
+
var _carts = formatCartList(_default);
|
|
77
|
+
return {
|
|
78
|
+
isEmpty: isEmptyStatus(_default),
|
|
79
|
+
isProductList: isProductList(_default),
|
|
80
|
+
carts: _carts
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @title: 更新商品
|
|
86
|
+
* @description:
|
|
87
|
+
* @param {any} newState
|
|
88
|
+
* @param {any} state
|
|
89
|
+
* @return {*}
|
|
90
|
+
* @Author: WangHan
|
|
91
|
+
* @Date: 2024-11-28 22:30
|
|
92
|
+
*/
|
|
93
|
+
export var updateProduct = function updateProduct(state, newProducts) {
|
|
94
|
+
return {
|
|
95
|
+
products: newProducts,
|
|
96
|
+
carts: formatCartList(_objectSpread(_objectSpread({}, state), {}, {
|
|
97
|
+
products: newProducts
|
|
98
|
+
}))
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @title: 格式化服务
|
|
104
|
+
* @description:
|
|
105
|
+
* @param {any} service
|
|
106
|
+
* @param {number} id holder_id
|
|
107
|
+
* @return {*}
|
|
108
|
+
* @Author: WangHan
|
|
109
|
+
* @Date: 2024-12-09 22:47
|
|
110
|
+
*/
|
|
111
|
+
export var formatService = function formatService(service, id) {
|
|
112
|
+
return service.map(function (item) {
|
|
113
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
114
|
+
_extend: _objectSpread(_objectSpread({}, item._extend || {}), {}, {
|
|
115
|
+
holder_id: id
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
package/es/index.d.ts
CHANGED
|
@@ -22,3 +22,4 @@ export { default as Eftpos } from './components/eftpos';
|
|
|
22
22
|
export { default as EftposPay } from './components/eftposPay';
|
|
23
23
|
export { default as BookingDashboard } from './components/booking/dashboard';
|
|
24
24
|
export { default as PisellSelectCustomerModal } from './components/pisellSelectCustomerModal';
|
|
25
|
+
export { default as ShoppingCart } from './components/shoppingCart';
|
package/es/index.js
CHANGED
|
@@ -25,4 +25,5 @@ export { default as ToCPay } from "./components/pay/toC";
|
|
|
25
25
|
export { default as Eftpos } from "./components/eftpos";
|
|
26
26
|
export { default as EftposPay } from "./components/eftposPay";
|
|
27
27
|
export { default as BookingDashboard } from "./components/booking/dashboard";
|
|
28
|
-
export { default as PisellSelectCustomerModal } from "./components/pisellSelectCustomerModal";
|
|
28
|
+
export { default as PisellSelectCustomerModal } from "./components/pisellSelectCustomerModal";
|
|
29
|
+
export { default as ShoppingCart } from "./components/shoppingCart";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
|
|
4
4
|
state: FormState;
|
|
5
5
|
} & {
|
|
6
6
|
dispatch: (params: {
|
|
@@ -32,6 +32,7 @@ interface CustomSelectProps {
|
|
|
32
32
|
autoFocus?: boolean;
|
|
33
33
|
showDropDown?: boolean;
|
|
34
34
|
handleOpenModal?: () => void;
|
|
35
|
+
handleDayChange?: (value: any) => void;
|
|
35
36
|
}
|
|
36
37
|
declare const _default: React.ForwardRefExoticComponent<CustomSelectProps & React.RefAttributes<unknown>>;
|
|
37
38
|
export default _default;
|
|
@@ -75,7 +75,8 @@ var CustomSelect = (props, ref) => {
|
|
|
75
75
|
closeCallback,
|
|
76
76
|
autoFocus,
|
|
77
77
|
showDropDown = true,
|
|
78
|
-
handleOpenModal: propsHandleOpenModal
|
|
78
|
+
handleOpenModal: propsHandleOpenModal,
|
|
79
|
+
handleDayChange
|
|
79
80
|
} = props;
|
|
80
81
|
const searchRef = (0, import_react.useRef)();
|
|
81
82
|
const [_value, set_value] = (0, import_react.useState)([]);
|
|
@@ -111,7 +112,7 @@ var CustomSelect = (props, ref) => {
|
|
|
111
112
|
}
|
|
112
113
|
closeCallback == null ? void 0 : closeCallback();
|
|
113
114
|
};
|
|
114
|
-
const handleOpenModal = () => {
|
|
115
|
+
const handleOpenModal = (item) => {
|
|
115
116
|
if (disabled) {
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
@@ -145,6 +146,9 @@ var CustomSelect = (props, ref) => {
|
|
|
145
146
|
handleViewItem == null ? void 0 : handleViewItem(item);
|
|
146
147
|
};
|
|
147
148
|
const handleRemoveItem = (item) => {
|
|
149
|
+
if (handleDayChange) {
|
|
150
|
+
handleDayChange(item);
|
|
151
|
+
}
|
|
148
152
|
let _arr = (0, import_utils.changeArray)(_value, item, rowKey);
|
|
149
153
|
_onValueChange(_arr);
|
|
150
154
|
set_value(_arr);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/booking/components/footer/AppointmentProductModal/index.tsx
|
|
30
|
+
var AppointmentProductModal_exports = {};
|
|
31
|
+
__export(AppointmentProductModal_exports, {
|
|
32
|
+
default: () => AppointmentProductModal_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(AppointmentProductModal_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_materials = require("@pisell/materials");
|
|
38
|
+
var AppointmentProductModal = (props, ref) => {
|
|
39
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
40
|
+
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
41
|
+
open: () => {
|
|
42
|
+
setOpen(true);
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
46
|
+
import_materials.PisellModal.Information,
|
|
47
|
+
{
|
|
48
|
+
open,
|
|
49
|
+
platform: "pc",
|
|
50
|
+
title: import_utils.locales.getText("pisell2.text.missing.reservation.title"),
|
|
51
|
+
describe: import_utils.locales.getText("pisell2.text.missing.reservation.content"),
|
|
52
|
+
cancelText: import_utils.locales.getText("pisell2.text.cancel"),
|
|
53
|
+
okText: import_utils.locales.getText("pisell2.text.confirm"),
|
|
54
|
+
closable: true,
|
|
55
|
+
onOk: () => setOpen(false),
|
|
56
|
+
onCancel: () => setOpen(false)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
var AppointmentProductModal_default = (0, import_react.forwardRef)(AppointmentProductModal);
|
|
File without changes
|
|
@@ -25,6 +25,7 @@ __export(amount_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(amount_exports);
|
|
26
26
|
var import_utils = require("../../utils");
|
|
27
27
|
var import_utils2 = require("@pisell/utils");
|
|
28
|
+
var import_utils3 = require("../../info/service2/utils");
|
|
28
29
|
var getRelationDetailsTotal = (relation_details) => {
|
|
29
30
|
let total = 0;
|
|
30
31
|
for (let item of relation_details) {
|
|
@@ -38,27 +39,44 @@ var getProductAmount = (state, isEdit) => {
|
|
|
38
39
|
var _a, _b;
|
|
39
40
|
let price = 0;
|
|
40
41
|
let duration = 0;
|
|
42
|
+
const isDay = (0, import_utils3.isDayBooking)(state);
|
|
41
43
|
if (isEdit) {
|
|
42
44
|
if ((state == null ? void 0 : state.service) || (state == null ? void 0 : state.addons)) {
|
|
43
45
|
for (let item of state == null ? void 0 : state.service.value) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
if (isDay) {
|
|
47
|
+
price += Number(item._extend.total) * Number(item._extend.quantity);
|
|
48
|
+
const _duration = (0, import_utils3.isAppointment)(item, state) ? item._extend.duration : 0;
|
|
49
|
+
duration += _duration;
|
|
50
|
+
} else {
|
|
51
|
+
price += Number(item._extend.total);
|
|
52
|
+
price += getRelationDetailsTotal(item._extend.relation_details || []);
|
|
53
|
+
duration += import_utils.flexibleObj.getValue(item._extend.duration);
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
if (!isDay) {
|
|
57
|
+
for (let item of state.addons.value) {
|
|
58
|
+
price += Number(item._extend.total) * item._extend.quantity;
|
|
59
|
+
}
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
} else {
|
|
53
63
|
price = Number((_a = state.bookingDetail) == null ? void 0 : _a.product_expect_amount);
|
|
54
|
-
|
|
64
|
+
let services = ((_b = state == null ? void 0 : state.service) == null ? void 0 : _b.value) || [];
|
|
65
|
+
duration = services.reduce((pre, cur) => {
|
|
55
66
|
var _a2;
|
|
56
|
-
|
|
67
|
+
let current = 0;
|
|
68
|
+
if (isDay) {
|
|
69
|
+
const _duration = (0, import_utils3.isAppointment)(cur, state) ? cur._extend.duration : 0;
|
|
70
|
+
current = _duration || 0;
|
|
71
|
+
} else {
|
|
72
|
+
current = import_utils.flexibleObj.getValue(((_a2 = cur._extend) == null ? void 0 : _a2.duration) || 0);
|
|
73
|
+
}
|
|
74
|
+
return pre + current;
|
|
57
75
|
}, 0);
|
|
58
76
|
}
|
|
59
77
|
return {
|
|
60
78
|
price: Number(price),
|
|
61
|
-
duration: (0, import_utils.getDiscountTime)(duration)
|
|
79
|
+
duration: (0, import_utils.getDiscountTime)(duration, isDay)
|
|
62
80
|
};
|
|
63
81
|
};
|
|
64
82
|
var getProductItemTax = (item, bookingDetail) => {
|
|
@@ -48,6 +48,8 @@ var import_icons = require("@ant-design/icons");
|
|
|
48
48
|
var import_serve = require("./serve");
|
|
49
49
|
var import_serve2 = require("../../info2/serve");
|
|
50
50
|
var import_utils3 = require("../../info/utils");
|
|
51
|
+
var import_utils4 = require("../../info/service2/utils");
|
|
52
|
+
var import_AppointmentProductModal = __toESM(require("./AppointmentProductModal"));
|
|
51
53
|
var Footer = (props) => {
|
|
52
54
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
53
55
|
const { state, buttons, dispatch, source } = props;
|
|
@@ -55,6 +57,7 @@ var Footer = (props) => {
|
|
|
55
57
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
56
58
|
const [checkoutLoading, setCheckoutLoading] = (0, import_react.useState)(false);
|
|
57
59
|
const [isShowPaymentLink, setIsShowPaymentLink] = (0, import_react.useState)(false);
|
|
60
|
+
const appointmentProductRef = (0, import_react.useRef)(null);
|
|
58
61
|
const context = (0, import_useEngineContext.default)();
|
|
59
62
|
const { isTerminal, interaction, store, storage } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
60
63
|
(0, import_react.useEffect)(() => {
|
|
@@ -210,6 +213,11 @@ var Footer = (props) => {
|
|
|
210
213
|
};
|
|
211
214
|
const handleCheckout = async () => {
|
|
212
215
|
if (isEdit) {
|
|
216
|
+
if ((0, import_utils4.isDayBooking)(state)) {
|
|
217
|
+
const isHasDayProducts = handleDaySubmit();
|
|
218
|
+
if (isHasDayProducts)
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
213
221
|
const res = await handleSave({ type: "checkout" });
|
|
214
222
|
goCheckout((res == null ? void 0 : res.order_id) || state.bookingId);
|
|
215
223
|
return;
|
|
@@ -236,7 +244,7 @@ var Footer = (props) => {
|
|
|
236
244
|
if ((0, import_utils3.isBooking4Shop)(
|
|
237
245
|
(_e2 = (_d2 = (_c2 = (_b2 = (_a2 = context.appHelper.utils.store) == null ? void 0 : _a2.getState) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c2.global) == null ? void 0 : _d2.globalConfig) == null ? void 0 : _e2.id,
|
|
238
246
|
state.renderType
|
|
239
|
-
)) {
|
|
247
|
+
) || state.renderType === "dayBooking") {
|
|
240
248
|
return {
|
|
241
249
|
editBooking: import_serve2.editBookings,
|
|
242
250
|
createBooking: import_serve2.createBookings
|
|
@@ -247,11 +255,24 @@ var Footer = (props) => {
|
|
|
247
255
|
createBooking: state.apis.createBooking
|
|
248
256
|
};
|
|
249
257
|
};
|
|
258
|
+
const handleDaySubmit = () => {
|
|
259
|
+
var _a2;
|
|
260
|
+
const _isHasDayProducts = (0, import_utils4.isHasDayAppointmentProduct)(state);
|
|
261
|
+
if (_isHasDayProducts) {
|
|
262
|
+
(_a2 = appointmentProductRef == null ? void 0 : appointmentProductRef.current) == null ? void 0 : _a2.open();
|
|
263
|
+
}
|
|
264
|
+
return _isHasDayProducts;
|
|
265
|
+
};
|
|
250
266
|
const handleSave = async ({
|
|
251
267
|
type,
|
|
252
268
|
messageShow = true
|
|
253
269
|
}) => {
|
|
254
270
|
var _a2;
|
|
271
|
+
if ((0, import_utils4.isDayBooking)(state)) {
|
|
272
|
+
const isHasDayProducts = handleDaySubmit();
|
|
273
|
+
if (isHasDayProducts)
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
255
276
|
let _setLoading = type === "checkout" ? setCheckoutLoading : setLoading;
|
|
256
277
|
_setLoading(true);
|
|
257
278
|
const { createBooking, editBooking } = getApis();
|
|
@@ -647,7 +668,7 @@ var Footer = (props) => {
|
|
|
647
668
|
}
|
|
648
669
|
if (transaction_habit_selection.button_rows == 1) {
|
|
649
670
|
if (state.appointment_status !== "cancelled") {
|
|
650
|
-
if (!state.disabledEdit && !state.isBookingCreatePage) {
|
|
671
|
+
if (!state.disabledEdit && !state.isBookingCreatePage && !(0, import_utils4.isDayBooking)(state)) {
|
|
651
672
|
arr.push(actionMap.sale);
|
|
652
673
|
}
|
|
653
674
|
}
|
|
@@ -861,7 +882,7 @@ var Footer = (props) => {
|
|
|
861
882
|
className: "pisell-lowcode__booking-footer-buttons",
|
|
862
883
|
style: { marginTop: 12 }
|
|
863
884
|
},
|
|
864
|
-
state.appointment_status !== "cancelled" && !state.isBookingCreatePage ? /* @__PURE__ */ import_react.default.createElement(
|
|
885
|
+
state.appointment_status !== "cancelled" && !state.isBookingCreatePage && !(0, import_utils4.isDayBooking)(state) ? /* @__PURE__ */ import_react.default.createElement(
|
|
865
886
|
import_antd2.Button,
|
|
866
887
|
{
|
|
867
888
|
onClick: () => handleSale(),
|
|
@@ -879,6 +900,6 @@ var Footer = (props) => {
|
|
|
879
900
|
},
|
|
880
901
|
actionMap.orderDetail.label
|
|
881
902
|
)
|
|
882
|
-
) : null, contextHolder);
|
|
903
|
+
) : null, contextHolder, /* @__PURE__ */ import_react.default.createElement(import_AppointmentProductModal.default, { ref: appointmentProductRef }));
|
|
883
904
|
};
|
|
884
905
|
var footer_default = Footer;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/booking/components/footer/utils.ts
|
|
@@ -24,9 +34,13 @@ __export(utils_exports, {
|
|
|
24
34
|
formatValues: () => formatValues
|
|
25
35
|
});
|
|
26
36
|
module.exports = __toCommonJS(utils_exports);
|
|
37
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
27
38
|
var import_utils = require("../../utils");
|
|
28
39
|
var import_utils2 = require("../../utils");
|
|
29
40
|
var import_utilsByBooking = require("../../info2/utilsByBooking");
|
|
41
|
+
var import_utils3 = require("../../utils");
|
|
42
|
+
var import_status = require("../../info/service2/status");
|
|
43
|
+
var import_utils4 = require("../../info/service2/utils");
|
|
30
44
|
var formatNote = (data) => {
|
|
31
45
|
var _a;
|
|
32
46
|
return ((_a = data.notes) == null ? void 0 : _a.orderNote) || "";
|
|
@@ -77,7 +91,7 @@ var formatProductBundle = (bundle) => {
|
|
|
77
91
|
var getSubType = (item) => {
|
|
78
92
|
var _a;
|
|
79
93
|
const _type = (_a = item.duration) == null ? void 0 : _a.type;
|
|
80
|
-
if (_type
|
|
94
|
+
if (_type) {
|
|
81
95
|
return _type;
|
|
82
96
|
}
|
|
83
97
|
return "minutes";
|
|
@@ -113,39 +127,128 @@ var formatResource = (service) => {
|
|
|
113
127
|
return void 0;
|
|
114
128
|
}
|
|
115
129
|
};
|
|
116
|
-
var
|
|
130
|
+
var formatHolders = (state, item, values) => {
|
|
131
|
+
var _a, _b, _c, _d, _e;
|
|
132
|
+
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;
|
|
133
|
+
let obj = {
|
|
134
|
+
customer_id: values.customer_id,
|
|
135
|
+
form_id,
|
|
136
|
+
form_record: [((_e = item._extend) == null ? void 0 : _e.holder_id) || 0]
|
|
137
|
+
};
|
|
138
|
+
if (state.isFranchisee) {
|
|
139
|
+
obj.is_source_shop = 1;
|
|
140
|
+
}
|
|
141
|
+
return obj;
|
|
142
|
+
};
|
|
143
|
+
var formatProductPrice = (item) => {
|
|
144
|
+
var _a, _b, _c;
|
|
145
|
+
const other = (_a = item._extend) == null ? void 0 : _a.other;
|
|
146
|
+
let price = Number((_b = item._extend) == null ? void 0 : _b.price);
|
|
147
|
+
if (other == null ? void 0 : other.option) {
|
|
148
|
+
price = (_c = other == null ? void 0 : other.option) == null ? void 0 : _c.reduce((pre, cur) => {
|
|
149
|
+
return pre + Number(cur.price) * Number(cur.num);
|
|
150
|
+
}, price);
|
|
151
|
+
}
|
|
152
|
+
return price;
|
|
153
|
+
};
|
|
154
|
+
var formatProducts = (item) => {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f;
|
|
156
|
+
const total = Number(item._extend.total);
|
|
157
|
+
const origin_total = Number(item._extend.origin_total);
|
|
158
|
+
const discount_amount = origin_total - total;
|
|
159
|
+
const discount_type = discount_amount < 0 ? "change_price" : "discount";
|
|
160
|
+
return {
|
|
161
|
+
"num": item._extend.quantity,
|
|
162
|
+
"price": formatProductPrice(item),
|
|
163
|
+
"product_id": (item == null ? void 0 : item.product_id) || item.id,
|
|
164
|
+
"discount_amount": discount_amount,
|
|
165
|
+
"product_discount_reason": item._extend.discount_reason || "",
|
|
166
|
+
"is_charge_tax": item.is_charge_tax,
|
|
167
|
+
"note": (item == null ? void 0 : item.note) || "",
|
|
168
|
+
"discountway": item._extend.discountway || "num",
|
|
169
|
+
"discount_per": item._extend.discount_per,
|
|
170
|
+
"discount_type": item._extend.discount_type || discount_type,
|
|
171
|
+
"order_detail_id": item._extend.order_detail_id || 0,
|
|
172
|
+
"product_bundle": formatProductBundle((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle),
|
|
173
|
+
"bundle_edit": item._extend.bundle_edit,
|
|
174
|
+
"product_option_item": formatProductOption((_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.option),
|
|
175
|
+
"product_variant_id": ((_f = (_e = item._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.product_variant_id) || 0
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
var formatDayRelationProducts = (data, booking_item) => {
|
|
117
179
|
const list = data.service.value;
|
|
180
|
+
let relation_products = list == null ? void 0 : list.filter((item) => {
|
|
181
|
+
var _a;
|
|
182
|
+
const holderId = (_a = item._extend) == null ? void 0 : _a.holder_id;
|
|
183
|
+
const bookingHolderId = booking_item._extend.holder_id;
|
|
184
|
+
const isAppointment = import_status.appointmentTypes.includes(item.extension_type);
|
|
185
|
+
return holderId && holderId === bookingHolderId && !isAppointment;
|
|
186
|
+
});
|
|
187
|
+
relation_products = relation_products.map((item) => {
|
|
188
|
+
return formatProducts(item);
|
|
189
|
+
});
|
|
190
|
+
return relation_products || [];
|
|
191
|
+
};
|
|
192
|
+
var formatAppointmentProductLists = (data) => {
|
|
193
|
+
var _a;
|
|
194
|
+
try {
|
|
195
|
+
let list = data.service.value;
|
|
196
|
+
list = list.filter((item) => {
|
|
197
|
+
var _a2;
|
|
198
|
+
return ((_a2 = item._extend) == null ? void 0 : _a2.holder_id) && import_status.appointmentTypes.includes(item.extension_type);
|
|
199
|
+
});
|
|
200
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
201
|
+
list.forEach((item) => {
|
|
202
|
+
var _a2;
|
|
203
|
+
const key = (_a2 = item._extend) == null ? void 0 : _a2.holder_id;
|
|
204
|
+
if (!groupMap.has(key)) {
|
|
205
|
+
groupMap.set(key, []);
|
|
206
|
+
}
|
|
207
|
+
groupMap.get(key).push(item);
|
|
208
|
+
});
|
|
209
|
+
groupMap.forEach((group) => {
|
|
210
|
+
group[0].relation_products = formatDayRelationProducts(data, group[0]);
|
|
211
|
+
});
|
|
212
|
+
const result = (_a = Array.from(groupMap.values())) == null ? void 0 : _a.reduce((acc, group) => acc.concat(group), []);
|
|
213
|
+
return result || [];
|
|
214
|
+
} catch (error) {
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var formatBookings = (data, values) => {
|
|
218
|
+
const isDay = (0, import_utils4.isDayBooking)(data);
|
|
219
|
+
let list = data.service.value;
|
|
220
|
+
if (isDay) {
|
|
221
|
+
list = formatAppointmentProductLists(data);
|
|
222
|
+
}
|
|
223
|
+
let dayParams = {
|
|
224
|
+
relation_products: []
|
|
225
|
+
};
|
|
118
226
|
const eventOtherParams = data.eventOtherParams;
|
|
119
227
|
let bookings = [];
|
|
228
|
+
console.log(list, "wh_result11");
|
|
120
229
|
bookings = list.map((item) => {
|
|
121
|
-
var _a, _b;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
230
|
+
var _a, _b, _c, _d;
|
|
231
|
+
let start_date = item._extend.startDate.format("YYYY-MM-DD");
|
|
232
|
+
let end_date = item._extend.endDate.format("YYYY-MM-DD");
|
|
233
|
+
let end_time = item._extend.endDate.format("HH:mm");
|
|
125
234
|
let start_time = item._extend.startDate.format("HH:mm");
|
|
126
235
|
if ((0, import_utils.isNowTime)(item._extend.start_time)) {
|
|
127
236
|
start_time = (0, import_utils.getNowTime)();
|
|
128
237
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
238
|
+
if (isDay) {
|
|
239
|
+
const startDate = ((_a = item._extend) == null ? void 0 : _a.startDate) || ((_b = item._extend) == null ? void 0 : _b.start_date);
|
|
240
|
+
const endDate = ((_c = item._extend) == null ? void 0 : _c.endDate) || ((_d = item._extend) == null ? void 0 : _d.end_date);
|
|
241
|
+
const { startDateTime, endDateTime } = (0, import_utils4.formatDayTime)({ startDate, endDate });
|
|
242
|
+
start_date = (0, import_dayjs.default)(startDateTime).format("YYYY-MM-DD");
|
|
243
|
+
start_time = (0, import_dayjs.default)(startDateTime).format("HH:mm");
|
|
244
|
+
end_date = (0, import_dayjs.default)(endDateTime).format("YYYY-MM-DD");
|
|
245
|
+
end_time = (0, import_dayjs.default)(endDateTime).format("HH:mm");
|
|
246
|
+
dayParams.relation_products = (item == null ? void 0 : item.relation_products) || [];
|
|
247
|
+
dayParams.holder = formatHolders(data, item, values);
|
|
248
|
+
dayParams.duration = (0, import_utils3.getDays)({ _extend: { start_date: startDateTime, end_date: endDateTime } }, "minutes");
|
|
249
|
+
}
|
|
133
250
|
return {
|
|
134
|
-
"product":
|
|
135
|
-
"num": item._extend.quantity,
|
|
136
|
-
"price": item._extend.price,
|
|
137
|
-
"product_id": item.id,
|
|
138
|
-
"discount_amount": discount_amount,
|
|
139
|
-
"product_discount_reason": item._extend.discount_reason || "",
|
|
140
|
-
"is_charge_tax": item.is_charge_tax,
|
|
141
|
-
"note": "",
|
|
142
|
-
"discountway": item._extend.discountway || "num",
|
|
143
|
-
"discount_per": item._extend.discount_per,
|
|
144
|
-
"discount_type": item._extend.discount_type || discount_type,
|
|
145
|
-
"order_detail_id": item._extend.order_detail_id || 0,
|
|
146
|
-
"product_bundle": formatProductBundle((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle),
|
|
147
|
-
"bundle_edit": item._extend.bundle_edit
|
|
148
|
-
},
|
|
251
|
+
"product": formatProducts(item),
|
|
149
252
|
"relation_products": formatRelationDetails(item._extend.relation_details),
|
|
150
253
|
"id": item.booking_id || 0,
|
|
151
254
|
"relation_id": item._extend.relation_id || 0,
|
|
@@ -154,22 +257,36 @@ var formatBookings = (data) => {
|
|
|
154
257
|
"is_all": false,
|
|
155
258
|
"schedule_id": item._extend.schedule_id || 0,
|
|
156
259
|
"end_time": end_time,
|
|
157
|
-
"sub_type": getSubType(item),
|
|
260
|
+
"sub_type": isDay ? "days" : getSubType(item),
|
|
158
261
|
"select_date": start_date,
|
|
159
262
|
"start_time": start_time,
|
|
160
263
|
"end_date": end_date,
|
|
161
264
|
"start_date": start_date,
|
|
162
|
-
"duration": import_utils.flexibleObj.getValue(item._extend.duration),
|
|
265
|
+
"duration": isDay ? 0 : import_utils.flexibleObj.getValue(item._extend.duration),
|
|
163
266
|
"number": item._extend.capacity ? (0, import_utilsByBooking.getSumCapacity)({ cacheItem: item }) : item._extend.number || 1,
|
|
164
267
|
"resources": formatResource(item),
|
|
165
268
|
"metadata": item._extend.capacity ? {
|
|
166
269
|
capacity: item._extend.capacity
|
|
167
270
|
} : void 0,
|
|
168
|
-
...eventOtherParams || {}
|
|
271
|
+
...eventOtherParams || {},
|
|
272
|
+
...dayParams
|
|
169
273
|
};
|
|
170
274
|
});
|
|
171
275
|
return bookings;
|
|
172
276
|
};
|
|
277
|
+
var formatRelationProducts = (data) => {
|
|
278
|
+
var _a;
|
|
279
|
+
let list = ((_a = data.service) == null ? void 0 : _a.value) || [];
|
|
280
|
+
list = list.filter((item) => {
|
|
281
|
+
var _a2;
|
|
282
|
+
return !((_a2 = item._extend) == null ? void 0 : _a2.holder_id);
|
|
283
|
+
});
|
|
284
|
+
let relationProducts = [];
|
|
285
|
+
relationProducts = list.map((item) => {
|
|
286
|
+
return formatProducts(item);
|
|
287
|
+
});
|
|
288
|
+
return relationProducts;
|
|
289
|
+
};
|
|
173
290
|
var formatHolder = (state, values) => {
|
|
174
291
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
175
292
|
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;
|
|
@@ -196,9 +313,12 @@ var formatValues = (state) => {
|
|
|
196
313
|
bookings: [],
|
|
197
314
|
customer_id: 1,
|
|
198
315
|
customer_name: "",
|
|
199
|
-
holder: {}
|
|
316
|
+
holder: {},
|
|
317
|
+
relation_products: [],
|
|
318
|
+
metadata: {}
|
|
200
319
|
};
|
|
201
|
-
|
|
320
|
+
const isDay = (0, import_utils4.isDayBooking)(state);
|
|
321
|
+
if (!state.bookingId || isDay) {
|
|
202
322
|
values.shop_note = formatNote(state);
|
|
203
323
|
}
|
|
204
324
|
if (state.bookingId) {
|
|
@@ -214,12 +334,18 @@ var formatValues = (state) => {
|
|
|
214
334
|
...customer
|
|
215
335
|
};
|
|
216
336
|
values.holder = formatHolder(state, values);
|
|
217
|
-
|
|
337
|
+
if (isDay) {
|
|
338
|
+
values.relation_products = formatRelationProducts(state);
|
|
339
|
+
}
|
|
340
|
+
values.bookings = formatBookings(state, values);
|
|
218
341
|
if (((_c = (_b = values == null ? void 0 : values.bookings) == null ? void 0 : _b[0]) == null ? void 0 : _c.select_date) && !(state == null ? void 0 : state.bookingId)) {
|
|
219
342
|
let startTime = `${(_e = (_d = values == null ? void 0 : values.bookings) == null ? void 0 : _d[0]) == null ? void 0 : _e.start_time}`;
|
|
220
343
|
startTime = `${startTime || "00:00"}:00`;
|
|
221
344
|
values.schedule_date = `${values.bookings[0].select_date} ${startTime}`;
|
|
222
345
|
}
|
|
346
|
+
if (isDay) {
|
|
347
|
+
values.metadata.is_multiday_appointment = 1;
|
|
348
|
+
}
|
|
223
349
|
return values;
|
|
224
350
|
};
|
|
225
351
|
// Annotate the CommonJS export names for ESM import in node:
|