pledge.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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 qt">
  22. {{item.single_time_min*1}}U{{$t('homepledge.m2')}} | {{item.day}}{{$t('homepledge.m3')}}
  23. </view>
  24. <view class="le1 ze">
  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. if (!this.hasLogin) {
  88. // 保存地址
  89. saveUrl();
  90. // 登录拦截
  91. interceptor();
  92. } else {
  93. uni.navigateTo({
  94. url
  95. });
  96. }
  97. },
  98. loadData(source) {
  99. let that = this
  100. if (that.loadingType == 'loading' || that.loadingType == 'noMore') {
  101. return
  102. }
  103. lock({
  104. page: that.page,
  105. limit: that.limit,
  106. id: that.id,
  107. }).then(res => {
  108. let list = res.data.list.map(
  109. (res) => {
  110. res.bfb = +(res.join * 100 / res.stock).toFixed(2);
  111. return res
  112. }
  113. )
  114. that.list = that.list.concat(list)
  115. that.page++
  116. if (list.length == that.limit) {
  117. that.loadingType = 'more'
  118. } else {
  119. that.loadingType = 'noMore'
  120. }
  121. that.loaded = true
  122. })
  123. },
  124. }
  125. };
  126. </script>
  127. <style lang="scss">
  128. .all {
  129. width: 750rpx;
  130. height: 100%;
  131. background-color: #000000;
  132. padding-top: var(--status-bar-height);
  133. }
  134. .top {
  135. padding-top: 40rpx;
  136. font-size: 36rpx;
  137. font-weight: bold;
  138. color: #ffffff;
  139. text-align: center;
  140. }
  141. .img {
  142. width: 690rpx;
  143. height: 250rpx;
  144. margin: 20rpx 30rpx;
  145. }
  146. .my {
  147. background-color: #191a1f;
  148. margin: 0 30rpx;
  149. display: flex;
  150. color: #FFF;
  151. padding: 20rpx 30rpx;
  152. border-radius: 18rpx;
  153. .titleTip {
  154. width: 40rpx;
  155. height: 40rpx;
  156. }
  157. .right {
  158. width: 16rpx;
  159. height: 26rpx;
  160. }
  161. }
  162. .buttom {
  163. background-color: #191a1f;
  164. border-radius: 18rpx;
  165. margin: 30rpx;
  166. padding: 30rpx;
  167. line-height: 1;
  168. .le {
  169. font-size: 20rpx;
  170. .le1 {
  171. font-weight: 800;
  172. color: #feb041;
  173. margin-bottom: 15rpx;
  174. &.qt {
  175. padding-top: 15rpx;
  176. }
  177. &.ze {
  178. padding-top: 26rpx;
  179. }
  180. &.title {
  181. font-size: 33rpx;
  182. color: #ffffff;
  183. }
  184. }
  185. // .le2 {
  186. // .line {
  187. // width: 308rpx;
  188. // height: 16rpx;
  189. // background-color: rgba(235, 235, 235, 0.38);
  190. // border-radius: 99rpx;
  191. // overflow: hidden;
  192. // .line-action {
  193. // height: 100%;
  194. // width: 100%;
  195. // border-radius: 99rpx;
  196. // background-color: #FEB041;
  197. // }
  198. // }
  199. // }
  200. }
  201. .r1 {
  202. font-size: 47rpx;
  203. font-weight: 800;
  204. color: #FF0102;
  205. }
  206. .r2 {
  207. font-size: 21rpx;
  208. font-weight: 500;
  209. color: #999999;
  210. }
  211. .add-buttom {
  212. background: #feb041;
  213. border-radius: 6rpx;
  214. font-size: 21rpx;
  215. font-weight: 800;
  216. color: #191a1f;
  217. padding: 10rpx 20rpx;
  218. text-align: center;
  219. }
  220. }
  221. </style>