apply.vue 5.0 KB

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