SelectCarModel.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. </view>
  14. <view class="zdyNavTitle">选择品牌</view>
  15. <view style="width: 120rpx;"></view>
  16. </view>
  17. </view>
  18. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  19. <view style="height: 44px;"></view>
  20. <scroll-view class="scroll-view" :scroll-into-view="toView" scroll-y="true">
  21. <view class="brand-select">
  22. <template v-for="item in brandList">
  23. <view :id="item.titleStr">
  24. <view class="brand-select-title" :id="item.titleStr">
  25. <h5 :class="{'brand-select-titleselect':item.titleStr==toView}">{{item.titleStr}}</h5>
  26. </view>
  27. <view class="brand-select-wrapper">
  28. <a class="brand-select-item" v-for="item2 in item.list" @click="selectBrand(item2)"
  29. :id="item2.brand">
  30. <img :src="item2.icon" class="brand-select-item-icon">
  31. <span>{{item2.brand||item2.name}}</span>
  32. </a>
  33. </view>
  34. </view>
  35. </template>
  36. </view>
  37. </scroll-view>
  38. <div class="fast-navigation">
  39. <a class="fast-navigation-sel" :class="{'select':item.titleStr==toView}" v-for="item in brandList" @tap="bindToView(item)">{{item.titleStr}}</a>
  40. </div>
  41. </view>
  42. </template>
  43. <script>
  44. import { getHashQuery } from '../../utils/index.js'
  45. export default {
  46. components: {
  47. },
  48. data() {
  49. return {
  50. brandList: [],
  51. toView: '',
  52. iStatusBarHeight: '',
  53. token:'',
  54. }
  55. },
  56. onLoad(opt) {
  57. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  58. this.getItemData();
  59. var token=getHashQuery('token')
  60. //var encodedToken = encodeURIComponent(token);
  61. this.token=token
  62. localStorage.setItem('token', token)
  63. /* uni.setStorageSync('token',token )
  64. uni.setStorageSync('encodedToken',encodedToken ) */
  65. },
  66. methods: {
  67. goback() {
  68. console.log('返回');
  69. //uni.navigateBack({})
  70. window.history.back()
  71. },
  72. //获取品牌
  73. getItemData() {
  74. let that = this
  75. uni.showLoading({
  76. title: '加载中'
  77. });
  78. this.$http('advancedEpc/getBrands', {
  79. // epc_id: this.epc_id,
  80. // token: this.token,
  81. // param: this.param,
  82. // access_time: this.access_time,
  83. // page: this.page
  84. }, 'GET').then(res => {
  85. uni.hideLoading();
  86. var list = res.data.result.list;
  87. var sectionTitle = [];
  88. var brandList = [];
  89. list.forEach(item => {
  90. if (item) {
  91. sectionTitle.push(item.first_letter);
  92. }
  93. })
  94. sectionTitle.sort();
  95. sectionTitle = Array.from(new Set(sectionTitle))
  96. sectionTitle.forEach(title => {
  97. var arr = [];
  98. list.forEach(item => {
  99. if (item.first_letter == title) {
  100. arr.push(item);
  101. }
  102. })
  103. var dic = {
  104. titleStr: title,
  105. list: arr
  106. };
  107. brandList.push(dic);
  108. })
  109. that.brandList = brandList;
  110. console.log('list==', brandList);
  111. });
  112. },
  113. selectBrand(item) {
  114. console.log(item)
  115. uni.navigateTo({
  116. url:'SelectCarTwo?epc_id=' + item.epc_id + '&brand_name=' + item.brand+'&token='+this.token
  117. })
  118. },
  119. bindToView(item) {
  120. console.log(item)
  121. this.toView = item.titleStr
  122. console.log(this.toView)
  123. //this.scrollTop = 0
  124. },
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. .box {
  130. height: calc(100vh - 44px);
  131. background: #F4F5F7;
  132. padding-bottom: constant(safe-area-inset-bottom);
  133. padding-bottom: env(safe-area-inset-bottom);
  134. }
  135. .baiheibackImg {
  136. width: 70rpx;
  137. height: 44rpx;
  138. }
  139. .gaunbiIMg {
  140. width: 20px;
  141. height: 20px;
  142. padding: 12px;
  143. }
  144. .sltpImg {
  145. width: 704rpx;
  146. height: 353rpx;
  147. }
  148. .sltp {
  149. padding-top: 20rpx;
  150. }
  151. .nodataImg {
  152. width: 400rpx;
  153. padding-top: 100rpx;
  154. }
  155. .noTxt {
  156. font-size: 36rpx;
  157. color: #999999;
  158. padding-top: 50rpx;
  159. }
  160. .nodataBox {
  161. text-align: center;
  162. }
  163. .addBtn {
  164. width: 690rpx;
  165. height: 74rpx;
  166. background: linear-gradient(124deg, #FF8700 0%, #FF4F00 100%);
  167. border-radius: 37rpx;
  168. line-height: 74rpx;
  169. text-align: center;
  170. color: #FFFFFF;
  171. font-size: 30rpx;
  172. position: fixed;
  173. bottom: 23rpx;
  174. left: 30rpx;
  175. }
  176. .carlistBox {
  177. padding-bottom: 120rpx;
  178. }
  179. .tab {
  180. background: #FFFFFF;
  181. display: flex;
  182. justify-content: space-around;
  183. line-height: 93rpx;
  184. color: #3C3C3C;
  185. font-size: 30rpx;
  186. border-bottom: 1px solid #F4F5F7;
  187. }
  188. .activeTab {
  189. color: #FF4F00;
  190. text-decoration: underline
  191. }
  192. /* .brand-select-title{
  193. height: 80px;
  194. background:rgba(247,247,247,1);
  195. position: relative;
  196. } */
  197. .brand-select {
  198. .brand-select-title {
  199. height: 80rpx;
  200. background: rgba(247, 247, 247, 1);
  201. position: relative;
  202. h5 {
  203. position: absolute;
  204. height: 40rpx;
  205. font-size: 28rpx;
  206. font-weight: 500;
  207. color: rgba(102, 102, 102, 1);
  208. line-height: 40rpx;
  209. top: 20rpx;
  210. left: 30rpx;
  211. }
  212. }
  213. .brand-select-wrapper {
  214. display: flex;
  215. flex-wrap: wrap;
  216. background: rgba(255, 255, 255, 1);
  217. width: 100vw;
  218. .brand-select-item {
  219. display: block;
  220. width: 126rpx;
  221. height: 120rpx;
  222. padding: 30rpx;
  223. img {
  224. display: inline-block;
  225. margin-left: 10rpx;
  226. width: 60rpx;
  227. height: 60rpx;
  228. }
  229. span {
  230. display: inline-block;
  231. text-align: center;
  232. // height: 33rpx;
  233. width: 106rpx;
  234. font-size: 24rpx;
  235. font-weight: 400;
  236. color: rgba(51, 51, 51, 1);
  237. // line-height: 33rpx;
  238. margin-left: -10rpx;
  239. }
  240. }
  241. }
  242. }
  243. .fast-navigation {
  244. position: fixed;
  245. text-align: center;
  246. right: 16rpx;
  247. top: 360rpx;
  248. width: 23rpx;
  249. font-size: 24rpx;
  250. font-weight: 500;
  251. line-height: 35rpx;
  252. color: rgb(153, 153, 153);
  253. a {
  254. display: block;
  255. }
  256. .select {
  257. color: #FF4F00;
  258. }
  259. }
  260. .scroll-view {
  261. height: calc(100vh - 93rpx);
  262. }
  263. .popup-height {
  264. width: 200px;
  265. }
  266. .popup-content {
  267. width: 590rpx;
  268. background: #FFFFFF;
  269. height: 100vh;
  270. }
  271. .carModel-nav-title {
  272. height: 100rpx;
  273. background: linear-gradient(134deg, #FF8635 0%, #FF4828 100%);
  274. line-height: 100rpx;
  275. display: flex;
  276. z-index: 500;
  277. &.cell-logo {
  278. position: sticky;
  279. top: 0;
  280. background: linear-gradient(134deg, #FF8635 0%, #FF4828 100%);
  281. }
  282. .carModel-nav-title-box {
  283. width: 100%;
  284. display: flex;
  285. }
  286. .carModel-nav-title-img {
  287. margin: 20rpx;
  288. width: 60rpx;
  289. height: 60rpx;
  290. }
  291. .carModel-nav-title-msg {
  292. font-size: 30rpx;
  293. font-weight: 400;
  294. color: rgba(255, 255, 255, 1);
  295. display: block;
  296. padding-right: 20rpx;
  297. }
  298. }
  299. .cell-item-title {
  300. height: 60rpx;
  301. background: rgba(250, 250, 250, 1);
  302. font-size: 28rpx;
  303. font-weight: 400;
  304. color: rgba(102, 102, 102, 1);
  305. line-height: 60rpx;
  306. padding-left: 26rpx;
  307. }
  308. .span-cell {
  309. position: relative;
  310. display: -webkit-box;
  311. display: -webkit-flex;
  312. display: flex;
  313. box-sizing: border-box;
  314. width: 100%;
  315. padding: 6rpx 30rpx;
  316. overflow: hidden;
  317. color: #323233;
  318. font-size: 3.73333vw;
  319. line-height: 82rpx;
  320. height: 82rpx;
  321. background-color: #fff;
  322. border-bottom: 1px solid #ebedf0;
  323. }
  324. .carModel-nav-title {
  325. height: 100rpx;
  326. background: linear-gradient(134deg, #FF8635 0%, #FF4828 100%);
  327. line-height: 100rpx;
  328. display: flex;
  329. z-index: 500;
  330. &.cell-logo {
  331. position: sticky;
  332. top: 0;
  333. background: linear-gradient(134deg, #FF8635 0%, #FF4828 100%);
  334. }
  335. .carModel-nav-title-box {
  336. width: 100%;
  337. display: flex;
  338. }
  339. .carModel-nav-title-img {
  340. margin: 20rpx;
  341. width: 60rpx;
  342. height: 60rpx;
  343. }
  344. .carModel-nav-title-msg {
  345. font-size: 30rpx;
  346. font-weight: 400;
  347. color: rgba(255, 255, 255, 1);
  348. display: block;
  349. padding-right: 20px;
  350. }
  351. }
  352. .displacementListLine {
  353. min-height: 50rpx;
  354. padding: 20rpx 20rpx 20rpx 30rpx;
  355. font-size: 28rpx;
  356. font-weight: 600;
  357. color: rgba(51, 51, 51, 1);
  358. line-height: 50rpx;
  359. border-top: 2rpx solid rgb(238, 238, 238);
  360. background-color: rgb(255, 255, 255);
  361. }
  362. .displacementListBox {
  363. position: fixed;
  364. top: 0;
  365. left: 0;
  366. width: 100vw;
  367. height: 100vh;
  368. background: #F4F5F7;
  369. z-index: 11111;
  370. /* #ifdef H5 */
  371. top: 44px;
  372. /* #endif */
  373. }
  374. .carGroupListBox {
  375. position: fixed;
  376. top: 0;
  377. left: 0;
  378. width: 100vw;
  379. height: 100vh;
  380. background: #F4F5F7;
  381. z-index: 11111;
  382. /* #ifdef H5 */
  383. top: 44px;
  384. /* #endif */
  385. }
  386. .brandList {
  387. height: calc(100vh - 250rpx);
  388. }
  389. .brand-select-titleselect {
  390. color: #FF4F00 !important;
  391. }
  392. .zdyNavBox {
  393. width: 100vw;
  394. background: #FFFFFF;
  395. position: fixed;
  396. top: 0;
  397. left: 0;
  398. z-index: 9999999;
  399. }
  400. .zdyNav {
  401. display: flex;
  402. justify-content: space-between;
  403. align-items: center;
  404. padding: 14rpx 6rpx;
  405. }
  406. .zdyNavLeft {
  407. width: 120rpx;
  408. }
  409. .zdyNavTitle {
  410. background: #FFFFFF;
  411. text-align: center;
  412. /* font-size: 32rpx; */
  413. /* font-weight: bold; */
  414. font-size: 18px!important;
  415. color: #333333!important;
  416. }
  417. .zdyNavRight {
  418. background: #FFFFFF;
  419. text-align: center;
  420. font-size: 28rpx;
  421. color: #3F90F7;
  422. width: 120rpx;
  423. }
  424. .gobackBox{
  425. padding-left: 20rpx;
  426. padding-top: 6rpx;
  427. }
  428. .gobackImg{
  429. width: 10px;
  430. height: 20px;
  431. padding-right: 20rpx;
  432. }
  433. </style>