my-balance.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box seckill-box">
  3. <Nav title="我的余额" bgckgroundBox='transparent' leftColor='#fff' titleColor='#fff'></Nav>
  4. <view class="p-24 box-border-box">
  5. <view class="zzc-box b-rad-20 bgc-f flex-direction align-items-center flex-justify-center">
  6. <view class="fs-28 fc-9 mb-8">
  7. 总资产(元)
  8. </view>
  9. <view class="fs-52 fc-3 fw-b">
  10. <text class="fs-40 fw-600">¥</text>{{Number(moneyNum).toFixed(2)}}
  11. </view>
  12. </view>
  13. </view>
  14. <view class="plr-24 box-border-box mb-24">
  15. <view class="b-rad-200 bgc-f box-border-box">
  16. <scroll-view class="scroll-view_H" scroll-x="true">
  17. <view class="title-box b-rad-200 box-border-box text-align-center" v-for="(item,index) in titleData"
  18. @click="titleBut(item)" :class="item.water_key === titleId?'bgc-4FB3EF fc-f':''">
  19. {{item.water_name}}
  20. </view>
  21. </scroll-view>
  22. </view>
  23. </view>
  24. <view class="plr-24 box-border-box">
  25. <view class="p-24 box-border-box bgc-f sx-box">
  26. <picker mode="date" :value="tiem" :start="startDate" :end="endDate" @change="bindDateChange">
  27. <view class="align-items-center">
  28. <view class=" fs-28 fc-0 fw-400 align-items-center mr-8">
  29. {{tiem}}
  30. </view>
  31. <image class="right" src="@/static/img/toRight.png" mode=""></image>
  32. </view>
  33. </picker>
  34. </view>
  35. </view>
  36. <scroll-view :scroll-y="true" class="scroll-view-css plr-24 box-border-box" @scrolltolower="scrolltolower">
  37. <view class="bgc-f plr-32 box-border-box">
  38. <view v-if="listData.length == 0" class="scroll-view-css">
  39. <EnBlank :customSrc='true'>
  40. <template v-slot:blankImg>
  41. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  42. </template>
  43. </EnBlank>
  44. </view>
  45. <view class="ptb-24 item-box" v-for="(item,index) in listData" :key="index">
  46. <view class="align-items-center flex-justify-space mb-4">
  47. <view class="fs-32 fc-3">
  48. {{item.mark}}
  49. </view>
  50. <view class="fs-32 fw-600" :class="item.add_reduce === 0?'fc-3':'fc-FE9E11'">
  51. {{item.price}}
  52. </view>
  53. </view>
  54. <view class="align-items-center flex-justify-space">
  55. <view class="fs-24 fc-9">
  56. {{item.created_at}}
  57. </view>
  58. <view class="fs-24 fc-9">
  59. 当前余额{{Number(item.remainder).toFixed(2)}}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. moneyStatus,
  70. moneyList
  71. } from "@/api/money.js"
  72. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  73. export default {
  74. components: {
  75. EnBlank
  76. },
  77. data() {
  78. const currentDate = this.getDate({
  79. format: true
  80. })
  81. return {
  82. titleId: "0",
  83. titleData: [],
  84. listData: [],
  85. tiem: currentDate,
  86. page: 1,
  87. total: 0,
  88. moneyNum: ''
  89. };
  90. },
  91. computed: {
  92. startDate() {
  93. return this.getDate('start');
  94. },
  95. endDate() {
  96. return this.getDate('end');
  97. }
  98. },
  99. onLoad(data) {
  100. if(data) {
  101. this.moneyNum = data.money
  102. }
  103. },
  104. mounted() {
  105. this.moneyStatus()
  106. this.moneyList()
  107. },
  108. methods: {
  109. moneyList() {
  110. moneyList({
  111. status: this.titleId,
  112. monthDate: this.tiem,
  113. page: this.page
  114. }).then((res) => {
  115. if (res.code === 1) {
  116. this.listData.push(...res.data.list)
  117. this.total = res.data.total
  118. }
  119. })
  120. },
  121. bindDateChange(e) {
  122. this.tiem = e.detail.value
  123. this.page = 1;
  124. this.listData = [];
  125. this.moneyList();
  126. },
  127. titleBut(item) {
  128. if (item.water_key === this.titleId) {
  129. return
  130. }
  131. this.titleId = item.water_key
  132. this.page = 1;
  133. this.listData = [];
  134. this.moneyList();
  135. },
  136. moneyStatus() {
  137. moneyStatus().then((res) => {
  138. if (res.code === 1) {
  139. this.titleData = res.data
  140. }
  141. })
  142. },
  143. getDate(type) {
  144. const date = new Date();
  145. let year = date.getFullYear();
  146. let month = date.getMonth() + 1;
  147. let day = date.getDate();
  148. if (type === 'start') {
  149. year = year - 60;
  150. } else if (type === 'end') {
  151. year = year + 2;
  152. }
  153. month = month > 9 ? month : '0' + month;
  154. day = day > 9 ? day : '0' + day;
  155. return `${year}-${month}-${day}`;
  156. },
  157. scrolltolower() {
  158. if (this.listData.length < this.total) {
  159. ++this.page
  160. this.moneyList()
  161. }
  162. }
  163. },
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .item-box {
  168. border-bottom: 1rpx solid #EEEEEE;
  169. }
  170. .item-box:last-child {
  171. border: none;
  172. }
  173. .right {
  174. width: 32rpx;
  175. height: 32rpx;
  176. }
  177. .sx-box {
  178. border-radius: 20rpx 20rpx 0 0;
  179. }
  180. .seckill-box {
  181. background: linear-gradient(to bottom, #4FB3EF, #F5F5F5, #F5F5F5);
  182. }
  183. .zzc-box {
  184. width: 100%;
  185. height: 268rpx;
  186. }
  187. .scroll-view_H {
  188. white-space: nowrap;
  189. width: 100%;
  190. }
  191. .title-box {
  192. min-width: 33.3%;
  193. display: inline-block;
  194. height: 70rpx;
  195. line-height: 70rpx;
  196. padding: 0 50rpx;
  197. }
  198. </style>