index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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. <!-- 预约 start-->
  38. <view class="yuyue-wrap">
  39. <view class="yuyue-top flex">
  40. <image src="../../static/img/yuyue-top.png" mode="heightFix"></image>
  41. </view>
  42. <view class="yuyue-item" v-for="item in 3">
  43. <view class="item-top">
  44. <image src="../../static/img/yuyue.png" mode=""></image>
  45. <view class="item-top-info flex">
  46. <view class="">
  47. 早上场<text>/大家都在买</text>
  48. </view>
  49. <view class="goto">
  50. GO>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="item-info flex">
  55. <view class="item-img">
  56. <image src="../../static/img/zaoshang.png" mode=""></image>
  57. </view>
  58. <view class="item-val flex">
  59. <view class="item-status">
  60. 距离本场开始
  61. </view>
  62. <view class="item-djs">
  63. <uni-countdown
  64. color="#C6914E"
  65. background-color="#F6EFDF"
  66. :show-day="false"
  67. :day="0"
  68. :hour="10"
  69. :minute="10"
  70. :second="10"
  71. ></uni-countdown>
  72. </view>
  73. <view class="item-base">
  74. 开始时间 16:00:00 结束时间 16:30:00
  75. </view>
  76. <view class="item-btn" @click="yuyue()">
  77. 已预约
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 预约 end-->
  84. <!-- 预约弹窗 start-->
  85. <uni-popup ref="popupyy" type="bottom">
  86. <view class="popupyy-wrap">
  87. <view class="popupyy-top">
  88. 预约活动
  89. </view>
  90. <view class="popupyy-tit">
  91. 本次预约冻结广告值
  92. </view>
  93. <view class="popupyy-val">
  94. 330
  95. </view>
  96. <view class="" style="margin-top: 50rpx;">
  97. 消费积分不低于100
  98. </view>
  99. <view class="" style="color: #FF4C4C;margin-top: 15rpx;">
  100. 可用广告值700
  101. </view>
  102. <view class="popupyy-btn" @click="yuyueOk()">
  103. 确认预约
  104. </view>
  105. </view>
  106. </uni-popup>
  107. <!-- 预约弹窗 end-->
  108. </view>
  109. </template>
  110. <script>
  111. import {
  112. tabbar1
  113. } from '@/utils/tabbar.js';
  114. import {
  115. loadIndexs
  116. } from '@/api/index.js';
  117. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  118. export default {
  119. components: {
  120. uniCountdown
  121. },
  122. data() {
  123. return {
  124. current: 0,
  125. tabbar: tabbar1,
  126. titleNViewBackground: '',
  127. swiperCurrent: 0,
  128. swiperLength: 0,
  129. dataList: '',
  130. carouselList: [], //轮播图列表
  131. text: ['恭喜黑白灰用户拼团成功¥353元!', '恭喜黑白灰用户拼团成功¥353元!'],
  132. stopTime: {
  133. stopTimeH: 0,
  134. stopTimeM: 24,
  135. stopTimeS: 59
  136. },
  137. bzb: 30
  138. };
  139. },
  140. onLoad() {
  141. this.loadData();
  142. },
  143. methods: {
  144. loadData() {
  145. loadIndexs({})
  146. .then(({
  147. data
  148. }) => {
  149. let goods = data.info;
  150. this.dataList = goods.bastList; //精品推荐
  151. this.carouselList = data.banner;
  152. })
  153. .catch(e => {});
  154. },
  155. goDetails(e) {
  156. console.log(e, '123456');
  157. uni.navigateTo({
  158. url: '/pages/index/messageInfo'
  159. });
  160. },
  161. nav(url) {
  162. uni.navigateTo({
  163. url,
  164. fail() {
  165. uni.switchTab({
  166. url
  167. });
  168. }
  169. });
  170. },
  171. //轮播图切换修改背景色
  172. swiperChange(e) {
  173. const index = e.detail.current;
  174. this.swiperCurrent = index;
  175. this.titleNViewBackground = this.carouselList[index].background;
  176. },
  177. // 點擊搜索框
  178. clickSearch() {
  179. uni.navigateTo({
  180. url: '/pages/product/search'
  181. });
  182. },
  183. //详情页
  184. navToDetailPage(item) {
  185. let id = item.id;
  186. uni.navigateTo({
  187. url: '/pages/product/product?id=' + id
  188. });
  189. },
  190. // 打开预约弹窗
  191. yuyue() {
  192. this.$refs.popupyy.open()
  193. },
  194. // 确定预约
  195. yuyueOk() {
  196. this.$refs.popupyy.close()
  197. }
  198. }
  199. };
  200. </script>
  201. <style lang="scss">
  202. page,
  203. .center {
  204. min-height: 100%;
  205. height: auto;
  206. background: #ededed;
  207. }
  208. // 顶部搜索
  209. .top-search {
  210. height: 80rpx;
  211. padding: 0 20rpx;
  212. background-color: #fff;
  213. .top-logo {
  214. width: 50rpx;
  215. // height: 50rpx;
  216. margin-right: 10rpx;
  217. image {
  218. width: 48rpx;
  219. }
  220. }
  221. .search-box {
  222. justify-content: center;
  223. width: 698rpx;
  224. height: 60rpx;
  225. background: #EEEEEE;
  226. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  227. border-radius: 30rpx;
  228. .search {
  229. width: 34rpx;
  230. height: 34rpx;
  231. }
  232. .search-font {
  233. margin-left: 14rpx;
  234. font-size: 28rpx;
  235. font-family: PingFang SC;
  236. font-weight: 500;
  237. color: #CBCBCB;
  238. }
  239. }
  240. }
  241. // 顶部轮播图
  242. .top-swiper {
  243. width: 750rpx;
  244. height: 360rpx;
  245. // margin: 20rpx 0 0;
  246. image {
  247. width: 750rpx;
  248. height: 360rpx;
  249. }
  250. }
  251. .swiper-btm {
  252. height: 60rpx;
  253. width: 750rpx;
  254. background-color: #fff;
  255. margin-bottom: 20rpx;
  256. font-size: 21rpx;
  257. font-weight: 500;
  258. color: #333333;
  259. .btm-item {
  260. flex-grow: 1;
  261. justify-content: center;
  262. image {
  263. width: 25rpx;
  264. height: 25rpx;
  265. margin-right: 14rpx;
  266. }
  267. }
  268. }
  269. .jg {
  270. height: 20rpx;
  271. background-color: #fff;
  272. }
  273. .yuyue-wrap {
  274. background-color: #fff;
  275. .yuyue-top {
  276. height: 117rpx;
  277. justify-content: center;
  278. image {
  279. display: inline-block;
  280. height: 31rpx;
  281. margin: auto;
  282. }
  283. }
  284. .yuyue-item {
  285. width: 690rpx;
  286. margin: auto;
  287. .item-top {
  288. width: 690rpx;
  289. height: 80rpx;
  290. border-radius: 18rpx;
  291. // background-color: #bfa;
  292. position: relative;
  293. image {
  294. width: 690rpx;
  295. height: 80rpx;
  296. // position: relative;
  297. }
  298. .item-top-info {
  299. width: 690rpx;
  300. height: 80rpx;
  301. position: absolute;
  302. top: 0;
  303. left: 0;
  304. font-size: 33rpx;
  305. font-weight: bold;
  306. color: #C6914E;
  307. padding-left: 35rpx;
  308. padding-right: 25rpx;
  309. text {
  310. font-size: 22rpx;
  311. font-weight: 500;
  312. color: #C6914E;
  313. }
  314. .goto {
  315. width: 60rpx;
  316. line-height: 26rpx;
  317. background: #C6914E;
  318. border-radius: 12rpx;
  319. font-size: 18rpx;
  320. font-weight: 500;
  321. color: #FFFFFF;
  322. text-align: center;
  323. }
  324. }
  325. }
  326. .item-info {
  327. width: 690rpx;
  328. height: 252rpx;
  329. margin-top: -20rpx;
  330. background: #FFFFFF;
  331. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  332. border-radius: 0px 0px 20rpx 20rpx;
  333. padding: 0 25rpx;
  334. margin-bottom: 20rpx;
  335. .item-img {
  336. width: 134rpx;
  337. height: 133rpx;
  338. background-color: red;
  339. flex-shrink: 0;
  340. image {
  341. width: 134rpx;
  342. height: 133rpx;
  343. }
  344. }
  345. .item-val {
  346. flex-grow: 1;
  347. height: 100%;
  348. // background-color: #009688;
  349. position: relative;
  350. flex-direction: column;
  351. align-items: flex-start;
  352. padding-left: 25rpx;
  353. justify-content: center;
  354. .item-djs {
  355. margin: 20rpx 0;
  356. height: 42rpx;
  357. }
  358. .item-status {
  359. font-size: 26rpx;
  360. font-weight: bold;
  361. color: #333333;
  362. }
  363. .item-base {
  364. font-size: 25rpx;
  365. font-weight: 500;
  366. color: #666666;
  367. }
  368. .item-btn {
  369. width: 159rpx;
  370. height: 59rpx;
  371. line-height: 59rpx;
  372. background: #CCCCCC;
  373. border-radius: 10rpx;
  374. position: absolute;
  375. right: 0;
  376. top: 0;
  377. bottom: 0;
  378. margin: auto;
  379. text-align: center;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. .popupyy-wrap {
  386. width: 750rpx;
  387. height: 745rpx;
  388. background: #FFFFFF;
  389. border-radius: 20rpx 20rpx 0px 0px;
  390. text-align: center;
  391. font-size: 32rpx;
  392. color: #999999;
  393. font-weight: 500;
  394. padding-top: 60rpx;
  395. .popupyy-top {
  396. font-size: 36rpx;
  397. font-weight: 500;
  398. color: #333333;
  399. position: relative;
  400. &::before {
  401. content: '';
  402. width: 138rpx;
  403. height: 1rpx;
  404. background: #CBCBCB;
  405. position: absolute;
  406. top: 0;
  407. bottom: 0;
  408. left: 124rpx;
  409. margin: auto;
  410. }
  411. &::after {
  412. content: '';
  413. width: 138rpx;
  414. height: 1rpx;
  415. background: #CBCBCB;
  416. position: absolute;
  417. top: 0;
  418. bottom: 0;
  419. right: 124rpx;
  420. margin: auto;
  421. }
  422. }
  423. .popupyy-tit {
  424. font-size: 32rpx;
  425. font-weight: 500;
  426. color: #999999;
  427. margin-top: 70rpx;
  428. }
  429. .popupyy-val {
  430. font-size: 67rpx;
  431. font-weight: bold;
  432. color: #333333;
  433. margin-top: 60rpx;
  434. }
  435. .popupyy-btn {
  436. width: 680rpx;
  437. line-height: 100rpx;
  438. background: #303030;
  439. border-radius: 10rpx;
  440. font-size: 34rpx;
  441. font-weight: 500;
  442. color: #F8DABA;
  443. margin: 20rpx auto 0;
  444. }
  445. }
  446. </style>