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.

etc-log-off.vue 14KB

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