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

opening-account-unit.vue 17KB

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