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

364 行
11 KiB

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