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

open-account.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. // navTo(`/subpackage/after-sale/account-recharge/login`)
  241. } else if (res.cancel) {
  242. console.log('用户点击取消');
  243. }
  244. }
  245. });
  246. })
  247. .catch((err) => {
  248. console.log(err);
  249. });
  250. }
  251. //营业执照Orc接口调用
  252. const cardImageOcrYY = () => {
  253. uni.chooseImage({
  254. count: 1, //只能选取一张照片
  255. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  256. sourceType: ["camera", "album"], //从相册选择
  257. success: function (res) {
  258. uploadFile(res.tempFilePaths[0], "", ocrAllQuery).then((data) => {
  259. if (data.result) {
  260. state.form.url2 = '';
  261. state.form.companyName = stringToJson(data.result
  262. .businessLicense)[
  263. '名称'];
  264. state.form.code = stringToJson(data.result
  265. .businessLicense)[
  266. '统一社会信用代码'];
  267. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  268. state.form.url1 = data;
  269. })
  270. }
  271. })
  272. },
  273. });
  274. };
  275. //委托书获取图片给后端
  276. // const cardFileImageUpdateyy = (val : any) => {
  277. // var data = {
  278. // fileBase64: val,
  279. // };
  280. // const options = {
  281. // type: 2,
  282. // data: data,
  283. // method: "POST",
  284. // showLoading: true,
  285. // };
  286. // request(fileUpload, options).then((res) => {
  287. // const data = stringToJson(res.bizContent);
  288. // state.form.url1 = data.data.url;
  289. // });
  290. // };
  291. const shiqu = () => {
  292. console.log("state.form.handlerPhone", state.form.handlerPhone)
  293. }
  294. </script>
  295. <style scoped>
  296. .content {
  297. background-color: rgb(246, 246, 246);
  298. font-size: 30rpx;
  299. padding-bottom: 30rpx;
  300. }
  301. .up_img_wrap {
  302. background-color: white;
  303. padding: 0 20rpx;
  304. }
  305. .title {
  306. margin: 0 0 20rpx 0;
  307. }
  308. .tips {
  309. color: red;
  310. font-size: 30rpx;
  311. }
  312. .item_wrap {
  313. display: flex;
  314. flex-shrink: 1;
  315. flex-wrap: wrap;
  316. justify-content: space-between;
  317. padding: 10rpx 0 20rpx 0;
  318. }
  319. .item {
  320. width: 45%;
  321. height: 250rpx;
  322. margin-top: 20rpx;
  323. }
  324. .item image {
  325. width: 100%;
  326. height: 80%;
  327. }
  328. .item view {
  329. text-align: center;
  330. }
  331. .message {
  332. margin-top: 30rpx;
  333. }
  334. .pay_msg {
  335. border-bottom: 2px dotted rgb(75, 217, 97);
  336. padding: 30rpx 0;
  337. }
  338. .company {
  339. padding: 20rpx 50rpx 20rpx 6rpx;
  340. display: flex;
  341. align-items: center;
  342. justify-content: space-between;
  343. }
  344. .phone {
  345. margin-top: 20rpx;
  346. }
  347. .attention {
  348. background-color: rgb(246, 246, 246);
  349. color: red;
  350. font-size: 30rpx;
  351. padding: 30rpx 20rpx 20rpx 20rpx;
  352. }
  353. .open {
  354. height: 80rpx;
  355. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  356. border-radius: 40rpx;
  357. font-size: 32rpx;
  358. font-weight: 400;
  359. color: #ffffff;
  360. margin: 0 30rpx;
  361. }
  362. .choice-takePhoto {
  363. position: absolute;
  364. bottom: 0;
  365. background-color: white;
  366. width: 100%;
  367. border-radius: 20rpx 20rpx 0 0;
  368. }
  369. .choice-takePhoto>view:first-child {
  370. text-align: center;
  371. height: 80rpx;
  372. line-height: 80rpx;
  373. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  374. background-color: white;
  375. }
  376. .choice-takePhoto>view:last-child {
  377. text-align: center;
  378. height: 80rpx;
  379. line-height: 80rpx;
  380. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  381. background-color: white;
  382. }
  383. .choice-takePhoto>view {
  384. text-align: center;
  385. height: 80rpx;
  386. line-height: 80rpx;
  387. background-color: white;
  388. }
  389. .choice-takePhoto-wrap {
  390. width: 100%;
  391. height: 100vh;
  392. background-color: rgba(127, 127, 127, 0.2);
  393. position: fixed;
  394. left: 0;
  395. top: 0;
  396. z-index: 11111;
  397. }
  398. </style>