approve.vue 3.8 KB

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