carList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="car-list">
  3. <view v-for="(item,index) of carList" :key="index" @click="clickItem(item)" class="car-list-card" :class="{ 'car-list-card-i' : car_info.car_sn == item.car_sn}">
  4. <view class="car-name" :class="{ 'car-name-i' : car_info.car_sn == item.car_sn}">{{item.car_name}}</view>
  5. <image v-if="car_info.car_sn == item.car_sn" class="icon" src="/static/resource/images/gyq_ly.png" mode=""></image>
  6. <!-- https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX -->
  7. <image class="img" :src="item.model_images" mode="aspectFit"></image>
  8. <view v-if="car_info.car_sn == item.car_sn" class="select">
  9. <image class="icon1" src="/static/resource/images/gyq_select.png" mode=""></image>
  10. <text>当前选择</text>
  11. </view>
  12. </view>
  13. <view class="options">
  14. <view @click="navCarDetail" class="btn btn-left">{{ $t('租赁设备') }}</view>
  15. <view class="btn btn-right">{{ $t('绑定设备') }}</view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. var config = require('../../common/config.js');
  21. var app = getApp();
  22. var config = require('../../common/config.js');
  23. var common = require('../../common/common.js');
  24. var http = require('../../common/http.js');
  25. var storage = require('../../common/storage.js');
  26. export default {
  27. data() {
  28. return {
  29. carList:[],
  30. car_sn:"",
  31. car_info:{}
  32. };
  33. }
  34. /**
  35. * 生命周期函数--监听页面加载
  36. */
  37. ,
  38. onLoad: function(options) {
  39. this.loadUserCarList()
  40. },
  41. methods: {
  42. navCarDetail(){
  43. // const me=this
  44. // uni.navigateTo({
  45. // url: '/pages/carDetail/carDetail'
  46. // })
  47. },
  48. clickItem(item){
  49. if(item.car_sn == this.car_info.car_sn) return
  50. uni.setStorageSync('car_info',item)
  51. this.car_info = item
  52. },
  53. loadUserCarList(){
  54. this.car_info = uni.getStorageSync('car_info') || {};
  55. const me = this
  56. common.loading()
  57. http.postApi(config.API_FLK_CAR_DEVICE_LIST, {}, (resp) => {
  58. uni.hideLoading();
  59. if (resp.data.code === 200) {
  60. const carList=resp.data.data.list
  61. me.setData({
  62. carList,
  63. })
  64. } else {
  65. common.simpleToast(resp.data.msg);
  66. }
  67. })
  68. },
  69. }
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .car-list{
  74. padding: 24rpx;
  75. }
  76. .car-list-card{
  77. width:100%;
  78. height: 596rpx;
  79. background: linear-gradient( 135deg, #DEE0E8 0%, rgba(255,255,255,0.4) 50%, #F1F3F4 100%);
  80. border-radius: 40rpx;
  81. border: 6rpx solid #FFF;
  82. position: relative;
  83. padding: 30rpx;
  84. .select{
  85. position: absolute;
  86. right: 0;
  87. top: 0;
  88. width: 164rpx;
  89. height: 78rpx;
  90. text-align: center;
  91. .icon1{
  92. width: 164rpx;
  93. height: 78rpx;
  94. position: absolute;
  95. left: 0;
  96. top: 0;
  97. }
  98. text{
  99. position: relative;
  100. z-index: 1;
  101. font-family: PingFangSC, PingFang SC;
  102. font-weight: 600;
  103. font-size: 28rpx;
  104. color: #FFFFFF;
  105. line-height: 28rpx;
  106. margin-top: 10rpx;
  107. display: block;
  108. }
  109. }
  110. .icon{
  111. position: absolute;
  112. width: 48rpx;
  113. height: 48rpx;
  114. left: 30rpx;
  115. top: 120rpx;
  116. }
  117. .img{
  118. width: 520rpx;
  119. height: 400rpx;
  120. display: block;
  121. margin: auto;
  122. margin-top: 40rpx;
  123. }
  124. }
  125. .car-list-card-i{
  126. background: linear-gradient( 135deg, #DEEAFF 0%, rgba(220,244,251,0.4) 50%, #DAFFF6 100%);
  127. }
  128. .car-name{
  129. font-family: PingFangSC, PingFang SC;
  130. font-weight: 600;
  131. font-size: 48rpx;
  132. color: #828DA2;
  133. }
  134. .car-name-i{
  135. color: #060809;
  136. }
  137. .options {
  138. padding: 0 28rpx;
  139. display: flex;
  140. justify-content: space-between;
  141. margin-bottom: 44rpx;
  142. margin-top: 44rpx;
  143. .btn {
  144. width: 336rpx;
  145. height: 98rpx;
  146. border-radius: 50rpx;
  147. border: 4rpx solid #060809;
  148. font-size: 36rpx;
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. }
  153. .btn-left {
  154. color: #060809;
  155. background: rgba(255, 255, 255, 0.6);
  156. margin-right: 22rpx;
  157. }
  158. .btn-right {
  159. color: #fff;
  160. background: #060809;
  161. }
  162. }
  163. </style>