smrz.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view class="content">
  3. <view class="" style="height: 20rpx;">
  4. </view>
  5. <view class="tab">
  6. <view class="bd-wrap flex">
  7. <view class="bg-name">
  8. 您的姓名:
  9. </view>
  10. <view class="bg-val">
  11. <input type="text" value="" placeholder="请输入姓名" class="val-ipt" v-model="name"
  12. ref="name" />
  13. </view>
  14. </view>
  15. <view class="bd-wrap flex">
  16. <view class="bg-name">
  17. 身份证号:
  18. </view>
  19. <view class="bg-val">
  20. <input type="text" value="" placeholder="请输入身份证号" class="val-ipt" v-model="idcard"
  21. ref="idcard" />
  22. </view>
  23. </view>
  24. <view class="bd-wrap flex">
  25. <view class="bg-name">
  26. 手机号:
  27. </view>
  28. <view class="bg-val">
  29. <input type="text" value="" placeholder="请输入手机号" class="val-ipt" v-model="phone"
  30. ref="idcard" />
  31. </view>
  32. </view>
  33. <view class="bd-wrap flex">
  34. <view class="bg-name">
  35. 验证码:
  36. </view>
  37. <view class="bg-val">
  38. <input type="text" value="" placeholder="请输入验证码" class="val-ipt" v-model="code"
  39. ref="idcard" />
  40. </view>
  41. <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
  42. </view>
  43. <view class="tit tit1">
  44. 身份证照片(正反两面)
  45. </view>
  46. <view class="" @click="imgsub('sfzz')">
  47. <image :src="sfzz" mode="" class="sfz" v-if="sfzz"></image>
  48. <image src="../../static/user/sfzz.png" mode="" class="sfz" v-else></image>
  49. </view>
  50. <view class="tip">
  51. 身份证头像面
  52. </view>
  53. <view class="" @click="imgsub('sfzf')">
  54. <image :src="sfzf" mode="" class="sfz" v-if="sfzf"></image>
  55. <image src="../../static/user/sfzf.png" mode="" class="sfz" v-else></image>
  56. </view>
  57. <view class="tip">
  58. 身份证国徽面
  59. </view>
  60. </view>
  61. <view class="btm-btn" @click="bank">
  62. 确认
  63. </view>
  64. <codeImage @openCode='getCode' loginType="register" @close='showAlert=false' :phone="phone" ref="alertImage"
  65. :show='showAlert'></codeImage>
  66. </view>
  67. </template>
  68. <script>
  69. import codeImage from '@/components/codeImage.vue';
  70. import {
  71. mapState,
  72. mapMutations
  73. } from 'vuex';
  74. import {
  75. upload
  76. } from '@/api/order.js';
  77. import {
  78. enroll
  79. } from '@/api/index.js'
  80. import {
  81. getLevelList,
  82. bank,
  83. bankInfo,
  84. realName
  85. } from '@/api/user.js'
  86. export default {
  87. components: {
  88. codeImage
  89. },
  90. data() {
  91. return {
  92. countDown: 0,
  93. name: '',
  94. idcard: '',
  95. sfzz: '',
  96. sfzf: '',
  97. code: '',
  98. phone: '',
  99. loading: false,
  100. showAlert: false
  101. };
  102. },
  103. onLoad(opt) {},
  104. onShow() {
  105. },
  106. onReachBottom() {
  107. },
  108. computed: {
  109. ...mapState('user', ['userInfo'])
  110. },
  111. methods: {
  112. // 发送验证码
  113. getCode() {
  114. const obj = this;
  115. obj.countDown = 60;
  116. obj.time = setInterval(() => {
  117. obj.countDown--;
  118. }, 1000);
  119. //调用验证码接口
  120. },
  121. imgsub(name) {
  122. console.log('上传头像')
  123. upload({
  124. filename: ''
  125. }).then(data => {
  126. console.log("data", data);
  127. this.bankInfo[name] = data[0].url;
  128. })
  129. },
  130. //发送验证码
  131. verification() {
  132. let obj = this;
  133. if (this.phone == '') {
  134. this.$api.msg('请输入电话号码');
  135. return;
  136. }
  137. if (this.phone.length < 11) {
  138. this.$api.msg('请输入正确的手机号');
  139. return;
  140. }
  141. // 判断是否在倒计时
  142. if (obj.countDown > 0) {
  143. return false;
  144. } else {
  145. obj.showAlert = true;
  146. obj.$refs.alertImage.getImage()
  147. }
  148. },
  149. bank() {
  150. let that = this
  151. if (that.loading) {
  152. return
  153. }
  154. if (that.name == '') {
  155. return that.$api.msg('请输入您的姓名')
  156. }
  157. if (that.idcard == '') {
  158. return that.$api.msg('请输入身份证号')
  159. }
  160. if (that.sfzz == '') {
  161. return that.$api.msg('请上传身份证照片')
  162. }
  163. if (that.sfzf == '') {
  164. return that.$api.msg('请上传身份证照片')
  165. }
  166. let data = {
  167. real_name: that.name,
  168. id_card: that.idcard,
  169. id_card_front_image: that.sfzz,
  170. id_card_back_image: that.sfzf
  171. }
  172. that.loading = true
  173. realName(data).then(res => {
  174. console.log(res);
  175. uni.showToast({
  176. title: '提交成功',
  177. duration: 2000
  178. });
  179. setTimeout(() => {
  180. uni.navigateBack()
  181. that.loading = false
  182. }, 1500)
  183. }).catch(err => {
  184. console.log('err');
  185. that.loading = false
  186. })
  187. }
  188. }
  189. };
  190. </script>
  191. <style lang="scss" scoped>
  192. page {
  193. height: auto;
  194. min-height: 100%;
  195. background-color: #fff;
  196. }
  197. .tab {
  198. width: 690rpx;
  199. margin: auto;
  200. // height: 606rpx;
  201. background: #FFFFFF;
  202. border-radius: 10rpx;
  203. padding: 30rpx 0 99rpx;
  204. .tit {
  205. font-weight: 500;
  206. font-size: 32rpx;
  207. color: #222222;
  208. }
  209. .tit1 {
  210. padding-top: 45rpx;
  211. }
  212. }
  213. .bd-wrap {
  214. // width: 690rpx;
  215. // height: 100rpx;
  216. padding: 20rpx 0;
  217. background-color: #fff;
  218. border-bottom: 1px solid #AEAEAE;
  219. // line-height: 100rpx;
  220. font-size: 32rpx;
  221. position: relative;
  222. .code {
  223. color: $base-color;
  224. font-size: 23rpx;
  225. border-left: 1px solid #eeeeee;
  226. width: 150rpx;
  227. flex-shrink: 0;
  228. text-align: center;
  229. }
  230. .bg-name {
  231. width: 182rpx;
  232. height: 100%;
  233. flex-shrink: 0;
  234. // padding-left: 20rpx;
  235. }
  236. .bg-val {
  237. // width: 430rpx;
  238. flex-grow: 1;
  239. height: 100%;
  240. .val-ipt {
  241. width: 100%;
  242. height: 100%;
  243. // background-color: #009100;
  244. padding-left: 10rpx;
  245. padding-top: 10rpx;
  246. }
  247. }
  248. }
  249. .btm-btn {
  250. width: 690rpx;
  251. line-height: 80rpx;
  252. background: #333333;
  253. border-radius: 10rpx;
  254. margin: auto;
  255. font-size: 30rpx;
  256. color: #FFFFFF;
  257. text-align: center;
  258. }
  259. .sfz {
  260. width: 300rpx;
  261. height: 210rpx;
  262. display: block;
  263. margin: 35rpx auto;
  264. border-radius: 35rpx;
  265. border: #ececec 1px solid;
  266. }
  267. .tip {
  268. text-align: center;
  269. font-size: 26rpx;
  270. font-weight: 500;
  271. color: #333333;
  272. }
  273. </style>