Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vehicle-details.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <template>
  2. <view class="vehicle-details-container">
  3. <!-- 车辆基本信息 -->
  4. <view class="vehicle-info-section">
  5. <view class="info-item">
  6. <text class="label">车牌号</text>
  7. <text class="value">{{ vehicleInfo.vehiclePlate }}</text>
  8. </view>
  9. <view class="info-item">
  10. <text class="label">车牌颜色</text>
  11. <text class="value">{{
  12. getVehiclePlateColor(vehicleInfo.vehiclePlateColor)
  13. }}</text>
  14. </view>
  15. <!-- 行驶证图片 -->
  16. <view class="license-section">
  17. <view class="license-item">
  18. <text class="license-title">行驶证主页</text>
  19. <view class="license-image-container">
  20. <image
  21. v-if="vehicleInfo.vehPosImgUrl"
  22. :src="getImageUrl(vehicleInfo.vehPosImgUrl)"
  23. class="license-image"
  24. mode="aspectFit"
  25. @click="previewImage(getImageUrl(vehicleInfo.vehPosImgUrl))"
  26. />
  27. <view v-else class="license-placeholder">
  28. <text class="placeholder-text">暂无图片</text>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="license-item">
  33. <text class="license-title">行驶证副页</text>
  34. <view class="license-image-container">
  35. <image
  36. v-if="vehicleInfo.vehNegImgUrl"
  37. :src="getImageUrl(vehicleInfo.vehNegImgUrl)"
  38. class="license-image"
  39. mode="aspectFit"
  40. @click="previewImage(getImageUrl(vehicleInfo.vehNegImgUrl))"
  41. />
  42. <view v-else class="license-placeholder">
  43. <text class="placeholder-text">暂无图片</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="info-item">
  49. <text class="label">车辆所有人信息</text>
  50. <text class="value">{{ vehicleInfo.ownerName }}</text>
  51. </view>
  52. <view class="info-item">
  53. <text class="label">车辆所有人证件类型</text>
  54. <text class="value">{{ vehicleInfo.ownerIdType }}</text>
  55. </view>
  56. <view class="info-item">
  57. <text class="label">车辆所有人证件号码</text>
  58. <text class="value">{{ vehicleInfo.ownerIdNum }}</text>
  59. </view>
  60. <view class="info-item">
  61. <text class="label">车辆所有人电话</text>
  62. <text class="value">{{ vehicleInfo.ownerTel }}</text>
  63. </view>
  64. <view class="info-item">
  65. <text class="label">车辆号码</text>
  66. <text class="value">{{ vehicleInfo.vehicleId }}</text>
  67. </view>
  68. <view class="info-item">
  69. <text class="label">行驶证车辆类型</text>
  70. <text class="value">{{ vehicleInfo.vehicleType }}</text>
  71. </view>
  72. <view class="info-item">
  73. <text class="label">车辆识别号</text>
  74. <text class="value">{{ vehicleInfo.vin }}</text>
  75. </view>
  76. <view class="info-item">
  77. <text class="label">发动机号码</text>
  78. <text class="value">{{ vehicleInfo.engineNum }}</text>
  79. </view>
  80. <view class="info-item">
  81. <text class="label">车辆收费类型</text>
  82. <text class="value">{{ vehicleInfo.type }}</text>
  83. </view>
  84. <view class="info-item">
  85. <text class="label">核定载人数</text>
  86. <text class="value">{{ vehicleInfo.approvedCount }}</text>
  87. </view>
  88. <view class="info-item">
  89. <text class="label">总质量</text>
  90. <text class="value">{{ vehicleInfo.totalMass }}kg</text>
  91. </view>
  92. <view class="info-item">
  93. <text class="label">整备质量</text>
  94. <text class="value">{{ vehicleInfo.maintenaceMass }}kg</text>
  95. </view>
  96. <view class="info-item">
  97. <text class="label">核定载质量</text>
  98. <text class="value">{{ vehicleInfo.permittedWeight }}kg</text>
  99. </view>
  100. <view class="info-item">
  101. <text class="label">外廊尺寸</text>
  102. <text class="value">{{ vehicleInfo.vehicleDimensions }}</text>
  103. </view>
  104. <view class="info-item">
  105. <text class="label">准牵引总质量</text>
  106. <text class="value">{{ vehicleInfo.permittedTowWeight }}Kg</text>
  107. </view>
  108. <view class="info-item">
  109. <text class="label">车轮数</text>
  110. <text class="value">{{ vehicleInfo.vehicleWheelCount }}</text>
  111. </view>
  112. <view class="info-item">
  113. <text class="label">车轴数</text>
  114. <text class="value">{{ vehicleInfo.axleCount }}</text>
  115. </view>
  116. <view class="info-item">
  117. <text class="label">车辆使用性质</text>
  118. <text class="value">{{ vehicleInfo.useCharacter }}</text>
  119. </view>
  120. <!-- 车身照和车头照 -->
  121. <view class="license-section">
  122. <view class="license-item">
  123. <text class="license-title">车身照</text>
  124. <view class="license-image-container">
  125. <image
  126. v-if="vehicleInfo.vehBodyUrl"
  127. :src="getImageUrl(vehicleInfo.vehBodyUrl)"
  128. class="license-image"
  129. mode="aspectFit"
  130. @click="previewImage(getImageUrl(vehicleInfo.vehBodyUrl))"
  131. />
  132. <view v-else class="license-placeholder">
  133. <text class="placeholder-text">暂无图片</text>
  134. </view>
  135. </view>
  136. </view>
  137. <view class="license-item">
  138. <text class="license-title">车头照</text>
  139. <view class="license-image-container">
  140. <image
  141. v-if="vehicleInfo.proxyUrl"
  142. :src="getImageUrl(vehicleInfo.proxyUrl)"
  143. class="license-image"
  144. mode="aspectFit"
  145. @click="previewImage(getImageUrl(vehicleInfo.proxyUrl))"
  146. />
  147. <view v-else class="license-placeholder">
  148. <text class="placeholder-text">暂无图片</text>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- 底部按钮 -->
  155. <view class="bottom-actions">
  156. <button class="submit-btn" @click="changeVehicleInfo">车辆信息变更</button>
  157. </view>
  158. </view>
  159. </template>
  160. <script lang="ts" setup>
  161. import { reactive, ref } from "vue";
  162. import { onLoad } from "@dcloudio/uni-app";
  163. import { getVehiclePlateColor } from "@/datas/vehiclePlateColor";
  164. import { vehicleInfoView } from "@/utils/network/api.js";
  165. import { requestNew } from "@/utils/network/request.js";
  166. import { fileURL } from "@/datas/fileURL.js";
  167. // 响应式数据
  168. const vehicleInfo = reactive({
  169. vehiclePlate: '',
  170. vehiclePlateColor: 0,
  171. vehPosImgUrl: '',
  172. vehNegImgUrl: '',
  173. ownerName: '',
  174. ownerIdType: '',
  175. ownerIdNum: '',
  176. ownerTel: '',
  177. vin: '',
  178. vehicleId: '',
  179. vehicleType: '',
  180. engineNum: '',
  181. type: '',
  182. approvedCount: 0,
  183. totalMass: 0,
  184. maintenaceMass: 0,
  185. permittedWeight: 0,
  186. vehicleDimensions: '',
  187. permittedTowWeight: 0,
  188. vehicleWheelCount: 0,
  189. axleCount: 0,
  190. useCharacter: '',
  191. vehBodyUrl: '',
  192. proxyUrl: ''
  193. });
  194. const plateNumber = ref(["贵", "Z", "M", "J", "U", "7", "0"]);
  195. const currentInputIndex = ref(0);
  196. const selectedColor = ref("blue");
  197. // 页面加载
  198. onLoad((options) => {
  199. console.log("车辆详情页面参数:", options);
  200. uni.setNavigationBarTitle({
  201. title: "车辆详情",
  202. });
  203. if (options.id) {
  204. // 根据id获取车辆详情
  205. getVehicleDetails(options.id);
  206. } else {
  207. uni.showToast({
  208. title: "缺少车辆ID参数",
  209. icon: "none",
  210. });
  211. }
  212. });
  213. // 获取车辆详情
  214. const getVehicleDetails = (id: string) => {
  215. const options = {
  216. type: 2,
  217. data: {
  218. vehicleId: id,
  219. },
  220. method: "POST",
  221. showLoading: true,
  222. };
  223. requestNew(vehicleInfoView, options)
  224. .then((res) => {
  225. console.log("车辆详情接口返回:", res);
  226. if (res) {
  227. // 将接口返回的数据赋值给vehicleInfo
  228. Object.assign(vehicleInfo, res);
  229. console.log(vehicleInfo, 'vehicleInfo');
  230. } else {
  231. uni.showToast({
  232. title: res?.message || "获取车辆信息失败",
  233. icon: "none",
  234. });
  235. }
  236. })
  237. .catch((err) => {
  238. console.error("获取车辆详情失败:", err);
  239. uni.showToast({
  240. title: "获取车辆信息失败",
  241. icon: "none",
  242. });
  243. });
  244. };
  245. // 处理图片URL
  246. const getImageUrl = (url: string) => {
  247. if (!url) return '';
  248. // 如果已经是完整URL,直接返回
  249. if (url.startsWith('http://') || url.startsWith('https://')) {
  250. return url;
  251. }
  252. // 从fileURL中删除default-bucket/后缀,然后拼上url
  253. const baseUrl = fileURL.replace('/default-bucket/', '');
  254. return `${baseUrl}/${url}`;
  255. };
  256. // 预览图片
  257. const previewImage = (url: string) => {
  258. if (url) {
  259. uni.previewImage({
  260. urls: [url],
  261. current: url,
  262. });
  263. }
  264. };
  265. // 聚焦输入框
  266. const focusInput = (index: number) => {
  267. currentInputIndex.value = index;
  268. };
  269. // 添加新车牌
  270. const addNewPlate = () => {
  271. uni.showToast({
  272. title: "添加新车牌功能",
  273. icon: "none",
  274. });
  275. };
  276. // 选择车牌颜色
  277. const selectColor = (color: string) => {
  278. selectedColor.value = color;
  279. };
  280. // 选择图片
  281. const chooseImage = () => {
  282. uni.chooseImage({
  283. count: 1,
  284. sizeType: ["compressed"],
  285. sourceType: ["album", "camera"],
  286. success: (res) => {
  287. vehicleInfo.proxyUrl = res.tempFilePaths[0];
  288. },
  289. });
  290. };
  291. // 下一步
  292. const nextStep = () => {
  293. uni.showToast({
  294. title: "下一步功能",
  295. icon: "none",
  296. });
  297. };
  298. // 车辆信息变更
  299. const changeVehicleInfo = () => {
  300. uni.navigateTo({
  301. url: `/subpackage/personal-center/vehicle-change/vehicle-change-choiceType?vehicleId=${vehicleInfo.vehicleId}&vehiclePlate=${vehicleInfo.vehiclePlate}`,
  302. });
  303. };
  304. </script>
  305. <style lang="scss" scoped>
  306. .vehicle-details-container {
  307. min-height: 100vh;
  308. background-color: #f5f5f5;
  309. padding-bottom: 200rpx;
  310. }
  311. .header {
  312. background-color: #fff;
  313. padding: 30rpx;
  314. text-align: center;
  315. border-bottom: 1rpx solid #eee;
  316. .title {
  317. font-size: 36rpx;
  318. font-weight: bold;
  319. color: #333;
  320. }
  321. }
  322. .vehicle-info-section {
  323. background-color: #fff;
  324. margin: 20rpx;
  325. border-radius: 12rpx;
  326. padding: 30rpx;
  327. .info-item {
  328. display: flex;
  329. justify-content: space-between;
  330. align-items: center;
  331. padding: 20rpx 0;
  332. border-bottom: 1rpx solid #f0f0f0;
  333. &:last-child {
  334. border-bottom: none;
  335. }
  336. .label {
  337. font-size: 28rpx;
  338. color: #666;
  339. flex: 1;
  340. }
  341. .value {
  342. font-size: 28rpx;
  343. color: #333;
  344. flex: 2;
  345. text-align: right;
  346. }
  347. }
  348. }
  349. .license-section {
  350. background-color: #fff;
  351. margin: 20rpx;
  352. border-radius: 12rpx;
  353. padding: 30rpx;
  354. .license-item {
  355. margin-bottom: 30rpx;
  356. &:last-child {
  357. margin-bottom: 0;
  358. }
  359. .license-title {
  360. font-size: 28rpx;
  361. color: #333;
  362. margin-bottom: 20rpx;
  363. display: block;
  364. }
  365. .license-image-container {
  366. width: 100%;
  367. height: 300rpx;
  368. border: 2rpx dashed #ddd;
  369. border-radius: 8rpx;
  370. display: flex;
  371. align-items: center;
  372. justify-content: center;
  373. .license-image {
  374. width: 100%;
  375. height: 100%;
  376. border-radius: 8rpx;
  377. }
  378. .license-placeholder {
  379. display: flex;
  380. align-items: center;
  381. justify-content: center;
  382. width: 100%;
  383. height: 100%;
  384. .placeholder-text {
  385. color: #999;
  386. font-size: 26rpx;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. .plate-selection-section {
  393. background-color: #fff;
  394. margin: 20rpx;
  395. border-radius: 12rpx;
  396. padding: 30rpx;
  397. .plate-header {
  398. margin-bottom: 30rpx;
  399. .plate-title {
  400. font-size: 32rpx;
  401. color: #333;
  402. font-weight: bold;
  403. }
  404. }
  405. .plate-input-section {
  406. margin-bottom: 30rpx;
  407. .input-label {
  408. font-size: 28rpx;
  409. color: #666;
  410. margin-bottom: 20rpx;
  411. display: block;
  412. }
  413. .plate-input-container {
  414. display: flex;
  415. align-items: center;
  416. gap: 10rpx;
  417. .plate-char-input {
  418. width: 80rpx;
  419. height: 80rpx;
  420. border: 2rpx solid #ddd;
  421. border-radius: 8rpx;
  422. display: flex;
  423. align-items: center;
  424. justify-content: center;
  425. background-color: #fff;
  426. &.active {
  427. border-color: #007aff;
  428. background-color: #f0f8ff;
  429. }
  430. .plate-char {
  431. font-size: 32rpx;
  432. color: #333;
  433. font-weight: bold;
  434. }
  435. }
  436. .plate-add-btn {
  437. width: 80rpx;
  438. height: 80rpx;
  439. border: 2rpx solid #ddd;
  440. border-radius: 8rpx;
  441. display: flex;
  442. flex-direction: column;
  443. align-items: center;
  444. justify-content: center;
  445. background-color: #fff;
  446. .add-icon {
  447. font-size: 24rpx;
  448. color: #007aff;
  449. font-weight: bold;
  450. }
  451. .add-text {
  452. font-size: 20rpx;
  453. color: #007aff;
  454. }
  455. }
  456. }
  457. }
  458. .plate-color-section {
  459. .color-label {
  460. font-size: 28rpx;
  461. color: #666;
  462. margin-bottom: 20rpx;
  463. display: block;
  464. }
  465. .color-options {
  466. display: flex;
  467. gap: 20rpx;
  468. .color-option {
  469. flex: 1;
  470. height: 80rpx;
  471. border-radius: 8rpx;
  472. display: flex;
  473. align-items: center;
  474. justify-content: center;
  475. border: 2rpx solid transparent;
  476. &.blue {
  477. background: linear-gradient(135deg, #007aff, #0056b3);
  478. &.active {
  479. border-color: #007aff;
  480. box-shadow: 0 0 10rpx rgba(0, 122, 255, 0.3);
  481. }
  482. }
  483. &.green {
  484. background: linear-gradient(135deg, #34c759, #28a745);
  485. &.active {
  486. border-color: #34c759;
  487. box-shadow: 0 0 10rpx rgba(52, 199, 89, 0.3);
  488. }
  489. }
  490. .color-text {
  491. color: #fff;
  492. font-size: 28rpx;
  493. font-weight: bold;
  494. }
  495. }
  496. }
  497. }
  498. }
  499. .front-photo-section {
  500. background-color: #fff;
  501. margin: 20rpx;
  502. border-radius: 12rpx;
  503. padding: 30rpx;
  504. .photo-title {
  505. font-size: 28rpx;
  506. color: #333;
  507. margin-bottom: 20rpx;
  508. display: block;
  509. }
  510. .photo-container {
  511. width: 100%;
  512. height: 400rpx;
  513. border: 2rpx dashed #ddd;
  514. border-radius: 8rpx;
  515. display: flex;
  516. align-items: center;
  517. justify-content: center;
  518. .front-photo {
  519. width: 100%;
  520. height: 100%;
  521. border-radius: 8rpx;
  522. }
  523. .photo-placeholder {
  524. display: flex;
  525. align-items: center;
  526. justify-content: center;
  527. width: 100%;
  528. height: 100%;
  529. .placeholder-text {
  530. color: #999;
  531. font-size: 26rpx;
  532. }
  533. }
  534. }
  535. }
  536. .bottom-actions {
  537. position: fixed;
  538. bottom: 0;
  539. left: 0;
  540. right: 0;
  541. background-color: #fff;
  542. padding: 30rpx;
  543. border-top: 1rpx solid #eee;
  544. display: flex;
  545. flex-direction: column;
  546. gap: 20rpx;
  547. .next-btn {
  548. background: linear-gradient(135deg, #007aff, #0056b3);
  549. color: #fff;
  550. border: none;
  551. border-radius: 12rpx;
  552. height: 88rpx;
  553. font-size: 32rpx;
  554. font-weight: bold;
  555. }
  556. .submit-btn {
  557. width:90%;
  558. background: linear-gradient(to bottom, #1e3a8a, #1e1e1e);
  559. color: #fff;
  560. border: none;
  561. border-radius: 50rpx;
  562. height: 88rpx;
  563. font-size: 32rpx;
  564. font-weight: bold;
  565. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.3);
  566. position: relative;
  567. &::before {
  568. content: "";
  569. position: absolute;
  570. top: 0;
  571. left: 0;
  572. right: 0;
  573. height: 2rpx;
  574. background: linear-gradient(to right, #60a5fa, #93c5fd);
  575. border-radius: 50rpx 50rpx 0 0;
  576. }
  577. &::after {
  578. content: "";
  579. position: absolute;
  580. bottom: 0;
  581. left: 0;
  582. right: 0;
  583. height: 2rpx;
  584. background: #000;
  585. border-radius: 0 0 50rpx 50rpx;
  586. }
  587. }
  588. }
  589. </style>