index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
  5. <view class="top-main flex">
  6. <view class="search-box flex" @click="clickSearch()">
  7. <image class="search" src="../../static/img/search.png" mode=""></image>
  8. <view class="search-font">输入关键词搜索</view>
  9. </view>
  10. </view>
  11. </view>
  12. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  13. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item" @click="bannerNavToUrl(item)"><image :src="item.pic" /></swiper-item>
  14. </swiper>
  15. <view class="tongz flex">
  16. <view>
  17. <view class="tongz-bg"><image src="../../static/img/tongz-bg.png" mode=""></image></view>
  18. <view class="tongz-left flex">
  19. <image class="image-left" src="../../static/img/ling.png" mode=""></image>
  20. <u-notice-bar
  21. style="width: 100%;"
  22. mode="vertical"
  23. type="none"
  24. :volume-icon="false"
  25. :more-icon="true"
  26. :list="text"
  27. @click="goDetails"
  28. @getMore="nav('/pages/index/message?type=1')"
  29. ></u-notice-bar>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="navbar flex">
  34. <view class="navbar-item" @click="nav('/pages/product/classify?type=4')">
  35. <image class="nitem-image" src="../../static/img/index-inco1.png" mode=""></image>
  36. <view class="nitem-font">随意嗨购</view>
  37. </view>
  38. <view class="navbar-item" @click="nav('/pages/product/classify?type=5')">
  39. <image class="nitem-image" src="../../static/img/index-inco3.png" mode=""></image>
  40. <view class="nitem-font">置换</view>
  41. </view>
  42. <view class="navbar-item" @click="nav('/pages/product/seckill')">
  43. <image class="nitem-image" src="../../static/img/index-inco5.png" mode=""></image>
  44. <view class="nitem-font">秒杀</view>
  45. </view>
  46. <view class="navbar-item" @click="nav('/pages/store/store')">
  47. <image class="nitem-image" src="../../static/img/index-inco7.png" mode=""></image>
  48. <view class="nitem-font">合作专区</view>
  49. </view>
  50. <view class="navbar-item" @click="nav('/pages/category/category')">
  51. <image class="nitem-image" src="../../static/img/index-inco8.png" mode=""></image>
  52. <view class="nitem-font">大品牌区</view>
  53. </view>
  54. <!-- <view class="navbar-item" @click="nav('/pages/index/message?type=2')">
  55. <image class="nitem-image" src="../../static/img/index-inco6.png" mode=""></image>
  56. <view class="nitem-font">拍卖品</view>
  57. </view> -->
  58. <view class="navbar-item" @click="nav('/pages/product/classify?type=1')">
  59. <image class="nitem-image" src="../../static/img/index-inco2.png" mode=""></image>
  60. <view class="nitem-font">医斯佳专区</view>
  61. </view>
  62. <view class="navbar-item" @click="nav('/pages/product/classify?type=3')">
  63. <image class="nitem-image" src="../../static/img/index-inco4.png" mode=""></image>
  64. <view class="nitem-font">CBB专区</view>
  65. </view>
  66. </view>
  67. <view class="shingle" v-if="list">
  68. <view class="shingle-top flex">
  69. <view class="shingle-title">CBB潮贝抢货通道</view>
  70. <view class="shingle-btn" @click="nav('/pages/hall/hall')">
  71. 更多CBB代理团队
  72. <text>></text>
  73. </view>
  74. </view>
  75. <view class="shingle-main" @click="navTo(list)">
  76. <view class="shingle-bg"><image :src="list.image" mode=""></image></view>
  77. <view class="shinglem-title flex">
  78. <image class="tbg" src="../../static/img/tbg-left.png" mode=""></image>
  79. <view class="shinglemt-center">
  80. <image class="address" src="../../static/img/address.png" mode=""></image>
  81. <view class="shingle-font">{{ list.name || 'null' }}</view>
  82. </view>
  83. <image class="tbg" src="../../static/img/tbg-right.png" mode=""></image>
  84. </view>
  85. <view class="shingle-mmain flex">
  86. <view class="smmain-item">
  87. <view class="smitem-top">开放中</view>
  88. <view class="smitem-bottom">状态</view>
  89. </view>
  90. <view class="shu"></view>
  91. <view class="smmain-item">
  92. <view class="smitem-top clamp">{{ list.nickname }}</view>
  93. <view class="smitem-bottom">CBB潮倍贝</view>
  94. </view>
  95. <view class="shu"></view>
  96. <view class="smmain-item">
  97. <view class="people flex">
  98. <view class="peopleitem" v-for="item in 1"><image src="../../static/img/busy.png" mode=""></image></view>
  99. <view class="peopleitem" v-for="item in 4"><image src="../../static/img/leisure.png" mode=""></image></view>
  100. </view>
  101. <view class="smitem-bottom">流畅</view>
  102. </view>
  103. </view>
  104. <image class="right-bottom" src="../../static/img/right-bottom.png" mode=""></image>
  105. </view>
  106. </view>
  107. <!-- 秒杀楼层 -->
  108. <seckill></seckill>
  109. <view class="ge" v-if="stop.length != 0"></view>
  110. <view class="serve" v-if="stop.length != 0">
  111. <view class="seckill-title flex">
  112. <view class="seckill-left flex">
  113. <image class="seckill-inco" src="../../static/img/serve.png" mode=""></image>
  114. <view class="seckill-font">服务专区推荐</view>
  115. </view>
  116. <view class="seckill-right" @click="nav('/pages/store/store')">
  117. <view class="seckill-rfont">更多</view>
  118. <image class="seckill-back" src="../../static/img/back.png" mode=""></image>
  119. </view>
  120. </view>
  121. <view class="serve-main flex">
  122. <view class="serve-item" @click="nav('/pages/store/storeInfo?id=' + item.id)" v-for="(item, index) in stop" :key="index">
  123. <image class="serve-price" :src="item.image" mode=""></image>
  124. <view class="clamp serve-title">{{ item.name }}</view>
  125. <view class="serve-address flex" v-if="item.jl">
  126. <image class="saddress-inco" src="../../static/img/address.png" mode=""></image>
  127. <view class="saddress-font">距离{{ item.jl }}KM</view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. <u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar"></u-tabbar>
  133. </view>
  134. </template>
  135. <script>
  136. import { tabbar1 } from '@/utils/tabbar.js';
  137. import seckill from '../../components/seckill/seckill.vue';
  138. import { article } from '@/api/user.js';
  139. import { loadIndexs, store_list } from '@/api/index.js';
  140. import uniCountdowns from '@/components/uni-countdown/uni-countdowns.vue';
  141. import { openMap } from '@/utils/rocessor.js';
  142. import { auction_gu } from '@/api/hall.js';
  143. export default {
  144. components: {
  145. seckill,
  146. uniCountdowns
  147. },
  148. data() {
  149. return {
  150. current: 0,
  151. tabbar: tabbar1,
  152. titleNViewBackground: '',
  153. swiperCurrent: 0,
  154. swiperLength: 0,
  155. longitude: '', //经度
  156. latitude: '', //纬度
  157. dataList: '',
  158. carouselList: [], //轮播图列表
  159. text: [],
  160. article: [],
  161. list: {},
  162. stop: []
  163. };
  164. },
  165. onPullDownRefresh() {
  166. console.log('111');
  167. this.loadData();
  168. this.getaddress();
  169. setTimeout(function() {
  170. uni.stopPullDownRefresh();
  171. }, 1000);
  172. },
  173. onShow() {
  174. this.loadData();
  175. this.getaddress();
  176. },
  177. methods: {
  178. loadData() {
  179. article({}, 1).then(({ data }) => {
  180. data.forEach(e => {
  181. this.text.push(e.synopsis);
  182. });
  183. this.article = data;
  184. });
  185. auction_gu({ pages: 1, limit: 1 })
  186. .then(({ data }) => {
  187. this.list = data[0];
  188. })
  189. .catch(e => {
  190. console.log(e);
  191. });
  192. loadIndexs({})
  193. .then(({ data }) => {
  194. let goods = data.info;
  195. this.dataList = goods.bastList; //精品推荐
  196. this.carouselList = data.banner;
  197. })
  198. .catch(e => {});
  199. },
  200. //根据经纬度计算距离
  201. getFlatternDistance(lat1, lng1, lat2, lng2) {
  202. let radLat1 = (lat1 * Math.PI) / 180.0;
  203. let radLat2 = (lat2 * Math.PI) / 180.0;
  204. let a = radLat1 - radLat2;
  205. let b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
  206. let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
  207. s = s * 6378.137;
  208. s = Math.round(s * 10000) / 10000;
  209. return s;
  210. },
  211. getaddress() {
  212. let obj = this;
  213. uni.getLocation({
  214. type: 'gcj02',
  215. success: res => {
  216. console.log('dizhi+++++++++++');
  217. this.longitude = res.longitude; //经度
  218. this.latitude = res.latitude; //纬度
  219. store_list({
  220. page: 1,
  221. limit: 3,
  222. latitude: res.latitude,
  223. longitude: res.longitude
  224. }).then(e => {
  225. if (e.data.length != 0) {
  226. e.data.list.forEach(e => {
  227. e.jl = this.getFlatternDistance(this.latitude, this.longitude, e.latitude, e.longitude);
  228. });
  229. }
  230. obj.stop = e.data.list;
  231. console.log(e);
  232. });
  233. },
  234. fail: err => {
  235. console.log(err, '123456789');
  236. openMap().then(e => {
  237. this.getaddress();
  238. });
  239. }
  240. });
  241. },
  242. goDetails(e) {
  243. uni.navigateTo({
  244. url: '/pages/index/messageInfo?id=' + this.article[e].id
  245. });
  246. },
  247. nav(url) {
  248. uni.navigateTo({
  249. url,
  250. fail() {
  251. uni.switchTab({
  252. url
  253. });
  254. }
  255. });
  256. },
  257. //轮播图切换修改背景色
  258. swiperChange(e) {
  259. const index = e.detail.current;
  260. this.swiperCurrent = index;
  261. this.titleNViewBackground = this.carouselList[index].background;
  262. },
  263. // 點擊搜索框
  264. clickSearch() {
  265. uni.navigateTo({
  266. url: '/pages/product/search'
  267. });
  268. },
  269. navTo(item) {
  270. uni.navigateTo({
  271. url: '/pages/hall/halllist?id=' + item.id + '&name=' + item.name + '&peoplename=' + item.nickname
  272. });
  273. },
  274. //详情页
  275. navToDetailPage(item) {
  276. let id = item.id;
  277. uni.navigateTo({
  278. url: '/pages/product/product?id=' + id
  279. });
  280. }
  281. }
  282. };
  283. </script>
  284. <style lang="scss">
  285. page,
  286. .center {
  287. min-height: 100%;
  288. height: auto;
  289. background: #ffffff;
  290. }
  291. .top {
  292. position: relative;
  293. width: 100%;
  294. height: 360rpx;
  295. .top-bg {
  296. position: absolute;
  297. top: 0;
  298. left: 0;
  299. right: 0;
  300. width: 100%;
  301. height: 100%;
  302. }
  303. .top-main {
  304. position: relative;
  305. z-index: 2;
  306. padding: 30rpx;
  307. .search-box {
  308. justify-content: center;
  309. width: 698rpx;
  310. height: 60rpx;
  311. background: rgba(255, 240, 245, 0.4);
  312. box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  313. border-radius: 30rpx;
  314. .search {
  315. width: 34rpx;
  316. height: 34rpx;
  317. }
  318. .search-font {
  319. margin-left: 14rpx;
  320. font-size: 28rpx;
  321. font-family: PingFang SC;
  322. font-weight: 500;
  323. color: #ffffff;
  324. }
  325. }
  326. }
  327. }
  328. .carousel {
  329. width: 700rpx;
  330. height: 276rpx;
  331. margin: -240rpx auto 0;
  332. image {
  333. width: 700rpx;
  334. height: 276rpx;
  335. }
  336. }
  337. .tongz {
  338. width: 690rpx;
  339. height: 70rpx;
  340. margin: 32rpx auto 0;
  341. padding: 18rpx 30rpx 18rpx 24rpx;
  342. align-items: center;
  343. position: relative;
  344. .tongz-bg {
  345. position: absolute;
  346. top: 0;
  347. right: 0;
  348. left: 0;
  349. width: 690rpx;
  350. height: 70rpx;
  351. image {
  352. width: 100%;
  353. height: 100%;
  354. }
  355. }
  356. .tongz-left {
  357. width: 640rpx;
  358. .image-left {
  359. width: 28rpx;
  360. height: 34rpx;
  361. }
  362. .tongz-font {
  363. margin-left: 22rpx;
  364. font-size: 28rpx;
  365. font-family: Source Han Sans CN;
  366. font-weight: 400;
  367. color: #0f253a;
  368. }
  369. }
  370. .tongz-right {
  371. position: relative;
  372. z-index: 11;
  373. width: 12rpx;
  374. height: 26rpx;
  375. image {
  376. width: 100%;
  377. height: 100%;
  378. }
  379. }
  380. }
  381. .navbar {
  382. justify-content: flex-start;
  383. flex-wrap: wrap;
  384. .navbar-item {
  385. margin-top: 42rpx;
  386. width: 25%;
  387. display: flex;
  388. flex-direction: column;
  389. align-items: center;
  390. .nitem-image {
  391. width: 90rpx;
  392. height: 90rpx;
  393. }
  394. .nitem-font {
  395. font-size: 24rpx;
  396. font-family: PingFang SC;
  397. font-weight: 500;
  398. color: #0c1732;
  399. }
  400. }
  401. }
  402. .product {
  403. width: 662rpx;
  404. height: 180rpx;
  405. margin: 44rpx auto;
  406. .product-image {
  407. width: 662rpx;
  408. height: 180rpx;
  409. }
  410. }
  411. .shingle {
  412. width: 750rpx;
  413. background: #f8f8f8;
  414. border-radius: 10rpx;
  415. margin: 60rpx auto 0rpx;
  416. padding: 44rpx 50rpx 40rpx;
  417. .shingle-top {
  418. padding-left: 2rpx;
  419. .shingle-title {
  420. font-size: 36rpx;
  421. font-family: PingFang SC;
  422. font-weight: bold;
  423. color: #dc262b;
  424. }
  425. .shingle-btn {
  426. width: 250rpx;
  427. height: 50rpx;
  428. border: 2rpx solid #dc262b;
  429. border-radius: 10rpx;
  430. padding: 0 16rpx;
  431. text-align: left;
  432. font-size: 24rpx;
  433. font-family: PingFang SC;
  434. font-weight: 500;
  435. color: #dc262b;
  436. line-height: 50rpx;
  437. text {
  438. display: inline-block;
  439. padding-left: 6rpx;
  440. }
  441. }
  442. }
  443. .shingle-main {
  444. margin: 20rpx auto;
  445. width: 650rpx;
  446. height: 206rpx;
  447. position: relative;
  448. .shingle-bg {
  449. position: absolute;
  450. top: 0;
  451. left: 0;
  452. right: 0;
  453. width: 650rpx;
  454. height: 206rpx;
  455. image {
  456. width: 650rpx;
  457. height: 206rpx;
  458. }
  459. }
  460. .shinglem-title {
  461. position: relative;
  462. z-index: 2;
  463. justify-content: center;
  464. height: 70rpx;
  465. .tbg {
  466. height: 70rpx;
  467. width: 40rpx;
  468. }
  469. .shinglemt-center {
  470. display: flex;
  471. align-items: center;
  472. background: rgba(220, 38, 43, 0.66);
  473. }
  474. .address {
  475. width: 28rpx;
  476. height: 30rpx;
  477. }
  478. .shingle-font {
  479. font-size: 36rpx;
  480. font-family: PingFang SC;
  481. font-weight: bold;
  482. color: #ffffff;
  483. line-height: 70rpx;
  484. margin-left: 14rpx;
  485. }
  486. }
  487. .shingle-mmain {
  488. position: relative;
  489. z-index: 2;
  490. margin-top: 30rpx;
  491. .smmain-item {
  492. width: 33%;
  493. display: flex;
  494. flex-direction: column;
  495. align-items: center;
  496. .smitem-top {
  497. text-align: center;
  498. width: 90%;
  499. font-size: 30rpx;
  500. font-family: PingFang SC;
  501. font-weight: bold;
  502. color: #ffffff;
  503. }
  504. .smitem-bottom {
  505. margin-top: 10rpx;
  506. font-size: 30rpx;
  507. font-family: PingFang SC;
  508. font-weight: bold;
  509. color: #ffffff;
  510. }
  511. .people {
  512. justify-content: center;
  513. .peopleitem {
  514. width: 24rpx;
  515. height: 34rpx;
  516. image {
  517. width: 100%;
  518. height: 100%;
  519. }
  520. }
  521. }
  522. }
  523. .shu {
  524. width: 2rpx;
  525. height: 70rpx;
  526. background: #ffffff;
  527. }
  528. }
  529. .right-bottom {
  530. position: absolute;
  531. z-index: 2;
  532. right: 0;
  533. bottom: 0;
  534. width: 94rpx;
  535. height: 92rpx;
  536. }
  537. }
  538. }
  539. .seckill-left {
  540. justify-content: flex-start;
  541. .seckill-inco {
  542. width: 36rpx;
  543. height: 36rpx;
  544. flex-shrink: 0;
  545. }
  546. .seckill-font {
  547. margin-left: 8rpx;
  548. font-size: 32rpx;
  549. font-family: PingFang SC;
  550. font-weight: bold;
  551. color: #333333;
  552. }
  553. .djs {
  554. margin-left: 12rpx;
  555. font-size: 20rpx;
  556. font-family: PingFang SC;
  557. font-weight: bold;
  558. color: #dc262b;
  559. }
  560. }
  561. .seckill-right {
  562. display: flex;
  563. justify-content: flex-start;
  564. align-items: center;
  565. .seckill-rfont {
  566. font-size: 24rpx;
  567. font-family: PingFang SC;
  568. font-weight: 500;
  569. color: #999999;
  570. margin-right: 8rpx;
  571. }
  572. .seckill-back {
  573. width: 10rpx;
  574. height: 20rpx;
  575. }
  576. }
  577. .ge {
  578. height: 20rpx;
  579. width: 750rpx;
  580. background: #f8f8f8;
  581. }
  582. .serve {
  583. padding: 32rpx 30rpx;
  584. background: #ffffff;
  585. .serve-main {
  586. margin-top: 24rpx;
  587. flex-wrap: wrap;
  588. justify-content: flex-start;
  589. .serve-item:first-child {
  590. margin-left: 0rpx;
  591. }
  592. .serve-item {
  593. width: 220rpx;
  594. background: #f6f6f6;
  595. border-radius: 10rpx;
  596. margin-left: 14rpx;
  597. padding-bottom: 22rpx;
  598. .serve-price {
  599. width: 220rpx;
  600. height: 220rpx;
  601. border-radius: 10rpx 10rpx 0px 0px;
  602. background: #03a9f4;
  603. }
  604. .serve-title {
  605. margin-top: 16rpx;
  606. padding: 0 14rpx;
  607. font-size: 26rpx;
  608. font-family: PingFang SC;
  609. font-weight: 500;
  610. color: #0a122b;
  611. }
  612. .serve-address {
  613. justify-content: flex-start;
  614. margin-top: 10rpx;
  615. padding: 0 14rpx;
  616. .saddress-inco {
  617. width: 18rpx;
  618. height: 24rpx;
  619. }
  620. .saddress-font {
  621. margin-left: 4rpx;
  622. font-size: 20rpx;
  623. font-family: PingFang SC;
  624. font-weight: 500;
  625. color: #666666;
  626. }
  627. }
  628. }
  629. }
  630. }
  631. </style>