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

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