approve.vue 3.7 KB

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