index.vue 17 KB

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