index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="chooseCar">
  3. <radio-group @change="radioChange">
  4. <view class="body" v-for="(item, index) in carList" :key="index" @tap="goBack(item)">
  5. <view style="display: flex;align-items: center;">
  6. <image :src="baseImagePath+item.brandLogo" alt="">
  7. <view class="carView">
  8. <view class="carBodyHead">
  9. <image class="carImg" :src="require('../../../static/car.png')">
  10. <span>{{item.carNumber}}</span>
  11. <view class="vehicleBorder"></view><span>{{item.carMadelLevel}}</span>
  12. </view>
  13. <view class="classBodyContent">
  14. {{item.brandName}} {{item.carSeriesName}}
  15. </view>
  16. </view>
  17. </view>
  18. <view class="radio">
  19. <radio style="line-height: 66rpx;" color="#FF5C00" :value="index" :checked="id==item.id" />
  20. </view>
  21. </view>
  22. </radio-group>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. getUserCarPage
  28. } from "@/api/shop.js";
  29. export default {
  30. components: {},
  31. data: function() {
  32. return {
  33. baseImagePath: this.baseImagePath,
  34. id: "",
  35. carList: [],
  36. pageSize: 20,
  37. pageNo: 1
  38. }
  39. },
  40. onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数
  41. this.id = option.id
  42. this.getPage()
  43. },
  44. onReachBottom() {
  45. this.getPage()
  46. },
  47. methods: {
  48. getPage(){
  49. let _this = this;
  50. getUserCarPage({
  51. pageSize: _this.pageSize,
  52. pageNo: _this.pageNo,
  53. }).then((res) => {
  54. console.log(res,'选择');
  55. _this.carList = _this.carList.concat(res.data.rows)
  56. _this.pageNo++
  57. })
  58. },
  59. radioChange(e) {
  60. },
  61. goBack(datas) {
  62. uni.$emit('chooseCar', datas)
  63. uni.setStorageSync('chooseCar',datas)
  64. uni.navigateBack({
  65. delta: 1
  66. })
  67. },
  68. }
  69. }
  70. </script>
  71. <style lang="less">
  72. page {
  73. background: #F5F5F5;
  74. }
  75. .body {
  76. background: #FFFFFF;
  77. border-radius: 10rpx;
  78. margin: 20rpx;
  79. display: flex;
  80. align-items: center;
  81. justify-content: space-between;
  82. padding: 33rpx 24rpx 33rpx 26rpx;
  83. image {
  84. width: 120rpx;
  85. height: 120rpx;
  86. background: #FFFFFF;
  87. border: 2px solid #F4F4F4;
  88. border-radius: 8rpx;
  89. }
  90. .carView {
  91. padding-left: 29rpx;
  92. padding-top: 8rpx;
  93. .carBodyHead {
  94. display: flex;
  95. .carImg {
  96. width: 33rpx;
  97. height: 27rpx;
  98. }
  99. .vehicleBorder {
  100. width: 1px;
  101. height: 20rpx;
  102. background: #DBDBDB;
  103. }
  104. span {
  105. font-size: 30rpx;
  106. font-family: PingFang SC;
  107. font-weight: bold;
  108. color: #333333;
  109. line-height: 31rpx;
  110. padding: 0 15rpx 0 15rpx;
  111. }
  112. }
  113. .classBodyContent {
  114. font-size: 26rpx;
  115. font-family: PingFang SC;
  116. font-weight: 500;
  117. color: #666666;
  118. line-height: 34rpx;
  119. padding: 20rpx 45rpx 8rpx 0;
  120. }
  121. }
  122. }
  123. </style>