index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <view :style="colorStyle">
  3. <!-- #ifdef MP || APP-PLUS -->
  4. <view class="accountTitle">
  5. <view :style="{height:sysHeight * 2 + 'rpx'}"></view>
  6. <view class="sysTitle h-80 flex-center">
  7. <view>积分商城</view>
  8. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  9. </view>
  10. </view>
  11. <view :style="{height: (sysHeight + 39) * 2 +'rpx'}"></view>
  12. <!-- #endif -->
  13. <view class="header">
  14. <view class="headerBg">
  15. <view class="pictrue">
  16. <image src="../static/mall03.png"></image>
  17. </view>
  18. <view class="num">当前积分{{integral}}</view>
  19. </view>
  20. <navigator hover-class='none' url='/pages/goods/order_list/index?type=4' class="record acea-row row-center-wrapper">兑换记录</navigator>
  21. </view>
  22. <view class="nav acea-row row-middle row-around">
  23. <navigator hover-class='none' url='/pages/users/user_integral/index' class="item">
  24. <view class="pictrue">
  25. <image src="../static/mall05.png"></image>
  26. </view>
  27. <view>我的积分</view>
  28. </navigator>
  29. <view class="line"></view>
  30. <navigator hover-class='none' url='/pages/users/user_sgin/index' class="item">
  31. <view class="pictrue">
  32. <image src="../static/mall04.png"></image>
  33. </view>
  34. <view>每日签到</view>
  35. </navigator>
  36. <view class="line"></view>
  37. <navigator hover-class='none' url='/pages/goods/lottery/grids/index?type=1' class="item">
  38. <view class="pictrue">
  39. <image src="../static/mall02.png"></image>
  40. </view>
  41. <view>积分抽奖</view>
  42. </navigator>
  43. </view>
  44. <view class="hot" v-if="goodList.length">
  45. <view class="title">热门推荐</view>
  46. <scroll-view scroll-x="true" class="scroll">
  47. <view class="scroll-item" v-for="(item,index) in goodList" :key="index" @click="goGoodsDetail(item)">
  48. <view class="pictrue">
  49. <image :src='item.image'></image>
  50. </view>
  51. <view class="name line1">{{item.title}}</view>
  52. <view class="info">已有{{item.sales}}人兑换</view>
  53. <view class="price-box acea-row row-middle">
  54. <view class="acea-row row-middle" v-if="parseFloat(item.integral)">
  55. <image src="../static/mall05.png"></image>
  56. <text class="font-num">{{ item.integral }}</text>
  57. </view>
  58. <text v-if="parseFloat(item.integral) && parseFloat(item.price)">+</text>
  59. <text v-if="parseFloat(item.price)">
  60. <text class="font-num">{{ item.price }}</text>
  61. <text class="fs-22">元</text>
  62. </text>
  63. </view>
  64. </view>
  65. </scroll-view>
  66. </view>
  67. <view class="body">
  68. <view class="body-title">
  69. <scroll-view scroll-x="true" class="scroll">
  70. <view class="item" :class="index == current?'on':''"
  71. v-for="(item, index) in navList" :key="index"
  72. @click="navTap(item,index)">{{item.value}}{{index?'积分':''}}</view>
  73. </scroll-view>
  74. </view>
  75. <view class="product-list" v-if="integralGood.length">
  76. <view class="product-item" v-for="(item, index) in integralGood" @click="goGoodsDetail(item)">
  77. <easy-loadimage
  78. mode="widthFix"
  79. :image-src="item.image"
  80. width="314rpx"
  81. height="314rpx"
  82. borderRadius="20rpx 20rpx 0 0"></easy-loadimage>
  83. <view class="info">
  84. <view class="title line1">{{ item.title }}</view>
  85. <view class="sales">已有{{item.sales}}人兑换</view>
  86. <view class="price-box acea-row row-middle">
  87. <view class="acea-row row-middle" v-if="parseFloat(item.integral)">
  88. <image src="../static/mall05.png"></image>
  89. <text class="font-num">{{ item.integral }}</text>
  90. </view>
  91. <text v-if="parseFloat(item.integral) && parseFloat(item.price)">+</text>
  92. <text v-if="parseFloat(item.price)">
  93. <text class="font-num">{{ item.price }}</text>
  94. <text class="fs-22">元</text>
  95. </text>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <view v-else class="no-goods">
  101. <emptyPage title="暂无商品,去看看别的吧~" src="/statics/images/noActivity.gif"></emptyPage>
  102. </view>
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  108. import {
  109. toLogin
  110. } from '@/libs/login.js';
  111. import {
  112. mapGetters
  113. } from 'vuex';
  114. import {
  115. getStoreIntegral,
  116. getIntegralCategory,
  117. getStoreIntegralList
  118. } from '@/api/activity.js'
  119. import {
  120. goShopDetail
  121. } from '@/libs/order.js';
  122. import colors from "@/mixins/color";
  123. import {HTTP_REQUEST_URL} from '@/config/app';
  124. import emptyPage from '@/components/emptyPage.vue';
  125. export default {
  126. components: { emptyPage },
  127. mixins: [colors],
  128. data() {
  129. return {
  130. sysHeight,
  131. // #ifdef MP
  132. getHeight: this.$util.getWXStatusHeight(),
  133. // #endif
  134. goodList: [],
  135. navList: [],
  136. current: 0,
  137. where: {
  138. range: '',
  139. page: 1,
  140. limit: 20,
  141. },
  142. integralGood: [],
  143. imgHost: HTTP_REQUEST_URL,
  144. isShowAuth: false,
  145. loadend: false,
  146. loading: false,
  147. loadTitle: '加载更多',
  148. integral: 0
  149. }
  150. },
  151. computed: mapGetters(['isLogin']),
  152. onLoad() {
  153. this.integralCategory();
  154. this.storeIntegralList();
  155. if (this.isLogin) {
  156. this.getStoreIntegral();
  157. } else {
  158. toLogin();
  159. }
  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. onShow(){
  172. uni.removeStorageSync('form_type_cart');
  173. },
  174. onPageScroll(object) {
  175. uni.$emit('scroll');
  176. },
  177. methods: {
  178. // 授权回调
  179. onLoadFun() {
  180. this.isShowAuth = false;
  181. },
  182. // 授权关闭
  183. authColse: function(e) {
  184. this.isShowAuth = e
  185. },
  186. integralCategory(){
  187. getIntegralCategory().then(res=>{
  188. let data = res.data;
  189. data.unshift({
  190. value:'全部'
  191. })
  192. this.navList = data;
  193. }).catch(err=>{
  194. return this.$util.Tips({
  195. title: err
  196. });
  197. })
  198. },
  199. navTap(item,index){
  200. if (this.current === index) return;
  201. this.current = index;
  202. this.where.range = item.value;
  203. this.where.page = 1;
  204. this.loadend = false;
  205. this.$set(this, 'integralGood', []);
  206. this.storeIntegralList();
  207. },
  208. storeIntegralList(){
  209. if (this.loadend) return;
  210. if (this.loading) return;
  211. this.loading = true;
  212. getStoreIntegralList(this.where).then(res=>{
  213. let list = res.data;
  214. this.integralGood.push.apply(this.integralGood, list);
  215. this.loadend = list.length < this.where.limit;
  216. this.loading = false;
  217. this.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  218. this.$set(this, 'integralGood', this.integralGood);
  219. this.where.page = this.where.page + 1;
  220. }).catch(err=>{
  221. this.loading = false;
  222. this.loadTitle = '加载更多';
  223. return this.$util.Tips({
  224. title: err
  225. });
  226. })
  227. },
  228. goarrow(){
  229. uni.navigateBack()
  230. },
  231. getStoreIntegral() {
  232. getStoreIntegral().then(res => {
  233. this.goodList = res.data.list;
  234. this.integral = res.data.integral;
  235. })
  236. },
  237. // 去商品详情
  238. goGoodsDetail(item) {
  239. uni.navigateTo({
  240. url: `/pages/activity/goods_details/index?id=${item.id}&type=4`
  241. });
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. page{
  248. padding-bottom: 40rpx;
  249. }
  250. .accountTitle{
  251. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  252. position: fixed;
  253. left:0;
  254. top:0;
  255. width: 100%;
  256. z-index: 99;
  257. .sysTitle{
  258. width: 100%;
  259. position: relative;
  260. font-weight: 500;
  261. color: #fff;
  262. font-size: 30rpx;
  263. .iconfont{
  264. position: absolute;
  265. font-size: 36rpx;
  266. left:11rpx;
  267. width: 60rpx;
  268. }
  269. }
  270. }
  271. .header{
  272. width: 100%;
  273. height: 400rpx;
  274. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  275. position: relative;
  276. .record{
  277. width: 124rpx;
  278. height: 48rpx;
  279. background-color: rgba(51, 51, 51, 0.2);
  280. border-radius: 50rpx 0 0 50rpx;
  281. font-weight: 400;
  282. color: #FFFFFF;
  283. font-size: 24rpx;
  284. position: absolute;
  285. right: 0;
  286. top:36rpx;
  287. }
  288. &::after{
  289. position: absolute;
  290. content: '';
  291. width: 100%;
  292. height: 105rpx;
  293. background: linear-gradient(180deg, rgba(233,51,35,0) 0%, var(--view-minorColorT) 50%, #F5F5F5 100%);
  294. }
  295. .headerBg{
  296. background-image: url('../static/mall01.png');
  297. background-repeat: no-repeat;
  298. background-size: 100% 100%;
  299. width: 689rpx;
  300. height: 298rpx;
  301. margin: 0 auto;
  302. padding-top: 88rpx;
  303. .pictrue{
  304. width: 345rpx;
  305. height: 76rpx;
  306. image{
  307. width: 100%;
  308. height: 100%;
  309. }
  310. }
  311. .num{
  312. font-size: 26rpx;
  313. font-weight: 400;
  314. color: rgba(255,255,255,0.6);
  315. margin: 4rpx 0 0 12rpx;
  316. }
  317. }
  318. }
  319. .hot{
  320. background-color: #fff;
  321. width: 710rpx;
  322. border-radius: 24rpx;
  323. margin: 20rpx auto 0 auto;
  324. padding: 32rpx 0 20rpx 32rpx;
  325. .title{
  326. font-weight: 600;
  327. color: #333333;
  328. font-size: 32rpx;
  329. }
  330. .scroll{
  331. white-space: nowrap;
  332. margin-top: 26rpx;
  333. .scroll-item{
  334. display: inline-block;
  335. width: 224rpx;
  336. margin-right: 20rpx;
  337. vertical-align: top;
  338. .pictrue{
  339. width: 100%;
  340. height: 224rpx;
  341. image{
  342. width: 100%;
  343. height: 100%;
  344. border-radius: 20rpx;
  345. }
  346. }
  347. .name{
  348. font-weight: 400;
  349. color: #333333;
  350. font-size: 26rpx;
  351. margin-top: 16rpx;
  352. }
  353. .info{
  354. color: #999999;
  355. font-size: 22rpx;
  356. margin-top: 8rpx;
  357. }
  358. .price-box{
  359. font-size: 24rpx;
  360. font-weight: 500;
  361. margin-top: 10rpx;
  362. color: #666;
  363. image{
  364. width: 31rpx;
  365. height: 31rpx;
  366. margin-right: 8rpx;
  367. }
  368. }
  369. }
  370. }
  371. }
  372. .nav{
  373. width: 710rpx;
  374. height: 184rpx;
  375. background-color: #fff;
  376. border-radius: 30rpx;
  377. margin: -150rpx auto 0 auto;
  378. position: relative;
  379. .item{
  380. font-size: 26rpx;
  381. font-weight: 400;
  382. color: #333333;
  383. text-align: center;
  384. width: 30%;
  385. .pictrue{
  386. width: 61rpx;
  387. height: 61rpx;
  388. margin: 0 auto 16rpx auto;
  389. image{
  390. width: 100%;
  391. height: 100%;
  392. }
  393. }
  394. }
  395. .line{
  396. width: 1px;
  397. height: 70rpx;
  398. background-color: #F3F3F3;
  399. }
  400. }
  401. .body {
  402. background-color: #fff;
  403. width: 710rpx;
  404. margin: 20rpx auto 0 auto;
  405. border-radius: 24rpx;
  406. padding-bottom: 20rpx;
  407. .body-title {
  408. padding-left: 32rpx;
  409. .scroll{
  410. white-space: nowrap;
  411. .item{
  412. display: inline-block;
  413. margin-right: 60rpx;
  414. padding: 34rpx 0 38rpx 0;
  415. font-size: 28rpx;
  416. font-weight: 400;
  417. &.on{
  418. font-weight: 500;
  419. color: var(--view-theme);
  420. position: relative;
  421. font-size: 30rpx;
  422. &::after{
  423. position: absolute;
  424. content: '';
  425. width: 36rpx;
  426. height: 30rpx;
  427. border: 2px solid var(--view-theme);
  428. border-left: 2px solid transparent !important;
  429. border-top: 2px solid transparent !important;
  430. border-right: 2px solid transparent !important;
  431. border-radius: 50%;
  432. left:50%;
  433. bottom: 22rpx;
  434. margin-left: -24rpx;
  435. }
  436. }
  437. }
  438. }
  439. }
  440. .product-list {
  441. display: flex;
  442. flex-wrap: wrap;
  443. justify-content: space-between;
  444. padding: 0 32rpx;
  445. .product-item {
  446. position: relative;
  447. width: 314rpx;
  448. background: #fff;
  449. border-radius: 10rpx;
  450. margin-bottom: 20rpx;
  451. .info {
  452. margin-top: 20rpx;
  453. .title {
  454. font-size: 28rpx;
  455. }
  456. .price-box{
  457. font-size: 24rpx;
  458. font-weight: 500;
  459. margin-top: 10rpx;
  460. color: #666;
  461. image{
  462. width: 31rpx;
  463. height: 31rpx;
  464. margin-right: 8rpx;
  465. }
  466. }
  467. .sales {
  468. font-size: 24rpx;
  469. color: #999999;
  470. margin-top: 8rpx;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. </style>