Index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="true"><view class="div main-content">
  3. <index-header></index-header>
  4. <view class="div body-wrap no-login">
  5. <!---->
  6. <view class="div point-exchange-wrap" v-if="mallvoucherList.length">
  7. <view class="div type-wrap">
  8. <view class="div content">
  9. <view class="div text-content type-name">
  10. <text class="span">积分换平台代金券</text>
  11. </view>
  12. <view class="div view-content"></view>
  13. <view class="div text-content type-sub">
  14. <text class="span">代金券在手,省钱有道</text>
  15. </view>
  16. </view>
  17. <view class="div type-sub" @click="goMallVoucher()">更多<text class="span iconfont type-sub">&#xe650;</text></view>
  18. </view>
  19. <view class="div list-wrap">
  20. <index-mall-voucher-item class="list-wrap-item" v-for="(item,index) in mallvoucherList" :item="item" :key="index"></index-mall-voucher-item>
  21. </view>
  22. </view>
  23. <view class="div point-exchange-wrap" v-if="voucherList.length">
  24. <view class="div type-wrap">
  25. <view class="div content">
  26. <view class="div text-content type-name">
  27. <text class="span">积分换店铺代金券</text>
  28. </view>
  29. <view class="div view-content"></view>
  30. <view class="div text-content type-sub">
  31. <text class="span">代金券在手,省钱有道</text>
  32. </view>
  33. </view>
  34. <view class="div type-sub" @click="goVoucher()">更多<text class="span iconfont type-sub">&#xe650;</text></view>
  35. </view>
  36. <view class="div list-wrap">
  37. <index-voucher-item class="list-wrap-item" v-for="(item,index) in voucherList" :item="item" :key="index"></index-voucher-item>
  38. </view>
  39. </view>
  40. <view class="div point-exchange-wrap" v-if="goodsList.length">
  41. <view class="div type-wrap">
  42. <view class="div content">
  43. <view class="div text-content type-name">
  44. <text class="span">积分换好物</text>
  45. </view>
  46. <view class="div view-content"></view>
  47. <view class="div text-content type-sub">
  48. <text class="span">积累积分,兑换好物</text>
  49. </view>
  50. </view>
  51. <view class="div type-sub" @click="goProd()">更多<text class="span iconfont type-sub">&#xe650;</text></view>
  52. </view>
  53. <view class="div list-wrap">
  54. <view class="div goods-list double-column">
  55. <index-prod-item class="goods-item" v-for="(item,index) in goodsList" :item="item" :key="index"></index-prod-item>
  56. </view>
  57. </view>
  58. </view>
  59. <empty-record v-if="voucherList.length==0 && goodsList.length == 0 && mallvoucherList.length == 0"></empty-record>
  60. </view>
  61. </view></home-base>
  62. </template>
  63. <script>
  64. import {getFontSize} from '@/util/common'
  65. import HomeBase from '../HomeBase'
  66. import EmptyRecord from '../../EmptyRecord'
  67. import IndexHeader from './IndexHeader'
  68. import IndexProdItem from './IndexProdItem'
  69. import IndexVoucherItem from './IndexVoucherItem'
  70. import IndexMallVoucherItem from './IndexMallVoucherItem'
  71. import { getPointshop } from '../../../api/homePointsgoods'
  72. export default {
  73. name: 'index',
  74. computed:{
  75. fontSize(){
  76. return getFontSize()
  77. },
  78. },
  79. data(){
  80. return {
  81. goodsList: [],
  82. voucherList: [],
  83. mallvoucherList: []
  84. }
  85. },
  86. components:{
  87. HomeBase,
  88. EmptyRecord,
  89. IndexHeader,
  90. IndexProdItem,
  91. IndexVoucherItem,
  92. IndexMallVoucherItem
  93. },
  94. created: function () {
  95. getPointshop().then(res => {
  96. let mall_voucher=res.result.mall_voucher
  97. if(mall_voucher){
  98. this.mallvoucherList=mall_voucher
  99. }
  100. let recommend_voucher=res.result.recommend_voucher
  101. if(recommend_voucher){
  102. this.voucherList=recommend_voucher
  103. }
  104. let recommend_pointsprod=res.result.recommend_pointsprod
  105. if(recommend_pointsprod){
  106. this.goodsList=recommend_pointsprod
  107. }
  108. })
  109. },
  110. methods: {
  111. goMallVoucher () {
  112. uni.navigateTo({url:'/pages/home/pointsgoods/PointMallVoucher'})
  113. },
  114. goVoucher () {
  115. uni.navigateTo({url:'/pages/home/pointsgoods/PointVoucher'})
  116. },
  117. goProd () {
  118. uni.navigateTo({url:'/pages/home/pointsgoods/PointProd'})
  119. }
  120. }
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .font-size-activity-tag {font-size:$h6!important;}
  125. .color-tip { color: #909399!important; }
  126. .color-base-text {color: #ff4544!important;}
  127. .goods-list.double-column {display: flex;-webkit-flex-wrap: wrap;flex-wrap: wrap;margin-top: 10px}
  128. .goods-list.double-column .goods-item{-webkit-box-flex: 1;-webkit-flex: 1;flex: 1;-webkit-flex-basis: 48%;flex-basis: 48%;max-width: calc((100% - 15px) / 2);margin-right:15px;margin-bottom: 10px}
  129. .goods-list.double-column .goods-item:nth-child(2n) {margin-right: 0}
  130. .img-content >img{width: 100%;height: 100%;}
  131. .tips-layer .head {position: relative;}
  132. .tips-layer .title {height: 40px;line-height: 40px;text-align: center;font-size:$h2;font-weight: 700;}
  133. .tips-layer .iconclose{position: absolute;top: 4px;right: 22px;font-size:$h2;font-weight: 500;}
  134. .tips-layer .body .detail {padding: 10px;}
  135. .tips-layer .body .detail .font-size-base {margin-bottom: 5px;}
  136. .main-content{font-size:$subFontSize;line-height: 1.8;}
  137. .font-size-tag {font-size:$fontSize!important;}
  138. .color-base-bg {background-color: #ff4544!important;}
  139. .body-wrap {margin-top: 25px}
  140. .body-wrap.no-login {margin-top: 10px}
  141. .body-wrap .point-exchange-wrap {padding: 0 15px;margin-top: 15px}
  142. .body-wrap .type-wrap {display: flex;align-items: center}
  143. .body-wrap .type-wrap .type-name {font-size:$h2;color: #303133;line-height: 1}
  144. .body-wrap .type-wrap .view-content {width: 1px;height: 11px;background-color: #909399;margin: 0 10px}
  145. .body-wrap .type-wrap .type-sub {font-size:$fontSize;color: #909399;line-height: 1}
  146. .body-wrap .type-wrap .content{flex:1;display: flex;align-items: center}
  147. .body-wrap .list-wrap {width: 100%}
  148. .body-wrap .list-wrap .list-wrap-item {display: inline-block;margin-top: 10px;width:50%;}
  149. .body-wrap .list-wrap .list-wrap-item:nth-child(2n+2) {text-align: right}
  150. </style>