mall.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <view class="center">
  3. <!-- 顶部logo and 搜索 start-->
  4. <view class="top-search flex">
  5. <view class="top-logo">
  6. <image src="../../static/icon/logo.png" mode="widthFix"></image>
  7. </view>
  8. <view class="search-box flex" @click="clickSearch()">
  9. <image class="search" src="../../static/icon/search-h.png" mode=""></image>
  10. <view class="search-font">输入关键词搜索</view>
  11. </view>
  12. </view>
  13. <!-- 顶部logo and 搜索 end-->
  14. <view class="jg"></view>
  15. <!-- 轮播图 start -->
  16. <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  17. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  18. @click="bannerNavToUrl(item)">
  19. <image src="../../static/img/bargainBg.jpg" />
  20. </swiper-item>
  21. </swiper>
  22. <!-- 轮播图 end -->
  23. <view class="swiper-btm flex">
  24. <view class="btm-item flex">
  25. <image src="../../static/icon/index-gou.png" mode=""></image>
  26. <view class="">自用购物返利</view>
  27. </view>
  28. <view class="btm-item flex">
  29. <image src="../../static/icon/index-gou.png" mode=""></image>
  30. <view class="">分享好友赚钱</view>
  31. </view>
  32. <view class="btm-item flex">
  33. <image src="../../static/icon/index-gou.png" mode=""></image>
  34. <view class="">超值正品优惠</view>
  35. </view>
  36. </view>
  37. <!-- 商品列表 -->
  38. <view class="good-list">
  39. <view class="good flex" v-for="item in 10">
  40. <view class="good-img">
  41. <image src="../../static/img/afternoon.png" mode=""></image>
  42. </view>
  43. <view class="good-info flex">
  44. <view class="good-name clamp2">
  45. 法国空运高端82年拉菲陈酿红葡萄酒法国空运高端82年拉菲陈酿红葡萄酒
  46. </view>
  47. <view class="good-price">
  48. <view class="old-price">
  49. <text class="old-left">¥2000</text> <image src="../../static/icon/down.png" mode="widthFix"></image><text class="old-right">直降40元</text>
  50. </view>
  51. <view class="new-price flex">
  52. <view class="">
  53. ¥1960
  54. </view>
  55. <view class="good-tip">
  56. 1960提货券
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import {
  67. tabbar1
  68. } from '@/utils/tabbar.js';
  69. import {
  70. loadIndexs
  71. } from '@/api/index.js';
  72. import uniCountdowns from '@/components/uni-countdown/uni-countdowns.vue';
  73. export default {
  74. components: {
  75. uniCountdowns
  76. },
  77. data() {
  78. return {
  79. current: 0,
  80. tabbar: tabbar1,
  81. titleNViewBackground: '',
  82. swiperCurrent: 0,
  83. swiperLength: 0,
  84. dataList: '',
  85. carouselList: [], //轮播图列表
  86. text: ['恭喜黑白灰用户拼团成功¥353元!', '恭喜黑白灰用户拼团成功¥353元!'],
  87. stopTime: {
  88. stopTimeH: 0,
  89. stopTimeM: 24,
  90. stopTimeS: 59
  91. },
  92. bzb: 30
  93. };
  94. },
  95. onLoad() {
  96. this.loadData();
  97. },
  98. methods: {
  99. loadData() {
  100. loadIndexs({})
  101. .then(({
  102. data
  103. }) => {
  104. let goods = data.info;
  105. this.dataList = goods.bastList; //精品推荐
  106. this.carouselList = data.banner;
  107. })
  108. .catch(e => {});
  109. },
  110. goDetails(e) {
  111. console.log(e, '123456');
  112. uni.navigateTo({
  113. url: '/pages/index/messageInfo'
  114. });
  115. },
  116. nav(url) {
  117. uni.navigateTo({
  118. url,
  119. fail() {
  120. uni.switchTab({
  121. url
  122. });
  123. }
  124. });
  125. },
  126. //轮播图切换修改背景色
  127. swiperChange(e) {
  128. const index = e.detail.current;
  129. this.swiperCurrent = index;
  130. this.titleNViewBackground = this.carouselList[index].background;
  131. },
  132. // 點擊搜索框
  133. clickSearch() {
  134. uni.navigateTo({
  135. url: '/pages/product/search'
  136. });
  137. },
  138. //详情页
  139. navToDetailPage(item) {
  140. let id = item.id;
  141. uni.navigateTo({
  142. url: '/pages/product/product?id=' + id
  143. });
  144. }
  145. }
  146. };
  147. </script>
  148. <style lang="scss">
  149. page,
  150. .center {
  151. min-height: 100%;
  152. height: auto;
  153. background: #ededed;
  154. }
  155. // 顶部搜索
  156. .top-search {
  157. height: 80rpx;
  158. padding: 0 20rpx;
  159. background-color: #fff;
  160. .top-logo {
  161. width: 50rpx;
  162. // height: 50rpx;
  163. margin-right: 10rpx;
  164. image {
  165. width: 50rpx;
  166. // height: 50rpx;
  167. }
  168. }
  169. .search-box {
  170. justify-content: center;
  171. width: 698rpx;
  172. height: 60rpx;
  173. background: #EEEEEE;
  174. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  175. border-radius: 30rpx;
  176. .search {
  177. width: 34rpx;
  178. height: 34rpx;
  179. }
  180. .search-font {
  181. margin-left: 14rpx;
  182. font-size: 28rpx;
  183. font-family: PingFang SC;
  184. font-weight: 500;
  185. color: #CBCBCB;
  186. }
  187. }
  188. }
  189. // 顶部轮播图
  190. .top-swiper {
  191. width: 750rpx;
  192. height: 360rpx;
  193. // margin: 20rpx 0 0;
  194. image {
  195. width: 750rpx;
  196. height: 360rpx;
  197. }
  198. }
  199. .swiper-btm {
  200. height: 60rpx;
  201. width: 750rpx;
  202. background-color: #fff;
  203. margin-bottom: 20rpx;
  204. font-size: 21rpx;
  205. font-weight: 500;
  206. color: #333333;
  207. .btm-item {
  208. flex-grow: 1;
  209. justify-content: center;
  210. image {
  211. width: 25rpx;
  212. height: 25rpx;
  213. margin-right: 14rpx;
  214. }
  215. }
  216. }
  217. .jg {
  218. height: 20rpx;
  219. background-color: #fff;
  220. }
  221. .good-list {
  222. width: 750rpx;
  223. background: linear-gradient(0deg, #FFFFFF, #F8F8F8);
  224. padding: 30rpx 0;
  225. .good {
  226. width: 690rpx;
  227. height: 276rpx;
  228. background: #FFFFFF;
  229. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  230. border-radius: 10rpx;
  231. margin: auto;
  232. padding: 20rpx 15rpx;
  233. margin-bottom: 20rpx;
  234. &:last-of-type {
  235. margin-bottom: 0rpx;
  236. }
  237. .good-img {
  238. flex-shrink: 0;
  239. width: 236rpx;
  240. height: 236rpx;
  241. border-radius: 10rpx;
  242. margin-right: 22rpx;
  243. image {
  244. width: 236rpx;
  245. height: 236rpx;
  246. border-radius: 10rpx;
  247. }
  248. }
  249. .good-info {
  250. flex-grow: 1;
  251. height: 100%;
  252. flex-direction: column;
  253. justify-content: space-between;
  254. align-items: flex-start;
  255. .good-name {
  256. font-size: 32rpx;
  257. font-weight: bold;
  258. padding-top: 10rpx;
  259. color: #333333;
  260. }
  261. .good-price {
  262. width: 100%;
  263. image {
  264. width: 14rpx;
  265. margin: 0 6rpx 0 10rpx;
  266. }
  267. .old-price {
  268. .old-left {
  269. font-size: 26rpx;
  270. font-weight: 500;
  271. text-decoration: line-through;
  272. color: #999999;
  273. }
  274. .old-right {
  275. font-size: 24rpx;
  276. font-weight: bold;
  277. color: #B59467;
  278. }
  279. }
  280. .new-price {
  281. width: 100%;
  282. font-size: 36rpx;
  283. font-weight: bold;
  284. color: #FF4C4C;
  285. justify-content: space-between;
  286. .good-tip {
  287. display: inline-block;
  288. padding: 0 20rpx 0 17rpx;
  289. min-width: 160rpx;
  290. text-align: center;
  291. line-height: 40rpx;
  292. background: #303030;
  293. font-size: 24rpx;
  294. font-weight: 500;
  295. color: #F8DABA;
  296. border-radius: 10rpx;
  297. position: relative;
  298. &::before {
  299. content: '';
  300. display: inline-block;
  301. height: 17rpx;
  302. width: 17rpx;
  303. background-color: #fff;
  304. border-radius: 50%;
  305. position: absolute;
  306. top: 0;
  307. bottom: 0;
  308. left: -9rpx;
  309. margin: auto;
  310. }
  311. &::after {
  312. content: '';
  313. display: inline-block;
  314. height: 17rpx;
  315. width: 17rpx;
  316. background-color: #fff;
  317. border-radius: 50%;
  318. position: absolute;
  319. top: 0;
  320. bottom: 0;
  321. right: -9rpx;
  322. margin: auto;
  323. }
  324. }
  325. }
  326. }
  327. }
  328. }
  329. }
  330. </style>