index.vue 5.9 KB

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