FinishStep.uvue 28.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977
<template>
    <view class="step">
        <un-popup v-model:show="showPopup"
                  :mode="isLandscapeMode ? 'right' : 'bottom'"
                  :round="isLandscapeMode ? 0 : 20"
                  :closeable="false"
                  :z-index="10075"
                  @close="close">
            <view class="popup-wrapper" :class="isLandscapeMode ? 'landscape-wrapper' : 'portrait-wrapper'">
                <!-- 标题栏 -->
                <view class="popup-header">
                    <view v-if="step == 2" class="icon-back" @click="cancel">
                        <un-icon name="arrow-left" size="20" color="#333"></un-icon>
                    </view>
                    <text class="popup-title">{{ step == 1 ? '客户信息完善' : '结果反馈' }}</text>
                    <view class="panel-close" @click="close">
                        <un-icon name="close-circle-fill" size="20" color="#94a3b8"></un-icon>
                    </view>
                </view>

                <!-- 内容区域 -->
                <scroll-view class="popup-body" scroll-y>
                    <view :key="updateViewKey" class="content">
                        <template v-if="step == 1">
                            <template v-if="!check(true)">
                                <view v-if="errorTip" class="error-tip">
                                    <text class="error-tip-text">以下信息不能为空,请完善信息后保存</text>
                                </view>
                                <view v-else class="pop-tips-wrapper">
                                    <view class="pop-tips">
                                        <uni-icons :size="16" type="info-circle" color="#2c66f7"></uni-icons>
                                        <text class="pop-tips-text">{{ tipsText }}</text>
                                    </view>
                                </view>
                            </template>
                            <view class="form">
                                <template v-for="(i, index) in formObject" :key="index">
                                    <view class="form-item">
                                        <view class="label">
                                            <view v-if="i.required == true" class="required">
                                                <text class="required-text">*</text>
                                            </view>
                                            <text class="form-label-text">{{ i.label }}</text>
                                        </view>
                                        <view class="value"
                                              :class="[
                                                  { error: showError(i.key) && i.required == true },
                                                  { disabled: customerType == 0 || i.disabled == true },
                                                  { 'value-is-radio': i.type == 'radio' }
                                              ]">
                                            <template v-if="i.type == 'input'">
                                                <un-input v-model="formData[i.key]"
                                                          :disabled="customerType == 0"
                                                          :maxlength="i.maxlength"
                                                          :placeholder="i.placeholder"
                                                          border="none"
                                                          style="flex: 1;"
                                                          :type="i.inputType"
                                                          @change="onInputChange(i.key)" />
                                            </template>
                                            <template v-else-if="i.type == 'radio'">
                                                <view class="radio-cell">
                                                    <un-radio-group v-model="formData[i.key]"
                                                                    placement="row"
                                                                    :disabled="customerType == 0"
                                                                    @change="onInputChange(i.key)">
                                                        <un-radio name="VIP" label="VIP"></un-radio>
                                                        <un-radio name="潜客" label="潜客"></un-radio>
                                                        <un-radio name="普通" label="普通"></un-radio>
                                                    </un-radio-group>
                                                </view>
                                            </template>
                                            <template v-else>
                                                <view :key="selectKey"
                                                      class="select"
                                                      :class="[{'placeholder': (formData as UTSJSONObject)[i.key] == ''}]"
                                                      @click="showSelectPopup(i)">
                                                    <view class="select-content">
                                                        <text class="select-text" :class="[(formData as UTSJSONObject)[i.key] == '' ? 'select-text-placeholder' : '']">{{ (formData as UTSJSONObject)[i.key] != '' ? (formData as UTSJSONObject)[i.key] : i.placeholder }}</text>
                                                        <uni-icons class="arrow"
                                                                   size="16"
                                                                   type="right"
                                                                   color="#c0c4cc">
                                                        </uni-icons>
                                                    </view>
                                                </view>
                                            </template>
                                        </view>
                                    </view>
                                </template>
                            </view>
                        </template>
                        <template v-else>
                            <view class="pop-tips-wrapper">
                                <view class="pop-tips">
                                    <uni-icons :size="16" type="info-circle" color="#2c66f7"></uni-icons>
                                    <text class="pop-tips-text">请完善本次接待结果</text>
                                </view>
                            </view>
                            <view class="choose-box">
                                <template v-for="(item, index) in resultList" :key="index">
                                    <view class="choose-item"
                                          :class="[`${item.status == receptionStatus ? (item.status == '1' ? 'success' : 'error') : ''}`]"
                                          @click="chooseResult(item.status)">
                                        <un-icon class="sprite-icon"
                                                 :name="getIconName(item.icon, item.status == receptionStatus)"
                                                 :size="24"
                                                 :color="item.status == receptionStatus ? (item.status == '1' ? '#14cc68' : '#f24724') : '#999'"
                                                 customStyle="margin-right: 12px" />
                                        <text class="choose-item-text" :class="[`${item.status == receptionStatus ? (item.status == '1' ? 'success-text' : 'error-text') : ''}`]">{{ item.text }}</text>
                                    </view>
                                </template>
                            </view>
                        </template>
                    </view>
                </scroll-view>

                <!-- 底部按钮 -->
                    <view class="popup-footer">
                    <view class="flex-1 popup-footer-item popup-footer-item-first">
                        <un-button :block="true"
                                   round="8px"
                                   size="large"
                                   :text="step == 1 ? '取消' : '上一步'"
                                   @click="cancel" />
                    </view>
                    <view class="flex-1">
                        <un-button :block="true"
                                   round="8px"
                                   size="large"
                                   :text="sceneType == 0 ? (step == 1 ? '下一步' : '完成接待') : '完成接待'"
                                   type="primary"
                                   @click="submit" />
                    </view>
                </view>
            </view>
        </un-popup>

        <!-- <CarBrands ref="carBrandListVisible" -->
                   <!-- @select="handleSelect($event as IUTSObject, 'carBrandListVisible')" /> -->
        <!-- <Employee ref="employeeBoxVisible" -->
                  <!-- @select="handleSelect($event as IUTSObject, 'employeeBoxVisible')" /> -->
    </view>
