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 16KB

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