myCalculation.vue 7.7 KB

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