江西小程序管理端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
3.5 KiB

1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我的车辆"></topNavbar>
  4. <view class="pad">
  5. <view class="searcBox">
  6. <searchRow placeholder="搜索车牌号" @searchFn="searchFn" ref="searchRef"></searchRow>
  7. </view>
  8. <view class="card" style="margin-bottom: 24rpx;" v-if="identity== '实操教练'">
  9. <view class="add">
  10. <view class="lab">绑定车辆</view>
  11. <view class="btnBg" @click="$goPage('/pages/userCenter/myCar/notBound/notBound')">立即绑定</view>
  12. </view>
  13. </view>
  14. <view class="ul">
  15. <view class="card" v-for="(item,index) in list" :key="index">
  16. <unbind v-if="identity== '实操教练'" @cancelBind="cancelBind(item)">
  17. <view class="li" >
  18. <view class="plate">{{item.licnum}}</view>
  19. <view class="name">{{item.manufacturer}}</view>
  20. </view>
  21. </unbind>
  22. <view class="li" v-else>
  23. <view class="plate">{{item.licnum}}</view>
  24. <view class="name">{{item.manufacturer}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view style="padding-bottom: 20rpx;" v-if="list.length>4">
  30. <u-loadmore :status="status" />
  31. </view>
  32. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  33. </view>
  34. </template>
  35. <script>
  36. import { carPage, coachUnbinding, siteCarPage } from '@/config/api.js'
  37. import unbind from './comp/unbind.vue'
  38. export default {
  39. components: {
  40. unbind
  41. },
  42. data() {
  43. return {
  44. list: [],
  45. params: {
  46. pageNo: 1,
  47. pageSize: 20
  48. },
  49. total: 20,
  50. status: 'loading'
  51. }
  52. },
  53. onLoad() {
  54. this.params.schoolId = this.vuex_schoolId
  55. if(this.identity== '实操教练') {
  56. this.params.coachId = this.vuex_coachId
  57. }
  58. },
  59. onShow() {
  60. if(this.params.licnum) this.$refs.searchRef.keyword = ''
  61. this.params.licnum = ''
  62. this.listInit()
  63. },
  64. onPullDownRefresh() {
  65. this.listInit().then(()=>{uni.stopPullDownRefresh()})
  66. },
  67. onReachBottom() {
  68. if(this.total>this.list.length) {
  69. this.carPageFn()
  70. }
  71. },
  72. methods: {
  73. async listInit() {
  74. this.list = []
  75. this.params.pageNo = 1
  76. await this.carPageFn()
  77. },
  78. async carPageFn() {
  79. if(this.identity=='考场模拟教练') {
  80. var {data: res} = await siteCarPage(this.params)
  81. }else {
  82. var {data: res} = await carPage(this.params)
  83. }
  84. this.params.pageNo ++
  85. this.list.push(...res.list)
  86. this.total = res.total
  87. if(this.list.length>=this.total) this.status = 'nomore'
  88. console.log(res)
  89. },
  90. searchFn(val) {
  91. console.log(val)
  92. this.params.licnum = val
  93. this.list = []
  94. this.params.pageNo = 1
  95. this.carPageFn()
  96. },
  97. // 取消绑定
  98. async cancelBind(item) {
  99. let obj = {
  100. "carId": item.id,
  101. "coachId": this.vuex_coachId,
  102. "coachName": this.vuex_userInfo.user.nickname
  103. }
  104. const res = await coachUnbinding(obj)
  105. if(res.code==0) {
  106. this.$u.toast('解绑成功')
  107. this.listInit()
  108. }
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .searcBox {
  115. padding: 24rpx 0;
  116. }
  117. .card {
  118. margin-bottom: 20rpx;
  119. overflow: hidden;
  120. height: 100rpx;
  121. .add {
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. height: 108rpx;
  126. padding: 0 40rpx;
  127. .lab {
  128. font-size: 32rpx;
  129. color: #333;
  130. font-weight: 500;
  131. }
  132. .btnBg {
  133. width: 192rpx;
  134. }
  135. }
  136. .li {
  137. height: 100rpx;
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. padding: 0 24rpx;
  142. .plate {
  143. color: $themC;
  144. font-weight: 500;
  145. }
  146. .name {
  147. color: #686B73;
  148. }
  149. }
  150. }
  151. </style>