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

open-account.vue 13KB

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