apply.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="box">
  3. <view class="information">
  4. <view class="list">
  5. <view class="lable">姓名</view>
  6. <input class="input" type="text" v-model="list.name" placeholder="请输入您的姓名" />
  7. </view>
  8. <view class="list">
  9. <view class="lable">性别</view>
  10. <picker class="picker" mode="selector" :range="typeList" range-key='name' @change="changeType">
  11. <view>{{typeList[list.gender].name}}</view>
  12. </picker>
  13. <image class="image-next" mode="widthFix" src="@/static/img/jt.png"></image>
  14. </view>
  15. <view class="list">
  16. <view class="lable">身份证号</view>
  17. <input class="input" type="text" v-model="list.idcard" placeholder="请输入您的身份证号" />
  18. </view>
  19. <view class="list">
  20. <view class="lable">岗位职业:</view>
  21. <input class="input" type="text" v-model="list.job" placeholder="请输入您的岗位职业" />
  22. <!-- <image class="image-next" mode="widthFix" src="@/static/img/jt.png"></image> -->
  23. </view>
  24. </view>
  25. <view class="img margin-t-30 padding-v-30 padding-c-30">
  26. <view class="padding-b-30">证件照片(一寸照)</view>
  27. <view class="photo" @click='pic'>
  28. <img :src="list.photo" v-if="list.photo" />
  29. <img src="@/static/img/k.png" v-else>
  30. </view>
  31. </view>
  32. <view class="button" @click="submit">
  33. 提交审核
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. cert,
  40. certApply,
  41. uploads
  42. } from '@/api/certificate.js'
  43. import {
  44. getUserInfo
  45. } from '@/api/login.js'
  46. export default {
  47. data() {
  48. return {
  49. list: {
  50. name: '', //姓名
  51. gender: 0, //性别
  52. idcard: '', //身份照
  53. job: '', //工作
  54. photo: '', //照片
  55. },
  56. typeList: [{
  57. type: 0,
  58. name: '男'
  59. }, {
  60. type: 1,
  61. name: '女'
  62. }],
  63. }
  64. },
  65. onLoad() {
  66. getUserInfo();
  67. },
  68. methods: {
  69. // 修改
  70. changeType(res) {
  71. this.list.gender = res.detail.value;
  72. },
  73. //提交
  74. submit() {
  75. const that = this;
  76. const data = this.list;
  77. if (!data.name) {
  78. uni.showModal({
  79. title: '错误提示',
  80. content: '请输入姓名',
  81. showCancel: false,
  82. });
  83. return
  84. }
  85. if (!data.idcard) {
  86. uni.showModal({
  87. title: '错误提示',
  88. content: '请输入身份证号',
  89. showCancel: false,
  90. });
  91. return
  92. }
  93. if (!data.job) {
  94. uni.showModal({
  95. title: '错误提示',
  96. content: '请输入工作职业',
  97. showCancel: false,
  98. });
  99. return
  100. }
  101. if (!data.photo) {
  102. uni.showModal({
  103. title: '错误提示',
  104. content: '请上传证件照片',
  105. showCancel: false,
  106. });
  107. return
  108. }
  109. uni.showLoading({
  110. title: '提交中',
  111. mask: true
  112. });
  113. certApply(
  114. data
  115. ).then(res => {
  116. console.log(res)
  117. uni.hideLoading()
  118. // 初始化提交
  119. that.list = {
  120. name: '', //姓名
  121. gender: 0, //性别
  122. idcard: '', //身份照
  123. job: '', //工作
  124. photo: '', //照片
  125. };
  126. uni.showModal({
  127. title: '提示',
  128. content: '已提交成功请耐心等待审核通过',
  129. showCancel: false,
  130. });
  131. }).catch(res => {
  132. uni.hideLoading()
  133. console.log(res)
  134. })
  135. },
  136. //图片预览
  137. pic() {
  138. const that = this
  139. uploads().then(
  140. (res) => {
  141. that.list.photo = res[0].url;
  142. }
  143. ).catch((e) => {
  144. console.log(e);
  145. })
  146. },
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. page {
  152. height: 100%;
  153. }
  154. body {
  155. background-color: #f3f3f3;
  156. }
  157. .box {
  158. padding: 30rpx;
  159. }
  160. .information {
  161. background-color: #fff;
  162. border-radius: 20rpx;
  163. font-size: 30rpx;
  164. }
  165. .list {
  166. display: flex;
  167. justify-content: center;
  168. align-items: center;
  169. border-bottom: solid 1rpx #f3f3f3;
  170. padding: 30rpx;
  171. .picker {
  172. flex-grow: 1;
  173. }
  174. .lable {
  175. width: 150rpx;
  176. flex-shrink: 0;
  177. }
  178. .input {
  179. width: calc(100% - 20rpx);
  180. font-size: 28rpx;
  181. }
  182. .image-next {
  183. width: 20rpx;
  184. }
  185. }
  186. .img {
  187. font-size: 30rpx;
  188. background-color: #fff;
  189. border-radius: 20rpx;
  190. img {
  191. width: 160rpx;
  192. }
  193. }
  194. .photo {
  195. width: 160rpx;
  196. height: 160rpx;
  197. }
  198. .button {
  199. position: fixed;
  200. bottom: 0;
  201. left: 0;
  202. width: 100%;
  203. text-align: center;
  204. color: #fff;
  205. background-color:rgba(246, 84, 134, 1);
  206. font-size: 30rpx;
  207. height: 100rpx;
  208. line-height: 100rpx;
  209. }
  210. .pickerAddress {
  211. margin-top: 20rpx;
  212. padding-left: 5rpx;
  213. }
  214. .pickerColor {
  215. color: #808080;
  216. }
  217. </style>