移动端
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.

userRegister.vue 13 KiB

3 年之前
3 年之前
3 年之前
2 年之前
2 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
2 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
3 年之前
2 年之前
2 年之前
2 年之前
2 年之前
3 年之前
3 年之前
2 年之前
2 年之前
2 年之前
1 年之前
1 年之前
1 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <div class="app-container" :style="{height:height+'px'}">
  3. <!-- <van-nav-bar-->
  4. <!-- title="个人用户注册"-->
  5. <!-- left-arrow-->
  6. <!-- fixed-->
  7. <!-- placeholder-->
  8. <!-- @click-left="onClickLeft"-->
  9. <!-- style="background: linear-gradient(to right,#91E1CA,#E0F4E4);"-->
  10. <!-- />-->
  11. <navBar title="个人用户注册" background="0" positionType="fixed"></navBar>
  12. <van-form @submit="getSubmit">
  13. <div class="block_box">
  14. <!-- <div class="block_tt"><i></i>用户信息</div> color: '#0CBEA6',-->
  15. <van-divider :style="{ borderColor: '#0CBEA6', padding: '0 16px' }">用户信息</van-divider>
  16. <van-field v-model="form.phone" type="tel" label="手机号" placeholder="请输入手机号,作为登录账号" required :rules="[{ required:true }]" />
  17. <!-- <van-field-->
  18. <!-- center-->
  19. <!-- clearable-->
  20. <!-- label="短信验证码"-->
  21. <!-- placeholder="请输入短信验证码"-->
  22. <!-- required-->
  23. <!-- v-model="form.sms"-->
  24. <!-- :rules="[{ required:true }]"-->
  25. <!-- >-->
  26. <!-- <template #button>-->
  27. <!-- <van-button size="small" type="primary" native-type="button" :rules="[{ required:true }]">发送验证码</van-button>-->
  28. <!-- </template>-->
  29. <!-- </van-field>-->
  30. <van-field v-model="form.password" type="password" label="密码" placeholder="请输入密码" required :rules="[{ required:true }]"/>
  31. <van-field v-model="confirmPassWord" type="password" label="确认密码" placeholder="请再次输入密码" required :rules="[{ required:true }]"/>
  32. <van-field v-model="form.realname" label="姓名" placeholder="请输入姓名" required :rules="[{ required:true }]"/>
  33. <van-field v-model="form.idCardNum" label="身份证号" placeholder="请输入身份证号" required :rules="[{ required:true }]"/>
  34. <van-field v-model="form.address" label="联系地址" placeholder="请输入联系地址" />
  35. <van-field name="uploader" label="身份证(正)" required :border="false"></van-field>
  36. <van-field name="uploader">
  37. <template #input>
  38. <van-uploader :after-read="afterReadSFZ" :before-delete="deleteFileSFZ" v-model="fileListSFZ" multiple :max-count="1" />
  39. </template>
  40. </van-field>
  41. <p style="color: red;padding: 2vw 3vw;">*身份证照片、本人和身份证的合影</p>
  42. </div>
  43. <!-- <van-divider>银行信息</van-divider>-->
  44. <div class="block_box">
  45. <van-divider :style="{ borderColor: '#0CBEA6', padding: '0 16px' }">银行信息</van-divider>
  46. <van-field name="uploader" label="银行卡" required :border="false"></van-field>
  47. <van-field name="uploader">
  48. <template #input>
  49. <van-uploader :after-read="afterReadYHK" :before-delete="deleteFileYHK" v-model="fileListYHK" multiple :max-count="1" />
  50. </template>
  51. </van-field>
  52. <van-field v-model="form.bankCardName" label="开户姓名" placeholder="请输入姓名" required :rules="[{ required:true }]"/>
  53. <van-field v-model="form.bankCardNum" label="开户账号" placeholder="请输入开户账号" required :rules="[{ required:true }]"/>
  54. <van-field
  55. v-model="accountType"
  56. is-link
  57. readonly
  58. required
  59. :rules="[{ required:true }]"
  60. label="账户类型"
  61. placeholder="请选择账户类型"
  62. @click="showAccountType = true"
  63. />
  64. <van-popup v-model:show="showAccountType" position="bottom">
  65. <van-picker
  66. show-toolbar
  67. value-key="dictLabel"
  68. :columns="accountTypeOption"
  69. @confirm="onConfirmAccountType"
  70. @cancel="showAccountType = false"
  71. />
  72. </van-popup>
  73. <van-field
  74. v-model="bankType"
  75. is-link
  76. readonly
  77. required
  78. :rules="[{ required:true }]"
  79. label="所属银行"
  80. placeholder="请选择所属银行"
  81. @click="showBankType = true"
  82. />
  83. <van-popup v-model:show="showBankType" position="bottom">
  84. <van-picker
  85. show-toolbar
  86. value-key="dictLabel"
  87. :columns="bankTypeOption"
  88. @confirm="onConfirmBankType"
  89. @cancel="showArea = false"
  90. />
  91. </van-popup>
  92. <van-field
  93. v-model="sheng"
  94. is-link
  95. readonly
  96. label="开户省市"
  97. placeholder="请选择开户省市"
  98. @click="showSheng = true"
  99. />
  100. <van-popup v-model:show="showSheng" position="bottom">
  101. <van-picker
  102. show-toolbar
  103. value-key="label"
  104. :columns="shengOption"
  105. @confirm="onConfirmSheng"
  106. @cancel="showSheng = false"
  107. />
  108. </van-popup>
  109. <van-field v-model="form.bankDeposit" label="关键词" placeholder="请输入开户行地址关键词,如镇街名称"/>
  110. <van-field
  111. v-model="form.bankAddress"
  112. label="开户银行"
  113. placeholder="输入【开户省市、关键词】后:"
  114. required
  115. :rules="[{ required:true }]"
  116. readonly
  117. @click="showBankAddress = true"
  118. >
  119. <template #button>
  120. <van-button size="small" type="primary" native-type="button" @click="searchBankAddress">点击检索</van-button>
  121. </template>
  122. </van-field>
  123. <van-popup v-model:show="showBankAddress" position="bottom">
  124. <van-picker
  125. show-toolbar
  126. value-key="bankDeposit"
  127. :columns="bankAddressOption"
  128. @confirm="onConfirmBankAddress"
  129. @cancel="showBankAddress = false"
  130. />
  131. </van-popup>
  132. <van-field v-model="form.payeePaymentLines" label="联行号" placeholder="开户银行选定后,自动填充!" required :rules="[{ required:true }]"/>
  133. <van-field v-model="form.code" center clearable label="验证码" placeholder="图形验证码" required :rules="[{ required:true }]">
  134. <template #button>
  135. <img class="code-img" :src="codeUrl" @click="getCode" />
  136. </template>
  137. </van-field>
  138. </div>
  139. <div class="submit">
  140. <!-- <p>我已阅读并同意<span>《农村产权交易信息服务平台会员注册协议》</span></p>-->
  141. <van-button round block type="info" color="#0DBCAA" native-type="submit">立即注册</van-button>
  142. </div>
  143. </van-form>
  144. </div>
  145. </template>
  146. <script>
  147. import { getCodeImg } from "@/api/login";
  148. import {userRegister, attachmentUpload, realtimeBackList, depositList} from "@/api/register/index";
  149. import {deleteUserImg, options, realtimeList} from "@/api/user";
  150. import navBar from "@/components/common/nav_bar.vue";
  151. export default {
  152. name: "userRegister",
  153. components: { navBar },
  154. data() {
  155. return {
  156. height:0,
  157. tel:'',
  158. confirmPassWord:'',
  159. form: {
  160. phone: "", //账号
  161. code: "", //验证码
  162. password: "", //密码
  163. realname: "", //姓名
  164. idCardNum: "", //身份证号
  165. address: "", //地址
  166. uuid:'',//图形验证码ID
  167. memberType:1,
  168. economicType:1,
  169. idCardPic :'',
  170. accountOpenCert:'',
  171. bankCardName:'',
  172. bankCardNum:'',
  173. bankAddress:'',
  174. },
  175. codeUrl:'',
  176. fileListSFZ:[],
  177. fileListYHK:[],
  178. hcAreaInfoFieldName: {
  179. text: "label",
  180. value: "value",
  181. children: "children",
  182. },
  183. bankTypeOption:[],
  184. sheng:'',
  185. shi:'',
  186. bankType:'',
  187. accountType:'',
  188. bankDeposit:'',
  189. showBankType:false,
  190. showSheng :false,
  191. shengOption:options,
  192. showShi :false,
  193. shiOption:[],
  194. showBankAddress :false,
  195. accountTypeOption:[],
  196. showAccountType :false,
  197. bankAddressOption:[],
  198. };
  199. },
  200. created() {
  201. this.getCode()
  202. this.getDicts("bank_type_all").then(response => {
  203. this.bankTypeOption = response.data;
  204. });
  205. this.getDicts("bank_account_type").then(response => {
  206. this.accountTypeOption = response.data;
  207. });
  208. this.height = document.body.clientHeight
  209. },
  210. methods: {
  211. getCode() {
  212. getCodeImg().then((res) => {
  213. this.form.uuid = res.uuid;
  214. this.codeUrl = "data:image/gif;base64," + res.img;
  215. });
  216. },
  217. getSubmit(){
  218. console.log(this.form)
  219. if (this.form.password!= this.confirmPassWord){
  220. this.$toast({
  221. icon: 'error', // 找到自己需要的图标
  222. message: '两次密码输入不一致',
  223. duration:"2000",
  224. onClose:function(){
  225. }
  226. })
  227. return;
  228. }
  229. if (this.form.idCardPic == ''){
  230. this.$toast({
  231. icon: 'error', // 找到自己需要的图标
  232. message: '请上传身份证',
  233. duration:"2000",
  234. onClose:function(){
  235. }
  236. })
  237. return;
  238. }
  239. if (this.form.accountOpenCert == ''){
  240. this.$toast({
  241. icon: 'error', // 找到自己需要的图标
  242. message: '请上传银行卡',
  243. duration:"2000",
  244. onClose:function(){
  245. }
  246. })
  247. return;
  248. }
  249. this.$toast.loading({
  250. message: '正在注册...',
  251. forbidClick: true,
  252. });
  253. this.form.accountType = '2';
  254. console.log(this.form);
  255. var that = this
  256. userRegister(this.form).then((res) => {
  257. this.$toast.clear();
  258. this.$toast({
  259. icon: 'success', // 找到自己需要的图标
  260. message: '注册成功',
  261. duration:"2000",
  262. onClose:function(){
  263. that.$router.push({path: '/login'})
  264. }
  265. })
  266. });
  267. },
  268. afterReadSFZ(file) {
  269. // 此时可以自行将文件上传至服务器
  270. this.$toast.loading({
  271. message: "上传中...",
  272. forbidClick: true,
  273. duration: 0,
  274. });
  275. console.log(file)
  276. let params1 = new FormData();
  277. params1.append("file", file.file);
  278. attachmentUpload(params1).then((r1) => {
  279. this.form.idCardPic = r1.fileName;
  280. })
  281. },
  282. afterReadYHK(file) {
  283. // 此时可以自行将文件上传至服务器.
  284. this.$toast.loading({
  285. message: "上传中...",
  286. forbidClick: true,
  287. duration: 0,
  288. });
  289. let params1 = new FormData();
  290. params1.append("file", file.file);
  291. attachmentUpload(params1).then((r1) => {
  292. this.form.accountOpenCert = r1.fileName;
  293. })
  294. },
  295. deleteFileSFZ(elIndex){
  296. return (file, name) => {
  297. let fileIndex = name.index
  298. this.fileListSFZ[elIndex].splice(fileIndex, 1)
  299. this.form.idCardPic = '';
  300. }
  301. },
  302. deleteFileYHK(elIndex){
  303. return (file, name) => {
  304. let fileIndex = name.index
  305. this.fileListYHK[elIndex].splice(fileIndex, 1)
  306. this.form.accountOpenCert = '';
  307. }
  308. },
  309. searchBankAddress(){
  310. let data = {
  311. sheng:this.form.sheng,
  312. shi:this.form.shi,
  313. bankType:this.form.bankType,
  314. bankDeposit:this.form.bankDeposit,
  315. }
  316. depositList(data).then(response => {
  317. if (response.rows.length<1){
  318. if (this.form.sheng==''||this.form.shi==''){
  319. this.$toast({
  320. icon: 'fail', // 找到自己需要的图标
  321. message: '请选择省市',
  322. duration:"1000",
  323. })
  324. return;
  325. }
  326. if (this.form.bankDeposit==''){
  327. this.$toast({
  328. icon: 'fail', // 找到自己需要的图标
  329. message: '请输入关键词',
  330. duration:"1000",
  331. })
  332. return;
  333. }
  334. realtimeBackList(data).then(response2 => {
  335. this.bankAddressOption = response2.data;
  336. });
  337. }else{
  338. this.bankAddressOption = response.rows;
  339. }
  340. });
  341. },
  342. onConfirmBankType(value){
  343. this.showBankType = false;
  344. this.form.bankAddress = '';
  345. this.form.payeePaymentLines = '';
  346. this.bankType = value.dictLabel;
  347. this.form.bankType = value.dictValue;
  348. },
  349. onConfirmSheng(value){
  350. console.log(value)
  351. this.showSheng = false;
  352. this.form.sheng = value[0];
  353. this.form.shi = value[1];
  354. this.sheng = value.join('/');
  355. },
  356. onConfirmBankAddress(value){
  357. console.log(value)
  358. this.form.bankAddress = value.bankDeposit;
  359. this.form.payeePaymentLines = value.payeePaymentLines;
  360. this.showBankAddress = false;
  361. },
  362. onConfirmAccountType(value){
  363. console.log(value)
  364. this.form.accountType = value.dictValue;
  365. this.accountType = value.dictLabel;
  366. this.showAccountType = false;
  367. },
  368. },
  369. };
  370. </script>
  371. <style scoped lang="scss">
  372. .app-container {
  373. background-color: #F4F8FB;
  374. .code-img {
  375. width: 220px;
  376. }
  377. }
  378. .submit{
  379. width: 90%;
  380. margin: 2vh auto 0;
  381. padding-bottom: 5vh;
  382. p{
  383. text-align: center;
  384. margin-bottom: 0.2rem;
  385. span{
  386. color: #007E72;
  387. }
  388. }
  389. }
  390. .block_box{
  391. width: 94%;
  392. margin: 3vw auto;
  393. background: #ffffff;
  394. padding: 3vw 0;
  395. border-radius: 15Px;
  396. overflow: hidden;
  397. .block_tt{
  398. font-size: 16Px;
  399. display: flex;
  400. align-items: center;
  401. padding: 0 3vw;
  402. line-height: 1;
  403. i{
  404. display: block;
  405. width: 3Px;
  406. height: 14Px;
  407. background: #0CBEA6;
  408. margin-right: 5PX;
  409. border-radius: 5PX;
  410. }
  411. /*border-left: 3Px solid #0CBEA6;*/
  412. }
  413. }
  414. </style>