myCalculation.vue 5.2 KB

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