applyDriving.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <view class="input">
  4. <text>姓名</text>
  5. <input type="text" v-model="info.name" placeholder="请输入姓名" />
  6. </view>
  7. <view class="input">
  8. <text>手机号</text>
  9. <input type="number" v-model="info.mobile" placeholder="请输入手机号" />
  10. </view>
  11. <view class="input">
  12. <text>驾龄</text>
  13. <input type="number" v-model="info.driving_age" placeholder="请输入驾龄(年)" />
  14. </view>
  15. <view class="input">
  16. <text>身份证号</text>
  17. <input type="idcard" v-model="info.card_id" placeholder="请输入身份证" placeholder-class="input-placeholder" />
  18. </view>
  19. <view class="input">
  20. <text>上传身份证照片</text>
  21. <view class="img">
  22. <image v-if="!info.card_image" src="../../static/sfz1.png" @tap="uploadImage('card_image')" mode=""></image>
  23. <image v-if="info.card_image" :src="host + info.card_image" @tap="uploadImage('card_image')" mode=""></image>
  24. <image v-if="!info.card_back_image" src="../../static/sfz2.png" @tap="uploadImage('card_back_image')" mode=""></image>
  25. <image v-if="info.card_back_image" :src="host + info.card_back_image" @tap="uploadImage('card_back_image')" mode=""></image>
  26. </view>
  27. </view>
  28. <view class="input">
  29. <text>驾驶照</text>
  30. <view class="img">
  31. <image v-if="!info.driver_image" src="../../static/jsz.png" @tap="uploadImage('driver_image')" mode=""></image>
  32. <image v-if="info.driver_image" :src="host + info.driver_image" mode="" @tap="uploadImage('driver_image')"></image>
  33. </view>
  34. </view>
  35. <view class="input" style="border: none;">
  36. <text>个人照片</text>
  37. <view class="img">
  38. <image v-if="!info.image" src="../../static/zp.png" @tap="uploadImage('image')" mode=""></image>
  39. <image v-if="info.image" :src="host + info.image" mode="" @tap="uploadImage('image')"></image>
  40. </view>
  41. </view>
  42. <button class="button" v-if="!info.id" type="primary" @tap="post">立即申请</button>
  43. <view v-if="info.status == '0'" class="desc">审核中</view>
  44. <view v-if="info.status == '-1'" class="desc">审核未通过,请修改信息后重新提交{{ info.remark ? '。审核备注:' + info.remark : '' }}</view>
  45. <button class="button" v-if="info.status == '-1'" type="primary" @tap="post">重新提交</button>
  46. </view>
  47. </template>
  48. <script>
  49. import helper from '../../common/helper.js';
  50. import api from '../../common/api.js';
  51. export default {
  52. data() {
  53. return {
  54. host: helper.host,
  55. info: {
  56. card_image: '',
  57. card_back_image: '',
  58. driver_image: '',
  59. image:''
  60. }
  61. };
  62. },
  63. onLoad() {
  64. this.getInfo();
  65. },
  66. methods: {
  67. async getInfo() {
  68. let res = await api.getApplyInfo();
  69. if (res.data && res.data.id) {
  70. this.info = res.data;
  71. }
  72. },
  73. async post() {
  74. if (!this.info.name) {
  75. helper.toast('请输入姓名');
  76. return false;
  77. }
  78. if (!this.info.card_id) {
  79. helper.toast('请输入身份证号');
  80. return false;
  81. }
  82. if (!this.info.card_image) {
  83. helper.toast('请上传身份证正面照片');
  84. return false;
  85. }
  86. if (!this.info.card_back_image) {
  87. helper.toast('请上传身份证背面照片');
  88. return false;
  89. }
  90. if (!this.info.driver_image) {
  91. helper.toast('请上传驾驶证');
  92. return false;
  93. }
  94. let res = await api.addApply(this.info);
  95. if (res.code == 1) {
  96. uni.showModal({
  97. title: '提示',
  98. content: res.msg,
  99. success: res => {
  100. if (res.confirm) {
  101. uni.navigateBack({
  102. url: '/pages/mine/mine'
  103. });
  104. }
  105. }
  106. });
  107. } else {
  108. helper.toast(res.msg);
  109. }
  110. },
  111. removeImage(key) {
  112. this.info[key] = '';
  113. },
  114. uploadImage(key) {
  115. uni.chooseImage({
  116. success: async chooseImageRes => {
  117. let res = await api.upload(chooseImageRes.tempFilePaths[0]);
  118. if (res.code != 1) {
  119. helper.toast(res.msg);
  120. return false;
  121. }
  122. this.info[key] = res.data.url
  123. helper.toast(res.msg);
  124. }
  125. });
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss">
  131. .desc {
  132. text-align: center;
  133. font-size: 26upx;
  134. color: #dd524d;
  135. margin-top: 20upx;
  136. padding: 20upx 5%;
  137. }
  138. .input {
  139. display: flex;
  140. align-items: center;
  141. flex-wrap: wrap;
  142. padding: 20upx 5%;
  143. border-bottom: 1px solid #eeeeee;
  144. text {
  145. width: 30%;
  146. font-size: 28upx;
  147. font-weight: 800;
  148. }
  149. input {
  150. width: 70%;
  151. font-size: 28upx;
  152. }
  153. .input-placeholder {
  154. font-size: 28upx;
  155. }
  156. .img {
  157. width: 100%;
  158. margin: 40upx 0 30upx 0;
  159. display: flex;
  160. image {
  161. width: 48%;
  162. height: 166upx;
  163. margin-right: 4%;
  164. }
  165. }
  166. }
  167. .button {
  168. border-radius: 0px;
  169. background-color: #32c45e;
  170. font-size: 28upx;
  171. width: 90%;
  172. }
  173. </style>