index.vue 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. <template>
  2. <!-- 访客申请 -->
  3. <view class="container">
  4. <!-- 导航栏 -->
  5. <custom-navbar title="访客申请" :showBack="true"></custom-navbar>
  6. <!-- 表单内容 -->
  7. <view class="form-container">
  8. <!-- 第一块:对接人信息 -->
  9. <view class="section">
  10. <view class="section-title">
  11. <image class="title-icon" src="/static/images/person.png" mode="aspectFit"></image>
  12. 对接人信息
  13. </view>
  14. <view class="mar-b-16">
  15. <text class="label">所属部门:</text>
  16. <view class="select-wrapper">
  17. <!-- 调试信息 -->
  18. <uni-data-select v-model="formData.departmentId" :localdata="departmentOptions"
  19. placeholder="请选择所属部门" @change="onDepartmentSelectChange" :clear="false">
  20. </uni-data-select>
  21. </view>
  22. </view>
  23. <view class="form-item1">
  24. <text class="label">员工姓名:</text>
  25. <view class="select-wrapper">
  26. <uni-data-select v-model="formData.employeeId" :localdata="employeeOptions" placeholder="请选择员工"
  27. @change="onEmployeeSelectChange" :clear="false">
  28. </uni-data-select>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 第二块:访问信息 -->
  33. <view class="section">
  34. <view class="section-title">
  35. <image class="title-icon" src="/static/images/calendar.png" mode="aspectFit"></image>
  36. 访问信息
  37. </view>
  38. <view class="form-item">
  39. <text class="label">访问事由</text>
  40. <input class="input" v-model="formData.visitReason" placeholder="请输入访问事由"
  41. placeholder-style="color: #c0c4cc" />
  42. </view>
  43. <view class="form-item">
  44. <text class="label">到访时间</text>
  45. <uni-datetime-picker type="datetime" v-model="formData.visitTime" @change="onVisitTimeChange"
  46. :clear-icon="false" placeholder="请选择到访时间" format="YYYY-MM-DD HH:mm" :hide-second="true">
  47. <view class="input-wrapper">
  48. <text class="placeholder" v-if="!formData.visitTime">请选择到访时间</text>
  49. <text v-else>{{ formData.visitTime }}</text>
  50. <uni-icons type="calendar" size="16" color="#c0c4cc"></uni-icons>
  51. </view>
  52. </uni-datetime-picker>
  53. </view>
  54. <view class="form-item">
  55. <text class="label">访客姓名</text>
  56. <input class="input" v-model="formData.visitorName" placeholder="请输入访客姓名"
  57. placeholder-style="color: #c0c4cc" />
  58. </view>
  59. <view class="form-item">
  60. <text class="label">访客单位</text>
  61. <input class="input" v-model="formData.visitorCompany" placeholder="请输入访客单位"
  62. placeholder-style="color: #c0c4cc" />
  63. </view>
  64. <view class="form-item">
  65. <text class="label">手机号</text>
  66. <input class="input" v-model="formData.visitorPhone" placeholder="请输入手机号"
  67. placeholder-style="color: #c0c4cc" type="number" />
  68. </view>
  69. </view>
  70. <!-- 第三块:随行人员 -->
  71. <view class="section">
  72. <view class="section-title">随行人员</view>
  73. <view class="accompany-list">
  74. <view class="accompany-item" v-for="(item, index) in formData.accompanyPersons" :key="index">
  75. <view class="form-item">
  76. <text class="label">随行人员</text>
  77. <input class="input" v-model="item.name" placeholder="请输入随行人员姓名"
  78. placeholder-style="color: #c0c4cc" />
  79. </view>
  80. <view class="form-item">
  81. <text class="label">手机号</text>
  82. <input class="input" v-model="item.phone" placeholder="请输入手机号"
  83. placeholder-style="color: #c0c4cc" type="number" />
  84. </view>
  85. <view class="delete-btn" v-if="formData.accompanyPersons.length > 1"
  86. @click.stop="removeAccompany(index)">
  87. <uni-icons type="trash" size="18" color="#ff4757"></uni-icons>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="add-accompany-btn" @click="addAccompany">
  92. <uni-icons type="plus" size="16" color="#007aff"></uni-icons>
  93. <text>添加随行人员</text>
  94. </view>
  95. </view>
  96. <!-- 第四块:使用车辆 -->
  97. <view class="section">
  98. <view class="vehicle-header">
  99. <view class="section-title">
  100. <image class="title-icon" src="/static/images/cart.png" mode="aspectFit"></image>
  101. 使用车辆
  102. </view>
  103. <switch :checked="formData.useVehicle" @change="onVehicleChange" color="#007aff" />
  104. </view>
  105. <view v-if="formData.useVehicle" class="vehicle-content">
  106. <view class="form-item">
  107. <text class="label">接客时间</text>
  108. <uni-datetime-picker type="datetime" v-model="formData.pickupTime" @change="onPickupTimeChange"
  109. :clear-icon="false" placeholder="请选择接客时间" format="YYYY-MM-DD HH:mm" :hide-second="true">
  110. <view class="input-wrapper">
  111. <text class="placeholder" v-if="!formData.pickupTime">请选择接客时间</text>
  112. <text v-else>{{ formData.pickupTime }}</text>
  113. <uni-icons type="calendar" size="16" color="#c0c4cc"></uni-icons>
  114. </view>
  115. </uni-datetime-picker>
  116. </view>
  117. <view class="form-item">
  118. <text class="label">接客地点</text>
  119. <input class="input" v-model="formData.pickupLocation" placeholder="请输入接客地点"
  120. placeholder-style="color: #c0c4cc" />
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. <!-- 提交按钮 -->
  126. <view class="submit-container">
  127. <button class="submit-btn" @click="submitForm">提交</button>
  128. </view>
  129. <!-- 提交成功弹框 -->
  130. <uni-popup ref="successPopup" type="center" :mask-click="false">
  131. <view class="success-popup">
  132. <view class="popup-content">
  133. <view class="success-icon">
  134. <uni-icons type="checkmarkempty" size="60" color="#52c41a"></uni-icons>
  135. </view>
  136. <view class="popup-title">申请提交成功</view>
  137. <view class="popup-message">您的申请已成功提交,请关注公众号即时查询审核结果</view>
  138. <view class="popup-buttons">
  139. <button class="cancel-btn" @click="closeSuccessPopup">取消</button>
  140. <button class="follow-btn" @click="showQRCode">关注</button>
  141. </view>
  142. </view>
  143. </view>
  144. </uni-popup>
  145. <!-- 授权登录组件 -->
  146. <auth-login-popup ref="authLoginPopup" @success="onLoginSuccess" @close="onLoginClose"></auth-login-popup>
  147. </view>
  148. </template>
  149. <script>
  150. import user from '../../store/modules/user';
  151. import {
  152. getDept,
  153. selectUser,
  154. addVisit
  155. } from '@/config/api.js';
  156. import AuthLoginPopup from '@/components/auth-login-popup/auth-login-popup.vue';
  157. export default {
  158. components: {
  159. AuthLoginPopup
  160. },
  161. data() {
  162. return {
  163. type: '', // 从上一页传递过来的参数
  164. tabbarHeight: 50, // tabbar高度,默认50px
  165. user: null, // 用户信息
  166. formData: {
  167. departmentId: '',
  168. department: '',
  169. employeeId: '',
  170. employeeName: '',
  171. visitReason: '',
  172. visitTime: '',
  173. visitorName: '',
  174. visitorCompany: '',
  175. visitorPhone: '',
  176. accompanyPersons: [{
  177. name: '',
  178. phone: ''
  179. }],
  180. useVehicle: false,
  181. pickupTime: '',
  182. pickupLocation: ''
  183. },
  184. // 部门数据
  185. departments: [],
  186. // 部门选项(格式化为uni-data-select所需格式)
  187. departmentOptions: [],
  188. // 员工选项
  189. employeeOptions: []
  190. }
  191. },
  192. onLoad(options) {
  193. // 页面加载,该钩子被调用时
  194. console.log("加载记录页面", "usususuus")
  195. // 获取传递过来的参数
  196. if (options.type) {
  197. this.type = options.type;
  198. }
  199. // 获取用户信息
  200. this.user = uni.getStorageSync("user")
  201. this.getTabbarHeight()
  202. this.getDeptList()
  203. },
  204. onReady() {
  205. // 页面渲染完成后再次获取,确保准确
  206. this.getTabbarHeight()
  207. // 打开授权登录弹窗
  208. // this.$refs.authLoginPopup.open()
  209. },
  210. methods: {
  211. // 获取tabbar高度
  212. getTabbarHeight() {
  213. // 获取菜单按钮信息,用于计算真实的可用高度
  214. const systemInfo = uni.getSystemInfoSync()
  215. // 在微信小程序中,使用 windowHeight 和 screenHeight 的差值
  216. // windowHeight 是不包含 tabbar 的可用高度
  217. const windowHeight = systemInfo.windowHeight
  218. const screenHeight = systemInfo.screenHeight
  219. // 微信小程序 tabbar 高度通常是 50px,但在不同设备可能不同
  220. // 直接使用差值
  221. let tabbarHeight = screenHeight - windowHeight
  222. console.log('系统信息:', {
  223. screenHeight,
  224. windowHeight,
  225. 计算的tabbar高度: tabbarHeight,
  226. safeAreaBottom: systemInfo.safeAreaInsets?.bottom || systemInfo.safeArea?.bottom || 0
  227. })
  228. // 在小程序中通常是 50-80 之间
  229. // 如果是 H5,差值会包含地址栏等,会更大
  230. // #ifdef MP-WEIXIN
  231. if (tabbarHeight < 30 || tabbarHeight > 100) {
  232. tabbarHeight = 50 // 微信小程序默认 50px
  233. }
  234. // #endif
  235. // #ifdef H5
  236. tabbarHeight = 50 // H5 固定使用 50px
  237. // #endif
  238. this.tabbarHeight = tabbarHeight
  239. },
  240. async getDeptList() {
  241. console.log("获取DEPT")
  242. try {
  243. const res = await getDept({
  244. parentId: 100
  245. })
  246. console.log("部门API返回数据:", res)
  247. this.departments = res.data
  248. // 格式化部门数据为uni-data-select所需格式
  249. this.departmentOptions = res.data.map(item => ({
  250. value: item.dept_id,
  251. text: item.dept_name
  252. }))
  253. console.log("格式化后的部门选项:", this.departmentOptions)
  254. // 添加延时确保数据已经设置
  255. this.$nextTick(() => {
  256. console.log("nextTick后的部门选项:", this.departmentOptions)
  257. })
  258. } catch (error) {
  259. console.error("获取部门列表失败:", error)
  260. uni.showToast({
  261. title: '获取部门列表失败',
  262. icon: 'none'
  263. })
  264. }
  265. },
  266. // 部门选择改变
  267. async onDepartmentSelectChange(value) {
  268. console.log("选择的部门ID:", value)
  269. this.formData.departmentId = value
  270. // 找到选中的部门信息
  271. const selectedDept = this.departments.find(dept => dept.dept_id === value)
  272. if (selectedDept) {
  273. this.formData.department = selectedDept.dept_name
  274. // 根据部门ID获取员工列表
  275. try {
  276. const userRes = await selectUser({
  277. deptId: value
  278. })
  279. console.log("员工列表:", userRes)
  280. // 格式化员工数据为uni-data-select所需格式
  281. if (userRes && userRes.rows) {
  282. this.employeeOptions = userRes.rows.map(item => ({
  283. value: item.user_id,
  284. text: item.nick_name
  285. }))
  286. console.log("格式化后的员工选项:", this.employeeOptions)
  287. } else if (userRes && userRes.data && userRes.data.rows) {
  288. // 备用路径,以防数据结构不同
  289. this.employeeOptions = userRes.data.rows.map(item => ({
  290. value: item.user_id,
  291. text: item.nick_name
  292. }))
  293. console.log("格式化后的员工选项(备用路径):", this.employeeOptions)
  294. }
  295. // 清空之前选择的员工
  296. this.formData.employeeId = ''
  297. this.formData.employeeName = ''
  298. } catch (error) {
  299. console.error("获取员工列表失败:", error)
  300. uni.showToast({
  301. title: '获取员工列表失败',
  302. icon: 'none'
  303. })
  304. }
  305. }
  306. },
  307. // 员工选择改变
  308. onEmployeeSelectChange(value) {
  309. console.log("选择的员工ID:", value)
  310. this.formData.employeeId = value
  311. // 根据employeeOptions找到对应的员工名称
  312. const selectedEmployee = this.employeeOptions.find(emp => emp.value === value)
  313. if (selectedEmployee) {
  314. this.formData.employeeName = selectedEmployee.text
  315. console.log("选择的员工名称:", selectedEmployee.text)
  316. }
  317. },
  318. // 到访时间改变
  319. onVisitTimeChange(e) {
  320. this.formData.visitTime = e;
  321. },
  322. // 接客时间改变
  323. onPickupTimeChange(e) {
  324. this.formData.pickupTime = e;
  325. },
  326. // 获取当前日期时间
  327. getCurrentDatetime() {
  328. const now = new Date();
  329. const year = now.getFullYear();
  330. const month = String(now.getMonth() + 1).padStart(2, '0');
  331. const day = String(now.getDate()).padStart(2, '0');
  332. const hour = String(now.getHours()).padStart(2, '0');
  333. const minute = String(now.getMinutes()).padStart(2, '0');
  334. return `${year}-${month}-${day} ${hour}:${minute}`;
  335. },
  336. // 添加随行人员
  337. addAccompany() {
  338. this.formData.accompanyPersons.push({
  339. name: '',
  340. phone: ''
  341. });
  342. },
  343. // 删除随行人员
  344. removeAccompany(index) {
  345. console.log('删除随行人员,索引:', index, '当前数量:', this.formData.accompanyPersons.length);
  346. if (this.formData.accompanyPersons.length > 1) {
  347. uni.showModal({
  348. title: '确认删除',
  349. content: '确定要删除这个随行人员吗?',
  350. success: (res) => {
  351. if (res.confirm) {
  352. this.formData.accompanyPersons.splice(index, 1);
  353. console.log('删除成功,剩余数量:', this.formData.accompanyPersons.length);
  354. }
  355. }
  356. });
  357. } else {
  358. uni.showToast({
  359. title: '至少保留一个随行人员',
  360. icon: 'none'
  361. });
  362. }
  363. },
  364. // 车辆开关改变
  365. onVehicleChange(e) {
  366. this.formData.useVehicle = e.detail.value;
  367. if (!this.formData.useVehicle) {
  368. // 关闭车辆使用时清空相关信息
  369. this.formData.pickupTime = '';
  370. this.formData.pickupLocation = '';
  371. }
  372. },
  373. // 手机号格式校验
  374. validatePhone(phone) {
  375. const phoneRegex = /^1[3-9]\d{9}$/;
  376. return phoneRegex.test(phone);
  377. },
  378. // 表单验证
  379. validateForm() {
  380. if (!this.formData.department) {
  381. uni.showToast({
  382. title: '请选择所属部门',
  383. icon: 'none'
  384. });
  385. return false;
  386. }
  387. if (!this.formData.employeeName) {
  388. uni.showToast({
  389. title: '请输入员工姓名',
  390. icon: 'none'
  391. });
  392. return false;
  393. }
  394. if (!this.formData.visitReason) {
  395. uni.showToast({
  396. title: '请输入访问事由',
  397. icon: 'none'
  398. });
  399. return false;
  400. }
  401. if (!this.formData.visitTime) {
  402. uni.showToast({
  403. title: '请选择到访时间',
  404. icon: 'none'
  405. });
  406. return false;
  407. }
  408. if (!this.formData.visitorName) {
  409. uni.showToast({
  410. title: '请输入访客姓名',
  411. icon: 'none'
  412. });
  413. return false;
  414. }
  415. // if (!this.formData.visitorCompany) {
  416. // uni.showToast({
  417. // title: '请输入访客单位',
  418. // icon: 'none'
  419. // });
  420. // return false;
  421. // }
  422. if (!this.formData.visitorPhone) {
  423. uni.showToast({
  424. title: '请输入手机号',
  425. icon: 'none'
  426. });
  427. return false;
  428. }
  429. // 校验访客手机号格式
  430. if (!this.validatePhone(this.formData.visitorPhone)) {
  431. uni.showToast({
  432. title: '请输入正确的手机号格式',
  433. icon: 'none'
  434. });
  435. return false;
  436. }
  437. // 验证随行人员信息
  438. for (let i = 0; i < this.formData.accompanyPersons.length; i++) {
  439. const person = this.formData.accompanyPersons[i];
  440. if (person.name && !person.phone) {
  441. uni.showToast({
  442. title: `请输入第${i + 1}个随行人员的手机号`,
  443. icon: 'none'
  444. });
  445. return false;
  446. }
  447. if (!person.name && person.phone) {
  448. uni.showToast({
  449. title: `请输入第${i + 1}个随行人员的姓名`,
  450. icon: 'none'
  451. });
  452. return false;
  453. }
  454. // 校验随行人员手机号格式
  455. if (person.phone && !this.validatePhone(person.phone)) {
  456. uni.showToast({
  457. title: `第${i + 1}个随行人员手机号格式不正确`,
  458. icon: 'none'
  459. });
  460. return false;
  461. }
  462. }
  463. // 验证车辆使用信息
  464. if (this.formData.useVehicle) {
  465. if (!this.formData.pickupTime) {
  466. uni.showToast({
  467. title: '请选择接客时间',
  468. icon: 'none'
  469. });
  470. return false;
  471. }
  472. if (!this.formData.pickupLocation) {
  473. uni.showToast({
  474. title: '请选择接客地点',
  475. icon: 'none'
  476. });
  477. return false;
  478. }
  479. }
  480. return true;
  481. },
  482. // 提交表单
  483. async submitForm() {
  484. if (!this.validateForm()) {
  485. return;
  486. }
  487. // 检查是否已登录(通过 openid 缓存判断)
  488. const openid = uni.getStorageSync('openid');
  489. console.log('当前 openid:', openid);
  490. if (!openid) {
  491. // 未登录,弹出授权登录组件
  492. console.log('未登录,弹出授权登录组件');
  493. uni.showToast({
  494. title: '请先登录',
  495. icon: 'none',
  496. duration: 1500
  497. });
  498. // 延迟弹出登录框,确保提示显示
  499. setTimeout(() => {
  500. this.$refs.authLoginPopup.open();
  501. }, 500);
  502. return;
  503. }
  504. // 已登录,继续提交表单
  505. console.log('已登录,继续提交表单');
  506. // 过滤空的随行人员
  507. const validAccompanyPersons = this.formData.accompanyPersons.filter(person =>
  508. person.name && person.phone
  509. );
  510. // 构建提交数据
  511. const submitData = {
  512. visitDate: this.formData.visitTime, // 访问时间
  513. userId: this.formData.employeeId, // 员工id(从选择的员工中获取user_id)后端不用了
  514. empName: this.formData.employeeName, // 访问部门人(员工姓名)
  515. visDept: this.formData.department, // 访客部门
  516. visitPerson: this.formData.visitorName, // 访客姓名
  517. visitorTel: this.formData.visitorPhone, // 访客手机
  518. visitorNum: (validAccompanyPersons.length + 1).toString(), // 访问人数(访客+随行人员)
  519. visitReson: this.formData.visitReason, // 访问事由
  520. // visDept: this.formData.visitorCompany, // 访客单位 后端没有给
  521. accPerson: JSON.stringify(validAccompanyPersons) // 随行人员转为JSON字符串
  522. };
  523. console.log('提交数据:', submitData);
  524. try {
  525. // 调用后端接口提交数据
  526. const response = await addVisit(submitData);
  527. console.log('提交响应:', response);
  528. // 检查返回结果(支持 code === 200 或 code === "200")
  529. if (response && (response.code === 200 || response.code === "200")) {
  530. //提示提交成功
  531. // uni.showToast({
  532. // title: response.msg || '操作成功',
  533. // icon: 'success',
  534. // duration: 2000
  535. // });
  536. this.$refs.successPopup.open();
  537. // 延迟返回上一页
  538. // setTimeout(() => {
  539. // uni.navigateBack({
  540. // fail: () => {
  541. // // 如果返回失败,跳转到访客页面
  542. // uni.switchTab({
  543. // url: '/pages/tabbar/visitor'
  544. // });
  545. // }
  546. // });
  547. // }, 2000);
  548. } else {
  549. // 提交失败
  550. uni.showToast({
  551. title: response.msg || response.message || '提交失败,请重试',
  552. icon: 'none',
  553. duration: 2000
  554. });
  555. }
  556. } catch (error) {
  557. console.error('提交异常:', error);
  558. // 优先使用后端返回的错误信息
  559. const errorMsg = error.data?.msg || error.msg || error.message || '提交失败,请重试';
  560. uni.showToast({
  561. title: errorMsg,
  562. icon: 'none',
  563. duration: 2000
  564. });
  565. }
  566. },
  567. // 关闭成功弹框
  568. closeSuccessPopup() {
  569. this.$refs.successPopup.close();
  570. // 返回上一页
  571. uni.navigateBack();
  572. },
  573. // 显示二维码
  574. showQRCode() {
  575. console.log('提交关注-跳转');
  576. this.$refs.successPopup.close();
  577. // this.$refs.qrcodePopup.open();
  578. uni.switchTab({
  579. url: '/pages/tabbar/visitor'
  580. });
  581. },
  582. // 关闭二维码弹框
  583. closeQRCode() {
  584. this.$refs.qrcodePopup.close();
  585. // 返回上一页
  586. uni.navigateBack();
  587. },
  588. // 跳转到隐私政策
  589. goToPrivacy() {
  590. uni.navigateTo({
  591. url: '/pagesA/public/richtext'
  592. });
  593. },
  594. // 跳转到服务协议
  595. goToService() {
  596. uni.navigateTo({
  597. url: '/pagesA/public/richtext'
  598. });
  599. },
  600. // 预览二维码
  601. previewQRCode() {
  602. uni.previewImage({
  603. urls: ['/static/images/qrcode.png'],
  604. current: 0
  605. });
  606. },
  607. // 登录成功回调
  608. onLoginSuccess(userInfo) {
  609. console.log('登录成功,用户信息:', userInfo);
  610. // 更新当前页面的用户信息
  611. this.user = userInfo;
  612. // 登录成功后提示用户可以继续提交
  613. uni.showToast({
  614. title: '登录成功,请继续提交',
  615. icon: 'success',
  616. duration: 1500
  617. });
  618. },
  619. // 登录弹窗关闭回调
  620. onLoginClose() {
  621. console.log('用户关闭了登录弹窗');
  622. },
  623. }
  624. }
  625. </script>
  626. <style lang="scss" scoped>
  627. .container {
  628. background-color: #f5f5f5;
  629. min-height: 100vh;
  630. }
  631. .form-container {
  632. padding: 20rpx;
  633. }
  634. .section {
  635. background-color: #fff;
  636. border-radius: 12rpx;
  637. margin-bottom: 20rpx;
  638. padding: 30rpx;
  639. }
  640. .section-title {
  641. font-size: 32rpx;
  642. font-weight: 600;
  643. color: #333;
  644. margin-bottom: 30rpx;
  645. display: flex;
  646. align-items: center;
  647. }
  648. .title-icon {
  649. width: 40rpx;
  650. height: 40rpx;
  651. margin-right: 15rpx;
  652. }
  653. .form-item {
  654. display: flex;
  655. align-items: center;
  656. margin-bottom: 30rpx;
  657. position: relative;
  658. &:last-child {
  659. margin-bottom: 0;
  660. }
  661. }
  662. .label {
  663. width: 160rpx;
  664. font-size: 28rpx;
  665. color: #666;
  666. flex-shrink: 0;
  667. }
  668. .input {
  669. flex: 1;
  670. height: 70rpx;
  671. padding: 0 20rpx;
  672. background-color: #f8f8f8;
  673. border-radius: 8rpx;
  674. font-size: 28rpx;
  675. color: #333;
  676. }
  677. .input-wrapper {
  678. flex: 1;
  679. height: 70rpx;
  680. padding: 0 20rpx;
  681. background-color: #f8f8f8;
  682. border-radius: 8rpx;
  683. display: flex;
  684. align-items: center;
  685. justify-content: space-between;
  686. }
  687. .placeholder {
  688. color: #c0c4cc;
  689. font-size: 28rpx;
  690. }
  691. .select-wrapper {
  692. flex: 1;
  693. ::v-deep .uni-stat__select {
  694. width: 100%;
  695. }
  696. ::v-deep .uni-stat-box {
  697. width: 100%;
  698. }
  699. ::v-deep .uni-select {
  700. width: 100%;
  701. border: none;
  702. }
  703. ::v-deep .uni-select__input-box {
  704. height: 70rpx;
  705. padding: 0 20rpx;
  706. background-color: #f8f8f8;
  707. border-radius: 8rpx;
  708. border: none;
  709. }
  710. ::v-deep .uni-select__input-text {
  711. font-size: 28rpx;
  712. color: #333;
  713. }
  714. ::v-deep .uni-select__input-placeholder {
  715. color: #c0c4cc;
  716. }
  717. ::v-deep .uni-select__selector {
  718. max-height: 400rpx;
  719. }
  720. }
  721. .accompany-list {
  722. .accompany-item {
  723. position: relative;
  724. padding: 20rpx;
  725. background-color: #f8f8f8;
  726. border-radius: 8rpx;
  727. margin-bottom: 20rpx;
  728. &:last-child {
  729. margin-bottom: 0;
  730. }
  731. }
  732. }
  733. .delete-btn {
  734. position: absolute;
  735. top: 10rpx;
  736. right: 10rpx;
  737. width: 70rpx;
  738. height: 70rpx;
  739. display: flex;
  740. align-items: center;
  741. justify-content: center;
  742. background-color: #fff;
  743. border-radius: 50%;
  744. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  745. z-index: 10;
  746. cursor: pointer;
  747. &:active {
  748. opacity: 0.7;
  749. transform: scale(0.95);
  750. }
  751. }
  752. .add-accompany-btn {
  753. display: flex;
  754. align-items: center;
  755. justify-content: center;
  756. height: 80rpx;
  757. background-color: #f8f9fa;
  758. border: 2rpx dashed #c0c4cc;
  759. border-radius: 8rpx;
  760. color: #909399;
  761. font-size: 28rpx;
  762. text {
  763. margin-left: 10rpx;
  764. }
  765. }
  766. .vehicle-header {
  767. display: flex;
  768. align-items: center;
  769. margin-bottom: 30rpx;
  770. .section-title {
  771. flex: 1;
  772. margin-bottom: 0;
  773. margin-left: 15rpx;
  774. }
  775. }
  776. .vehicle-content {
  777. padding-top: 20rpx;
  778. border-top: 1rpx solid #eee;
  779. }
  780. .submit-container {
  781. padding: 20rpx;
  782. background-color: #fff;
  783. margin-top: 20rpx;
  784. }
  785. .submit-btn {
  786. width: 100%;
  787. height: 88rpx;
  788. background: linear-gradient(135deg, #ff6b35 0%, #ff9500 100%);
  789. border-radius: 44rpx;
  790. border: none;
  791. color: #fff;
  792. font-size: 32rpx;
  793. font-weight: 600;
  794. }
  795. .picker-container {
  796. background-color: #fff;
  797. border-radius: 20rpx 20rpx 0 0;
  798. }
  799. .picker-header {
  800. display: flex;
  801. align-items: center;
  802. justify-content: space-between;
  803. padding: 30rpx;
  804. border-bottom: 1rpx solid #eee;
  805. text {
  806. color: #007aff;
  807. font-size: 28rpx;
  808. }
  809. }
  810. .picker-title {
  811. font-size: 32rpx;
  812. font-weight: 600;
  813. color: #333 !important;
  814. }
  815. .picker-view {
  816. height: 400rpx;
  817. }
  818. .picker-item {
  819. display: flex;
  820. align-items: center;
  821. justify-content: center;
  822. height: 80rpx;
  823. font-size: 28rpx;
  824. color: #333;
  825. }
  826. // 提交成功弹框样式
  827. .success-popup {
  828. .popup-content {
  829. background-color: #fff;
  830. border-radius: 20rpx;
  831. padding: 60rpx 40rpx 40rpx;
  832. width: 560rpx;
  833. text-align: center;
  834. }
  835. .success-icon {
  836. margin-bottom: 30rpx;
  837. }
  838. .popup-title {
  839. font-size: 36rpx;
  840. font-weight: 600;
  841. color: #333;
  842. margin-bottom: 20rpx;
  843. }
  844. .popup-message {
  845. font-size: 28rpx;
  846. color: #666;
  847. line-height: 1.6;
  848. margin-bottom: 50rpx;
  849. }
  850. .popup-buttons {
  851. display: flex;
  852. gap: 20rpx;
  853. button {
  854. flex: 1;
  855. height: 80rpx;
  856. border-radius: 40rpx;
  857. font-size: 28rpx;
  858. border: none;
  859. }
  860. .cancel-btn {
  861. background-color: #f5f5f5;
  862. color: #666;
  863. }
  864. .follow-btn {
  865. background: linear-gradient(135deg, #ff6b35 0%, #ff9500 100%);
  866. color: #fff;
  867. }
  868. }
  869. }
  870. // 二维码弹框样式
  871. .qrcode-popup {
  872. .qrcode-content {
  873. background-color: #fff;
  874. border-radius: 20rpx;
  875. padding: 50rpx 40rpx;
  876. width: 560rpx;
  877. text-align: center;
  878. }
  879. .qrcode-title {
  880. font-size: 32rpx;
  881. font-weight: 600;
  882. color: #333;
  883. margin-bottom: 40rpx;
  884. }
  885. .qrcode-image {
  886. width: 400rpx;
  887. height: 400rpx;
  888. margin: 0 auto 30rpx;
  889. border: 1rpx solid #eee;
  890. border-radius: 12rpx;
  891. overflow: hidden;
  892. position: relative;
  893. image {
  894. width: 100%;
  895. height: 100%;
  896. }
  897. .preview-tip {
  898. position: absolute;
  899. left: 0;
  900. right: 0;
  901. bottom: 0;
  902. height: 60rpx;
  903. background: rgba(0, 0, 0, 0.5);
  904. display: flex;
  905. align-items: center;
  906. justify-content: center;
  907. color: #fff;
  908. font-size: 24rpx;
  909. text {
  910. margin-left: 10rpx;
  911. }
  912. }
  913. &:active {
  914. opacity: 0.8;
  915. }
  916. }
  917. .qrcode-tip {
  918. font-size: 26rpx;
  919. color: #999;
  920. margin-bottom: 40rpx;
  921. line-height: 1.5;
  922. }
  923. .qrcode-close-btn {
  924. width: 100%;
  925. height: 80rpx;
  926. background: linear-gradient(135deg, #ff6b35 0%, #ff9500 100%);
  927. border-radius: 40rpx;
  928. color: #fff;
  929. font-size: 28rpx;
  930. border: none;
  931. }
  932. }
  933. </style>