SelectCarModel.vue 9.5 KB

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