approve.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.loding = false;
  119. console.log(e);
  120. uni.hideLoading();
  121. });
  122. }
  123. }
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .content {
  128. height: 100%;
  129. padding: 0 $page-row-spacing;
  130. }
  131. .add-btn {
  132. display: flex;
  133. align-items: center;
  134. justify-content: center;
  135. width: 690rpx;
  136. height: 80rpx;
  137. margin: 60rpx auto;
  138. font-size: $font-lg;
  139. color: #fff;
  140. background: #ff0000;
  141. border-radius: 10rpx;
  142. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  143. }
  144. .bgimg {
  145. text-align: center;
  146. width: 1200rpx;
  147. margin-left: -260rpx;
  148. height: 400rpx;
  149. background: #ff0000;
  150. border-bottom-right-radius: 999999rpx;
  151. border-bottom-left-radius: 999999rpx;
  152. .img {
  153. width: 400rpx;
  154. margin-top: 50rpx;
  155. }
  156. }
  157. .user {
  158. margin-top: -100rpx !important;
  159. border-radius: 10rpx !important;
  160. padding: 0 30rpx;
  161. }
  162. .userBox,
  163. .user {
  164. box-shadow: 0px 2px 16px 1px rgba(89, 89, 89, 0.24) !important;
  165. background-color: white !important;
  166. }
  167. .userBox {
  168. margin-top: 20rpx;
  169. padding: 30rpx;
  170. .imgUp {
  171. min-height: 100rpx;
  172. text-align: center;
  173. margin-top: 30rpx;
  174. .img {
  175. width: 300rpx;
  176. height: 400rpx;
  177. }
  178. }
  179. }
  180. .imglist /deep/ * {
  181. margin-left: auto !important;
  182. margin-right: auto !important;
  183. }
  184. </style>