bill.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. page:1,
  157. limit:15,
  158. currency:3,
  159. type:this.pageType - 0 + 1,
  160. }).then(res => {
  161. this.tableData = res.list;
  162. if(this.tableData.length >= res.count ){
  163. this.moreStatus = 'more-loading';
  164. }else{
  165. this.moreStatus = 'loading';
  166. };
  167. console.log('Api_getUserBill = ' , this.res)
  168. }).catch(err => {
  169. })
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .pages-content {
  176. width: 100%;
  177. min-height: 100vh;
  178. background-color: #fff;
  179. }
  180. .table-box {
  181. background-color: $modules-box-bg;
  182. ::v-deep .uni-table-loading {
  183. display: none;
  184. }
  185. .sss {
  186. padding: 0 $pages-padding ;
  187. }
  188. ::v-deep .uni-table-tr {
  189. display: flex;
  190. // align-items: center;
  191. .uni-table-th,
  192. .uni-table-td {
  193. flex-shrink: 0;
  194. display: flex;
  195. flex-direction: column;
  196. justify-content: center;
  197. &:nth-child(1) {
  198. flex: 4;
  199. }
  200. &:nth-child(2) {
  201. flex: 3;
  202. }
  203. &:nth-child(3) {
  204. flex: 3;
  205. }
  206. }
  207. .uni-table-td {
  208. line-height: 1.2;
  209. padding: 25rpx 20rpx;
  210. word-break: break-all;
  211. white-space: pre-wrap;
  212. border-bottom: 1rpx solid #f5f5f5;
  213. &:last-child,
  214. &:first-child {
  215. padding-right: 0;
  216. padding-left: 0;
  217. }
  218. }
  219. .uni-table-th {
  220. border-bottom: 2rpx solid #e6e6e6;
  221. &:last-child {
  222. padding-right: $pages-padding;
  223. }
  224. &:first-child {
  225. padding-left: $pages-padding;
  226. }
  227. }
  228. }
  229. .table-title {
  230. font-size: 28rpx;
  231. font-family: PingFang SC, PingFang SC-Regular;
  232. font-weight: 400;
  233. color: #1a1a1a;
  234. }
  235. .table-text-01 {
  236. font-size: 28rpx;
  237. font-family: PingFang SC, PingFang SC-Bold;
  238. font-weight: 700;
  239. color: #1a1a1a;
  240. }
  241. .table-text-02 {
  242. font-size: 24rpx;
  243. font-family: PingFang SC, PingFang SC-Regular;
  244. font-weight: 400;
  245. color: #808080;
  246. }
  247. .table-text-03 {
  248. font-size: 28rpx;
  249. font-family: PingFang SC, PingFang SC-Bold;
  250. font-weight: 700;
  251. color: #0abd76;
  252. }
  253. .table-text-04 {
  254. font-size: 24rpx;
  255. font-family: PingFang SC, PingFang SC-Regular;
  256. font-weight: 400;
  257. color: #808080;
  258. }
  259. .table-text-05 {
  260. font-size: 28rpx;
  261. font-family: PingFang SC, PingFang SC-Bold;
  262. font-weight: 700;
  263. color: #1a1a1a;
  264. }
  265. }
  266. </style>