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

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