index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="points-swiper">
  4. <image class="bag" src="../../static/images/jf-head.png" mode=""></image>
  5. <view class="swiper">
  6. <swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval"
  7. :duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  8. <block v-for="(item, index) in imgUrls" :key="index">
  9. <swiper-item>
  10. <image :src="item.img" class="slide-image" @click="goPages(item)"></image>
  11. </swiper-item>
  12. </block>
  13. </swiper>
  14. </view>
  15. </view>
  16. <view class="model">
  17. <view class="model-list" v-for="(model,index) in modelList" :key="index" @click="jump(model.url)">
  18. <image class="img" :src="model.imgUrl" mode=""></image>
  19. <text>{{model.title}}</text>
  20. </view>
  21. </view>
  22. <view class="body">
  23. <view class="body-title">
  24. <text class="title">大家都在换</text>
  25. <text class="jump-trip" @click="jumpMore">查看更多
  26. <text class="iconfont icon-xiangyou"></text></text>
  27. </view>
  28. <view class="product-list" v-if="goodList.length">
  29. <view class="product-item" v-for="(item, index) in goodList" @click="goGoodsDetail(item)">
  30. <image :src="item.image"></image>
  31. <view class="info">
  32. <view class="title line1">{{ item.title }}</view>
  33. <view class="price-box">
  34. {{ item.price }}积分
  35. </view>
  36. <view class="sales">{{item.sales}}人兑换</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view v-else class="no-goods">
  41. <image :src="imgHost + '/statics/images/no-thing.png'" mode=""></image>
  42. <view class="fontimg">暂无商品,去看点别的吧</view>
  43. </view>
  44. <view class="footer">
  45. <view class="body-title">
  46. <text class="title">轻松赚积分</text>
  47. <text></text>
  48. </view>
  49. <view class="footer-list">
  50. <view class="list-left">
  51. <image class="icon-sty" src="static/go-shoping.png" mode=""></image>
  52. <view class="list-left-right">
  53. <view class="title">
  54. 购买商品
  55. </view>
  56. <view class="trip">
  57. 购买商品可获得积分奖励
  58. </view>
  59. </view>
  60. </view>
  61. <navigator url="/pages/index/index" open-type="switchTab">
  62. <text class="go-jump">
  63. 去完成
  64. </text>
  65. </navigator>
  66. </view>
  67. <view class="footer-list">
  68. <view class="list-left">
  69. <image class="icon-sty" src="static/everyday.png" mode=""></image>
  70. <view class="list-left-right">
  71. <view class="title">
  72. 每日签到活动
  73. </view>
  74. <view class="trip">
  75. 每日签到可获得积分奖励
  76. </view>
  77. </view>
  78. </view>
  79. <view @click="jump('/pages/users/user_sgin/index')">
  80. <text class="go-jump">
  81. 去完成
  82. </text>
  83. </view>
  84. </view>
  85. <view class="footer-list">
  86. <view class="list-left">
  87. <image class="icon-sty" src="static/luck-draw.png" mode=""></image>
  88. <view class="list-left-right">
  89. <view class="title">
  90. 九宫格抽奖活动
  91. </view>
  92. <view class="trip">
  93. 幸运抽奖可获得积分奖励
  94. </view>
  95. </view>
  96. </view>
  97. <view @click="jump('/pages/goods/lottery/grids/index?type=1')">
  98. <text class="go-jump">
  99. 去完成
  100. </text>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- #ifdef MP -->
  106. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  107. <!-- #endif -->
  108. </view>
  109. </template>
  110. <script>
  111. // import swipers from './components/swiper.vue';
  112. import {
  113. toLogin
  114. } from '@/libs/login.js';
  115. import {
  116. mapGetters
  117. } from 'vuex';
  118. import {
  119. getStoreIntegral
  120. } from '@/api/points_mall.js'
  121. import {
  122. goShopDetail
  123. } from '@/libs/order.js';
  124. import colors from "@/mixins/color";
  125. import {HTTP_REQUEST_URL} from '@/config/app';
  126. export default {
  127. components: {
  128. // swipers
  129. },
  130. mixins: [colors],
  131. data() {
  132. return {
  133. autoplay: true,
  134. circular: true,
  135. interval: 3000,
  136. duration: 500,
  137. imgUrls: [],
  138. goodList: [],
  139. modelList: [{
  140. title: '我的积分',
  141. imgUrl: 'static/my-point.png',
  142. url: "/pages/users/user_integral/index"
  143. },
  144. {
  145. title: '每日签到',
  146. imgUrl: 'static/sign-in.png',
  147. url: '/pages/users/user_sgin/index'
  148. }, {
  149. title: '积分抽奖',
  150. imgUrl: 'static/points-lottery.png',
  151. url: '/pages/goods/lottery/grids/index?type=1'
  152. }, {
  153. title: '兑换记录',
  154. imgUrl: 'static/exchange.png',
  155. url: "/pages/points_mall/exchange_record"
  156. },
  157. ],
  158. imgHost:HTTP_REQUEST_URL,
  159. isShowAuth: false
  160. }
  161. },
  162. computed: mapGetters(['isLogin']),
  163. onLoad() {
  164. this.getStoreIntegral()
  165. },
  166. watch: {
  167. isLogin: {
  168. handler: function(newV, oldV) {
  169. if (newV == true) {
  170. // this.getStoreIntegral();
  171. }
  172. },
  173. deep: true
  174. },
  175. },
  176. onShow(){
  177. uni.removeStorageSync('form_type_cart');
  178. },
  179. methods: {
  180. // 授权回调
  181. onLoadFun() {
  182. this.isShowAuth = false;
  183. },
  184. // 授权关闭
  185. authColse: function(e) {
  186. this.isShowAuth = e
  187. },
  188. getStoreIntegral() {
  189. getStoreIntegral().then(res => {
  190. this.imgUrls = res.data.banner
  191. this.goodList = res.data.list
  192. })
  193. },
  194. // 去商品详情
  195. goGoodsDetail(item) {
  196. goShopDetail(item).then(res => {
  197. uni.navigateTo({
  198. url: `/pages/points_mall/integral_goods_details?id=${item.id}`
  199. });
  200. });
  201. },
  202. jumpMore() {
  203. uni.navigateTo({
  204. url: '/pages/points_mall/integral_goods_list'
  205. })
  206. },
  207. goPages(item) {
  208. let url = item.link;
  209. if (url.indexOf("http") != -1) {
  210. // #ifdef H5
  211. location.href = url
  212. // #endif
  213. } else {
  214. if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart', '/pages/user/index', '/pages/index/index','/pages/store_cate/store_cate']
  215. .indexOf(url) == -1) {
  216. uni.navigateTo({
  217. url: url
  218. })
  219. } else {
  220. uni.switchTab({
  221. url: url
  222. })
  223. }
  224. }
  225. },
  226. getIsLogin(){
  227. // #ifndef MP
  228. toLogin()
  229. // #endif
  230. // #ifdef MP
  231. this.isShowAuth = true;
  232. // #endif
  233. },
  234. jump(url) {
  235. if(this.isLogin){
  236. uni.navigateTo({
  237. url
  238. })
  239. }else{
  240. this.getIsLogin();
  241. }
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. .swiper,
  248. swiper,
  249. swiper-item,
  250. .slide-image {
  251. width: 100%;
  252. height: 280rpx;
  253. }
  254. /deep/ .uni-swiper-wrapper {
  255. border-radius: 10rpx;
  256. }
  257. .swiper {
  258. padding: 40rpx;
  259. }
  260. .points-swiper {
  261. position: relative;
  262. width: 100%;
  263. background-color: #fff;
  264. .bag {
  265. position: absolute;
  266. width: 100%;
  267. height: 285rpx;
  268. }
  269. .points-swiper-sty {
  270. padding: 20rpx 26rpx;
  271. }
  272. }
  273. .model {
  274. display: flex;
  275. justify-content: space-between;
  276. padding: 56rpx 42rpx;
  277. background-color: #fff;
  278. }
  279. .model-list {
  280. display: flex;
  281. flex-direction: column;
  282. align-items: center;
  283. justify-content: center;
  284. font-size: 26rpx;
  285. color: #333;
  286. margin-top: 27rpx;
  287. font-weight: 500;
  288. .img {
  289. width: 84rpx;
  290. height: 84rpx;
  291. margin-bottom: 19rpx;
  292. }
  293. }
  294. .body {
  295. background-color: #fff;
  296. padding: 0 30rpx;
  297. margin-top: 20rpx;
  298. .body-title {
  299. display: flex;
  300. justify-content: space-between;
  301. padding: 30rpx 0 10rpx 0;
  302. .title {
  303. font-size: 32rpx;
  304. font-family: PingFang SC;
  305. font-weight: bold;
  306. }
  307. .jump-trip,
  308. .icon-xiangyou {
  309. font-size: 24rpx;
  310. color: #999999;
  311. }
  312. }
  313. .product-list {
  314. display: flex;
  315. flex-wrap: wrap;
  316. justify-content: space-between;
  317. margin-top: 30rpx;
  318. .product-item {
  319. position: relative;
  320. width: 334rpx;
  321. background: #fff;
  322. border-radius: 10rpx;
  323. margin-bottom: 20rpx;
  324. box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.06);
  325. image {
  326. width: 100%;
  327. height: 344rpx;
  328. border-radius: 10rpx 10rpx 0 0;
  329. }
  330. .info {
  331. padding: 14rpx 16rpx;
  332. .title {
  333. font-size: 28rpx;
  334. }
  335. .price-box {
  336. font-size: 26rpx;
  337. font-weight: 700;
  338. margin-top: 8px;
  339. color: var(--view-theme);
  340. }
  341. .sales {
  342. font-size: 22rpx;
  343. color: #999999;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. .footer {
  350. margin-top: 20rpx;
  351. .footer-list {
  352. display: flex;
  353. justify-content: space-between;
  354. padding: 26rpx 0;
  355. .list-left {
  356. display: flex;
  357. align-items: center;
  358. .icon-sty {
  359. width: 80rpx;
  360. height: 80rpx;
  361. margin-right: 18rpx;
  362. }
  363. .list-left-right {
  364. .title {
  365. font-size: 28rpx;
  366. font-weight: bold;
  367. color: #333333;
  368. }
  369. .trip {
  370. font-size: 22rpx;
  371. color: #999999;
  372. }
  373. }
  374. }
  375. .go-jump {
  376. display: flex;
  377. align-items: center;
  378. background-color: #E93323;
  379. border-radius: 26rpx;
  380. color: #fff;
  381. font-size: 28rpx;
  382. height: 48rpx;
  383. line-height: 48rpx;
  384. padding: 6rpx 24rpx;
  385. }
  386. }
  387. }
  388. .no-goods {
  389. display: flex;
  390. flex-direction: column;
  391. height: 472rpx;
  392. image{
  393. width: 100%;
  394. display: block;
  395. margin: 0 auto;
  396. }
  397. .fontimg{
  398. text-align: center;
  399. color: #bebebe;
  400. }
  401. }
  402. </style>