index.vue 8.5 KB

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