</template>

<script setup lang="uts">
import { ComponentPublicInstance, computed, onMounted, onUnmounted, ref, watch } from "vue";

import CarBrands from "@/components/CarBrands.uvue";
import Employee from "@/components/Employee.uvue";
import { recordService } from "@/services/recorder/index.uts";
import { state } from "@/store/index.uts";
import { type RecordData } from "@/services/recorder/types/record.uts";
import { toObj } from "@/utils/common.uts";

// ============ 类型定义 ============
type FormObjectItem = {
	disabled?: boolean
	inputType?: string
	key: string
	label: string
	maxlength?: number
	placeholder: string
	popKey?: string
	required?: boolean
	type: string
}

type ResultListItem = {
	icon: string
	status: string
	text: string
}

type Props = {
	customerType?: number
	sceneType?: number
	titleTips?: string
}

// ============ Props & Emits ============
const props = withDefaults(defineProps<Props>(), {
	sceneType: 0,
	customerType: 1,
	titleTips: ""
});

const emit = defineEmits(["submit", "back"]);

let componentDisposed = false;
onUnmounted((): void => {
	componentDisposed = true;
});

// ============ 响应式数据 ============
const showPopup = ref<boolean>(false); // 控制弹窗显示(现在由 MessageBox 管理)
const formData = ref<UTSJSONObject>({
	customerName: "",
	customerPhone: "",
	customerType: "",
	carType: "",
	carModel: "",
	phoneNumber: "",
	staffName: ""
} as UTSJSONObject);

const resultList = ref<Array<ResultListItem>>([
	{
		icon: "success",
		text: "结果完美,成交了",
		status: "1"
	},
	{
		icon: "error",
		text: "仍需努力,战败了",
		status: "0"
	}
]);

const formObject_boutique: Array<FormObjectItem> = [{
	label: "车主姓名",
	key: "customerName",
	type: "input",
	inputType: "text",
	maxlength: 20,
	placeholder: "请输入车主姓名",
	required: true
},
{
	label: "品牌车型",
	key: "carModel",
	type: "select",
	popKey: "carBrandListVisible",
	placeholder: "请选择品牌车型",
	disabled: true
},
{
	label: "车主电话",
	key: "phoneNumber",
	type: "input",
	inputType: "tel",
	maxlength: 11,
	placeholder: "请输入车主电话",
	required: true
},
{
	label: "交付专员",
	key: "staffName",
	type: "select",
	popKey: "employeeBoxVisible",
	placeholder: "请选择交付专员",
	required: true
}];

