@pisell/private-materials 6.3.139 → 6.3.141
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 +5 -5
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +6 -6
- package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/booking/forms/footer.d.ts +1 -0
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/es/components/booking/hooks/useClearCart.d.ts +1 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/notes/NoteBlock/index.d.ts +1 -0
- package/es/components/ecocup/components/AddCustomerModal/index.d.ts +1 -0
- package/es/components/ecocup/components/CupActionList/index.d.ts +1 -0
- package/es/components/ecocup/components/CupActionModal/index.d.ts +1 -0
- package/es/components/ecocup/components/CupStatusModal/index.d.ts +1 -0
- package/es/components/ecocup/components/CustomerAndCupModal/index.d.ts +1 -0
- package/es/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/es/components/ecocup/components/SearchBar/index.d.ts +1 -0
- package/es/components/ecocup/components/SettingModal/index.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useColumns.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/es/components/ecocup/cupList/index.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/es/components/scanOrder/components/Cart/index.js +127 -56
- package/es/components/scanOrder/components/Cart/index.less +11 -5
- package/es/components/scanOrder/components/Check/index.js +85 -80
- package/es/components/scanOrder/components/Content/index.js +356 -164
- package/es/components/scanOrder/components/Menu/index.d.ts +11 -0
- package/es/components/scanOrder/components/Menu/index.js +140 -169
- package/es/components/scanOrder/components/Voucher/index.d.ts +8 -0
- package/es/components/scanOrder/components/Voucher/index.js +250 -0
- package/es/components/scanOrder/context.js +38 -13
- package/es/components/scanOrder/hooks.js +4 -1
- package/es/components/scanOrder/locales.d.ts +65 -0
- package/es/components/scanOrder/locales.js +65 -0
- package/es/components/scanOrder/types.d.ts +10 -0
- package/es/components/scanOrder/utils/toShoppingCartProducts.d.ts +1 -0
- package/es/components/scanOrder/utils/toShoppingCartProducts.js +137 -9
- package/es/components/scanOrder/utils/transformProductDetail.js +21 -4
- package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
- package/es/components/venueBooking/components/Addons/index.js +42 -33
- package/es/components/venueBooking/components/Cart/index.js +26 -14
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/plus/orderList/components/HandleActions.d.ts +1 -0
- package/es/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/es/plus/orderList/components/Reset.d.ts +1 -0
- package/es/plus/orderList/components/Toolbar.d.ts +1 -0
- package/es/plus/pisellReservation/floorMap/useReservationFloorPlan.d.ts +1 -0
- package/es/plus/saasAttendance/settings/components/membersField/index.d.ts +1 -0
- package/es/plus/saasRegister/components/VertifyEmail.d.ts +1 -0
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +1 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +1 -0
- package/es/pro/pisellPhoneKeyboard/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/booking/forms/footer.d.ts +1 -0
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/notes/NoteBlock/index.d.ts +1 -0
- package/lib/components/ecocup/components/AddCustomerModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/CupActionList/index.d.ts +1 -0
- package/lib/components/ecocup/components/CupActionModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/CupStatusModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/CustomerAndCupModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/lib/components/ecocup/components/SearchBar/index.d.ts +1 -0
- package/lib/components/ecocup/components/SettingModal/index.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useColumns.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/lib/components/ecocup/cupList/index.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/lib/components/scanOrder/components/Cart/index.js +79 -24
- package/lib/components/scanOrder/components/Cart/index.less +11 -5
- package/lib/components/scanOrder/components/Check/index.js +28 -23
- package/lib/components/scanOrder/components/Content/index.js +136 -42
- package/lib/components/scanOrder/components/Menu/index.d.ts +11 -0
- package/lib/components/scanOrder/components/Menu/index.js +23 -36
- package/lib/components/scanOrder/components/Voucher/index.d.ts +8 -0
- package/lib/components/scanOrder/components/Voucher/index.js +162 -0
- package/lib/components/scanOrder/context.js +21 -10
- package/lib/components/scanOrder/hooks.js +4 -1
- package/lib/components/scanOrder/locales.d.ts +65 -0
- package/lib/components/scanOrder/locales.js +65 -0
- package/lib/components/scanOrder/types.d.ts +10 -0
- package/lib/components/scanOrder/utils/toShoppingCartProducts.d.ts +1 -0
- package/lib/components/scanOrder/utils/toShoppingCartProducts.js +88 -6
- package/lib/components/scanOrder/utils/transformProductDetail.js +10 -3
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
- package/lib/components/venueBooking/components/Addons/index.js +15 -8
- package/lib/components/venueBooking/components/Cart/index.js +8 -2
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
- package/lib/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/lib/plus/orderList/components/Reset.d.ts +1 -0
- package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
- package/lib/plus/pisellReservation/floorMap/useReservationFloorPlan.d.ts +1 -0
- package/lib/plus/saasAttendance/settings/components/membersField/index.d.ts +1 -0
- package/lib/plus/saasRegister/components/VertifyEmail.d.ts +1 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +1 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +1 -0
- package/lib/pro/pisellPhoneKeyboard/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -37,9 +37,12 @@ var import_materials = require("@pisell/materials");
|
|
|
37
37
|
var import_utils = require("@pisell/utils");
|
|
38
38
|
var import_shoppingCart = __toESM(require("../../../shoppingCart"));
|
|
39
39
|
var import_context = require("../../context");
|
|
40
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
40
41
|
var import_subTotal = __toESM(require("../../../subTotal"));
|
|
42
|
+
var import_Voucher = __toESM(require("../Voucher"));
|
|
41
43
|
var import_index = require("./index.less");
|
|
42
44
|
function Cart(props) {
|
|
45
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43
46
|
const {
|
|
44
47
|
open,
|
|
45
48
|
onCancel,
|
|
@@ -52,16 +55,24 @@ function Cart(props) {
|
|
|
52
55
|
disabled = false
|
|
53
56
|
} = props;
|
|
54
57
|
const { runModuleAction, refreshViewModel, scanOrderModule } = (0, import_context.useScanOrderContext)();
|
|
58
|
+
const engineContext = (0, import_useEngineContext.default)();
|
|
59
|
+
const businessUtils = (_b = (_a = engineContext == null ? void 0 : engineContext.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.businessUtils;
|
|
60
|
+
const locale = ((_d = (_c = engineContext == null ? void 0 : engineContext.engine) == null ? void 0 : _c.props) == null ? void 0 : _d.locale) || "en";
|
|
61
|
+
const hasGoodPassApp = !!((_e = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _e.call(businessUtils, "goodpass"));
|
|
62
|
+
const hasDiscountCardApp = !!((_f = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _f.call(businessUtils, "discountcard"));
|
|
63
|
+
const showVoucher = hasGoodPassApp || hasDiscountCardApp;
|
|
55
64
|
const isVisible = embedded || open;
|
|
56
65
|
if (!isVisible) return null;
|
|
57
66
|
const [dineInConfig, setDineInConfig] = (0, import_react.useState)(null);
|
|
58
|
-
const getConfig = async () => {
|
|
67
|
+
const getConfig = (0, import_react.useCallback)(async () => {
|
|
59
68
|
const otherParams = await runModuleAction("getOtherParams");
|
|
60
69
|
console.log("otherParams >>>>> ", otherParams);
|
|
61
70
|
const dineInConfig2 = (otherParams == null ? void 0 : otherParams.dineInConfig) ?? {};
|
|
62
71
|
setDineInConfig(dineInConfig2);
|
|
63
|
-
};
|
|
64
|
-
|
|
72
|
+
}, [runModuleAction]);
|
|
73
|
+
(0, import_react.useEffect)(() => {
|
|
74
|
+
getConfig();
|
|
75
|
+
}, []);
|
|
65
76
|
const isShowNote = (0, import_react.useMemo)(() => {
|
|
66
77
|
return dineInConfig == null ? void 0 : dineInConfig["sale.allow_item_notes"];
|
|
67
78
|
}, [dineInConfig]);
|
|
@@ -75,11 +86,11 @@ function Cart(props) {
|
|
|
75
86
|
import_utils.locales.getText("pisell2.scan.order.action.confirm.order") || import_utils.locales.getText("pisell2.event.confirm") || "Confirm"
|
|
76
87
|
);
|
|
77
88
|
const subTotalList = (0, import_react.useMemo)(() => {
|
|
78
|
-
var
|
|
89
|
+
var _a2;
|
|
79
90
|
const subTotal = Number((summary == null ? void 0 : summary.product_amount) ?? 0);
|
|
80
91
|
const totalTaxFee = Number((summary == null ? void 0 : summary.tax_fee) ?? 0);
|
|
81
92
|
const total = Number((summary == null ? void 0 : summary.total_amount) ?? (summary == null ? void 0 : summary.expect_amount) ?? 0);
|
|
82
|
-
const tempOrder = (
|
|
93
|
+
const tempOrder = (_a2 = scanOrderModule == null ? void 0 : scanOrderModule.getTempOrder) == null ? void 0 : _a2.call(scanOrderModule);
|
|
83
94
|
const tempSummary = (tempOrder == null ? void 0 : tempOrder.summary) || {};
|
|
84
95
|
const taxTitle = String(
|
|
85
96
|
(tempSummary == null ? void 0 : tempSummary.tax_title) || (summary == null ? void 0 : summary.tax_title) || "GST/Tax"
|
|
@@ -89,11 +100,21 @@ function Cart(props) {
|
|
|
89
100
|
const isPriceIncludeTax = Boolean(
|
|
90
101
|
(tempSummary == null ? void 0 : tempSummary.is_price_include_tax) ?? (tempSummary == null ? void 0 : tempSummary.isPriceIncludeTax) ?? (summary == null ? void 0 : summary.is_price_include_tax)
|
|
91
102
|
);
|
|
103
|
+
const surchargeItems = ((summary == null ? void 0 : summary.surcharges) || []).filter((s) => Number(s == null ? void 0 : s.amount) > 0).map((s) => {
|
|
104
|
+
const labelObj = (s == null ? void 0 : s.label) || (s == null ? void 0 : s.name) || {};
|
|
105
|
+
const label = labelObj[locale] || labelObj.en || labelObj.original || (s == null ? void 0 : s.key) || "";
|
|
106
|
+
return {
|
|
107
|
+
key: (s == null ? void 0 : s.key) || `surcharge_${s == null ? void 0 : s.surcharge_id}`,
|
|
108
|
+
label,
|
|
109
|
+
value: Number(s == null ? void 0 : s.amount)
|
|
110
|
+
};
|
|
111
|
+
});
|
|
92
112
|
return [
|
|
93
113
|
{
|
|
94
114
|
key: "sub_total",
|
|
95
115
|
value: Number.isNaN(subTotal) ? 0 : subTotal
|
|
96
116
|
},
|
|
117
|
+
...surchargeItems,
|
|
97
118
|
{
|
|
98
119
|
key: "tax",
|
|
99
120
|
value: Number.isNaN(totalTaxFee) ? 0 : totalTaxFee,
|
|
@@ -111,25 +132,58 @@ function Cart(props) {
|
|
|
111
132
|
bold: true
|
|
112
133
|
}
|
|
113
134
|
];
|
|
114
|
-
}, [summary, scanOrderModule]);
|
|
135
|
+
}, [summary, scanOrderModule, locale]);
|
|
115
136
|
const handleCartChange = async (item, type) => {
|
|
116
|
-
if (type
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
await runModuleAction("removeProductFromOrder", {
|
|
137
|
+
if (type === "note") {
|
|
138
|
+
const productId = (item == null ? void 0 : item.product_id) ?? (item == null ? void 0 : item.id) ?? null;
|
|
139
|
+
const productVariantId = Number((item == null ? void 0 : item.product_variant_id) ?? 0);
|
|
140
|
+
const identityKey = item == null ? void 0 : item.identity_key;
|
|
141
|
+
if (productId === null && Number.isNaN(productVariantId)) return;
|
|
142
|
+
const identity = {
|
|
123
143
|
product_id: productId,
|
|
124
|
-
product_variant_id: Number.isNaN(productVariantId) ? 0 : productVariantId
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
144
|
+
product_variant_id: Number.isNaN(productVariantId) ? 0 : productVariantId
|
|
145
|
+
};
|
|
146
|
+
if (typeof identityKey === "string" && identityKey.length > 0) {
|
|
147
|
+
identity.identity_key = identityKey;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
await runModuleAction(
|
|
151
|
+
"setOrderProductLineNote",
|
|
152
|
+
identity,
|
|
153
|
+
String((item == null ? void 0 : item.note) ?? "")
|
|
154
|
+
);
|
|
155
|
+
await refreshViewModel();
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error("[scanOrder] setOrderProductLineNote failed", {
|
|
158
|
+
error,
|
|
159
|
+
item
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
} else if (type === "delete") {
|
|
164
|
+
const productId = (item == null ? void 0 : item.product_id) ?? (item == null ? void 0 : item.id) ?? null;
|
|
165
|
+
const productVariantId = Number((item == null ? void 0 : item.product_variant_id) ?? 0);
|
|
166
|
+
const identityKey = item == null ? void 0 : item.identity_key;
|
|
167
|
+
if (productId === null && Number.isNaN(productVariantId)) return;
|
|
168
|
+
if (typeof identityKey !== "string" || identityKey.length === 0) {
|
|
169
|
+
console.error("[scanOrder] removeProductFromOrder skipped: missing identity_key", {
|
|
170
|
+
item
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
await runModuleAction("removeProductFromOrder", {
|
|
176
|
+
product_id: productId,
|
|
177
|
+
product_variant_id: Number.isNaN(productVariantId) ? 0 : productVariantId,
|
|
178
|
+
identity_key: identityKey
|
|
179
|
+
});
|
|
180
|
+
await refreshViewModel();
|
|
181
|
+
} catch (error) {
|
|
182
|
+
console.error("[scanOrder] removeProductFromOrder failed", {
|
|
183
|
+
error,
|
|
184
|
+
item
|
|
185
|
+
});
|
|
186
|
+
}
|
|
133
187
|
}
|
|
134
188
|
};
|
|
135
189
|
(0, import_react.useEffect)(() => {
|
|
@@ -157,8 +211,9 @@ function Cart(props) {
|
|
|
157
211
|
onChange: handleCartChange
|
|
158
212
|
}
|
|
159
213
|
);
|
|
160
|
-
const cartSubtotalSection = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_subTotal.default, { list: subTotalList, style: { padding: 0 } }), extraContent ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-cart-extra-content" }, extraContent) : null);
|
|
161
|
-
const
|
|
214
|
+
const cartSubtotalSection = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, showVoucher ? /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, null) : null, /* @__PURE__ */ import_react.default.createElement(import_subTotal.default, { list: subTotalList, style: { padding: 0 } }), extraContent ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-cart-extra-content" }, extraContent) : null);
|
|
215
|
+
const cartBodyClassName = embedded ? "pisell-scan-order-cart-body pisell-scan-order-cart-body-embedded" : "pisell-scan-order-cart-body";
|
|
216
|
+
const cartBodyContent = /* @__PURE__ */ import_react.default.createElement("div", { className: cartBodyClassName }, cartLineItems, cartSubtotalSection);
|
|
162
217
|
if (embedded) {
|
|
163
218
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, cartBodyContent, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-order-cart-embedded-footer" }, /* @__PURE__ */ import_react.default.createElement(
|
|
164
219
|
import_materials.Button,
|
|
@@ -118,16 +118,22 @@
|
|
|
118
118
|
cursor: not-allowed;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/* 移动端:结算内嵌卡 — 与 pisell-scan-order-content-mobile-wrap 的底部留白配合;
|
|
122
|
+
* 不再在 cart-body 上重复 96px,否则与外层叠加会出现大块空白,sticky 在整页滚动时也会与内容同步位移 */
|
|
121
123
|
.pisell-scan-order-content-mobile-wrap {
|
|
122
|
-
.pisell-scan-order-cart-body {
|
|
123
|
-
padding-bottom:
|
|
124
|
+
.pisell-scan-order-cart-body-embedded {
|
|
125
|
+
padding-bottom: 16px;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
.pisell-scan-order-cart-embedded-footer {
|
|
127
|
-
position:
|
|
129
|
+
position: fixed;
|
|
130
|
+
left: 0;
|
|
131
|
+
right: 0;
|
|
128
132
|
bottom: 0;
|
|
129
|
-
z-index:
|
|
130
|
-
padding
|
|
133
|
+
z-index: 28;
|
|
134
|
+
padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
|
|
135
|
+
border-top: 1px solid #eaecf0;
|
|
136
|
+
background: #fff;
|
|
131
137
|
box-shadow: 0 -4px 10px rgba(16, 24, 40, 0.06);
|
|
132
138
|
}
|
|
133
139
|
}
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(Check_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_antd = require("antd");
|
|
37
37
|
var import_utils = require("@pisell/utils");
|
|
38
|
-
var import_materials = require("@pisell/materials");
|
|
39
38
|
var import_Cart = __toESM(require("../Cart"));
|
|
40
39
|
var import_FulfillmentMode = __toESM(require("../FulfillmentMode"));
|
|
41
40
|
var import_ManualPickupRefModal = __toESM(require("../ManualPickupRefModal"));
|
|
@@ -50,13 +49,15 @@ function Check() {
|
|
|
50
49
|
const [pickupRefOpen, setPickupRefOpen] = (0, import_react.useState)(false);
|
|
51
50
|
const utils = (0, import_hooks.contextUtils)();
|
|
52
51
|
const [dineInConfig, setDineInConfig] = (0, import_react.useState)(null);
|
|
53
|
-
const getConfig = async () => {
|
|
52
|
+
const getConfig = (0, import_react.useCallback)(async () => {
|
|
54
53
|
const otherParams = await runModuleAction("getOtherParams");
|
|
55
54
|
console.log("otherParams >>>>> ", otherParams);
|
|
56
55
|
const dineInConfig2 = (otherParams == null ? void 0 : otherParams.dineInConfig) ?? {};
|
|
57
56
|
setDineInConfig(dineInConfig2);
|
|
58
|
-
};
|
|
59
|
-
|
|
57
|
+
}, [runModuleAction]);
|
|
58
|
+
(0, import_react.useEffect)(() => {
|
|
59
|
+
getConfig();
|
|
60
|
+
}, []);
|
|
60
61
|
const isShowOrderNote = (0, import_react.useMemo)(() => {
|
|
61
62
|
return dineInConfig == null ? void 0 : dineInConfig["sale.allow_order_notes"];
|
|
62
63
|
}, [dineInConfig]);
|
|
@@ -80,41 +81,50 @@ function Check() {
|
|
|
80
81
|
() => String(import_utils.locales.getText("pisell2.scan.order.products.title") || "Products"),
|
|
81
82
|
[]
|
|
82
83
|
);
|
|
84
|
+
const showCheckStepEmptyCartTip = () => {
|
|
85
|
+
import_antd.message.error(import_utils.locales.getText("pisell2.scan.order.check.cart.empty.tip") || "Please go back to add products");
|
|
86
|
+
};
|
|
83
87
|
const doSubmit = async () => {
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
89
|
+
const items = (viewModel == null ? void 0 : viewModel.cartItems) || [];
|
|
90
|
+
if (items.length === 0) {
|
|
91
|
+
showCheckStepEmptyCartTip();
|
|
92
|
+
setSubmitting(false);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
85
95
|
try {
|
|
86
96
|
setSubmitting(true);
|
|
87
97
|
await runModuleAction("updateTempOrderNote", note);
|
|
88
98
|
const res = await runModuleAction("submitScanOrder");
|
|
89
99
|
console.log("submitScanOrder >>>>> ", res);
|
|
90
100
|
clearStepCache();
|
|
91
|
-
if (dineInConfig == null ? void 0 : dineInConfig["
|
|
101
|
+
if ((dineInConfig == null ? void 0 : dineInConfig["sale.require_payment_on_submit"]) && !isAdditionalOrder) {
|
|
102
|
+
try {
|
|
103
|
+
await runModuleAction("restoreOrder");
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.warn("[scanOrder] restoreOrder after payment failed", error);
|
|
106
|
+
}
|
|
92
107
|
utils.action({
|
|
93
108
|
type: "pisell1.payment",
|
|
94
109
|
data: {
|
|
95
110
|
order_id: (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.order_id,
|
|
96
|
-
total_amount: (_b = viewModel == null ? void 0 : viewModel.summary) == null ? void 0 :
|
|
111
|
+
total_amount: ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.order_wait_pay_amount) || ((_c = viewModel == null ? void 0 : viewModel.summary) == null ? void 0 : _c.total_amount)
|
|
97
112
|
},
|
|
98
113
|
callback: async (_e2) => {
|
|
99
|
-
try {
|
|
100
|
-
await runModuleAction("restoreOrder");
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.warn("[scanOrder] restoreOrder after payment failed", error);
|
|
103
|
-
}
|
|
104
114
|
}
|
|
105
115
|
});
|
|
106
116
|
} else {
|
|
107
|
-
if ((
|
|
117
|
+
if ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.order_id) {
|
|
108
118
|
try {
|
|
109
119
|
await runModuleAction("restoreOrder");
|
|
110
120
|
} catch (error) {
|
|
111
121
|
console.warn("[scanOrder] restoreOrder before redirect failed", error);
|
|
112
122
|
}
|
|
113
|
-
const link = `/order/details?id=${(
|
|
114
|
-
const app = (
|
|
115
|
-
if ((
|
|
123
|
+
const link = `/order/details?id=${(_e = res == null ? void 0 : res.data) == null ? void 0 : _e.order_id}`;
|
|
124
|
+
const app = (_f = utils == null ? void 0 : utils.getApp) == null ? void 0 : _f.call(utils);
|
|
125
|
+
if ((_g = app == null ? void 0 : app.history) == null ? void 0 : _g.replace) {
|
|
116
126
|
app.history.replace(link);
|
|
117
|
-
} else if ((
|
|
127
|
+
} else if ((_h = app == null ? void 0 : app.history) == null ? void 0 : _h.push) {
|
|
118
128
|
app.history.push(link);
|
|
119
129
|
} else {
|
|
120
130
|
location.replace(link);
|
|
@@ -133,12 +143,7 @@ function Check() {
|
|
|
133
143
|
if (submitting) return;
|
|
134
144
|
const cartItems = (viewModel == null ? void 0 : viewModel.cartItems) || [];
|
|
135
145
|
if (cartItems.length === 0) {
|
|
136
|
-
(
|
|
137
|
-
content: String(
|
|
138
|
-
import_utils.locales.getText("pisell2.scan.order.products.empty.tip") || "Please select products"
|
|
139
|
-
),
|
|
140
|
-
duration: 2
|
|
141
|
-
});
|
|
146
|
+
showCheckStepEmptyCartTip();
|
|
142
147
|
return;
|
|
143
148
|
}
|
|
144
149
|
if (isAdditionalOrder) {
|