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

opening-account-unit.vue 16KB

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