@pisell/private-materials 3.0.203 → 3.0.204
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +27 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +33 -18
- package/es/components/booking/components/customSelect/index.d.ts +0 -1
- package/es/components/booking/components/customSelect/index.js +2 -6
- package/es/components/booking/components/footer/amount.js +22 -46
- package/es/components/booking/components/footer/index.js +40 -84
- package/es/components/booking/components/footer/utils.js +35 -266
- package/es/components/booking/forms/model.d.ts +1 -1
- package/es/components/booking/info/addServiceVariant/index.js +1 -8
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +13 -14
- package/es/components/booking/info/clientVariant/vertical/index.js +9 -124
- package/es/components/booking/info/main.js +15 -28
- package/es/components/booking/info/model.js +0 -3
- package/es/components/booking/info/pet/index.js +5 -54
- package/es/components/booking/info/service/addService/index.js +96 -187
- package/es/components/booking/info/service/addService/index.less +3 -13
- package/es/components/booking/info/service/addService/utils.d.ts +2 -12
- package/es/components/booking/info/service/addService/utils.js +26 -103
- package/es/components/booking/info/service/editService/index.js +132 -435
- package/es/components/booking/info/service/editService/index.less +13 -18
- package/es/components/booking/info/service/serve.d.ts +0 -10
- package/es/components/booking/info/service/serve.js +0 -28
- package/es/components/booking/info/utils.d.ts +0 -20
- package/es/components/booking/info/utils.js +0 -37
- package/es/components/booking/locales.d.ts +0 -66
- package/es/components/booking/locales.js +3 -81
- package/es/components/booking/model.d.ts +1 -5
- package/es/components/booking/model.js +2 -4
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -1
- package/es/components/booking/utils.d.ts +3 -12
- package/es/components/booking/utils.js +26 -143
- package/es/components/eftpos/form/index.js +12 -6
- package/es/components/eftpos/group/index.d.ts +1 -2
- package/es/components/eftpos/group/index.js +1 -2
- package/es/components/eftpos/hooks.d.ts +4 -4
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftpos/receipt/index.d.ts +24 -0
- package/es/components/eftpos/receipt/index.js +96 -0
- package/es/components/eftposPay/app.d.ts +11 -0
- package/es/components/eftposPay/app.js +173 -0
- package/es/components/eftposPay/component/fail/failCustom.js +1 -0
- package/es/components/eftposPay/component/fail/index.js +1 -0
- package/es/components/eftposPay/component/manual/index.js +4 -1
- package/es/components/eftposPay/component/step/index.d.ts +6 -6
- package/es/components/eftposPay/component/step/step.d.ts +4 -4
- package/es/components/eftposPay/const.d.ts +27 -1
- package/es/components/eftposPay/const.js +22 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/device.js +2 -2
- package/es/components/eftposPay/helper.d.ts +6 -0
- package/es/components/eftposPay/helper.js +24 -4
- package/es/components/eftposPay/hooks.d.ts +2 -1
- package/es/components/eftposPay/hooks.js +22 -16
- package/es/components/eftposPay/index.d.ts +1 -1
- package/es/components/eftposPay/index.js +130 -179
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +15 -0
- package/es/components/eftposPay/payo/config.js +20 -8
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tip.d.ts +10 -0
- package/es/components/eftposPay/tip.js +177 -0
- package/es/components/eftposPay/tip.less +9 -0
- package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/es/components/eftposPay/tyro/index.js +55 -22
- package/es/components/eftposPay/windcave/helper.d.ts +1 -1
- package/es/components/eftposPay/windcave/windcave.js +17 -6
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +1 -2
- package/lib/components/booking/components/customSelect/index.d.ts +0 -1
- package/lib/components/booking/components/customSelect/index.js +2 -6
- package/lib/components/booking/components/footer/amount.js +8 -27
- package/lib/components/booking/components/footer/index.js +4 -25
- package/lib/components/booking/components/footer/utils.js +35 -161
- package/lib/components/booking/forms/model.d.ts +1 -1
- package/lib/components/booking/info/addServiceVariant/index.js +0 -5
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +7 -8
- package/lib/components/booking/info/clientVariant/vertical/index.js +11 -87
- package/lib/components/booking/info/main.js +9 -17
- package/lib/components/booking/info/model.js +0 -3
- package/lib/components/booking/info/pet/index.js +25 -61
- package/lib/components/booking/info/service/addService/index.js +84 -115
- package/lib/components/booking/info/service/addService/index.less +3 -13
- package/lib/components/booking/info/service/addService/utils.d.ts +2 -12
- package/lib/components/booking/info/service/addService/utils.js +10 -58
- package/lib/components/booking/info/service/editService/index.js +182 -425
- package/lib/components/booking/info/service/editService/index.less +13 -18
- package/lib/components/booking/info/service/serve.d.ts +0 -10
- package/lib/components/booking/info/service/serve.js +2 -7
- package/lib/components/booking/info/utils.d.ts +0 -20
- package/lib/components/booking/info/utils.js +0 -41
- package/lib/components/booking/locales.d.ts +0 -66
- package/lib/components/booking/locales.js +3 -69
- package/lib/components/booking/model.d.ts +1 -5
- package/lib/components/booking/model.js +2 -4
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -1
- package/lib/components/booking/utils.d.ts +3 -12
- package/lib/components/booking/utils.js +18 -89
- package/lib/components/eftpos/form/index.js +12 -6
- package/lib/components/eftpos/group/index.d.ts +1 -2
- package/lib/components/eftpos/group/index.js +0 -1
- package/lib/components/eftpos/hooks.d.ts +4 -4
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftpos/receipt/index.d.ts +24 -0
- package/lib/components/eftpos/receipt/index.js +88 -0
- package/lib/components/eftposPay/app.d.ts +11 -0
- package/lib/components/eftposPay/app.js +166 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
- package/lib/components/eftposPay/component/fail/index.js +1 -1
- package/lib/components/eftposPay/component/manual/index.js +19 -5
- package/lib/components/eftposPay/component/step/index.d.ts +6 -6
- package/lib/components/eftposPay/component/step/step.d.ts +4 -4
- package/lib/components/eftposPay/const.d.ts +27 -1
- package/lib/components/eftposPay/const.js +18 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/device.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +6 -0
- package/lib/components/eftposPay/helper.js +29 -4
- package/lib/components/eftposPay/hooks.d.ts +2 -1
- package/lib/components/eftposPay/hooks.js +8 -2
- package/lib/components/eftposPay/index.d.ts +1 -1
- package/lib/components/eftposPay/index.js +106 -144
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +15 -0
- package/lib/components/eftposPay/payo/config.js +33 -9
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tip.d.ts +10 -0
- package/lib/components/eftposPay/tip.js +159 -0
- package/lib/components/eftposPay/tip.less +9 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/lib/components/eftposPay/tyro/index.js +40 -9
- package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
- package/lib/components/eftposPay/windcave/windcave.js +29 -6
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/package.json +5 -5
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +0 -38
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/info/Provider.d.ts +0 -0
- package/es/components/booking/info/Provider.js +0 -54
- package/es/components/booking/info/dateRange/index.d.ts +0 -5
- package/es/components/booking/info/dateRange/index.js +0 -98
- package/es/components/booking/info/dateRange/index.less +0 -21
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/es/components/booking/info/pet/ChangePetModal/index.js +0 -134
- package/es/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -5
- package/es/components/booking/info/service/editService/BookingList/index.js +0 -39
- package/es/components/booking/info/service/editService/EditTabs/index.d.ts +0 -3
- package/es/components/booking/info/service/editService/EditTabs/index.js +0 -35
- package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +0 -11
- package/es/components/booking/info/service/serviceManager/distributeDiscount.js +0 -55
- package/es/components/booking/info/service/serviceManager/index.d.ts +0 -20
- package/es/components/booking/info/service/serviceManager/index.js +0 -277
- package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/es/components/booking/info/service/serviceManager/utils.js +0 -0
- package/es/components/booking/info/service2/Group/utils.d.ts +0 -14
- package/es/components/booking/info/service2/Group/utils.js +0 -146
- package/es/components/booking/info/service2/Lists.d.ts +0 -3
- package/es/components/booking/info/service2/Lists.js +0 -152
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/es/components/booking/info/service2/hooks/useSelectPet.js +0 -54
- package/es/components/booking/info/service2/index.d.ts +0 -6
- package/es/components/booking/info/service2/index.js +0 -57
- package/es/components/booking/info/service2/status.d.ts +0 -31
- package/es/components/booking/info/service2/status.js +0 -78
- package/es/components/booking/info/service2/utils.d.ts +0 -237
- package/es/components/booking/info/service2/utils.js +0 -1064
- package/es/components/booking/materiels/holder/index.d.ts +0 -7
- package/es/components/booking/materiels/holder/index.js +0 -51
- package/es/components/shoppingCart/Provider.d.ts +0 -3
- package/es/components/shoppingCart/Provider.js +0 -86
- package/es/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/Product.js +0 -68
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/index.js +0 -72
- package/es/components/shoppingCart/components/Cart/index.less +0 -68
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Empty/index.js +0 -14
- package/es/components/shoppingCart/components/Empty/index.less +0 -19
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Render/index.js +0 -69
- package/es/components/shoppingCart/components/Render/index.less +0 -2
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +0 -132
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useAddService.js +0 -23
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useClearCart.js +0 -59
- package/es/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useContext.js +0 -5
- package/es/components/shoppingCart/index.d.ts +0 -4
- package/es/components/shoppingCart/index.js +0 -24
- package/es/components/shoppingCart/locales.d.ts +0 -33
- package/es/components/shoppingCart/locales.js +0 -38
- package/es/components/shoppingCart/mock.d.ts +0 -40
- package/es/components/shoppingCart/mock.js +0 -40
- package/es/components/shoppingCart/status.d.ts +0 -2
- package/es/components/shoppingCart/status.js +0 -22
- package/es/components/shoppingCart/type.d.ts +0 -39
- package/es/components/shoppingCart/type.js +0 -1
- package/es/components/shoppingCart/utils.d.ts +0 -63
- package/es/components/shoppingCart/utils.js +0 -116
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +0 -60
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/info/Provider.d.ts +0 -0
- package/lib/components/booking/info/Provider.js +0 -0
- package/lib/components/booking/info/dateRange/index.d.ts +0 -5
- package/lib/components/booking/info/dateRange/index.js +0 -111
- package/lib/components/booking/info/dateRange/index.less +0 -21
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/lib/components/booking/info/pet/ChangePetModal/index.js +0 -121
- package/lib/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -5
- package/lib/components/booking/info/service/editService/BookingList/index.js +0 -55
- package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +0 -3
- package/lib/components/booking/info/service/editService/EditTabs/index.js +0 -75
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +0 -11
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +0 -70
- package/lib/components/booking/info/service/serviceManager/index.d.ts +0 -20
- package/lib/components/booking/info/service/serviceManager/index.js +0 -207
- package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
- package/lib/components/booking/info/service2/Group/utils.d.ts +0 -14
- package/lib/components/booking/info/service2/Group/utils.js +0 -142
- package/lib/components/booking/info/service2/Lists.d.ts +0 -3
- package/lib/components/booking/info/service2/Lists.js +0 -115
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +0 -50
- package/lib/components/booking/info/service2/index.d.ts +0 -6
- package/lib/components/booking/info/service2/index.js +0 -75
- package/lib/components/booking/info/service2/status.d.ts +0 -31
- package/lib/components/booking/info/service2/status.js +0 -81
- package/lib/components/booking/info/service2/utils.d.ts +0 -237
- package/lib/components/booking/info/service2/utils.js +0 -678
- package/lib/components/booking/materiels/holder/index.d.ts +0 -7
- package/lib/components/booking/materiels/holder/index.js +0 -65
- package/lib/components/shoppingCart/Provider.d.ts +0 -3
- package/lib/components/shoppingCart/Provider.js +0 -110
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/Product.js +0 -73
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/index.js +0 -77
- package/lib/components/shoppingCart/components/Cart/index.less +0 -68
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Empty/index.js +0 -43
- package/lib/components/shoppingCart/components/Empty/index.less +0 -19
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Render/index.js +0 -75
- package/lib/components/shoppingCart/components/Render/index.less +0 -2
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +0 -124
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useAddService.js +0 -55
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useClearCart.js +0 -66
- package/lib/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useContext.js +0 -31
- package/lib/components/shoppingCart/index.d.ts +0 -4
- package/lib/components/shoppingCart/index.js +0 -60
- package/lib/components/shoppingCart/locales.d.ts +0 -33
- package/lib/components/shoppingCart/locales.js +0 -56
- package/lib/components/shoppingCart/mock.d.ts +0 -40
- package/lib/components/shoppingCart/mock.js +0 -76
- package/lib/components/shoppingCart/status.d.ts +0 -2
- package/lib/components/shoppingCart/status.js +0 -60
- package/lib/components/shoppingCart/type.d.ts +0 -39
- package/lib/components/shoppingCart/type.js +0 -17
- package/lib/components/shoppingCart/utils.d.ts +0 -63
- package/lib/components/shoppingCart/utils.js +0 -86
- package/lowcode/shopping-cart/meta.ts +0 -98
|
@@ -37,7 +37,6 @@ __export(utils_exports, {
|
|
|
37
37
|
formatResource: () => formatResource,
|
|
38
38
|
formatTimes: () => formatTimes,
|
|
39
39
|
getCacheParams: () => getCacheParams,
|
|
40
|
-
getDays: () => getDays,
|
|
41
40
|
getDiscountTime: () => getDiscountTime,
|
|
42
41
|
getDuration: () => getDuration,
|
|
43
42
|
getEndDate: () => getEndDate,
|
|
@@ -60,7 +59,6 @@ __export(utils_exports, {
|
|
|
60
59
|
module.exports = __toCommonJS(utils_exports);
|
|
61
60
|
var import_dayjs = __toESM(require("dayjs"));
|
|
62
61
|
var import_utils = require("@pisell/utils");
|
|
63
|
-
var import_utils2 = require("./info/service2/utils");
|
|
64
62
|
var import_lodash = require("lodash");
|
|
65
63
|
var Request = class {
|
|
66
64
|
constructor() {
|
|
@@ -74,13 +72,10 @@ var Request = class {
|
|
|
74
72
|
}
|
|
75
73
|
};
|
|
76
74
|
var request = new Request();
|
|
77
|
-
var getDiscountTime = (service_times
|
|
78
|
-
if (!service_times
|
|
75
|
+
var getDiscountTime = (service_times) => {
|
|
76
|
+
if (!service_times) {
|
|
79
77
|
return "";
|
|
80
78
|
}
|
|
81
|
-
if (isDay) {
|
|
82
|
-
return `${service_times} ${import_utils.locales.getText("pisell2.text.day")(service_times)}`;
|
|
83
|
-
}
|
|
84
79
|
if (service_times < 60) {
|
|
85
80
|
return `${service_times} ${import_utils.locales.getText("pisell2.text.min")}`;
|
|
86
81
|
} else {
|
|
@@ -94,7 +89,7 @@ var getDiscountTime = (service_times, isDay) => {
|
|
|
94
89
|
return str;
|
|
95
90
|
}
|
|
96
91
|
};
|
|
97
|
-
var sliceDayIntoFiveMinutes = (config, locale
|
|
92
|
+
var sliceDayIntoFiveMinutes = (config, locale) => {
|
|
98
93
|
let _locale = locale;
|
|
99
94
|
let dayjsLocale = _locale === "en-US" || _locale === "en" ? "en" : "zh-cn";
|
|
100
95
|
import_dayjs.default.locale(dayjsLocale);
|
|
@@ -104,20 +99,6 @@ var sliceDayIntoFiveMinutes = (config, locale, isDay) => {
|
|
|
104
99
|
let timeSlices = [];
|
|
105
100
|
let durationSlicesBasedOnTime = [];
|
|
106
101
|
let currentTime = startTime;
|
|
107
|
-
if (isDay) {
|
|
108
|
-
let currentDay = 1;
|
|
109
|
-
while (currentDay <= 30) {
|
|
110
|
-
const timeLabel = currentTime.format("hh:mm A");
|
|
111
|
-
const timeValue = currentTime.format("HH:mm");
|
|
112
|
-
timeSlices.push({ label: timeLabel, value: timeValue });
|
|
113
|
-
durationSlicesBasedOnTime.push({
|
|
114
|
-
label: `${currentDay} ${import_utils.locales.getText("pisell2.text.day")(currentDay)}`,
|
|
115
|
-
value: currentDay
|
|
116
|
-
});
|
|
117
|
-
currentDay++;
|
|
118
|
-
}
|
|
119
|
-
return { timeSlices, durationSlicesBasedOnTime };
|
|
120
|
-
}
|
|
121
102
|
while (currentTime.isBefore(endTime)) {
|
|
122
103
|
const timeLabel = currentTime.format("hh:mm A");
|
|
123
104
|
const timeValue = currentTime.format("HH:mm");
|
|
@@ -270,23 +251,6 @@ var getResourceTimeIsUsable = (item, cacheItem) => {
|
|
|
270
251
|
return time;
|
|
271
252
|
};
|
|
272
253
|
var formatTimes = (resourceItem, cacheItem) => {
|
|
273
|
-
var _a;
|
|
274
|
-
if (((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.sub_type) === "days") {
|
|
275
|
-
const isResourceItem = (resourceItem == null ? void 0 : resourceItem.form_record_id) > 0;
|
|
276
|
-
let isMaxLimitRange = (resourceItem == null ? void 0 : resourceItem.sold_out) === 1;
|
|
277
|
-
let isDateRange = (resourceItem == null ? void 0 : resourceItem.available_status) === 1;
|
|
278
|
-
const isUsable = isDateRange && !isMaxLimitRange;
|
|
279
|
-
const usableTime = {
|
|
280
|
-
isMaxLimitRange,
|
|
281
|
-
isDateRange,
|
|
282
|
-
isUsable: isResourceItem ? isUsable : true
|
|
283
|
-
};
|
|
284
|
-
resourceItem._extend = {
|
|
285
|
-
...resourceItem._extend,
|
|
286
|
-
usableTime
|
|
287
|
-
};
|
|
288
|
-
return resourceItem;
|
|
289
|
-
}
|
|
290
254
|
let usableTimes = [];
|
|
291
255
|
let _resourceItem = { ...resourceItem };
|
|
292
256
|
_resourceItem.times = _resourceItem.times.map((time) => {
|
|
@@ -407,8 +371,8 @@ var getServiceTimes = (service) => {
|
|
|
407
371
|
endDate
|
|
408
372
|
};
|
|
409
373
|
};
|
|
410
|
-
var getErrorList = (resource, cacheItem
|
|
411
|
-
var _a, _b, _c
|
|
374
|
+
var getErrorList = (resource, cacheItem) => {
|
|
375
|
+
var _a, _b, _c;
|
|
412
376
|
if (!(cacheItem == null ? void 0 : cacheItem.id)) {
|
|
413
377
|
return [
|
|
414
378
|
{
|
|
@@ -431,21 +395,13 @@ var getErrorList = (resource, cacheItem, isDay) => {
|
|
|
431
395
|
type: "product"
|
|
432
396
|
});
|
|
433
397
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
endText = end_date ? end_date == null ? void 0 : end_date.format("YYYY-MM-DD") : "";
|
|
440
|
-
} else {
|
|
441
|
-
const { startDate, endDate } = getServiceTimes(cacheItem);
|
|
442
|
-
startText = startDate.format("hh:mm A");
|
|
443
|
-
endText = endDate.format("hh:mm A");
|
|
444
|
-
if ((0, import_dayjs.default)(endDate).isAfter(startDate, "day")) {
|
|
445
|
-
endText = import_utils.locales.getText("pisell1.text.tomorrow") + endText;
|
|
446
|
-
}
|
|
398
|
+
const { startDate, endDate } = getServiceTimes(cacheItem);
|
|
399
|
+
const startText = startDate.format("hh:mm A");
|
|
400
|
+
let endText = endDate.format("hh:mm A");
|
|
401
|
+
if ((0, import_dayjs.default)(endDate).isAfter(startDate, "day")) {
|
|
402
|
+
endText = import_utils.locales.getText("pisell1.text.tomorrow") + endText;
|
|
447
403
|
}
|
|
448
|
-
if (
|
|
404
|
+
if (!((_b = resource._extend) == null ? void 0 : _b.usableTime)) {
|
|
449
405
|
list.push({
|
|
450
406
|
label: import_utils.locales.getText("pisell1.text.resource-error-message-2")(
|
|
451
407
|
resource.labelText,
|
|
@@ -455,7 +411,7 @@ var getErrorList = (resource, cacheItem, isDay) => {
|
|
|
455
411
|
type: "time"
|
|
456
412
|
});
|
|
457
413
|
} else {
|
|
458
|
-
if (
|
|
414
|
+
if (!((_c = resource._extend) == null ? void 0 : _c.usableTime._extend.isMaxLimitRange)) {
|
|
459
415
|
list.push({
|
|
460
416
|
label: import_utils.locales.getText("pisell1.text.resource-error-message-3")(
|
|
461
417
|
resource.labelText,
|
|
@@ -470,15 +426,11 @@ var getErrorList = (resource, cacheItem, isDay) => {
|
|
|
470
426
|
return list;
|
|
471
427
|
};
|
|
472
428
|
var formatResource = (resourceItem, cacheItem, formatLabel) => {
|
|
473
|
-
var _a, _b, _c, _d;
|
|
474
429
|
let _resourceItem = { ...resourceItem };
|
|
475
430
|
_resourceItem = formatTimes(_resourceItem, cacheItem);
|
|
476
431
|
_resourceItem = formatResourceProducts(_resourceItem, cacheItem);
|
|
477
432
|
_resourceItem.labelText = _resourceItem.room_name || _resourceItem.name;
|
|
478
|
-
|
|
479
|
-
if (((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.sub_type) === "days") {
|
|
480
|
-
usable = ((_c = (_b = _resourceItem._extend) == null ? void 0 : _b.usableTime) == null ? void 0 : _c.isUsable) && ((_d = _resourceItem._extend) == null ? void 0 : _d.usableProduct);
|
|
481
|
-
}
|
|
433
|
+
const usable = _resourceItem._extend.usableTime && _resourceItem._extend.usableProduct;
|
|
482
434
|
_resourceItem.usable = usable;
|
|
483
435
|
if (formatLabel) {
|
|
484
436
|
_resourceItem.label = formatLabel(_resourceItem);
|
|
@@ -496,25 +448,14 @@ var getCacheParams = () => {
|
|
|
496
448
|
var deleteCacheParams = () => {
|
|
497
449
|
sessionStorage.removeItem("pisell2.booking.serviceParams");
|
|
498
450
|
};
|
|
499
|
-
var getDays = (cacheItem, type) => {
|
|
500
|
-
var _a, _b;
|
|
501
|
-
if (type === "days") {
|
|
502
|
-
const { start_date, end_date } = (0, import_utils2.formatDayDate)(cacheItem._extend);
|
|
503
|
-
return end_date.diff(start_date, "day");
|
|
504
|
-
}
|
|
505
|
-
let startDate = (0, import_dayjs.default)((_a = cacheItem._extend) == null ? void 0 : _a.start_date);
|
|
506
|
-
let endDate = (0, import_dayjs.default)((_b = cacheItem._extend) == null ? void 0 : _b.end_date);
|
|
507
|
-
return endDate.diff(startDate, type);
|
|
508
|
-
};
|
|
509
451
|
var getServerItemExtend = (state, cacheItem, timeObj) => {
|
|
510
452
|
var _a;
|
|
511
453
|
if (!cacheItem.new && cacheItem._extend.endDate) {
|
|
512
454
|
return cacheItem._extend;
|
|
513
455
|
}
|
|
514
|
-
|
|
515
|
-
let lastServer = isDay ? false : getLastServer(state.service.value);
|
|
456
|
+
let lastServer = getLastServer(state.service.value);
|
|
516
457
|
let _extend = {
|
|
517
|
-
duration:
|
|
458
|
+
duration: findNextDuration(
|
|
518
459
|
cacheItem.duration,
|
|
519
460
|
timeObj.durationSlicesBasedOnTime,
|
|
520
461
|
(_a = cacheItem == null ? void 0 : cacheItem.duration) == null ? void 0 : _a.value
|
|
@@ -560,30 +501,19 @@ var getServerItemExtend = (state, cacheItem, timeObj) => {
|
|
|
560
501
|
..._extend,
|
|
561
502
|
...cacheItem._extend
|
|
562
503
|
};
|
|
563
|
-
if (isDay) {
|
|
564
|
-
_extend.end_date = (0, import_dayjs.default)(_extend.start_date).add(_extend.duration, "day");
|
|
565
|
-
const { start_date, end_date } = (0, import_utils2.formatDayDate)(_extend);
|
|
566
|
-
_extend = { ..._extend, start_date, startDate: start_date, end_date, endDate: end_date };
|
|
567
|
-
}
|
|
568
504
|
return _extend;
|
|
569
505
|
};
|
|
570
506
|
var getProductTotalPrice = (item) => {
|
|
571
507
|
var _a;
|
|
572
|
-
let price =
|
|
508
|
+
let price = 0;
|
|
509
|
+
price += Number(item._extend.price);
|
|
573
510
|
let other = (_a = item._extend) == null ? void 0 : _a.other;
|
|
574
|
-
if (other == null ? void 0 : other.product_variant_id) {
|
|
575
|
-
price = Number(other == null ? void 0 : other.price);
|
|
576
|
-
}
|
|
577
511
|
if (other == null ? void 0 : other.bundle) {
|
|
578
512
|
price = other == null ? void 0 : other.bundle.reduce((accumulator, currentValue) => {
|
|
579
513
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
580
514
|
}, price);
|
|
581
515
|
}
|
|
582
|
-
|
|
583
|
-
price = other == null ? void 0 : other.option.reduce((accumulator, currentValue) => {
|
|
584
|
-
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
585
|
-
}, price);
|
|
586
|
-
}
|
|
516
|
+
price = price;
|
|
587
517
|
return price;
|
|
588
518
|
};
|
|
589
519
|
var getDuration = (duration) => {
|
|
@@ -647,7 +577,6 @@ var getIsEdit = (state) => {
|
|
|
647
577
|
formatResource,
|
|
648
578
|
formatTimes,
|
|
649
579
|
getCacheParams,
|
|
650
|
-
getDays,
|
|
651
580
|
getDiscountTime,
|
|
652
581
|
getDuration,
|
|
653
582
|
getEndDate,
|
|
@@ -37,6 +37,7 @@ var import_react = __toESM(require("react"));
|
|
|
37
37
|
var import_antd = require("antd");
|
|
38
38
|
var import_group = require("../group");
|
|
39
39
|
var import_surcharge = __toESM(require("../surcharge"));
|
|
40
|
+
var import_receipt = __toESM(require("../receipt"));
|
|
40
41
|
var import_deviceList = __toESM(require("../deviceList"));
|
|
41
42
|
var Mapping = {
|
|
42
43
|
Input: import_antd.Input,
|
|
@@ -58,7 +59,8 @@ var Mapping = {
|
|
|
58
59
|
};
|
|
59
60
|
var CustomMapping = {
|
|
60
61
|
Surcharge: import_surcharge.default,
|
|
61
|
-
DeviceList: import_deviceList.default
|
|
62
|
+
DeviceList: import_deviceList.default,
|
|
63
|
+
Receipt: import_receipt.default
|
|
62
64
|
};
|
|
63
65
|
var CustomFormItem = ({
|
|
64
66
|
formItemList,
|
|
@@ -72,27 +74,27 @@ var CustomFormItem = ({
|
|
|
72
74
|
{
|
|
73
75
|
formItemList: item.children,
|
|
74
76
|
onChange,
|
|
75
|
-
key: item.name ? item.name
|
|
77
|
+
key: item.name ? `${item.name}${level}` : `${Component}${index}${level}`,
|
|
76
78
|
level: level + 1
|
|
77
79
|
}
|
|
78
80
|
);
|
|
79
81
|
}
|
|
80
82
|
if (typeof Component === "object") {
|
|
81
|
-
return /* @__PURE__ */ import_react.default.createElement(Component, { ...item, key: item.name
|
|
83
|
+
return /* @__PURE__ */ import_react.default.createElement(Component, { ...item, key: `${item.name}${level}` });
|
|
82
84
|
}
|
|
83
85
|
if (Mapping[Component]) {
|
|
84
86
|
const Comm = Mapping[Component];
|
|
85
87
|
const { input, ...formItemProps } = item;
|
|
86
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps, key: item.name
|
|
88
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps, key: `${item.name}${level}` }, /* @__PURE__ */ import_react.default.createElement(Comm, { ...input }));
|
|
87
89
|
}
|
|
88
90
|
if (Mapping[Component]) {
|
|
89
91
|
const Comm = Mapping[Component];
|
|
90
92
|
const { input, ...formItemProps } = item;
|
|
91
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps, key: item.name
|
|
93
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { ...formItemProps, key: `${item.name}${level}` }, /* @__PURE__ */ import_react.default.createElement(Comm, { ...input }));
|
|
92
94
|
}
|
|
93
95
|
if (CustomMapping[Component]) {
|
|
94
96
|
const Comm = CustomMapping[Component];
|
|
95
|
-
return /* @__PURE__ */ import_react.default.createElement(Comm, { ...item, key: item.name
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement(Comm, { ...item, key: `${item.name}${level}` });
|
|
96
98
|
}
|
|
97
99
|
throw TypeError(
|
|
98
100
|
`pos物料库 输入组件类型 ${Component} 无法映射,请正确传入组件类型`
|
|
@@ -104,6 +106,10 @@ var helpMapping = {
|
|
|
104
106
|
Surcharge: {
|
|
105
107
|
getCommName: import_surcharge.getCommName,
|
|
106
108
|
getCommDefaultVal: import_surcharge.getCommDefaultVal
|
|
109
|
+
},
|
|
110
|
+
Receipt: {
|
|
111
|
+
getCommName: import_receipt.getCommName,
|
|
112
|
+
getCommDefaultVal: import_receipt.getCommDefaultVal
|
|
107
113
|
}
|
|
108
114
|
};
|
|
109
115
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RadioGroupProps } from 'antd';
|
|
3
3
|
export declare const CheckboxGroup: ({ direction, options, ...props }: any) => React.JSX.Element;
|
|
4
|
-
export declare const RadioGroup: ({ direction, options,
|
|
4
|
+
export declare const RadioGroup: ({ direction, options, ...props }: RadioGroupProps & {
|
|
5
5
|
direction?: "vertical" | undefined;
|
|
6
|
-
component: string;
|
|
7
6
|
}) => React.JSX.Element;
|
|
@@ -6,8 +6,8 @@ import { Eftpos } from './const';
|
|
|
6
6
|
* @Date: 2024-08-20 13:23
|
|
7
7
|
*/
|
|
8
8
|
export declare const usePairTerminalo: (type: Eftpos, params: {
|
|
9
|
-
url?: string;
|
|
10
|
-
version?: string;
|
|
9
|
+
url?: string | undefined;
|
|
10
|
+
version?: string | undefined;
|
|
11
11
|
}) => ({ mid, tid, apiKey, posProductData, }: {
|
|
12
12
|
mid: string;
|
|
13
13
|
tid: string;
|
|
@@ -29,6 +29,6 @@ export declare const usePairTerminalo: (type: Eftpos, params: {
|
|
|
29
29
|
* @Date: 2024-08-19 18:36
|
|
30
30
|
*/
|
|
31
31
|
export declare const useTyro: (params: {
|
|
32
|
-
url?: string;
|
|
33
|
-
version?: string;
|
|
32
|
+
url?: string | undefined;
|
|
33
|
+
version?: string | undefined;
|
|
34
34
|
}) => readonly [import("react").MutableRefObject<any>, boolean];
|
|
@@ -73,7 +73,7 @@ var PosTabs = (0, import_react.forwardRef)(
|
|
|
73
73
|
{
|
|
74
74
|
className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
|
|
75
75
|
},
|
|
76
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
76
|
+
/* @__PURE__ */ import_react.default.createElement(import_apiKey.default, { color: active2 ? "#fff" : "#98A2B3" })
|
|
77
77
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
@@ -90,7 +90,7 @@ var PosTabs = (0, import_react.forwardRef)(
|
|
|
90
90
|
{
|
|
91
91
|
className: `pisell-lowcode__pos_circle ${active2 ? "active" : ""}`
|
|
92
92
|
},
|
|
93
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
93
|
+
/* @__PURE__ */ import_react.default.createElement(import_device2.default, { color: active2 ? "#fff" : "#98A2B3" })
|
|
94
94
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
95
95
|
"span",
|
|
96
96
|
{
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 自定义组件设置
|
|
4
|
+
* @description: 自定义组件设置
|
|
5
|
+
* @param {any} commConfig 当前组件配置
|
|
6
|
+
* @param {string} name 上游name(用于嵌套 xxx:{yyy:''})
|
|
7
|
+
* @return {*}
|
|
8
|
+
* @Author: hongbing.wang
|
|
9
|
+
* @Date: 2024-08-20 11:10
|
|
10
|
+
*/
|
|
11
|
+
export declare const getCommName: (commConfig: any, name: string[]) => any;
|
|
12
|
+
/**
|
|
13
|
+
* @title: 自定义组件结果设置
|
|
14
|
+
* @description: 自定义组件结果设置
|
|
15
|
+
* @param {any} commConfig 当前组件配置
|
|
16
|
+
* @return {*}
|
|
17
|
+
* @Author: hongbing.wang
|
|
18
|
+
* @Date: 2024-08-20 11:11
|
|
19
|
+
*/
|
|
20
|
+
export declare const getCommDefaultVal: (commConfig: any) => {
|
|
21
|
+
[x: number]: any;
|
|
22
|
+
};
|
|
23
|
+
declare const _default: (props: any) => React.JSX.Element;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/eftpos/receipt/index.tsx
|
|
30
|
+
var receipt_exports = {};
|
|
31
|
+
__export(receipt_exports, {
|
|
32
|
+
default: () => receipt_default,
|
|
33
|
+
getCommDefaultVal: () => getCommDefaultVal,
|
|
34
|
+
getCommName: () => getCommName
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(receipt_exports);
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_antd = require("antd");
|
|
39
|
+
var import_group = require("../group");
|
|
40
|
+
var getCommName = (commConfig, name) => {
|
|
41
|
+
commConfig.receipts.__sourceName = commConfig.receipts.name;
|
|
42
|
+
commConfig.receiptList.__sourceName = commConfig.receiptList.name;
|
|
43
|
+
commConfig.receipts.name = name.length > 0 ? [...name, commConfig.receipts.name] : commConfig.receipts.name;
|
|
44
|
+
commConfig.receiptList.name = name.length > 0 ? [...name, commConfig.receiptList.name] : commConfig.receiptList.name;
|
|
45
|
+
return commConfig;
|
|
46
|
+
};
|
|
47
|
+
var getCommDefaultVal = (commConfig) => {
|
|
48
|
+
const receipts = commConfig.receipts.input.defaultValue;
|
|
49
|
+
const receiptList = commConfig.receiptList.input.defaultValue;
|
|
50
|
+
console.log("receipts = ", receipts);
|
|
51
|
+
return {
|
|
52
|
+
[commConfig.receipts.__sourceName]: typeof receipts === "undefined" ? true : receipts,
|
|
53
|
+
[commConfig.receiptList.__sourceName]: typeof receiptList === "undefined" ? ["merchant", "customer"] : receiptList
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
var receipt_default = (props) => {
|
|
57
|
+
const { receipts, receiptList } = props;
|
|
58
|
+
const [receiptsInput, receiptsOther] = (0, import_react.useMemo)(() => {
|
|
59
|
+
const { input, ...other } = receipts;
|
|
60
|
+
return [input, other];
|
|
61
|
+
}, [receipts]);
|
|
62
|
+
const [receiptListInput, receiptListOther] = (0, import_react.useMemo)(() => {
|
|
63
|
+
const { input, ...other } = receiptList;
|
|
64
|
+
return [input, other];
|
|
65
|
+
}, [receipts]);
|
|
66
|
+
const [type, setType] = (0, import_react.useState)(receiptsInput.defaultValue);
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { style: { marginBottom: "12px" }, ...receiptsOther }, /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
import_group.RadioGroup,
|
|
69
|
+
{
|
|
70
|
+
...receiptsInput,
|
|
71
|
+
onChange: (event) => {
|
|
72
|
+
setType(event.target.value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
)), /* @__PURE__ */ import_react.default.createElement(
|
|
76
|
+
import_antd.Form.Item,
|
|
77
|
+
{
|
|
78
|
+
...receiptListOther,
|
|
79
|
+
style: type ? { marginLeft: "24px", display: "none" } : { marginLeft: "24px" }
|
|
80
|
+
},
|
|
81
|
+
/* @__PURE__ */ import_react.default.createElement(import_group.CheckboxGroup, { ...receiptListInput })
|
|
82
|
+
));
|
|
83
|
+
};
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
getCommDefaultVal,
|
|
87
|
+
getCommName
|
|
88
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PosProps, RouteType } from './const';
|
|
3
|
+
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
|
|
4
|
+
action: RouteType;
|
|
5
|
+
device_number: string | number;
|
|
6
|
+
api: ReturnType<PosProps['getApi']>;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
channel?: string | undefined;
|
|
9
|
+
formatAmount(amount: number | string, precision: number, symbol: string): string;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export default App;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/eftposPay/app.tsx
|
|
30
|
+
var app_exports = {};
|
|
31
|
+
__export(app_exports, {
|
|
32
|
+
default: () => app_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(app_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ahooks = require("ahooks");
|
|
37
|
+
var import_amount = __toESM(require("./amount"));
|
|
38
|
+
var import_const = require("./const");
|
|
39
|
+
var import_device = __toESM(require("./device"));
|
|
40
|
+
var import_pay = __toESM(require("./pay"));
|
|
41
|
+
var import_store = require("./store");
|
|
42
|
+
var App = ({
|
|
43
|
+
action,
|
|
44
|
+
api,
|
|
45
|
+
device_number,
|
|
46
|
+
terminal,
|
|
47
|
+
tyroUrl,
|
|
48
|
+
tyroVersion,
|
|
49
|
+
onChangeParams,
|
|
50
|
+
isMobile,
|
|
51
|
+
channel,
|
|
52
|
+
formatAmount = (number, precision, symbol) => `${symbol}${number}`,
|
|
53
|
+
...props
|
|
54
|
+
}) => {
|
|
55
|
+
const data = (0, import_store.useContextData)();
|
|
56
|
+
const dispatch = (0, import_store.useDispatch)();
|
|
57
|
+
const [current, setCurrent] = (0, import_react.useState)(action);
|
|
58
|
+
const statusRef = (0, import_react.useRef)(data.status);
|
|
59
|
+
const network = (0, import_react.useMemo)(
|
|
60
|
+
() => typeof terminal.network === "boolean" ? terminal.network : true,
|
|
61
|
+
[terminal == null ? void 0 : terminal.network]
|
|
62
|
+
);
|
|
63
|
+
const { online } = (0, import_ahooks.useNetwork)();
|
|
64
|
+
const netRef = (0, import_react.useRef)([network, online]);
|
|
65
|
+
const net = (0, import_react.useMemo)(() => {
|
|
66
|
+
let networkChange = false, onlineChange = false;
|
|
67
|
+
if (netRef.current[0] !== network) {
|
|
68
|
+
netRef.current[0] = network;
|
|
69
|
+
networkChange = true;
|
|
70
|
+
}
|
|
71
|
+
if (netRef.current[1] !== online) {
|
|
72
|
+
netRef.current[1] = online;
|
|
73
|
+
onlineChange = true;
|
|
74
|
+
}
|
|
75
|
+
if (networkChange) {
|
|
76
|
+
return network;
|
|
77
|
+
}
|
|
78
|
+
return online;
|
|
79
|
+
}, [network, online]);
|
|
80
|
+
(0, import_react.useEffect)(() => {
|
|
81
|
+
statusRef.current = data.status;
|
|
82
|
+
}, [data.status]);
|
|
83
|
+
const client = (0, import_react.useMemo)(() => {
|
|
84
|
+
if (channel === "kiosk") {
|
|
85
|
+
return import_const.ClientEnum.User;
|
|
86
|
+
}
|
|
87
|
+
return import_const.ClientEnum.Merchant;
|
|
88
|
+
}, [channel]);
|
|
89
|
+
(0, import_react.useEffect)(() => {
|
|
90
|
+
dispatch((0, import_store.updateClient)(client));
|
|
91
|
+
}, [client]);
|
|
92
|
+
(0, import_react.useEffect)(() => {
|
|
93
|
+
onChangeParams && onChangeParams({
|
|
94
|
+
...data,
|
|
95
|
+
...data.eftpos === "tyro" ? { custom: { ...data.custom, btnList: [], list: [] } } : {},
|
|
96
|
+
form: import_const.RestoreEumn.Restore
|
|
97
|
+
});
|
|
98
|
+
}, [data, onChangeParams]);
|
|
99
|
+
const onChange = (0, import_react.useCallback)(
|
|
100
|
+
(status, params, other) => {
|
|
101
|
+
if (status === "page" && typeof params === "string") {
|
|
102
|
+
if (["amount", "deviceList", "pay"].includes(params)) {
|
|
103
|
+
setCurrent(params);
|
|
104
|
+
dispatch((0, import_store.updateState)({ action: params }));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
console.log("状态切换 = ", status, params, other);
|
|
108
|
+
props.onChangeStatus(status, params, other);
|
|
109
|
+
},
|
|
110
|
+
[]
|
|
111
|
+
);
|
|
112
|
+
const onClose = () => {
|
|
113
|
+
onChange("fail", {
|
|
114
|
+
number: data.number,
|
|
115
|
+
uniquePaymentNumber: data.number,
|
|
116
|
+
device: data.device,
|
|
117
|
+
order_id: data.order_id
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
if (current === import_const.RouteEnum.DeviceList) {
|
|
121
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
122
|
+
import_device.default,
|
|
123
|
+
{
|
|
124
|
+
api,
|
|
125
|
+
onChange,
|
|
126
|
+
onClose,
|
|
127
|
+
isMobile,
|
|
128
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
129
|
+
net,
|
|
130
|
+
device_number,
|
|
131
|
+
formatAmount,
|
|
132
|
+
client
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
if (current === import_const.RouteEnum.Amount) {
|
|
137
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
138
|
+
import_amount.default,
|
|
139
|
+
{
|
|
140
|
+
onChange,
|
|
141
|
+
onClose,
|
|
142
|
+
formatAmount,
|
|
143
|
+
isMobile,
|
|
144
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
145
|
+
net,
|
|
146
|
+
client
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
151
|
+
import_pay.default,
|
|
152
|
+
{
|
|
153
|
+
api,
|
|
154
|
+
tyroUrl,
|
|
155
|
+
tyroVersion,
|
|
156
|
+
onChange,
|
|
157
|
+
className: isMobile ? "pisell-lowcode__eft-pay-terminal" : "",
|
|
158
|
+
terminal,
|
|
159
|
+
isMobile,
|
|
160
|
+
net,
|
|
161
|
+
formatAmount,
|
|
162
|
+
client
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
var app_default = App;
|
|
@@ -101,7 +101,7 @@ var failCustom_default = ({ className = "", isMobile, onChange }) => {
|
|
|
101
101
|
onChange("print", [], "print_on_timeout");
|
|
102
102
|
};
|
|
103
103
|
const onClose = () => {
|
|
104
|
-
onChange("fail", { number, device, order_id });
|
|
104
|
+
onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
|
|
105
105
|
};
|
|
106
106
|
(0, import_ahooks.useMount)(() => {
|
|
107
107
|
if ((failCustom == null ? void 0 : failCustom.status) === "fail") {
|
|
@@ -107,7 +107,7 @@ var fail_default = ({ onChange, className = "", isMobile }) => {
|
|
|
107
107
|
onChange("print", [], "print_on_timeout");
|
|
108
108
|
};
|
|
109
109
|
const onClose = () => {
|
|
110
|
-
onChange("fail", { number, device, order_id });
|
|
110
|
+
onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
|
|
111
111
|
};
|
|
112
112
|
(0, import_ahooks.useMount)(() => {
|
|
113
113
|
if (steps[step].status === "fail") {
|