index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <template>
  2. <view class="center">
  3. <view class="topcontent padding-b-30">
  4. <view class="top">
  5. <view class="vheigh"></view>
  6. <view class="top-main flex">
  7. <view class="search-box flex" @click="clickSearch()">
  8. <image class="search" src="../../static/img/search.png" mode=""></image>
  9. <view class="search-font">输入关键词搜索</view>
  10. </view>
  11. </view>
  12. </view>
  13. <swiper class="carousel" autoplay="true" duration="400" interval="5000">
  14. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  15. @click="bannerNavToUrl(item)">
  16. <image :src="item.pic" />
  17. </swiper-item>
  18. </swiper>
  19. <view class="stre flex">
  20. <view class="ic-text flex">
  21. <image class="ic-tubiao" src="../../static/icon/shou-ic.png" mode=""></image>
  22. <view class="ic-wen">自用购物优惠</view>
  23. </view>
  24. <view class="ic-text flex">
  25. <image class="ic-tubiao" src="../../static/icon/shou-ic.png" mode=""></image>
  26. <view class="ic-wen">分享好友赚钱</view>
  27. </view>
  28. <view class="ic-text flex">
  29. <image class="ic-tubiao" src="../../static/icon/shou-ic.png" mode=""></image>
  30. <view class="ic-wen">超值正品优惠</view>
  31. </view>
  32. </view>
  33. <view class="zhishi flex">
  34. <navigator url="/pages/index/artDetail?id=5">
  35. <view class="zhishi-item">
  36. <image class="zhishi-ic" src="../../static/icon/shou-tro.png" mode=""></image>
  37. <view class="zhishi-te">行业介绍</view>
  38. </view>
  39. </navigator>
  40. <navigator url="/pages/index/artDetail?id=6">
  41. <view class="zhishi-item">
  42. <image class="zhishi-ic" src="../../static/icon/shou-we.png" mode=""></image>
  43. <view class="zhishi-te">关于我们</view>
  44. </view>
  45. </navigator>
  46. <view class="zhishi-item" @click="openKf">
  47. <image class="zhishi-ic" src="../../static/icon/shou-kefu.png" mode=""></image>
  48. <view class="zhishi-te">联系客服</view>
  49. </view>
  50. <navigator url="/pages/user/shareQrCode">
  51. <view class="zhishi-item">
  52. <image class="zhishi-ic" src="../../static/icon/firend.png" mode=""></image>
  53. <view class="zhishi-te">邀请好友</view>
  54. </view>
  55. </navigator>
  56. </view>
  57. <view class="tongz">
  58. <view class="tongz-left flex padding-l-30">
  59. <image class="image-left" src="../../static/icon/shou-gonggao.png" mode=""></image>
  60. <u-notice-bar class="notice" mode="vertical" type="none" :volume-icon="false" :more-icon="true"
  61. :list="text" @click="goDetails" @getMore="nav('/pages/index/message?type=1')"></u-notice-bar>
  62. </view>
  63. </view>
  64. <view class="product-list flex">
  65. <template v-for="(item,ind) in dataList">
  66. <view class="list-left" v-if="ind==0">
  67. <navigator :url="`/pages/index/artDetail?id=${item.id}`">
  68. <image class="imgleft" :src="item.image_input[0]" mode="scaleToFill"></image>
  69. </navigator>
  70. </view>
  71. </template>
  72. <view class="list-right flex" v-if="dataList.length>1">
  73. <view class="item" v-for="(item,ind) in dataList" v-if="ind>0">
  74. <navigator :url="`/pages/index/artDetail?id=${item.id}`">
  75. <image class="imgleft" :src="item.image_input[0]" mode="scaleToFill"></image>
  76. </navigator>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="bottom-box margin-t-30">
  82. <view class="bottom-title padding-b-30">
  83. <image class="image" src="../../static/img/image-title.png" mode="scaleToFill"></image>
  84. </view>
  85. <swiper previous-margin='150rpx' next-margin='150rpx' class="product-art-list" circular autoplay
  86. duration="400" interval="5000" @change='changeBottom'>
  87. <swiper-item v-for="(item, index) in article" :key="index" class="product-art-item">
  88. <navigator :url="`/pages/index/artDetail?id=${item.id}`">
  89. <view class="image-box">
  90. <image class="image" :src="item.image_input[0]" />
  91. </view>
  92. </navigator>
  93. </swiper-item>
  94. </swiper>
  95. <view class="product-detail">
  96. <text v-if="article.length>0">
  97. {{article[actionArtInd].synopsis}}
  98. </text>
  99. </view>
  100. </view>
  101. <uni-popup ref="popupkf" type="center">
  102. <view class="popup-box">
  103. <view class="img">
  104. <image src="../../static/img/img009.png" mode=""></image>
  105. </view>
  106. <view class="mian">
  107. <view class="delivery">
  108. <view class="title">已经为您定制专属客服</view>
  109. <image src="../../static/img/img010.png" mode=""></image>
  110. </view>
  111. <view class="nocancel">客服VX:{{ kefu }}</view>
  112. <view class="comfirm-box">
  113. <view class="cancel" @click="cancel">取消</view>
  114. <view class="comfirm" @click="comfirm(kefu)">复制微信</view>
  115. </view>
  116. </view>
  117. </view>
  118. </uni-popup>
  119. <u-tabbar activeColor="#333333" inactive-color='#999999' v-model="current" :list="tabbar"></u-tabbar>
  120. </view>
  121. </template>
  122. <script>
  123. import {
  124. tabbar1
  125. } from '@/utils/tabbar.js';
  126. import seckill from '../../components/seckill/seckill.vue';
  127. import {
  128. article
  129. } from '@/api/user.js';
  130. import {
  131. getCategoryList,
  132. getProducts
  133. } from '@/api/product.js';
  134. import {
  135. loadIndexs,
  136. store_list
  137. } from '@/api/index.js';
  138. import uniCountdowns from '@/components/uni-countdown/uni-countdowns.vue';
  139. // #ifdef H5
  140. // import { openMap } from '@/utils/rocessor.js';
  141. // #endif
  142. import {
  143. auction_gu
  144. } from '@/api/hall.js';
  145. import {
  146. mapState,
  147. mapMutations
  148. } from 'vuex';
  149. export default {
  150. components: {
  151. seckill,
  152. uniCountdowns
  153. },
  154. data() {
  155. return {
  156. current: 0,
  157. tabbar: tabbar1,
  158. longitude: '', //经度
  159. latitude: '', //纬度
  160. carouselList: [], //轮播图列表
  161. text: [], //公告
  162. article: [], //精品展示
  163. dataList: [], //产品介绍
  164. kefu: '',
  165. actionArtInd: 0, //默认选中的精品展示对象
  166. };
  167. },
  168. onPullDownRefresh() {
  169. console.log('111');
  170. this.loadData();
  171. setTimeout(function() {
  172. uni.stopPullDownRefresh();
  173. }, 1000);
  174. },
  175. onShow() {
  176. this.loadData();
  177. },
  178. methods: {
  179. ...mapMutations(['setLat', 'setLon', 'setChoose']),
  180. // 底部轮播图切换
  181. changeBottom(res) {
  182. this.actionArtInd = res.detail.current;
  183. console.log(res);
  184. },
  185. // 打开客服
  186. openKf() {
  187. this.$refs.popupkf.open();
  188. },
  189. // 关闭客服
  190. cancel() {
  191. this.$refs.popupkf.close();
  192. },
  193. loadData() {
  194. article({}, 1).then(({
  195. data
  196. }) => {
  197. this.text = data.map((e) => {
  198. return e.synopsis
  199. })
  200. });
  201. // 精品展示
  202. article({}, 2).then(({
  203. data
  204. }) => {
  205. this.article = data.map((e) => {
  206. e.imageurl = e.image_input[0];
  207. return e
  208. })
  209. });
  210. // 产品介绍
  211. article({}, 3).then(({
  212. data
  213. }) => {
  214. this.dataList = data.map((e) => {
  215. return e
  216. })
  217. });
  218. loadIndexs({})
  219. .then(({
  220. data
  221. }) => {
  222. let goods = data.info;
  223. // this.dataList = goods.bastList; //精品推荐
  224. this.carouselList = data.banner;
  225. })
  226. .catch(e => {});
  227. },
  228. out_of_china(lng, lat) {
  229. return lng < 72.004 || lng > 137.8347 || (lat < 0.8293 || lat > 55.8271 || false);
  230. },
  231. toBack() {
  232. uni.navigateTo({
  233. url: '/pages/navigation/index'
  234. })
  235. },
  236. goDetails(e) {
  237. uni.navigateTo({
  238. url: '/pages/index/messageInfo?id=' + this.article[e].id
  239. });
  240. },
  241. nav(url) {
  242. console.log(url, '123456');
  243. uni.navigateTo({
  244. url,
  245. fail() {
  246. uni.switchTab({
  247. url
  248. });
  249. }
  250. });
  251. },
  252. // 點擊搜索框
  253. clickSearch() {
  254. uni.navigateTo({
  255. url: '/pages/product/search'
  256. });
  257. },
  258. navTo(item) {
  259. uni.navigateTo({
  260. url: '/pages/hall/halllist?id=' + item.id + '&name=' + item.name + '&peoplename=' + item
  261. .nickname
  262. });
  263. },
  264. //详情页
  265. navToDetailPage(item) {
  266. let id = item.id;
  267. uni.navigateTo({
  268. url: '/pages/product/product?id=' + id
  269. });
  270. }
  271. }
  272. };
  273. </script>
  274. <style lang="scss">
  275. .center {
  276. padding-bottom: 30rpx;
  277. }
  278. .topcontent {
  279. background-color: #FFFFFF;
  280. }
  281. .vheigh {
  282. height: var(--status-bar-height);
  283. background-color: $base-color;
  284. }
  285. .top {
  286. position: relative;
  287. width: 100%;
  288. height: 120rpx;
  289. .top-main {
  290. position: relative;
  291. z-index: 2;
  292. padding: 30rpx;
  293. .search-box {
  294. justify-content: center;
  295. width: 698rpx;
  296. height: 60rpx;
  297. background: rgba(255, 240, 245, 0.4);
  298. border-radius: 30rpx;
  299. background-color: #EEEEEE;
  300. .search {
  301. width: 34rpx;
  302. height: 34rpx;
  303. }
  304. .search-font {
  305. margin-left: 14rpx;
  306. font-size: 28rpx;
  307. font-family: PingFang SC;
  308. font-weight: 500;
  309. color: #CBCBCB;
  310. }
  311. }
  312. }
  313. }
  314. .carousel {
  315. width: 750rpx;
  316. height: 360rpx;
  317. /* #ifndef APP-PLUS */
  318. // margin: -230rpx auto 0;
  319. // margin: -160rpx auto 0;
  320. /* #endif */
  321. /* #ifdef APP-PLUS */
  322. // margin: -100rpx auto 0;
  323. /* #endif */
  324. image {
  325. width: 100%;
  326. height: 100%;
  327. }
  328. }
  329. .stre {
  330. padding: 0 30rpx;
  331. margin-top:20rpx ;
  332. .ic-text {
  333. .ic-tubiao {
  334. width: 27rpx;
  335. height: 27rpx;
  336. }
  337. .ic-wen {
  338. font-size: 21rpx;
  339. color: #333333;
  340. }
  341. }
  342. }
  343. .zhishi {
  344. padding: 30rpx;
  345. .zhishi-item {
  346. .zhishi-ic {
  347. width: 90rpx;
  348. height: 90rpx;
  349. }
  350. .zhishi-te {
  351. font-size: 24rpx;
  352. color: #666666;
  353. }
  354. }
  355. }
  356. .tongz {
  357. height: 70rpx;
  358. margin: 0 30rpx 30rpx 30rpx;
  359. border-radius: 20rpx;
  360. overflow: hidden;
  361. align-items: center;
  362. position: relative;
  363. background-color: #F8F8FA;
  364. .tongz-left {
  365. .notice {
  366. flex-grow: 1;
  367. }
  368. .image-left {
  369. width: 28rpx;
  370. height: 28rpx;
  371. }
  372. .tongz-font {
  373. margin-left: 22rpx;
  374. font-size: 28rpx;
  375. font-family: Source Han Sans CN;
  376. font-weight: 400;
  377. color: #0f253a;
  378. }
  379. }
  380. .tongz-right {
  381. position: relative;
  382. z-index: 11;
  383. width: 12rpx;
  384. height: 26rpx;
  385. image {
  386. width: 100%;
  387. height: 100%;
  388. }
  389. }
  390. }
  391. .popup-box {
  392. width: 522rpx;
  393. height: 605rpx;
  394. background-color: #ffffff;
  395. border-radius: 20rpx;
  396. position: relative;
  397. .img {
  398. position: relative;
  399. top: -56rpx;
  400. left: 0;
  401. width: 522rpx;
  402. height: 132rpx;
  403. display: flex;
  404. justify-content: center;
  405. image {
  406. border-radius: 20rpx 20rpx 0 0;
  407. width: 450rpx;
  408. height: 132rpx;
  409. }
  410. }
  411. .mian {
  412. margin-top: -44rpx;
  413. display: flex;
  414. flex-direction: column;
  415. align-items: center;
  416. // padding: 32rpx 32rpx;
  417. background-color: #ffffff;
  418. border-radius: 0 0 20rpx 20rpx;
  419. text-align: center;
  420. .delivery {
  421. font-size: 40rpx;
  422. color: #333333;
  423. display: flex;
  424. align-items: center;
  425. flex-direction: column;
  426. .title {}
  427. image {
  428. margin-top: 48rpx;
  429. width: 172rpx;
  430. height: 160rpx;
  431. }
  432. }
  433. .nocancel {
  434. font-size: 32rpx;
  435. color: #333333;
  436. margin-top: 14rpx;
  437. }
  438. .comfirm-box {
  439. margin-top: 52rpx;
  440. display: flex;
  441. // margin-bottom: 32rpx;
  442. // justify-content: space-around;
  443. .cancel {
  444. display: flex;
  445. align-items: center;
  446. justify-content: center;
  447. width: 197rpx;
  448. height: 74rpx;
  449. border: 1px solid #dcc786;
  450. border-radius: 38rpx;
  451. font-size: 32rpx;
  452. color: #605128;
  453. }
  454. .comfirm {
  455. margin-left: 32rpx;
  456. display: flex;
  457. align-items: center;
  458. justify-content: center;
  459. width: 197rpx;
  460. height: 74rpx;
  461. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  462. border-radius: 38px;
  463. font-size: 32rpx;
  464. color: #605128;
  465. }
  466. }
  467. }
  468. }
  469. .product-list {
  470. padding: 0 30rpx;
  471. line-height: 0;
  472. align-items: stretch;
  473. .list-left {
  474. .imgleft {
  475. width: 306rpx;
  476. height: 319rpx;
  477. }
  478. }
  479. .list-right {
  480. flex-direction: column;
  481. .imgleft {
  482. width: 366rpx;
  483. height: 152rpx;
  484. }
  485. }
  486. }
  487. .bottom-box {
  488. padding: 30rpx 0;
  489. background-color: #FFFFFF;
  490. .bottom-title {
  491. text-align: center;
  492. .image {
  493. width: 609rpx;
  494. height: 31rpx;
  495. }
  496. }
  497. .product-art-list {
  498. height: 432rpx;
  499. .product-art-item {
  500. .image-box {
  501. text-align: center;
  502. .image {
  503. width: 432rpx;
  504. height: 432rpx;
  505. }
  506. }
  507. }
  508. }
  509. .product-detail {
  510. margin: 30rpx;
  511. height: 4em;
  512. overflow: hidden;
  513. text-indent: 2em;
  514. text-overflow: ellipsis;
  515. display: -webkit-box;
  516. -webkit-line-clamp: 4;
  517. -webkit-box-orient: vertical;
  518. }
  519. }
  520. </style>