/** 延保等默认场景:与 simgle_app FinishStep 字段一致 */
const FORM_OBJECT_MAIN: Array<FormObjectItem> = [
	{
		label: "客户姓名",
		key: "customerName",
		type: "input",
		inputType: "text",
		maxlength: 50,
		placeholder: "请输入客户姓名",
		required: true
	},
	{
		label: "客户电话",
		key: "customerPhone",
		type: "input",
		inputType: "tel",
		maxlength: 11,
		placeholder: "请输入车主电话",
		required: true
	},
	{
		label: "客户类型",
		key: "customerType",
		type: "radio",
		placeholder: "",
		required: true
	},
	{
		label: "品牌车型",
		key: "carType",
		type: "input",
		inputType: "text",
		maxlength: 50,
		placeholder: "请输入品牌车型",
		required: true
	}
];

// 主表单配置
const formObject = ref<Array<FormObjectItem>>(FORM_OBJECT_MAIN);

// UI 状态
const step = ref<number>(1);
const errorTip = ref<boolean>(false);
const receptionStatus = ref<string>("");
const updateViewKey = ref<number>(Date.now());
const selectKey = ref<number>(Date.now());
const isLoading = ref<boolean>(false); // 加载状态

// 屏幕状态
const windowWidth = ref<number>(uni.getWindowInfo().windowWidth);
const windowHeight = ref<number>(uni.getWindowInfo().windowHeight);

const isLandscapeMode = computed<boolean>(() => {
    return windowWidth.value > windowHeight.value;
});

// 在生命周期钩子中手动处理窗口大小变化,避免全局直接调用 uni.onWindowResize 导致报错
onMounted(() => {
    // 每次组件挂载时获取最新的窗口信息
    const info = uni.getWindowInfo();
    windowWidth.value = info.windowWidth;
    windowHeight.value = info.windowHeight;
});

// 使用 uni.onWindowResize 需要确保它只在支持的平台上调用,但为了兼容性,
// 我们可以监听尺寸变化或者干脆在需要展示的时候重新获取尺寸。
// 这里的替代方案是提供一个方法来同步窗口尺寸,并在打开弹窗前调用它。
const syncWindowSize = (): void => {
    const info = uni.getWindowInfo();
    windowWidth.value = info.windowWidth;
    windowHeight.value = info.windowHeight;
};

// Refs
const carBrandListVisible = ref<ComponentPublicInstance | null>(null);
const employeeBoxVisible = ref<ComponentPublicInstance | null>(null);

// 正则
const phoneRex = /^1[3-9]\d{9}$/;

// ============ 工具函数 ============
// 获取动态 ref 值
const getRefValue = (key: string): ComponentPublicInstance | null => {
	if (key === "carBrandListVisible") return carBrandListVisible.value;
	if (key === "employeeBoxVisible") return employeeBoxVisible.value;
	return null;
};

// 关闭弹窗
const close = (): void => {
	showPopup.value = false;
	errorTip.value = false;
	receptionStatus.value = "";
};

// 显示成功提示
const showSuccess = (): void => {
	showPopup.value = true;
};

// ============ 计算属性 ============
const watchStatus = computed(() => {
	const status = state.user?.historyStatus;
	if (status == null) {
		return false;
	} else if (status == 1) {
		return true;
	} else {
		return false;
	}
});

const tipsText = computed(() => {
	const _sceneType = props.sceneType;
	const _titleTips = props.titleTips;
	let text = _titleTips !== null && _titleTips !== "" ? _titleTips : "检测到客户信息未完善,请填写后再完成接待。";
	if (_sceneType == 1) text = '请确认"车型加装选购页"中的客户信息,并点击「完成接待」结束客户接待。';
	return text;
});

