index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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">{{$t(`大家都在换`)}}</text>
  25. <text class="jump-trip" @click="jumpMore">{{$t(`查看更多`)}}
  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 }} {{$t(`积分`)}}
  35. </view>
  36. <view class="sales">{{item.sales}}{{$t(`人兑换`)}}</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">{{$t(`暂无商品,去看点别的吧`)}}</view>
  43. </view>
  44. <view class="footer">
  45. <view class="body-title">
  46. <text class="title">{{$t(`轻松赚积分`)}}</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. {{$t(`购买商品`)}}
  55. </view>
  56. <view class="trip">
  57. {{$t(`购买商品可获得积分奖励`)}}
  58. </view>
  59. </view>
  60. </view>
  61. <navigator url="/pages/index/index" open-type="switchTab" class="right-box">
  62. <text class="go-jump">
  63. {{$t(`去完成`)}}
  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. {{$t(`每日签到活动`)}}
  73. </view>
  74. <view class="trip">
  75. {{$t(`每日签到可获得积分奖励`)}}
  76. </view>
  77. </view>
  78. </view>
  79. <navigator url="/pages/users/user_sgin/index" class="right-box">
  80. <text class="go-jump">
  81. {{$t(`去完成`)}}
  82. </text>
  83. </navigator>
  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. {{$t(`九宫格抽奖活动`)}}
  91. </view>
  92. <view class="trip">
  93. {{$t(`幸运抽奖可获得积分奖励`)}}
  94. </view>
  95. </view>
  96. </view>
  97. <navigator url="/pages/goods/lottery/grids/index?type=1" class="right-box">
  98. <text class="go-jump">
  99. {{$t(`去完成`)}}
  100. </text>
  101. </navigator>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. // import swipers from './components/swiper.vue';
  109. import {
  110. mapGetters
  111. } from 'vuex';
  112. import {
  113. getStoreIntegral
  114. } from '@/api/points_mall.js'
  115. import {
  116. goShopDetail
  117. } from '@/libs/order.js';
  118. import colors from "@/mixins/color";
  119. import {
  120. HTTP_REQUEST_URL
  121. } from '@/config/app';
  122. export default {
  123. components: {
  124. // swipers
  125. },
  126. mixins: [colors],
  127. data() {
  128. return {
  129. imgHost: HTTP_REQUEST_URL,
  130. autoplay: true,
  131. circular: true,
  132. interval: 3000,
  133. duration: 500,
  134. imgUrls: [],
  135. goodList: [],
  136. modelList: [{
  137. title: this.$t(`我的积分`),
  138. imgUrl: './static/my-point.png',
  139. url: "/pages/users/user_integral/index"
  140. },
  141. {
  142. title: this.$t(`每日签到`),
  143. imgUrl: './static/sign-in.png',
  144. url: '/pages/users/user_sgin/index'
  145. }, {
  146. title: this.$t(`积分抽奖`),
  147. imgUrl: './static/points-lottery.png',
  148. url: '/pages/goods/lottery/grids/index?type=1'
  149. }, {
  150. title: this.$t(`兑换记录`),
  151. imgUrl: './static/exchange.png',
  152. url: "/pages/points_mall/exchange_record"
  153. },
  154. ]
  155. }
  156. },
  157. computed: mapGetters(['isLogin']),
  158. onLoad() {
  159. this.getStoreIntegral()
  160. },
  161. watch: {
  162. isLogin: {
  163. handler: function(newV, oldV) {
  164. if (newV == true) {
  165. this.getStoreIntegral();
  166. }
  167. },
  168. deep: true
  169. },
  170. },
  171. methods: {
  172. getStoreIntegral() {
  173. getStoreIntegral().then(res => {
  174. this.imgUrls = res.data.banner
  175. this.goodList = res.data.list
  176. })
  177. },
  178. // 去商品详情
  179. goGoodsDetail(item) {
  180. goShopDetail(item).then(res => {
  181. uni.navigateTo({
  182. url: `/pages/points_mall/integral_goods_details?id=${item.id}`
  183. });
  184. });
  185. },
  186. jumpMore() {
  187. uni.navigateTo({
  188. url: '/pages/points_mall/integral_goods_list'
  189. })
  190. },
  191. goPages(item) {
  192. let url = item.link;
  193. this.$util.JumpPath(url);
  194. },
  195. jump(url) {
  196. uni.navigateTo({
  197. url
  198. })
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. .swiper,
  205. swiper,
  206. swiper-item,
  207. .slide-image {
  208. width: 100%;
  209. height: 280rpx;
  210. }
  211. /deep/ .uni-swiper-wrapper {
  212. border-radius: 10rpx;
  213. }
  214. .swiper {
  215. padding: 20rpx;
  216. }
  217. .points-swiper {
  218. position: relative;
  219. width: 100%;
  220. background-color: #fff;
  221. .bag {
  222. position: absolute;
  223. width: 100%;
  224. height: 285rpx;
  225. }
  226. .points-swiper-sty {
  227. padding: 20rpx 26rpx;
  228. }
  229. }
  230. .model {
  231. display: flex;
  232. justify-content: space-between;
  233. padding: 56rpx 42rpx;
  234. background-color: #fff;
  235. }
  236. .model-list {
  237. display: flex;
  238. flex-direction: column;
  239. align-items: center;
  240. justify-content: center;
  241. font-size: 26rpx;
  242. color: #333;
  243. margin-top: 27rpx;
  244. font-weight: 500;
  245. .img {
  246. width: 84rpx;
  247. height: 84rpx;
  248. margin-bottom: 19rpx;
  249. }
  250. }
  251. .body {
  252. background-color: #fff;
  253. padding: 0 30rpx;
  254. margin-top: 20rpx;
  255. .body-title {
  256. display: flex;
  257. justify-content: space-between;
  258. padding: 30rpx 0 10rpx 0;
  259. .title {
  260. font-size: 32rpx;
  261. font-family: PingFang SC;
  262. font-weight: bold;
  263. }
  264. .jump-trip,
  265. .icon-xiangyou {
  266. font-size: 24rpx;
  267. color: #999999;
  268. }
  269. }
  270. .product-list {
  271. display: flex;
  272. flex-wrap: wrap;
  273. justify-content: space-between;
  274. margin-top: 30rpx;
  275. .product-item {
  276. position: relative;
  277. width: 334rpx;
  278. background: #fff;
  279. border-radius: 10rpx;
  280. margin-bottom: 20rpx;
  281. box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.06);
  282. image {
  283. width: 100%;
  284. height: 344rpx;
  285. border-radius: 10rpx 10rpx 0 0;
  286. }
  287. .info {
  288. padding: 14rpx 16rpx;
  289. .title {
  290. font-size: 28rpx;
  291. }
  292. .price-box {
  293. font-size: 26rpx;
  294. font-weight: 700;
  295. margin-top: 8px;
  296. color: var(--view-theme);
  297. }
  298. .sales {
  299. font-size: 22rpx;
  300. color: #999999;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. .footer {
  307. margin-top: 20rpx;
  308. .footer-list {
  309. display: flex;
  310. justify-content: space-between;
  311. padding: 26rpx 0;
  312. .list-left {
  313. display: flex;
  314. align-items: center;
  315. .icon-sty {
  316. width: 80rpx;
  317. height: 80rpx;
  318. margin-right: 18rpx;
  319. }
  320. .list-left-right {
  321. .title {
  322. font-size: 28rpx;
  323. font-weight: bold;
  324. color: #333333;
  325. }
  326. .trip {
  327. font-size: 22rpx;
  328. color: #999999;
  329. }
  330. }
  331. }
  332. .right-box {
  333. display: flex;
  334. align-items: center;
  335. }
  336. .go-jump {
  337. display: flex;
  338. align-items: center;
  339. background-color: #E93323;
  340. border-radius: 26rpx;
  341. color: #fff;
  342. font-size: 28rpx;
  343. height: 48rpx;
  344. line-height: 48rpx;
  345. padding: 6rpx 24rpx;
  346. }
  347. }
  348. }
  349. .no-goods {
  350. display: flex;
  351. flex-direction: column;
  352. height: 472rpx;
  353. image {
  354. width: 100%;
  355. display: block;
  356. margin: 0 auto;
  357. }
  358. .fontimg {
  359. text-align: center;
  360. color: #bebebe;
  361. }
  362. }
  363. </style>