You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

car-change.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <template>
  2. <view class="content">
  3. <view class="item-tips">
  4. <view class="title"> 上传后请核对识别信息 </view>
  5. <view class="tip"> 如有错误请及时手动修改 </view>
  6. </view>
  7. <view class="picture-wrapper" @click="takePhotoMode('3')">
  8. <view class="bg">
  9. <view class="">
  10. <view class="name"> 行驶证主页 </view>
  11. <view class="value"> 上传行驶证的主页 </view>
  12. <view class="tip">
  13. <view class="tip-value"> 拍摄规范 </view>
  14. </view>
  15. </view>
  16. <image v-if="!state.form.vehPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/car-zhu.png`">
  17. </image>
  18. <image v-else class="icon" :src="strReplace(state.form.vehPosImgUrl)"></image>
  19. </view>
  20. </view>
  21. <view class="picture-wrapper" @click="takePhotoMode('4')">
  22. <view class="bg">
  23. <view class="">
  24. <view class="name"> 行驶证副页 </view>
  25. <view class="value"> 上传行驶证的副页 </view>
  26. <view class="tip">
  27. <view class="tip-value"> 拍摄规范 </view>
  28. </view>
  29. </view>
  30. <image v-if="!state.form.vehNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/car-fu.png`">
  31. </image>
  32. <image v-else class="icon" :src="strReplace(state.form.vehNegImgUrl)"></image>
  33. </view>
  34. </view>
  35. <view class="picture-wrapper" @click="cardFileImageUpdate()">
  36. <view class="bg">
  37. <view class="">
  38. <view class="name"> 车头照 </view>
  39. <view class="value"> 上传汽车的车头照片 </view>
  40. <view class="tip">
  41. <view class="tip-value"> 拍摄规范 </view>
  42. </view>
  43. </view>
  44. <image v-if="!state.form.vehBodyUrl" class="icon" :src="`${$imgUrl}applyCard/chetou.png`">
  45. </image>
  46. <image v-else class="icon" :src="strReplace(state.form.vehBodyUrl)"></image>
  47. </view>
  48. </view>
  49. <view class="shibie-wrapper">
  50. <view class="title"> 识别内容如下 </view>
  51. <view class="">
  52. <u-form label-width="200" :model="state.form" ref="uForm">
  53. <u-form-item label="车牌号">
  54. <u-input inputAlign="right" v-model="state.form.vehicleId" disabled="true" />
  55. </u-form-item>
  56. <u-form-item label="车主姓名">
  57. <u-input inputAlign="right" v-model="state.form.ownerName" />
  58. </u-form-item>
  59. <u-form-item label="车辆类型">
  60. <u-input inputAlign="right" v-model="state.form.vehicleType" />
  61. </u-form-item>
  62. <!-- <u-form-item label="使用性质">
  63. <u-input inputAlign="right" v-model="state.form.useCharacter" />
  64. </u-form-item> -->
  65. <u-form-item label="车辆识别代号">
  66. <u-input inputAlign="right" v-model="state.form.vin" />
  67. </u-form-item>
  68. <u-form-item label="发动机号码">
  69. <u-input inputAlign="right" v-model="state.form.engineNum" />
  70. </u-form-item>
  71. <u-form-item label="注册日期">
  72. <u-input inputAlign="right" v-model="state.form.registerDate" />
  73. </u-form-item>
  74. <u-form-item label="发证日期">
  75. <u-input inputAlign="right" v-model="state.form.issueDate" />
  76. </u-form-item>
  77. <u-form-item label="核定载人数">
  78. <u-input inputAlign="right" v-model="state.form.approvedCount" />
  79. </u-form-item>
  80. <u-form-item label="整备质量">
  81. <u-input inputAlign="right" v-model="state.form.maintenaceMass" />
  82. </u-form-item>
  83. <u-form-item label="外廊尺寸">
  84. <u-input inputAlign="right" v-model="state.form.vehicleDimensions" />
  85. </u-form-item>
  86. <u-form-item label="总质量">
  87. <u-input inputAlign="right" v-model="state.form.totalMass" />
  88. </u-form-item>
  89. <!-- <u-form-item label="车牌颜色">
  90. <u-input inputAlign="right"
  91. v-model="state.showCaridCorlor" type="select" disabled="ture" />
  92. </u-form-item> -->
  93. </u-form>
  94. </view>
  95. </view>
  96. <view class="green-tip">
  97. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  98. </view>
  99. <view class="action">
  100. <button type="default" class="button" @click="savaHandle()">
  101. 下一步
  102. </button>
  103. </view>
  104. <u-select v-model="state.actionSheetShow" :list="state.actionSheetList" @confirm="selectConfirm"></u-select>
  105. </view>
  106. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  107. <view class="choice-takePhoto">
  108. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  109. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  110. <view @click.stop="cancle">取消</view>
  111. </view>
  112. </view>
  113. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  114. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  115. </template>
  116. <script setup lang="ts">
  117. import {
  118. reactive
  119. } from "vue";
  120. import navBgCar from "./components/nav-bg-car3";
  121. import navBar from "../../components/nav-bar/nav-bar2.vue";
  122. import {
  123. getItem
  124. } from "@/utils/storage.ts"
  125. import {
  126. etcCarCardInfoSubmit,
  127. etcCarOcrCard,
  128. fileUpload,
  129. changeCarInfo,
  130. envs
  131. } from "@/utils/network/api.js";
  132. import {
  133. request
  134. } from "@/utils/network/request.js";
  135. import {
  136. stringToJson
  137. } from "@/utils/network/encryption";
  138. import {
  139. onLoad,
  140. onShow
  141. } from "@dcloudio/uni-app";
  142. import {
  143. strReplace, uploadFile
  144. } from "@/utils/utils";
  145. import viewfinder from "@/components/viewfinder.vue"
  146. let cacachCarid = ''
  147. // 修改
  148. const savaHandle = () => {
  149. state.form.vehicleId = cacachCarid
  150. var data = state.form;
  151. console.log(data, "##########");
  152. const options = {
  153. type: 2,
  154. data: data,
  155. method: "POST",
  156. showLoading: true,
  157. };
  158. request(changeCarInfo, options).then((res) => {
  159. const data = stringToJson(res.bizContent);
  160. console.log(data)
  161. if (data.info == '成功.') {
  162. uni.reLaunch({
  163. url: "/subpackage/personal-center/setting/car-information/car-manage"
  164. })
  165. }
  166. });
  167. };
  168. const selectConfirm = (item : any) => {
  169. // item.map((val, index) => {
  170. // state.form.useUserType = val.value;
  171. // state.form.useUserTypeName = val.label;
  172. // });
  173. console.log(item);
  174. if (state.form.vehicleId) {
  175. state.showCaridCorlor = item[0].label
  176. state.carIdcorlorCode = item[0].value
  177. console.log(state.form);
  178. } else {
  179. uni.showToast({
  180. title: '请先填写车牌号',
  181. icon: 'none'
  182. })
  183. }
  184. };
  185. const cardFileImageUpdate = () => {
  186. uni.chooseImage({
  187. count: 1, //只能选取一张照片
  188. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  189. sourceType: ["camera", "album"], //从相册选择
  190. success: function (res) {
  191. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  192. state.form.vehBodyUrl = data;
  193. })
  194. },
  195. });
  196. };
  197. const state = reactive({
  198. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  199. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  200. isTakePhotoModeShow: false, //选择拍照方式是否出来
  201. changeColor: false,
  202. showImg: true,
  203. images: '',
  204. actionSheetShow: false,
  205. actionSheetList: [{
  206. label: "蓝色",
  207. value: 0,
  208. }, {
  209. label: "黄色",
  210. value: 1,
  211. },
  212. {
  213. label: "黑色",
  214. value: 2,
  215. },
  216. {
  217. label: "白色",
  218. value: 3,
  219. },
  220. {
  221. label: "渐变绿色",
  222. value: 4,
  223. },
  224. {
  225. label: "黄绿双拼色",
  226. value: 5,
  227. },
  228. {
  229. label: "蓝白渐变色",
  230. value: 6,
  231. },
  232. {
  233. label: "未确定",
  234. value: 9,
  235. },
  236. {
  237. label: "绿色",
  238. value: 11,
  239. },
  240. {
  241. label: "红色",
  242. value: 12,
  243. },
  244. ],
  245. showCaridCorlor: '',
  246. carIdcorlorCode: '',
  247. form: {
  248. openId: getItem('openId'), //用户标识.
  249. // man: "", //所有人
  250. // character: "", //使用性质
  251. register: "", //注册日期
  252. customerId: "", //用户编号 .
  253. vehicleId: "", //车牌编号 .
  254. issueDate: "", //发证日期 .
  255. vehPosImgUrl: "", //行驶证正面 .
  256. vehNegImgUrl: "", //行驶证证反面 .
  257. type: "0", //0,客车 1.货车 .
  258. useUserType: 0, //车辆用户类型 .
  259. // useUserTypeName: "普通车",
  260. vehicleSign: 2, //前/后装标识 .
  261. vin: "", //车辆识别代号 .
  262. engineNum: "", //发动机号码 .
  263. vehicleType: "", //车辆类型 .
  264. vehicleModel: "", //行驶证品牌型号 .
  265. approvedCount: undefined, //核定人数 .
  266. totalMass: undefined, //总质量 .
  267. maintenaceMass: undefined, //整备质量.
  268. permittedWeight: "", //核定载质量 .
  269. vehicleDimensions: "", //车辆尺寸 .
  270. permittedTowWeight: "", //准牵引总质量 .
  271. axleCount: "", //车轴数 .
  272. ownerName: "", //车主姓名
  273. ownerIdType: "", //车主证件类型
  274. ownerIdNum: "", //车主证件号码
  275. ownPosImgUrl: "", //车主证件正面图片
  276. ownNegImgUrl: "", //车主证件反面图片
  277. agreementId: "", //签约编号
  278. channelId: "", //编号渠道
  279. scenePayType: "", //
  280. transportIdNum: "", //道路运输证编号
  281. licenseIdNum: "", //经营许可证编号
  282. vehBodyUrl: "", //车身照片
  283. proxyUrl: "", //委托书地址,
  284. emergencyFlag: '', //应急车辆标识 0-非应急车辆 1-应急车辆
  285. contacts: '', //指定联系人列表
  286. ownerAddress: '', //所有人联系地址
  287. axisType: '', //轴型
  288. ownerTel: '', //所有人联系方式
  289. axleDistance: '', //轴距
  290. testRecord: '', //检验记录
  291. fileNum: '', //档案编号
  292. useCharacter: '', //车辆使用性质
  293. registerDate: '',//注册日期
  294. status: ""//车辆信息状态
  295. },
  296. orderId: "",
  297. isMyPeopple: true,
  298. });
  299. onLoad((option : any) => {
  300. // state.form.orderId = option.orderId;
  301. console.log(JSON.parse(option.data), "RRRRRRRRRRRRRRRRRRR");
  302. let data = JSON.parse(option.data)
  303. cacachCarid = data.vehicleId
  304. state.form.vehPosImgUrl = data.vehPosImgUrl
  305. state.form.vehNegImgUrl = data.vehNegImgUrl
  306. state.form.vehBodyUrl = data.vehBodyUrl
  307. state.form.vehicleId = data.vehiclePlate
  308. state.form.vehicleType = data.vehicleType
  309. // state.form.useCharacter=data.useCharacter
  310. state.form.vin = data.vin
  311. state.form.ownerName = data.ownerName
  312. state.form.engineNum = data.engineNum
  313. state.form.registerDate = data.registerDate
  314. state.form.issueDate = data.issueDate
  315. state.form.approvedCount = data.approvedCount
  316. state.form.maintenaceMass = data.maintenaceMass
  317. state.form.vehicleDimensions = data.vehicleDimensions
  318. state.form.totalMass = data.totalMass
  319. state.form.status = data.status
  320. if (data.status == '使用') {
  321. state.form.status = 1
  322. } else if (data.status == '未使用') {
  323. state.form.status = 2
  324. } else {
  325. state.form.status = 3
  326. }
  327. });
  328. const xiangce = (val) => {
  329. console.log("val", val)
  330. if (state.choiceIndex == 3) {
  331. var imageType = 1;
  332. } else {
  333. var imageType = 2;
  334. }
  335. state.changeColor = true;
  336. uni.chooseImage({
  337. count: 1, //只能选取一张照片
  338. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  339. sourceType: ["album"], //从相册选择
  340. success: function (res) {
  341. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  342. if (state.choiceIndex == 3 || state.choiceIndex == 4) {
  343. state.showImg = false
  344. state.images = res.tempFilePaths[0]
  345. state.phoneType = state.choiceIndex
  346. state.isTakePhotoModeShow = false
  347. return
  348. }
  349. },
  350. })
  351. }
  352. const takePhoto = (val) => {
  353. console.log("拍照", val)
  354. state.phoneType = val;
  355. state.showImg = true;
  356. }
  357. const confirmReturn = (val) => {
  358. if (state.choiceIndex == 3) {
  359. var imageType = 1;
  360. } else {
  361. var imageType = 2;
  362. }
  363. state.changeColor = true;
  364. state.phoneType = 0
  365. state.isTakePhotoModeShow = false
  366. uploadFile(val.tempImagePath, imageType, etcCarOcrCard).then((data) => {
  367. if (state.choiceIndex === "3") {
  368. // state.form.vehicleId = data.plate_a;
  369. state.form.ownerName = data.man;
  370. state.form.vehicleType = data.vehicle;
  371. // state.form.useCharacter = data.character;
  372. state.form.vin = data.vin;
  373. state.form.engineNum = data.engine;
  374. state.form.registerDate = data.register;
  375. state.form.issueDate = data.issue;
  376. state.form.vehPosImgUrl = data.imageUrl;
  377. state.form.vehicleModel = data.model;
  378. } else {
  379. state.form.approvedCount = parseFloat(data.apc);
  380. state.form.maintenaceMass = parseFloat(data.unladen);
  381. state.form.vehicleDimensions = data.overall;
  382. state.form.totalMass = parseFloat(data.gross);
  383. state.form.vehNegImgUrl = data.imageUrl;
  384. }
  385. state.isTakePhotoModeShow = false
  386. })
  387. console.log("图片地址val", val.tempImagePath)
  388. }
  389. const takePhotoMode = (index) => {
  390. console.log("index", index)
  391. state.isTakePhotoModeShow = true
  392. state.choiceIndex = index
  393. }
  394. const cancle = () => {
  395. state.isTakePhotoModeShow = false
  396. }
  397. const camera = () => {
  398. state.phoneType = 0
  399. }
  400. </script>
  401. <style lang="scss" scoped>
  402. .content {
  403. position: relative;
  404. // margin-top: -50rpx;
  405. padding: 0rpx 30rpx;
  406. position: relative;
  407. .img-pos {
  408. position: absolute;
  409. left: 270rpx;
  410. top: -38rpx;
  411. right: 50rpx;
  412. .img-flex {
  413. display: flex;
  414. justify-content: space-between;
  415. align-items: center;
  416. .car-img {
  417. width: 86rpx;
  418. height: 42rpx;
  419. }
  420. .flag-img {
  421. width: 30rpx;
  422. height: 35rpx;
  423. }
  424. }
  425. }
  426. .action {
  427. padding-left: 20rpx;
  428. padding-right: 20rpx;
  429. padding-bottom: 30rpx;
  430. .button {
  431. height: 80rpx;
  432. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  433. border-radius: 40rpx;
  434. font-size: 32rpx;
  435. font-weight: 400;
  436. color: #ffffff;
  437. line-height: 80rpx;
  438. }
  439. }
  440. .item-tips {
  441. .title {
  442. font-size: 30rpx;
  443. font-family: Microsoft YaHei;
  444. font-weight: 400;
  445. color: #000000;
  446. line-height: 24rpx;
  447. }
  448. .tip {
  449. margin-top: 16rpx;
  450. font-size: 24rpx;
  451. font-family: Microsoft YaHei;
  452. font-weight: 400;
  453. color: #999999;
  454. line-height: 24rpx;
  455. }
  456. }
  457. .picture-wrapper {
  458. margin-top: 40rpx;
  459. .bg {
  460. background: #ffffff;
  461. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  462. border-radius: 20rpx;
  463. padding: 40rpx;
  464. display: flex;
  465. // align-items: center;
  466. justify-content: space-between;
  467. .name {
  468. font-size: 34rpx;
  469. font-family: Microsoft YaHei;
  470. font-weight: 400;
  471. color: #000000;
  472. line-height: 34rpx;
  473. }
  474. .value {
  475. margin-top: 20rpx;
  476. font-size: 24rpx;
  477. font-family: Microsoft YaHei;
  478. font-weight: 400;
  479. color: #999999;
  480. line-height: 24rpx;
  481. }
  482. .tip {
  483. margin-top: 20rpx;
  484. text-align: center;
  485. width: 110rpx;
  486. height: 40rpx;
  487. background: rgba(33, 190, 177, 0.2);
  488. border-radius: 6rpx;
  489. .tip-value {
  490. font-size: 20rpx;
  491. font-family: Microsoft YaHei;
  492. font-weight: 400;
  493. color: #0a8f8a;
  494. line-height: 40rpx;
  495. opacity: 1;
  496. }
  497. }
  498. }
  499. .icon {
  500. width: 294rpx;
  501. height: 188rpx;
  502. }
  503. }
  504. .shibie-wrapper {
  505. margin-top: 60rpx;
  506. .title {
  507. font-size: 30rpx;
  508. font-family: Microsoft YaHei;
  509. font-weight: 400;
  510. color: #000000;
  511. line-height: 30rpx;
  512. }
  513. }
  514. .buchong-wrapper {
  515. margin-top: 60rpx;
  516. .title {
  517. font-size: 30rpx;
  518. font-family: Microsoft YaHei;
  519. font-weight: 400;
  520. color: #000000;
  521. line-height: 30rpx;
  522. }
  523. }
  524. .green-tip {
  525. margin-top: 50rpx;
  526. font-size: 24rpx;
  527. font-family: Microsoft YaHei;
  528. font-weight: 400;
  529. color: #00b38b;
  530. line-height: 24rpx;
  531. margin-bottom: 60rpx;
  532. }
  533. }
  534. .choice-takePhoto {
  535. position: absolute;
  536. bottom: 0;
  537. background-color: white;
  538. width: 100%;
  539. border-radius: 20rpx 20rpx 0 0;
  540. }
  541. .choice-takePhoto>view:first-child {
  542. text-align: center;
  543. height: 80rpx;
  544. line-height: 80rpx;
  545. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  546. background-color: white;
  547. }
  548. .choice-takePhoto>view:last-child {
  549. text-align: center;
  550. height: 80rpx;
  551. line-height: 80rpx;
  552. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  553. background-color: white;
  554. }
  555. .choice-takePhoto>view {
  556. text-align: center;
  557. height: 80rpx;
  558. line-height: 80rpx;
  559. background-color: white;
  560. }
  561. .choice-takePhoto-wrap {
  562. width: 100%;
  563. height: 100vh;
  564. background-color: rgba(127, 127, 127, 0.2);
  565. position: fixed;
  566. left: 0;
  567. top: 0;
  568. z-index: 11111;
  569. }
  570. </style>