index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <ujp-navbar title="车辆管理页面"></ujp-navbar>
  4. <view v-if="false">
  5. <view class="carNone" v-if="carList.length == 0">
  6. <img src="@/assets/static/img/none2.svg" alt="">
  7. <p class="oldTextjp2" oldstyle="font-size: 18px;">暂无绑定车辆</p>
  8. <view class="carNone-btn" @click="addCar">
  9. 添加车牌
  10. </view>
  11. </view>
  12. <view class="car" v-else>
  13. <view class="car-item" v-for="(item,index) in carList" :key="item.id" @click="toCarAdd(item)">
  14. <span v-if="item.defaultFlag">默认</span>
  15. <font>{{item.carNum}}</font>
  16. </view>
  17. <view class="car-btn oldTextjp2" oldstyle="font-size: 18px;" @click="addCar">添加车牌</view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import * as userApi from '@/apis/user.js'
  24. export default {
  25. data() {
  26. return {
  27. carList: [],
  28. jpcode:"",
  29. }
  30. },
  31. onShow() {
  32. this.getCarList();
  33. },
  34. onLoad(op) {
  35. if(op.jpcode){
  36. this.jpcode=op.jpcode
  37. }
  38. },
  39. methods: {
  40. toCarAdd(item) {
  41. var url='/pages/user/car/carAdd?id=' + item.id;
  42. if(this.jpcode){
  43. url+="&jpcode="+this.jpcode
  44. }
  45. uni.navigateTo({
  46. url: url
  47. })
  48. },
  49. getCarList() {
  50. uni.showLoading({
  51. title: "加载中",
  52. mask: true,
  53. })
  54. userApi.regUserCarList().then((res) => {
  55. uni.hideLoading();
  56. this.carList = res.data;
  57. }).catch(error => {
  58. uni.showToast({
  59. title: error,
  60. icon: "none"
  61. })
  62. })
  63. },
  64. addCar() {
  65. var url='/pages/user/car/carDet' ;
  66. if(this.jpcode){
  67. url+="?jpcode="+this.jpcode
  68. }
  69. uni.navigateTo({
  70. url: url
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style>
  77. page{
  78. background: #fff;
  79. }
  80. </style>
  81. <style lang="scss" scoped>
  82. .carNone{
  83. display: flex;
  84. flex-direction: column;
  85. justify-content: center;
  86. height: calc(100vh - 44px);
  87. align-items: center;
  88. img{
  89. width: 256px;
  90. height: 256px;
  91. }
  92. p{
  93. margin-top: -60px;
  94. }
  95. .carNone-btn{
  96. font-size: 16px;
  97. color:#00B962;
  98. border: 1px solid #00B962;
  99. padding: 10px 70px;
  100. border-radius: 20px;
  101. margin-top: 48px;
  102. }
  103. }
  104. .car{
  105. padding: 24px;
  106. .car-item{
  107. margin: 10px;
  108. background-color: #00B962;
  109. height: 80px;
  110. border-radius: 8px;
  111. position: relative;
  112. text-align: center;
  113. font{
  114. color:#fff;
  115. font-size: 36px;
  116. line-height:80px;
  117. }
  118. span{
  119. position: absolute;
  120. height: 24px;
  121. width: 48px;
  122. background-color: #008A4B ;
  123. color:#fff;
  124. right: 0;
  125. top: 0;
  126. text-align: center;
  127. line-height: 24px;
  128. border-radius: 0 8px 0 8px;
  129. }
  130. }
  131. .car-btn{
  132. margin:12px 10px 0;
  133. font-size: 16px;
  134. color:#00B962;
  135. border: 1px solid #00B962;
  136. border-radius: 21px;
  137. padding: 10px 0;
  138. text-align: center;
  139. }
  140. }
  141. </style>