index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="content">
  3. <view class="top"><image src="../../static/img/index/index.png" mode="" class="bg"></image></view>
  4. <view class="box">
  5. <view v-for="(item, index) in list" :key="index">
  6. <view class="discounts">
  7. <image src="../../static/img/index/youhui1.png" mode="" class="discounts1"></image>
  8. <view class="money">
  9. <text>{{ item.money * 2 }}</text>
  10. </view>
  11. <view class="baodan" @click="baodan(item.id)">查看详情</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="index1">
  16. <image src="../../static/img/index/index1.png" mode=""></image>
  17. <!-- <view class="bottom"></view> -->
  18. </view>
  19. <u-tabbar :list="tabbar" bg-color='#000' active-color='#FAD6B0' inactive-color='#71614f' change='change'></u-tabbar>
  20. </view>
  21. </template>
  22. <script>
  23. import { mapState, mapMutations } from 'vuex';
  24. import { tabbar } from '@/components/tabbar/tabbar.js'
  25. import { activityList } from '@/api/active.js';
  26. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  27. export default {
  28. components: {},
  29. computed: {
  30. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  31. },
  32. data() {
  33. return {
  34. list: [],
  35. revenueList: [],
  36. tabbar: tabbar,
  37. };
  38. },
  39. onShow() {
  40. if (this.hasLogin) {
  41. this.loadData();
  42. } else {
  43. uni.showModal({
  44. title: '登录',
  45. content: '您未登录,是否马上登陆?',
  46. success: e => {
  47. if (e.confirm) {
  48. saveUrl();
  49. interceptor();
  50. }
  51. },
  52. fail: e => {
  53. console.log(e);
  54. }
  55. });
  56. }
  57. },
  58. methods: {
  59. baodan(id) {
  60. uni.navigateTo({
  61. url: '/pages/index/infoDetail?id=' + id
  62. });
  63. },
  64. loadData() {
  65. activityList({}).then(({ data }) => {
  66. data.list.forEach(e => {
  67. let money = e.money * 1;
  68. let money1 = this.unit(e.money * 1 * 5);
  69. let money2 = this.unit(e.money * 1 * 25);
  70. let money3 = this.unit(e.money * 1 * 125);
  71. let money4 = this.unit(e.money * 1 * 625);
  72. let money5 = this.unit(e.money * 1 * 3125);
  73. let money6 = this.unit(e.money * 1 * 15625);
  74. let money7 = this.unit(e.money * 1 * 78125);
  75. e.revenueList = [];
  76. e.revenueList[0] = '5人x' + money + '元=' + money1;
  77. e.revenueList[1] = '25人x' + money + '元=' + money2;
  78. e.revenueList[2] = '125人x' + money + '元=' + money3;
  79. e.revenueList[3] = '625人x' + money + '元=' + money4;
  80. e.revenueList[4] = '3125人x' + money + '元=' + money5;
  81. e.revenueList[5] = '15625人x' + money + '元=' + money6;
  82. e.revenueList[6] = '78125人x' + money + '元=' + money7;
  83. });
  84. this.list = data.list;
  85. });
  86. },
  87. unit(num) {
  88. let i = 0;
  89. if (num / 10000 >= 1) {
  90. i = num / 10000 + '万元';
  91. if (num / 100000000 >= 1) {
  92. i = num / 100000000 + '亿元';
  93. }
  94. } else {
  95. i = num + '元';
  96. }
  97. return i;
  98. },
  99. change(index){
  100. console.log(index)
  101. }
  102. }
  103. };
  104. </script>
  105. <style lang="scss" scoped>
  106. page {
  107. height: auto;
  108. }
  109. .content {
  110. .top {
  111. position: relative;
  112. display: flex;
  113. flex-direction: column;
  114. z-index: 10;
  115. .bg {
  116. width: 100%;
  117. height: 1480rpx;
  118. }
  119. }
  120. .box {
  121. .discounts {
  122. margin: 20rpx 30rpx;
  123. display: flex;
  124. justify-content: center;
  125. position: relative;
  126. width: 690rpx;
  127. height: 890rpx;
  128. z-index: 30;
  129. .discounts1 {
  130. width: 100%;
  131. height: 100%;
  132. }
  133. .money {
  134. margin: 0 auto;
  135. display: flex;
  136. justify-content: center;
  137. align-items: center;
  138. top: 0;
  139. margin-top: 250rpx;
  140. font-size: 36rpx;
  141. font-family: Source Han Sans CN;
  142. font-weight: bold;
  143. color: #c63535;
  144. line-height: 30rpx;
  145. position: absolute;
  146. text {
  147. font-size: 116rpx;
  148. font-family: Source Han Sans CN;
  149. font-weight: 800;
  150. color: #c63535;
  151. line-height: 115rpx;
  152. }
  153. }
  154. .baodan {
  155. position: absolute;
  156. top: 690rpx;
  157. width: 300rpx;
  158. height: 80rpx;
  159. text-align: center;
  160. line-height: 80rpx;
  161. color: #ffffff;
  162. background: #4e2c0e;
  163. font-size: 40rpx;
  164. border-radius: 10rpx;
  165. }
  166. }
  167. .earnings-box {
  168. z-index: 100;
  169. position: relative;
  170. margin: 40rpx 30rpx;
  171. width: 690rpx;
  172. height: 1140rpx;
  173. .earnings {
  174. width: 100%;
  175. height: 100%;
  176. }
  177. .text-box {
  178. position: absolute;
  179. top: 184rpx;
  180. left: 110rpx;
  181. .textDetail {
  182. min-height: 134rpx;
  183. max-height: 140rpx;
  184. overflow: hidden;
  185. padding-bottom: 64rpx;
  186. .textDetail-title {
  187. font-size: 28rpx;
  188. font-family: PingFang SC;
  189. font-weight: bold;
  190. color: #4e2c0e;
  191. line-height: 30rpx;
  192. padding-bottom: 10rpx;
  193. }
  194. .textDetail-content {
  195. font-size: 30rpx;
  196. font-family: PingFang SC;
  197. font-weight: bold;
  198. color: #4e2c0e;
  199. line-height: 30rpx;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. .index1 {
  206. margin-top: -400rpx;
  207. width: 100%;
  208. height: 713rpx;
  209. image {
  210. width: 100%;
  211. height: 100%;
  212. }
  213. .bottom {
  214. width: 100%;
  215. height: 100rpx;
  216. }
  217. }
  218. }
  219. </style>