index.vue 8.6 KB

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