index.vue 15 KB

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