index.vue 4.6 KB

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