index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view>
  3. <view class="notice">
  4. <text class='iconfont icon-gonggao'></text>
  5. <swiper :indicator-dots="indicatorDots" autoplay="true" interval="2500" duration="500" vertical="true" circular="true">
  6. <block v-for="(item,index) in notice" :key='index'>
  7. <swiper-item>
  8. <navigator class='news' hover-class='none' :url="'/pages/news/index?id='+item.id">{{item.title}}</navigator>
  9. </swiper-item>
  10. </block>
  11. </swiper>
  12. </view>
  13. <view class="content">
  14. <view class="banner">
  15. <swiper indicator-dots="true" autoplay="true" circular="true" interval="2500" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  16. <block v-for="(item,index) in banner" :key="index">
  17. <swiper-item>
  18. <navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
  19. <image :src="item.img" class="slide-image"></image>
  20. </navigator>
  21. </swiper-item>
  22. </block>
  23. </swiper>
  24. </view>
  25. <view class="icon">
  26. <view><text class='iconfont icon-jiangchengben'></text>降成本</view>
  27. <view><text class='iconfont icon-qukucun'></text>去库存</view>
  28. <view><text class='iconfont icon-genggaoxiao'></text>更高效</view>
  29. <view><text class='iconfont icon-xuanze1'></text>多选择</view>
  30. </view>
  31. <view class="nav">
  32. <view><image src="../../static/images/nav1.png"></image><view>开启分站</view></view>
  33. <navigator class="item" url="/pages/users/spread/index" hover-class="none">
  34. <image src="../../static/images/nav2.png"></image><view>邀请好友</view>
  35. </navigator>
  36. <view><image src="../../static/images/nav3.png"></image><view>品质保证</view></view>
  37. <view><image src="../../static/images/nav4.png"></image><view>降低成本</view></view>
  38. </view>
  39. <view class="product">
  40. <view class="title">
  41. <text>排行榜</text>
  42. <navigator class="more" url="/pages/product/index" open-type='switchTab' hover-class='none'>更多 <text class="iconfont icon-jiantou"></text></navigator>
  43. </view>
  44. <view class="list">
  45. <scroll-view scroll-x="true" style="white-space: nowrap; display: flex" show-scrollbar="false">
  46. <navigator class="item" v-for="(item,index) in sort_product" :key="index" :url="'/pages/product/detail?id='+item.id" hover-class='none'>
  47. <image :src="item.img" mode=""></image>
  48. <view class="name">{{item.title}}</view>
  49. <view class="price">¥{{item.price}}</view>
  50. </navigator>
  51. </scroll-view>
  52. </view>
  53. </view>
  54. <view class="product">
  55. <view class="title">
  56. <text>新品上新</text>
  57. <navigator class="more" url="/pages/product/index" open-type='switchTab' hover-class='none'>更多 <text class="iconfont icon-jiantou"></text></navigator>
  58. </view>
  59. <view class="list">
  60. <scroll-view scroll-x="true" style="white-space: nowrap; display: flex" show-scrollbar="false">
  61. <navigator class="item" v-for="(item,index) in new_product" :key="index" :url="'/pages/product/detail?id='+item.id" hover-class='none'>
  62. <image :src="item.img" mode=""></image>
  63. <view class="name">{{item.title}}</view>
  64. <view class="price">¥{{item.price}}</view>
  65. </navigator>
  66. </scroll-view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="hotSale"><text>热销单品</text>品质保证 一件代发</view>
  71. <view class="productList">
  72. <navigator class="item" v-for="(item,index) in hot_product" :key="index" :url="'/pages/product/detail?id='+item.id" hover-class='none'>
  73. <image :src="item.img" class="image"></image>
  74. <view class="info">
  75. <view class="title">{{item.title}}</view>
  76. <view class="text"><text class="price">¥{{item.price}}</text><text>{{item.wget}}kg/件</text></view>
  77. <view class="express">快递:
  78. <image src="../../static/images/express1.png" class="icon"></image>
  79. <image src="../../static/images/express2.png" class="icon"></image>
  80. <image src="../../static/images/express3.png" class="icon"></image>
  81. </view>
  82. </view>
  83. </navigator>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. import {
  89. getNotice,
  90. getIndexData
  91. } from '@/api/api.js';
  92. export default {
  93. data() {
  94. return{
  95. spid: '',
  96. indicatorDots: false,
  97. notice: [],
  98. banner: [],
  99. sort_product: [],
  100. new_product: [],
  101. hot_product: []
  102. }
  103. },
  104. onLoad(options) {
  105. if (options.spid) {
  106. this.spid = options.spid;
  107. }
  108. this.getNotice();
  109. this.getIndexConfig();
  110. },
  111. methods: {
  112. // 公告
  113. getNotice: function() {
  114. getNotice().then(res => {
  115. this.notice = res.data;
  116. })
  117. },
  118. // 首页数据
  119. getIndexConfig: function() {
  120. getIndexData().then(res => {
  121. this.banner = res.data.banner;
  122. this.sort_product = res.data.sort_product;
  123. this.new_product = res.data.new_product;
  124. this.hot_product = res.data.hot_product;
  125. })
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss">
  131. .notice{
  132. background: #fff;
  133. height: 90rpx;
  134. display: flex;
  135. padding: 20rpx 0;
  136. text{
  137. line-height: 50rpx;
  138. border-right: 2rpx solid #ddd;
  139. padding: 0 20rpx;
  140. }
  141. swiper{
  142. width: 650rpx;
  143. height: 50rpx;
  144. line-height: 50rpx;
  145. overflow: hidden;
  146. margin-left: 10rpx;
  147. .news{
  148. overflow: hidden;
  149. text-overflow: ellipsis;
  150. white-space: nowrap;
  151. }
  152. }
  153. }
  154. .content{
  155. padding: 0 20rpx;
  156. }
  157. .banner{
  158. margin-top: 20rpx;
  159. .slide-image{
  160. width:710rpx;
  161. height:300rpx;
  162. border-radius: 14rpx;
  163. }
  164. }
  165. .icon{
  166. color:#ff5c00;
  167. display: flex;
  168. justify-content:space-between;
  169. margin-top: 20rpx;
  170. text{
  171. margin-right: 10rpx;
  172. }
  173. }
  174. .nav{
  175. display: flex;
  176. justify-content:space-around;
  177. padding-top:30rpx;
  178. color:#333;
  179. image{
  180. width:110rpx;
  181. height:110rpx;
  182. }
  183. }
  184. .product {
  185. padding: 23rpx 20rpx;
  186. margin-top:20rpx;
  187. border-radius: 15rpx;
  188. background-color: #fff;
  189. overflow: hidden;
  190. box-shadow: 0px 0px 16px 3px rgba(0, 0, 0, 0.04);
  191. .title {
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. text {
  196. font-size: 32rpx;
  197. font-weight: bold;
  198. }
  199. .more {
  200. font-size: 26rpx;
  201. color: #999;
  202. .iconfont {
  203. margin-left: 6rpx;
  204. font-size: 25rpx;
  205. }
  206. }
  207. }
  208. .list{
  209. width: 100%;
  210. margin-top: 27rpx;
  211. .item{
  212. display: inline-block;
  213. width: 150rpx;
  214. margin-right: 20rpx;
  215. font-size: 24rpx;
  216. image{
  217. width:150rpx;
  218. height:150rpx;
  219. }
  220. .name{
  221. white-space: nowrap;
  222. overflow: hidden;
  223. text-overflow: ellipsis;
  224. }
  225. .price{
  226. text-align: center;
  227. color:#ff5c00;
  228. margin-top: 8rpx;
  229. }
  230. }
  231. }
  232. }
  233. .hotSale{
  234. margin: 20rpx 0;
  235. padding: 30rpx 20rpx;
  236. color:#666;
  237. background: #fff;
  238. text{
  239. color:#000;
  240. font-size: 32rpx;
  241. font-weight: bold;
  242. border-right: 2rpx solid #ddd;
  243. padding-right: 15rpx;
  244. margin-right: 15rpx;
  245. }
  246. }
  247. .productList {
  248. display: flex;
  249. justify-content:space-evenly;
  250. flex-wrap:wrap;
  251. .item{
  252. background: #fff;
  253. width:350rpx;
  254. margin-bottom: 20rpx;
  255. border-radius: 16rpx;
  256. .image{
  257. width:350rpx;
  258. height:350rpx;
  259. border-radius: 16rpx 16rpx 0 0;
  260. }
  261. .info{
  262. padding: 15rpx;
  263. .title{
  264. white-space: nowrap;
  265. overflow: hidden;
  266. text-overflow: ellipsis;
  267. }
  268. .text{
  269. display: flex;
  270. align-items: center;
  271. justify-content:space-between;
  272. color:#666;
  273. font-size: 24rpx;
  274. margin: 10rpx 0;
  275. .price{
  276. color:#ff5c00;
  277. font-size: 32rpx;
  278. }
  279. }
  280. .express{
  281. display: flex;
  282. align-items: center;
  283. .icon{
  284. width:40rpx;
  285. height:40rpx;
  286. margin-right: 10rpx;
  287. margin-top: -2rpx;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. </style>