SelectCarTwo.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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="$noMultipleClicks(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. noClick:true,
  54. brand_id:'',
  55. imageicon:'',
  56. }
  57. },
  58. onLoad(opt) {
  59. console.log('opt', opt);
  60. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  61. this.epc_id = opt.epc_id;
  62. this.brand_name = opt.brand_name;
  63. this.title = opt.brand_name;
  64. this.modelname = opt.brand_name;
  65. this.brand_id = opt.brand_id;
  66. this.imageicon = opt.imageicon
  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. if(!this.modelname.includes(item.combine_cp)){
  86. this.modelname += ' ' + item.combine_cp;
  87. }
  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. // this.token = item.token;
  133. // this.param = item.param;
  134. console.log(this.modelname);
  135. uni.navigateTo({
  136. url: 'group?type=2&token='+item.token+'&param='+item.param+'&access_time='+this.access_time+'&epc_id='+this.epc_id
  137. +'&modelname='+this.modelname+'&brand_id='+this.brand_id+'&imageicon='+this.imageicon+"&caption="+item.caption
  138. })
  139. },
  140. goOemSearch() {
  141. uni.navigateTo({
  142. url: 'OemSearch?brand=' + this.brand_name + '&epc_id=' + this.epc_id + '&param=' + this.param +
  143. '&token=' + this.token + '&access_time=' + this.access_time
  144. })
  145. },
  146. goback() {
  147. console.log('返回');
  148. uni.navigateBack({})
  149. },
  150. }
  151. }
  152. </script>
  153. <style>
  154. .box {
  155. min-height: 100vh;
  156. background: #ffffff;
  157. padding-bottom: constant(safe-area-inset-bottom);
  158. padding-bottom: env(safe-area-inset-bottom);
  159. }
  160. .zdyNavBox {
  161. width: 100vw;
  162. background: #FFFFFF;
  163. position: fixed;
  164. top: 0;
  165. left: 0;
  166. z-index: 9999999;
  167. }
  168. .zdyNav {
  169. display: flex;
  170. justify-content: space-between;
  171. align-items: center;
  172. padding: 14rpx 6rpx;
  173. }
  174. .zdyNavLeft{
  175. width: 120rpx;
  176. }
  177. .zdyNavTitle {
  178. background: #FFFFFF;
  179. text-align: center;
  180. font-size: 32rpx;
  181. font-weight: bold;
  182. }
  183. .zdyNavRight {
  184. background: #FFFFFF;
  185. text-align: center;
  186. font-size: 28rpx;
  187. color: #3F90F7;
  188. width: 120rpx;
  189. }
  190. .top {
  191. color: #FFFFFF;
  192. font-size: 28rpx;
  193. padding: 24rpx;
  194. /* background: linear-gradient(110deg, #48B9F9 0%, #3F90F7 100%); */
  195. background-color: #1777FF ;
  196. }
  197. .cangBox {
  198. background: #FFFFFF;
  199. }
  200. .cangTitle {
  201. padding: 10rpx 24rpx;
  202. background: #F4F5F7;
  203. color: #333333;
  204. font-size: 28rpx;
  205. text-align: center;
  206. font-weight: bold;
  207. }
  208. .xingBox {
  209. font-size: 28rpx;
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. padding: 24rpx;
  214. border-bottom: 1rpx solid #eeeeee;
  215. }
  216. </style>