index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <page :nav="false" ref="pageRef">
  3. <view
  4. class="pagae-nav"
  5. :style="{ paddingTop: statusBarHeight + 'px', background: headerBg }"
  6. >
  7. <view class="flex-align-center relative" style="height: 80rpx">
  8. <text class="cuIcon-back back" @click.stop="back"></text>
  9. <view class="title line-ellipsis">源石</view>
  10. </view>
  11. </view>
  12. <view class="wrapper" :style="{ backgroundImage: 'url(' + ossurl.box.boxPageBg + ')' }">
  13. <view
  14. v-if="data"
  15. class="stoneBox"
  16. :style="{ backgroundImage: 'url(' + ossurl.mine.stoneBg + ')' }"
  17. >
  18. <view class="info flex-align-around">
  19. <view class="flex-column-align-center">
  20. <view class="num">
  21. {{ data.balance }}
  22. </view>
  23. <view class="name" @click="$refs.explainRef.show()">
  24. 可用
  25. <view
  26. class="cuIcon-questionfill"
  27. ></view>
  28. </view>
  29. </view>
  30. <view class="flex-column-align-center">
  31. <view class="num">
  32. {{ data.frozen }}
  33. </view>
  34. <view class="name">冻结</view>
  35. </view>
  36. </view>
  37. <view class="tip flex-align-between"></view>
  38. </view>
  39. <view v-if="tableData && tableData.length > 0" class="list">
  40. <view class="title">
  41. 源石明细
  42. <view class="pikerBox">
  43. <picker
  44. @change="bindPickerChange"
  45. :value="index"
  46. :range="tabs"
  47. range-key="title"
  48. >
  49. <view class="pikerView">
  50. {{ tabs[index].title }}
  51. <view
  52. class="cuIcon-triangledownfill"
  53. style="font-size: 32rpx"
  54. ></view>
  55. </view>
  56. </picker>
  57. </view>
  58. </view>
  59. <view v-for="item in tableData" :key="item.itemId" class="cell flex-align-between">
  60. <view class="flex1">
  61. <view class="font4 bold flex-align-between">
  62. {{ item.itemDesc }}
  63. <view class="money bold">
  64. <text v-if="item.type === 'IN'">+</text>
  65. <text v-else-if="item.type === 'OUT'">-</text>
  66. {{ item.money }}
  67. </view>
  68. </view>
  69. <view class="font2 paddingT8" style="color: rgba(0, 0, 0, 0.3)">
  70. {{ item.createTime }}
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <empty v-if="isEmpty" :top="120" />
  76. <explain ref="explainRef" />
  77. </view>
  78. </page>
  79. </template>
  80. <script>
  81. import pageMixin from './../../mixin/page'
  82. import empty from '@/components/empty'
  83. import explain from './explain'
  84. import loginMixin from '@/mixin/login'
  85. import ossurl from '@/utils/ossurl'
  86. import tabbar2 from '@/components/tabbar2'
  87. const Tabs = [
  88. { title: '全部类型', value: '' },
  89. { title: '收入', value: 'IN' },
  90. { title: '支出', value: 'OUT' }
  91. ]
  92. export default {
  93. mixins: [pageMixin, loginMixin],
  94. components: { empty, explain, tabbar2 },
  95. data() {
  96. return {
  97. tabs: Tabs,
  98. tab: Tabs[0],
  99. ossurl,
  100. data: null,
  101. scrollTop: 0
  102. }
  103. },
  104. computed: {
  105. headerBg() {
  106. return this.scrollTop > 0 ? '#fff' : 'transparent'
  107. },
  108. statusBarHeight() {
  109. if (this.$store.state.systemInfo) {
  110. return this.$store.state.systemInfo.statusBarHeight
  111. }
  112. return 20
  113. },
  114. index() {
  115. let index = this.tabs.findIndex((e) => {
  116. return e.value == this.tab.value
  117. })
  118. return index
  119. }
  120. },
  121. onPageScroll(e) {
  122. this.scrollTop = e.scrollTop
  123. },
  124. mounted() {
  125. this.getData(true)
  126. this.refresh()
  127. },
  128. onPullDownRefresh() {
  129. this.getData()
  130. this.refresh()
  131. },
  132. onReachBottom() {
  133. this.loadMore()
  134. },
  135. methods: {
  136. back() {
  137. this.$router.back()
  138. },
  139. init() {
  140. this.getData()
  141. this.refresh()
  142. },
  143. clickTab(item) {
  144. this.tab = item
  145. this.refresh(true)
  146. },
  147. bindPickerChange(val) {
  148. console.log(val)
  149. this.tab = this.tabs[val.detail.value]
  150. this.refresh(true)
  151. },
  152. async getData(loading = false) {
  153. const res = await this.$service.wallet.info('MAGIC', loading)
  154. this.data = res
  155. uni.stopPullDownRefresh()
  156. },
  157. async loadData() {
  158. const res = await this.$service.wallet.bill(
  159. this.pageNum,
  160. this.pageSize,
  161. 'MAGIC',
  162. this.tab.value
  163. )
  164. return res
  165. }
  166. }
  167. }
  168. </script>
  169. <style></style>
  170. <style lang="scss" scoped>
  171. .pikerView {
  172. height: 48rpx;
  173. background: #f1f1f1;
  174. border-radius: 24rpx;
  175. line-height: 48rpx;
  176. text-align: center;
  177. font-size: 24rpx;
  178. font-family: Source Han Sans, Source Han Sans;
  179. font-weight: 350;
  180. color: rgba(0, 0, 0, 0.85);
  181. padding: 0 22rpx;
  182. display: flex;
  183. align-items: center;
  184. }
  185. .wrapper {
  186. padding-top: 200rpx;
  187. background-size: 100% auto;
  188. background-position: top;
  189. background-repeat: no-repeat;
  190. }
  191. .pagae-nav {
  192. position: fixed;
  193. left: 0;
  194. top: 0;
  195. width: 100%;
  196. z-index: 100;
  197. align-items: center;
  198. .title {
  199. font-size: 30rpx;
  200. font-weight: bold;
  201. text-align: center;
  202. line-height: 72rpx;
  203. width: 500rpx;
  204. }
  205. .back {
  206. z-index: 1800;
  207. font-size: 32rpx;
  208. line-height: 32rpx;
  209. position: absolute;
  210. left: 20rpx;
  211. top: 24rpx;
  212. }
  213. }
  214. .stoneBox {
  215. height: 270rpx;
  216. width: 710rpx;
  217. background-size: 100% 100%;
  218. background-position: top;
  219. background-repeat: no-repeat;
  220. }
  221. .info {
  222. overflow: hidden;
  223. position: relative;
  224. padding-top: 40rpx;
  225. padding-bottom: 24rpx;
  226. .name {
  227. font-size: 28rpx;
  228. font-family: Source Han Sans, Source Han Sans;
  229. font-weight: 350;
  230. color: #6d6d6d;
  231. margin-top: 16rpx;
  232. .cuIcon-questionfill {
  233. font-size: 28rpx;
  234. display: inline-block;
  235. }
  236. }
  237. .num {
  238. font-size: 44rpx;
  239. font-family: Source Han Sans, Source Han Sans;
  240. font-weight: bold;
  241. color: #000000;
  242. }
  243. }
  244. .tip {
  245. font-size: 24rpx;
  246. font-family: Source Han Sans, Source Han Sans;
  247. font-weight: 400;
  248. color: #000000;
  249. padding: 20rpx 32rpx;
  250. line-height: 44rpx;
  251. }
  252. .list {
  253. border-radius: 20rpx;
  254. overflow: hidden;
  255. background: #ffffff;
  256. padding: 0 32rpx;
  257. margin-top: 20rpx;
  258. .title {
  259. padding: 36rpx 0 12rpx 0;
  260. display: flex;
  261. align-items: center;
  262. justify-content: space-between;
  263. }
  264. .cell {
  265. padding: 20rpx 0 26rpx 0;
  266. border-bottom: 2rpx solid rgba(0, 0, 0, 0.05);
  267. margin-bottom: 20rpx;
  268. }
  269. .money {
  270. font-size: 28rpx;
  271. font-family: Source Han Sans, Source Han Sans;
  272. font-weight: 500;
  273. color: #182933;
  274. line-height: 44rpx;
  275. }
  276. }
  277. </style>