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.

open-account.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view class='content'>
  3. <view class='up_img_wrap'>
  4. <view class='title'>请上传图片</view>
  5. <view class='tips'>注意事项:1.请上传有效图片;2.图片大小不超过2M</view>
  6. <view class='item_wrap'>
  7. <view class='item' @click="cardImageOcrYY()">
  8. <image v-if="!state.form.url1" class="icon" :src="`${$imgUrl}applyCard/zhizhao.png`">
  9. </image>
  10. <image v-else class="icon" :src="state.form.url1"></image>
  11. <view>公司营业执照</view>
  12. </view>
  13. <view class='item' @click="cardDbImageOcr('2')">
  14. <image v-if="!state.form.url2" class="icon" :src="`${$imgUrl}applyCard/weituoshu.png`">
  15. </image>
  16. <image v-else class="icon" :src="state.form.url2"></image>
  17. <view>单位授权书</view>
  18. </view>
  19. <view class='item' @click="takePhotoMode('1')">
  20. <image v-if="!state.form.url3" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  21. </image>
  22. <image v-else class="icon" :src="state.form.url3"></image>
  23. <view>被委托人身份证正页照</view>
  24. </view>
  25. <view class='item' @click="takePhotoMode('2')">
  26. <image v-if="!state.form.url4" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  27. </image>
  28. <image v-else class="icon" :src="state.form.url4"></image>
  29. <view>被委托人身份证副页</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class='up_img_wrap message'>
  34. <u-form :model="form" ref="form1" label-width=210 border-bottom=false>
  35. <u-form-item label="对公用户登录名 " border-bottom=true>
  36. <u-input placeholder='请输入7-16位字母加数字组成的账号' type="text" v-model="state.form.name" />
  37. </u-form-item>
  38. <u-form-item label="对公用户密码">
  39. <!-- <u-input placeholder='请输入对公用户密码' type="text" v-model="state.form.passWord" /> -->
  40. <view class="form-input">
  41. <input class="input" v-model="state.form.passWord" placeholder="请输入密码"
  42. placeholder-class="color: #c0c4cc;" :password="state.isPwdType ? true : false"
  43. type="text" />
  44. <image :src="`${$imgUrl}login/${
  45. state.isPwdType ? 'icon_eye_close' : 'icon_eye_open'
  46. }.png`" class="eye" @click="state.isPwdType = !state.isPwdType" mode="aspectFill"></image>
  47. </view>
  48. </u-form-item>
  49. <u-form-item label="支付密码">
  50. <!-- <u-input placeholder='请输入支付密码' type="text" v-model="state.form.consumePassword" /> -->
  51. <view class="form-input">
  52. <input class="input" v-model="state.form.consumePassword" placeholder="请再次输入密码"
  53. placeholder-class="color: #c0c4cc;" :password="state.isAffirmPwdType ? true : false"
  54. type="text" />
  55. <image :src="`${$imgUrl}login/${
  56. state.isAffirmPwdType ? 'icon_eye_close' : 'icon_eye_open'
  57. }.png`" class="eye" @click="state.isAffirmPwdType = !state.isAffirmPwdType" mode="aspectFill"></image>
  58. </view>
  59. </u-form-item>
  60. <!-- <u-form-item label="公司证件类型 ">
  61. <u-input v-model="state.form.type" type="select" :select-open="state.showType" @click="state.showType = true" placeholder='请选择'/>
  62. </u-form-item> -->
  63. <u-form-item label="公司证件编码 ">
  64. <u-input placeholder='请输入公司证件编码' type="text" v-model="state.form.code" />
  65. </u-form-item>
  66. <u-form-item label="公司名称">
  67. <u-input placeholder='请输入公司名称' type="text" v-model="state.form.companyName" />
  68. </u-form-item>
  69. <u-form-item label="经办人姓名">
  70. <u-input placeholder='请输入经办人姓名' type="text" v-model="state.form.handlerName" />
  71. </u-form-item>
  72. <u-form-item label="经办人手机号">
  73. <u-input placeholder='请输入经办人手机号' type="text" v-model="state.form.handlerPhone" />
  74. </u-form-item>
  75. <u-form-item label="银行卡号">
  76. <u-input placeholder='请输入银行卡号' type="text" v-model="state.form.bankCardId" />
  77. </u-form-item>
  78. <u-form-item label="开户行">
  79. <u-input placeholder='请输入开户行' type="text" v-model="state.form.bankAddress" />
  80. </u-form-item>
  81. </u-form>
  82. <!-- <view class='pay_msg'>付款银行账户信息</view>
  83. <view class='company' @click='goBankCard()'>
  84. <view>
  85. <view><text>123456</text><text>贵阳银行股份有限公司</text></view>
  86. <view class='phone'>123****5678</view>
  87. </view>
  88. <u-icon name="arrow-right" color='#ccc' size='40'></u-icon>
  89. </view> -->
  90. </view>
  91. <view class='attention'>
  92. <view>注意事项:</view>
  93. <view>1.开户成功后,请先设置密码,否则不能进行圈存操作</view>
  94. <view>2.付款账户:贵单位打款银行卡</view>
  95. <view>3.开户申请审核结果将于两个工作日发送短信告知</view>
  96. <view>4.只支持黔通卡充值</view>
  97. </view>
  98. <button class='open' type="success" @click='open()'>开户</button>
  99. </view>
  100. <u-picker mode="selector" :range="state.typeList" v-model="state.showType" @confirm="regionConfirmType"></u-picker>
  101. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  102. <view class="choice-takePhoto">
  103. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  104. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  105. <view @click.stop="cancle">取消</view>
  106. </view>
  107. </view>
  108. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  109. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  110. </template>
  111. <script setup lang="ts">
  112. import { reactive } from "vue";
  113. import { etcOcrCard, envs, ocrAllQuery, fileUpload, openRecharge } from "@/utils/network/api.js";
  114. import { pathToBase64 } from "@/utils/image-tools/index.js";
  115. import { navTo } from "@/utils/utils";
  116. import { request } from "@/utils/network/request.js";
  117. import { stringToJson } from "@/utils/network/encryption.js";
  118. import { msg, checkStr, strReplace, uploadFile } from "@/utils/utils";
  119. import viewfinder from "../../../components/viewfinder.vue"
  120. const state = reactive({
  121. showImg: true,
  122. images: '',
  123. isMy: "",//自己办理 他人办理
  124. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  125. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  126. isTakePhotoModeShow: false, //选择拍照方式是否出来
  127. isBusinessLicense: false, //是否上传公司营业执照
  128. form: {
  129. url1: '', //公司营业执照
  130. url2: '', //
  131. url3: '', //
  132. url4: '', //
  133. name: '',//对公用户登录名
  134. passWord: '',//对公用户登录密码
  135. consumePassword: '', //支付密码
  136. // type:'',//公司证件类型
  137. code: '', //公司证件编码
  138. companyName: '',
  139. handlerName: '',
  140. handlerPhone: '',
  141. bankAddress: "", //开户行
  142. bankCardId: "", //充值银行卡号
  143. },
  144. showType: false, //公司证件类型下拉
  145. isPwdType: true,
  146. isAffirmPwdType: true,
  147. // typeList:['营业执照','统一社会信用代码证','组织结构代码证'],
  148. })
  149. const cardDbImageOcr = (val : any) => {
  150. var imageType = val;
  151. uni.chooseImage({
  152. count: 1, //只能选取一张照片
  153. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  154. sourceType: ["camera", "album"], //从相册选择
  155. success: function (res) {
  156. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  157. state.form.url2 = data;
  158. })
  159. },
  160. });
  161. };
  162. const takePhotoMode = (index) => {
  163. state.isTakePhotoModeShow = true
  164. state.choiceIndex = index
  165. }
  166. const xiangce = (val) => {
  167. console.log("val", val)
  168. var imageType = val;
  169. uni.chooseImage({
  170. count: 1, //只能选取一张照片
  171. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  172. sourceType: ["album"], //从相册选择
  173. success: function (res) {
  174. state.showImg = false
  175. state.images = res.tempFilePaths[0]
  176. state.phoneType = state.choiceIndex
  177. state.isTakePhotoModeShow = false
  178. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  179. },
  180. })
  181. }
  182. const takePhoto = (val) => {
  183. state.showImg = true
  184. console.log("拍照", val)
  185. state.phoneType = val;
  186. }
  187. const confirmReturn = (val) => {
  188. state.phoneType = 0
  189. state.isTakePhotoModeShow = false
  190. var imageType = state.choiceIndex;
  191. console.log("图片地址val", val.tempImagePath)
  192. uploadFile(val.tempImagePath, imageType, etcOcrCard).then((data) => {
  193. console.log("身份证上传", data, imageType)
  194. if (imageType === "1") {
  195. state.form.url3 = data.imageUrl;
  196. } else if (imageType === "2") {
  197. state.form.url4 = data.imageUrl;
  198. }
  199. state.isTakePhotoModeShow = false
  200. })
  201. }
  202. const cancle = () => {
  203. state.isTakePhotoModeShow = false
  204. }
  205. const camera = () => {
  206. state.phoneType = 0
  207. }
  208. // 选择公司证件类型的回调
  209. // const regionConfirmType=(e : any)=>{
  210. // state.form.type=state.typeList[e]
  211. // }
  212. const goBankCard = () => {
  213. navTo(`/subpackage/personal-center/setting/bank-card/bank-card`);
  214. }
  215. const open = () => {
  216. for (var i in state.form) {
  217. if (!state.form[i]) {
  218. msg('请把信息填写完整!')
  219. return;
  220. }
  221. }
  222. if (!checkStr(state.form.handlerPhone, 'mobile')) {
  223. msg('请输入正确手机号');
  224. return;
  225. }
  226. const options = {
  227. type: 2,
  228. data: {
  229. 'accountId': state.form.name, //账户编号
  230. 'corporateIdNum': state.form.code, //公司营业执照统一社会信用代码
  231. 'corporateName': state.form.companyName, //对公名称
  232. 'photoUrl': state.form.url1, //营业执照图片路径
  233. 'authBookUrl': state.form.url2, //授权书图片路径
  234. 'agentName': state.form.handlerName, //经办人姓名
  235. 'agentTel': state.form.handlerPhone, //经办人手机号
  236. 'idCardImageUrl': state.form.url3, //经办人身份证正面
  237. 'idCardBackImageUrl': state.form.url4, //经办人身份证反面
  238. 'bankAddress': state.form.bankAddress, //开户行
  239. 'bankCardId': state.form.bankCardId, //充值银行卡号
  240. 'passWord': state.form.passWord, //密码
  241. 'consumePassword': state.form.consumePassword,//支付密码
  242. },
  243. method: "POST",
  244. showLoading: true,
  245. };
  246. request(openRecharge, options)
  247. .then((res) => {
  248. let data = stringToJson(res.bizContent)
  249. console.log("开户成功", data.status)
  250. uni.showModal({
  251. content: '申请已受理,请等待审核',
  252. showCancel: false,
  253. success: function (res) {
  254. if (res.confirm) {
  255. uni.navigateBack({
  256. delta: 2
  257. })
  258. } else if (res.cancel) {
  259. console.log('用户点击取消');
  260. }
  261. }
  262. });
  263. })
  264. .catch((err) => {
  265. console.log(err);
  266. });
  267. }
  268. //营业执照Orc接口调用
  269. const cardImageOcrYY = () => {
  270. uni.chooseImage({
  271. count: 1, //只能选取一张照片
  272. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  273. sourceType: ["camera", "album"], //从相册选择
  274. success: function (res) {
  275. uploadFile(res.tempFilePaths[0], "", ocrAllQuery).then((data) => {
  276. if (data.result) {
  277. state.form.url2 = '';
  278. state.form.companyName = stringToJson(data.result
  279. .businessLicense)[
  280. '名称'];
  281. state.form.code = stringToJson(data.result
  282. .businessLicense)[
  283. '统一社会信用代码'];
  284. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  285. state.form.url1 = data;
  286. })
  287. }
  288. })
  289. },
  290. });
  291. };
  292. //委托书获取图片给后端
  293. // const cardFileImageUpdateyy = (val : any) => {
  294. // var data = {
  295. // fileBase64: val,
  296. // };
  297. // const options = {
  298. // type: 2,
  299. // data: data,
  300. // method: "POST",
  301. // showLoading: true,
  302. // };
  303. // request(fileUpload, options).then((res) => {
  304. // const data = stringToJson(res.bizContent);
  305. // state.form.url1 = data.data.url;
  306. // });
  307. // };
  308. const shiqu = () => {
  309. console.log("state.form.handlerPhone", state.form.handlerPhone)
  310. }
  311. </script>
  312. <style scoped lang="scss">
  313. .content {
  314. background-color: rgb(246, 246, 246);
  315. font-size: 30rpx;
  316. padding-bottom: 30rpx;
  317. }
  318. .up_img_wrap {
  319. background-color: white;
  320. padding: 0 20rpx;
  321. }
  322. .title {
  323. margin: 0 0 20rpx 0;
  324. }
  325. .tips {
  326. color: red;
  327. font-size: 30rpx;
  328. }
  329. .item_wrap {
  330. display: flex;
  331. flex-shrink: 1;
  332. flex-wrap: wrap;
  333. justify-content: space-between;
  334. padding: 10rpx 0 20rpx 0;
  335. }
  336. .item {
  337. width: 45%;
  338. height: 250rpx;
  339. margin-top: 20rpx;
  340. }
  341. .item image {
  342. width: 100%;
  343. height: 80%;
  344. }
  345. .item view {
  346. text-align: center;
  347. }
  348. .message {
  349. margin-top: 30rpx;
  350. }
  351. .pay_msg {
  352. border-bottom: 2px dotted rgb(75, 217, 97);
  353. padding: 30rpx 0;
  354. }
  355. .company {
  356. padding: 20rpx 50rpx 20rpx 6rpx;
  357. display: flex;
  358. align-items: center;
  359. justify-content: space-between;
  360. }
  361. .phone {
  362. margin-top: 20rpx;
  363. }
  364. .attention {
  365. background-color: rgb(246, 246, 246);
  366. color: red;
  367. font-size: 30rpx;
  368. padding: 30rpx 20rpx 20rpx 20rpx;
  369. }
  370. .open {
  371. height: 80rpx;
  372. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  373. border-radius: 40rpx;
  374. font-size: 32rpx;
  375. font-weight: 400;
  376. color: #ffffff;
  377. margin: 0 30rpx;
  378. }
  379. .choice-takePhoto {
  380. position: absolute;
  381. bottom: 0;
  382. background-color: white;
  383. width: 100%;
  384. border-radius: 20rpx 20rpx 0 0;
  385. }
  386. .choice-takePhoto>view:first-child {
  387. text-align: center;
  388. height: 80rpx;
  389. line-height: 80rpx;
  390. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  391. background-color: white;
  392. }
  393. .choice-takePhoto>view:last-child {
  394. text-align: center;
  395. height: 80rpx;
  396. line-height: 80rpx;
  397. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  398. background-color: white;
  399. }
  400. .choice-takePhoto>view {
  401. text-align: center;
  402. height: 80rpx;
  403. line-height: 80rpx;
  404. background-color: white;
  405. }
  406. .choice-takePhoto-wrap {
  407. width: 100%;
  408. height: 100vh;
  409. background-color: rgba(127, 127, 127, 0.2);
  410. position: fixed;
  411. left: 0;
  412. top: 0;
  413. z-index: 11111;
  414. }
  415. .form-input {
  416. display: flex;
  417. flex-direction: row;
  418. align-items: center;
  419. height: 90rpx;
  420. .input {
  421. flex: 1;
  422. padding-right: 48rpx;
  423. font-size: 26rpx;
  424. // background: transparent;
  425. }
  426. .eye {
  427. width: 48rpx;
  428. height: 48rpx;
  429. }
  430. }
  431. </style>