pledge.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="all">
  3. <view class="top">
  4. <text>{{$t('homepledge.m0')}}</text>
  5. </view>
  6. <image class="img" src="../../static/img/zhiya2.png" mode="scaleToFill" style=""></image>
  7. <view @click="nav('/pages/myPledge/myPledge')" class="my flex">
  8. <view class="flex">
  9. <image class="titleTip margin-r-10" src="../../static/img/zhiya3.png" mode=""></image>
  10. <view>
  11. {{$t('homepledge.m1')}}
  12. </view>
  13. </view>
  14. <image class="right" src="../../static/img/zhiya1.png" style="" mode=""></image>
  15. </view>
  16. <view class="buttom flex" v-for="(item,ind) in list" @click="nav('/pages/myPledge/zyXingqing?id='+item.id)">
  17. <view class="le" >
  18. <view class="le1 title ">
  19. {{item.name}}
  20. </view>
  21. <view class="le1 ">
  22. {{item.single_time_min*1}}U{{$t('homepledge.m2')}} | {{item.day}}{{$t('homepledge.m3')}}
  23. </view>
  24. <view class="le1 ">
  25. {{$t('homepledge.total')}}:{{item.stock*1}}U
  26. </view>
  27. <view class="le2 flex font-color-gray">
  28. <view class="line margin-r-10">
  29. <view class="line-action" :style="{'margin-left': -(100-item.bfb)+'%'}">
  30. </view>
  31. </view>
  32. <view>{{item.bfb}}%</view>
  33. </view>
  34. </view>
  35. <view class="ri">
  36. <view class="r1 margin-b-20"> {{item.day_get}}% </view>
  37. <view class="r2 margin-b-30 font-color-gray"> {{$t('homepledge.a4')}} </view>
  38. <view class="add-buttom">
  39. {{$t('homepledge.a5')}}
  40. </view>
  41. </view>
  42. </view>
  43. <taber tab='pledge'></taber>
  44. </view>
  45. </template>
  46. <script>
  47. import taber from "@/components/footer/footer.vue";
  48. import {
  49. lock
  50. } from "@/api/mypledge.js"
  51. import {
  52. saveUrl,
  53. interceptor
  54. } from '@/utils/loginUtils.js';
  55. import {
  56. mapState
  57. } from 'vuex';
  58. export default {
  59. components: {
  60. taber
  61. },
  62. computed: {
  63. ...mapState('user', ['hasLogin'])
  64. },
  65. data() {
  66. return {
  67. page: 1,
  68. limit: 10,
  69. loadingType: 'more',
  70. loaded: false,
  71. list: []
  72. }
  73. },
  74. onLoad() {
  75. this.loadData()
  76. },
  77. onReachBottom() {
  78. this.loadData()
  79. },
  80. methods: {
  81. navigator() {
  82. uni.navigateTo({
  83. url: '/pages/myPledge/myPledge'
  84. })
  85. },
  86. nav(url) {
  87. console.log(url);
  88. if (!this.hasLogin) {
  89. // 保存地址
  90. saveUrl();
  91. // 登录拦截
  92. interceptor();
  93. } else {
  94. uni.navigateTo({
  95. url
  96. });
  97. }
  98. },
  99. loadData(source) {
  100. let that = this
  101. if (that.loadingType == 'loading' || that.loadingType == 'noMore') {
  102. return
  103. }
  104. lock({
  105. page: that.page,
  106. limit: that.limit,
  107. id: that.id,
  108. }).then(res => {
  109. let list = res.data.list.map(
  110. (res) => {
  111. res.bfb = +(res.join * 100 / res.stock).toFixed(2);
  112. return res
  113. }
  114. )
  115. that.list = that.list.concat(list)
  116. that.page++
  117. if (list.length == that.limit) {
  118. that.loadingType = 'more'
  119. } else {
  120. that.loadingType = 'noMore'
  121. }
  122. that.loaded = true
  123. })
  124. },
  125. }
  126. };
  127. </script>
  128. <style lang="scss">
  129. .all {
  130. width: 750rpx;
  131. height: 100%;
  132. background-color: #000000;
  133. padding-top: var(--status-bar-height);
  134. }
  135. .top {
  136. padding-top: 40rpx;
  137. font-size: 36rpx;
  138. font-weight: bold;
  139. color: #ffffff;
  140. text-align: center;
  141. }
  142. .img {
  143. width: 690rpx;
  144. height: 250rpx;
  145. margin: 20rpx 30rpx;
  146. }
  147. .my {
  148. background-color: #191a1f;
  149. margin: 0 30rpx;
  150. display: flex;
  151. color: #FFF;
  152. padding: 20rpx 30rpx;
  153. border-radius: 18rpx;
  154. .titleTip {
  155. width: 40rpx;
  156. height: 40rpx;
  157. }
  158. .right {
  159. width: 16rpx;
  160. height: 26rpx;
  161. }
  162. }
  163. .buttom {
  164. background-color: #191a1f;
  165. border-radius: 18rpx;
  166. margin: 30rpx;
  167. padding: 30rpx;
  168. line-height: 1;
  169. .le {
  170. font-size: 20rpx;
  171. .le1 {
  172. font-weight: 800;
  173. color: #feb041;
  174. margin-bottom: 20rpx;
  175. &.title {
  176. font-size: 33rpx;
  177. color: #ffffff;
  178. }
  179. }
  180. .le2 {
  181. .line {
  182. width: 308rpx;
  183. height: 16rpx;
  184. background-color: rgba(235, 235, 235, 0.38);
  185. border-radius: 99rpx;
  186. overflow: hidden;
  187. .line-action {
  188. height: 100%;
  189. width: 100%;
  190. border-radius: 99rpx;
  191. background-color: #FEB041;
  192. }
  193. }
  194. }
  195. }
  196. .r1 {
  197. font-size: 47rpx;
  198. font-weight: 800;
  199. color: #FF0102;
  200. }
  201. .r2 {
  202. font-size: 21rpx;
  203. font-weight: 500;
  204. color: #999999;
  205. }
  206. .add-buttom {
  207. background: #feb041;
  208. border-radius: 6rpx;
  209. font-size: 21rpx;
  210. font-weight: 800;
  211. color: #191a1f;
  212. padding: 10rpx 20rpx;
  213. text-align: center;
  214. }
  215. }
  216. </style>