index.vue 13 KB

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