SelectCarTwo.vue 7.0 KB

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