@pisell/private-materials 3.0.16 → 3.0.17
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 +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/addons/index.d.ts +1 -1
- package/es/components/booking/addons/index.js +148 -32
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/components/TabProduct/selectProductItem/index.js +21 -8
- package/es/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
- package/es/components/booking/components/collapsibleList/index.d.ts +11 -0
- package/es/components/booking/components/collapsibleList/index.js +99 -0
- package/es/components/booking/components/collapsibleList/index.less +61 -0
- package/es/components/booking/components/collapsibleList/utils.d.ts +2 -0
- package/es/components/booking/components/collapsibleList/utils.js +21 -0
- package/es/components/booking/components/footer/amount.js +9 -10
- package/es/components/booking/components/footer/utils.d.ts +18 -0
- package/es/components/booking/components/footer/utils.js +76 -4
- package/es/components/booking/forms/forms.d.ts +1 -1
- package/es/components/booking/forms/index.d.ts +1 -1
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/forms/single/index.js +16 -82
- package/es/components/booking/index.d.ts +1 -1
- package/es/components/booking/info/index.d.ts +1 -1
- package/es/components/booking/info/model.d.ts +1 -2
- package/es/components/booking/info/service/addService/index.js +47 -24
- package/es/components/booking/info/service/editService/index.js +49 -24
- package/es/components/booking/info/service/editService/index.less +21 -0
- package/es/components/booking/info/service/index.d.ts +2 -2
- package/es/components/booking/info/service/index.js +5 -129
- package/es/components/booking/info/service/index.less +0 -100
- package/es/components/booking/info/service/serviceItem/index.d.ts +4 -0
- package/es/components/booking/info/service/serviceItem/index.js +63 -0
- package/es/components/booking/info/service/serviceItem/index.less +97 -0
- package/es/components/booking/info/service/serviceList/index.d.ts +4 -0
- package/es/components/booking/info/service/serviceList/index.js +105 -0
- package/es/components/booking/info/service/serviceList/index.less +0 -0
- package/es/components/booking/model.d.ts +1 -2
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/booking/utils.d.ts +1 -0
- package/es/components/booking/utils.js +15 -0
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/lib/components/booking/addons/index.d.ts +1 -1
- package/lib/components/booking/addons/index.js +159 -35
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/components/TabProduct/selectProductItem/index.js +33 -8
- package/lib/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
- package/lib/components/booking/components/collapsibleList/index.d.ts +11 -0
- package/lib/components/booking/components/collapsibleList/index.js +94 -0
- package/lib/components/booking/components/collapsibleList/index.less +61 -0
- package/lib/components/booking/components/collapsibleList/utils.d.ts +2 -0
- package/lib/components/booking/components/collapsibleList/utils.js +46 -0
- package/lib/components/booking/components/footer/amount.js +9 -10
- package/lib/components/booking/components/footer/utils.d.ts +18 -0
- package/lib/components/booking/components/footer/utils.js +46 -7
- package/lib/components/booking/forms/forms.d.ts +1 -1
- package/lib/components/booking/forms/index.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/forms/single/index.js +12 -48
- package/lib/components/booking/index.d.ts +1 -1
- package/lib/components/booking/info/index.d.ts +1 -1
- package/lib/components/booking/info/model.d.ts +1 -2
- package/lib/components/booking/info/service/addService/index.js +57 -36
- package/lib/components/booking/info/service/editService/index.js +76 -56
- package/lib/components/booking/info/service/editService/index.less +21 -0
- package/lib/components/booking/info/service/index.d.ts +2 -2
- package/lib/components/booking/info/service/index.js +4 -112
- package/lib/components/booking/info/service/index.less +0 -100
- package/lib/components/booking/info/service/serviceItem/index.d.ts +4 -0
- package/lib/components/booking/info/service/serviceItem/index.js +98 -0
- package/lib/components/booking/info/service/serviceItem/index.less +97 -0
- package/lib/components/booking/info/service/serviceList/index.d.ts +4 -0
- package/lib/components/booking/info/service/serviceList/index.js +129 -0
- package/lib/components/booking/info/service/serviceList/index.less +0 -0
- package/lib/components/booking/model.d.ts +1 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/booking/utils.d.ts +1 -0
- package/lib/components/booking/utils.js +15 -0
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/package.json +1 -1
|
@@ -1 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title: 套餐单规格信息
|
|
3
|
+
* @description:
|
|
4
|
+
* @param {any} option
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
* @Date: 2024-02-19 09:26
|
|
8
|
+
*/
|
|
9
|
+
export declare const formatProductOption: (option: any) => any;
|
|
10
|
+
/**
|
|
11
|
+
* @title: 套餐信息
|
|
12
|
+
* @description:
|
|
13
|
+
* @param {any} bundle
|
|
14
|
+
* @return {*}
|
|
15
|
+
* @Author: zhiwei.Wang
|
|
16
|
+
* @Date: 2024-02-19 09:26
|
|
17
|
+
*/
|
|
18
|
+
export declare const formatProductBundle: (bundle: any) => any;
|
|
1
19
|
export declare const formatValues: (state: any) => any;
|
|
@@ -24,28 +24,90 @@ var formatCustomer = function formatCustomer(data) {
|
|
|
24
24
|
country_calling_code: (_data$client6 = data.client) === null || _data$client6 === void 0 ? void 0 : (_data$client6$value = _data$client6.value) === null || _data$client6$value === void 0 ? void 0 : _data$client6$value.country_calling_code
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @title: 套餐单规格信息
|
|
30
|
+
* @description:
|
|
31
|
+
* @param {any} option
|
|
32
|
+
* @return {*}
|
|
33
|
+
* @Author: zhiwei.Wang
|
|
34
|
+
* @Date: 2024-02-19 09:26
|
|
35
|
+
*/
|
|
36
|
+
export var formatProductOption = function formatProductOption(option) {
|
|
37
|
+
if (!option) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
return option.map(function (d) {
|
|
41
|
+
return {
|
|
42
|
+
"num": d.num,
|
|
43
|
+
"option_group_item_id": d.product_option_item_id,
|
|
44
|
+
"option_group_id": d.option_group_id
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @title: 套餐信息
|
|
51
|
+
* @description:
|
|
52
|
+
* @param {any} bundle
|
|
53
|
+
* @return {*}
|
|
54
|
+
* @Author: zhiwei.Wang
|
|
55
|
+
* @Date: 2024-02-19 09:26
|
|
56
|
+
*/
|
|
57
|
+
export var formatProductBundle = function formatProductBundle(bundle) {
|
|
58
|
+
if (!bundle) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
return bundle.map(function (d) {
|
|
62
|
+
return {
|
|
63
|
+
"bundle_group_id": d.group_id,
|
|
64
|
+
"bundle_id": d.id,
|
|
65
|
+
"bundle_product_id": d._bundle_product_id,
|
|
66
|
+
"bundle_variant_id": d.bundle_variant_id,
|
|
67
|
+
"num": d.num,
|
|
68
|
+
"extension_id": d.extension_id,
|
|
69
|
+
"extension_type": d.extension_type,
|
|
70
|
+
"option": formatProductOption(d.option)
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @title: 预约商品信息
|
|
77
|
+
* @description:
|
|
78
|
+
* @param {any} data
|
|
79
|
+
* @return {*}
|
|
80
|
+
* @Author: zhiwei.Wang
|
|
81
|
+
* @Date: 2024-02-19 09:26
|
|
82
|
+
*/
|
|
27
83
|
var formatBookings = function formatBookings(data) {
|
|
28
84
|
var list = data.service.value;
|
|
29
85
|
var eventOtherParams = data.eventOtherParams;
|
|
30
86
|
var bookings = [];
|
|
31
87
|
bookings = list.map(function (item) {
|
|
88
|
+
var _item$_extend, _item$_extend$other;
|
|
32
89
|
var start_date = item._extend.startDate.format('YYYY-MM-DD');
|
|
33
|
-
var start_time = item._extend.startDate.format("HH:mm");
|
|
34
90
|
var end_date = item._extend.endDate.format('YYYY-MM-DD');
|
|
35
91
|
var end_time = item._extend.endDate.format("HH:mm");
|
|
92
|
+
var start_time = item._extend.startDate.format("HH:mm");
|
|
93
|
+
var total = Number(item._extend.total);
|
|
94
|
+
var origin_total = Number(item._extend.origin_total);
|
|
95
|
+
var discount_amount = origin_total - total;
|
|
36
96
|
return _objectSpread({
|
|
37
97
|
"product": {
|
|
38
98
|
"num": item._extend.quantity,
|
|
39
|
-
"price": item.price,
|
|
99
|
+
"price": item._extend.price,
|
|
40
100
|
"product_id": item.id,
|
|
41
|
-
"discount_amount":
|
|
101
|
+
"discount_amount": discount_amount,
|
|
42
102
|
"product_discount_reason": item._extend.discount_reason || '',
|
|
43
103
|
"is_charge_tax": item.is_charge_tax,
|
|
44
104
|
"note": "",
|
|
45
105
|
"discountway": item._extend.discountway || "num",
|
|
46
106
|
"discount_per": item._extend.discount_per,
|
|
47
107
|
"discount_type": item._extend.discount_type || "discount",
|
|
48
|
-
"order_detail_id": item._extend.order_detail_id || 0
|
|
108
|
+
"order_detail_id": item._extend.order_detail_id || 0,
|
|
109
|
+
"product_bundle": formatProductBundle((_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : (_item$_extend$other = _item$_extend.other) === null || _item$_extend$other === void 0 ? void 0 : _item$_extend$other.bundle),
|
|
110
|
+
"bundle_edit": item._extend.bundle_edit
|
|
49
111
|
},
|
|
50
112
|
'id': item.booking_id || 0,
|
|
51
113
|
"relation_id": item._extend.relation_id,
|
|
@@ -65,6 +127,16 @@ var formatBookings = function formatBookings(data) {
|
|
|
65
127
|
});
|
|
66
128
|
return bookings;
|
|
67
129
|
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @title: 预约主体信息
|
|
133
|
+
* @description:
|
|
134
|
+
* @param {any} data
|
|
135
|
+
* @param {any} values
|
|
136
|
+
* @return {*}
|
|
137
|
+
* @Author: zhiwei.Wang
|
|
138
|
+
* @Date: 2024-02-19 09:26
|
|
139
|
+
*/
|
|
68
140
|
var formatHolder = function formatHolder(data, values) {
|
|
69
141
|
var _data$bookingConfig, _data$bookingConfig$c, _data$bookingConfig$c2, _data$bookingConfig$c3, _data$pet$value, _data$pet, _data$pet$originValue, _data$pet$originValue2;
|
|
70
142
|
var form_id = (data === null || data === void 0 ? void 0 : (_data$bookingConfig = data.bookingConfig) === null || _data$bookingConfig === void 0 ? void 0 : (_data$bookingConfig$c = _data$bookingConfig.config) === null || _data$bookingConfig$c === void 0 ? void 0 : (_data$bookingConfig$c2 = _data$bookingConfig$c.basic) === null || _data$bookingConfig$c2 === void 0 ? void 0 : (_data$bookingConfig$c3 = _data$bookingConfig$c2.appointment_subject) === null || _data$bookingConfig$c3 === void 0 ? void 0 : _data$bookingConfig$c3.form_id) || 0;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -5,19 +5,13 @@ 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
|
-
|
|
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; }
|
|
14
|
-
import React, { useCallback, useState, useMemo } from "react";
|
|
8
|
+
import React, { useCallback, useMemo } from "react";
|
|
15
9
|
import FileDownload02 from "@pisell/icon/es/FileDownload02";
|
|
16
10
|
import { image, locales } from "@pisell/utils";
|
|
17
11
|
import { Avatar } from "antd";
|
|
18
12
|
import CustomSelect from "../../components/customSelect";
|
|
13
|
+
import CollapsibleList from "../../components/collapsibleList";
|
|
19
14
|
import "./index.less";
|
|
20
|
-
var MAX_LIMIT = 3;
|
|
21
15
|
|
|
22
16
|
/**
|
|
23
17
|
* @title: 表单选择器
|
|
@@ -39,10 +33,6 @@ var Single = function Single(_ref) {
|
|
|
39
33
|
addButtonProps = _ref.addButtonProps,
|
|
40
34
|
modalOpen = _ref.modalOpen,
|
|
41
35
|
watch = _ref.watch;
|
|
42
|
-
var _useState = useState({}),
|
|
43
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
maxLimit = _useState2[0],
|
|
45
|
-
setMaxLimit = _useState2[1];
|
|
46
36
|
// const primaryField = useMemo(() => {
|
|
47
37
|
// return field.field[0]?.key || "";
|
|
48
38
|
// }, [field]);
|
|
@@ -125,69 +115,20 @@ var Single = function Single(_ref) {
|
|
|
125
115
|
*/
|
|
126
116
|
var renderItem = useCallback(function (fieldData) {
|
|
127
117
|
var _fields = form.field || [];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}, field.field_column.title), /*#__PURE__*/React.createElement("div", {
|
|
141
|
-
className: "pet-form-item-value"
|
|
142
|
-
}, renderFieldValue(fieldData, field)));
|
|
118
|
+
return /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
119
|
+
list: _fields,
|
|
120
|
+
renderItem: function renderItem(field) {
|
|
121
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: "pet-form-item",
|
|
123
|
+
key: field.key
|
|
124
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: "pet-form-item-label"
|
|
126
|
+
}, field.field_column.title), /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: "pet-form-item-value"
|
|
128
|
+
}, renderFieldValue(fieldData, field)));
|
|
129
|
+
}
|
|
143
130
|
});
|
|
144
|
-
}, [form
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @title: 展开和收起
|
|
148
|
-
* @description:
|
|
149
|
-
* @param {any} d
|
|
150
|
-
* @return {*}
|
|
151
|
-
* @Author: zhiwei.Wang
|
|
152
|
-
* @Date: 2024-01-30 17:08
|
|
153
|
-
*/
|
|
154
|
-
var handlePreviewAll = function handlePreviewAll(d) {
|
|
155
|
-
var _maxLimit = maxLimit[d.form_record_id] || MAX_LIMIT;
|
|
156
|
-
if (_maxLimit === MAX_LIMIT) {
|
|
157
|
-
_maxLimit = 99;
|
|
158
|
-
} else {
|
|
159
|
-
_maxLimit = MAX_LIMIT;
|
|
160
|
-
}
|
|
161
|
-
setMaxLimit(_objectSpread(_objectSpread({}, maxLimit), {}, _defineProperty({}, d.form_record_id, _maxLimit)));
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @title: 是否展开全部
|
|
166
|
-
* @description:
|
|
167
|
-
* @param {*} useMemo
|
|
168
|
-
* @return {*}
|
|
169
|
-
* @Author: zhiwei.Wang
|
|
170
|
-
* @Date: 2024-01-30 17:08
|
|
171
|
-
*/
|
|
172
|
-
var showAll = useMemo(function () {
|
|
173
|
-
var _field = form.field || [];
|
|
174
|
-
return _field.length > MAX_LIMIT;
|
|
175
|
-
}, [maxLimit, form]);
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* @title: 展开文案
|
|
179
|
-
* @description:
|
|
180
|
-
* @return {*}
|
|
181
|
-
* @Author: zhiwei.Wang
|
|
182
|
-
* @Date: 2024-01-30 17:08
|
|
183
|
-
*/
|
|
184
|
-
var viewAllText = useCallback(function (d) {
|
|
185
|
-
var _maxLimit = maxLimit[d.form_record_id] || MAX_LIMIT;
|
|
186
|
-
if (_maxLimit === MAX_LIMIT) {
|
|
187
|
-
return locales.getText("pisell2.text.view-all");
|
|
188
|
-
}
|
|
189
|
-
return locales.getText("pisell2.text.view-less");
|
|
190
|
-
}, [maxLimit]);
|
|
131
|
+
}, [form]);
|
|
191
132
|
|
|
192
133
|
/**
|
|
193
134
|
* @title: 渲染字段
|
|
@@ -259,14 +200,7 @@ var Single = function Single(_ref) {
|
|
|
259
200
|
mode: _mode,
|
|
260
201
|
previewItemClassName: "pisell-lowcode__booking-pet-card",
|
|
261
202
|
previewItemRender: function previewItemRender(d) {
|
|
262
|
-
return
|
|
263
|
-
className: "pet-form-view-all",
|
|
264
|
-
onClick: function onClick(e) {
|
|
265
|
-
e.preventDefault();
|
|
266
|
-
e.stopPropagation();
|
|
267
|
-
handlePreviewAll(d);
|
|
268
|
-
}
|
|
269
|
-
}, viewAllText(d)) : null);
|
|
203
|
+
return renderItem(d);
|
|
270
204
|
},
|
|
271
205
|
name: ((_form$form3 = form.form) === null || _form$form3 === void 0 ? void 0 : _form$form3.title) || "-",
|
|
272
206
|
addButtonProps: _addButtonProps,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const Booking: (props: any) =>
|
|
1
|
+
declare const Booking: (props: any) => JSX.Element;
|
|
2
2
|
export default Booking;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
2
|
export declare const walkInData: {
|
|
4
3
|
id: number;
|
|
5
4
|
nickname: string;
|
|
6
5
|
};
|
|
7
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
6
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
8
7
|
state: FormState;
|
|
9
8
|
} & {
|
|
10
9
|
dispatch: (params: {
|
|
@@ -25,11 +25,11 @@ import { Context } from "../../model";
|
|
|
25
25
|
import AddButton from "../../../components/addButton";
|
|
26
26
|
import { Input } from "antd";
|
|
27
27
|
import "./index.less";
|
|
28
|
-
import { formatProductListByCategory, request } from "../../../utils";
|
|
29
|
-
import { locales, getUniqueId } from "@pisell/utils";
|
|
30
28
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
31
29
|
import { getProductDetail } from "../serve";
|
|
32
30
|
import { getIsBundleOrCombination } from "../../utils";
|
|
31
|
+
import { formatProductListByCategory, getProductTotalPrice, request } from "../../../utils";
|
|
32
|
+
import { locales, getUniqueId } from "@pisell/utils";
|
|
33
33
|
var Info = function Info() {
|
|
34
34
|
var _state$service2;
|
|
35
35
|
var _useState = useState(""),
|
|
@@ -140,7 +140,7 @@ var Info = function Info() {
|
|
|
140
140
|
// include_variant: "no",
|
|
141
141
|
ids: state.renderType === "eventBooking" ? (_state$eventOtherPara = state.eventOtherParams) === null || _state$eventOtherPara === void 0 ? void 0 : _state$eventOtherPara.productIds : undefined,
|
|
142
142
|
open_quotation: 1,
|
|
143
|
-
with_schedule:
|
|
143
|
+
with_schedule: 1
|
|
144
144
|
});
|
|
145
145
|
case 2:
|
|
146
146
|
data = _context2.sent;
|
|
@@ -171,28 +171,51 @@ var Info = function Info() {
|
|
|
171
171
|
});
|
|
172
172
|
};
|
|
173
173
|
var handleSelectProduct = function handleSelectProduct(item) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
state.action({
|
|
175
|
+
type: "pisell1.handleOpenProductModal",
|
|
176
|
+
data: {
|
|
177
|
+
id: item.id,
|
|
178
|
+
date: state.date.value.format("YYYY-MM-DD"),
|
|
179
|
+
showConfig: {
|
|
180
|
+
option: false,
|
|
181
|
+
session: false,
|
|
182
|
+
variant: false,
|
|
183
|
+
package: true
|
|
184
|
+
}
|
|
183
185
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
186
|
+
callback: function callback(e) {
|
|
187
|
+
var cacheItem = _objectSpread(_objectSpread({}, item), {}, {
|
|
188
|
+
product_id: item.id,
|
|
189
|
+
_id: getUniqueId(),
|
|
190
|
+
_key: e.key,
|
|
191
|
+
_extend: {
|
|
192
|
+
start_date: state.date.value,
|
|
193
|
+
quantity: 1,
|
|
194
|
+
price: item.price,
|
|
195
|
+
product_name: item.title,
|
|
196
|
+
other: e
|
|
197
|
+
},
|
|
198
|
+
new: 1
|
|
199
|
+
});
|
|
200
|
+
var _total = getProductTotalPrice(cacheItem);
|
|
201
|
+
console.log("_total", e);
|
|
202
|
+
// 用于折扣 可修改
|
|
203
|
+
cacheItem._extend.total = _total;
|
|
204
|
+
// 用于储存原价
|
|
205
|
+
cacheItem._extend.origin_total = _total;
|
|
206
|
+
var _isEdit = !!state.service.cacheItem;
|
|
207
|
+
if (_isEdit) {
|
|
208
|
+
var _state$service$cacheI;
|
|
209
|
+
cacheItem._id = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI._id;
|
|
210
|
+
cacheItem.new = 0;
|
|
211
|
+
}
|
|
212
|
+
dispatch({
|
|
213
|
+
type: "setService",
|
|
214
|
+
payload: {
|
|
215
|
+
editModal: true,
|
|
216
|
+
cacheItem: cacheItem
|
|
217
|
+
}
|
|
218
|
+
});
|
|
196
219
|
}
|
|
197
220
|
});
|
|
198
221
|
};
|
|
@@ -27,17 +27,19 @@ import { formatAmount, locales } from "@pisell/utils";
|
|
|
27
27
|
import Duration from "../../../materiels/duration";
|
|
28
28
|
import { Input, Button, Select, Row, Col, Form, Alert, InputNumber } from "antd";
|
|
29
29
|
import "./index.less";
|
|
30
|
+
import CollapsibleList from "../../../components/collapsibleList";
|
|
31
|
+
import { renderBundles } from "../../../components/collapsibleList/utils";
|
|
30
32
|
import dayjs from "dayjs";
|
|
31
33
|
import { useUpdateEffect, useMemoizedFn } from "ahooks";
|
|
32
34
|
import { sliceDayIntoFiveMinutes, formatResource, getErrorList, getServiceTimes, getServerItemExtend, deleteCacheParams, getEndDate, flexibleObj, getDuration, getDiscountTime } from "../../../utils";
|
|
33
35
|
import Like from "../like";
|
|
34
36
|
import { getNoResource } from "../../../mock";
|
|
35
37
|
var Info = function Info() {
|
|
36
|
-
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service$cacheI5, _state$service$cacheI6;
|
|
38
|
+
var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service5, _state$service6, _state$service6$cache, _state$service6$cache2, _state$service$cacheI5, _state$service$cacheI6, _state$service$cacheI7, _state$service$cacheI8;
|
|
37
39
|
var _Form$useForm = Form.useForm(),
|
|
38
40
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
39
41
|
form = _Form$useForm2[0];
|
|
40
|
-
var
|
|
42
|
+
var useTotal = Form.useWatch("total", form);
|
|
41
43
|
var useLikeStatus = Form.useWatch("like_status", form);
|
|
42
44
|
var useResource = Form.useWatch("resource", form);
|
|
43
45
|
var useStartTime = Form.useWatch("start_time", form);
|
|
@@ -182,8 +184,9 @@ var Info = function Info() {
|
|
|
182
184
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
183
185
|
while (1) switch (_context.prev = _context.next) {
|
|
184
186
|
case 0:
|
|
187
|
+
_context.prev = 0;
|
|
185
188
|
setResourceLoading(true);
|
|
186
|
-
_context.next =
|
|
189
|
+
_context.next = 4;
|
|
187
190
|
return state.apis.getResources({
|
|
188
191
|
skip: 1,
|
|
189
192
|
num: 1000,
|
|
@@ -193,17 +196,17 @@ var Info = function Info() {
|
|
|
193
196
|
abort: true
|
|
194
197
|
}
|
|
195
198
|
});
|
|
196
|
-
case
|
|
199
|
+
case 4:
|
|
197
200
|
data = _context.sent;
|
|
198
201
|
// 合并无资源
|
|
199
202
|
_list = [getNoResource()].concat((data === null || data === void 0 ? void 0 : data.list) || []);
|
|
200
203
|
_cacheItem = cacheItem || getCurrentCacheItem();
|
|
201
204
|
if (_cacheItem._extend) {
|
|
202
|
-
_context.next =
|
|
205
|
+
_context.next = 9;
|
|
203
206
|
break;
|
|
204
207
|
}
|
|
205
208
|
return _context.abrupt("return");
|
|
206
|
-
case
|
|
209
|
+
case 9:
|
|
207
210
|
// 格式化, 添加自定义参数
|
|
208
211
|
_list = _list.map(function (d) {
|
|
209
212
|
return formatResource(d, _cacheItem, function (item) {
|
|
@@ -235,12 +238,18 @@ var Info = function Info() {
|
|
|
235
238
|
resources: _list
|
|
236
239
|
}
|
|
237
240
|
});
|
|
241
|
+
_context.next = 17;
|
|
242
|
+
break;
|
|
243
|
+
case 15:
|
|
244
|
+
_context.prev = 15;
|
|
245
|
+
_context.t0 = _context["catch"](0);
|
|
246
|
+
case 17:
|
|
238
247
|
setResourceLoading(false);
|
|
239
|
-
case
|
|
248
|
+
case 18:
|
|
240
249
|
case "end":
|
|
241
250
|
return _context.stop();
|
|
242
251
|
}
|
|
243
|
-
}, _callee);
|
|
252
|
+
}, _callee, null, [[0, 15]]);
|
|
244
253
|
}));
|
|
245
254
|
return function getResources(_x2) {
|
|
246
255
|
return _ref.apply(this, arguments);
|
|
@@ -342,8 +351,8 @@ var Info = function Info() {
|
|
|
342
351
|
*/
|
|
343
352
|
var getDiscount = function getDiscount() {
|
|
344
353
|
var _state$service$cacheI2;
|
|
345
|
-
var oPrice = Number(((_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2.
|
|
346
|
-
var cPrice = Number(
|
|
354
|
+
var oPrice = Number(((_state$service$cacheI2 = state.service.cacheItem) === null || _state$service$cacheI2 === void 0 ? void 0 : _state$service$cacheI2._extend.origin_total) || 0);
|
|
355
|
+
var cPrice = Number(useTotal || 0);
|
|
347
356
|
var discount = "";
|
|
348
357
|
// 原价 = 现价 为无折扣
|
|
349
358
|
if (cPrice === oPrice) {
|
|
@@ -391,6 +400,9 @@ var Info = function Info() {
|
|
|
391
400
|
_extend.relation_type = relation_type || "form";
|
|
392
401
|
_extend.relation_id = item_id || (currentResource === null || currentResource === void 0 ? void 0 : currentResource.form_record_id) || 0;
|
|
393
402
|
_extend.schedule_id = schedule_id || 0;
|
|
403
|
+
if (_extend.bundle_edit !== undefined) {
|
|
404
|
+
_extend.bundle_edit = 1;
|
|
405
|
+
}
|
|
394
406
|
_item._extend = _extend;
|
|
395
407
|
|
|
396
408
|
// 判断是新增还是编辑
|
|
@@ -439,11 +451,11 @@ var Info = function Info() {
|
|
|
439
451
|
*/
|
|
440
452
|
var isReason = useMemo(function () {
|
|
441
453
|
var _state$service$cacheI4;
|
|
442
|
-
var oPrice = Number(((_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : _state$service$cacheI4.
|
|
443
|
-
var cPrice = Number(
|
|
454
|
+
var oPrice = Number(((_state$service$cacheI4 = state.service.cacheItem) === null || _state$service$cacheI4 === void 0 ? void 0 : _state$service$cacheI4._extend.origin_total) || 0);
|
|
455
|
+
var cPrice = Number(useTotal || 0);
|
|
444
456
|
// 原价 !== 现价
|
|
445
457
|
return cPrice !== oPrice;
|
|
446
|
-
}, [
|
|
458
|
+
}, [useTotal, state.service.cacheItem]);
|
|
447
459
|
|
|
448
460
|
/**
|
|
449
461
|
* @title: 错误信息列表
|
|
@@ -501,7 +513,7 @@ var Info = function Info() {
|
|
|
501
513
|
*/
|
|
502
514
|
useEffect(function () {
|
|
503
515
|
getDiscount();
|
|
504
|
-
}, [
|
|
516
|
+
}, [useTotal, state.service.cacheItem]);
|
|
505
517
|
|
|
506
518
|
// useEffect(() => {
|
|
507
519
|
// handleLikeResource("common");
|
|
@@ -511,13 +523,17 @@ var Info = function Info() {
|
|
|
511
523
|
if (!((_state$service = state.service) !== null && _state$service !== void 0 && _state$service.cacheItem)) {
|
|
512
524
|
return false;
|
|
513
525
|
}
|
|
514
|
-
return
|
|
515
|
-
}, [
|
|
526
|
+
return useTotal != ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : (_state$service2$cache = _state$service2.cacheItem) === null || _state$service2$cache === void 0 ? void 0 : _state$service2$cache._extend.origin_total);
|
|
527
|
+
}, [useTotal, (_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._extend.origin_total]);
|
|
516
528
|
useEffect(function () {
|
|
517
529
|
if (useResource === 0) {
|
|
518
530
|
handleLikeResource("common");
|
|
519
531
|
}
|
|
520
532
|
}, [useResource]);
|
|
533
|
+
var bundles = useMemo(function () {
|
|
534
|
+
var _state$service4, _state$service4$cache, _state$service4$cache2, _state$service4$cache3;
|
|
535
|
+
return ((_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : (_state$service4$cache = _state$service4.cacheItem) === null || _state$service4$cache === void 0 ? void 0 : (_state$service4$cache2 = _state$service4$cache._extend) === null || _state$service4$cache2 === void 0 ? void 0 : (_state$service4$cache3 = _state$service4$cache2.other) === null || _state$service4$cache3 === void 0 ? void 0 : _state$service4$cache3.bundle) || [];
|
|
536
|
+
}, [(_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : _state$service5.cacheItem]);
|
|
521
537
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Drawer, {
|
|
522
538
|
zIndex: 1000,
|
|
523
539
|
open: state.service.editModal,
|
|
@@ -546,9 +562,8 @@ var Info = function Info() {
|
|
|
546
562
|
span: 24
|
|
547
563
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
548
564
|
name: "product_name"
|
|
549
|
-
}, /*#__PURE__*/React.createElement(
|
|
550
|
-
|
|
551
|
-
open: false,
|
|
565
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
566
|
+
className: "current-service-info",
|
|
552
567
|
onClick: function onClick() {
|
|
553
568
|
if (state.channelDisabledEdit) {
|
|
554
569
|
return;
|
|
@@ -561,11 +576,21 @@ var Info = function Info() {
|
|
|
561
576
|
}
|
|
562
577
|
});
|
|
563
578
|
}
|
|
564
|
-
}
|
|
579
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
580
|
+
className: "current-service-info-name"
|
|
581
|
+
}, ((_state$service6 = state.service) === null || _state$service6 === void 0 ? void 0 : (_state$service6$cache = _state$service6.cacheItem) === null || _state$service6$cache === void 0 ? void 0 : (_state$service6$cache2 = _state$service6$cache._extend) === null || _state$service6$cache2 === void 0 ? void 0 : _state$service6$cache2.product_name) || "-"), /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
582
|
+
style: {
|
|
583
|
+
marginTop: bundles.length ? "8px" : 0
|
|
584
|
+
},
|
|
585
|
+
list: bundles,
|
|
586
|
+
renderItem: function renderItem(item) {
|
|
587
|
+
return renderBundles(item, state.amountSymbol);
|
|
588
|
+
}
|
|
589
|
+
})))), /*#__PURE__*/React.createElement(Col, {
|
|
565
590
|
span: 12
|
|
566
591
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
567
592
|
label: locales.getText("pisell2.text.price"),
|
|
568
|
-
name: "
|
|
593
|
+
name: "total",
|
|
569
594
|
rules: [{
|
|
570
595
|
required: true
|
|
571
596
|
}]
|
|
@@ -578,8 +603,8 @@ var Info = function Info() {
|
|
|
578
603
|
width: "100%"
|
|
579
604
|
},
|
|
580
605
|
min: 0,
|
|
581
|
-
max: ((_state$service$cacheI5 = state.service.cacheItem) === null || _state$service$cacheI5 === void 0 ? void 0 : _state$service$cacheI5.
|
|
582
|
-
placeholder: ((_state$service$
|
|
606
|
+
max: ((_state$service$cacheI5 = state.service.cacheItem) === null || _state$service$cacheI5 === void 0 ? void 0 : (_state$service$cacheI6 = _state$service$cacheI5._extend) === null || _state$service$cacheI6 === void 0 ? void 0 : _state$service$cacheI6.origin_total) || 0,
|
|
607
|
+
placeholder: ((_state$service$cacheI7 = state.service.cacheItem) === null || _state$service$cacheI7 === void 0 ? void 0 : (_state$service$cacheI8 = _state$service$cacheI7._extend) === null || _state$service$cacheI8 === void 0 ? void 0 : _state$service$cacheI8.origin_total) || "0"
|
|
583
608
|
}))), /*#__PURE__*/React.createElement(Col, {
|
|
584
609
|
span: 12
|
|
585
610
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
@@ -592,7 +617,7 @@ var Info = function Info() {
|
|
|
592
617
|
allowClear: isDiscount,
|
|
593
618
|
onChange: function onChange(e) {
|
|
594
619
|
form.setFieldsValue({
|
|
595
|
-
|
|
620
|
+
total: state.service.cacheItem._extend.origin_total
|
|
596
621
|
});
|
|
597
622
|
}
|
|
598
623
|
}))), isReason ? /*#__PURE__*/React.createElement(Col, {
|
|
@@ -84,4 +84,25 @@
|
|
|
84
84
|
.like-resource {}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.current-service-info {
|
|
90
|
+
min-height: 40px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
background-color: #ffffff;
|
|
93
|
+
border: 1px solid #D0D5DD;
|
|
94
|
+
border-radius: 10px;
|
|
95
|
+
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
padding: 11px;
|
|
98
|
+
|
|
99
|
+
.current-service-info-name {
|
|
100
|
+
font-size: 16px;
|
|
101
|
+
color: #101828;
|
|
102
|
+
font-weight: 650;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:hover {
|
|
106
|
+
border-color: #7f56d9;
|
|
107
|
+
}
|
|
87
108
|
}
|