合同小程序前端代码仓库
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.

152 lines
3.0 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <view class="container">
  3. <view class="header_info">
  4. <view class="header_info_left" @click="getBack">
  5. <uni-icons type="left" size="30" >
  6. </uni-icons>
  7. </view>
  8. <text class="header_info_right">
  9. 选择品牌
  10. </text>
  11. </view>
  12. <view class="containers">
  13. <scroll-view scroll-y="true" class="scroll-view" :scroll-into-view="currentIndex">
  14. <view v-for="(item, index) in indexList" :key="index" :id="item.letter">
  15. <view class="index-letter">{{ item.letter }}</view>
  16. <view v-for="(car, i) in item.cars" :key="i" class="car-item" @click="getID(car.id,car.name)">
  17. {{ car.name }}
  18. </view>
  19. </view>
  20. </scroll-view>
  21. <view class="index-bar">
  22. <view :class="['test',letter == item.letter ?'test1':'']" v-for="(item, index) in indexList" :key="index" @tap="scrollToIndex(item.letter)">
  23. {{ item.letter }}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {getList,childList} from "@/api.uts"
  31. import transformBrands from '@/js/airport.uts'
  32. export default {
  33. data() {
  34. return {
  35. currentIndex: '',
  36. letter:"",
  37. clientInfo:{},
  38. indexList: [],
  39. certFront:'',
  40. carPic:'',
  41. certBack:'',
  42. };
  43. },
  44. onLoad(options) {
  45. this.clientInfo = JSON.parse(decodeURIComponent(options.clientInfo));
  46. console.log(this.clientInfo.appOrderCarList[0].carSeries);
  47. },
  48. mounted() {
  49. getList().then((res)=>{
  50. let list = transformBrands(res.result)
  51. this.indexList = list;
  52. })
  53. },
  54. methods: {
  55. scrollToIndex(letter) {
  56. this.letter = letter
  57. this.currentIndex = letter;
  58. },
  59. getID(id,name){
  60. console.log(id);
  61. this.clientInfo.appOrderCarList[0].carSeries = name;
  62. // console.log('1',this.clientInfo.appOrderCarList[0].carSeries );
  63. // console.log(res.result);
  64. getApp().pid = id;
  65. uni.redirectTo(
  66. {url:'/pages/views/carTwo?clientInfo='+ encodeURIComponent(JSON.stringify(this.clientInfo))
  67. }
  68. )
  69. },
  70. getBack(){
  71. console.log(1)
  72. uni.navigateBack(
  73. {delta:1}
  74. )
  75. }
  76. }
  77. };
  78. </script>
  79. <style>
  80. .containers {
  81. display: flex;
  82. flex-direction: row;
  83. height: 90%;
  84. }
  85. .header_info{
  86. height:10%;
  87. width: 100%;
  88. background-color: #f8f8f8;
  89. display: flex;
  90. flex-direction: row;
  91. }
  92. .header_info_right{
  93. width: 100%;
  94. color: #101010;
  95. display: flex;
  96. margin-left: 35%;
  97. /* justify-content: center; */
  98. }
  99. .scroll-view {
  100. flex: 1;
  101. height: 100%;
  102. /* margin-top: 10%; */
  103. background-color: #ffffff;
  104. }
  105. .index-bar {
  106. width: 1rem;
  107. height: 90%;
  108. margin-top: 15%;
  109. display: flex;
  110. flex-direction: column;
  111. justify-content: space-around;
  112. /* background-color: #f0f0f0; */
  113. background: transparent;
  114. }
  115. .test{
  116. width: 100%;
  117. margin: 0.2rem 0.2rem 0.2rem 0;
  118. font-size: 0.7rem;
  119. color: #b1b1b1;
  120. display: flex;
  121. justify-content: center;
  122. align-items: center;
  123. }
  124. .test1{
  125. background-color: #047af9;
  126. border-radius: 50%;
  127. }
  128. .index-letter {
  129. font-size: 1rem;
  130. font-weight: bold;
  131. padding: 10px;
  132. background-color: #f0f0f0;
  133. }
  134. .car-item {
  135. padding: 10px;
  136. border-bottom: 0.01rem solid #e0e0e0;
  137. font-size: 0.8rem;
  138. }
  139. </style>