SelectCarTwo.vue 6.2 KB

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