index.vue 12 KB

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