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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  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="cardImageOcr('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="cardImageOcr('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>
  60. <image v-if="!state.form.proxyUrl" class="icon" :src="`${$imgUrl}applyCard/weituoshu.png`">
  61. </image>
  62. <image v-else class="icon" :src="strReplace(state.form.proxyUrl)"></image>
  63. </view>
  64. </view>
  65. <view class="shibie-wrapper">
  66. <view class="title"> 识别内容如下 </view>
  67. <u-form label-width="200" :model="state.form" ref="uForm">
  68. <u-form-item label="公司名称">
  69. <u-input inputAlign="right" placeholder='请输入公司名称' v-model="state.form.userName" />
  70. </u-form-item>
  71. <u-form-item label="社会信用代码">
  72. <u-input inputAlign="right" placeholder='请输入社会信用代码' v-model="state.form.userIdNum" />
  73. </u-form-item>
  74. <u-form-item label="经办人姓名">
  75. <u-input inputAlign="right" placeholder='请输入经办人姓名' v-model="state.form.agentName" />
  76. </u-form-item>
  77. <u-form-item label="经办人身份证号">
  78. <u-input inputAlign="right" placeholder='请输入经办人身份证号' v-model="state.form.agentIdNum" />
  79. </u-form-item>
  80. <u-form-item label="经办人联系方式">
  81. <u-input inputAlign="right" placeholder='请输入经办人联系方式' v-model="state.form.tel" />
  82. </u-form-item>
  83. </u-form>
  84. </view>
  85. <view class="green-tip">
  86. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  87. </view>
  88. <view class="action">
  89. <button type="default" class="button" @click="savaHandle()">
  90. 下一步
  91. </button>
  92. </view>
  93. </view>
  94. </template>
  95. <script setup lang="ts">
  96. import {
  97. reactive, ref
  98. } from "vue";
  99. import navBgCar from "./components/nav-bg-car3";
  100. import navBar from "../components/nav-bar/nav-bar2.vue";
  101. import {
  102. pathToBase64
  103. } from "@/utils/image-tools/index.js";
  104. import {
  105. ocrAllQuery,
  106. fileUpload,
  107. etcOcrCard,
  108. etcCompanyCardInfoSubmit,
  109. register,
  110. } from "@/utils/network/api.js";
  111. import {
  112. request
  113. } from "@/utils/network/request.js";
  114. import {
  115. stringToJson
  116. } from "@/utils/network/encryption";
  117. import {
  118. onLoad,
  119. onPageScroll,
  120. } from "@dcloudio/uni-app";
  121. import {
  122. setItem,
  123. getItem,
  124. } from "@/utils/storage";
  125. import {
  126. msg,
  127. checkStr
  128. } from "@/utils/utils";
  129. const scrollTop =ref(0);//滚动距离
  130. const state = reactive({
  131. form: {
  132. orderId: "", //订单ID
  133. //营业执照信息
  134. userName: "", //开户名称/账户名称
  135. userIdType: "203", //用户证件类型 203//营业执照
  136. userIdNum: "", //营业执照号码
  137. posImgUrl: "", //营业执照证明
  138. department: '本部', //不超过50个字符,若单位仅开一个账户,填写“本部”
  139. address: "", //单位地址
  140. //经办人信息
  141. agentName: "",
  142. agentIdType: "101",
  143. agentIdNum: "",
  144. agentAddress: "",
  145. agentPhone: "",
  146. agentIdVld: '',
  147. tel: '',
  148. agentGender: '',
  149. agentPosImgUrl: "",
  150. agentNegImgUrl: "",
  151. proxyUrl: "",
  152. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  153. channelId: "", //渠道id
  154. opId: '',
  155. orderSource: 'WECHAT',
  156. },
  157. orderId: "",
  158. vehiclePlateColor: ''
  159. });
  160. const savaHandle = () => {
  161. if (state.form.agentGender === '男') {
  162. state.form.agentGender = 'MAN'
  163. } else {
  164. state.form.agentGender = 'WOMAN'
  165. }
  166. if (!checkStr(state.form.agentIdNum, 'card')) {
  167. msg('请输入正确身份证');
  168. return;
  169. }
  170. if (!checkStr(state.form.tel, 'mobile')) {
  171. msg('请输入正确手机号');
  172. return;
  173. }
  174. //如果未登录||新用户
  175. if (!getItem('openId')) {
  176. let data = {
  177. userType: "ENTERPRISE",
  178. idNum: state.form.userIdNum,
  179. idType: state.form.userIdType,
  180. mobile: state.form.tel,
  181. name: state.form.userName,
  182. gender: 'UNKOWN',
  183. certifyChannel: "BAIDUOCR",
  184. address: state.form.address,
  185. agentIdNum: state.form.agentIdNum,
  186. agentIdType: state.form.agentIdType,
  187. agentName: state.form.agentName,
  188. department: state.form.department,
  189. userIdImgUrl: state.form.posImgUrl,
  190. userIdImgBase64: "",
  191. }
  192. const options = {
  193. type: 2,
  194. data: data,
  195. method: "POST",
  196. showLoading: true,
  197. };
  198. request(register, options).then((res) => {
  199. let result = stringToJson(res.bizContent);
  200. if (result.accessToken && result.openId) {
  201. setItem('token', result.accessToken)
  202. setItem('openId', result.openId)
  203. state.form.opId = result.openId;
  204. let data = state.form;
  205. const options = {
  206. type: 2,
  207. data: data,
  208. method: "POST",
  209. showLoading: true,
  210. };
  211. request(etcCompanyCardInfoSubmit, options).then((res) => {
  212. // let result = stringToJson(res.bizContent);
  213. console.log(res);
  214. uni.redirectTo({
  215. url: `/applyCard/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=1`,
  216. });
  217. });
  218. }
  219. })
  220. }else{
  221. var data = state.form;
  222. const options = {
  223. type: 2,
  224. data: data,
  225. method: "POST",
  226. showLoading: true,
  227. };
  228. request(etcCompanyCardInfoSubmit, options).then((res) => {
  229. const data = stringToJson(res.bizContent);
  230. uni.redirectTo({
  231. url: `/applyCard/car-release?orderId=${state.orderId}&&vehiclePlateColor=${state.vehiclePlateColor}`,
  232. });
  233. });
  234. }
  235. };
  236. onLoad((option: any) => {
  237. state.form.orderId = option.orderId;
  238. state.orderId = option.orderId;
  239. state.vehiclePlateColor = option.vehiclePlateColor;
  240. state.form.opId = getItem('openId')??'';
  241. });
  242. //监听页面滚动
  243. onPageScroll((e) => {
  244. scrollTop.value = e.scrollTop;
  245. });
  246. //营业执照Orc接口调用
  247. const cardImageOcrYY = () => {
  248. uni.chooseImage({
  249. count: 1, //只能选取一张照片
  250. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  251. sourceType: ["camera", "album"], //从相册选择
  252. success: function(res) {
  253. pathToBase64(res.tempFilePaths[0])
  254. .then((path) => {
  255. var data = {
  256. type: 'business_license',
  257. base64: path,
  258. };
  259. const options = {
  260. type: 2,
  261. data: data,
  262. method: "POST",
  263. showLoading: true,
  264. };
  265. request(ocrAllQuery, options).then((res) => {
  266. const data = stringToJson(res.bizContent);
  267. if (data.result) {
  268. state.form.userName = stringToJson(data.result
  269. .businessLicense)[
  270. '名称'];
  271. state.form.userIdNum = stringToJson(data.result
  272. .businessLicense)[
  273. '统一社会信用代码'];
  274. cardFileImageUpdateyy(path)
  275. }
  276. });
  277. })
  278. .catch((error) => {});
  279. },
  280. });
  281. };
  282. const cardImageOcr = (val: any) => {
  283. var imageType = val;
  284. uni.chooseImage({
  285. count: 1, //只能选取一张照片
  286. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  287. sourceType: ["camera", "album"], //从相册选择
  288. success: function(res) {
  289. pathToBase64(res.tempFilePaths[0])
  290. .then((path) => {
  291. var data = {
  292. source: "WECHAT",
  293. agencyId: "52010106004",
  294. imageType: imageType,
  295. fileName: res.tempFilePaths[0],
  296. imageBase64: path,
  297. };
  298. const options = {
  299. type: 2,
  300. data: data,
  301. method: "POST",
  302. showLoading: true,
  303. };
  304. request(etcOcrCard, options).then((res) => {
  305. const data = stringToJson(res.bizContent);
  306. if (val === "1") {
  307. state.form.agentName = data.name;
  308. state.form.agentIdNum = data.idno;
  309. state.form.agentPosImgUrl = data.imageUrl;
  310. state.form.address = data.address;
  311. state.form.agentGender = data.gender;
  312. } else {
  313. state.form.agentIdVld = data.enddate;
  314. state.form.agentNegImgUrl = data.imageUrl;
  315. }
  316. });
  317. })
  318. .catch((error) => {});
  319. },
  320. });
  321. };
  322. //委托书获取图片给后端
  323. const cardFileImageUpdateyy = (val: any) => {
  324. var data = {
  325. fileBase64: val,
  326. };
  327. const options = {
  328. type: 2,
  329. data: data,
  330. method: "POST",
  331. showLoading: true,
  332. };
  333. request(fileUpload, options).then((res) => {
  334. const data = stringToJson(res.bizContent);
  335. state.form.posImgUrl = data.data.url;
  336. });
  337. };
  338. const cardFileImageUpdate = () => {
  339. uni.chooseImage({
  340. count: 1, //只能选取一张照片
  341. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  342. sourceType: ["camera", "album"], //从相册选择
  343. success: function(res) {
  344. pathToBase64(res.tempFilePaths[0])
  345. .then((path) => {
  346. var data = {
  347. fileBase64: path,
  348. };
  349. const options = {
  350. type: 2,
  351. data: data,
  352. method: "POST",
  353. showLoading: true,
  354. };
  355. request(fileUpload, options).then((res) => {
  356. const data = stringToJson(res.bizContent);
  357. state.form.proxyUrl = data.data.url;
  358. });
  359. })
  360. .catch((error) => {});
  361. },
  362. });
  363. };
  364. //替换图片地址
  365. const strReplace = (str: string) => {
  366. return str.replace('192.168.101.145:9000', '222.85.144.89:19002')
  367. }
  368. </script>
  369. <style lang="scss" scoped>
  370. .content-wrap {
  371. position: relative;
  372. margin-top: -50rpx;
  373. padding: 0rpx 30rpx;
  374. position: relative;
  375. .action {
  376. padding-left: 20rpx;
  377. padding-right: 20rpx;
  378. padding-bottom: 30rpx;
  379. .button {
  380. height: 80rpx;
  381. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  382. border-radius: 40rpx;
  383. font-size: 32rpx;
  384. font-weight: 400;
  385. color: #ffffff;
  386. line-height: 80rpx;
  387. }
  388. }
  389. .item-tips {
  390. .title {
  391. font-size: 30rpx;
  392. font-family: Microsoft YaHei;
  393. font-weight: 400;
  394. color: #000000;
  395. line-height: 24rpx;
  396. }
  397. .tip {
  398. margin-top: 16rpx;
  399. font-size: 24rpx;
  400. font-family: Microsoft YaHei;
  401. font-weight: 400;
  402. color: #999999;
  403. line-height: 24rpx;
  404. }
  405. }
  406. .picture-wrapper {
  407. margin-top: 40rpx;
  408. .bg {
  409. background: #ffffff;
  410. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  411. border-radius: 20rpx;
  412. padding: 40rpx;
  413. display: flex;
  414. // align-items: center;
  415. justify-content: space-between;
  416. .name {
  417. font-size: 34rpx;
  418. font-family: Microsoft YaHei;
  419. font-weight: 400;
  420. color: #000000;
  421. line-height: 34rpx;
  422. }
  423. .value {
  424. margin-top: 20rpx;
  425. font-size: 24rpx;
  426. font-family: Microsoft YaHei;
  427. font-weight: 400;
  428. color: #999999;
  429. line-height: 24rpx;
  430. }
  431. .tip {
  432. margin-top: 20rpx;
  433. text-align: center;
  434. width: 110rpx;
  435. height: 40rpx;
  436. background: rgba(33, 190, 177, 0.2);
  437. border-radius: 6rpx;
  438. .tip-value {
  439. font-size: 20rpx;
  440. font-family: Microsoft YaHei;
  441. font-weight: 400;
  442. color: #0a8f8a;
  443. line-height: 40rpx;
  444. opacity: 1;
  445. }
  446. }
  447. }
  448. .icon {
  449. width: 294rpx;
  450. height: 188rpx;
  451. }
  452. }
  453. .shibie-wrapper {
  454. margin-top: 60rpx;
  455. .title {
  456. font-size: 30rpx;
  457. font-family: Microsoft YaHei;
  458. font-weight: 400;
  459. color: #000000;
  460. line-height: 30rpx;
  461. }
  462. }
  463. .buchong-wrapper {
  464. margin-top: 60rpx;
  465. .title {
  466. font-size: 30rpx;
  467. font-family: Microsoft YaHei;
  468. font-weight: 400;
  469. color: #000000;
  470. line-height: 30rpx;
  471. }
  472. }
  473. .green-tip {
  474. margin-top: 50rpx;
  475. font-size: 24rpx;
  476. font-family: Microsoft YaHei;
  477. font-weight: 400;
  478. color: #00b38b;
  479. line-height: 24rpx;
  480. margin-bottom: 60rpx;
  481. }
  482. }
  483. </style>