// ============ 监听器 ============
watch(watchStatus, (newVal: boolean) => {
	receptionStatus.value = "";
	errorTip.value = false;
	showPopup.value = false;
}, { immediate: true });
function showError(key: string): boolean {
	const value = formData.value;
	let flag = (value as UTSJSONObject)[key] == "";
	if (key == "phoneNumber") {
		const phoneValue = (value as UTSJSONObject)[key] as string;
		if (phoneValue !== null && phoneValue !== "") {
			flag = phoneRex.test(phoneValue) == false;
		}
	}
	return errorTip.value && flag;
}

function showSelectPopup(item: FormObjectItem): void {
	console.log("showSelectPopup", item);
	if (props.customerType == 0 || (item.disabled == true)) return;
	const popKey = item.popKey !== null  ? item.popKey : "";
	const refValue = getRefValue(popKey);
	if (refValue != null) {
		(refValue as ComponentPublicInstance).$callMethod("open");
	}
}
// 取消
function cancel(): void {
	if (step.value == 1) close();
	else step.value = 1;
}
function check(all: boolean = false): boolean {
	let flag = true;

	formObject.value.forEach(e => {
		if (e.required == true) {
			const value = formData.value;
			if (value == null || (value as UTSJSONObject)[e.key] == "") {
				flag = false;
				return;
			}
			if (!all && e.key == "phoneNumber") {
				const phoneValue = (value as UTSJSONObject)[e.key] as string;
				if (phoneValue !== null && phoneValue !== "" && phoneRex.test(phoneValue) == false) {
					uni.showToast({
						title: "请输入正确的车主电话",
						icon: "none"
					});
					flag = false;

				}
			}
		}
	});

	return flag;
}

// 显示成功
const showSuccessMessage = (): void => {
	showSuccess();
	emit("submit", receptionStatus.value);
};

// 提交表单
const submit = (): void => {
	if (step.value == 1) {
		errorTip.value = true;

		if (check()) {
			const sceneType = props.sceneType;
			if (sceneType == 0) {
				step.value = 2;
			} else {
				receptionStatus.value = "1";
				showSuccessMessage();
			}
		}
	} else {
		if (receptionStatus.value == "") {
			uni.showToast({
				title: "请完善本次接待结果",
				icon: "none"
			});
			return;
		}
		showSuccessMessage();
	}
};

// 输入更新
const onInputChange = (key: string): void => {
	const value = (formData.value as UTSJSONObject)[key] as string;
	const payload: RecordData = {} as RecordData;
	payload[key] = value;
	// if (key == "carModel") {
	// 	payload["carModelId"] = "";
	// }
	recordService.updateBusinessData(payload);
};

// 选择处理
const handleSelect = (item: IUTSObject, popkey: string): void => {
	// const value = formData.value as UTSJSONObject;
	// const itemObj = item as UTSJSONObject;

	// if (popkey === "employeeBoxVisible") {
		// value.salesUuid = itemObj.uuid as string;
		// value.staffName = itemObj.staffName as string;
		// recordService.updateBusinessData({
		// 	salesUuid: itemObj.uuid as string,
		// 	salesName: itemObj.staffName as string
		// });
	// } else {
		// if (carBrandListVisible.value !== null) {
		// 	carBrandListVisible.value.$callMethod("close");
		// }
		// value.carModel = itemObj.name as string;
		// value.carModelId = itemObj.id as number;
	// }

	// formData.value = value;
	// selectKey.value = Date.now();
};

