myCalculation.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="container">
  3. <view class="list-cell" v-if="list.length > 0" v-for="(ls,index) in list" :key='index'>
  4. <view class="cell-title flex">
  5. <view class="cellTpl flex_item">
  6. <image :src="ls.machine.logo"></image>
  7. <view class="title">{{ls.machine.name}}</view>
  8. </view>
  9. <view class="status">{{ls.status == 0 ? '准备中' : ls.status == 1 ? '挖矿中' : '已到期'}}</view>
  10. </view>
  11. <view class="cell-tip">{{ls.machine.first_step_time + ls.machine.second_step_time + ls.machine.third_step_time}}天矿机</view>
  12. <view class="flex cell-tpl">
  13. <view class="tpl">
  14. <view class="">单价(T)</view>
  15. <view class="">{{ls.machine.cost_money * 1}} {{ls.machine.cost_money_type}}</view>
  16. </view>
  17. <view class="tpl">
  18. <view class="">有效算力</view>
  19. <view class="">{{ls.num * 1}}T</view>
  20. </view>
  21. <view class="tpl">
  22. <view class="">合约周期</view>
  23. <view class="">{{ls.machine.first_step_time + ls.machine.second_step_time + ls.machine.third_step_time}}天</view>
  24. </view>
  25. </view>
  26. <view class="cell-info flex">
  27. <view class="tip">到期时间:{{ls.mining_end_time}}</view>
  28. </view>
  29. <view class="cell-info flex">
  30. <view class="tip">购买时间:{{ls._pay_time}}</view>
  31. </view>
  32. <view class="cell-info flex" v-if="ls.status == 0">
  33. <view class="tip">倒计时:<uni-countdown
  34. color="#FFF"
  35. background-color="#BAC1EF"
  36. :day="ls.stopTimeD"
  37. :hour="ls.stopTimeH"
  38. :minute="ls.stopTimeM"
  39. :second="ls.stopTimeS"
  40. ></uni-countdown></view>
  41. </view>
  42. <!-- <view class="cell-info flex">
  43. <view class="tip">正式挖矿时间:{{ls.mining_start_time}}</view>
  44. </view> -->
  45. <view class="list-tip">
  46. <rich-text :nodes="ls.machine.detail"></rich-text>
  47. </view>
  48. </view>
  49. <view class="empty-box" v-show="list.length === 0"><empty></empty></view>
  50. </view>
  51. </template>
  52. <script>
  53. import { mymining } from '@/api/calculation.js';
  54. import empty from '@/components/empty';
  55. import { timeComputed } from '@/utils/rocessor.js';
  56. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  57. export default {
  58. components: {
  59. empty,uniCountdown
  60. },
  61. data() {
  62. return {
  63. list:'',
  64. };
  65. },
  66. onLoad(option){
  67. this.loadData();
  68. },
  69. onShow() {
  70. },
  71. //下拉刷新
  72. onPullDownRefresh() {
  73. this.loadData();
  74. },
  75. methods: {
  76. async loadData() {
  77. let obj = this;
  78. mymining({
  79. page:1,
  80. limit:1000,
  81. }).then(({ data }) => {
  82. console.log(data,"基础数据")
  83. obj.list = data.data;
  84. obj.list = data.data.map((e,ind) => {
  85. let ar = e;
  86. console.log(e,"饿");
  87. // 判断是否为进行中的活动
  88. if (ar.status === 0) {
  89. // 计算倒计时时间
  90. obj.timeComputed(ar.mining_start_time * 1000, ar);
  91. } else {
  92. // // 获取距离开始还需要多少时间
  93. // let arTime = ar.time.split(':');
  94. // let h = arTime[0];
  95. // let m = arTime[1];
  96. // let time = new Date();
  97. // // 设置时间
  98. // time.setHours(h, m, 0);
  99. // // 计算倒计时时间
  100. // obj.timeComputed(time.getTime(), ar);
  101. }
  102. return e;
  103. })
  104. });
  105. },
  106. // 计算倒计时时间
  107. timeComputed(da, ar) {
  108. let obj = this;
  109. // 计算时间,保存需要多少时间到期
  110. let stopTime = timeComputed(da);
  111. console.log(stopTime);
  112. ar.stopTimeD = stopTime.day;
  113. ar.stopTimeH = stopTime.hours;
  114. ar.stopTimeM = stopTime.minutes;
  115. ar.stopTimeS = stopTime.seconds;
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss">
  121. page {
  122. min-height: 100%;
  123. background-color: #ffffff;
  124. .container {
  125. width: 100%;
  126. }
  127. }
  128. .list-cell{
  129. padding: 40rpx 40rpx;
  130. .cell-title{
  131. padding: 29rpx 38rpx;
  132. font-size: 30rpx;
  133. font-weight: bold;
  134. color: #333333;
  135. .cellTpl{
  136. image{
  137. width: 40rpx;
  138. height: 40rpx;
  139. margin-right: 15rpx;
  140. }
  141. }
  142. .status{
  143. color: #E51C23;
  144. }
  145. }
  146. .cell-tip{
  147. padding: 0rpx 38rpx;
  148. font-size: 24rpx;
  149. font-weight: bold;
  150. color: #0EC1A1;
  151. }
  152. .cell-tpl{
  153. padding: 40rpx 31rpx;
  154. font-size: 24rpx;
  155. font-weight: bold;
  156. color: #333333;
  157. line-height: 40rpx;
  158. }
  159. .cell-info{
  160. margin-bottom: 25rpx;
  161. .tip{
  162. font-size: 30rpx;
  163. font-weight: bold;
  164. color: #5771DF;
  165. }
  166. .zhiya-btn{
  167. background-color: #5771DF;
  168. padding: 12rpx 22rpx;
  169. font-size: 24rpx;
  170. border-radius: 50rpx;
  171. color: #FFFFFF;
  172. }
  173. }
  174. .list-tip{
  175. word-wrap:break-word;
  176. background-color: #BAC1EF !important;
  177. font-size: 24rpx;
  178. font-weight: 500;
  179. color: #333333;
  180. padding: 36rpx 32rpx;
  181. margin-top: 15rpx;
  182. border-bottom-left-radius:15rpx ;
  183. border-bottom-right-radius:15rpx ;
  184. }
  185. }
  186. .empty-box{
  187. margin-top: 100rpx;
  188. width: 100%;
  189. height: 500rpx;
  190. }
  191. </style>