Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

car-create.vue 13KB

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