index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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. // #ifndef MP
  215. toLogin()
  216. // #endif
  217. // #ifdef MP
  218. this.isShowAuth = true;
  219. // #endif
  220. },
  221. jump(url) {
  222. if(this.isLogin){
  223. uni.navigateTo({
  224. url
  225. })
  226. }else{
  227. this.getIsLogin();
  228. }
  229. }
  230. }
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .swiper,
  235. swiper,
  236. swiper-item,
  237. .slide-image {
  238. width: 100%;
  239. height: 280rpx;
  240. }
  241. /deep/ .uni-swiper-wrapper {
  242. border-radius: 10rpx;
  243. }
  244. .swiper {
  245. padding: 40rpx;
  246. }
  247. .points-swiper {
  248. position: relative;
  249. width: 100%;
  250. background-color: #fff;
  251. .bag {
  252. position: absolute;
  253. width: 100%;
  254. height: 285rpx;
  255. }
  256. .points-swiper-sty {
  257. padding: 20rpx 26rpx;
  258. }
  259. }
  260. .model {
  261. display: flex;
  262. justify-content: space-between;
  263. padding: 56rpx 42rpx;
  264. background-color: #fff;
  265. }
  266. .model-list {
  267. display: flex;
  268. flex-direction: column;
  269. align-items: center;
  270. justify-content: center;
  271. font-size: 26rpx;
  272. color: #333;
  273. margin-top: 27rpx;
  274. font-weight: 500;
  275. .img {
  276. width: 84rpx;
  277. height: 84rpx;
  278. margin-bottom: 19rpx;
  279. }
  280. }
  281. .body {
  282. background-color: #fff;
  283. padding: 0 30rpx;
  284. margin-top: 20rpx;
  285. .body-title {
  286. display: flex;
  287. justify-content: space-between;
  288. padding: 30rpx 0 10rpx 0;
  289. .title {
  290. font-size: 32rpx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. }
  294. .jump-trip,
  295. .icon-xiangyou {
  296. font-size: 24rpx;
  297. color: #999999;
  298. }
  299. }
  300. .product-list {
  301. display: flex;
  302. flex-wrap: wrap;
  303. justify-content: space-between;
  304. margin-top: 30rpx;
  305. .product-item {
  306. position: relative;
  307. width: 334rpx;
  308. background: #fff;
  309. border-radius: 10rpx;
  310. margin-bottom: 20rpx;
  311. box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.06);
  312. image {
  313. width: 100%;
  314. height: 344rpx;
  315. border-radius: 10rpx 10rpx 0 0;
  316. }
  317. .info {
  318. padding: 14rpx 16rpx;
  319. .title {
  320. font-size: 28rpx;
  321. }
  322. .price-box {
  323. font-size: 26rpx;
  324. font-weight: 500;
  325. margin-top: 10rpx;
  326. color: var(--view-theme);
  327. }
  328. .sales {
  329. font-size: 22rpx;
  330. color: #999999;
  331. margin-top: 6rpx;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. .footer {
  338. margin-top: 20rpx;
  339. .footer-list {
  340. display: flex;
  341. justify-content: space-between;
  342. padding: 26rpx 0;
  343. .list-left {
  344. display: flex;
  345. align-items: center;
  346. .icon-sty {
  347. width: 80rpx;
  348. height: 80rpx;
  349. margin-right: 18rpx;
  350. }
  351. .list-left-right {
  352. .title {
  353. font-size: 28rpx;
  354. font-weight: bold;
  355. color: #333333;
  356. }
  357. .trip {
  358. font-size: 22rpx;
  359. color: #999999;
  360. }
  361. }
  362. }
  363. .go-jump {
  364. display: flex;
  365. align-items: center;
  366. background-color: #E93323;
  367. border-radius: 40rpx;
  368. color: #fff;
  369. font-size: 28rpx;
  370. height: 48rpx;
  371. line-height: 48rpx;
  372. padding: 6rpx 24rpx;
  373. }
  374. }
  375. }
  376. .no-goods {
  377. display: flex;
  378. flex-direction: column;
  379. height: 472rpx;
  380. image{
  381. width: 100%;
  382. display: block;
  383. margin: 0 auto;
  384. }
  385. .fontimg{
  386. text-align: center;
  387. color: #bebebe;
  388. }
  389. }
  390. </style>