approve.vue 3.9 KB

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