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

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