SelectCarTwo.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="box">
  3. <!-- 自定义导航 -->
  4. <view class="zdyNavBox">
  5. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  6. <view class="zdyNav">
  7. <div @click="goback" class="uni-page-head-btn"><i class="uni-btn-icon"
  8. style="color: rgb(0, 0, 0); font-size: 27px;"></i></div>
  9. <view class="zdyNavTitle">车型</view>
  10. <view class="zdyNavRight" @click="goOemSearch">OEM搜索</view>
  11. </view>
  12. </view>
  13. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  14. <view style="height: 44px;"></view>
  15. <view class="top">{{title}}</view>
  16. <!-- 车型 -->
  17. <view v-if="carModelShow" class="cangBox">
  18. <view v-for="(item,index) in xingList" :key="index">
  19. <view class="cangTitle">{{item.fct_name}}</view>
  20. <view @click="goNext(item2)" class="xingBox" v-for="(item2,index) in item.models" :key="index">
  21. <view class="xing">{{item2.model_name}}</view>
  22. <image src="../../static/img/rightArrow.png" mode="" style="width: 12rpx; height: 20rpx"></image>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 配置 -->
  27. <view v-if="peizhiShow" class="cangBox">
  28. <view @click="goNext2(item)" class="xingBox" v-for="(item,index) in peizhiList">
  29. <view class="xing">{{item.combine_cp}}</view>
  30. <image src="../../static/img/rightArrow.png" mode="" style="width: 12rpx; height: 20rpx"></image>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. epc_id: '',
  40. brand_name:'',
  41. title: '',
  42. iStatusBarHeight: '',
  43. access_time: '',
  44. token:'',
  45. param:'',
  46. carModelShow:false,
  47. peizhiShow:false,
  48. xingList: [],
  49. peizhiList:[],
  50. }
  51. },
  52. onLoad(opt) {
  53. console.log('opt', opt);
  54. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  55. this.epc_id = opt.epc_id;
  56. this.brand_name = opt.brand_name;
  57. this.title = opt.brand_name;
  58. this.getItemData();
  59. },
  60. methods: {
  61. goNext(item) {
  62. if (item.next_restrain == 1) {
  63. this.token = item.token;
  64. this.param = item.param;
  65. this.title += ' > ' + item.model_name;
  66. this.getYueSuData(item)
  67. }
  68. },
  69. goNext2(item) {
  70. if (item.next_restrain == 1) {
  71. this.token = item.token;
  72. this.param = item.param;
  73. this.title += ' > ' + item.year;
  74. this.getYueSuData(item)
  75. }
  76. },
  77. //获取车型约束列表
  78. getYueSuData(item) {
  79. uni.showLoading({
  80. title: '加载中'
  81. });
  82. this.$http('advancedEpc/getRestrain', {
  83. epc_id: this.epc_id,
  84. token: this.token,
  85. param: this.param,
  86. access_time: this.access_time,
  87. }, 'GET').then(res => {
  88. uni.hideLoading();
  89. this.carModelShow = false;
  90. this.peizhiShow = true;
  91. this.peizhiList = res.data.result.list;
  92. this.access_time = res.data.result.access_time;
  93. });
  94. },
  95. //获取车型
  96. getItemData() {
  97. uni.showLoading({
  98. title: '加载中'
  99. });
  100. this.$http('advancedEpc/getModel', {
  101. epc_id: this.epc_id,
  102. }, 'GET').then(res => {
  103. uni.hideLoading();
  104. this.xingList = res.data.result.list;
  105. this.access_time = res.data.result.access_time;
  106. this.carModelShow = true;
  107. this.token = res.data.result.list[0].models[0].token;
  108. this.param = res.data.result.list[0].models[0].param;
  109. });
  110. },
  111. goVinDetail() {
  112. uni.navigateTo({
  113. url: 'VinDetail'
  114. })
  115. },
  116. goOemSearch() {
  117. uni.navigateTo({
  118. url: 'OemSearch?brand=' + this.brand_name + '&epc_id=' + this.epc_id + '&param=' + this.param +
  119. '&token=' + this.token + '&access_time=' + this.access_time
  120. })
  121. },
  122. goback() {
  123. console.log('返回');
  124. uni.navigateBack({})
  125. },
  126. }
  127. }
  128. </script>
  129. <style>
  130. .box {
  131. min-height: 100vh;
  132. background: #ffffff;
  133. padding-bottom: constant(safe-area-inset-bottom);
  134. padding-bottom: env(safe-area-inset-bottom);
  135. }
  136. .zdyNavBox {
  137. width: 100vw;
  138. background: #FFFFFF;
  139. position: fixed;
  140. top: 0;
  141. left: 0;
  142. z-index: 9999999;
  143. }
  144. .zdyNav {
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: center;
  148. padding: 14rpx 6rpx;
  149. }
  150. .zdyNavTitle {
  151. background: #FFFFFF;
  152. text-align: center;
  153. font-size: 32rpx;
  154. font-weight: bold;
  155. }
  156. .zdyNavRight {
  157. background: #FFFFFF;
  158. text-align: center;
  159. font-size: 28rpx;
  160. color: #3F90F7;
  161. width: 120rpx;
  162. }
  163. .top {
  164. color: #FFFFFF;
  165. font-size: 28rpx;
  166. padding: 24rpx;
  167. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  168. }
  169. .cangBox {
  170. background: #FFFFFF;
  171. }
  172. .cangTitle {
  173. padding: 10rpx 24rpx;
  174. background: #F4F5F7;
  175. color: #333333;
  176. font-size: 28rpx;
  177. }
  178. .xingBox {
  179. font-size: 28rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. padding: 24rpx;
  184. border-bottom: 1rpx solid #eeeeee;
  185. }
  186. </style>