index.vue 7.4 KB

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