index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <view class="center">
  3. <!-- 顶部logo and 搜索 start-->
  4. <view class="status_bar"></view>
  5. <view class="top-search flex">
  6. <view class="search-box flex" @click="clickSearch()">
  7. <image class="search" src="../../static/icon/search-h.png" mode=""></image>
  8. <view class="search-font">输入关键词搜索</view>
  9. </view>
  10. </view>
  11. <!-- 顶部logo and 搜索 end-->
  12. <view class="jg"></view>
  13. <!-- 轮播图 start -->
  14. <view class="swiper-wrap">
  15. <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  16. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  17. @click="bannerNavToUrl(item)">
  18. <image :src="item.pic" />
  19. </swiper-item>
  20. </swiper>
  21. </view>
  22. <!-- 轮播图 end -->
  23. <view class="jg"></view>
  24. <!-- 分类 start-->
  25. <view class="cate-section flex">
  26. <view class="cate-item flex" @click="gozx">
  27. <view class="img-wrapper flex">
  28. <image src="../../static/icon/c1.png" mode=""></image>
  29. </view>
  30. <view class="item-title">易博甄选</view>
  31. </view>
  32. <view class="cate-item flex" @click="goCp()">
  33. <view class="img-wrapper flex">
  34. <image src="../../static/icon/c2.png" mode=""></image>
  35. </view>
  36. <view class="item-title">环球国际</view>
  37. </view>
  38. <view class="cate-item flex" @click="openGg()">
  39. <view class="img-wrapper flex">
  40. <image src="../../static/icon/c3.png" mode=""></image>
  41. </view>
  42. <view class="item-title">视频领奖</view>
  43. </view>
  44. <!-- <view class="cate-item flex" @click="nav('/pages/coupon/couponList')">
  45. <view class="img-wrapper flex">
  46. <image src="../../static/icon/c4.png" mode=""></image>
  47. </view>
  48. <view class="item-title">领券中心</view>
  49. </view> -->
  50. <view class="cate-item flex" @click="nav('/pages/user/shareQrCode')">
  51. <view class="img-wrapper flex">
  52. <image src="../../static/icon/c5.png" mode=""></image>
  53. </view>
  54. <view class="item-title">邀请有礼</view>
  55. </view>
  56. </view>
  57. <!-- 分类 end-->
  58. <!-- 专区 start -->
  59. <view class="zq-wrap flex">
  60. <view class="zq-item" @click="nav('/pages/index/xfqzq')">
  61. <view class="zq-tit">
  62. 消费券专区
  63. </view>
  64. <view class="item-info flex">
  65. <image src="../../static/img/xf-bg.png" mode=""></image>
  66. <view class="info-tit">
  67. <image src="../../static/icon/ms.png" mode="widthFix"></image>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="zq-item bd" @click="nav('/pages/index/bdzq')">
  72. <view class="zq-tit">
  73. 积分专区
  74. </view>
  75. <view class="item-info flex">
  76. <image src="../../static/img/bd-bg.png" mode=""></image>
  77. <view class="info-tit">
  78. <image src="../../static/icon/bd.png" mode="widthFix"></image>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 专区 end -->
  84. <!-- 商品列表 start -->
  85. <view class="product-box">
  86. <view class="product-tit flex">
  87. <view class="hx">
  88. </view>
  89. <view class="tit">
  90. 猜您喜欢
  91. </view>
  92. <view class="hx">
  93. </view>
  94. </view>
  95. <view class="hotgoods">
  96. <view class="hotgoods-item" v-for="item in list" :key="item.id"
  97. @click="nav('/pages/product/product?id=' + item.id)" style="height: 520rpx;">
  98. <view class="image-wrapper">
  99. <image class="image" :src="item.image" mode="scaleToFill"></image>
  100. </view>
  101. <view class="flex" style="flex-direction: column;justify-content: space-between;align-items: flex-start;height: 160rpx;">
  102. <view class="title clamp2">{{item.store_name}}</view>
  103. <view class="hot-price">
  104. <view class="price">
  105. <text class="font-size-sm"></text>
  106. {{ item.integral * 1 }}<text class="jf">积分</text>
  107. </view>
  108. <view class="yuanPrice">市场价:¥{{ item.ot_price*1 }}</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. <uni-load-more :status="loadingType"></uni-load-more>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. loadIndexs,
  120. groom1,
  121. advertisement
  122. } from '@/api/index.js';
  123. import {
  124. getProducts
  125. } from '@/api/product.js'
  126. import {
  127. mapState,
  128. mapMutations
  129. } from 'vuex';
  130. export default {
  131. data() {
  132. return {
  133. dataList: '',
  134. carouselList: [], //轮播图列表
  135. page: 1,
  136. limit: 10,
  137. list: [],
  138. loadingType: 'more'
  139. };
  140. },
  141. onLoad() {
  142. this.loadData();
  143. this.getProduct()
  144. },
  145. onShow() {
  146. console.log(this.$dsbridge, 'dsbridge+++++++++++++')
  147. },
  148. onHide() {
  149. },
  150. onReachBottom() {
  151. this.getProduct()
  152. },
  153. computed: {
  154. ...mapState('user', ['userInfo'])
  155. },
  156. // 用户下拉刷新
  157. async onPullDownRefresh() {
  158. this.page = 1
  159. this.loadingType = 'more'
  160. this.list = []
  161. await this.getProduct()
  162. uni.stopPullDownRefresh()
  163. },
  164. methods: {
  165. openGg() {
  166. console.log(this.$dsbridge,'this.$dsbridge')
  167. this.$dsbridge.call("fnAds.onShowRewardVideoAD", {}, function(result) {
  168. // alert(result);
  169. // 奖励状态返回
  170. // if(result.event)
  171. let res = JSON.parse(result)
  172. if(res.event == 'onReward') {
  173. advertisement({
  174. task:'1'
  175. }).then(e => {
  176. // alert('已观看')
  177. // alert('奖励已发放')
  178. // uni.showToast({
  179. // title:'奖励已发放',
  180. // duration:2000
  181. // });
  182. }).catch(err => {
  183. })
  184. }
  185. });
  186. },
  187. goCp() {
  188. window.location.href='http://web.mall.hqgjsmc.com/'
  189. },
  190. gozx() {
  191. window.location.href='https://chen.ningjuwang.com/shop/wap/27x50ex0ep39-qfKx#/index?preview_template_id=19&preview_page_id=190&preview_template_type=1'
  192. },
  193. swiperChange() {
  194. },
  195. loadData() {
  196. loadIndexs({})
  197. .then(({
  198. data
  199. }) => {
  200. let goods = data.info;
  201. this.dataList = goods.bastList; //精品推荐
  202. this.carouselList = data.banner;
  203. })
  204. .catch(e => {});
  205. },
  206. nav(url) {
  207. uni.navigateTo({
  208. url,
  209. fail() {
  210. uni.switchTab({
  211. url
  212. });
  213. }
  214. });
  215. },
  216. // 點擊搜索框
  217. clickSearch() {
  218. uni.navigateTo({
  219. url: '/pages/product/search'
  220. });
  221. },
  222. // getProduct
  223. getProduct() {
  224. let obj = this
  225. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  226. return
  227. }
  228. obj.loadingType = 'loading'
  229. groom1({
  230. page: obj.page,
  231. limit: obj.limit
  232. }).then(res => {
  233. console.log(res)
  234. obj.list = obj.list.concat(res.data.list)
  235. obj.page++
  236. if (obj.limit == res.data.length) {
  237. obj.loadingType = 'more'
  238. } else {
  239. obj.loadingType = 'noMore'
  240. }
  241. })
  242. }
  243. }
  244. };
  245. </script>
  246. <style lang="scss">
  247. page,
  248. .center {
  249. min-height: 100%;
  250. height: auto;
  251. background: #fff;
  252. }
  253. // 顶部搜索
  254. .top-search {
  255. height: 80rpx;
  256. // padding: 0 20rpx;
  257. background-color: #338fc0;
  258. justify-content: center;
  259. .search-box {
  260. justify-content: center;
  261. width: 700rpx;
  262. height: 60rpx;
  263. background: #fff;
  264. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  265. border-radius: 30rpx;
  266. .search {
  267. width: 34rpx;
  268. height: 34rpx;
  269. }
  270. .search-font {
  271. margin-left: 14rpx;
  272. font-size: 28rpx;
  273. font-family: PingFang SC;
  274. font-weight: 500;
  275. color: #CBCBCB;
  276. }
  277. }
  278. }
  279. // 顶部轮播图
  280. .swiper-wrap {
  281. width: 750rpx;
  282. background-color: #338fc0;
  283. .top-swiper {
  284. width: 700rpx;
  285. height: 350rpx;
  286. margin: auto;
  287. border-radius: 20rpx;
  288. image {
  289. width: 700rpx;
  290. height: 350rpx;
  291. border-radius: 20rpx;
  292. }
  293. }
  294. }
  295. .swiper-btm {
  296. height: 60rpx;
  297. width: 750rpx;
  298. background-color: #fff;
  299. margin-bottom: 20rpx;
  300. font-size: 21rpx;
  301. font-weight: 500;
  302. color: #333333;
  303. .btm-item {
  304. flex-grow: 1;
  305. justify-content: center;
  306. image {
  307. width: 25rpx;
  308. height: 25rpx;
  309. margin-right: 14rpx;
  310. }
  311. }
  312. }
  313. .jg {
  314. height: 20rpx;
  315. background-color:#338fc0;
  316. }
  317. .status_bar {
  318. height: var(--status-bar-height);
  319. width: 100%;
  320. background:#338fc0;
  321. }
  322. // 分类
  323. .cate-section {
  324. justify-content: space-around;
  325. background-color: #fff;
  326. padding: 0rpx 0 30rpx;
  327. background: #338fc0;
  328. .cate-item {
  329. flex-grow: 0;
  330. width: 20%;
  331. flex-direction: column;
  332. text-align: center;
  333. align-items: center;
  334. justify-content: center;
  335. .img-wrapper {
  336. width: 90rpx;
  337. height: 90rpx;
  338. border-radius: 20rpx;
  339. position: relative;
  340. image {
  341. width: 90rpx;
  342. height: 90rpx;
  343. position: absolute;
  344. left: 50%;
  345. top: 50%;
  346. transform: translate(-50%, -50%);
  347. }
  348. }
  349. .item-title {
  350. margin-top: 15rpx;
  351. font-size: 26rpx;
  352. font-weight: 500;
  353. color: #FFFFFF;
  354. }
  355. }
  356. }
  357. // 专区
  358. .zq-wrap {
  359. height: 345rpx;
  360. width: 750rpx;
  361. background: linear-gradient(180deg, #338fc0, #fff);
  362. padding: 0 27rpx;
  363. .zq-item {
  364. width: 342rpx;
  365. height: 300rpx;
  366. background: linear-gradient(180deg, #fc2f40, #fb829e);
  367. border-radius: 20rpx;
  368. box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
  369. position: relative;
  370. .zq-tit {
  371. padding: 15rpx 0 0 20rpx;
  372. font-size: 32rpx;
  373. font-weight: bold;
  374. font-style: italic;
  375. color: #FFFFFF;
  376. }
  377. .item-info {
  378. position: absolute;
  379. bottom: 8rpx;
  380. left: 0;
  381. right: 0;
  382. margin: auto;
  383. width: 324rpx;
  384. height: 232rpx;
  385. background: #FFFFFF;
  386. border-radius: 20rpx;
  387. flex-direction: column;
  388. justify-content: center;
  389. align-items: center;
  390. image {
  391. width: 294rpx;
  392. height: 160rpx;
  393. }
  394. .info-tit {
  395. margin-top: 12rpx;
  396. width: 189rpx;
  397. height: 36rpx;
  398. image {
  399. width: 189rpx;
  400. }
  401. }
  402. }
  403. }
  404. .bd {
  405. background: linear-gradient(180deg, #ff601a, #feba9d);
  406. }
  407. }
  408. .product-box {
  409. margin-top: 20rpx;
  410. background: #ffffff;
  411. padding: 26rpx 20rpx 20rpx;
  412. .product-tit {
  413. justify-content: center;
  414. .hx {
  415. width: 120rpx;
  416. height: 1rpx;
  417. background: #989898;
  418. }
  419. .tit {
  420. margin: 0 70rpx;
  421. font-size: 30rpx;
  422. font-weight: 500;
  423. color: #363636;
  424. }
  425. }
  426. }
  427. .hotgoods {
  428. margin-top: 38rpx;
  429. width: 100%;
  430. display: flex;
  431. flex-wrap: wrap;
  432. padding: 0 0 30rpx;
  433. justify-content: space-between;
  434. .hotgoods-item {
  435. width: 345rpx;
  436. background-color: #ffffff;
  437. border-radius: 12rpx;
  438. box-shadow:0 0 15rpx rgba(0, 0, 0,0.2);
  439. margin-bottom: 15rpx;
  440. .image-wrapper {
  441. width: 345rpx;
  442. height: 345rpx;
  443. border-radius: 3px;
  444. overflow: hidden;
  445. position: relative;
  446. .image-bg {
  447. position: absolute;
  448. top: 0;
  449. left: 0;
  450. right: 0;
  451. bottom: 0;
  452. width: 100%;
  453. height: 100%;
  454. opacity: 1;
  455. border-radius: 12rpx 12rpx 0 0;
  456. z-index: 2;
  457. }
  458. .image {
  459. width: 100%;
  460. height: 100%;
  461. opacity: 1;
  462. border-radius: 12rpx 12rpx 0 0;
  463. }
  464. }
  465. .title {
  466. margin-top: 24rpx;
  467. padding: 0 20rpx;
  468. font-size: 28rpx;
  469. font-family: PingFang SC;
  470. font-weight: 500;
  471. color: #333333;
  472. }
  473. .hot-price {
  474. display: flex;
  475. justify-content: flex-start;
  476. align-items: center;
  477. // padding: 14rpx 0 30rpx;
  478. .hotPrice-box {
  479. padding: 2rpx 6rpx;
  480. background: linear-gradient(90deg, #c79a4c, #f9df7f);
  481. border-radius: 5rpx;
  482. text-align: center;
  483. line-height: 28rpx;
  484. font-size: 20rpx;
  485. font-family: Source Han Sans CN;
  486. font-weight: 400;
  487. color: #ffffff;
  488. }
  489. .price {
  490. margin-left: 10rpx;
  491. font-size: 40rpx;
  492. color: #ff0000;
  493. font-weight: 500;
  494. .jf {
  495. font-size: 20rpx;
  496. }
  497. }
  498. .yuanPrice {
  499. margin-left: 10rpx;
  500. font-size: 20rpx;
  501. font-family: PingFang SC;
  502. font-weight: 500;
  503. text-decoration: line-through;
  504. color: #999999;
  505. }
  506. .cart-icon {
  507. image {
  508. width: 44rpx;
  509. height: 44rpx;
  510. }
  511. }
  512. }
  513. }
  514. }
  515. </style>