index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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 {HTTP_REQUEST_URL} from '@/config/app';
  120. export default {
  121. components: {
  122. // swipers
  123. },
  124. mixins: [colors],
  125. data() {
  126. return {
  127. imgHost:HTTP_REQUEST_URL,
  128. autoplay: true,
  129. circular: true,
  130. interval: 3000,
  131. duration: 500,
  132. imgUrls: [],
  133. goodList: [],
  134. modelList: [{
  135. title: this.$t(`我的积分`),
  136. imgUrl: './static/my-point.png',
  137. url: "/pages/users/user_integral/index"
  138. },
  139. {
  140. title: this.$t(`每日签到`),
  141. imgUrl: './static/sign-in.png',
  142. url: '/pages/users/user_sgin/index'
  143. }, {
  144. title: this.$t(`积分抽奖`),
  145. imgUrl: './static/points-lottery.png',
  146. url: '/pages/goods/lottery/grids/index?type=1'
  147. }, {
  148. title: this.$t(`兑换记录`),
  149. imgUrl: './static/exchange.png',
  150. url: "/pages/points_mall/exchange_record"
  151. },
  152. ]
  153. }
  154. },
  155. computed: mapGetters(['isLogin']),
  156. onLoad() {
  157. this.getStoreIntegral()
  158. },
  159. watch: {
  160. isLogin: {
  161. handler: function(newV, oldV) {
  162. if (newV == true) {
  163. this.getStoreIntegral();
  164. }
  165. },
  166. deep: true
  167. },
  168. },
  169. methods: {
  170. getStoreIntegral() {
  171. getStoreIntegral().then(res => {
  172. this.imgUrls = res.data.banner
  173. this.goodList = res.data.list
  174. })
  175. },
  176. // 去商品详情
  177. goGoodsDetail(item) {
  178. goShopDetail(item).then(res => {
  179. uni.navigateTo({
  180. url: `/pages/points_mall/integral_goods_details?id=${item.id}`
  181. });
  182. });
  183. },
  184. jumpMore() {
  185. uni.navigateTo({
  186. url: '/pages/points_mall/integral_goods_list'
  187. })
  188. },
  189. goPages(item) {
  190. let url = item.link;
  191. if (url.indexOf("http") != -1) {
  192. // #ifdef H5
  193. location.href = url
  194. // #endif
  195. } else {
  196. if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart', '/pages/user/index',
  197. '/pages/index/index'
  198. ]
  199. .indexOf(url) == -1) {
  200. uni.navigateTo({
  201. url: url
  202. })
  203. } else {
  204. uni.switchTab({
  205. url: url
  206. })
  207. }
  208. }
  209. },
  210. jump(url) {
  211. uni.navigateTo({
  212. url
  213. })
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .swiper,
  220. swiper,
  221. swiper-item,
  222. .slide-image {
  223. width: 100%;
  224. height: 280rpx;
  225. }
  226. /deep/ .uni-swiper-wrapper {
  227. border-radius: 10rpx;
  228. }
  229. .swiper {
  230. padding: 20rpx;
  231. }
  232. .points-swiper {
  233. position: relative;
  234. width: 100%;
  235. background-color: #fff;
  236. .bag {
  237. position: absolute;
  238. width: 100%;
  239. height: 285rpx;
  240. }
  241. .points-swiper-sty {
  242. padding: 20rpx 26rpx;
  243. }
  244. }
  245. .model {
  246. display: flex;
  247. justify-content: space-between;
  248. padding: 56rpx 42rpx;
  249. background-color: #fff;
  250. }
  251. .model-list {
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. justify-content: center;
  256. font-size: 26rpx;
  257. color: #333;
  258. margin-top: 27rpx;
  259. font-weight: 500;
  260. .img {
  261. width: 84rpx;
  262. height: 84rpx;
  263. margin-bottom: 19rpx;
  264. }
  265. }
  266. .body {
  267. background-color: #fff;
  268. padding: 0 30rpx;
  269. margin-top: 20rpx;
  270. .body-title {
  271. display: flex;
  272. justify-content: space-between;
  273. padding: 30rpx 0 10rpx 0;
  274. .title {
  275. font-size: 32rpx;
  276. font-family: PingFang SC;
  277. font-weight: bold;
  278. }
  279. .jump-trip,
  280. .icon-xiangyou {
  281. font-size: 24rpx;
  282. color: #999999;
  283. }
  284. }
  285. .product-list {
  286. display: flex;
  287. flex-wrap: wrap;
  288. justify-content: space-between;
  289. margin-top: 30rpx;
  290. .product-item {
  291. position: relative;
  292. width: 334rpx;
  293. background: #fff;
  294. border-radius: 10rpx;
  295. margin-bottom: 20rpx;
  296. box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.06);
  297. image {
  298. width: 100%;
  299. height: 344rpx;
  300. border-radius: 10rpx 10rpx 0 0;
  301. }
  302. .info {
  303. padding: 14rpx 16rpx;
  304. .title {
  305. font-size: 28rpx;
  306. }
  307. .price-box {
  308. font-size: 26rpx;
  309. font-weight: 700;
  310. margin-top: 8px;
  311. color: var(--view-theme);
  312. }
  313. .sales {
  314. font-size: 22rpx;
  315. color: #999999;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. .footer {
  322. margin-top: 20rpx;
  323. .footer-list {
  324. display: flex;
  325. justify-content: space-between;
  326. padding: 26rpx 0;
  327. .list-left {
  328. display: flex;
  329. align-items: center;
  330. .icon-sty {
  331. width: 80rpx;
  332. height: 80rpx;
  333. margin-right: 18rpx;
  334. }
  335. .list-left-right {
  336. .title {
  337. font-size: 28rpx;
  338. font-weight: bold;
  339. color: #333333;
  340. }
  341. .trip {
  342. font-size: 22rpx;
  343. color: #999999;
  344. }
  345. }
  346. }
  347. .right-box {
  348. display: flex;
  349. align-items: center;
  350. }
  351. .go-jump {
  352. display: flex;
  353. align-items: center;
  354. background-color: #E93323;
  355. border-radius: 26rpx;
  356. color: #fff;
  357. font-size: 28rpx;
  358. height: 48rpx;
  359. line-height: 48rpx;
  360. padding: 6rpx 24rpx;
  361. }
  362. }
  363. }
  364. .no-goods {
  365. display: flex;
  366. flex-direction: column;
  367. height: 472rpx;
  368. image {
  369. width: 100%;
  370. display: block;
  371. margin: 0 auto;
  372. }
  373. .fontimg {
  374. text-align: center;
  375. color: #bebebe;
  376. }
  377. }
  378. </style>