rake.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="rake">
  3. <view class="item" v-for="(ls,index) in list" v-if="ls.stock != 0">
  4. <view class="top">
  5. <view class="info-title">
  6. <image :src="ls.logo" mode=""></image>
  7. <view class="">{{ ls.name }}</view>
  8. </view>
  9. <view class="tags">
  10. <view class="tag" v-for="it in ls.tags" :key="it">{{ it }}</view>
  11. </view>
  12. <view class="base-info">
  13. <view class="info-item">
  14. <view class="tit">单价</view>
  15. <view class="val">{{ +ls.cost_money }}{{ls.cost_money_type}}/{{ ls.get_money_type === 'BZZ' ? '节点' : 'T' }}</view>
  16. </view>
  17. <view class="info-item">
  18. <view class="tit">有效算力</view>
  19. <view class="val">{{ ls.step }} {{ ls.get_money_type === 'BZZ' ? '节点' : 'T' }}</view>
  20. </view>
  21. <view class="info-item">
  22. <view class="tit">周期</view>
  23. <view class="val">{{ ls.first_step_time + ls.second_step_time }}天 + {{ ls.third_step_time }}天</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="btn-wrapper">
  28. <view class="btn">
  29. 服务费:{{ls.user_service_ratio*1}}%
  30. <text @click="+ls.lower_service_ratio<= +mList[index].user_service_ratio ? '': set(index,ls,0)" :class="{'black':+ls.lower_service_ratio<= +mList[index].user_service_ratio }">设置</text>
  31. </view>
  32. <!-- <view class="btn">
  33. 佣金:{{ls.award_ratio*1}}%
  34. <text @click="ls.lower_award_ratio*1 < mList[index].award_ratio*1 ? set(index,ls,1):''" :class="{'black':+ls.lower_award_ratio >= +mList[index].award_ratio }">设置</text>
  35. </view> -->
  36. </view>
  37. </view>
  38. <view class="jg" v-if="list.length !== 0"></view>
  39. <empty v-if="list.length == 0"></empty>
  40. <uni-popup ref="popup" type="center">
  41. <view class="wrapper">
  42. <view class="title">
  43. 设置{{setType === 0? '服务费比例':'佣金比例'}}
  44. </view>
  45. <input type="number" v-model="setVal" :placeholder="placeTitle" class="inp" />
  46. <view class="btn-wrapper">
  47. <view class="cansel" @click="close()">取消</view>
  48. <view class="qr" @click="sub()">确定</view>
  49. </view>
  50. </view>
  51. </uni-popup>
  52. </view>
  53. </template>
  54. <script>
  55. import { mining, buyMining } from '@/api/calculation.js';
  56. import {setServiceRatio ,setRatio} from '../../api/set.js'
  57. import empty from '../../components/empty.vue';
  58. export default {
  59. components: {
  60. empty
  61. },
  62. data() {
  63. return {
  64. height: 0,
  65. setType: 0,
  66. setVal: null,
  67. list: [],
  68. mList: [],
  69. m_service_ratio: 0,
  70. uid:0,
  71. max_ratio: 0,
  72. min_ratio: 0,
  73. item: {}
  74. };
  75. },
  76. computed: {
  77. placeTitle() {
  78. return `可设置比例为${this.min_ratio}%~${this.max_ratio}%`;
  79. }
  80. },
  81. onReady(res) {
  82. // var _this = this;
  83. // uni.getSystemInfo({
  84. // success: resu => {
  85. // const query = uni.createSelectorQuery();
  86. // query.select('.list-cell').boundingClientRect();
  87. // query.exec(function(res) {
  88. // console.log(res, 'ddddddddddddd');
  89. // _this.height = resu.windowHeight - res[0].top + 'px';
  90. // console.log('打印页面的剩余高度', _this.height);
  91. // });
  92. // },
  93. // fail: res => {}
  94. // });
  95. },
  96. onLoad(opt) {
  97. if(opt) {
  98. this.uid = opt.uid
  99. }
  100. // uni.showLoading({
  101. // title: '加载中'
  102. // })
  103. this.loadMlist()
  104. },
  105. methods: {
  106. set(index,ls,num) {
  107. console.log(index)
  108. this.setType = num
  109. this.item = ls
  110. if(this.setType === 0) {
  111. this.min_ratio = +this.mList[index].user_service_ratio
  112. this.max_ratio = +this.list[index].lower_service_ratio
  113. console.log(this.min_ratio,this.max_ratio,'5555555555555555555555555')
  114. if(this.min_ratio === this.max_ratio) {
  115. this.$api.msg('当前无法设置')
  116. }else {
  117. this.$refs.popup.open();
  118. }
  119. console.log(this.min_ratio,this.max_ratio)
  120. }else {
  121. this.min_ratio = +this.list[index].lower_award_ratio
  122. this.max_ratio = +this.mList[index].award_ratio
  123. console.log(this.min_ratio,this.max_ratio,'5555555555555555555555555')
  124. if(this.min_ratio === this.max_ratio) {
  125. this.$api.msg('当前无法设置')
  126. }else {
  127. this.$refs.popup.open();
  128. }
  129. }
  130. },
  131. close() {
  132. this.$refs.popup.close();
  133. this.setVal = null;
  134. },
  135. sub() {
  136. console.log();
  137. this.$refs.popup.close();
  138. if(this.setType === 0){
  139. setServiceRatio(this.uid,{
  140. ratio: this.setVal,
  141. mid: this.item.id
  142. }).then(res => {
  143. this.$api.msg(res.msg)
  144. this.loadData()
  145. })
  146. }else {
  147. setRatio(this.uid,{
  148. ratio: this.setVal,
  149. mid: this.item.id
  150. }).then(res => {
  151. this.$api.msg(res.msg)
  152. this.loadData()
  153. })
  154. }
  155. this.setVal = null
  156. },
  157. loadData() {
  158. mining({
  159. uid: this.uid,
  160. page: 1,
  161. limit: 1000
  162. }).then(({ data }) => {
  163. this.list = data.data;
  164. // uni.hideLoading()
  165. console.log(this.list, '88888888888888');
  166. });
  167. },
  168. loadMlist() {
  169. mining({
  170. // uid: this.uid,
  171. page: 1,
  172. limit: 1000
  173. }).then(({ data }) => {
  174. this.mList = data.data;
  175. console.log(this.mList, '999999999999999999999999999999999999');
  176. this.loadData();
  177. });
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. page {
  184. height: 100%;
  185. // padding-top: 20rpx;
  186. }
  187. .rake {
  188. height: 100%;
  189. // padding-top: 30rpx;
  190. }
  191. .item {
  192. margin: 20rpx auto;
  193. width: 670rpx;
  194. // height: 438rpx;
  195. background: #f7f6fb;
  196. border-radius: 10rpx;
  197. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  198. .top {
  199. // height: 347rpx;
  200. width: 100%;
  201. padding: 40rpx 30rpx 0;
  202. .info-title {
  203. display: flex;
  204. image {
  205. display: inline-block;
  206. width: 38rpx;
  207. height: 38rpx;
  208. margin-left: 10rpx;
  209. flex-shrink: 0;
  210. }
  211. view {
  212. padding-left: 12rpx;
  213. font-size: 30rpx;
  214. font-family: PingFang SC;
  215. font-weight: bold;
  216. color: #333333;
  217. }
  218. }
  219. .tags {
  220. padding-top: 20rpx;
  221. display: flex;
  222. flex-wrap: wrap;
  223. .tag {
  224. display: inline-block;
  225. padding: 0 20rpx;
  226. text-align: center;
  227. line-height: 43rpx;
  228. background: #e3f6fa;
  229. border-radius: 22rpx;
  230. margin: 10rpx 10rpx 0;
  231. font-size: 24rpx;
  232. font-family: PingFang SC;
  233. font-weight: bold;
  234. color: #0ec1a1;
  235. }
  236. }
  237. .base-info {
  238. padding-top: 30rpx;
  239. display: flex;
  240. justify-content: space-between;
  241. // text-align: center;
  242. font-size: 24rpx;
  243. font-family: PingFang SC;
  244. font-weight: bold;
  245. color: #333333;
  246. padding-bottom: 30rpx;
  247. }
  248. .end-time {
  249. font-size: 30rpx;
  250. font-family: PingFang SC;
  251. font-weight: bold;
  252. color: #5771df;
  253. padding-bottom: 24rpx;
  254. }
  255. }
  256. .btn-wrapper {
  257. // width: 670rpx;
  258. height: 95rpx;
  259. background: #ffffff;
  260. border-radius: 0px 0px 10rpx 10rpx;
  261. display: flex;
  262. justify-content: flex-end;
  263. // justify-content: space-between;
  264. align-items: center;
  265. padding-right: 20rpx;
  266. .btn {
  267. // display: flex;
  268. padding-left: 10rpx;
  269. text {
  270. display: inline-block;
  271. width: 108rpx;
  272. height: 39rpx;
  273. background: #5771df;
  274. border: 1rpx solid #5771df;
  275. box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.1);
  276. border-radius: 20rpx;
  277. text-align: center;
  278. line-height: 35rpx;
  279. margin-left: 11rpx;
  280. font-size: 24rpx;
  281. font-family: PingFang SC;
  282. font-weight: 500;
  283. color: #ffffff;
  284. }
  285. .black {
  286. background-color: #999;
  287. border-color: #999;
  288. }
  289. }
  290. }
  291. }
  292. .list-cell {
  293. width: 100%;
  294. height: 100%;
  295. background-color: #f8f8f8;
  296. }
  297. .wrapper {
  298. width: 549rpx;
  299. height: 344rpx;
  300. background: #ffffff;
  301. border-radius: 14rpx;
  302. .title {
  303. text-align: center;
  304. padding-top: 40rpx;
  305. font-size: 37rpx;
  306. font-family: PingFang SC;
  307. font-weight: bold;
  308. color: #333333;
  309. }
  310. .inp {
  311. display: block;
  312. margin: 60rpx auto;
  313. width: 439rpx;
  314. height: 68rpx;
  315. background: #f6f6f6;
  316. border-radius: 10rpx;
  317. padding-left: 13rpx;
  318. }
  319. .btn-wrapper {
  320. display: flex;
  321. view {
  322. width: 50%;
  323. text-align: center;
  324. }
  325. .cansel {
  326. font-size: 37rpx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #333333;
  330. }
  331. .qr {
  332. font-size: 37rpx;
  333. font-family: PingFang SC;
  334. font-weight: 500;
  335. color: #5771df;
  336. }
  337. }
  338. }
  339. .jg {
  340. height: 20rpx;
  341. }
  342. </style>