SelectCarTwo.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. carName:'',
  59. }
  60. },
  61. onLoad(opt) {
  62. console.log('opt', opt);
  63. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  64. this.epc_id = opt.epc_id;
  65. this.brand_name = opt.brand_name;
  66. this.title = opt.brand_name;
  67. this.modelname = opt.brand_name;
  68. this.getItemData();
  69. },
  70. methods: {
  71. goNext(item) {
  72. this.token = item.token;
  73. this.param = item.param;
  74. if (item.next_restrain == 1) {
  75. this.title += ' > ' + item.model_name;
  76. this.modelname += ' ' + item.model_name;
  77. this.carName=this.modelname
  78. this.getYueSuData(item)
  79. }
  80. else{
  81. this.gogroup(item);
  82. }
  83. },
  84. goNext2(item) {
  85. this.token = item.token;
  86. this.param = item.param;
  87. this.modelname += ' ' + item.combine_cp;
  88. if (item.next_restrain == 1) {
  89. this.title += ' > ' + item.combine_cp;
  90. this.getYueSuData(item)
  91. }
  92. else{
  93. this.gogroup(item);
  94. }
  95. },
  96. //获取车型约束列表
  97. getYueSuData(item) {
  98. uni.showLoading({
  99. title: '加载中'
  100. });
  101. this.$http('advancedEpc/getRestrain', {
  102. epc_id: this.epc_id,
  103. token: this.token,
  104. param: this.param,
  105. access_time: this.access_time,
  106. }, 'GET').then(res => {
  107. uni.hideLoading();
  108. this.carModelShow = false;
  109. this.peizhiShow = true;
  110. this.peizhiList = res.data.result.list;
  111. this.access_time = res.data.result.access_time;
  112. });
  113. },
  114. //获取车型
  115. getItemData() {
  116. uni.showLoading({
  117. title: '加载中'
  118. });
  119. this.$http('advancedEpc/getModel', {
  120. epc_id: this.epc_id,
  121. }, 'GET').then(res => {
  122. uni.hideLoading();
  123. this.xingList = res.data.result.list;
  124. this.access_time = res.data.result.access_time;
  125. this.carModelShow = true;
  126. this.token = res.data.result.list[0].models[0].token;
  127. this.param = res.data.result.list[0].models[0].param;
  128. });
  129. },
  130. gogroup(item) {
  131. console.log(item)
  132. var json={
  133. brand: this.brand_name,
  134. epc_id:this.epc_id,
  135. param:item.param,
  136. token:item.token,
  137. access_time:this.access_time,
  138. modelname:this.modelname,
  139. carName:this.carName,
  140. }
  141. uni.showLoading({
  142. title: '加载中'
  143. });
  144. this.$http('advancedEpc/cachekey', {
  145. value: JSON.stringify(json),
  146. }, 'GET').then(res => {
  147. uni.hideLoading();
  148. console.log(res.data)
  149. uni.setStorageSync('cachekey',res.data )
  150. });
  151. uni.navigateTo({
  152. url: 'group?type=2&cart='+item.token+'&param='+item.param+'&access_time='+this.access_time+'&epc_id='+this.epc_id+'&modelname='+this.modelname
  153. })
  154. /* */
  155. },
  156. goOemSearch() {
  157. uni.navigateTo({
  158. url: 'OemSearch?brand=' + this.brand_name + '&epc_id=' + this.epc_id + '&param=' + this.param +
  159. '&token=' + this.token + '&access_time=' + this.access_time
  160. })
  161. },
  162. goback() {
  163. console.log('返回');
  164. uni.navigateBack({})
  165. },
  166. goHome(){
  167. var token= uni.getStorageSync("token")
  168. /* var encodedToken= uni.getStorageSync("encodedToken")
  169. var token = decodeURIComponent(encodedToken) */
  170. //var token=getHashQuery('token')
  171. var url = 'http://byweb.66km.cn/#/home?token='+token
  172. //window.history.back()
  173. window.location.href =url
  174. }
  175. }
  176. }
  177. </script>
  178. <style>
  179. .box {
  180. min-height: 100vh;
  181. background: #ffffff;
  182. padding-bottom: constant(safe-area-inset-bottom);
  183. padding-bottom: env(safe-area-inset-bottom);
  184. }
  185. .zdyNavBox {
  186. width: 100vw;
  187. background: #FFFFFF;
  188. position: fixed;
  189. top: 0;
  190. left: 0;
  191. z-index: 9999999;
  192. }
  193. .zdyNav {
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. padding: 14rpx 6rpx;
  198. }
  199. .zdyNavLeft{
  200. width: 120rpx;
  201. display: flex;
  202. }
  203. .goHomeBox{
  204. padding-left: 20rpx;
  205. padding-top: 6rpx;
  206. }
  207. .goHomeImg{
  208. width: 20px;
  209. height: 20px;
  210. }
  211. .zdyNavTitle {
  212. background: #FFFFFF;
  213. text-align: center;
  214. /* font-size: 32rpx; */
  215. /* font-weight: bold; */
  216. font-size: 18px!important;
  217. color: #333333!important;
  218. }
  219. .zdyNavRight {
  220. background: #FFFFFF;
  221. text-align: center;
  222. font-size: 28rpx;
  223. color: #3F90F7;
  224. width: 120rpx;
  225. }
  226. .top {
  227. color: #FFFFFF;
  228. font-size: 28rpx;
  229. padding: 24rpx;
  230. background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%);
  231. }
  232. .cangBox {
  233. background: #FFFFFF;
  234. }
  235. .cangTitle {
  236. padding: 10rpx 24rpx;
  237. background: #F4F5F7;
  238. color: #333333;
  239. font-size: 28rpx;
  240. text-align: center;
  241. font-weight: bold;
  242. }
  243. .xingBox {
  244. font-size: 28rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: center;
  248. padding: 24rpx;
  249. border-bottom: 1rpx solid #eeeeee;
  250. }
  251. </style>