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-change.vue 18KB

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