@pisell/private-materials 6.3.177 → 6.3.178
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/meta.js +1 -1
- 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 +1 -1
- package/es/businessModel/SalesModel/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.js +91 -24
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +24 -20
- package/es/components/appointmentBooking/components/Header/index.js +4 -24
- package/es/components/appointmentBooking/components/Voucher/index.js +10 -0
- package/es/components/appointmentBooking/hooks.d.ts +1 -17
- package/es/components/appointmentBooking/hooks.js +54 -128
- package/es/components/appointmentBooking/utils.d.ts +1 -0
- package/es/components/appointmentBooking/utils.js +54 -33
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/TabProduct/index.d.ts +1 -0
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
- package/es/components/booking/deposit/index.d.ts +1 -0
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/forms/single/index.d.ts +1 -0
- package/es/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
- package/es/components/booking/info/date/index.d.ts +1 -0
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/es/components/booking/info/index.d.ts +1 -0
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/notes/index.d.ts +1 -0
- package/es/components/booking/info/service/Lists.d.ts +1 -0
- package/es/components/booking/info/service/actions/index.d.ts +1 -0
- package/es/components/booking/info/service/addService/index.d.ts +1 -0
- package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/info/service2/Lists.d.ts +1 -0
- package/es/components/booking/info2/service/actions/index.d.ts +1 -0
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
- package/es/components/booking/info2/service/contactInfoMode/index.d.ts +1 -0
- package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/materiels/holder/index.d.ts +1 -0
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +1 -2
- package/es/components/eftposPay/amount.d.ts +1 -0
- package/es/components/eftposPay/app.d.ts +1 -0
- package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/es/components/eftposPay/device.js +4 -11
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.d.ts +1 -0
- package/es/components/eftposPay/linkly/index.d.ts +1 -0
- package/es/components/eftposPay/pay.d.ts +1 -0
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/es/components/eventBooking/components/progressBar/index.d.ts +1 -8
- package/es/components/eventBooking/components/progressBar/index.js +10 -30
- package/es/components/eventBooking/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/pisellCashCounting/hooks.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/es/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +1 -0
- package/es/components/productExtension/index.d.ts +1 -0
- package/es/components/ruleSetting/index.d.ts +1 -0
- package/es/components/scanOrder/components/Check/index.js +46 -187
- package/es/components/scanOrder/components/Check/index.less +0 -39
- package/es/components/scanOrder/components/Content/index.js +72 -189
- package/es/components/scanOrder/components/Menu/index.js +5 -11
- package/es/components/scanOrder/hooks.js +0 -7
- package/es/components/scanOrder/locales.d.ts +0 -75
- package/es/components/scanOrder/locales.js +0 -75
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/es/components/shoppingCart/index.d.ts +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/es/components/venueBooking/components/Cart/index.js +159 -46
- package/es/components/venueBooking/components/Voucher/index.js +1 -6
- package/es/components/venueBooking/context.js +15 -2
- package/es/components/venueBooking/locales.d.ts +5 -0
- package/es/components/venueBooking/locales.js +10 -5
- package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/NormalCard/index.d.ts +1 -0
- package/es/pro/Login2.0/locales.js +1 -1
- package/es/utils/buildCartHolderParams.d.ts +92 -0
- package/es/utils/buildCartHolderParams.js +191 -0
- package/lib/businessModel/SalesModel/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +71 -9
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +6 -2
- package/lib/components/appointmentBooking/components/Header/index.js +1 -13
- package/lib/components/appointmentBooking/components/Voucher/index.js +10 -0
- package/lib/components/appointmentBooking/hooks.d.ts +1 -17
- package/lib/components/appointmentBooking/hooks.js +16 -91
- package/lib/components/appointmentBooking/utils.d.ts +1 -0
- package/lib/components/appointmentBooking/utils.js +24 -13
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
- package/lib/components/booking/deposit/index.d.ts +1 -0
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/forms/single/index.d.ts +1 -0
- package/lib/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
- package/lib/components/booking/info/date/index.d.ts +1 -0
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/lib/components/booking/info/index.d.ts +1 -0
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/notes/index.d.ts +1 -0
- package/lib/components/booking/info/service/Lists.d.ts +1 -0
- package/lib/components/booking/info/service/actions/index.d.ts +1 -0
- package/lib/components/booking/info/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/info/service2/Lists.d.ts +1 -0
- package/lib/components/booking/info2/service/actions/index.d.ts +1 -0
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
- package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +1 -0
- package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/materiels/holder/index.d.ts +1 -0
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +1 -2
- package/lib/components/eftposPay/amount.d.ts +1 -0
- package/lib/components/eftposPay/app.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/lib/components/eftposPay/device.js +4 -6
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.d.ts +1 -0
- package/lib/components/eftposPay/linkly/index.d.ts +1 -0
- package/lib/components/eftposPay/pay.d.ts +1 -0
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/lib/components/eventBooking/components/progressBar/index.d.ts +1 -8
- package/lib/components/eventBooking/components/progressBar/index.js +9 -29
- package/lib/components/eventBooking/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/pisellCashCounting/hooks.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +1 -0
- package/lib/components/productExtension/index.d.ts +1 -0
- package/lib/components/ruleSetting/index.d.ts +1 -0
- package/lib/components/scanOrder/components/Check/index.js +3 -116
- package/lib/components/scanOrder/components/Check/index.less +0 -39
- package/lib/components/scanOrder/components/Content/index.js +25 -106
- package/lib/components/scanOrder/components/Menu/index.js +0 -2
- package/lib/components/scanOrder/hooks.js +0 -7
- package/lib/components/scanOrder/locales.d.ts +0 -75
- package/lib/components/scanOrder/locales.js +0 -75
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/lib/components/shoppingCart/index.d.ts +1 -0
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/lib/components/venueBooking/components/Cart/index.js +92 -14
- package/lib/components/venueBooking/components/Voucher/index.js +1 -5
- package/lib/components/venueBooking/context.js +12 -2
- package/lib/components/venueBooking/locales.d.ts +5 -0
- package/lib/components/venueBooking/locales.js +10 -5
- package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/NormalCard/index.d.ts +1 -0
- package/lib/pro/Login2.0/locales.js +1 -1
- package/lib/utils/buildCartHolderParams.d.ts +92 -0
- package/lib/utils/buildCartHolderParams.js +167 -0
- package/package.json +1 -1
|
@@ -259,7 +259,7 @@ export default {
|
|
|
259
259
|
'pisell-register2-complete-title': '注册完成!',
|
|
260
260
|
'pisell-register2-redirecting': '正在重定向到您的帐户...',
|
|
261
261
|
'pisell-login2-continue-with-email': '使用邮箱',
|
|
262
|
-
'pisell-login2-continue-with-phone': '
|
|
262
|
+
'pisell-login2-continue-with-phone': '使用手机',
|
|
263
263
|
'pisell-login2-email-not-registered': '该邮箱未注册,请先注册',
|
|
264
264
|
'pisell-login2-check-email-failed': '检查邮箱失败,请重试',
|
|
265
265
|
'pisell-login2-continue-failed': '继续失败,请重试',
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** ProductCard Time 组件所需的 holder 展示字段 */
|
|
2
|
+
export interface CartHolderParams {
|
|
3
|
+
holder_id?: number;
|
|
4
|
+
isErrorHolder?: boolean;
|
|
5
|
+
isShowChangeHolder?: boolean;
|
|
6
|
+
addHolderButtonText?: string;
|
|
7
|
+
holder_title?: string;
|
|
8
|
+
holders?: Array<{
|
|
9
|
+
id: any;
|
|
10
|
+
label: any;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface BuildCartHolderParamsOptions {
|
|
15
|
+
/** 购物车行数据 */
|
|
16
|
+
item: any;
|
|
17
|
+
/** holder 配置,通常来自 item._productInit.holder_config 或 item._origin.product.holder_config */
|
|
18
|
+
holderConfig?: Record<string, any>;
|
|
19
|
+
/** getHolderFormMap 中对应 resource_id 的表单数据 */
|
|
20
|
+
formData?: Record<string, any>;
|
|
21
|
+
/** 多语言翻译函数 */
|
|
22
|
+
translation: (value: any) => string;
|
|
23
|
+
/** 是否注入 holder 字段,由业务侧决定(如预约商品 / 含 duration 的场地商品) */
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 从购物车行解析当前选中的 holder form_record_id。
|
|
28
|
+
*
|
|
29
|
+
* venueBooking:以 _origin.holder 为准(SDK 会原地更新 form_record);
|
|
30
|
+
* 顶层 item.holder_id 可能是上一轮 UI 注入或 SDK 回灌的滞后值,不能优先于 _origin.holder。
|
|
31
|
+
*/
|
|
32
|
+
export declare const resolveCartItemHolderId: (item: any) => number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
|
|
35
|
+
* 供 appointmentBooking、venueBooking 等购物车场景复用。
|
|
36
|
+
*/
|
|
37
|
+
export declare const buildCartHolderParams: ({ item, holderConfig, formData, translation, enabled, }: BuildCartHolderParamsOptions) => CartHolderParams;
|
|
38
|
+
/**
|
|
39
|
+
* 从 appointmentBooking 购物车行读取 holder_config
|
|
40
|
+
*/
|
|
41
|
+
export declare const getAppointmentCartHolderConfig: (item: any) => any;
|
|
42
|
+
/**
|
|
43
|
+
* 从 venueBooking 购物车行读取 holder_config
|
|
44
|
+
*/
|
|
45
|
+
export declare const getVenueCartHolderConfig: (item: any) => any;
|
|
46
|
+
export interface ValidateRequiredCartHoldersOptions {
|
|
47
|
+
items?: any[];
|
|
48
|
+
getHolderConfig?: (item: any) => Record<string, any>;
|
|
49
|
+
/** 是否校验该行,默认全部校验 */
|
|
50
|
+
shouldValidateItem?: (item: any) => boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 校验购物车中 holder_config.required 的行是否已选择 holder。
|
|
54
|
+
*/
|
|
55
|
+
export declare const validateRequiredCartHolders: ({ items, getHolderConfig, }: ValidateRequiredCartHoldersOptions) => {
|
|
56
|
+
hasError: boolean;
|
|
57
|
+
invalidItems: any[];
|
|
58
|
+
};
|
|
59
|
+
export interface CartHolderFormModule {
|
|
60
|
+
appendFormRecord?: (params: {
|
|
61
|
+
record: any;
|
|
62
|
+
}) => void;
|
|
63
|
+
refreshAllHolderFormRecords?: (params: {
|
|
64
|
+
customer_id?: any;
|
|
65
|
+
}) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface HandleCartHolderFormSuccessOptions {
|
|
68
|
+
res: any;
|
|
69
|
+
formId?: number | string;
|
|
70
|
+
skuRelationFormId: number;
|
|
71
|
+
utils: any;
|
|
72
|
+
module: CartHolderFormModule;
|
|
73
|
+
}
|
|
74
|
+
export interface CartHolderFormSuccessResult {
|
|
75
|
+
formRecordId: any;
|
|
76
|
+
mainField: any;
|
|
77
|
+
formId: any;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
|
|
81
|
+
*/
|
|
82
|
+
export declare const getSkuRelationFormId: (holderMap: Record<string, any>, formId?: number | string) => number;
|
|
83
|
+
/**
|
|
84
|
+
* 从 form_to_form_value 中取最新创建的 form_record_id。
|
|
85
|
+
*/
|
|
86
|
+
export declare const getSkuRelationFormRecordId: (res: any) => any;
|
|
87
|
+
/**
|
|
88
|
+
* 处理购物车添加 holder 表单提交成功后的公共逻辑。
|
|
89
|
+
* - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
|
|
90
|
+
* - 普通表单:appendFormRecord 并直接使用 form_record_id
|
|
91
|
+
*/
|
|
92
|
+
export declare const handleCartHolderFormSuccess: ({ res, formId, skuRelationFormId, utils, module, }: HandleCartHolderFormSuccessOptions) => CartHolderFormSuccessResult;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
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; }
|
|
10
|
+
import { getCustomer } from "../components/appointmentBooking/utils";
|
|
11
|
+
|
|
12
|
+
/** ProductCard Time 组件所需的 holder 展示字段 */
|
|
13
|
+
|
|
14
|
+
var toHolderRecordId = function toHolderRecordId(value) {
|
|
15
|
+
if (value == null || value === '') return undefined;
|
|
16
|
+
var id = Number(value);
|
|
17
|
+
return Number.isNaN(id) ? undefined : id;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 从 _origin.holder 解析 form_record_id。
|
|
22
|
+
* form_record 可能是 number、number[];不能假定一定是数组下标 [0]。
|
|
23
|
+
*/
|
|
24
|
+
var resolveOriginHolderId = function resolveOriginHolderId(holder) {
|
|
25
|
+
var formRecord = holder === null || holder === void 0 ? void 0 : holder.form_record;
|
|
26
|
+
if (Array.isArray(formRecord)) {
|
|
27
|
+
var _iterator = _createForOfIteratorHelper(formRecord),
|
|
28
|
+
_step;
|
|
29
|
+
try {
|
|
30
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
31
|
+
var _value = _step.value;
|
|
32
|
+
var id = toHolderRecordId(_value);
|
|
33
|
+
if (id != null) return id;
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
_iterator.e(err);
|
|
37
|
+
} finally {
|
|
38
|
+
_iterator.f();
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
var _id = toHolderRecordId(formRecord);
|
|
42
|
+
if (_id != null) return _id;
|
|
43
|
+
}
|
|
44
|
+
return toHolderRecordId(holder === null || holder === void 0 ? void 0 : holder.form_record_id);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 从购物车行解析当前选中的 holder form_record_id。
|
|
49
|
+
*
|
|
50
|
+
* venueBooking:以 _origin.holder 为准(SDK 会原地更新 form_record);
|
|
51
|
+
* 顶层 item.holder_id 可能是上一轮 UI 注入或 SDK 回灌的滞后值,不能优先于 _origin.holder。
|
|
52
|
+
*/
|
|
53
|
+
export var resolveCartItemHolderId = function resolveCartItemHolderId(item) {
|
|
54
|
+
var _item$_origin;
|
|
55
|
+
var originHolder = item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.holder;
|
|
56
|
+
if (originHolder && _typeof(originHolder) === 'object') {
|
|
57
|
+
return resolveOriginHolderId(originHolder);
|
|
58
|
+
}
|
|
59
|
+
return toHolderRecordId(item === null || item === void 0 ? void 0 : item.holder_id);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
|
|
64
|
+
* 供 appointmentBooking、venueBooking 等购物车场景复用。
|
|
65
|
+
*/
|
|
66
|
+
export var buildCartHolderParams = function buildCartHolderParams(_ref) {
|
|
67
|
+
var _formData$form, _records$find;
|
|
68
|
+
var item = _ref.item,
|
|
69
|
+
_ref$holderConfig = _ref.holderConfig,
|
|
70
|
+
holderConfig = _ref$holderConfig === void 0 ? {} : _ref$holderConfig,
|
|
71
|
+
formData = _ref.formData,
|
|
72
|
+
translation = _ref.translation,
|
|
73
|
+
_ref$enabled = _ref.enabled,
|
|
74
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
75
|
+
if (!enabled) {
|
|
76
|
+
return {
|
|
77
|
+
isShowChangeHolder: false,
|
|
78
|
+
holders: []
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var records = (formData === null || formData === void 0 ? void 0 : formData.records) || [];
|
|
82
|
+
var holderId = resolveCartItemHolderId(item);
|
|
83
|
+
return {
|
|
84
|
+
holder_id: holderId,
|
|
85
|
+
isErrorHolder: !!(!holderId && holderConfig !== null && holderConfig !== void 0 && holderConfig.required),
|
|
86
|
+
isShowChangeHolder: (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.status) === 'enable',
|
|
87
|
+
addHolderButtonText: translation(formData === null || formData === void 0 || (_formData$form = formData.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.setting) === null || _formData$form === void 0 ? void 0 : _formData$form.title),
|
|
88
|
+
holder_title: holderId ? (_records$find = records.find(function (record) {
|
|
89
|
+
return Number(record === null || record === void 0 ? void 0 : record.form_record_id) === holderId;
|
|
90
|
+
})) === null || _records$find === void 0 ? void 0 : _records$find.main_field : '',
|
|
91
|
+
holders: records.map(function (record) {
|
|
92
|
+
return _objectSpread(_objectSpread({}, record), {}, {
|
|
93
|
+
id: record === null || record === void 0 ? void 0 : record.form_record_id,
|
|
94
|
+
label: record === null || record === void 0 ? void 0 : record.main_field
|
|
95
|
+
});
|
|
96
|
+
})
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 从 appointmentBooking 购物车行读取 holder_config
|
|
102
|
+
*/
|
|
103
|
+
export var getAppointmentCartHolderConfig = function getAppointmentCartHolderConfig(item) {
|
|
104
|
+
var _item$_productInit;
|
|
105
|
+
return (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 从 venueBooking 购物车行读取 holder_config
|
|
110
|
+
*/
|
|
111
|
+
export var getVenueCartHolderConfig = function getVenueCartHolderConfig(item) {
|
|
112
|
+
var _item$_origin2;
|
|
113
|
+
return (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 || (_item$_origin2 = _item$_origin2.product) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.holder_config) || {};
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* 校验购物车中 holder_config.required 的行是否已选择 holder。
|
|
117
|
+
*/
|
|
118
|
+
export var validateRequiredCartHolders = function validateRequiredCartHolders(_ref2) {
|
|
119
|
+
var _ref2$items = _ref2.items,
|
|
120
|
+
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
121
|
+
_ref2$getHolderConfig = _ref2.getHolderConfig,
|
|
122
|
+
getHolderConfig = _ref2$getHolderConfig === void 0 ? getVenueCartHolderConfig : _ref2$getHolderConfig;
|
|
123
|
+
console.log(items, 'items1111');
|
|
124
|
+
var invalidItems = items.filter(function (item) {
|
|
125
|
+
var holderConfig = getHolderConfig(item);
|
|
126
|
+
if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.required)) return false;
|
|
127
|
+
return !resolveCartItemHolderId(item);
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
hasError: invalidItems.length > 0,
|
|
131
|
+
invalidItems: invalidItems
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
|
|
136
|
+
*/
|
|
137
|
+
export var getSkuRelationFormId = function getSkuRelationFormId(holderMap, formId) {
|
|
138
|
+
var _formData$form2, _formData$form3, _detail$setting;
|
|
139
|
+
if (!formId) return 0;
|
|
140
|
+
var formData = holderMap === null || holderMap === void 0 ? void 0 : holderMap[formId];
|
|
141
|
+
if ((formData === null || formData === void 0 || (_formData$form2 = formData.form) === null || _formData$form2 === void 0 || (_formData$form2 = _formData$form2.form) === null || _formData$form2 === void 0 ? void 0 : _formData$form2.form_type) !== 'minors') return 0;
|
|
142
|
+
var detail = formData === null || formData === void 0 || (_formData$form3 = formData.form) === null || _formData$form3 === void 0 || (_formData$form3 = _formData$form3.field) === null || _formData$form3 === void 0 ? void 0 : _formData$form3.find(function (item) {
|
|
143
|
+
return item.filed_type === 'form_to_form' && item.status === 'hide';
|
|
144
|
+
});
|
|
145
|
+
return (detail === null || detail === void 0 || (_detail$setting = detail.setting) === null || _detail$setting === void 0 ? void 0 : _detail$setting.linkedTable) || 0;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 从 form_to_form_value 中取最新创建的 form_record_id。
|
|
150
|
+
*/
|
|
151
|
+
export var getSkuRelationFormRecordId = function getSkuRelationFormRecordId(res) {
|
|
152
|
+
var _res$values;
|
|
153
|
+
var formToFormValue = res === null || res === void 0 || (_res$values = res.values) === null || _res$values === void 0 || (_res$values = _res$values.form_to_form_value) === null || _res$values === void 0 ? void 0 : _res$values[0];
|
|
154
|
+
var formDataValue = (formToFormValue === null || formToFormValue === void 0 ? void 0 : formToFormValue.form_data_value) || [];
|
|
155
|
+
return formDataValue[formDataValue.length - 1];
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* 处理购物车添加 holder 表单提交成功后的公共逻辑。
|
|
160
|
+
* - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
|
|
161
|
+
* - 普通表单:appendFormRecord 并直接使用 form_record_id
|
|
162
|
+
*/
|
|
163
|
+
export var handleCartHolderFormSuccess = function handleCartHolderFormSuccess(_ref3) {
|
|
164
|
+
var _res$values2, _res$values3, _res$values4;
|
|
165
|
+
var res = _ref3.res,
|
|
166
|
+
formId = _ref3.formId,
|
|
167
|
+
skuRelationFormId = _ref3.skuRelationFormId,
|
|
168
|
+
utils = _ref3.utils,
|
|
169
|
+
module = _ref3.module;
|
|
170
|
+
var formRecordId = res === null || res === void 0 || (_res$values2 = res.values) === null || _res$values2 === void 0 ? void 0 : _res$values2.form_record_id;
|
|
171
|
+
var resolvedFormId = res === null || res === void 0 || (_res$values3 = res.values) === null || _res$values3 === void 0 ? void 0 : _res$values3.form_id;
|
|
172
|
+
if (formId && skuRelationFormId) {
|
|
173
|
+
var _module$refreshAllHol;
|
|
174
|
+
var customer = getCustomer(utils);
|
|
175
|
+
module === null || module === void 0 || (_module$refreshAllHol = module.refreshAllHolderFormRecords) === null || _module$refreshAllHol === void 0 || _module$refreshAllHol.call(module, {
|
|
176
|
+
customer_id: customer === null || customer === void 0 ? void 0 : customer.id
|
|
177
|
+
});
|
|
178
|
+
formRecordId = getSkuRelationFormRecordId(res);
|
|
179
|
+
resolvedFormId = formId;
|
|
180
|
+
} else if (formId) {
|
|
181
|
+
var _module$appendFormRec;
|
|
182
|
+
module === null || module === void 0 || (_module$appendFormRec = module.appendFormRecord) === null || _module$appendFormRec === void 0 || _module$appendFormRec.call(module, {
|
|
183
|
+
record: res === null || res === void 0 ? void 0 : res.values
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
formRecordId: formRecordId,
|
|
188
|
+
mainField: res === null || res === void 0 || (_res$values4 = res.values) === null || _res$values4 === void 0 ? void 0 : _res$values4.main_field,
|
|
189
|
+
formId: resolvedFormId
|
|
190
|
+
};
|
|
191
|
+
};
|
|
@@ -44,6 +44,8 @@ var import_utils2 = require("../../../utils");
|
|
|
44
44
|
var import_Voucher = __toESM(require("../../Voucher"));
|
|
45
45
|
var import_Deposit = __toESM(require("../../Deposit"));
|
|
46
46
|
var import_utils3 = require("../utils");
|
|
47
|
+
var import_buildCartHolderParams = require("../../../../../utils/buildCartHolderParams");
|
|
48
|
+
var import_buildCartHolderParams2 = require("../../../../../utils/buildCartHolderParams");
|
|
47
49
|
var import_index = require("./index.less");
|
|
48
50
|
var CartItem = ({ onNext, renderContactInfo }) => {
|
|
49
51
|
var _a, _b, _c, _d, _e;
|
|
@@ -64,8 +66,26 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
64
66
|
const { isFormSubject, bookingSubject, isRetailTemplate } = (0, import_hooks2.useAppointmentBookingSetting)();
|
|
65
67
|
const { isLogin } = (0, import_hooks2.useAppointmentBookingLogin)();
|
|
66
68
|
const utils = (0, import_hooks2.contextUtils)();
|
|
67
|
-
const { businessUtils, translation } = utils;
|
|
69
|
+
const { businessUtils, translation, pisellos } = utils;
|
|
68
70
|
const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = summary;
|
|
71
|
+
const [holderMap, setHolderMap] = (0, import_react.useState)({});
|
|
72
|
+
(0, import_react.useEffect)(() => {
|
|
73
|
+
var _a2;
|
|
74
|
+
const onHolderChanged = (res) => {
|
|
75
|
+
if ((res == null ? void 0 : res.path) === "holderMap") {
|
|
76
|
+
setHolderMap(res == null ? void 0 : res.value);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
(_a2 = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a2.on("appointmentBooking_holder:changed", onHolderChanged);
|
|
80
|
+
return () => {
|
|
81
|
+
var _a3;
|
|
82
|
+
(_a3 = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a3.off("appointmentBooking_holder:changed", onHolderChanged);
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
(0, import_react.useEffect)(() => {
|
|
86
|
+
const _holderMap = (appointmentBooking == null ? void 0 : appointmentBooking.getHolderFormMap()) || {};
|
|
87
|
+
setHolderMap(_holderMap);
|
|
88
|
+
}, []);
|
|
69
89
|
const currentUser = (0, import_react.useMemo)(() => {
|
|
70
90
|
return (0, import_utils2.formatCurrentUser)(utils) || {};
|
|
71
91
|
}, []);
|
|
@@ -80,6 +100,7 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
80
100
|
const hasGoodPassApp = !!((_a = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _a.call(businessUtils, "goodpass"));
|
|
81
101
|
const hasDiscountCardApp = !!((_b = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _b.call(businessUtils, "discountcard"));
|
|
82
102
|
const handleClickCard = (e, type, val) => {
|
|
103
|
+
var _a2, _b2;
|
|
83
104
|
console.log(e, type, val, "handleClickCard");
|
|
84
105
|
if (type === "note") {
|
|
85
106
|
return appointmentBooking.updateCart({
|
|
@@ -119,13 +140,32 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
119
140
|
}
|
|
120
141
|
if (type === "add_holder") {
|
|
121
142
|
const relationShipFormId = bookingSubject == null ? void 0 : bookingSubject.relationship_form_id;
|
|
143
|
+
const formId = (_b2 = (_a2 = e == null ? void 0 : e._productInit) == null ? void 0 : _a2.holder_config) == null ? void 0 : _b2.resource_id;
|
|
144
|
+
const skuRelationFormId = (0, import_buildCartHolderParams2.getSkuRelationFormId)(holderMap, formId);
|
|
122
145
|
return (0, import_utils2.openForm)({
|
|
123
|
-
form_id: relationShipFormId || (bookingSubject == null ? void 0 : bookingSubject.form_id),
|
|
146
|
+
form_id: skuRelationFormId || formId || relationShipFormId || (bookingSubject == null ? void 0 : bookingSubject.form_id),
|
|
124
147
|
title: import_utils.locales.getText("pisell2.event.create.form"),
|
|
125
148
|
utils,
|
|
126
149
|
callback: async (res) => {
|
|
127
150
|
if ((res == null ? void 0 : res.status) === "success") {
|
|
128
151
|
let result = void 0;
|
|
152
|
+
if (formId) {
|
|
153
|
+
const { formRecordId, mainField } = (0, import_buildCartHolderParams2.handleCartHolderFormSuccess)({
|
|
154
|
+
res,
|
|
155
|
+
formId,
|
|
156
|
+
skuRelationFormId,
|
|
157
|
+
utils,
|
|
158
|
+
module: appointmentBooking
|
|
159
|
+
});
|
|
160
|
+
appointmentBooking.updateCart({
|
|
161
|
+
_id: e == null ? void 0 : e._id,
|
|
162
|
+
account: {
|
|
163
|
+
id: formRecordId,
|
|
164
|
+
username: mainField
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
129
169
|
if (!relationShipFormId) {
|
|
130
170
|
result = await addAccount(res == null ? void 0 : res.values, "holder");
|
|
131
171
|
} else {
|
|
@@ -151,13 +191,26 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
151
191
|
};
|
|
152
192
|
const products = (0, import_react.useMemo)(() => {
|
|
153
193
|
if (!(carts == null ? void 0 : carts.length)) return [];
|
|
154
|
-
carts.
|
|
155
|
-
|
|
194
|
+
const enrichedCarts = carts.map((item) => {
|
|
195
|
+
const isNormalProduct = appointmentBooking.isTargetCartIdNormalProduct(
|
|
156
196
|
item == null ? void 0 : item._id
|
|
157
197
|
);
|
|
198
|
+
const holderConfig = (0, import_buildCartHolderParams.getAppointmentCartHolderConfig)(item);
|
|
199
|
+
const formData = holderMap == null ? void 0 : holderMap[holderConfig == null ? void 0 : holderConfig.resource_id];
|
|
200
|
+
const holderParams = (0, import_buildCartHolderParams.buildCartHolderParams)({
|
|
201
|
+
item,
|
|
202
|
+
holderConfig,
|
|
203
|
+
formData,
|
|
204
|
+
translation,
|
|
205
|
+
enabled: !isFormSubject ? false : !isNormalProduct
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
...item,
|
|
209
|
+
...holderParams
|
|
210
|
+
};
|
|
158
211
|
});
|
|
159
212
|
if ((currentSelectedResources == null ? void 0 : currentSelectedResources.length) > 0) {
|
|
160
|
-
const newCarts =
|
|
213
|
+
const newCarts = enrichedCarts.map((item) => {
|
|
161
214
|
const currentResourceData = currentSelectedResources.find(
|
|
162
215
|
(resource) => (resource == null ? void 0 : resource._id) === (item == null ? void 0 : item._id)
|
|
163
216
|
);
|
|
@@ -169,15 +222,22 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
169
222
|
return {
|
|
170
223
|
...item,
|
|
171
224
|
isMultipleResource: true,
|
|
172
|
-
multiResources
|
|
173
|
-
isErrorHolder: isErrorHolder || false
|
|
225
|
+
multiResources
|
|
226
|
+
// isErrorHolder: isErrorHolder || false,
|
|
174
227
|
};
|
|
175
228
|
});
|
|
176
229
|
return newCarts;
|
|
177
230
|
} else {
|
|
178
|
-
return
|
|
231
|
+
return enrichedCarts;
|
|
179
232
|
}
|
|
180
|
-
}, [
|
|
233
|
+
}, [
|
|
234
|
+
carts,
|
|
235
|
+
currentSelectedResources,
|
|
236
|
+
currentStepParams == null ? void 0 : currentStepParams.key,
|
|
237
|
+
isErrorHolder,
|
|
238
|
+
holderMap,
|
|
239
|
+
isFormSubject
|
|
240
|
+
]);
|
|
181
241
|
const subTotalList = (0, import_react.useMemo)(() => {
|
|
182
242
|
const hideDeposit = (carts == null ? void 0 : carts.length) === 0 || !(deposit == null ? void 0 : deposit.hasDeposit);
|
|
183
243
|
const surcharge = ((summary == null ? void 0 : summary.surcharge) || []).map(
|
|
@@ -236,7 +296,9 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
236
296
|
isShowDelete: ((_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key) === "select-service",
|
|
237
297
|
isShowPackageNote: false,
|
|
238
298
|
isShowChangeHolder: isLastStep ? false : isFormSubject && isLogin,
|
|
299
|
+
// isShowChangeHolder: isLastStep ? false : !isRetailTemplate && isLogin,
|
|
239
300
|
isShowHolder: isFormSubject,
|
|
301
|
+
// isShowHolder: !isRetailTemplate,
|
|
240
302
|
isShowAddHolderButton: true
|
|
241
303
|
},
|
|
242
304
|
collapseParams: {
|
|
@@ -61,7 +61,7 @@ var ConfirmInformation = (0, import_react.forwardRef)((props, ref) => {
|
|
|
61
61
|
carts,
|
|
62
62
|
setTimes
|
|
63
63
|
} = (0, import_context.useAppointmentBookingContext)();
|
|
64
|
-
const { isRetailTemplate, bookingSetting } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
64
|
+
const { isRetailTemplate, bookingSetting, isFormSubject } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
65
65
|
console.log(bookingSetting, "bookingSetting");
|
|
66
66
|
const [form] = import_antd.Form.useForm();
|
|
67
67
|
const userInfo = (0, import_useLoginUser.default)();
|
|
@@ -185,8 +185,12 @@ var ConfirmInformation = (0, import_react.forwardRef)((props, ref) => {
|
|
|
185
185
|
};
|
|
186
186
|
const onCheckout = async (extraData) => {
|
|
187
187
|
try {
|
|
188
|
+
const _extraData = {
|
|
189
|
+
...extraData,
|
|
190
|
+
is_add_holder_info: isFormSubject
|
|
191
|
+
};
|
|
188
192
|
const { deposit } = summary;
|
|
189
|
-
const { data } = await appointmentBooking.submitOrder(
|
|
193
|
+
const { data } = await appointmentBooking.submitOrder(_extraData);
|
|
190
194
|
const { is_deposit, deposit_amount, total_amount, order_id } = data || {};
|
|
191
195
|
const _total = is_deposit ? deposit_amount : total_amount;
|
|
192
196
|
if (_total > 0) {
|
|
@@ -56,7 +56,6 @@ var Header = () => {
|
|
|
56
56
|
const { setOtherData, getOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
57
57
|
const { checkProductType } = (0, import_hooks.useAppointmentBookingProduct)();
|
|
58
58
|
const utils = (0, import_hooks.contextUtils)();
|
|
59
|
-
const progressBarRef = (0, import_react.useRef)(null);
|
|
60
59
|
const stepName = (0, import_react.useMemo)(() => {
|
|
61
60
|
var _a2, _b, _c;
|
|
62
61
|
const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
|
|
@@ -132,27 +131,16 @@ var Header = () => {
|
|
|
132
131
|
const utils2 = context.appHelper.utils || {};
|
|
133
132
|
(_b = utils2 == null ? void 0 : utils2.history) == null ? void 0 : _b.replace("/");
|
|
134
133
|
};
|
|
135
|
-
const { restoreBackTrap } = (0, import_hooks.useInterceptBrowserBack)({
|
|
136
|
-
stepIndex: (currentStep == null ? void 0 : currentStep.index) ?? 0,
|
|
137
|
-
canGoBack: () => ((currentStep == null ? void 0 : currentStep.index) ?? 0) > 0,
|
|
138
|
-
onBack: handleBack,
|
|
139
|
-
onExit: () => {
|
|
140
|
-
var _a2;
|
|
141
|
-
return (_a2 = progressBarRef.current) == null ? void 0 : _a2.triggerClose();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
134
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
145
135
|
import_progressBar.default,
|
|
146
136
|
{
|
|
147
|
-
ref: progressBarRef,
|
|
148
137
|
title: currentStep ? `${import_utils.locales.getText("pisell2.appointment.step")(
|
|
149
138
|
(currentStep == null ? void 0 : currentStep.index) + 1
|
|
150
139
|
)}` : "",
|
|
151
140
|
description: stepName,
|
|
152
141
|
showBack: (currentStep == null ? void 0 : currentStep.index) > 0,
|
|
153
142
|
onBack: () => handleBack(),
|
|
154
|
-
onClose: () => handleClose()
|
|
155
|
-
onConfirmCancel: restoreBackTrap
|
|
143
|
+
onClose: () => handleClose()
|
|
156
144
|
}
|
|
157
145
|
);
|
|
158
146
|
};
|
|
@@ -45,6 +45,7 @@ var import_voucher = require("../../../booking/components/voucher/index.less");
|
|
|
45
45
|
var import_utils2 = require("../../../booking/utils");
|
|
46
46
|
var import_index = require("./index.less");
|
|
47
47
|
var import_ahooks = require("ahooks");
|
|
48
|
+
var import_utils3 = require("../../utils");
|
|
48
49
|
var ShopDiscountHooks = {
|
|
49
50
|
onInited: "shopDiscount:onInited",
|
|
50
51
|
onDestroy: "shopDiscount:onDestroy",
|
|
@@ -268,7 +269,16 @@ var VoucherCard = (props) => {
|
|
|
268
269
|
onClick: () => {
|
|
269
270
|
if (!action) return;
|
|
270
271
|
openLoginModal({
|
|
272
|
+
data: {
|
|
273
|
+
type: "plugin"
|
|
274
|
+
},
|
|
271
275
|
callback: (status) => {
|
|
276
|
+
if (status === "success") {
|
|
277
|
+
const customer = (0, import_utils3.getCustomer)(utils);
|
|
278
|
+
appointmentBooking == null ? void 0 : appointmentBooking.refreshAllHolderFormRecords({
|
|
279
|
+
customer_id: customer == null ? void 0 : customer.id
|
|
280
|
+
});
|
|
281
|
+
}
|
|
272
282
|
}
|
|
273
283
|
});
|
|
274
284
|
}
|
|
@@ -46,6 +46,7 @@ export declare const useAppointmentBookingLogin: () => {
|
|
|
46
46
|
isLogin: boolean;
|
|
47
47
|
openLoginModal: (params: {
|
|
48
48
|
callback: any;
|
|
49
|
+
data?: any;
|
|
49
50
|
}) => void;
|
|
50
51
|
};
|
|
51
52
|
/**
|
|
@@ -105,20 +106,3 @@ export declare const useAppointmentBookingSetting: () => {
|
|
|
105
106
|
formName: any;
|
|
106
107
|
bookingSetting: any;
|
|
107
108
|
};
|
|
108
|
-
export interface UseInterceptBrowserBackOptions {
|
|
109
|
-
/** 是否启用拦截,默认 true */
|
|
110
|
-
enabled?: boolean;
|
|
111
|
-
/** 当前步骤 index(0-based),用于同步 history 栈深度 */
|
|
112
|
-
stepIndex: number;
|
|
113
|
-
/** 是否还能在流程内后退(如 currentStep.index > 0) */
|
|
114
|
-
canGoBack: () => boolean;
|
|
115
|
-
/** 流程内后退,对应 Header.handleBack */
|
|
116
|
-
onBack: () => void | Promise<void>;
|
|
117
|
-
/** 已在第一步时的退出逻辑,对应 Header.handleClose */
|
|
118
|
-
onExit?: () => void;
|
|
119
|
-
}
|
|
120
|
-
export interface UseInterceptBrowserBackResult {
|
|
121
|
-
/** 系统返回触发退出确认但被取消时,补回 history trap */
|
|
122
|
-
restoreBackTrap: () => void;
|
|
123
|
-
}
|
|
124
|
-
export declare const useInterceptBrowserBack: ({ enabled, stepIndex, canGoBack, onBack, onExit, }: UseInterceptBrowserBackOptions) => UseInterceptBrowserBackResult;
|