// 打开弹窗
const open = (): void => {
	console.log("[FinishStep] open called");
	isLoading.value = true;

	recordService.getBusinessData().then((data) => {
		console.log("[FinishStep] getBusinessData result:", data);
		if (componentDisposed) {
			console.log("[FinishStep] component disposed, return");
			return;
		}
		// ✅ 使用 JSON 往返转换将 RecordData 转换为 UTSJSONObject
		let customerInfo: UTSJSONObject | null = null;
		if (data != null) {
			try {
				const jsonStr = JSON.stringify(data);
				customerInfo = JSON.parse(jsonStr) as UTSJSONObject;
			} catch (e) {
				console.log("[FinishStep] JSON conversion error:", e);
			}
		}
		console.log("customerInfo", customerInfo);
		if (customerInfo != null) {
			// 填充表单数据
			// formData.value = {
			// 	customerName: customerInfo.customerName != null && customerInfo.customerName != "null" ? customerInfo.customerName : "",
			// 	carModel: customerInfo.carModel != null && customerInfo.carModel != "null" ? customerInfo.carModel : "",
			// 	carModelId: customerInfo.carModelId != null && customerInfo.carModelId != "null" ? customerInfo.carModelId : "",
			// 	customerType: customerInfo.customerType != null && customerInfo.customerType != "null" ? customerInfo.customerType as string : "",
			// 	phoneNumber: customerInfo.phoneNumber != null && customerInfo.phoneNumber != "null" ? customerInfo.phoneNumber : "",
			// 	staffName: customerInfo.staffName != null && customerInfo.staffName != "null" ? customerInfo.staffName : "",
			// 	salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "",
			// };

			const _sceneType = props.sceneType;
			const _customerType = props.customerType;
			let stepValue = 1;

			// 检查必填字段
			const keys = ["customerName", "carType", "customerPhone", "customerType"];
			for (const key of keys) {
				const value = formData.value[key] as null | string;
				if (value == null || value == "") {
					stepValue = 1;
					break;
				}
				stepValue = 2;
			}

			errorTip.value = false;

			if (_sceneType == 1) {
				stepValue = 1;
				formObject.value = formObject_boutique;
				const checkResult = check();
				if (_customerType == 0 && !checkResult) {
					emit("back");
					isLoading.value = false;
					return;
				}
			} else {
				formObject.value = FORM_OBJECT_MAIN;
			}

			if (stepValue == 2) {
				const checkResult = check();
				if (!checkResult) {
					errorTip.value = true;
					stepValue = 1;
				}
			}

			step.value = stepValue;

			syncWindowSize();
			// 打开弹窗 - Android 需要延迟以确保 DOM 更新
			console.log("[FinishStep] before setting showPopup, current value:", showPopup.value);
			setTimeout(() => {
				showPopup.value = true;
				console.log("[FinishStep] after setting showPopup, value:", showPopup.value);
				updateViewKey.value = Date.now();
				console.log("[FinishStep] popup should be visible now");
				isLoading.value = false;
			}, 100);
		} else {
			console.log("[FinishStep] customerInfo is null, not showing popup");
			isLoading.value = false;
		}
	}).catch((error) => {
		console.log("[FinishStep] getBusinessData error:", error);
		if (!componentDisposed) {
			isLoading.value = false;
		}
	});
};

// 选择接待结果
const chooseResult = (val: string): void => {
	receptionStatus.value = val;
	recordService.updateBusinessData({ result: val=="1"?"成交":"战败" });
};

// 获取图标名称
const getIconName = (icon: string, isActive: boolean): string => {
	// success -> checkmark-circle-fill (选中时) / checkmark-circle (未选中)
	// error -> close-circle-fill (选中时) / close-circle (未选中)
	if (icon === "success") {
		return isActive ? "checkmark-circle-fill" : "checkmark-circle";
	}
	if (icon === "error") {
		return isActive ? "close-circle-fill" : "close-circle";
	}
	return "question-circle";
};

// 暴露方法
defineExpose({ open, close });

</script>

<style scoped lang="scss">
.step {
    width: 100%;
    height: 100%;
}

.popup-wrapper {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%; /* 确保 wrapper 能继承外部的高度 */
}

.portrait-wrapper {
    width: 100%;
    max-height: 9999px; // uni-app x 不支持百分比,使用大数值代替
    border-radius: 20px 20px 0 0;
}

.landscape-wrapper {
    width: 400px;
    height: 100%;
}

.popup-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f0f0;
}

.popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #292d33;
}

.icon-back {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: all 0.2s ease;

    &:active {
        background: rgba(102, 126, 234, 0.15);
        transform: translateY(-50%) scale(0.95);
    }
}

.popup-body {
    flex: 1;
    min-height: 0;
    padding: 0 20px;
    box-sizing: border-box;
}

