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

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