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

car-change.vue 14KB

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