@pisell/private-materials 3.0.16 → 3.0.18
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.js +148 -32
- 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/single/index.js +16 -82
- 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 -97
- 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/utils.d.ts +1 -0
- package/es/components/booking/utils.js +15 -0
- package/lib/components/booking/addons/index.js +159 -35
- 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/single/index.js +12 -48
- 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 -97
- 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/utils.d.ts +1 -0
- package/lib/components/booking/utils.js +15 -0
- package/package.json +2 -2
|
@@ -35,27 +35,57 @@ import ProductItem from "../components/TabProduct/selectProductItem";
|
|
|
35
35
|
import TabProduct from "../components/TabProduct";
|
|
36
36
|
import EmptyBooking from "../components/emptyBooking";
|
|
37
37
|
import Footer from "../components/footer";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { formatProductBundle } from "../components/footer/utils";
|
|
39
|
+
import { formatProductListByCategory, getProductTotalPrice } from "../utils";
|
|
40
|
+
import { locales, getUniqueId } from "@pisell/utils";
|
|
40
41
|
import "./index.less";
|
|
41
42
|
export var formatProducts = function formatProducts(values) {
|
|
42
43
|
var arr = [];
|
|
43
44
|
arr = values.map(function (item) {
|
|
45
|
+
var _item$_extend, _item$_extend2, _item$_extend2$other;
|
|
44
46
|
return {
|
|
45
47
|
order_detail_id: item.order_detail_id || 0,
|
|
46
|
-
num: item.quantity,
|
|
47
|
-
price: item.price,
|
|
48
|
+
num: item._extend.quantity,
|
|
49
|
+
price: item._extend.price,
|
|
48
50
|
product_id: item.id,
|
|
49
51
|
discount_amount: 0,
|
|
50
52
|
product_discount_reason: "",
|
|
51
53
|
is_charge_tax: item.is_charge_tax,
|
|
52
54
|
note: "",
|
|
53
55
|
discountway: "num",
|
|
54
|
-
discount_type: "discount"
|
|
56
|
+
discount_type: "discount",
|
|
57
|
+
bundle_edit: (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.bundle_edit,
|
|
58
|
+
product_bundle: formatProductBundle((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : (_item$_extend2$other = _item$_extend2.other) === null || _item$_extend2$other === void 0 ? void 0 : _item$_extend2$other.bundle)
|
|
55
59
|
};
|
|
56
60
|
});
|
|
57
61
|
return arr;
|
|
58
62
|
};
|
|
63
|
+
var restoreProductOtherData = function restoreProductOtherData(data) {
|
|
64
|
+
var detail = data;
|
|
65
|
+
return {
|
|
66
|
+
product_id: detail.product_id,
|
|
67
|
+
option: [],
|
|
68
|
+
bundle: (detail.product_bundle || []).map(function (bundleItem) {
|
|
69
|
+
return _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
70
|
+
title: bundleItem.bundle_title,
|
|
71
|
+
group_id: bundleItem.bundle_group_id,
|
|
72
|
+
id: bundleItem.bundle_id,
|
|
73
|
+
product_id: bundleItem.bundle_product_id,
|
|
74
|
+
bundle_variant_id: bundleItem.bundle_variant_id,
|
|
75
|
+
quantity: bundleItem.num,
|
|
76
|
+
option: bundleItem.option.map(function (optionItem) {
|
|
77
|
+
return _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
78
|
+
name: optionItem.name["auto"],
|
|
79
|
+
quantity: bundleItem.num,
|
|
80
|
+
product_option_item_id: optionItem.option_group_item_id
|
|
81
|
+
});
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}),
|
|
85
|
+
product_variant_id: 0,
|
|
86
|
+
quantity: Number(detail.product_quantity)
|
|
87
|
+
};
|
|
88
|
+
};
|
|
59
89
|
|
|
60
90
|
// 格式化商品列表
|
|
61
91
|
var formatProductValues = function formatProductValues(data) {
|
|
@@ -65,7 +95,15 @@ var formatProductValues = function formatProductValues(data) {
|
|
|
65
95
|
title: d.product_title,
|
|
66
96
|
quantity: d.product_quantity,
|
|
67
97
|
cover: d.product_cover,
|
|
68
|
-
price: Number(d.
|
|
98
|
+
price: Number(d.source_product_price),
|
|
99
|
+
_extend: {
|
|
100
|
+
total: Number(d.selling_price),
|
|
101
|
+
payment_price: Number(d.payment_price),
|
|
102
|
+
price: Number(d.source_product_price),
|
|
103
|
+
quantity: d.product_quantity,
|
|
104
|
+
bundle_edit: 0,
|
|
105
|
+
other: restoreProductOtherData(d)
|
|
106
|
+
},
|
|
69
107
|
payment_price: Number(d.payment_price)
|
|
70
108
|
});
|
|
71
109
|
});
|
|
@@ -172,12 +210,12 @@ var Addons = Provider(function (props) {
|
|
|
172
210
|
return state.apis.getProducts({
|
|
173
211
|
skip: 1,
|
|
174
212
|
num: 500,
|
|
175
|
-
extension_type: ["normal"],
|
|
213
|
+
extension_type: ["normal", "product_bundle", "product_package_ticket", "ticket"],
|
|
176
214
|
with: ["category"],
|
|
177
|
-
include_formula: "no",
|
|
178
|
-
include_bundle: "no",
|
|
179
|
-
include_option: "no",
|
|
180
|
-
include_variant: "no",
|
|
215
|
+
// include_formula: "no",
|
|
216
|
+
// include_bundle: "no",
|
|
217
|
+
// include_option: "no",
|
|
218
|
+
// include_variant: "no",
|
|
181
219
|
open_quotation: 1,
|
|
182
220
|
with_schedule: 0
|
|
183
221
|
});
|
|
@@ -210,26 +248,51 @@ var Addons = Provider(function (props) {
|
|
|
210
248
|
*/
|
|
211
249
|
var handleAddProduct = function handleAddProduct(item) {
|
|
212
250
|
var _list = _toConsumableArray(state.addons.value);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
251
|
+
state.action({
|
|
252
|
+
type: "pisell1.handleOpenProductModal",
|
|
253
|
+
data: {
|
|
254
|
+
id: item.id,
|
|
255
|
+
date: state.date.value.format("YYYY-MM-DD"),
|
|
256
|
+
showConfig: {
|
|
257
|
+
option: false,
|
|
258
|
+
session: false,
|
|
259
|
+
variant: false,
|
|
260
|
+
package: true
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
callback: function callback(e) {
|
|
264
|
+
var product = _objectSpread(_objectSpread({}, item), {}, {
|
|
265
|
+
_id: getUniqueId(),
|
|
266
|
+
_key: e.key,
|
|
267
|
+
_extend: {
|
|
268
|
+
price: item.price,
|
|
269
|
+
other: e,
|
|
270
|
+
quantity: 1
|
|
271
|
+
},
|
|
272
|
+
quantity: 1
|
|
273
|
+
});
|
|
274
|
+
var _total = getProductTotalPrice(product);
|
|
275
|
+
product._extend.total = _total;
|
|
276
|
+
var _item = _list.find(function (d) {
|
|
277
|
+
return d._extend.other.key === e.key;
|
|
278
|
+
});
|
|
216
279
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
280
|
+
// 如果已添加, 则数量+1
|
|
281
|
+
if (_item) {
|
|
282
|
+
_item._extend.quantity = _item.quantity + 1;
|
|
283
|
+
} else {
|
|
284
|
+
// 否则 push
|
|
285
|
+
_list.push(product);
|
|
286
|
+
}
|
|
287
|
+
dispatch({
|
|
288
|
+
type: "setAddons",
|
|
289
|
+
payload: {
|
|
290
|
+
value: _list,
|
|
291
|
+
showModal: false,
|
|
292
|
+
// 编辑态
|
|
293
|
+
edit: true
|
|
294
|
+
}
|
|
295
|
+
});
|
|
233
296
|
}
|
|
234
297
|
});
|
|
235
298
|
};
|
|
@@ -252,9 +315,17 @@ var Addons = Provider(function (props) {
|
|
|
252
315
|
return d.id !== item.id;
|
|
253
316
|
});
|
|
254
317
|
} else {
|
|
318
|
+
var _item$_extend3;
|
|
255
319
|
var _item = _objectSpread(_objectSpread({}, item), {}, {
|
|
256
|
-
|
|
320
|
+
_extend: _objectSpread(_objectSpread({}, item._extend), {}, {
|
|
321
|
+
quantity: Number(e.target.value)
|
|
322
|
+
})
|
|
257
323
|
});
|
|
324
|
+
var _total = getProductTotalPrice(_item);
|
|
325
|
+
_item._extend.total = _total;
|
|
326
|
+
if (((_item$_extend3 = _item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.bundle_edit) !== undefined) {
|
|
327
|
+
_item._extend.bundle_edit = 1;
|
|
328
|
+
}
|
|
258
329
|
_list = _list.map(function (d) {
|
|
259
330
|
return d.id === item.id ? _item : d;
|
|
260
331
|
});
|
|
@@ -347,6 +418,50 @@ var Addons = Provider(function (props) {
|
|
|
347
418
|
source: "addons"
|
|
348
419
|
});
|
|
349
420
|
}, [state, _footer]);
|
|
421
|
+
var editProductDetail = function editProductDetail(item) {
|
|
422
|
+
console.log("item._extend.other", item._extend.other);
|
|
423
|
+
state.action({
|
|
424
|
+
type: "pisell1.handleOpenProductModal",
|
|
425
|
+
data: {
|
|
426
|
+
id: item.id,
|
|
427
|
+
date: state.date.value.format("YYYY-MM-DD"),
|
|
428
|
+
showConfig: {
|
|
429
|
+
option: false,
|
|
430
|
+
session: false,
|
|
431
|
+
variant: false,
|
|
432
|
+
package: true
|
|
433
|
+
},
|
|
434
|
+
value: item._extend.other
|
|
435
|
+
},
|
|
436
|
+
callback: function callback(e) {
|
|
437
|
+
var _product$_extend;
|
|
438
|
+
var product = _objectSpread(_objectSpread({}, item), {}, {
|
|
439
|
+
_extend: _objectSpread(_objectSpread({}, item._extend), {}, {
|
|
440
|
+
other: e
|
|
441
|
+
})
|
|
442
|
+
});
|
|
443
|
+
if (((_product$_extend = product._extend) === null || _product$_extend === void 0 ? void 0 : _product$_extend.bundle_edit) !== undefined) {
|
|
444
|
+
product._extend.bundle_edit = 1;
|
|
445
|
+
}
|
|
446
|
+
var _total = getProductTotalPrice(product);
|
|
447
|
+
product._extend.total = _total;
|
|
448
|
+
var _list = _toConsumableArray(state.addons.value);
|
|
449
|
+
console.log("cacheItem", product);
|
|
450
|
+
_list = _list.map(function (d) {
|
|
451
|
+
return d._id === product._id ? product : d;
|
|
452
|
+
});
|
|
453
|
+
dispatch({
|
|
454
|
+
type: "setAddons",
|
|
455
|
+
payload: {
|
|
456
|
+
value: _list,
|
|
457
|
+
showModal: false,
|
|
458
|
+
// 编辑态
|
|
459
|
+
edit: true
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
};
|
|
350
465
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TabPane, {
|
|
351
466
|
loading: loading,
|
|
352
467
|
header: locales.getText("pisell2.text.addons"),
|
|
@@ -354,7 +469,7 @@ var Addons = Provider(function (props) {
|
|
|
354
469
|
}, !state.bookingId ? /*#__PURE__*/React.createElement(EmptyBooking, null) : /*#__PURE__*/React.createElement(React.Fragment, null, state.addons.value.length ? /*#__PURE__*/React.createElement("div", {
|
|
355
470
|
className: "",
|
|
356
471
|
style: {
|
|
357
|
-
margin: "0 -
|
|
472
|
+
margin: "0 -32px"
|
|
358
473
|
}
|
|
359
474
|
}, state.addons.value.map(function (d) {
|
|
360
475
|
return /*#__PURE__*/React.createElement(ProductItem, {
|
|
@@ -362,6 +477,7 @@ var Addons = Provider(function (props) {
|
|
|
362
477
|
item: d,
|
|
363
478
|
key: d.id,
|
|
364
479
|
amountSymbol: state.amountSymbol,
|
|
480
|
+
onClick: editProductDetail,
|
|
365
481
|
onChangeQuantity: function onChangeQuantity(e) {
|
|
366
482
|
_onChangeQuantity(e, d);
|
|
367
483
|
}
|
|
@@ -2,8 +2,11 @@ import React from "react";
|
|
|
2
2
|
import { formatAmount, createArray, image, locales } from "@pisell/utils";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import BrowserSelect from "../../browserSelect";
|
|
5
|
+
import CollapsibleList from "../../collapsibleList";
|
|
6
|
+
import { renderBundles } from "../../collapsibleList/utils";
|
|
5
7
|
import "./index.less";
|
|
6
8
|
var SelectProductItem = function SelectProductItem(_ref) {
|
|
9
|
+
var _item$_extend, _item$_extend$other, _item$_extend2, _item$_extend2$other;
|
|
7
10
|
var item = _ref.item,
|
|
8
11
|
_onClick = _ref.onClick,
|
|
9
12
|
onChangeQuantity = _ref.onChangeQuantity,
|
|
@@ -32,24 +35,34 @@ var SelectProductItem = function SelectProductItem(_ref) {
|
|
|
32
35
|
className: "server-select-product-cover"
|
|
33
36
|
}) : /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", {
|
|
34
37
|
className: "server-select-product-content"
|
|
35
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
className: "server-select-product-content-left"
|
|
37
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
38
39
|
className: "server-select-product-title"
|
|
39
40
|
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
40
41
|
className: "server-select-product-subtitle"
|
|
41
|
-
}, item.subtitle || ""), /*#__PURE__*/React.createElement(
|
|
42
|
-
|
|
42
|
+
}, item.subtitle || ""), (((_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) || []).length ? /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
43
|
+
style: {
|
|
44
|
+
width: "100%"
|
|
45
|
+
},
|
|
46
|
+
list: ((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : (_item$_extend2$other = _item$_extend2.other) === null || _item$_extend2$other === void 0 ? void 0 : _item$_extend2$other.bundle) || [],
|
|
47
|
+
renderItem: function renderItem(item) {
|
|
48
|
+
return renderBundles(item, amountSymbol);
|
|
49
|
+
}
|
|
50
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "server-select-product-quantity",
|
|
52
|
+
onClick: function onClick(e) {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
}
|
|
43
56
|
}, /*#__PURE__*/React.createElement(BrowserSelect, {
|
|
44
57
|
options: list,
|
|
45
|
-
value: item.quantity,
|
|
58
|
+
value: item._extend.quantity,
|
|
46
59
|
onChange: onChangeQuantity,
|
|
47
60
|
style: {
|
|
48
61
|
minWidth: 50
|
|
49
62
|
},
|
|
50
63
|
disabled: disabled
|
|
51
|
-
})
|
|
52
|
-
className: "server-select-product-
|
|
53
|
-
}, formatAmount(item.
|
|
64
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: "server-select-product-total"
|
|
66
|
+
}, formatAmount(item._extend.total * item._extend.quantity, 2, amountSymbol)))));
|
|
54
67
|
};
|
|
55
68
|
export default SelectProductItem;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
padding: 16px;
|
|
4
4
|
position: relative;
|
|
5
5
|
display: flex;
|
|
6
|
-
align-items:
|
|
6
|
+
align-items: flex-start;
|
|
7
7
|
gap: 12px;
|
|
8
8
|
|
|
9
9
|
&::before {
|
|
@@ -33,42 +33,49 @@
|
|
|
33
33
|
.server-select-product-content {
|
|
34
34
|
flex: 1;
|
|
35
35
|
display: flex;
|
|
36
|
-
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
gap: 4px;
|
|
40
|
+
min-height: 80px;
|
|
37
41
|
|
|
38
|
-
.server-select-product-
|
|
39
|
-
|
|
42
|
+
.server-select-product-title {
|
|
43
|
+
color: var(--Base-Black, #000);
|
|
44
|
+
font-size: 20px;
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
line-height: 30px;
|
|
48
|
+
}
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
.server-select-product-subtitle {
|
|
51
|
+
color: var(--Gray-600, #475467);
|
|
52
|
+
font-size: 16px;
|
|
53
|
+
font-style: normal;
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
line-height: 24px;
|
|
56
|
+
}
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
58
|
+
.server-select-product-quantity {
|
|
59
|
+
width: 100%;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
color: var(--Gray-600, #475467);
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
font-size: 16px;
|
|
66
|
+
font-style: normal;
|
|
67
|
+
font-weight: 400;
|
|
59
68
|
|
|
69
|
+
.server-select-product-total {
|
|
70
|
+
color: var(--Base-Black, #000);
|
|
60
71
|
font-size: 16px;
|
|
61
72
|
font-style: normal;
|
|
62
|
-
font-weight:
|
|
73
|
+
font-weight: 500;
|
|
74
|
+
line-height: 24px;
|
|
63
75
|
}
|
|
64
76
|
}
|
|
65
77
|
|
|
66
|
-
|
|
67
|
-
color: var(--Base-Black, #000);
|
|
68
|
-
font-size: 20px;
|
|
69
|
-
font-style: normal;
|
|
70
|
-
font-weight: 600;
|
|
71
|
-
}
|
|
78
|
+
|
|
72
79
|
|
|
73
80
|
}
|
|
74
81
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface CollapsibleListProps<T> {
|
|
4
|
+
list: T[];
|
|
5
|
+
renderItem: (item: T, index: number) => React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
border?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const CollapsibleList: React.FC<CollapsibleListProps<any>>;
|
|
11
|
+
export default CollapsibleList;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useState, useMemo } from "react";
|
|
12
|
+
import { locales } from "@pisell/utils";
|
|
13
|
+
import classNames from "classnames";
|
|
14
|
+
import "./index.less";
|
|
15
|
+
var MAX_LIMIT = 3;
|
|
16
|
+
var CollapsibleList = function CollapsibleList(props) {
|
|
17
|
+
var _props$list = props.list,
|
|
18
|
+
list = _props$list === void 0 ? [] : _props$list,
|
|
19
|
+
renderItem = props.renderItem,
|
|
20
|
+
className = props.className,
|
|
21
|
+
style = props.style,
|
|
22
|
+
border = props.border;
|
|
23
|
+
var _useState = useState(MAX_LIMIT),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
maxLimit = _useState2[0],
|
|
26
|
+
setMaxLimit = _useState2[1];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @title: 展开和收起
|
|
30
|
+
* @description:
|
|
31
|
+
* @param {any} d
|
|
32
|
+
* @return {*}
|
|
33
|
+
* @Author: zhiwei.Wang
|
|
34
|
+
* @Date: 2024-01-30 17:08
|
|
35
|
+
*/
|
|
36
|
+
var handlePreviewAll = function handlePreviewAll() {
|
|
37
|
+
var _maxLimit = maxLimit;
|
|
38
|
+
if (_maxLimit === MAX_LIMIT) {
|
|
39
|
+
_maxLimit = 99;
|
|
40
|
+
} else {
|
|
41
|
+
_maxLimit = MAX_LIMIT;
|
|
42
|
+
}
|
|
43
|
+
setMaxLimit(_maxLimit);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @title: 是否展开全部
|
|
48
|
+
* @description:
|
|
49
|
+
* @param {*} useMemo
|
|
50
|
+
* @return {*}
|
|
51
|
+
* @Author: zhiwei.Wang
|
|
52
|
+
* @Date: 2024-01-30 17:08
|
|
53
|
+
*/
|
|
54
|
+
var showAll = useMemo(function () {
|
|
55
|
+
return list.length > MAX_LIMIT;
|
|
56
|
+
}, [list]);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @title: 展开文案
|
|
60
|
+
* @description:
|
|
61
|
+
* @return {*}
|
|
62
|
+
* @Author: zhiwei.Wang
|
|
63
|
+
* @Date: 2024-01-30 17:08
|
|
64
|
+
*/
|
|
65
|
+
var viewAllText = useMemo(function () {
|
|
66
|
+
var _maxLimit = maxLimit;
|
|
67
|
+
if (_maxLimit === MAX_LIMIT) {
|
|
68
|
+
return locales.getText("pisell2.text.view-all");
|
|
69
|
+
}
|
|
70
|
+
return locales.getText("pisell2.text.view-less");
|
|
71
|
+
}, [maxLimit]);
|
|
72
|
+
var _list = useMemo(function () {
|
|
73
|
+
var arr = _toConsumableArray(list);
|
|
74
|
+
// 默认展示3条, 点击更多时展示全部
|
|
75
|
+
var _maxLimit = maxLimit;
|
|
76
|
+
if (list.length > _maxLimit) {
|
|
77
|
+
arr = arr.slice(0, _maxLimit);
|
|
78
|
+
}
|
|
79
|
+
return arr;
|
|
80
|
+
}, [list.length, maxLimit]);
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: classNames("pisell2-collapsible-list-wrap", className),
|
|
83
|
+
style: style
|
|
84
|
+
}, border ? /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "pisell2-collapsible-list-top-border"
|
|
86
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "pisell2-collapsible-list"
|
|
88
|
+
}, _list.map(function (d, i) {
|
|
89
|
+
return renderItem(d, i);
|
|
90
|
+
})), showAll ? /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: "pisell2-collapsible-list-view-all",
|
|
92
|
+
onClick: function onClick(e) {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
handlePreviewAll();
|
|
96
|
+
}
|
|
97
|
+
}, viewAllText) : null);
|
|
98
|
+
};
|
|
99
|
+
export default CollapsibleList;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.pisell2-collapsible-list-wrap {
|
|
2
|
+
.pisell2-collapsible-list-top-border {
|
|
3
|
+
height: 1px;
|
|
4
|
+
background: #f1f1f1;
|
|
5
|
+
width: 100%;
|
|
6
|
+
margin: 8px 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.pisell2-collapsible-list {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.pisell2-collapsible-list-view-all {
|
|
16
|
+
margin-top: 4px;
|
|
17
|
+
color: #7f56d9;
|
|
18
|
+
font-size: 16px;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
user-select: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
.product-bundle-item {
|
|
29
|
+
width: 100%;
|
|
30
|
+
|
|
31
|
+
.product-bundle-info {
|
|
32
|
+
width: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
|
|
37
|
+
.product-bundle-info-title {
|
|
38
|
+
color: var(--gray-500, #667085);
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
line-height: 20px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.product-bundle-info-num {
|
|
46
|
+
color: var(--Gray-500, #667085);
|
|
47
|
+
font-size: 14px;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
line-height: 20px;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.product-bundle-option {
|
|
56
|
+
color: var(--gray-500, #667085);
|
|
57
|
+
font-size: 12px;
|
|
58
|
+
margin-top: 4px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { formatAmount } from "@pisell/utils";
|
|
3
|
+
export var renderBundles = function renderBundles(item, amountSymbol) {
|
|
4
|
+
var options = (item === null || item === void 0 ? void 0 : item.option) || [];
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
key: item.id,
|
|
7
|
+
className: "product-bundle-item"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "product-bundle-info"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "product-bundle-info-title"
|
|
12
|
+
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
className: "product-bundle-info-num"
|
|
14
|
+
}, formatAmount(item.price, 2, amountSymbol), " \xD7 ", item.num)), /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "product-bundle-option"
|
|
16
|
+
}, options.map(function (option, index) {
|
|
17
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
18
|
+
key: option.id
|
|
19
|
+
}, option.name, " x ", option.num, " ", index < options.length - 1 && ",", " ");
|
|
20
|
+
})));
|
|
21
|
+
};
|
|
@@ -25,7 +25,7 @@ var getProductAmount = function getProductAmount(state, isEdit) {
|
|
|
25
25
|
try {
|
|
26
26
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
27
27
|
var item = _step.value;
|
|
28
|
-
price += Number(item._extend.
|
|
28
|
+
price += Number(item._extend.total);
|
|
29
29
|
duration += flexibleObj.getValue(item._extend.duration);
|
|
30
30
|
}
|
|
31
31
|
} catch (err) {
|
|
@@ -38,7 +38,7 @@ var getProductAmount = function getProductAmount(state, isEdit) {
|
|
|
38
38
|
try {
|
|
39
39
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
40
40
|
var _item = _step2.value;
|
|
41
|
-
price += Number(_item.
|
|
41
|
+
price += Number(_item._extend.total) * _item._extend.quantity;
|
|
42
42
|
}
|
|
43
43
|
} catch (err) {
|
|
44
44
|
_iterator2.e(err);
|
|
@@ -62,7 +62,7 @@ var getProductAmount = function getProductAmount(state, isEdit) {
|
|
|
62
62
|
var getProductItemTax = function getProductItemTax(item, bookingDetail) {
|
|
63
63
|
var price = 0;
|
|
64
64
|
// 折扣后的金额 = 商品金额 - 商品折扣
|
|
65
|
-
var productDiscountPrice = Number(item.
|
|
65
|
+
var productDiscountPrice = Number(item.total);
|
|
66
66
|
// 店铺税 = 折扣后的金额 * 店铺税率 * 商品是否收税 (is_charge_tax 0 为不收税)
|
|
67
67
|
var shopTax = productDiscountPrice * Number(bookingDetail.tax_rate) * Number(item.is_charge_tax);
|
|
68
68
|
// 店铺税率 = 1 + 店铺税率 * 是否含税
|
|
@@ -83,10 +83,7 @@ var getProductItemTax = function getProductItemTax(item, bookingDetail) {
|
|
|
83
83
|
* @Date: 2024-02-28 10:56
|
|
84
84
|
*/
|
|
85
85
|
var getTotal = function getTotal(item) {
|
|
86
|
-
return item._extend.payment_price !== undefined ? item._extend.payment_price : item._extend.
|
|
87
|
-
};
|
|
88
|
-
var getAddonsTotal = function getAddonsTotal(item) {
|
|
89
|
-
return item.payment_price !== undefined ? item.payment_price : item.price;
|
|
86
|
+
return item._extend.payment_price !== undefined ? item._extend.payment_price : item._extend.total;
|
|
90
87
|
};
|
|
91
88
|
|
|
92
89
|
/**
|
|
@@ -112,7 +109,8 @@ var getTax = function getTax(state, isEdit) {
|
|
|
112
109
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
113
110
|
var item = _step3.value;
|
|
114
111
|
price += getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
|
|
115
|
-
|
|
112
|
+
total: getTotal(item),
|
|
113
|
+
price: item._extend.price,
|
|
116
114
|
quantity: item._extend.quantity
|
|
117
115
|
}), state.bookingDetail);
|
|
118
116
|
}
|
|
@@ -127,8 +125,9 @@ var getTax = function getTax(state, isEdit) {
|
|
|
127
125
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
128
126
|
var _item2 = _step4.value;
|
|
129
127
|
price += getProductItemTax(_objectSpread(_objectSpread({}, _item2), {}, {
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
total: getTotal(_item2),
|
|
129
|
+
price: _item2._extend.price,
|
|
130
|
+
quantity: _item2._extend.quantity
|
|
132
131
|
}), state.bookingDetail);
|
|
133
132
|
}
|
|
134
133
|
} catch (err) {
|
|
@@ -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;
|