Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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