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

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