SelectCarTwo.vue 5.3 KB

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