index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <!-- 管理车辆 -->
  2. <template>
  3. <view class="content">
  4. <view class="top-title flex flex-space-between">
  5. <view class="left flex">
  6. <view class="text1">我的机动车</view>
  7. <view class="text2">(共{{carList?carList.length:0}}辆)</view>
  8. </view>
  9. <view @click="addCar" class="add-car flex">
  10. <view class="car-text">添加车辆</view>
  11. <u-icon class="icon" name="plus-circle-fill" color="#2979ff" size="24"></u-icon>
  12. </view>
  13. </view>
  14. <view class="car-list" v-for="(item,index) in carList" :key="index">
  15. <view class="left-img">
  16. <image style="width: 125rpx;height:125rpx;box-shadow: 1px 1px 10px #ccc; background-color: #eeeeee;border-radius:10rpx;" mode="aspectFill"
  17. :src="item.addressUrl"></image>
  18. </view>
  19. <view class="car-list-item">
  20. <view class="row1">
  21. {{item.carNumber}}
  22. </view>
  23. <view class="row2">
  24. <u-icon name="edit-pen" size="26" style="margin-right: 20rpx;" @click="edit(item)"
  25. v-if="item.status!='审核中'"></u-icon>
  26. <u-icon name="trash" size="26" @click="del(item,index)"></u-icon>
  27. </view>
  28. <view class="row3">
  29. <view class="text">车辆状态:</view>
  30. <u-tag v-if="item.status=='已通过'" :text="item.status" type="success" plain plainFill size="mini">
  31. </u-tag>
  32. <u-tag v-if="item.status=='未通过'" :text="item.status" type="error" plain plainFill size="mini">
  33. </u-tag>
  34. <u-tag v-if="item.status=='审核中'" :text="item.status" type="warning" plain plainFill size="mini">
  35. </u-tag>
  36. <u-tag v-if="item.drivingOverdueFlag=='1'||item.trailerOverdueFlag=='1'||item.operationOverdueFlag=='1'||item.trailerOperationOverdueFlag=='1'" text="已过期" type="error" plain plainFill size="mini">
  37. </u-tag>
  38. </view>
  39. </view>
  40. </view>
  41. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  42. confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
  43. <u-toast ref="uToast"></u-toast>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapState
  49. } from 'vuex';
  50. var _this;
  51. export default {
  52. data() {
  53. return {
  54. carList: [],
  55. obj: {},
  56. index: null,
  57. isShowAlert: false,
  58. alertTitle: '确认删除该车辆?'
  59. };
  60. },
  61. computed: {
  62. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
  63. },
  64. onLoad(options) {
  65. console.log(this.firstAuthentication.id)
  66. _this = this;
  67. if (!this.hasLogin) {
  68. uni.$u.route('/pages/public/login');
  69. }
  70. this.init();
  71. console.log(options)
  72. },
  73. methods: {
  74. confirmClick() {
  75. this.isShowAlert = false
  76. this.$request.baseRequest('post', '/driverCarInfo/api/deleteDriverCar', {
  77. id: this.obj.id
  78. }).then(res => {
  79. if (res.code == '200') {
  80. this.$refs.uToast.show({
  81. type: 'success',
  82. message: "删除成功!",
  83. })
  84. this.carList.splice(this.index, 1)
  85. uni.hideLoading()
  86. }
  87. })
  88. .catch(res => {
  89. uni.$u.toast(res.message);
  90. });
  91. },
  92. cancelClick() {
  93. this.isShowAlert = false
  94. },
  95. init() {
  96. this.$request.baseRequest('get', '/driverCarInfo/selectDriverCar', {
  97. commonId: this.userInfo.id,
  98. // driverId:this.firstAuthentication.id
  99. }).then(res => {
  100. if (res.code == '200') {
  101. this.carList = res.data
  102. } else {
  103. uni.$u.toast(res.message);
  104. }
  105. })
  106. .catch(res => {
  107. uni.$u.toast(res.message);
  108. });
  109. },
  110. addCar() {
  111. uni.$u.route('/pages/mine/manageVehicles/addVehicle');
  112. },
  113. edit(val) {
  114. uni.$u.route('/pages/mine/manageVehicles/editVehicle', val);
  115. },
  116. del(val, index) {
  117. this.obj = val
  118. this.index = index
  119. this.isShowAlert = true
  120. }
  121. },
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .content {
  126. background: white;
  127. padding: 20rpx;
  128. }
  129. .content1 {
  130. width: 100%;
  131. }
  132. .content1-item {
  133. width: calc(50% - 0rpx);
  134. }
  135. .top-title {
  136. margin: 0 0 20rpx 0;
  137. .left {
  138. .text1 {
  139. font-size: 29rpx;
  140. color: #1F1F1F;
  141. font-weight: 700;
  142. }
  143. .text2 {
  144. font-size: 29rpx;
  145. color: #999999;
  146. }
  147. }
  148. }
  149. .car-text {
  150. margin-right: 6rpx;
  151. }
  152. .add-car {
  153. background: #EEF4FF;
  154. color: #2772FB;
  155. font-weight: 700;
  156. font-size: 26rpx;
  157. align-items: center;
  158. padding: 4rpx 10rpx 4rpx 20rpx;
  159. border-radius: 30rpx;
  160. }
  161. .car-list {
  162. margin-bottom: 20rpx;
  163. display: flex;
  164. }
  165. .car-list-item {
  166. background: url(../../../static/images/mine/bgh.png) center no-repeat;
  167. background-size: 100% 100%;
  168. padding: 60rpx 43rpx;
  169. width: 70%;
  170. .row1 {
  171. font-size: 36rpx;
  172. font-weight: 700;
  173. color: #1F1F1F;
  174. }
  175. .row2 {
  176. display: flex;
  177. justify-content: flex-end;
  178. }
  179. .row3 {
  180. display: flex;
  181. }
  182. }
  183. .left-img {
  184. width: 30%;
  185. display: flex;
  186. align-items: center;
  187. justify-content: center;
  188. }
  189. </style>