pledge.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. </view>
  44. </template>
  45. <script>
  46. import {
  47. lock
  48. } from "@/api/mypledge.js"
  49. import {
  50. saveUrl,
  51. interceptor
  52. } from '@/utils/loginUtils.js';
  53. import {
  54. mapState
  55. } from 'vuex';
  56. export default {
  57. computed: {
  58. ...mapState('user', ['hasLogin'])
  59. },
  60. data() {
  61. return {
  62. page: 1,
  63. limit: 10,
  64. loadingType: 'more',
  65. loaded: false,
  66. list: []
  67. }
  68. },
  69. onLoad() {
  70. this.loadData()
  71. },
  72. onReachBottom() {
  73. this.loadData()
  74. },
  75. methods: {
  76. navigator() {
  77. uni.navigateTo({
  78. url: '/pages/myPledge/myPledge'
  79. })
  80. },
  81. nav(url) {
  82. if (!this.hasLogin) {
  83. // 保存地址
  84. saveUrl();
  85. // 登录拦截
  86. interceptor();
  87. } else {
  88. uni.navigateTo({
  89. url
  90. });
  91. }
  92. },
  93. loadData(source) {
  94. let that = this
  95. if (that.loadingType == 'loading' || that.loadingType == 'noMore') {
  96. return
  97. }
  98. lock({
  99. page: that.page,
  100. limit: that.limit,
  101. id: that.id,
  102. }).then(res => {
  103. let list = res.data.list.map(
  104. (res) => {
  105. res.bfb = +(res.join * 100 / res.stock).toFixed(2);
  106. return res
  107. }
  108. )
  109. that.list = that.list.concat(list)
  110. that.page++
  111. if (list.length == that.limit) {
  112. that.loadingType = 'more'
  113. } else {
  114. that.loadingType = 'noMore'
  115. }
  116. that.loaded = true
  117. })
  118. },
  119. }
  120. };
  121. </script>
  122. <style lang="scss">
  123. .all {
  124. width: 750rpx;
  125. height: 100%;
  126. background-color: #000000;
  127. padding-top: var(--status-bar-height);
  128. }
  129. .top {
  130. padding-top: 40rpx;
  131. font-size: 36rpx;
  132. font-weight: bold;
  133. color: #ffffff;
  134. text-align: center;
  135. }
  136. .img {
  137. width: 690rpx;
  138. height: 250rpx;
  139. margin: 20rpx 30rpx;
  140. }
  141. .my {
  142. background-color: #191a1f;
  143. margin: 0 30rpx;
  144. display: flex;
  145. color: #FFF;
  146. padding: 20rpx 30rpx;
  147. border-radius: 18rpx;
  148. .titleTip {
  149. width: 40rpx;
  150. height: 40rpx;
  151. }
  152. .right {
  153. width: 16rpx;
  154. height: 26rpx;
  155. }
  156. }
  157. .buttom {
  158. background-color: #191a1f;
  159. border-radius: 18rpx;
  160. margin: 30rpx;
  161. padding: 30rpx;
  162. line-height: 1;
  163. .le {
  164. font-size: 20rpx;
  165. .le1 {
  166. font-weight: 800;
  167. color: #feb041;
  168. margin-bottom: 15rpx;
  169. &.qt {
  170. padding-top: 15rpx;
  171. }
  172. &.ze {
  173. padding-top: 26rpx;
  174. }
  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>