authrz.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <view class="" style="padding: 50rpx 30rpx;font-size: 50rpx;">
  5. 實名認證
  6. </view>
  7. <view class=""
  8. style="width: 720rpx;height: 80rpx;background-color: #fff;margin: auto;line-height: 80rpx;padding:0 10rpx;border-radius: 20rpx;font-size: 26rpx;">
  9. 完成實名認證後能夠獲得相應的權益
  10. </view>
  11. <view class=""
  12. style="width: 720rpx;height: 80rpx;background-color: #fff;margin: auto;line-height: 80rpx;padding:0 10rpx;border-radius: 20rpx;font-size: 26rpx;">
  13. 高級實名
  14. </view>
  15. </view>
  16. <view class="up-wrap">
  17. <view class="up-tit">
  18. 姓名
  19. </view>
  20. <input type="text" v-model="nickname" placeholder="請輸入姓名" class="cardinp">
  21. <view class="up-tit">
  22. 身份證號碼
  23. </view>
  24. <input type="text" v-model="card" placeholder="請輸入身份證號碼" class="cardinp">
  25. <view class="up-tit">
  26. 上傳身份證正面
  27. </view>
  28. <view class="up-img" @click="upcardzm()">
  29. <image :src="cardzmt" mode="heightFix" v-if="cardzmt"></image>
  30. <image src="../../static/img/flower.png" mode="heightFix" v-else></image>
  31. </view>
  32. <view class="up-tit">
  33. 上傳身份證背面
  34. </view>
  35. <view class="up-img" @click="upcardfm()">
  36. <image :src="cardfmt" mode="heightFix" v-if="cardfmt"></image>
  37. <image src="../../static/img/flower.png" mode="heightFix" v-else></image>
  38. </view>
  39. </view>
  40. <view class="up-btn" @click="upauthrz()">
  41. 高級提交
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import { mapState, mapMutations } from 'vuex';
  47. import {
  48. upauthrz,
  49. upimg,
  50. getUser
  51. } from '@/api/login.js'
  52. import { upload } from '@/api/wallet.js'
  53. export default {
  54. data() {
  55. return {
  56. nickname: '',
  57. card: '',
  58. cardzm: '',
  59. cardzmt: '',
  60. cardfm: '',
  61. cardfmt: '',
  62. }
  63. },
  64. onLoad() {
  65. this.getUser()
  66. },
  67. onShow() {
  68. },
  69. onReachBottom() {
  70. },
  71. onReady() {
  72. },
  73. methods: {
  74. ...mapMutations('user',['setUserInfo']),
  75. getUser() {
  76. let obj = this
  77. getUser().then(res => {
  78. console.log(res)
  79. let data = res.data
  80. this.setUserInfo(res.data)
  81. if(res.data.name) {
  82. obj.nickname = data.name
  83. obj.cardzm = data.cardzm
  84. obj.cardzmt = data.http + data.cardzm
  85. obj.cardfm = data.cardfm
  86. obj.cardfmt = data.http + data.cardfm
  87. obj.card = data.zhengjian
  88. }
  89. })
  90. },
  91. upcardzm() {
  92. upload({
  93. filename: ''
  94. }).then(data => {
  95. console.log('data', data);
  96. this.cardzm = data[0].img;
  97. this.cardzmt = data[0].src;
  98. });
  99. },
  100. upcardfm() {
  101. upload({
  102. filename: ''
  103. }).then(data => {
  104. console.log('data', data);
  105. this.cardfm = data[0].img;
  106. this.cardfmt = data[0].src;
  107. });
  108. },
  109. upauthrz() {
  110. let obj = this
  111. if(obj.nickname == '') {
  112. return obj.$api.msg('請輸入姓名')
  113. }
  114. if(obj.card == '') {
  115. return obj.$api.msg('請輸入身份證')
  116. }
  117. if(obj.cardzm == '') {
  118. return obj.$api.msg('請上傳身份證正面')
  119. }
  120. if(obj.cardfm == '') {
  121. return obj.$api.msg('請上傳身份證反面')
  122. }
  123. upauthrz({
  124. cardzm: obj.cardzm,
  125. cardfm: obj.cardfm,
  126. nickname: obj.nickname,
  127. card: obj.card
  128. }).then(res => {
  129. uni.showToast({
  130. title: '提交成功',
  131. duration: 2000,
  132. position: 'top'
  133. });
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss">
  140. .up-wrap {
  141. width: 720rpx;
  142. // height: 860rpx;
  143. border-radius: 20rpx;
  144. background-color: #fff;
  145. margin: 30rpx auto;
  146. padding: 20rpx;
  147. font-size: 32rpx;
  148. .up-tit {
  149. height: 80rpx;
  150. line-height: 80rpx;
  151. }
  152. .up-img {
  153. height: 240rpx;
  154. margin-top: 20rpx ;
  155. image {
  156. height: 200rpx;
  157. display: block;
  158. margin: auto;
  159. }
  160. }
  161. }
  162. .cardinp {
  163. display: inline-block;
  164. width: 100%;
  165. height: 80rpx;
  166. line-height: 80rpx;
  167. background-color: #f5f5f5;
  168. border-radius: 20rpx;
  169. padding-left: 20rpx;
  170. }
  171. .up-btn {
  172. margin: 20rpx auto 0;
  173. width: 680rpx;
  174. height: 80rpx;
  175. line-height: 80rpx;
  176. text-align: center;
  177. color: #000;
  178. font-size: 28rpx;
  179. background:linear-gradient(to left,#eeb80d,#ffe35b);
  180. border-radius: 20rpx;
  181. }
  182. </style>