myCalculation.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="container">
  3. <view class="item-wrapper" v-if="list.length > 0" v-for="(ls,index) in list" :key='index'>
  4. <view class="item">
  5. <view class="item-name">设备名称</view>
  6. <view class="item-val">{{ls.machine.name}}</view>
  7. </view>
  8. <view class="item">
  9. <view class="item-name">状态</view>
  10. <view class="item-val blue">{{ls.status == 0 ? '准备中' : ls.status == 1 ? '挖矿中' : '已到期'}}</view>
  11. </view>
  12. <view class="item">
  13. <view class="item-name">合约期限</view>
  14. <view class="item-val blue">{{ls.machine.first_step_time + ls.machine.second_step_time }}天 + {{ ls.machine.third_step_time}}天</view>
  15. </view>
  16. <view class="item">
  17. <view class="item-name">购买容量</view>
  18. <view class="item-val blue">{{+ls.num}} {{ls.get_money_type === 'FIL'? 'FIL':ls.get_money_type==='BZZ'?'节点':'T'}}</view>
  19. </view>
  20. <view class="item">
  21. <view class="item-name">管理费</view>
  22. <view class="item-val">{{ls.user_service_ratio}}%</view>
  23. </view>
  24. <view class="item">
  25. <view class="item-name">单价</view>
  26. <view class="item-val">{{ls.machine.cost_money * 1}} {{ls.machine.cost_money_type}}/{{ls.get_money_type === 'FIL'? 'FIL':ls.get_money_type==='BZZ'?'节点':'T'}}</view>
  27. </view>
  28. <view class="item">
  29. <view class="item-name">购买份数</view>
  30. <view class="item-val">{{+ls.num}}</view>
  31. </view>
  32. <view class="item">
  33. <view class="item-name">总价</view>
  34. <view class="item-val">{{ls._cost_money}}</view>
  35. </view>
  36. <view class="item">
  37. <view class="item-name">购买时间</view>
  38. <view class="item-val">{{ls._pay_time}}</view>
  39. </view>
  40. </view>
  41. <view class="jg" v-if="list.length !== 0"></view>
  42. <!-- <view class="list-cell" v-if="list.length > 0" v-for="(ls,index) in list" :key='index'>
  43. <view class="cell-title flex">
  44. <view class="cellTpl flex_item">
  45. <image :src="ls.machine.logo"></image>
  46. <view class="title">{{ls.machine.name}}</view>
  47. </view>
  48. <view class="status">{{ls.status == 0 ? '准备中' : ls.status == 1 ? '挖矿中' : '已到期'}}</view>
  49. </view>
  50. <view class="cell-tip">{{ls.machine.first_step_time + ls.machine.second_step_time + ls.machine.third_step_time}}天矿机</view>
  51. <view class="flex cell-tpl">
  52. <view class="tpl">
  53. <view class="" v-if="ls.get_money_type == 'BZZ'">单价(节点)</view>
  54. <view class="" v-else>单价(T)</view>
  55. <view class="">{{ls.machine.cost_money * 1}} {{ls.machine.cost_money_type}}</view>
  56. </view>
  57. <view class="tpl">
  58. <view class="">有效算力</view>
  59. <view class="" v-if="ls.get_money_type == 'BZZ'">{{ls.num * 1}}节点</view>
  60. <view class="" v-else>{{ls.num * 1}}T</view>
  61. </view>
  62. <view class="tpl">
  63. <view class="">合约周期</view>
  64. <view class="">{{ls.machine.first_step_time + ls.machine.second_step_time + ls.machine.third_step_time}}天</view>
  65. </view>
  66. </view>
  67. <view class="cell-info flex">
  68. <view class="tip">到期时间:{{ls.mining_end_time}}</view>
  69. </view>
  70. <view class="cell-info flex">
  71. <view class="tip">购买时间:{{ls._pay_time}}</view>
  72. </view>
  73. <view class="cell-info flex" v-if="ls.status == 0">
  74. <view class="tip">倒计时:<uni-countdown
  75. color="#FFF"
  76. background-color="#BAC1EF"
  77. :day="ls.stopTimeD"
  78. :hour="ls.stopTimeH"
  79. :minute="ls.stopTimeM"
  80. :second="ls.stopTimeS"
  81. :index="index"
  82. @timeover="isTime"
  83. ></uni-countdown></view>
  84. </view>
  85. </view> -->
  86. <view class="empty-box" v-show="list.length === 0"><empty></empty></view>
  87. </view>
  88. </template>
  89. <script>
  90. import { mymining } from '@/api/calculation.js';
  91. import empty from '@/components/empty';
  92. import { timeComputed } from '@/utils/rocessor.js';
  93. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  94. export default {
  95. components: {
  96. empty,uniCountdown
  97. },
  98. data() {
  99. return {
  100. list:'',
  101. };
  102. },
  103. onLoad(option){
  104. this.loadData();
  105. },
  106. onShow() {
  107. },
  108. //下拉刷新
  109. onPullDownRefresh() {
  110. this.loadData();
  111. },
  112. methods: {
  113. async loadData() {
  114. let obj = this;
  115. mymining({
  116. page:1,
  117. limit:1000,
  118. }).then(({ data }) => {
  119. console.log(data,"基础数据")
  120. obj.list = data.data;
  121. obj.list = data.data.map((e,ind) => {
  122. let ar = e;
  123. console.log(e,"饿");
  124. // 判断是否为进行中的活动
  125. if (ar.status === 0) {
  126. // 计算倒计时时间
  127. obj.timeComputed(ar.mining_start_time * 1000, ar);
  128. console.log(ar.stopTimeD)
  129. } else {
  130. console.log('++++++++++')
  131. // 获取距离开始还需要多少时间
  132. if( ar.time){
  133. let arTime = ar.time.split(':');
  134. let h = arTime[0];
  135. let m = arTime[1];
  136. let time = new Date();
  137. // 设置时间
  138. time.setHours(h, m, 0);
  139. // 计算倒计时时间
  140. obj.timeComputed(time.getTime(), ar);}
  141. }
  142. return e;
  143. })
  144. });
  145. },
  146. // 计算倒计时时间
  147. timeComputed(da, ar) {
  148. let obj = this;
  149. // 计算时间,保存需要多少时间到期
  150. let stopTime = timeComputed(da);
  151. console.log(stopTime);
  152. ar.stopTimeD = stopTime.day;
  153. ar.stopTimeH = stopTime.hours;
  154. ar.stopTimeM = stopTime.minutes;
  155. ar.stopTimeS = stopTime.seconds;
  156. },
  157. isTime(index) {
  158. this.list[index].status = 1
  159. }
  160. }
  161. };
  162. </script>
  163. <style lang="scss">
  164. page {
  165. min-height: 100%;
  166. background-color: #ffffff;
  167. .container {
  168. width: 100%;
  169. }
  170. }
  171. .list-cell{
  172. padding: 40rpx 40rpx;
  173. .cell-title{
  174. padding: 29rpx 38rpx;
  175. font-size: 30rpx;
  176. font-weight: bold;
  177. color: #333333;
  178. .cellTpl{
  179. image{
  180. width: 40rpx;
  181. height: 40rpx;
  182. margin-right: 15rpx;
  183. }
  184. }
  185. .status{
  186. color: #E51C23;
  187. }
  188. }
  189. .cell-tip{
  190. padding: 0rpx 38rpx;
  191. font-size: 24rpx;
  192. font-weight: bold;
  193. color: #0EC1A1;
  194. }
  195. .cell-tpl{
  196. padding: 40rpx 31rpx;
  197. font-size: 24rpx;
  198. font-weight: bold;
  199. color: #333333;
  200. line-height: 40rpx;
  201. }
  202. .cell-info{
  203. margin-bottom: 25rpx;
  204. .tip{
  205. font-size: 30rpx;
  206. font-weight: bold;
  207. color: #5771DF;
  208. }
  209. .zhiya-btn{
  210. background-color: #5771DF;
  211. padding: 12rpx 22rpx;
  212. font-size: 24rpx;
  213. border-radius: 50rpx;
  214. color: #FFFFFF;
  215. }
  216. }
  217. .list-tip{
  218. word-wrap:break-word;
  219. background-color: #BAC1EF !important;
  220. font-size: 24rpx;
  221. font-weight: 500;
  222. color: #333333;
  223. padding: 36rpx 32rpx;
  224. margin-top: 15rpx;
  225. border-bottom-left-radius:15rpx ;
  226. border-bottom-right-radius:15rpx ;
  227. }
  228. }
  229. .empty-box{
  230. margin-top: 100rpx;
  231. width: 100%;
  232. height: 500rpx;
  233. }
  234. .item-wrapper {
  235. padding: 0 35rpx;
  236. width: 690rpx;
  237. height: 748rpx;
  238. background: #F7F6FB;
  239. border: 1rpx solid #5771DF;
  240. border-radius: 20rpx;
  241. margin: 20rpx auto;
  242. font-size: 28rpx;
  243. font-family: PingFang SC;
  244. font-weight: 500;
  245. color: #333333;
  246. line-height: 1;
  247. display: flex;
  248. flex-direction: column;
  249. justify-content: space-around;
  250. .item {
  251. display: flex;
  252. justify-content: space-between;
  253. .item-val {
  254. font-weight: bold;
  255. }
  256. }
  257. .blue {
  258. color: #5771DF;
  259. }
  260. }
  261. .jg {
  262. height: 20rpx;
  263. }
  264. </style>