Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

car-change.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  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="车牌号">
  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.man" />
  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.character" />
  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.register" />
  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.form.useUserTypeName" 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 { reactive } from "vue";
  118. import {
  119. etcCarCardInfoSubmit,
  120. etcCarOcrCard,
  121. fileUpload,
  122. } from "@/utils/network/api.js";
  123. import { navTo, uploadFile } from "@/utils/utils";
  124. import { request } from "@/utils/network/request.js";
  125. import { stringToJson } from "@/utils/network/encryption";
  126. import { onLoad, onShow } from "@dcloudio/uni-app";
  127. import viewfinder from "@/components/viewfinder.vue"
  128. const savaHandle = () => {
  129. navTo("/subpackage/after-sale/to-bookkeeping-card/release-products");
  130. };
  131. const selectConfirm = (item : any) => {
  132. item.map((val, index) => {
  133. state.form.useUserType = val.value;
  134. state.form.useUserTypeName = val.label;
  135. });
  136. };
  137. const cardFileImageUpdate = () => {
  138. uni.chooseImage({
  139. count: 1, //只能选取一张照片
  140. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  141. sourceType: ["camera", "album"], //从相册选择
  142. success: function (res) {
  143. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  144. state.form.vehBodyUrl = data;
  145. })
  146. },
  147. });
  148. };
  149. const state = reactive({
  150. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  151. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  152. isTakePhotoModeShow: false, //选择拍照方式是否出来
  153. changeColor: false,
  154. showImg: true,
  155. images: '',
  156. actionSheetShow: false,
  157. actionSheetList: [
  158. {
  159. label: "普通车",
  160. value: 0,
  161. },
  162. {
  163. label:
  164. "道路运输证经营范围仅有“货物专用运输(集装箱) ”的牵引车办理J类型集装箱",
  165. value: 24,
  166. },
  167. {
  168. label: "道路运输证经营范围不含“货物专用运输(集装箱)”的牵引车",
  169. value: 27,
  170. },
  171. {
  172. label:
  173. '道路运输证经营范围除“货物专用运输 (集装 箱)"外,还有“普通货运”等其他项目的牵引车办理J2类型集装箱',
  174. value: 28,
  175. },
  176. ],
  177. form: {
  178. orderId: "", //订单ID
  179. man: "", //所有人
  180. character: "", //使用性质
  181. register: "", //注册日期
  182. customerId: "", //用户编号
  183. vehicleId: "", //车牌编号
  184. issueDate: "", //发证日期
  185. vehPosImgUrl: "", //行驶证正面
  186. vehNegImgUrl: "", //行驶证证反面
  187. type: "0", //0,客车 1.货车
  188. useUserType: 0, //车辆用户类型
  189. useUserTypeName: "普通车",
  190. vehicleSign: 2, //前/后装标识
  191. vin: "", //车辆识别代号
  192. engineNum: "", //发动机号码
  193. vehicleType: "", //车辆类型
  194. vehicleModel: "", //行驶证品牌型号
  195. approvedCount: undefined, //核定人数
  196. totalMass: undefined, //总质量
  197. maintenaceMass: undefined, //整备质量
  198. permittedWeight: "", //核定载质量
  199. vehicleDimensions: "", //车辆尺寸
  200. permittedTowWeight: "", //准牵引总质量
  201. axleCount: "", //车轴数
  202. ownerName: "", //车主姓名
  203. ownerIdType: "", //车主证件类型
  204. ownerIdNum: "", //车主证件号码
  205. ownPosImgUrl: "", //车主证件正面图片
  206. ownNegImgUrl: "", //车主证件反面图片
  207. agreementId: "", //签约编号
  208. channelId: "5201018892300000001", //编号渠道
  209. scenePayType: "", //
  210. transportIdNum: "", //道路运输证编号
  211. licenseIdNum: "", //经营许可证编号
  212. vehBodyUrl: "", //车身照片
  213. proxyUrl: "", //委托书地址
  214. },
  215. orderId: "",
  216. isMyPeopple: true,
  217. });
  218. onLoad((option : any) => {
  219. state.form.orderId = option.orderId;
  220. });
  221. const xiangce = (val) => {
  222. console.log("val", val)
  223. if (state.choiceIndex == 3) {
  224. var imageType = 1;
  225. } else {
  226. var imageType = 2;
  227. }
  228. state.changeColor = true;
  229. uni.chooseImage({
  230. count: 1, //只能选取一张照片
  231. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  232. sourceType: ["album"], //从相册选择
  233. success: function (res) {
  234. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  235. if (state.choiceIndex == 3 || state.choiceIndex == 4) {
  236. state.showImg = false
  237. state.images = res.tempFilePaths[0]
  238. state.phoneType = state.choiceIndex
  239. state.isTakePhotoModeShow = false
  240. return
  241. }
  242. },
  243. })
  244. }
  245. const takePhoto = (val) => {
  246. console.log("拍照", val)
  247. state.phoneType = val;
  248. state.showImg = true;
  249. }
  250. const confirmReturn = (val) => {
  251. if (state.choiceIndex == 3) {
  252. var imageType = 1;
  253. } else {
  254. var imageType = 2;
  255. }
  256. state.changeColor = true;
  257. state.phoneType = 0
  258. state.isTakePhotoModeShow = false
  259. uploadFile(val.tempImagePath, imageType, etcCarOcrCard).then((data) => {
  260. if (state.choiceIndex === "3") {
  261. state.form.vehicleId = data.plate_a;
  262. state.form.man = data.man;
  263. state.form.vehicleType = data.vehicle;
  264. state.form.character = data.character;
  265. state.form.vin = data.vin;
  266. state.form.engineNum = data.engine;
  267. state.form.register = data.register;
  268. state.form.issueDate = data.issue;
  269. state.form.vehPosImgUrl = data.imageUrl;
  270. state.form.vehicleModel = data.model;
  271. } else {
  272. state.form.approvedCount = parseFloat(data.apc);
  273. state.form.maintenaceMass = parseFloat(data.unladen);
  274. state.form.vehicleDimensions = data.overall;
  275. state.form.totalMass = parseFloat(data.gross);
  276. state.form.vehNegImgUrl = data.imageUrl;
  277. }
  278. state.isTakePhotoModeShow = false
  279. })
  280. console.log("图片地址val", val.tempImagePath)
  281. }
  282. const takePhotoMode = (index) => {
  283. console.log("index", index)
  284. state.isTakePhotoModeShow = true
  285. state.choiceIndex = index
  286. }
  287. const cancle = () => {
  288. state.isTakePhotoModeShow = false
  289. }
  290. </script>
  291. <style lang="scss" scoped>
  292. .content {
  293. position: relative;
  294. margin-top: 50rpx;
  295. padding: 0rpx 30rpx;
  296. position: relative;
  297. .img-pos {
  298. position: absolute;
  299. left: 270rpx;
  300. top: -38rpx;
  301. right: 50rpx;
  302. .img-flex {
  303. display: flex;
  304. justify-content: space-between;
  305. align-items: center;
  306. .car-img {
  307. width: 86rpx;
  308. height: 42rpx;
  309. }
  310. .flag-img {
  311. width: 30rpx;
  312. height: 35rpx;
  313. }
  314. }
  315. }
  316. .action {
  317. padding-left: 20rpx;
  318. padding-right: 20rpx;
  319. padding-bottom: 30rpx;
  320. .button {
  321. height: 80rpx;
  322. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  323. border-radius: 40rpx;
  324. font-size: 32rpx;
  325. font-weight: 400;
  326. color: #ffffff;
  327. line-height: 80rpx;
  328. }
  329. }
  330. .item-tips {
  331. .title {
  332. font-size: 30rpx;
  333. font-family: Microsoft YaHei;
  334. font-weight: 400;
  335. color: #000000;
  336. line-height: 24rpx;
  337. }
  338. .tip {
  339. margin-top: 16rpx;
  340. font-size: 24rpx;
  341. font-family: Microsoft YaHei;
  342. font-weight: 400;
  343. color: #999999;
  344. line-height: 24rpx;
  345. }
  346. }
  347. .picture-wrapper {
  348. margin-top: 40rpx;
  349. .bg {
  350. background: #ffffff;
  351. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  352. border-radius: 20rpx;
  353. padding: 40rpx;
  354. display: flex;
  355. // align-items: center;
  356. justify-content: space-between;
  357. .name {
  358. font-size: 34rpx;
  359. font-family: Microsoft YaHei;
  360. font-weight: 400;
  361. color: #000000;
  362. line-height: 34rpx;
  363. }
  364. .value {
  365. margin-top: 20rpx;
  366. font-size: 24rpx;
  367. font-family: Microsoft YaHei;
  368. font-weight: 400;
  369. color: #999999;
  370. line-height: 24rpx;
  371. }
  372. .tip {
  373. margin-top: 20rpx;
  374. text-align: center;
  375. width: 110rpx;
  376. height: 40rpx;
  377. background: rgba(33, 190, 177, 0.2);
  378. border-radius: 6rpx;
  379. .tip-value {
  380. font-size: 20rpx;
  381. font-family: Microsoft YaHei;
  382. font-weight: 400;
  383. color: #0a8f8a;
  384. line-height: 40rpx;
  385. opacity: 1;
  386. }
  387. }
  388. }
  389. .icon {
  390. width: 294rpx;
  391. height: 188rpx;
  392. }
  393. }
  394. .shibie-wrapper {
  395. margin-top: 60rpx;
  396. .title {
  397. font-size: 30rpx;
  398. font-family: Microsoft YaHei;
  399. font-weight: 400;
  400. color: #000000;
  401. line-height: 30rpx;
  402. }
  403. ::v-deep .u-form-item {
  404. border-bottom: 1rpx solid #DCDCDC;
  405. padding: 10rpx 0;
  406. }
  407. }
  408. .buchong-wrapper {
  409. margin-top: 60rpx;
  410. .title {
  411. font-size: 30rpx;
  412. font-family: Microsoft YaHei;
  413. font-weight: 400;
  414. color: #000000;
  415. line-height: 30rpx;
  416. }
  417. }
  418. .green-tip {
  419. margin-top: 50rpx;
  420. font-size: 24rpx;
  421. font-family: Microsoft YaHei;
  422. font-weight: 400;
  423. color: #00b38b;
  424. line-height: 24rpx;
  425. margin-bottom: 60rpx;
  426. }
  427. }
  428. .choice-takePhoto {
  429. position: absolute;
  430. bottom: 0;
  431. background-color: white;
  432. width: 100%;
  433. border-radius: 20rpx 20rpx 0 0;
  434. }
  435. .choice-takePhoto>view:first-child {
  436. text-align: center;
  437. height: 80rpx;
  438. line-height: 80rpx;
  439. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  440. background-color: white;
  441. }
  442. .choice-takePhoto>view:last-child {
  443. text-align: center;
  444. height: 80rpx;
  445. line-height: 80rpx;
  446. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  447. background-color: white;
  448. }
  449. .choice-takePhoto>view {
  450. text-align: center;
  451. height: 80rpx;
  452. line-height: 80rpx;
  453. background-color: white;
  454. }
  455. .choice-takePhoto-wrap {
  456. width: 100%;
  457. height: 100vh;
  458. background-color: rgba(127, 127, 127, 0.2);
  459. position: fixed;
  460. left: 0;
  461. top: 0;
  462. z-index: 11111;
  463. }
  464. </style>