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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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/renxiang.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/renxiang.png`">
  15. </image>
  16. <image v-else class="icon" :src="state.form.url2"></image>
  17. <view>单位授权书</view>
  18. </view>
  19. <view class='item' @click="cardDbImageOcr('3')">
  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="cardDbImageOcr('4')">
  26. <image v-if="!state.form.url4" class="icon" :src="`${$imgUrl}applyCard/renxiang.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='请输入6-12位字母加数字组成的账号' 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 v-model="state.form.type" type="select" :select-open="state.showType" @click="state.showType = true" placeholder='请选择'/>
  43. </u-form-item>
  44. <u-form-item label="公司证件编码 " >
  45. <u-input placeholder='请输入公司证件编码' type="text" v-model="state.form.code"/>
  46. </u-form-item>
  47. <u-form-item label="公司名称" >
  48. <u-input placeholder='请输入公司名称' type="text" v-model="state.form.companyName"/>
  49. </u-form-item>
  50. <u-form-item label="经办人姓名" >
  51. <u-input placeholder='请输入经办人姓名' type="text" v-model="state.form.handlerName"/>
  52. </u-form-item>
  53. <u-form-item label="经办人手机号" >
  54. <u-input placeholder='请输入经办人手机号' type="text" v-model="state.form.handlerPhone"/>
  55. </u-form-item>
  56. </u-form>
  57. <!-- <view class='pay_msg'>付款银行账户信息</view>
  58. <view class='company' @click='goBankCard()'>
  59. <view>
  60. <view><text>123456</text><text>贵阳银行股份有限公司</text></view>
  61. <view class='phone'>123****5678</view>
  62. </view>
  63. <u-icon name="arrow-right" color='#ccc' size='40'></u-icon>
  64. </view> -->
  65. </view>
  66. <view class='attention'>
  67. <view>注意事项:</view>
  68. <view>1.开户成功后,请先设置密码,否则不能进行圈存操作</view>
  69. <view>2.付款账户:贵单位打款银行卡</view>
  70. <view>3.开户申请审核结果将于两个工作日发送短信告知</view>
  71. <view>4.只支持黔通卡充值</view>
  72. </view>
  73. <button class='open' type="success" @click='open()'>开户</button>
  74. </view>
  75. <u-picker mode="selector" :range="state.typeList" v-model="state.showType" @confirm="regionConfirmType"></u-picker>
  76. </template>
  77. <script setup lang="ts">
  78. import {reactive} from "vue";
  79. import {etcOcrCard,envs,ocrAllQuery,fileUpload} from "@/utils/network/api.js";
  80. import {pathToBase64} from "@/utils/image-tools/index.js";
  81. import { navTo } from "@/utils/utils";
  82. import {request} from "@/utils/network/request.js";
  83. import {stringToJson} from "@/utils/network/encryption.js";
  84. import { msg } from "@/utils/utils";
  85. const state = reactive({
  86. isBusinessLicense:false, //是否上传公司营业执照
  87. form:{
  88. url1:'', //公司营业执照
  89. url2:'', //
  90. url3:'', //
  91. url4:'', //
  92. name:'',//对公用户登录名
  93. password:'',//对公用户登录密码
  94. type:'',//公司证件类型
  95. code:'', //公司证件编码
  96. companyName:'',
  97. handlerName:'',
  98. handlerPhone:'',
  99. bankAddress:"贵阳银行", //开户行
  100. bankCardId:"1111", //充值银行卡号
  101. },
  102. showType:false, //公司证件类型下拉
  103. typeList:['营业执照','统一社会信用代码证','组织结构代码证'],
  104. })
  105. const cardDbImageOcr = (val : any) => {
  106. var imageType = val;
  107. uni.chooseImage({
  108. count: 1, //只能选取一张照片
  109. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  110. sourceType: ["camera", "album"], //从相册选择
  111. success: function (res) {
  112. pathToBase64(res.tempFilePaths[0])
  113. .then((path) => {
  114. var data = {
  115. source: "1",
  116. agencyId: "52010106004",
  117. imageType: imageType,
  118. fileName: res.tempFilePaths[0],
  119. imageBase64: path,
  120. };
  121. const options = {
  122. type: 2,
  123. data: data,
  124. method: "POST",
  125. showLoading: true,
  126. };
  127. console.log("cdfdf")
  128. request(etcOcrCard, options).then((res) => {
  129. const data = stringToJson(res.bizContent);
  130. console.log("图片信息",data)
  131. if (val === "2"){
  132. state.form.url2 = data.imageUrl;
  133. }else if (val === "3"){
  134. state.form.url3 = data.imageUrl;
  135. }else if (val === "4"){
  136. state.form.url4 = data.imageUrl;
  137. }
  138. });
  139. })
  140. .catch((error) => { });
  141. },
  142. });
  143. };
  144. // 选择公司证件类型的回调
  145. const regionConfirmType=(e : any)=>{
  146. state.form.type=state.typeList[e]
  147. }
  148. //替换图片地址
  149. const strReplace = (str : string) => {
  150. return str.replace('192.168.101.145:9000', envs[process.env.NODE_ENV].baseUrl)
  151. }
  152. const goBankCard=()=>{
  153. navTo(`/subpackage/personal-center/setting/bank-card/bank-card`);
  154. }
  155. const open=()=>{
  156. for(var i in state.from){
  157. if(!state.from[i]){
  158. msg('请把信息填写完整!')
  159. return;
  160. }
  161. }
  162. const options = {
  163. type: 2,
  164. data: {
  165. 'accountId':state.from.code, //账户编号
  166. 'corporateIdNum':state.from.type, //公司营业执照统一社会信用代码
  167. 'corporateName':state.from.name, //对公名称
  168. 'password':state.from.password, //密码
  169. 'photoUrl':state.from.url1, //营业执照图片路径
  170. 'authBookUrl':state.from.url2, //授权书图片路径
  171. 'agentName':state.from.handlerName, //经办人姓名
  172. 'agentTel':state.from.handlerPhone, //经办人手机号
  173. 'idCardImageUrl':state.from.url3, //经办人身份证正面
  174. 'idCardImageUrl':state.from.url4, //经办人身份证反面
  175. 'bankAddress':"贵阳银行", //开户行
  176. 'bankCardId':"1111", //充值银行卡号
  177. },
  178. method: "POST",
  179. showLoading: true,
  180. };
  181. request(sendCode, options)
  182. .then((res) => {
  183. let data = stringToJson(res.bizContent)
  184. console.log("开户成功",data)
  185. })
  186. .catch((err) => {
  187. console.log(err);
  188. });
  189. }
  190. //营业执照Orc接口调用
  191. const cardImageOcrYY = () => {
  192. uni.chooseImage({
  193. count: 1, //只能选取一张照片
  194. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  195. sourceType: ["camera", "album"], //从相册选择
  196. success: function(res) {
  197. pathToBase64(res.tempFilePaths[0])
  198. .then((path) => {
  199. var data = {
  200. type: 'business_license',
  201. base64: path,
  202. };
  203. const options = {
  204. type: 2,
  205. data: data,
  206. method: "POST",
  207. showLoading: true,
  208. };
  209. request(ocrAllQuery, options).then((res) => {
  210. const data = stringToJson(res.bizContent);
  211. console.log("营业执照",data)
  212. if (data.result) {
  213. state.form.url2 = '';
  214. state.form.companyName = stringToJson(data.result
  215. .businessLicense)[
  216. '名称'];
  217. state.form.code = stringToJson(data.result
  218. .businessLicense)[
  219. '统一社会信用代码'];
  220. cardFileImageUpdateyy(path)
  221. }
  222. });
  223. })
  224. .catch((error) => {});
  225. },
  226. });
  227. };
  228. //委托书获取图片给后端
  229. const cardFileImageUpdateyy = (val: any) => {
  230. var data = {
  231. fileBase64: val,
  232. };
  233. const options = {
  234. type: 2,
  235. data: data,
  236. method: "POST",
  237. showLoading: true,
  238. };
  239. request(fileUpload, options).then((res) => {
  240. const data = stringToJson(res.bizContent);
  241. state.form.url1 = data.data.url;
  242. });
  243. };
  244. </script>
  245. <style scoped>
  246. .content{
  247. background-color:rgb(246,246,246);
  248. font-size:30rpx;
  249. padding-bottom: 30rpx;
  250. }
  251. .up_img_wrap{
  252. background-color:white;
  253. padding:0 20rpx;
  254. }
  255. .title{
  256. margin:0 0 20rpx 0;
  257. }
  258. .tips{
  259. color:red;
  260. font-size:30rpx;
  261. }
  262. .item_wrap{
  263. display: flex;
  264. flex-shrink: 1;
  265. flex-wrap: wrap;
  266. justify-content: space-between;
  267. padding:10rpx 0 20rpx 0;
  268. }
  269. .item{
  270. width:45%;
  271. height:250rpx;
  272. margin-top:20rpx;
  273. }
  274. .item image{
  275. width:100%;
  276. height:80%;
  277. }
  278. .item view{
  279. text-aline:center;
  280. text-align: center;
  281. }
  282. .message{
  283. margin-top:30rpx;
  284. }
  285. .pay_msg{
  286. border-bottom: 2px dotted rgb(75,217,97);
  287. padding:30rpx 0;
  288. }
  289. .company{
  290. padding: 20rpx 50rpx 20rpx 6rpx;
  291. display:flex;
  292. align-items: center;
  293. justify-content: space-between;
  294. }
  295. .phone{
  296. margin-top:20rpx;
  297. }
  298. .attention{
  299. background-color:rgb(246,246,246);
  300. color:red;
  301. font-size:30rpx;
  302. padding:30rpx 20rpx 20rpx 20rpx;
  303. }
  304. .open{
  305. height: 80rpx;
  306. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  307. border-radius: 40rpx;
  308. font-size: 32rpx;
  309. font-weight: 400;
  310. color: #ffffff;
  311. margin:0 30rpx;
  312. }
  313. </style>