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.

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