選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

open-account.vue 13KB

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