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

opening-account-unit.vue 16KB

1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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. </u-form-item>
  72. <u-form-item label="部门名称">
  73. <u-input inputAlign="right" class="clearBg" placeholder='请输入部门名称' v-model="state.form.department" />
  74. </u-form-item>
  75. <u-form-item label="社会信用代码">
  76. <u-input inputAlign="right" class="clearBg" placeholder='请输入社会信用代码'
  77. v-model="state.form.userIdNum" />
  78. </u-form-item>
  79. <u-form-item label="经办人姓名">
  80. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人姓名' v-model="state.form.agentName" />
  81. </u-form-item>
  82. <u-form-item label="经办人身份证号">
  83. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人身份证号'
  84. v-model="state.form.agentIdNum" />
  85. </u-form-item>
  86. <u-form-item label="经办人联系方式">
  87. <u-input inputAlign="right" class="clearBg" placeholder='请输入经办人联系方式' v-model="state.form.tel" />
  88. </u-form-item>
  89. </u-form>
  90. </view>
  91. <view class="green-tip">
  92. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  93. </view>
  94. <view class="action">
  95. <button type="default" class="button" @click="savaHandle()">
  96. 下一步
  97. </button>
  98. </view>
  99. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  100. <view class="choice-takePhoto">
  101. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  102. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  103. <view @click.stop="cancle">取消</view>
  104. </view>
  105. </view>
  106. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  107. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  108. </view>
  109. </template>
  110. <script setup lang="ts">
  111. import {
  112. reactive, ref
  113. } from "vue";
  114. import navBgCar from "./components/nav-bg-car3";
  115. import navBar from "@/components/nav-bar/nav-bar2.vue";
  116. import viewfinder from "../../components/viewfinder.vue"
  117. import {
  118. ocrAllQuery,
  119. fileUpload,
  120. envs,
  121. etcOcrCard,
  122. etcCompanyCardInfoSubmit,
  123. register,
  124. } from "@/utils/network/api.js";
  125. import {
  126. request
  127. } from "@/utils/network/request.js";
  128. import {
  129. stringToJson
  130. } from "@/utils/network/encryption";
  131. import {
  132. onLoad,
  133. onPageScroll,
  134. } from "@dcloudio/uni-app";
  135. import {
  136. setItem,
  137. getItem,
  138. } from "@/utils/storage";
  139. import {
  140. msg,
  141. checkStr,
  142. strReplace,
  143. uploadFile
  144. } from "@/utils/utils";
  145. const scrollTop = ref(0);//滚动距离
  146. const state = reactive({
  147. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  148. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  149. isTakePhotoModeShow: false, //选择拍照方式是否出来
  150. images: '',
  151. showImg: true,
  152. form: {
  153. orderId: "", //订单ID
  154. //营业执照信息
  155. userName: "", //开户名称/账户名称
  156. userIdType: "203", //用户证件类型 203//营业执照
  157. userIdNum: "", //营业执照号码
  158. posImgUrl: "", //营业执照证明
  159. department: '本部', //不超过50个字符,若单位仅开一个账户,填写“本部”
  160. address: "", //单位地址
  161. //经办人信息
  162. agentName: "",
  163. agentIdType: "101",
  164. agentIdNum: "",
  165. agentAddress: "",
  166. agentPhone: "",
  167. agentIdVld: '',
  168. tel: '',
  169. agentGender: '',
  170. agentPosImgUrl: "",
  171. agentNegImgUrl: "",
  172. negImgUrl: "", //这个参数和国徽面一样的,都要传
  173. proxyUrl: "",
  174. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  175. channelId: "", //渠道id
  176. opId: '',
  177. orderSource: 'WECHAT',
  178. },
  179. orderId: "",
  180. vehiclePlateColor: '',
  181. isSign: '',
  182. type: 1
  183. });
  184. const savaHandle = () => {
  185. if (state.form.agentGender === '男') {
  186. state.form.agentGender = 'MAN'
  187. } else {
  188. state.form.agentGender = 'WOMAN'
  189. }
  190. if (!state.form.posImgUrl) {
  191. msg('请上传营业执照');
  192. return;
  193. }
  194. if (!state.form.agentPosImgUrl) {
  195. msg('上传身份证的人像面');
  196. return;
  197. }
  198. if (!state.form.agentNegImgUrl) {
  199. msg('上传身份证的国徽面');
  200. return;
  201. }
  202. if (!state.form.proxyUrl) {
  203. msg('上传身份证的委托书');
  204. return;
  205. }
  206. if (!state.form.userName) {
  207. msg('请输入公司名称');
  208. return;
  209. }
  210. if (!state.form.department) {
  211. msg('请输入部门名称');
  212. return;
  213. }
  214. if (!state.form.userIdNum) {
  215. msg('请输入社会信用代码');
  216. return;
  217. }
  218. if (!state.form.agentName) {
  219. msg('请输入经办人姓名');
  220. return;
  221. }
  222. if (!checkStr(state.form.agentIdNum, 'card')) {
  223. msg('请输入正确的经办人身份证号');
  224. return;
  225. }
  226. if (!checkStr(state.form.tel, 'mobile')) {
  227. msg('请输入正确的经办人联系方式');
  228. return;
  229. }
  230. //如果未登录||新用户
  231. if (!getItem('openId')) {
  232. let data = {
  233. userType: "ENTERPRISE",
  234. idNum: state.form.userIdNum,
  235. idType: state.form.userIdType,
  236. mobile: state.form.tel,
  237. userName: state.form.userName,
  238. gender: 'UNKOWN',
  239. certifyChannel: "BAIDUOCR",
  240. address: state.form.address,
  241. agentIdNum: state.form.agentIdNum,
  242. agentIdType: state.form.agentIdType,
  243. agentName: state.form.agentName,
  244. department: state.form.department,
  245. userIdImgUrl: state.form.posImgUrl,
  246. userIdImgBase64: "",
  247. }
  248. const options = {
  249. type: 2,
  250. data: data,
  251. method: "POST",
  252. showLoading: true,
  253. };
  254. request(register, options).then((res) => {
  255. let result = stringToJson(res.bizContent);
  256. if (result.accessToken && result.openId) {
  257. setItem('token', result.accessToken)
  258. setItem('openId', result.openId)
  259. state.form.opId = result.openId;
  260. let data = state.form;
  261. const options = {
  262. type: 2,
  263. data: data,
  264. method: "POST",
  265. showLoading: true,
  266. };
  267. request(etcCompanyCardInfoSubmit, options).then((res) => {
  268. console.log(res);
  269. uni.redirectTo({
  270. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}`,
  271. });
  272. });
  273. }
  274. })
  275. } else {
  276. var data = state.form;
  277. const options = {
  278. type: 2,
  279. data: data,
  280. method: "POST",
  281. showLoading: true,
  282. };
  283. request(etcCompanyCardInfoSubmit, options).then((res) => {
  284. const data = stringToJson(res.bizContent);
  285. uni.redirectTo({
  286. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}`,
  287. });
  288. });
  289. }
  290. };
  291. onLoad((option : any) => {
  292. state.form.orderId = option.orderId;
  293. state.orderId = option.orderId;
  294. state.vehiclePlateColor = option.vehiclePlateColor;
  295. state.form.opId = getItem('openId') ? getItem('openId') : '';
  296. state.isSign = option.isSign;
  297. state.type = option.type;
  298. console.log("state.type", option)
  299. });
  300. //监听页面滚动
  301. onPageScroll((e) => {
  302. scrollTop.value = e.scrollTop;
  303. });
  304. //营业执照Orc接口调用
  305. const cardImageOcrYY = () => {
  306. uni.chooseImage({
  307. count: 1, //只能选取一张照片
  308. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  309. sourceType: ["camera", "album"], //从相册选择
  310. success: function (res) {
  311. uploadFile(res.tempFilePaths[0], "", ocrAllQuery).then((data) => {
  312. if (data.result) {
  313. state.form.userName = stringToJson(data.result
  314. .businessLicense)[
  315. '名称'];
  316. state.form.userIdNum = stringToJson(data.result
  317. .businessLicense)[
  318. '统一社会信用代码'];
  319. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  320. state.form.posImgUrl = data;
  321. })
  322. }
  323. })
  324. },
  325. });
  326. };
  327. const camera = () => {
  328. state.phoneType = 0
  329. }
  330. const cardFileImageUpdate = () => {
  331. uni.chooseImage({
  332. count: 1, //只能选取一张照片
  333. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  334. sourceType: ["camera", "album"], //从相册选择
  335. success: function (res) {
  336. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  337. state.form.proxyUrl = data;
  338. })
  339. },
  340. });
  341. };
  342. const takePhotoMode = (index) => {
  343. console.log("index", index)
  344. state.isTakePhotoModeShow = true
  345. state.choiceIndex = index
  346. }
  347. const xiangce = (val) => {
  348. console.log("val", val)
  349. var imageType = val;
  350. uni.chooseImage({
  351. count: 1, //只能选取一张照片
  352. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  353. sourceType: ["album"], //从相册选择
  354. success: function (res) {
  355. state.showImg = false
  356. state.images = res.tempFilePaths[0]
  357. state.phoneType = state.choiceIndex
  358. state.isTakePhotoModeShow = false
  359. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  360. },
  361. })
  362. }
  363. const takePhoto = (val) => {
  364. console.log("拍照", val)
  365. state.showImg = true
  366. state.phoneType = val;
  367. }
  368. const confirmReturn = (val) => {
  369. state.phoneType = 0
  370. state.isTakePhotoModeShow = false
  371. var imageType = state.choiceIndex;
  372. console.log("图片地址val", val.tempImagePath)
  373. uploadFile(val.tempImagePath, imageType, etcOcrCard).then((data) => {
  374. console.log("身份证上传", data)
  375. if (state.choiceIndex === "1") {
  376. state.form.agentName = data.name;
  377. state.form.agentIdNum = data.idno;
  378. state.form.agentPosImgUrl = data.imageUrl;
  379. state.form.address = data.address;
  380. state.form.agentGender = data.gender;
  381. } else {
  382. state.form.agentIdVld = data.enddate;
  383. state.form.agentNegImgUrl = data.imageUrl;
  384. state.form.negImgUrl = data.imageUrl;
  385. }
  386. state.isTakePhotoModeShow = false
  387. })
  388. }
  389. const cancle = () => {
  390. state.isTakePhotoModeShow = false
  391. }
  392. const downAuthD = () => {
  393. uni.downloadFile({
  394. url: "https://qtzl.etcjz.cn/default-bucket/20240311/单位委托书.docx",
  395. filePath: uni.env.USER_DATA_PATH + '/' + '单位委托书.docx',
  396. success(res) {
  397. const filePath = res.filePath
  398. uni.openDocument({
  399. filePath: filePath,
  400. fileType: 'docx',
  401. showMenu: true, //关键点
  402. success: function (res) {
  403. // msg("成功查看协议详情");
  404. },
  405. fail: function (err) {
  406. msg("打开文档失败");
  407. }
  408. });
  409. },
  410. fail: function (err) {
  411. msg("下载文档失败");
  412. console.log("err", err)
  413. },
  414. complete(res) {
  415. }
  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>