rake.vue 7.9 KB

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