market.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="container">
  3. <view class="status_bar"><!-- 这里是状态栏 --></view>
  4. <view class="content-money">
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">服务器兑换</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/img/fwq-bg.png" mode=""></image></view>
  10. <view class="money">
  11. <view class="num">{{ djjf }}</view>
  12. <view class="font">我的拼团冻结积分</view>
  13. <view class="all" @click="nav('/pages/money/frozen')">查看明细</view>
  14. </view>
  15. </view>
  16. <view class="main">
  17. <view class="main-title">
  18. <image src="../../static/icon/f-l.png" mode=""></image>
  19. <view class="title-font">热门兑换</view>
  20. <image src="../../static/icon/f-r.png" mode=""></image>
  21. </view>
  22. <view class="main-box">
  23. <view class="main-item" v-for="(item, index) in list" :key="index">
  24. <view class="item-bg"><image :src="item.logo" mode=""></image></view>
  25. <view class="item-info">
  26. <view class="item-name">{{ item.name }}</view>
  27. <view class="item-tip">合约周期:{{ item.first_step_time + item.second_step_time }}天 + {{ item.third_step_time }}天</view>
  28. <view class="item-tip">有效空间:{{ item.step }}T</view>
  29. <view class="price">
  30. {{ item.cost_money*1 }}
  31. <text>{{ item.cost_money_type}}</text>
  32. </view>
  33. <view class="btn" @click="go(item)">立即兑换</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { mining } from '@/api/market.js';
  42. import { wallet } from '@/api/finance.js';
  43. export default {
  44. data() {
  45. return {
  46. tabCurrent: '全部',
  47. tabType: 1,
  48. list: [],
  49. buyId: '',
  50. password: '',
  51. num: '',
  52. djjf:'',
  53. };
  54. },
  55. onLoad(option) {
  56. wallet({}).then(({ data }) => {
  57. const obj = this
  58. const arr = Object.keys(data.back);
  59. arr.forEach(e => {
  60. if(e == 'USDL'){
  61. obj.djjf = (data.back[e].money.money*1)
  62. }
  63. });
  64. });
  65. this.loadData();
  66. },
  67. onShow() {},
  68. //下拉刷新
  69. onPullDownRefresh() {
  70. },
  71. methods: {
  72. nav(url) {
  73. uni.navigateTo({
  74. url
  75. });
  76. },
  77. go() {
  78. uni.navigateTo({
  79. url:'/pages/market/details'
  80. })
  81. },
  82. // 点击返回 我的页面
  83. toBack() {
  84. uni.navigateBack({
  85. })
  86. },
  87. // 请求载入数据
  88. async loadData() {
  89. let obj = this;
  90. uni.showLoading({
  91. title: '加载中...'
  92. });
  93. mining({
  94. page: 1,
  95. limit: 1000
  96. }).then(({ data }) => {
  97. uni.hideLoading();
  98. console.log(data.data, '9999999999999999999999999999999999');
  99. obj.list = data.data.map(e => {
  100. e.step = +e.step;
  101. e._cost_money = +e._cost_money.replace(e.cost_money_type, '') + e.cost_money_type;
  102. return e;
  103. });
  104. console.log(obj.list, 'obj.list++++++++++++');
  105. });
  106. },
  107. go(ls) {
  108. uni.navigateTo({
  109. url: '/pages/market/details?id=' + ls.id + '&type=' + ls.type
  110. });
  111. }
  112. }
  113. };
  114. </script>
  115. <style lang="scss">
  116. page {
  117. background: #ffffff;
  118. height: 100%;
  119. }
  120. .status_bar {
  121. height: var(--status-bar-height);
  122. width: 100%;
  123. }
  124. .content-money {
  125. padding-bottom: 30rpx;
  126. position: relative;
  127. height: 448rpx;
  128. .content-bg {
  129. position: absolute;
  130. top: 0;
  131. left: 0;
  132. right: 0;
  133. width: 750rpx;
  134. height: 448rpx;
  135. image {
  136. width: 100%;
  137. height: 100%;
  138. }
  139. }
  140. .body-title {
  141. height: 80rpx;
  142. text-align: center;
  143. font-size: 35rpx;
  144. position: relative;
  145. .header {
  146. position: absolute;
  147. left: 0;
  148. top: 0;
  149. width: 100%;
  150. font-size: 36rpx;
  151. font-family: PingFang SC;
  152. font-weight: bold;
  153. color: #fffeff;
  154. height: 80rpx;
  155. font-size: 36rpx;
  156. font-weight: 700;
  157. z-index: 9;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. }
  162. .goback-box {
  163. position: absolute;
  164. left: 18rpx;
  165. top: 0;
  166. height: 80rpx;
  167. display: flex;
  168. align-items: center;
  169. }
  170. .goback {
  171. z-index: 100;
  172. width: 34rpx;
  173. height: 34rpx;
  174. }
  175. }
  176. }
  177. .money {
  178. position: relative;
  179. z-index: 10;
  180. padding-top: 64rpx;
  181. display: flex;
  182. flex-direction: column;
  183. align-items: center;
  184. .num {
  185. font-size: 84rpx;
  186. font-family: PingFang SC;
  187. font-weight: 800;
  188. color: #ffffff;
  189. }
  190. .font {
  191. font-size: 30rpx;
  192. font-family: PingFang SC;
  193. font-weight: 500;
  194. color: #ffffff;
  195. }
  196. .all {
  197. margin-top: 20rpx;
  198. width: 194rpx;
  199. height: 60rpx;
  200. line-height: 60rpx;
  201. border: 1px solid #ffffff;
  202. border-radius: 30rpx;
  203. font-size: 26rpx;
  204. font-family: SourceHanSansCN;
  205. font-weight: 500;
  206. color: #ffffff;
  207. text-align: center;
  208. }
  209. }
  210. .main {
  211. margin-top: 26rpx;
  212. .main-title {
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. image {
  217. width: 24rpx;
  218. height: 24rpx;
  219. }
  220. .title-font {
  221. width: 170rpx;
  222. font-size: 34rpx;
  223. font-family: PingFang SC;
  224. font-weight: bold;
  225. color: #2E58FF;
  226. text-align: center;
  227. }
  228. }
  229. .main-box {
  230. padding: 16rpx 20rpx 70rpx;
  231. .main-item {
  232. margin-top: 20rpx;
  233. background: #FFFFFF;
  234. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  235. border-radius: 10rpx;
  236. padding: 14rpx;
  237. display: flex;
  238. justify-content: flex-start;
  239. .item-bg {
  240. width: 260rpx;
  241. height: 260rpx;
  242. flex-shrink: 0;
  243. image {
  244. width: 100%;
  245. height: 100%;
  246. }
  247. }
  248. .item-info {
  249. position: relative;
  250. margin-left: 30rpx;
  251. padding-top: 20rpx;
  252. width: 100%;
  253. .item-name {
  254. font-size: 30rpx;
  255. font-family: PingFang SC;
  256. font-weight: bold;
  257. color: #333333;
  258. }
  259. .item-tip {
  260. font-size: 24rpx;
  261. font-family: PingFang SC;
  262. font-weight: 500;
  263. color: #666666;
  264. }
  265. .price {
  266. margin-top: 70rpx;
  267. font-size: 40rpx;
  268. font-family: PingFang SC;
  269. font-weight: bold;
  270. color: #E83F30;
  271. text {
  272. font-size: 22rpx;
  273. }
  274. }
  275. }
  276. .btn {
  277. position: absolute;
  278. right: 24rpx;
  279. bottom: 34rpx;
  280. width: 141rpx;
  281. height: 50rpx;
  282. background: linear-gradient(0deg, #2E58FF, #32C6FF);
  283. border-radius: 25rpx;
  284. text-align: center;
  285. line-height: 50rpx;
  286. font-size: 24rpx;
  287. font-family: PingFang SC;
  288. font-weight: 500;
  289. color: #FFFFFF;
  290. }
  291. }
  292. }
  293. }
  294. </style>