@pisell/private-materials 3.0.15 → 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/TabProduct/tabs/index.less +4 -1
- 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/index.js +4 -1
- 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 +141 -71
- 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/serve.d.ts +1 -0
- package/es/components/booking/info/service/serve.js +21 -0
- 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/info/utils.d.ts +1 -0
- package/es/components/booking/info/utils.js +8 -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 +16 -0
- package/es/components/booking/utils.js +37 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.js +2 -1
- package/es/components/productExtension/locales.js +5 -5
- 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/TabProduct/tabs/index.less +4 -1
- 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/index.js +3 -0
- 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 +68 -34
- 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/serve.d.ts +1 -0
- package/lib/components/booking/info/service/serve.js +30 -0
- 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/info/utils.d.ts +1 -0
- package/lib/components/booking/info/utils.js +35 -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 +16 -0
- package/lib/components/booking/utils.js +29 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.js +1 -1
- package/lib/components/productExtension/locales.js +5 -5
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/package.json +3 -3
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
declare type RType = (url: string, data?: {} | undefined, config?: {} | undefined) => Promise<any>;
|
|
3
|
+
declare class Request {
|
|
4
|
+
private request;
|
|
5
|
+
constructor();
|
|
6
|
+
setRequest(val: any): void;
|
|
7
|
+
getRequest(): {
|
|
8
|
+
get: RType;
|
|
9
|
+
post: RType;
|
|
10
|
+
put: RType;
|
|
11
|
+
remove: RType;
|
|
12
|
+
custom: RType;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const request: Request;
|
|
2
16
|
export declare const getDiscountTime: (service_times: number) => string;
|
|
3
17
|
export declare const sliceDayIntoFiveMinutes: (config: any, locale: string) => {
|
|
4
18
|
timeSlices: {
|
|
@@ -79,6 +93,7 @@ export declare const deleteCacheParams: () => void;
|
|
|
79
93
|
* @Date: 2024-01-26 14:09
|
|
80
94
|
*/
|
|
81
95
|
export declare const getServerItemExtend: (state: any, cacheItem: any, timeObj: any) => any;
|
|
96
|
+
export declare const getProductTotalPrice: (item: any) => number;
|
|
82
97
|
/**
|
|
83
98
|
* @title: 判断 duration
|
|
84
99
|
* @description: 用于处理不同格式的duration
|
|
@@ -95,3 +110,4 @@ export declare const getDuration: (duration: number | {
|
|
|
95
110
|
value: number;
|
|
96
111
|
} | "flexible";
|
|
97
112
|
export declare const isWalkIn: (customer_id?: number | string) => boolean;
|
|
113
|
+
export {};
|
|
@@ -7,12 +7,34 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
13
|
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; }
|
|
11
14
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
15
|
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); }
|
|
13
16
|
import dayjs from 'dayjs';
|
|
14
17
|
import { locales } from "@pisell/utils";
|
|
15
18
|
import { intersectionBy } from 'lodash';
|
|
19
|
+
var Request = /*#__PURE__*/function () {
|
|
20
|
+
function Request() {
|
|
21
|
+
_classCallCheck(this, Request);
|
|
22
|
+
_defineProperty(this, "request", {});
|
|
23
|
+
}
|
|
24
|
+
_createClass(Request, [{
|
|
25
|
+
key: "setRequest",
|
|
26
|
+
value: function setRequest(val) {
|
|
27
|
+
this.request = val;
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "getRequest",
|
|
31
|
+
value: function getRequest() {
|
|
32
|
+
return this.request;
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
return Request;
|
|
36
|
+
}();
|
|
37
|
+
export var request = new Request();
|
|
16
38
|
export var getDiscountTime = function getDiscountTime(service_times) {
|
|
17
39
|
if (!service_times) {
|
|
18
40
|
return "";
|
|
@@ -498,6 +520,21 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
|
|
|
498
520
|
return _extend;
|
|
499
521
|
};
|
|
500
522
|
|
|
523
|
+
// 商品价格: (商品价格 + (套餐价格 + 单规格价格 * 单规格数量) * 套餐数量) * 商品数量
|
|
524
|
+
export var getProductTotalPrice = function getProductTotalPrice(item) {
|
|
525
|
+
var _item$_extend;
|
|
526
|
+
var price = 0;
|
|
527
|
+
price += Number(item._extend.price);
|
|
528
|
+
var other = (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.other;
|
|
529
|
+
if (other !== null && other !== void 0 && other.bundle) {
|
|
530
|
+
// bundle
|
|
531
|
+
price = other === null || other === void 0 ? void 0 : other.bundle.reduce(function (accumulator, currentValue) {
|
|
532
|
+
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
533
|
+
}, price);
|
|
534
|
+
}
|
|
535
|
+
price = price;
|
|
536
|
+
return price;
|
|
537
|
+
};
|
|
501
538
|
/**
|
|
502
539
|
* @title: 判断 duration
|
|
503
540
|
* @description: 用于处理不同格式的duration
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"en": {
|
|
3
3
|
'pisell2.text.product-extension.please-select': "Please select",
|
|
4
|
-
'pisell2.text.product-extension.cut-off-time': 'Cut-off
|
|
5
|
-
'pisell2.text.product-extension.cut-off-time.desc': '
|
|
4
|
+
'pisell2.text.product-extension.cut-off-time': 'Cut-off Time',
|
|
5
|
+
'pisell2.text.product-extension.cut-off-time.desc': 'Use this setting to prevent last minute events. For example: you can prevent same day booking (set 1 day) or prevent events less than 6 hours away.',
|
|
6
6
|
'pisell2.text.product-extension.future-day': 'Future Day',
|
|
7
7
|
'pisell2.text.product-extension.future-day.hint': 'The maximum number of days in the future that customers can book',
|
|
8
8
|
'pisell2.text.product-extension.days': 'Days',
|
|
@@ -12,12 +12,12 @@ export default {
|
|
|
12
12
|
'pisell2.text.product-extension.add-other-product': 'Add Other Product',
|
|
13
13
|
'pisell2.text.product-extension.resource-type': 'Resource Type',
|
|
14
14
|
'pisell2.text.product-extension.open': 'Open',
|
|
15
|
-
'pisell2.text.product-extension.options': '
|
|
15
|
+
'pisell2.text.product-extension.options': 'Items'
|
|
16
16
|
},
|
|
17
17
|
'zh-CN': {
|
|
18
18
|
'pisell2.text.product-extension.please-select': "请选择",
|
|
19
19
|
'pisell2.text.product-extension.cut-off-time': '截止时间',
|
|
20
|
-
'pisell2.text.product-extension.cut-off-time.desc': '
|
|
20
|
+
'pisell2.text.product-extension.cut-off-time.desc': '使用此设置可防止最后一分钟的事件。 例如:您可以阻止当天预订(设置为 1 天)或阻止距离不到 6 小时的活动。',
|
|
21
21
|
'pisell2.text.product-extension.future-day': '预定天数',
|
|
22
22
|
'pisell2.text.product-extension.future-day.hint': '客户未来最多可预订天数',
|
|
23
23
|
'pisell2.text.product-extension.days': '天',
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
'zh-HK': {
|
|
33
33
|
'pisell2.text.product-extension.please-select': "請選擇",
|
|
34
34
|
'pisell2.text.product-extension.cut-off-time': '截止时间',
|
|
35
|
-
'pisell2.text.product-extension.cut-off-time.desc': '
|
|
35
|
+
'pisell2.text.product-extension.cut-off-time.desc': '使用此設置可防止最後一分鐘的事件。例如:您可以阻止當天預訂(設置為 1 天)或阻止距離不到 6 小時的活動。',
|
|
36
36
|
'pisell2.text.product-extension.future-day': '預定天數',
|
|
37
37
|
'pisell2.text.product-extension.future-day.hint': '客戶未來最多可預訂天數',
|
|
38
38
|
'pisell2.text.product-extension.days': '天',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
3
2
|
import dayjs from "dayjs";
|
|
4
3
|
export interface FormState {
|
|
@@ -69,7 +68,7 @@ export interface FormState {
|
|
|
69
68
|
};
|
|
70
69
|
setGlobalState: Function | null;
|
|
71
70
|
}
|
|
72
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
71
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
73
72
|
state: FormState;
|
|
74
73
|
} & {
|
|
75
74
|
dispatch: (params: {
|
|
@@ -43,27 +43,59 @@ var import_selectProductItem = __toESM(require("../components/TabProduct/selectP
|
|
|
43
43
|
var import_TabProduct = __toESM(require("../components/TabProduct"));
|
|
44
44
|
var import_emptyBooking = __toESM(require("../components/emptyBooking"));
|
|
45
45
|
var import_footer = __toESM(require("../components/footer"));
|
|
46
|
-
var import_utils = require("../utils");
|
|
47
|
-
var import_utils2 = require("
|
|
46
|
+
var import_utils = require("../components/footer/utils");
|
|
47
|
+
var import_utils2 = require("../utils");
|
|
48
|
+
var import_utils3 = require("@pisell/utils");
|
|
48
49
|
var import_index = require("./index.less");
|
|
49
50
|
var formatProducts = (values) => {
|
|
50
51
|
let arr = [];
|
|
51
52
|
arr = values.map((item) => {
|
|
53
|
+
var _a, _b, _c;
|
|
52
54
|
return {
|
|
53
55
|
order_detail_id: item.order_detail_id || 0,
|
|
54
|
-
num: item.quantity,
|
|
55
|
-
price: item.price,
|
|
56
|
+
num: item._extend.quantity,
|
|
57
|
+
price: item._extend.price,
|
|
56
58
|
product_id: item.id,
|
|
57
59
|
discount_amount: 0,
|
|
58
60
|
product_discount_reason: "",
|
|
59
61
|
is_charge_tax: item.is_charge_tax,
|
|
60
62
|
note: "",
|
|
61
63
|
discountway: "num",
|
|
62
|
-
discount_type: "discount"
|
|
64
|
+
discount_type: "discount",
|
|
65
|
+
bundle_edit: (_a = item._extend) == null ? void 0 : _a.bundle_edit,
|
|
66
|
+
product_bundle: (0, import_utils.formatProductBundle)((_c = (_b = item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.bundle)
|
|
63
67
|
};
|
|
64
68
|
});
|
|
65
69
|
return arr;
|
|
66
70
|
};
|
|
71
|
+
var restoreProductOtherData = (data) => {
|
|
72
|
+
let detail = data;
|
|
73
|
+
return {
|
|
74
|
+
product_id: detail.product_id,
|
|
75
|
+
option: [],
|
|
76
|
+
bundle: (detail.product_bundle || []).map((bundleItem) => {
|
|
77
|
+
return {
|
|
78
|
+
...bundleItem,
|
|
79
|
+
title: bundleItem.bundle_title,
|
|
80
|
+
group_id: bundleItem.bundle_group_id,
|
|
81
|
+
id: bundleItem.bundle_id,
|
|
82
|
+
product_id: bundleItem.bundle_product_id,
|
|
83
|
+
bundle_variant_id: bundleItem.bundle_variant_id,
|
|
84
|
+
quantity: bundleItem.num,
|
|
85
|
+
option: bundleItem.option.map((optionItem) => {
|
|
86
|
+
return {
|
|
87
|
+
...optionItem,
|
|
88
|
+
name: optionItem.name["auto"],
|
|
89
|
+
quantity: bundleItem.num,
|
|
90
|
+
product_option_item_id: optionItem.option_group_item_id
|
|
91
|
+
};
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
}),
|
|
95
|
+
product_variant_id: 0,
|
|
96
|
+
quantity: Number(detail.product_quantity)
|
|
97
|
+
};
|
|
98
|
+
};
|
|
67
99
|
var formatProductValues = (data) => {
|
|
68
100
|
return data.map((d) => {
|
|
69
101
|
return {
|
|
@@ -72,7 +104,15 @@ var formatProductValues = (data) => {
|
|
|
72
104
|
title: d.product_title,
|
|
73
105
|
quantity: d.product_quantity,
|
|
74
106
|
cover: d.product_cover,
|
|
75
|
-
price: Number(d.
|
|
107
|
+
price: Number(d.source_product_price),
|
|
108
|
+
_extend: {
|
|
109
|
+
total: Number(d.selling_price),
|
|
110
|
+
payment_price: Number(d.payment_price),
|
|
111
|
+
price: Number(d.source_product_price),
|
|
112
|
+
quantity: d.product_quantity,
|
|
113
|
+
bundle_edit: 0,
|
|
114
|
+
other: restoreProductOtherData(d)
|
|
115
|
+
},
|
|
76
116
|
payment_price: Number(d.payment_price)
|
|
77
117
|
};
|
|
78
118
|
});
|
|
@@ -125,12 +165,17 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
125
165
|
let data = await state.apis.getProducts({
|
|
126
166
|
skip: 1,
|
|
127
167
|
num: 500,
|
|
128
|
-
extension_type: [
|
|
168
|
+
extension_type: [
|
|
169
|
+
"normal",
|
|
170
|
+
"product_bundle",
|
|
171
|
+
"product_package_ticket",
|
|
172
|
+
"ticket"
|
|
173
|
+
],
|
|
129
174
|
with: ["category"],
|
|
130
|
-
include_formula: "no",
|
|
131
|
-
include_bundle: "no",
|
|
132
|
-
include_option: "no",
|
|
133
|
-
include_variant: "no",
|
|
175
|
+
// include_formula: "no",
|
|
176
|
+
// include_bundle: "no",
|
|
177
|
+
// include_option: "no",
|
|
178
|
+
// include_variant: "no",
|
|
134
179
|
open_quotation: 1,
|
|
135
180
|
with_schedule: 0
|
|
136
181
|
});
|
|
@@ -143,26 +188,52 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
143
188
|
};
|
|
144
189
|
const handleAddProduct = (item) => {
|
|
145
190
|
let _list = [...state.addons.value];
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
191
|
+
state.action({
|
|
192
|
+
type: "pisell1.handleOpenProductModal",
|
|
193
|
+
data: {
|
|
194
|
+
id: item.id,
|
|
195
|
+
date: state.date.value.format("YYYY-MM-DD"),
|
|
196
|
+
showConfig: {
|
|
197
|
+
option: false,
|
|
198
|
+
session: false,
|
|
199
|
+
variant: false,
|
|
200
|
+
package: true
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
callback: (e) => {
|
|
204
|
+
let product = {
|
|
205
|
+
...item,
|
|
206
|
+
_id: (0, import_utils3.getUniqueId)(),
|
|
207
|
+
_key: e.key,
|
|
208
|
+
_extend: {
|
|
209
|
+
price: item.price,
|
|
210
|
+
other: e,
|
|
211
|
+
quantity: 1
|
|
212
|
+
},
|
|
213
|
+
quantity: 1
|
|
214
|
+
};
|
|
215
|
+
let _total = (0, import_utils2.getProductTotalPrice)(product);
|
|
216
|
+
product._extend.total = _total;
|
|
217
|
+
let _item = _list.find((d) => d._extend.other.key === e.key);
|
|
218
|
+
if (_item) {
|
|
219
|
+
_item._extend.quantity = _item.quantity + 1;
|
|
220
|
+
} else {
|
|
221
|
+
_list.push(product);
|
|
222
|
+
}
|
|
223
|
+
dispatch({
|
|
224
|
+
type: "setAddons",
|
|
225
|
+
payload: {
|
|
226
|
+
value: _list,
|
|
227
|
+
showModal: false,
|
|
228
|
+
// 编辑态
|
|
229
|
+
edit: true
|
|
230
|
+
}
|
|
231
|
+
});
|
|
162
232
|
}
|
|
163
233
|
});
|
|
164
234
|
};
|
|
165
235
|
const onChangeQuantity = (e, item) => {
|
|
236
|
+
var _a2;
|
|
166
237
|
let quantity = e.target.value;
|
|
167
238
|
let _list = [...state.addons.value];
|
|
168
239
|
if (quantity == 0) {
|
|
@@ -170,8 +241,16 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
170
241
|
} else {
|
|
171
242
|
let _item = {
|
|
172
243
|
...item,
|
|
173
|
-
|
|
244
|
+
_extend: {
|
|
245
|
+
...item._extend,
|
|
246
|
+
quantity: Number(e.target.value)
|
|
247
|
+
}
|
|
174
248
|
};
|
|
249
|
+
let _total = (0, import_utils2.getProductTotalPrice)(_item);
|
|
250
|
+
_item._extend.total = _total;
|
|
251
|
+
if (((_a2 = _item._extend) == null ? void 0 : _a2.bundle_edit) !== void 0) {
|
|
252
|
+
_item._extend.bundle_edit = 1;
|
|
253
|
+
}
|
|
175
254
|
_list = _list.map((d) => d.id === item.id ? _item : d);
|
|
176
255
|
}
|
|
177
256
|
dispatch({
|
|
@@ -188,7 +267,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
188
267
|
const isIncludes = (str) => {
|
|
189
268
|
return str.toLowerCase().indexOf(search.toLowerCase()) !== -1;
|
|
190
269
|
};
|
|
191
|
-
return (0,
|
|
270
|
+
return (0, import_utils2.formatProductListByCategory)(
|
|
192
271
|
_list,
|
|
193
272
|
search ? (item) => isIncludes(item.title) : void 0
|
|
194
273
|
);
|
|
@@ -222,7 +301,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
222
301
|
disabled: loading,
|
|
223
302
|
onClick: handleOpenAdd
|
|
224
303
|
},
|
|
225
|
-
|
|
304
|
+
import_utils3.locales.getText("pisell2.text.add")
|
|
226
305
|
)
|
|
227
306
|
];
|
|
228
307
|
return arr;
|
|
@@ -233,14 +312,58 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
233
312
|
}
|
|
234
313
|
return /* @__PURE__ */ import_react.default.createElement(import_footer.default, { state, buttons: _footer, source: "addons" });
|
|
235
314
|
}, [state, _footer]);
|
|
315
|
+
const editProductDetail = (item) => {
|
|
316
|
+
console.log("item._extend.other", item._extend.other);
|
|
317
|
+
state.action({
|
|
318
|
+
type: "pisell1.handleOpenProductModal",
|
|
319
|
+
data: {
|
|
320
|
+
id: item.id,
|
|
321
|
+
date: state.date.value.format("YYYY-MM-DD"),
|
|
322
|
+
showConfig: {
|
|
323
|
+
option: false,
|
|
324
|
+
session: false,
|
|
325
|
+
variant: false,
|
|
326
|
+
package: true
|
|
327
|
+
},
|
|
328
|
+
value: item._extend.other
|
|
329
|
+
},
|
|
330
|
+
callback: (e) => {
|
|
331
|
+
var _a2;
|
|
332
|
+
let product = {
|
|
333
|
+
...item,
|
|
334
|
+
_extend: {
|
|
335
|
+
...item._extend,
|
|
336
|
+
other: e
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
if (((_a2 = product._extend) == null ? void 0 : _a2.bundle_edit) !== void 0) {
|
|
340
|
+
product._extend.bundle_edit = 1;
|
|
341
|
+
}
|
|
342
|
+
let _total = (0, import_utils2.getProductTotalPrice)(product);
|
|
343
|
+
product._extend.total = _total;
|
|
344
|
+
let _list = [...state.addons.value];
|
|
345
|
+
console.log("cacheItem", product);
|
|
346
|
+
_list = _list.map((d) => d._id === product._id ? product : d);
|
|
347
|
+
dispatch({
|
|
348
|
+
type: "setAddons",
|
|
349
|
+
payload: {
|
|
350
|
+
value: _list,
|
|
351
|
+
showModal: false,
|
|
352
|
+
// 编辑态
|
|
353
|
+
edit: true
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
};
|
|
236
359
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
237
360
|
import_tabPane.default,
|
|
238
361
|
{
|
|
239
362
|
loading,
|
|
240
|
-
header:
|
|
363
|
+
header: import_utils3.locales.getText("pisell2.text.addons"),
|
|
241
364
|
footer
|
|
242
365
|
},
|
|
243
|
-
!state.bookingId ? /* @__PURE__ */ import_react.default.createElement(import_emptyBooking.default, null) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, state.addons.value.length ? /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { margin: "0 -
|
|
366
|
+
!state.bookingId ? /* @__PURE__ */ import_react.default.createElement(import_emptyBooking.default, null) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, state.addons.value.length ? /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { margin: "0 -32px" } }, state.addons.value.map((d) => {
|
|
244
367
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
245
368
|
import_selectProductItem.default,
|
|
246
369
|
{
|
|
@@ -248,6 +371,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
248
371
|
item: d,
|
|
249
372
|
key: d.id,
|
|
250
373
|
amountSymbol: state.amountSymbol,
|
|
374
|
+
onClick: editProductDetail,
|
|
251
375
|
onChangeQuantity: (e) => {
|
|
252
376
|
onChangeQuantity(e, d);
|
|
253
377
|
}
|
|
@@ -256,13 +380,13 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
256
380
|
})) : /* @__PURE__ */ import_react.default.createElement(
|
|
257
381
|
import_emptyBooking.default,
|
|
258
382
|
{
|
|
259
|
-
description:
|
|
383
|
+
description: import_utils3.locales.getText("pisell1.text.no-addons")
|
|
260
384
|
}
|
|
261
385
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
262
386
|
import_drawer.default,
|
|
263
387
|
{
|
|
264
388
|
open: state.addons.showModal,
|
|
265
|
-
title:
|
|
389
|
+
title: import_utils3.locales.getText("pisell2.text.addons"),
|
|
266
390
|
onClose: () => {
|
|
267
391
|
dispatch({
|
|
268
392
|
type: "setAddons",
|
|
@@ -277,7 +401,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
277
401
|
{
|
|
278
402
|
prefix: /* @__PURE__ */ import_react.default.createElement(import_SearchLg.default, null),
|
|
279
403
|
style: { marginTop: 16, height: 44 },
|
|
280
|
-
placeholder:
|
|
404
|
+
placeholder: import_utils3.locales.getText("pisell2.text.search"),
|
|
281
405
|
allowClear: true,
|
|
282
406
|
value: search,
|
|
283
407
|
onChange: (e) => {
|
|
@@ -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: {
|
|
@@ -36,6 +36,8 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_utils = require("@pisell/utils");
|
|
37
37
|
var import_classnames = __toESM(require("classnames"));
|
|
38
38
|
var import_browserSelect = __toESM(require("../../browserSelect"));
|
|
39
|
+
var import_collapsibleList = __toESM(require("../../collapsibleList"));
|
|
40
|
+
var import_utils2 = require("../../collapsibleList/utils");
|
|
39
41
|
var import_index = require("./index.less");
|
|
40
42
|
var SelectProductItem = ({
|
|
41
43
|
item,
|
|
@@ -46,6 +48,7 @@ var SelectProductItem = ({
|
|
|
46
48
|
className,
|
|
47
49
|
disabled
|
|
48
50
|
}) => {
|
|
51
|
+
var _a, _b, _c, _d;
|
|
49
52
|
const list = (0, import_utils.createArray)(100, (d, i) => {
|
|
50
53
|
let item2 = {
|
|
51
54
|
label: i,
|
|
@@ -72,16 +75,38 @@ var SelectProductItem = ({
|
|
|
72
75
|
className: "server-select-product-cover"
|
|
73
76
|
}
|
|
74
77
|
) : /* @__PURE__ */ import_react.default.createElement("div", null),
|
|
75
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-
|
|
76
|
-
|
|
78
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-subtitle" }, item.subtitle || ""), (((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []).length ? /* @__PURE__ */ import_react.default.createElement(
|
|
79
|
+
import_collapsibleList.default,
|
|
77
80
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
style: { minWidth: 50 },
|
|
82
|
-
disabled
|
|
81
|
+
style: { width: "100%" },
|
|
82
|
+
list: ((_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.bundle) || [],
|
|
83
|
+
renderItem: (item2) => (0, import_utils2.renderBundles)(item2, amountSymbol)
|
|
83
84
|
}
|
|
84
|
-
)
|
|
85
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "server-select-product-quantity",
|
|
89
|
+
onClick: (e) => {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
95
|
+
import_browserSelect.default,
|
|
96
|
+
{
|
|
97
|
+
options: list,
|
|
98
|
+
value: item._extend.quantity,
|
|
99
|
+
onChange: onChangeQuantity,
|
|
100
|
+
style: { minWidth: 50 },
|
|
101
|
+
disabled
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, (0, import_utils.formatAmount)(
|
|
105
|
+
item._extend.total * item._extend.quantity,
|
|
106
|
+
2,
|
|
107
|
+
amountSymbol
|
|
108
|
+
))
|
|
109
|
+
))
|
|
85
110
|
);
|
|
86
111
|
};
|
|
87
112
|
var selectProductItem_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;
|