bill.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="pages-content">
  3. <!-- 头部 -->
  4. <headContent>
  5. <template #left>
  6. <reverse-back />
  7. </template>
  8. <template #content>
  9. <view class="haed-title">
  10. {{ getTitle(pageType) }}
  11. </view>
  12. </template>
  13. </headContent>
  14. <uni-table class="table-box" emptyText="" v-if="pageType">
  15. <!-- 表头行 -->
  16. <uni-tr>
  17. <uni-th class="table-title" align="left">{{ tableTh[pageType][0].lable }}</uni-th>
  18. <uni-th class="table-title" align="right">{{ tableTh[pageType][1].lable }}</uni-th>
  19. <uni-th class="table-title" align="right">{{ tableTh[pageType][2].lable }}</uni-th>
  20. </uni-tr>
  21. <!-- 表格数据行 -->
  22. <uni-tr class="sss" v-for="item in tableData">
  23. <uni-td>
  24. <view class="table-text-01">USDT</view>
  25. <view class="table-text-02">2023-04-0108:00:13</view>
  26. </uni-td>
  27. <uni-td style="text-align: right;">
  28. <view class="table-text-03">16.2761</view>
  29. <view class="table-text-04">结算资金费率</view>
  30. </uni-td>
  31. <uni-td style="text-align: right;">
  32. <view class="table-text-05">29997.9123</view>
  33. </uni-td>
  34. </uni-tr>
  35. </uni-table>
  36. <!-- 加载动画 -->
  37. <uni-load-more :status="moreStatus" v-show="tableData.length > 0 || moreStatus === 'loading' " />
  38. <!-- 暂无数据 -->
  39. <no-data v-show="tableData.length === 0 && moreStatus !== 'loading' " />
  40. </view>
  41. </template>
  42. <script>
  43. import reverseBack from "@/components/headModules/reverse-back.vue"
  44. import noData from "./modules/no-data.vue"
  45. import { Api_getUserBill } from "@/api/index.js"
  46. export default {
  47. components: {
  48. reverseBack,
  49. noData
  50. },
  51. data() {
  52. return {
  53. pageType: undefined,
  54. moreStatus: 'more-loading', // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
  55. tableTh: [
  56. //合约账户
  57. [{
  58. lable: '账单信息',
  59. val: 'key'
  60. },
  61. {
  62. lable: '数量/类别',
  63. val: 'key'
  64. },
  65. {
  66. lable: '余额',
  67. val: 'key'
  68. }
  69. ],
  70. //币币账户
  71. [{
  72. lable: '币种/时间',
  73. val: 'key'
  74. },
  75. {
  76. lable: '金额/类型',
  77. val: 'key'
  78. },
  79. {
  80. lable: '状态',
  81. val: 'key'
  82. }
  83. ],
  84. //法币账户
  85. [{
  86. lable: '类型/时间',
  87. val: 'key'
  88. },
  89. {
  90. lable: '数量',
  91. val: 'key'
  92. },
  93. {
  94. lable: '状态',
  95. val: 'key'
  96. }
  97. ],
  98. //赠金账户
  99. [{
  100. lable: '账单信息',
  101. val: 'key'
  102. },
  103. {
  104. lable: '数量/类别',
  105. val: 'key'
  106. },
  107. {
  108. lable: '余额',
  109. val: 'key'
  110. }
  111. ]
  112. ],
  113. tableData: []
  114. };
  115. },
  116. onLoad(opt) {
  117. this.pageType = opt?.type || undefined
  118. console.log('opt = ', this.pageType)
  119. // navigationArr: [
  120. // '合约账户',
  121. // '币币账户',
  122. // '法币账户',
  123. // '赠金账户'
  124. // ]
  125. this.getUserBill()
  126. },
  127. onReachBottom() {
  128. console.log('页面触底')
  129. },
  130. methods: {
  131. getTitle(type) {
  132. let title = ''
  133. switch (type) {
  134. case '0':
  135. title = '用户账单';
  136. break;
  137. case '1':
  138. title = '资产记录';
  139. break;
  140. case '2':
  141. title = '资产记录';
  142. break;
  143. case '3':
  144. title = '用户账单';
  145. break;
  146. default:
  147. title = '';
  148. }
  149. return title
  150. },
  151. // 获取用户账单
  152. getUserBill(){
  153. // moreStatus: 'more-loading', // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
  154. this.moreStatus = 'loading';
  155. Api_getUserBill({
  156. currency:3,
  157. type:this.pageType - 0 + 1,
  158. }).then(res => {
  159. this.tableData = res.list;
  160. if(this.tableData.length >= res.count ){
  161. this.moreStatus = 'more-loading';
  162. }else{
  163. this.moreStatus = 'loading';
  164. };
  165. console.log('Api_getUserBill = ' , this.res)
  166. }).catch(err => {
  167. })
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .pages-content {
  174. width: 100%;
  175. min-height: 100vh;
  176. background-color: #fff;
  177. }
  178. .table-box {
  179. background-color: $modules-box-bg;
  180. ::v-deep .uni-table-loading {
  181. display: none;
  182. }
  183. .sss {
  184. padding: 0 $pages-padding ;
  185. }
  186. ::v-deep .uni-table-tr {
  187. display: flex;
  188. // align-items: center;
  189. .uni-table-th,
  190. .uni-table-td {
  191. flex-shrink: 0;
  192. display: flex;
  193. flex-direction: column;
  194. justify-content: center;
  195. &:nth-child(1) {
  196. flex: 4;
  197. }
  198. &:nth-child(2) {
  199. flex: 3;
  200. }
  201. &:nth-child(3) {
  202. flex: 3;
  203. }
  204. }
  205. .uni-table-td {
  206. line-height: 1.2;
  207. padding: 25rpx 20rpx;
  208. word-break: break-all;
  209. white-space: pre-wrap;
  210. border-bottom: 1rpx solid #f5f5f5;
  211. &:last-child,
  212. &:first-child {
  213. padding-right: 0;
  214. padding-left: 0;
  215. }
  216. }
  217. .uni-table-th {
  218. border-bottom: 2rpx solid #e6e6e6;
  219. &:last-child {
  220. padding-right: $pages-padding;
  221. }
  222. &:first-child {
  223. padding-left: $pages-padding;
  224. }
  225. }
  226. }
  227. .table-title {
  228. font-size: 28rpx;
  229. font-family: PingFang SC, PingFang SC-Regular;
  230. font-weight: 400;
  231. color: #1a1a1a;
  232. }
  233. .table-text-01 {
  234. font-size: 28rpx;
  235. font-family: PingFang SC, PingFang SC-Bold;
  236. font-weight: 700;
  237. color: #1a1a1a;
  238. }
  239. .table-text-02 {
  240. font-size: 24rpx;
  241. font-family: PingFang SC, PingFang SC-Regular;
  242. font-weight: 400;
  243. color: #808080;
  244. }
  245. .table-text-03 {
  246. font-size: 28rpx;
  247. font-family: PingFang SC, PingFang SC-Bold;
  248. font-weight: 700;
  249. color: #0abd76;
  250. }
  251. .table-text-04 {
  252. font-size: 24rpx;
  253. font-family: PingFang SC, PingFang SC-Regular;
  254. font-weight: 400;
  255. color: #808080;
  256. }
  257. .table-text-05 {
  258. font-size: 28rpx;
  259. font-family: PingFang SC, PingFang SC-Bold;
  260. font-weight: 700;
  261. color: #1a1a1a;
  262. }
  263. }
  264. </style>