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.

opening-account-unit.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <navBar title="ETC开户新办申请-单位" :scrollTop="scrollTop"></navBar>
  3. <navBgCar></navBgCar>
  4. <view class="content-wrap">
  5. <view class="item-tips">
  6. <view class="title"> 上传后请核对识别信息 </view>
  7. <view class="tip"> 如有错误请及时手动修改 </view>
  8. </view>
  9. <view class="picture-wrapper" @click="cardImageOcrYY()">
  10. <view class="bg">
  11. <view class="">
  12. <view class="name"> 营业执照 </view>
  13. <view class="value"> 上传企业的营业执照 </view>
  14. <view class="tip">
  15. <view class="tip-value"> 拍摄规范 </view>
  16. </view>
  17. </view>
  18. <image v-if="!state.form.posImgUrl" class="icon" :src="`${$imgUrl}applyCard/zhizhao.png`">
  19. </image>
  20. <image v-else class="icon" :src="strReplace(state.form.posImgUrl)"></image>
  21. </view>
  22. </view>
  23. <view class="picture-wrapper" @click="takePhotoMode('1')">
  24. <view class="bg">
  25. <view class="">
  26. <view class="name"> 人像面 </view>
  27. <view class="value"> 上传身份证的人像面 </view>
  28. <view class="tip">
  29. <view class="tip-value"> 拍摄规范 </view>
  30. </view>
  31. </view>
  32. <image v-if="!state.form.agentPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  33. </image>
  34. <image v-else class="icon" :src="strReplace(state.form.agentPosImgUrl)"></image>
  35. </view>
  36. </view>
  37. <view class="picture-wrapper" @click="takePhotoMode('2')">
  38. <view class="bg">
  39. <view class="">
  40. <view class="name"> 国徽面 </view>
  41. <view class="value"> 上传身份证的国徽面 </view>
  42. <view class="tip">
  43. <view class="tip-value"> 拍摄规范 </view>
  44. </view>
  45. </view>
  46. <image v-if="!state.form.agentNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  47. </image>
  48. <image v-else class="icon" :src="strReplace(state.form.agentNegImgUrl)"></image>
  49. </view>
  50. </view>
  51. <view class="picture-wrapper" @click="cardFileImageUpdate()">
  52. <view class="bg">
  53. <view class="">
  54. <view class="name"> 委托书 </view>
  55. <view class="value"> 上传文字清晰的委托书 </view>
  56. <view class="tip">
  57. <view class="tip-value"> 拍摄规范 </view>
  58. </view>
  59. <view class="down" @click="downAuthD">模板下载</view>
  60. </view>
  61. <image v-if="!state.form.proxyUrl" class="icon" :src="`${$imgUrl}applyCard/weituoshu.png`">
  62. </image>
  63. <image v-else class="icon" :src="strReplace(state.form.proxyUrl)"></image>
  64. </view>
  65. </view>
  66. <view class="shibie-wrapper">
  67. <view class="title"> 识别内容如下 </view>
  68. <u-form label-width="200" :model="state.form" ref="uForm">
  69. <u-form-item label="公司名称">
  70. <u-input inputAlign="right" class="clearBg" placeholder='请输入公司名称' v-model="state.form.userName"
  71. maxlength="50" />
  72. </u-form-item>
  73. <u-form-item label="部门名称">
  74. <u-input inputAlign="right" class="clearBg" placeholder='请输入部门名称' v-model="state.form.department"
  75. maxlength="50" />
  76. </u-form-item>
  77. <u-form-item label="社会信用代码">
  78. <u-input inputAlign="right" class="clearBg" placeholder='请输入社会信用代码' v-model="state.form.userIdNum"
  79. maxlength="50" />
  80. </u-form-item>
  81. <u-form-item label="营业执照地址">
  82. <u-input inputAlign="right" class="clearBg" placeholder='请输入营业执照地址' v-model="state.form.userAddress"
  83. maxlength="50" />
  84. </u-form-item>
  85. <u-form-item label="经办人姓名">
  86. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人姓名' v-model="state.form.agentName"
  87. maxlength="20" />
  88. </u-form-item>
  89. <u-form-item label="经办人身份证号">
  90. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人身份证号' v-model="state.form.agentIdNum"
  91. maxlength="18" />
  92. </u-form-item>
  93. <u-form-item label="经办人地址">
  94. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人地址' v-model="state.form.agentAddress"
  95. maxlength="40" />
  96. </u-form-item>
  97. <u-form-item label="经办人联系方式">
  98. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人联系方式' v-model="state.form.agentTel"
  99. maxlength="11" />
  100. </u-form-item>
  101. </u-form>
  102. </view>
  103. <view class="green-tip">
  104. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  105. </view>
  106. <view class="action">
  107. <button type="default" class="button" @click="savaHandle()">
  108. 下一步
  109. </button>
  110. </view>
  111. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  112. <view class="choice-takePhoto">
  113. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  114. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  115. <view @click.stop="cancle">取消</view>
  116. </view>
  117. </view>
  118. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  119. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  120. </view>
  121. </template>
  122. <script setup lang="ts">
  123. import {
  124. reactive, ref
  125. } from "vue";
  126. import navBgCar from "./components/nav-bg-car3";
  127. import navBar from "@/components/nav-bar/nav-bar2.vue";
  128. import viewfinder from "../../components/viewfinder.vue"
  129. import {
  130. ocrAllQuery,
  131. idCardOcr,registerFull,userUpload
  132. } from "@/utils/network/api.js";
  133. import { requestNew
  134. } from "@/utils/network/request.js";
  135. import {
  136. stringToJson
  137. } from "@/utils/network/encryption";
  138. import {
  139. onLoad,
  140. onPageScroll,
  141. } from "@dcloudio/uni-app";
  142. import {
  143. setItem,
  144. getItem,
  145. } from "@/utils/storage";
  146. import {
  147. msg,
  148. checkStr,
  149. strReplace,
  150. uploadFile,
  151. compressImage,
  152. chooseImageCompress
  153. } from "@/utils/utils";
  154. const scrollTop = ref(0);//滚动距离
  155. const state = reactive({
  156. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  157. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  158. isTakePhotoModeShow: false, //选择拍照方式是否出来
  159. images: '',
  160. showImg: true,
  161. form: {
  162. orderId: "", //订单ID
  163. //营业执照信息
  164. userName: "", //开户名称/账户名称
  165. userIdType: "203", //用户证件类型 203//营业执照
  166. userIdNum: "", //营业执照号码
  167. posImgUrl: "", //营业执照证明
  168. department: '本部', //不超过50个字符,若单位仅开一个账户,填写“本部”
  169. userAddress: "", //单位地址
  170. //经办人信息
  171. agentName: "",
  172. agentIdType: "101",
  173. agentIdNum: "",
  174. agentAddress: "",
  175. agentPhone: "",
  176. agentIdVld: '',
  177. agentTel: '',
  178. agentGender: '',
  179. agentPosImgUrl: "",
  180. agentNegImgUrl: "",
  181. negImgUrl: "", //这个参数和国徽面一样的,都要传
  182. proxyUrl: "",
  183. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  184. channelId: "", //渠道id
  185. opId: '',
  186. orderSource: 'WECHAT',
  187. isAgent:true, //经办人办理
  188. userNegImgUrl:"",
  189. userPosImgUrl:"",
  190. tel:""
  191. },
  192. orderId: "",
  193. vehiclePlateColor: '',
  194. isSign: '',
  195. vanType: 1,
  196. vehicleId: "",
  197. jsCode:""
  198. });
  199. const savaHandle = () => {
  200. if (state.form.agentGender === '男') {
  201. state.form.agentGender = 'MAN'
  202. } else {
  203. state.form.agentGender = 'WOMAN'
  204. }
  205. if (!state.form.posImgUrl) {
  206. msg('请上传营业执照');
  207. return;
  208. }
  209. if (!state.form.agentPosImgUrl) {
  210. msg('请上传身份证的人像面');
  211. return;
  212. }
  213. if (!state.form.agentNegImgUrl) {
  214. msg('请上传身份证的国徽面');
  215. return;
  216. }
  217. if (!state.form.proxyUrl) {
  218. msg('请上传身份证的委托书');
  219. return;
  220. }
  221. if (!state.form.userName) {
  222. msg('请输入公司名称');
  223. return;
  224. }
  225. if (!state.form.department) {
  226. msg('请输入部门名称');
  227. return;
  228. }
  229. if (!state.form.userIdNum) {
  230. msg('请输入社会信用代码');
  231. return;
  232. }
  233. if (!state.form.userAddress) {
  234. msg('请输入营业执照地址');
  235. return;
  236. }
  237. if (!state.form.agentName) {
  238. msg('请输入经办人姓名');
  239. return;
  240. }
  241. if (!checkStr(state.form.agentIdNum, 'card')) {
  242. msg('请输入正确的经办人身份证号');
  243. return;
  244. }
  245. if (!checkStr(state.form.agentTel, 'mobile')) {
  246. msg('请输入正确的经办人联系方式');
  247. return;
  248. }
  249. state.form.tel=state.form.agentTel
  250. registerRequest().then((result : any) => {
  251. console.log("result", result)
  252. if (!getItem('openId')) {
  253. setItem('token', result.accessToken)
  254. setItem('openId', result.openId)
  255. state.form.opId = getItem('openId') ? getItem('openId') : '';
  256. }
  257. var data = state.form;
  258. const options = {
  259. type: 2,
  260. data: data,
  261. method: "POST",
  262. showLoading: true,
  263. };
  264. requestNew(userUpload, options).then((res) => {
  265. const data = res;
  266. uni.redirectTo({
  267. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&vanType=${state.vanType}&vehicleId=${state.vehicleId}`,
  268. });
  269. });
  270. })
  271. };
  272. onLoad((option : any) => {
  273. state.form.orderId = option.orderId;
  274. state.orderId = option.orderId;
  275. state.vehiclePlateColor = option.vehiclePlateColor;
  276. state.form.opId = getItem('openId') ? getItem('openId') : '';
  277. state.isSign = option.isSign;
  278. state.vanType = option.vanType;
  279. state.vehicleId = option.vehicleId;
  280. console.log("state.type", option)
  281. uni.login({
  282. provider: "weixin",
  283. success: function(e) {
  284. console.log("jsCode",e.code)
  285. state.jsCode=e.code
  286. },
  287. });
  288. });
  289. //监听页面滚动
  290. onPageScroll((e) => {
  291. scrollTop.value = e.scrollTop;
  292. });
  293. //营业执照Orc接口调用
  294. const cardImageOcrYY = () => {
  295. uni.chooseImage({
  296. count: 1, //只能选取一张照片
  297. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  298. sourceType: ["camera", "album"], //从相册选择
  299. success: function (res) {
  300. uploadFile(res.tempFilePaths[0], "", ocrAllQuery).then((data) => {
  301. if (data.result) {
  302. state.form.userName = stringToJson(data.result
  303. .businessLicense)[
  304. '名称'];
  305. state.form.userIdNum = stringToJson(data.result
  306. .businessLicense)[
  307. '统一社会信用代码'];
  308. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  309. state.form.posImgUrl = data;
  310. state.form.userNegImgUrl = data;
  311. state.form.userPosImgUrl = data;
  312. })
  313. }
  314. })
  315. },
  316. });
  317. };
  318. const camera = () => {
  319. state.phoneType = 0
  320. }
  321. const cardFileImageUpdate = () => {
  322. uni.chooseImage({
  323. count: 1, //只能选取一张照片
  324. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  325. sourceType: ["camera", "album"], //从相册选择
  326. success: function (res) {
  327. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  328. state.form.proxyUrl = data;
  329. })
  330. },
  331. });
  332. };
  333. const takePhotoMode = (index) => {
  334. console.log("index", index)
  335. state.isTakePhotoModeShow = true
  336. state.choiceIndex = index
  337. }
  338. const xiangce = (val) => {
  339. console.log("val", val)
  340. var imageType = val;
  341. chooseImageCompress((res)=>{
  342. state.images = res.tempFilePath?res.tempFilePath:res.tempFilePaths[0]
  343. state.showImg = false
  344. state.phoneType = state.choiceIndex
  345. state.isTakePhotoModeShow = false
  346. })
  347. // uni.chooseImage({
  348. // count: 1, //只能选取一张照片
  349. // sizeType: ["original"], //可以指定是原图还是压缩图,默认二者都有
  350. // sourceType: ["album"], //从相册选择
  351. // success: function (res) {
  352. // let scall=res.tempFiles[0].size/1024/1024/2
  353. // console.log("scall",scall)
  354. // console.log("res.tempFiles[0].size", res.tempFilePaths[0], res.tempFiles[0].size)
  355. // if(scall>1){
  356. // console.log("压缩")
  357. // compressImage(res.tempFilePaths[0], (res) => {
  358. // state.images = res.tempFilePath
  359. // state.showImg = false
  360. // state.phoneType = state.choiceIndex
  361. // state.isTakePhotoModeShow = false
  362. // })
  363. // }else{
  364. // state.images = res.tempFilePaths[0]
  365. // state.showImg = false
  366. // state.phoneType = state.choiceIndex
  367. // state.isTakePhotoModeShow = false
  368. // }
  369. // },
  370. // })
  371. }
  372. const takePhoto = (val) => {
  373. console.log("拍照", val)
  374. state.showImg = true
  375. state.phoneType = val;
  376. }
  377. const confirmReturn = (val) => {
  378. state.phoneType = 0
  379. state.isTakePhotoModeShow = false
  380. var imageType = state.choiceIndex;
  381. console.log("图片地址val", val.tempImagePath)
  382. uploadFile(val.tempImagePath, imageType, idCardOcr).then((data) => {
  383. console.log("身份证上传", data)
  384. if (state.choiceIndex === "1") {
  385. state.form.agentName = data.name;
  386. state.form.agentIdNum = data.idno;
  387. state.form.agentPosImgUrl = data.imageUrl;
  388. state.form.agentAddress = data.address;
  389. state.form.agentGender = data.gender;
  390. } else {
  391. state.form.agentIdVld = data.enddate;
  392. state.form.agentNegImgUrl = data.imageUrl;
  393. state.form.negImgUrl = data.imageUrl;
  394. }
  395. state.isTakePhotoModeShow = false
  396. })
  397. }
  398. const cancle = () => {
  399. state.isTakePhotoModeShow = false
  400. }
  401. const downAuthD = () => {
  402. uni.downloadFile({
  403. url: "https://qtzl.etcjz.cn/default-bucket/20240311/单位委托书.docx",
  404. filePath: uni.env.USER_DATA_PATH + '/' + '单位委托书.docx',
  405. success(res) {
  406. const filePath = res.filePath
  407. uni.openDocument({
  408. filePath: filePath,
  409. fileType: 'docx',
  410. showMenu: true, //关键点
  411. success: function (res) {
  412. },
  413. fail: function (err) {
  414. msg("打开文档失败");
  415. }
  416. });
  417. },
  418. fail: function (err) {
  419. msg("下载文档失败");
  420. console.log("err", err)
  421. },
  422. complete(res) {
  423. }
  424. })
  425. }
  426. // 无感注册
  427. const registerRequest = () => {
  428. let data = {
  429. userType: "ENTERPRISE",
  430. idNum: state.form.userIdNum,
  431. idType: state.form.userIdType,
  432. mobile: state.form.agentTel,
  433. userName: state.form.userName,
  434. gender: 'UNKOWN',
  435. certifyChannel: "BAIDUOCR",
  436. address: state.form.userAddress,
  437. agentIdNum: state.form.agentIdNum,
  438. agentIdType: state.form.agentIdType,
  439. agentName: state.form.agentName,
  440. department: state.form.department,
  441. userIdImgUrl: state.form.posImgUrl,
  442. userIdImgBase64: "",
  443. jsCode:state.jsCode
  444. }
  445. const options = {
  446. type: 2,
  447. data: data,
  448. method: "POST",
  449. showLoading: true,
  450. };
  451. return new Promise(async (resolve, reject) => {
  452. const res = await requestNew(registerFull, options);
  453. const data = res;
  454. resolve(data);
  455. }).catch((error) => {
  456. reject(error);
  457. });
  458. }
  459. </script>
  460. <style lang="scss" scoped>
  461. .content-wrap {
  462. position: relative;
  463. margin-top: -50rpx;
  464. padding: 0rpx 30rpx;
  465. position: relative;
  466. .action {
  467. padding-left: 20rpx;
  468. padding-right: 20rpx;
  469. padding-bottom: 30rpx;
  470. .button {
  471. height: 80rpx;
  472. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  473. border-radius: 40rpx;
  474. font-size: 32rpx;
  475. font-weight: 400;
  476. color: #ffffff;
  477. line-height: 80rpx;
  478. }
  479. }
  480. .item-tips {
  481. .title {
  482. font-size: 30rpx;
  483. font-family: Microsoft YaHei;
  484. font-weight: 400;
  485. color: #000000;
  486. line-height: 24rpx;
  487. }
  488. .tip {
  489. margin-top: 16rpx;
  490. font-size: 24rpx;
  491. font-family: Microsoft YaHei;
  492. font-weight: 400;
  493. color: #999999;
  494. line-height: 24rpx;
  495. }
  496. }
  497. .picture-wrapper {
  498. margin-top: 40rpx;
  499. .bg {
  500. background: #ffffff;
  501. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  502. border-radius: 20rpx;
  503. padding: 40rpx;
  504. display: flex;
  505. // align-items: center;
  506. justify-content: space-between;
  507. .name {
  508. font-size: 34rpx;
  509. font-family: Microsoft YaHei;
  510. font-weight: 400;
  511. color: #000000;
  512. line-height: 34rpx;
  513. }
  514. .value {
  515. margin-top: 20rpx;
  516. font-size: 24rpx;
  517. font-family: Microsoft YaHei;
  518. font-weight: 400;
  519. color: #999999;
  520. line-height: 24rpx;
  521. }
  522. .tip {
  523. margin-top: 20rpx;
  524. text-align: center;
  525. width: 110rpx;
  526. height: 40rpx;
  527. background: rgba(33, 190, 177, 0.2);
  528. border-radius: 6rpx;
  529. .tip-value {
  530. font-size: 20rpx;
  531. font-family: Microsoft YaHei;
  532. font-weight: 400;
  533. color: #0a8f8a;
  534. line-height: 40rpx;
  535. opacity: 1;
  536. }
  537. }
  538. }
  539. .icon {
  540. width: 294rpx;
  541. height: 188rpx;
  542. }
  543. }
  544. .shibie-wrapper {
  545. margin-top: 60rpx;
  546. .title {
  547. font-size: 30rpx;
  548. font-family: Microsoft YaHei;
  549. font-weight: 400;
  550. color: #000000;
  551. line-height: 30rpx;
  552. }
  553. }
  554. .buchong-wrapper {
  555. margin-top: 60rpx;
  556. .title {
  557. font-size: 30rpx;
  558. font-family: Microsoft YaHei;
  559. font-weight: 400;
  560. color: #000000;
  561. line-height: 30rpx;
  562. }
  563. }
  564. .green-tip {
  565. margin-top: 50rpx;
  566. font-size: 24rpx;
  567. font-family: Microsoft YaHei;
  568. font-weight: 400;
  569. color: #00b38b;
  570. line-height: 24rpx;
  571. margin-bottom: 60rpx;
  572. }
  573. }
  574. ::v-deep .u-input__input {
  575. background: transparent;
  576. }
  577. ::v-deep .u-form-item--left .u-form-item--left__content {
  578. padding-right: 0px;
  579. }
  580. .choice-takePhoto {
  581. position: absolute;
  582. bottom: 0;
  583. background-color: white;
  584. width: 100%;
  585. border-radius: 20rpx 20rpx 0 0;
  586. }
  587. .choice-takePhoto>view:first-child {
  588. text-align: center;
  589. height: 80rpx;
  590. line-height: 80rpx;
  591. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  592. background-color: white;
  593. }
  594. .choice-takePhoto>view:last-child {
  595. text-align: center;
  596. height: 80rpx;
  597. line-height: 80rpx;
  598. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  599. background-color: white;
  600. }
  601. .choice-takePhoto>view {
  602. text-align: center;
  603. height: 80rpx;
  604. line-height: 80rpx;
  605. background-color: white;
  606. }
  607. .choice-takePhoto-wrap {
  608. width: 100%;
  609. height: 100vh;
  610. background-color: rgba(127, 127, 127, 0.2);
  611. position: fixed;
  612. left: 0;
  613. top: 0;
  614. z-index: 11111;
  615. }
  616. .down {
  617. background-color: rgba(33, 190, 177, 0.2);
  618. color: #0a8f8a;
  619. border-radius: 10rpx;
  620. padding: 6rpx 10rpx;
  621. font-size: 28rpx;
  622. margin-top: 10rpx;
  623. width: 48%;
  624. }
  625. </style>