您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

car-create.vue 14KB

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