index.vue 5.0 KB

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