approve.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="content">
  3. <view class="bgimg"><image class="img" src="https://zhibo.liuniu946.com/img/bgRz.png" mode="widthFix"></image></view>
  4. <!-- <image src="../../static/img/renzheng.png" mode=""></image> -->
  5. <u-form class="user" :model="form" ref="uForm">
  6. <u-form-item label="姓名" label-width="150"><u-input v-model="form.name" placeholder="请输入真实姓名" /></u-form-item>
  7. <u-form-item label="身份证号" label-width="150"><u-input placeholder="请输入身份证号" v-model="form.card" /></u-form-item>
  8. </u-form>
  9. <view class="userBox">
  10. <view class="title">上传身份证照片</view>
  11. <view class="imgUp" @click.stop="upImg()"><image class="img" :src="form.img || '../../static/img/sfz.png'" mode="scaleToFill"></image></view>
  12. </view>
  13. <button class="add-btn" @click="pushData('add')">提交</button>
  14. </view>
  15. </template>
  16. <script>
  17. import { realName } from '@/api/set.js';
  18. import { upload } from '@/api/order.js';
  19. export default {
  20. data() {
  21. return {
  22. loding: false, //判断是否在点击中
  23. form: {
  24. name: '',
  25. card: '',
  26. img: ''
  27. },
  28. upFileLoding:false,
  29. };
  30. },
  31. onLoad(option) {},
  32. methods: {
  33. upImg(e) {
  34. const that = this;
  35. if(that.upFileLoding){
  36. return
  37. }
  38. that.upFileLoding = true;
  39. setTimeout(()=>{
  40. that.upFileLoding = false;
  41. },1000);
  42. upload({
  43. filename: ''
  44. }).then(data => {
  45. this.form.img = data[0].url;
  46. }).catch((err)=>{
  47. console.log(err);
  48. })
  49. },
  50. ToIndex() {
  51. let obj = this;
  52. let ur = uni.getStorageSync('present') || '/pages/index/index';
  53. // 用于处理缓存bug
  54. if (ur == 'pages/product/product') {
  55. ur = '/pages/index/index';
  56. }
  57. uni.switchTab({
  58. url: ur,
  59. fail(e) {
  60. uni.navigateTo({
  61. url: ur,
  62. fail(e) {
  63. uni.navigateTo({
  64. url: '/pages/index/index'
  65. });
  66. }
  67. });
  68. }
  69. });
  70. },
  71. pushData() {
  72. const da = this.form;
  73. if (this.loding) {
  74. return;
  75. }
  76. if (!da.name) {
  77. uni.showModal({
  78. title: '提示',
  79. content: '请填写真实姓名',
  80. showCancel: false
  81. });
  82. return;
  83. }
  84. if (!da.card) {
  85. uni.showModal({
  86. title: '提示',
  87. content: '请填写身份证',
  88. showCancel: false
  89. });
  90. return;
  91. }
  92. if (!da.img) {
  93. uni.showModal({
  94. title: '提示',
  95. content: '请选择图片',
  96. showCancel: false
  97. });
  98. return;
  99. }
  100. const data = {
  101. cidimg: da.img,
  102. rname: da.name,
  103. cid: da.card
  104. };
  105. uni.showLoading({
  106. title: '审核中',
  107. mask: true
  108. });
  109. this.loding = true;
  110. // 上传
  111. realName(data)
  112. .then(e => {
  113. uni.showModal({
  114. title: '提示',
  115. content: '实名提交成功',
  116. showCancel: false,
  117. success: res => {
  118. uni.switchTab({
  119. url: '/pages/index/index'
  120. });
  121. }
  122. });
  123. uni.hideLoading();
  124. this.loding = false;
  125. console.log(e);
  126. })
  127. .catch(e => {
  128. this.loding = false;
  129. console.log(e);
  130. uni.hideLoading();
  131. });
  132. }
  133. }
  134. };
  135. </script>
  136. <style lang="scss" scoped>
  137. .content {
  138. height: 100%;
  139. padding: 0 $page-row-spacing;
  140. }
  141. .add-btn {
  142. display: flex;
  143. align-items: center;
  144. justify-content: center;
  145. width: 690rpx;
  146. height: 80rpx;
  147. margin: 60rpx auto;
  148. font-size: $font-lg;
  149. color: #fff;
  150. background: #ff0000;
  151. border-radius: 10rpx;
  152. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  153. }
  154. .bgimg {
  155. text-align: center;
  156. width: 1200rpx;
  157. margin-left: -260rpx;
  158. height: 400rpx;
  159. background: #ff0000;
  160. border-bottom-right-radius: 999999rpx;
  161. border-bottom-left-radius: 999999rpx;
  162. .img {
  163. width: 400rpx;
  164. margin-top: 50rpx;
  165. }
  166. }
  167. .user {
  168. margin-top: -100rpx !important;
  169. border-radius: 10rpx !important;
  170. padding: 0 30rpx;
  171. }
  172. .userBox,
  173. .user {
  174. box-shadow: 0px 2px 16px 1px rgba(89, 89, 89, 0.24) !important;
  175. background-color: white !important;
  176. }
  177. .userBox {
  178. margin-top: 20rpx;
  179. padding: 30rpx;
  180. .imgUp {
  181. min-height: 100rpx;
  182. text-align: center;
  183. margin-top: 30rpx;
  184. .img {
  185. width: 300rpx;
  186. height: 400rpx;
  187. }
  188. }
  189. }
  190. .imglist /deep/ * {
  191. margin-left: auto !important;
  192. margin-right: auto !important;
  193. }
  194. </style>