.content {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.popup-footer {
    display: flex;
    flex-direction: row;
    padding: 16px 20px;
    padding-bottom: 24px;
    flex-shrink: 0;
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
    z-index: 2;
}

.popup-footer-item {
    width: 0;
}

.popup-footer-item-first {
    margin-right: 16px;
}

.pop-tips {
    width: 100%;
    background: rgba(44, 102, 247, 0.1);
    padding: 12px 5px 12px;
    margin-top: 15px;
}

.pop-tips-text {
    color: #2c66f7;
    font-size: 14px;
    text-align: center;
}

.error-tip {
    padding: 12px 16px;
    margin-top: 16px;
    text-align: center;
    background-color: #fff4f2;
    border-radius: 8px;
}

.error-tip-text {
    color: #f24724;
    font-size: 14px;
}

.pop-tips-wrapper {
    margin-top: 16px;

    .pop-tips {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 12px 16px;
        background: #f0f4ff;
        border-radius: 8px;
        margin-top: 0;
    }
}

.pop-tips-wrapper .pop-tips-text {
    color: #2c66f7;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}

.form {
    display: flex;
    padding-top: 16px;
    flex-direction: column;

    &-item {
        width: 100%;
        display: flex;
        align-items: center;
        box-sizing: border-box;
        margin: 0 auto 20px;
        flex-direction: row;

        .label {
            position: relative;
            flex-shrink: 0;
            width: 86px;
            display: flex;
            flex-direction: row;
            align-items: center;

            .required {
                margin-right: 4px;
                display: flex;
                align-items: center;
            }
        }

        .value {
            flex: 1;
            min-height: 48px;
            background: #f8f9fa;
            margin-left: 8px;
            box-sizing: border-box;
            border-radius: 8px;
            display: flex;
            align-items: center;
            transition: all 0.2s ease;
            padding: 0 12px;

            &.error {
                background: #fff4f2;
                border: 1px solid rgba(242, 71, 36, 0.3);
            }

            &.disabled {
                background: #f1f3f5;
                opacity: 0.8;
            }

            &.value-is-radio {
                background: transparent;
                border-width: 0;
                padding-left: 0;
                padding-right: 0;
                min-height: 40px;
            }

            &.value-is-radio.error {
                border-width: 1px;
                border-style: solid;
                border-color: rgba(242, 71, 36, 0.45);
                border-radius: 8px;
                padding-left: 8px;
                padding-right: 8px;
            }

            .radio-cell {
                width: 100%;
                display: flex;
                flex-direction: row;
                align-items: center;
            }

            .select {
                width: 100%;
                height: 48px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                background: transparent;
                border: none;
                box-sizing: border-box;

                .arrow {
                    flex-shrink: 0;
                    margin-left: auto;
                }
            }

            .select-content {
                display: flex;
                flex-direction: row;
                align-items: center;
                justify-content: space-between;
                width: 100%;
                height: 100%;

                .arrow {
                    flex-shrink: 0;
                    margin-left: auto;
                }
            }
        }
    }
}

.choose-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 24px;

    .choose-item {
        width: 100%;
        height: 72px;
        background: #f8f9fa;
        border: 2px solid transparent;
        border-radius: 12px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        margin-bottom: 16px;
        transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);

        &:active {
            transform: scale(0.98);
            background: #f1f3f5;
        }

        .sprite-icon {
            margin-right: 12px;
            transition: transform 0.25s ease;
            width: 24px;
            height: 24px;
        }
    }

    .success {
        background: #f0fbf5;
        border-color: #14cc68;
        box-shadow: 0 4px 12px rgba(20, 204, 104, 0.1);

        .sprite-icon {
            transform: scale(1.1);
        }
    }

    .error {
        background: #fff4f2;
        border-color: #f24724;
        box-shadow: 0 4px 12px rgba(242, 71, 36, 0.1);

        .sprite-icon {
            transform: scale(1.1);
        }
    }
}

.form-label-text {
    color: #495057;
    font-size: 15px;
    font-weight: 500;
}

.required-text {
    color: #fa5252;
}

.select-text {
    flex: 1;
    font-size: 15px;
    color: #212529;
    font-weight: 500;
}

.select-text-placeholder {
    color: #adb5bd;
    font-weight: 400;
}

.choose-item-text {
    font-size: 16px;
    color: #495057;
    font-weight: 500;
    transition: all 0.2s ease;
}

.success-text {
    color: #14cc68;
    font-weight: 600;
}

.error-text {
    color: #f24724;
    font-weight: 600;
}
</style>