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-create.vue 15KB

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