consultation-modal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <Teleport to="body">
  3. <Transition
  4. enter-active-class="transition duration-300 ease-out"
  5. enter-from-class="opacity-0"
  6. enter-to-class="opacity-100"
  7. leave-active-class="transition duration-200 ease-in"
  8. leave-from-class="opacity-100"
  9. leave-to-class="opacity-0"
  10. >
  11. <div
  12. v-if="modelValue"
  13. class="fixed inset-0 z-[999] flex items-center justify-center bg-black/50 backdrop-blur-sm"
  14. @click.self="close"
  15. >
  16. <div
  17. class="relative w-1200px bg-white rounded-8px shadow-2xl overflow-hidden animate-zoom-in lt-sm:w-[calc(100vw-35px)] lt-sm:max-h-[90vh] lt-sm:overflow-y-auto"
  18. >
  19. <!-- Close Button -->
  20. <i
  21. class="i-ep-close wh-22px font-semibold absolute top-20px right-20px text-gray-500 cursor-pointer lt-sm:top-16px lt-sm:right-16px"
  22. @click="close"
  23. ></i>
  24. <div class="py-46px px-36px lt-sm:px-40px lt-sm:py-60px">
  25. <!-- Header -->
  26. <div class="text-center mb-45px lt-sm:mb-24px">
  27. <div class="font-s-36px pf-sc-semibold text-#000000 mb-4px lt-sm:font-s-48px">
  28. 开启您的智慧社区转型之旅
  29. </div>
  30. <div class="font-s-16px text-#091221/70 lh-30px pf-sc-regular lt-sm:font-s-26px">
  31. 提交您的需求,我们的专属顾问将在24小时内为您提供定制化解决方案
  32. </div>
  33. </div>
  34. <div class="flex gap-60px lt-sm:flex-col lt-sm:gap-0">
  35. <!-- Left Form -->
  36. <div class="flex-1">
  37. <el-form
  38. ref="formRef"
  39. :model="form"
  40. :rules="rules"
  41. label-position="top"
  42. class="flex flex-col gap-24px lt-sm:gap-32px"
  43. :hide-required-asterisk="true"
  44. @submit.prevent="handleSubmit"
  45. >
  46. <!-- Name -->
  47. <el-form-item prop="contacts" class="custom-form-item">
  48. <template #label>
  49. <span class="form-label">
  50. 您的称谓
  51. <span class="text-red-500">*</span>
  52. </span>
  53. </template>
  54. <div class="flex gap-28px w-full lt-sm:flex-col lt-sm:gap-12px">
  55. <el-input
  56. v-model="form.contacts"
  57. placeholder="请输入您的称谓"
  58. class="custom-input flex-1 lt-sm:w-full"
  59. />
  60. <el-radio-group
  61. v-model="form.gender"
  62. class="shrink-0 flex-1 lt-sm:w-full lt-sm:justify-start"
  63. >
  64. <el-radio value="先生">先生</el-radio>
  65. <el-radio value="女士">女士</el-radio>
  66. </el-radio-group>
  67. </div>
  68. </el-form-item>
  69. <!-- Phone -->
  70. <el-form-item prop="phone" class="custom-form-item">
  71. <template #label>
  72. <span class="form-label">
  73. 手机号码
  74. <span class="text-red-500">*</span>
  75. </span>
  76. </template>
  77. <el-input
  78. v-model="form.phone"
  79. placeholder="请输入您的手机号码"
  80. class="custom-input w-full"
  81. />
  82. </el-form-item>
  83. <!-- Company/Address -->
  84. <el-form-item prop="company" class="custom-form-item">
  85. <template #label>
  86. <span class="form-label">
  87. 公司名称或项目地址
  88. <span class="text-red-500">*</span>
  89. </span>
  90. </template>
  91. <el-input
  92. v-model="form.company"
  93. placeholder="请输入公司名称或项目地址"
  94. class="custom-input w-full"
  95. />
  96. </el-form-item>
  97. <!-- Description -->
  98. <el-form-item prop="desc" class="custom-form-item">
  99. <el-input
  100. v-model="form.remark"
  101. type="textarea"
  102. placeholder="简要描述您的需求 (可选)"
  103. class="custom-textarea w-full"
  104. :rows="3"
  105. resize="none"
  106. />
  107. </el-form-item>
  108. <!-- Submit Button -->
  109. <button
  110. v-loading="loading"
  111. type="submit"
  112. :disabled="loading"
  113. class="mt-56px h-48px w-268px bg-#0F67F8 text-white pf-sc-regular rounded-8px px-16px flex items-center justify-between hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed lt-sm:w-453px lt-sm:m-auto lt-sm:rounded-16px lt-sm:h-84px lt-sm:mt-60px lt-sm:justify-between lt-sm:gap-8px"
  114. >
  115. <span class="font-s-16px lt-sm:hidden">立即咨询</span>
  116. <span class="hidden lt-sm:block lt-sm:font-s-26px">提交需求,获取专属方案</span>
  117. <i class="i-custom-arrow-right wh-18px lt-sm:wh-21px"></i>
  118. </button>
  119. </el-form>
  120. </div>
  121. <!-- Right Info -->
  122. <div
  123. class="w-390px rounded-8px p-40px flex flex-col overflow-hidden right-info lt-sm:hidden"
  124. >
  125. <div class="relative flex flex-col items-start">
  126. <div class="wh-40px bg-white rounded-10px flex-center">
  127. <i class="i-custom-phone wh-23px"></i>
  128. </div>
  129. <div class="mt-14px font-s-16px text-#091221/70">
  130. 即刻拨打400官方热线,7x24h为您服务
  131. </div>
  132. <div class="font-s-40px text-#0F67F8 d-din-pro-700-bold">400-600-7709</div>
  133. </div>
  134. <!-- QR Code Section -->
  135. <div class="relative mt-48px flex flex-col gap-13px">
  136. <div class="wh-40px bg-white rounded-10px flex-center">
  137. <i class="i-custom-wx wh-28px"></i>
  138. </div>
  139. <div class="font-s-16px text-#091221/70 pf-sc-regular">
  140. 微信扫码关注“绘家科技”微信公众号
  141. </div>
  142. <div class="text-#0F67F8 font-s-28px">扫码了解绘家</div>
  143. <i class="i-custom-qrcode wh-136px"></i>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </Transition>
  151. </Teleport>
  152. </template>
  153. <script setup lang="ts">
  154. import type { FormInstance, FormRules } from 'element-plus'
  155. import { applyPartner } from '~/api'
  156. const props = defineProps<{
  157. modelValue: boolean
  158. }>()
  159. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  160. const _ = props
  161. const emit = defineEmits<{
  162. (e: 'update:modelValue', value: boolean): void
  163. }>()
  164. const formRef = ref<FormInstance>()
  165. const loading = ref(false)
  166. const form = reactive({
  167. contacts: '',
  168. gender: '先生',
  169. phone: '',
  170. company: '',
  171. remark: '',
  172. })
  173. const rules = reactive<FormRules>({
  174. contacts: [{ required: true, message: '请输入您的称谓', trigger: 'blur' }],
  175. phone: [
  176. {
  177. required: true,
  178. message: '请输入您的手机号码',
  179. trigger: 'blur',
  180. },
  181. {
  182. pattern: /^1[3456789]\d{9}$/,
  183. message: '请输入正确的手机号码',
  184. trigger: 'blur',
  185. },
  186. ],
  187. company: [{ required: true, message: '请输入公司名称或项目地址', trigger: 'blur' }],
  188. })
  189. const close = () => {
  190. formRef.value?.resetFields()
  191. formRef.value?.clearValidate()
  192. emit('update:modelValue', false)
  193. }
  194. const handleSubmit = () => {
  195. if (!formRef.value) return
  196. formRef.value.validate((valid) => {
  197. if (valid) {
  198. loading.value = true
  199. applyPartner({
  200. company: form.company,
  201. contacts: form.contacts + form.gender,
  202. phone: form.phone,
  203. remark: form.remark || '无',
  204. })
  205. .then(() => {
  206. ElMessage.success('提交成功,我们会尽快与您联系')
  207. })
  208. .finally(() => {
  209. close()
  210. loading.value = false
  211. })
  212. }
  213. })
  214. }
  215. </script>
  216. <style scoped lang="scss">
  217. .form-label {
  218. @apply font-s-16px text-#334155 mb-14px;
  219. @apply lt-sm:font-s-26px lt-sm:mb-14px;
  220. }
  221. /* Custom Input Styles to match design */
  222. :deep(.custom-input .el-input__wrapper) {
  223. @apply lt-sm:h-82px lt-sm:rounded-8px lt-sm:px-24px;
  224. height: 52px;
  225. border-radius: 4px;
  226. box-shadow: 0 0 0 1px #e2e8f0; /* border-gray-200 */
  227. padding: 0 16px;
  228. background-color: white;
  229. transition: all 0.2s;
  230. }
  231. :deep(.custom-input .el-input__wrapper:hover) {
  232. box-shadow: 0 0 0 1px #cbd5e1;
  233. }
  234. :deep(.custom-input .el-input__wrapper.is-focus) {
  235. box-shadow: 0 0 0 1px #0f67f8 !important; /* border-#0F67F8 */
  236. outline: 2px solid rgba(219, 234, 254, 0.5);
  237. }
  238. :deep(.custom-input .el-input__inner) {
  239. @apply h-52px lt-sm:h-82px;
  240. font-size: 14px;
  241. color: #0f172a;
  242. }
  243. :deep(.custom-textarea .el-textarea__inner) {
  244. @apply min-h-127px lt-sm:min-h-166px;
  245. @apply lt-sm:rounded-8px lt-sm:p-24px;
  246. border-radius: 4px;
  247. box-shadow: 0 0 0 1px #e2e8f0;
  248. padding: 12px 16px;
  249. font-size: 14px;
  250. color: #0f172a;
  251. transition: all 0.2s;
  252. }
  253. :deep(.custom-textarea .el-textarea__inner:focus) {
  254. box-shadow: 0 0 0 1px #0f67f8 !important;
  255. outline: 2px solid rgba(219, 234, 254, 0.5);
  256. }
  257. /* Custom Button Styles */
  258. .custom-button {
  259. background-color: #0f67f8;
  260. border: none;
  261. transition: background-color 0.2s;
  262. &:hover {
  263. background-color: #0a50ff;
  264. }
  265. }
  266. /* Remove default el-form-item margin-bottom to control gap via flex gap */
  267. :deep(.el-form-item) {
  268. margin-bottom: 0;
  269. }
  270. @keyframes zoomIn {
  271. from {
  272. opacity: 0;
  273. transform: scale(0.95);
  274. }
  275. to {
  276. opacity: 1;
  277. transform: scale(1);
  278. }
  279. }
  280. .animate-zoom-in {
  281. animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  282. }
  283. .right-info {
  284. background-image: url('@/assets/images/bg-4.png');
  285. background-size: 100% 100%;
  286. }
  287. </style>