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

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