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

open-account.vue 13KB

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