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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <view class="page-content">
  3. <view class="bg">
  4. <template v-if="state.userType === '1'">
  5. <!--身份证正面-->
  6. <ocr-cert-block :img="formData.customerPosUrl" :type="1"></ocr-cert-block>
  7. <!--身份证反面-->
  8. <ocr-cert-block :img="formData.customerNegUrl" :type="2"></ocr-cert-block>
  9. </template>
  10. <template v-else>
  11. <view class="picture-wrapper" @click="uploadOtherFile">
  12. <view class="bg">
  13. <view class="">
  14. <view class="name"> 授权书 </view>
  15. <view class="value"> 上传授权书 </view>
  16. <view class="tip">
  17. <view class="tip-value"> 拍摄规范 </view>
  18. </view>
  19. </view>
  20. <image v-if="!formData.proxyUrl" class="icon" :src="`${$imgUrl}issuance/weituo.png`"
  21. :style="{'--bgimg':`url(${$imgUrl}issuance/bg-border.png`}">
  22. </image>
  23. <image v-else class="icon" :src="getFullImageUrl(formData.proxyUrl)"
  24. :style="{'--bgimg':`url(${$imgUrl}issuance/bg-border.png`}"></image>
  25. </view>
  26. </view>
  27. <!--营业执照-->
  28. <ocr-cert-block :type="5" @click="takePhotoMode"></ocr-cert-block>
  29. <!--经办人身份证正面-->
  30. <ocr-cert-block :img="formData.agentPosImgUrl" :type="1"></ocr-cert-block>
  31. <!--经办人身份证反面-->
  32. <ocr-cert-block :img="formData.agentNegImgUrl" :type="2"></ocr-cert-block>
  33. </template>
  34. </view>
  35. <view class="bg">
  36. <!--驾驶证正本-->
  37. <ocr-cert-block :img="formData.vehPosImgUrl" :type="3"></ocr-cert-block>
  38. <!--驾驶证副本-->
  39. <ocr-cert-block :img="formData.vehNegImgUrl" :type="4"></ocr-cert-block>
  40. </view>
  41. <view class="bg">
  42. <view class="title"> 基本信息 </view>
  43. <u-form label-width="230" :model="formData" ref="uForm" :label-style='labelStyle'>
  44. <template v-if="state.userType === '1'">
  45. <u-form-item label="姓名" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  46. <u-input v-model="formData.customerName" placeholder='请输入姓名' inputAlign="right"/>
  47. </u-form-item>
  48. <u-form-item label="证件号码" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  49. <u-input placeholder='请填写证件号码' type="number" v-model="formData.customerIdNum" inputAlign="right"/>
  50. </u-form-item>
  51. <u-form-item label="车牌号" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  52. <car-number-input @numberInputResult="carNumber" :defaultStr="formData.vehiclePlate"></car-number-input>
  53. </u-form-item>
  54. </template>
  55. <template v-else>
  56. <u-form-item label="单位名称" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  57. <u-input v-model="formData.customerName" placeholder='请输入单位名称' inputAlign="right"/>
  58. </u-form-item>
  59. <u-form-item label="经办人姓名" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  60. <u-input v-model="formData.customerName" placeholder='请输入经办人姓名' inputAlign="right"/>
  61. </u-form-item>
  62. <u-form-item label="证件号码" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  63. <u-input placeholder='请填写证件号码' type="number" v-model="formData.customerIdNum" inputAlign="right"/>
  64. </u-form-item>
  65. <u-form-item label="车牌号" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon' borderBottom>
  66. <car-number-input @numberInputResult="carNumber" :defaultStr="formData.vehiclePlate"></car-number-input>
  67. </u-form-item>
  68. </template>
  69. </u-form>
  70. </view>
  71. <view class="action">
  72. <button type="default" class="ui-btn" @click="submit()">
  73. 提交
  74. </button>
  75. </view>
  76. </view>
  77. <!--证件照上传 start-->
  78. <!-- <uploadOcr
  79. :isTakePhotoModeShow="state.isTakePhotoModeShow"
  80. :phoneType="state.choiceIndex"
  81. @close="close"
  82. @ocrResult="ocrResult">
  83. </uploadOcr> -->
  84. <!--证件照上传 end-->
  85. </template>
  86. <script setup lang="ts">
  87. import { reactive, ref, computed } from "vue";
  88. import { onLoad, onShow } from "@dcloudio/uni-app";
  89. import { getItem, StorageKeys } from "@/utils/storage";
  90. import { checkStr, navTo, uploadFile, msg, getFullImageUrl, replaceBaseImageUrl, maskBankCard } from "@/utils/utils";
  91. import { requestNew } from "@/utils/network/request.js";
  92. import { deviceResumeAdd, vehicleInfoView } from "@/utils/network/api.js";
  93. import { useUserStore } from "@/stores/user";
  94. import { commonStore } from '@/stores/common.js'
  95. import { getCodeName } from '@/datas/queryKey.js'
  96. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  97. import { getVehiclePlateColorPai } from '@/datas/vehiclePlateColor'
  98. // import uploadOcr from '@/components/uploadOcr';
  99. import { compareDates } from '@/utils/utils'
  100. const commonStoreUse = commonStore()
  101. const { getSelectIndex, setIsRefresh } = commonStoreUse
  102. const refreshKey = 'runWaterRefundInfo'
  103. const isMultiProvince = [
  104. {name: '单省', id: 0},
  105. {name: '跨省', id: 1},
  106. ]
  107. interface uploadFileParams{
  108. imageUrl: string
  109. }
  110. interface pageParams{
  111. routeType: string,
  112. vehicleId: string,
  113. cardId: string,
  114. obuId: string,
  115. cardExpireTime: string,
  116. obuExpireTime: string
  117. }
  118. const labelStyle = {
  119. color: "#004576",
  120. fontSize: "28rpx",
  121. }
  122. const leftIcon = {
  123. height: '100%',
  124. width: '8rpx',
  125. display: 'flex',
  126. 'align-items': 'center',
  127. 'margin-right': '4rpx',
  128. }
  129. const formData = reactive({
  130. customerPosUrl: '',
  131. customerNegUrl: '',
  132. customerName: '',
  133. customerIdNum: '',
  134. vehiclePlate: '',
  135. vehiclePlateColor: '',
  136. vehPosImgUrl: '',
  137. vehNegImgUrl: '',
  138. cardVehicleType: '',
  139. proxyUrl: '', // 委托书
  140. // agentIdtype: 'AMJMSFZ',
  141. agentPosImgUrl: '', // 经办人信息
  142. agentNegImgUrl: '',
  143. agentName: '',
  144. agentIdNum: '',
  145. customerTel: '',
  146. cardId: '',
  147. obuId: '',
  148. oldCardExpireTime: '',
  149. oldObuExpireTime: '',
  150. axleCount: '',
  151. approvedCount: '',
  152. totalMass: '',
  153. vehicleDimensions: '',
  154. vanType: '',
  155. })
  156. const state = reactive({
  157. isTakePhotoModeShow: false,
  158. choiceIndex: null,
  159. userType: '1', // 1 个人用户,2:单位用户
  160. pageParams: {
  161. routeType: "",
  162. vehicleId: "",
  163. cardId: "",
  164. obuId: "",
  165. cardExpireTime: "",
  166. obuExpireTime: ""
  167. },
  168. deviceInfo: {
  169. ownerName: '',
  170. ownerPosImgUrl: '',
  171. ownerNegImgUrl: '',
  172. ownerIdNum: '',
  173. vehiclePlate: '',
  174. vehiclePlateColor: '',
  175. type: '',
  176. vehPosImgUrl: '',
  177. vehNegImgUrl: '',
  178. proxyUrl: '',
  179. ownerTel: '',
  180. customerType: 0,
  181. axleCount: '',
  182. approvedCount: '',
  183. totalMass: '',
  184. vehicleDimensions: '',
  185. vehicleType: ''
  186. }
  187. })
  188. onLoad((option: pageParams) => {
  189. if (option) {
  190. state.pageParams = option
  191. formData.cardId = option.cardId
  192. formData.obuId = option.obuId
  193. formData.oldCardExpireTime = option.cardExpireTime
  194. formData.oldObuExpireTime = option.obuExpireTime
  195. }
  196. getVehicleInfoView()
  197. })
  198. onShow(() => {
  199. })
  200. /**
  201. * 身份证ocr识别后接收参数
  202. */
  203. interface OCRData {
  204. imageUrl: string,
  205. bizContent: string,
  206. screditCode: string,
  207. enddate: string
  208. }
  209. const submit = () => {
  210. if (!paramsVerify()) return;
  211. const options = {
  212. type: 2,
  213. data: {...formData},
  214. method: "POST",
  215. showLoading: true,
  216. }
  217. //调用方式
  218. requestNew(deviceResumeAdd, options).then(res => {
  219. // uni.redirectTo({
  220. // url: '/pages/common/submit-result?back=1&tipText=' + '预计1-3日完成资料审核'
  221. // })
  222. })
  223. }
  224. // 获取车辆详情
  225. const getVehicleInfoView = () => {
  226. let option = {
  227. type: 2,
  228. data: {vehicleId: state.pageParams.vehicleId},
  229. method: "POST",
  230. showLoading: true,
  231. }
  232. requestNew(vehicleInfoView, option).then(res => {
  233. state.deviceInfo = res
  234. setFormData()
  235. })
  236. }
  237. // 初始化表单参数
  238. const setFormData = () => {
  239. let deviceInfo = state.deviceInfo
  240. state.userType = deviceInfo.customerType === 1 ? '2' : '1'
  241. formData.customerName = deviceInfo.ownerName
  242. formData.customerPosUrl = deviceInfo.ownerPosImgUrl
  243. formData.customerNegUrl = deviceInfo.ownerNegImgUrl
  244. formData.customerIdNum = deviceInfo.ownerIdNum
  245. formData.vehiclePlate = deviceInfo.vehiclePlate
  246. formData.vehiclePlateColor = deviceInfo.vehiclePlateColor
  247. formData.cardVehicleType = deviceInfo.vehicleType
  248. formData.vehPosImgUrl = deviceInfo.vehPosImgUrl
  249. formData.vehNegImgUrl = deviceInfo.vehNegImgUrl
  250. formData.proxyUrl = state.userType === '1' ? '' : deviceInfo.proxyUrl
  251. formData.customerTel = deviceInfo.ownerTel
  252. formData.axleCount = deviceInfo.axleCount
  253. formData.approvedCount = deviceInfo.approvedCount
  254. formData.totalMass = deviceInfo.totalMass
  255. formData.vehicleDimensions = deviceInfo.vehicleDimensions
  256. formData.vanType = deviceInfo.type
  257. if (state.userType === '1') {
  258. formData.agentName = deviceInfo.ownerName
  259. formData.agentIdNum = deviceInfo.ownerIdNum
  260. formData.agentNegImgUrl = deviceInfo.ownerNegImgUrl
  261. formData.agentNegImgUrl = deviceInfo.ownerPosImgUrl
  262. // formData.agentIdtype = ownerIdType
  263. }
  264. }
  265. const selectProvince = () => {
  266. uni.navigateTo({
  267. url: '/pages/common/select-data-list'
  268. })
  269. }
  270. // 字段校验
  271. const paramsVerify = () => {
  272. let isVerify = true;
  273. if (state.userType === '1') {
  274. if(!formData.customerName){
  275. msg('请输入用户姓名');
  276. isVerify = false;
  277. } else if(!formData.customerIdNum){
  278. msg('请输入证件号码');
  279. isVerify = false;
  280. } else if(!formData.vehiclePlate){
  281. msg('请输入车牌号码');
  282. isVerify = false;
  283. }
  284. } else {
  285. }
  286. return isVerify;
  287. }
  288. //车牌号输入
  289. const carNumber = (val : any) => {
  290. formData.vehiclePlate = val.trim();
  291. };
  292. const close = (e) => {
  293. state.isTakePhotoModeShow = e
  294. }
  295. const takePhotoMode = (index: number) => {
  296. state.isTakePhotoModeShow = true
  297. state.choiceIndex = index
  298. }
  299. // const ocrResult = (data: OCRData) => {
  300. // let bizContent = data.bizContent = data.bizContent ? JSON.parse(data.bizContent) : {}
  301. // if (state.choiceIndex === 1) {
  302. // if (!bizContent.idno) {
  303. // msg('识别失败,请重新上传')
  304. // } else {
  305. // if (state.userType === '1') {
  306. // formData.customerName = bizContent.name;
  307. // formData.customerIdNum = bizContent.idno;
  308. // formData.customerPosUrl = data.imageUrl;
  309. // } else {
  310. // formData.agentName = bizContent.name;
  311. // formData.agentIdNum = bizContent.idno;
  312. // formData.agentPosImgUrl = data.imageUrl
  313. // }
  314. // }
  315. // } else if (state.choiceIndex === 2) {
  316. // if (!bizContent.begindate) {
  317. // msg('识别失败,请重新上传')
  318. // } else {
  319. // if (state.userType === '1') {
  320. // formData.customerNegUrl = data.imageUrl;
  321. // compareDates(data.enddate)
  322. // } else {
  323. // formData.agentNegImgUrl = data.imageUrl
  324. // compareDates(data.enddate)
  325. // }
  326. // }
  327. // } else if (state.choiceIndex === 3) {
  328. // formData.vehPosImgUrl = bizContent.imageUrl
  329. // if (bizContent.plate_a.length > 8) {
  330. // formData.vehiclePlate = bizContent.plate_a.substring(0, 8);
  331. // } else {
  332. // formData.vehiclePlate = bizContent.plate_a;
  333. // }
  334. // } else if (state.choiceIndex === 4) {
  335. // formData.vehNegImgUrl = bizContent.imageUrl
  336. // } else if (state.choiceIndex === 5) {
  337. // submitForm.name = bizContent.unitName;
  338. // submitForm.address = bizContent.adress;
  339. // submitForm.idNo = bizContent.screditCode;
  340. // submitForm.idCardFront = data.imageUrl
  341. // }
  342. // }
  343. // 授权证书上传
  344. const uploadOtherFile = () => {
  345. uni.chooseImage({
  346. count: 1, // 只能选取一张照片
  347. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  348. sourceType: ["camera", "album"], //从相册选择
  349. success: (res) => {
  350. uploadFile(res.tempFilePaths[0]).then((data: uploadFileParams) => {
  351. formData.proxyUrl = data.imageUrl
  352. })
  353. },
  354. });
  355. }
  356. </script>
  357. <style lang="scss" scoped>
  358. .bg{
  359. background-color: white;
  360. margin:0 32rpx;
  361. margin-top: 20rpx;
  362. border-radius: 12rpx;
  363. border: 1px solid #FFFFFF;
  364. padding: 20rpx;
  365. }
  366. .card {
  367. display: flex;
  368. margin: 0 20rpx;
  369. align-items: center;
  370. }
  371. .action {
  372. background-color: #fff;
  373. border-radius: 30rpx 30rpx 0 0;
  374. width: 100vw;
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. flex-direction: column;
  379. margin-top: 20rpx;
  380. padding: 24rpx 0 calc(24rpx + env(safe-area-inset-bottom));
  381. }
  382. ::deep.uni-select {
  383. font-size: 13px;
  384. height: 30px;
  385. line-height: 30px;
  386. }
  387. .choice-takePhoto-wrap {
  388. width: 100%;
  389. height: 100vh;
  390. background-color: rgba(127, 127, 127, 0.2);
  391. position: fixed;
  392. left: 0;
  393. top: 0;
  394. z-index: 11111;
  395. }
  396. .choice-takePhoto {
  397. position: absolute;
  398. bottom: 0;
  399. background-color: white;
  400. width: 100%;
  401. border-radius: 20rpx 20rpx 0 0;
  402. }
  403. .choice-takePhoto>view:first-child {
  404. text-align: center;
  405. height: 80rpx;
  406. line-height: 80rpx;
  407. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  408. background-color: white;
  409. }
  410. .choice-takePhoto>view:last-child {
  411. text-align: center;
  412. height: 80rpx;
  413. line-height: 80rpx;
  414. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  415. background-color: white;
  416. }
  417. .choice-takePhoto>view {
  418. text-align: center;
  419. height: 80rpx;
  420. line-height: 80rpx;
  421. background-color: white;
  422. }
  423. .choice-takePhoto-wrap {
  424. width: 100%;
  425. height: 100vh;
  426. background-color: rgba(127, 127, 127, 0.2);
  427. position: fixed;
  428. left: 0;
  429. top: 0;
  430. z-index: 11111;
  431. }
  432. .car-type{
  433. width: 400rpx;
  434. height: 68rpx;
  435. margin: 50rpx auto;
  436. border-radius: 68rpx;
  437. border: 1px #CCB375 solid;
  438. font-size: 28rpx;
  439. overflow: hidden;
  440. display: flex;
  441. .car-type-item{
  442. width: 50%;
  443. height: 100%;
  444. line-height: 68rpx;
  445. text-align: center;
  446. color: #CCB375;
  447. flex-shrink: 0;
  448. flex-grow: 0;
  449. }
  450. .active{
  451. color: #FFFFFF;
  452. background-color: #CCB375;
  453. }
  454. }
  455. .disabled-text{
  456. color: #999999;
  457. }
  458. .uni-list{
  459. width: 88%;
  460. margin: 24rpx auto;
  461. .left-owner-radio{
  462. margin-right: 12rpx;
  463. }
  464. }
  465. .page-content{
  466. position: relative;
  467. min-height: 100vh;
  468. }
  469. .flex-input{
  470. flex: 1;
  471. display: flex;
  472. align-items: center;
  473. justify-content: flex-end;
  474. .unit{
  475. color: #01243A;
  476. font-size: 26rpx;
  477. width: 60rpx;
  478. text-align: center;
  479. }
  480. }
  481. .image-list{
  482. display: flex;
  483. flex-wrap: wrap;
  484. margin-top: 24rpx;
  485. .icon{
  486. width: 180rpx;
  487. height: 180rpx;
  488. margin: 0 24rpx 24rpx 0;
  489. }
  490. .image-out{
  491. width: 180rpx;
  492. height: 180rpx;
  493. margin: 0 24rpx 24rpx 0;
  494. position: relative;
  495. .delete{
  496. position: absolute;
  497. right: 0;
  498. top: 0;
  499. }
  500. }
  501. }
  502. .upload-num{
  503. color: #999999;
  504. font-size: 26rpx;
  505. margin-left: 12rpx;
  506. }
  507. </style>