rake.vue 7.7 KB

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