您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

opening-account-unit.vue 17KB

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