statistics.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view >
  3. <view class="card">
  4. <view class="top" @click="showTime=true">
  5. <text>{{defaultTime}}</text>
  6. <text class="cuIcon-unfold margin-left-10"></text>
  7. </view>
  8. <view class="bottom">
  9. <text>共支出 {{statistics.payNum}} 笔,合计</text>
  10. <text class="text-price">{{statistics.totalMoney}}</text>
  11. </view>
  12. <image class="logo" src="/pagesA/static/icon/bill.png" mode=""></image>
  13. </view>
  14. <view class="echart">
  15. <view class="title">
  16. 支出对比
  17. </view>
  18. <view class="" v-if="!$isEmpty(statistics.dataList)">
  19. <qiun-data-charts :inScrollView="true" type="column" :chartData="chartData" />
  20. </view>
  21. <view class="empty" v-else>
  22. <image src="/static/icon/empty5.png" mode="widthFix"></image>
  23. <text>暂无数据</text>
  24. </view>
  25. </view>
  26. <view class="card2">
  27. <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  28. :up="upOption">
  29. <view class="title">支出记录</view>
  30. <view class="item" hover-class="hoverClass" v-for="(item,index) in list" :key="index">
  31. <view class="area1">
  32. <view class="item-padding">
  33. <image :src="item.logo" style="border-radius: 50%;" mode="aspectFit"></image>
  34. <view class="">
  35. <text>{{item.name}}</text>
  36. <text>{{item.updateTime}}</text>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="area3 text-area u-flex-1">
  41. <view class="item-padding"
  42. style="text-align: right;flex:1;font-size: 34rpx;color: #F39248;margin-right: 20rpx;">
  43. -¥{{item.totalPrice}}</view>
  44. </view>
  45. </view>
  46. <view class="empty" style="margin-top: 80rpx;" v-if="$isEmpty(list)">
  47. <image src="/static/icon/empty5.png" mode="widthFix"></image>
  48. <text>暂无数据</text>
  49. </view>
  50. </mescroll-body>
  51. </view>
  52. <u-picker v-model="showTime" mode="time" :params="params" @confirm="confirmTime"></u-picker>
  53. </view>
  54. </template>
  55. <script>
  56. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  57. import qiunDataCharts from "../../comps/echarts/qiun-data-charts/qiun-data-charts.vue"
  58. export default {
  59. mixins: [MescrollMixin],
  60. components: {
  61. qiunDataCharts
  62. },
  63. data() {
  64. return {
  65. height:'',
  66. list:[],
  67. //统计数据
  68. statistics:{},
  69. //图表数据
  70. chartData: {},
  71. defaultTime:'',
  72. showTime:false,
  73. params: {
  74. year: true,
  75. month: true,
  76. },
  77. upOption:{
  78. empty:{
  79. use:false
  80. }
  81. }
  82. }
  83. },
  84. onLoad() {
  85. this.defaultTime =this.$dateTime.format(new Date(),'YYYY-mm')
  86. this.getData()
  87. },
  88. methods: {
  89. async getElInfo() {
  90. let rectInfo = await this.$u.getRect('.card2');
  91. this.height = this.$u.sys().windowHeight - rectInfo.top + 'px'
  92. this.$forceUpdate()
  93. },
  94. async getData() {
  95. let params={
  96. queryColumn:'total_price',
  97. queryDate: this.$dateTime.format(new Date(this.defaultTime)),
  98. payId:this.vuex_userId
  99. }
  100. this.statistics=(await this.$api.statistics.getBillStatistics(params)).data
  101. this.chartData = {
  102. categories: this.statistics.monthList,
  103. series: [{
  104. color: "#facba8",
  105. name: "积分值(单位:元) ",
  106. data: this.statistics.dataList
  107. }]
  108. }
  109. },
  110. confirmTime(e){
  111. this.defaultTime = e.year + '-' +e.month
  112. this.getData()
  113. this.downCallback()
  114. },
  115. upCallback(mescroll) {
  116. let params = {
  117. current:mescroll.num,
  118. size:mescroll.size,
  119. payId:this.vuex_userId,
  120. payStatus:'付款成功'
  121. }
  122. if (this.defaultTime) {
  123. params.createTime = this.$dateTime.format(new Date(this.defaultTime))
  124. } else {
  125. params.createTime = this.$dateTime.format(new Date())
  126. }
  127. try {
  128. this.$api.balanceBills.list(params).then(res => {
  129. let data = res.data.records
  130. let total = res.data.total
  131. mescroll.endBySize(data.length, total);
  132. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  133. this.list = this.list.concat(data); //追加新数据
  134. this.getElInfo()
  135. })
  136. } catch (e) {
  137. this.mescroll.endErr()
  138. }
  139. },
  140. }
  141. }
  142. </script>
  143. <style lang="scss">
  144. .echart {
  145. margin-top: 30rpx;
  146. background-color: #FFFFFF;
  147. padding-bottom: 40rpx;
  148. .title {
  149. font-weight: 800;
  150. font-size: 34rpx;
  151. padding: 40rpx 40rpx 60rpx;
  152. }
  153. }
  154. .empty{
  155. margin: 60rpx;
  156. display: flex;
  157. justify-content: center;
  158. align-items: center;
  159. flex-direction: column;
  160. image{
  161. width: 200rpx;
  162. height: 200rpx;
  163. }
  164. text{
  165. color: #999999;
  166. font-weight: 300;
  167. margin-top: 40rpx;
  168. }
  169. }
  170. .card {
  171. background-color: #FC8D38;
  172. padding: 60rpx 0 60rpx 50rpx;
  173. height: 360rpx;
  174. display: flex;
  175. flex-direction: column;
  176. justify-content: space-between;
  177. position: relative;
  178. .logo{
  179. z-index: 999;
  180. position: absolute;
  181. right: 0rpx;
  182. bottom: 0rpx;
  183. width: 220rpx;
  184. height: 200rpx;
  185. }
  186. .top {
  187. color: #FFFFFF;
  188. font-size: 36rpx;
  189. }
  190. .bottom {
  191. display: flex;
  192. flex-direction: column;
  193. text:first-child {
  194. color: #FFD1AE;
  195. font-size: 28rpx;
  196. }
  197. text:last-child {
  198. margin-top: 16rpx;
  199. font-size: 56rpx;
  200. color: #FFFFFF;
  201. }
  202. }
  203. }
  204. .card2 {
  205. margin-top: 30rpx;
  206. background-color: #FFFFFF;
  207. .title{
  208. font-size: 34rpx;
  209. font-weight: 800;
  210. padding: 40rpx 40rpx 20rpx;
  211. }
  212. .area-padding {
  213. padding: 40rpx 0 20rpx;
  214. }
  215. .text-area{
  216. display: flex;
  217. justify-content: flex-start;
  218. align-items: center;
  219. }
  220. .area1 {
  221. padding-left: 30rpx;
  222. width: 55%;
  223. view:first-child {
  224. display: flex;
  225. image {
  226. width: 80rpx;
  227. height: 80rpx
  228. }
  229. view {
  230. padding-left: 15rpx;
  231. padding-bottom: 5rpx;
  232. display: flex;
  233. flex-direction: column;
  234. text:first-child {
  235. font-size: 32rpx;
  236. padding-bottom: 10rpx;
  237. color: #000;
  238. }
  239. text:last-child {
  240. font-size: 22rpx;
  241. color: #888888;
  242. }
  243. }
  244. }
  245. }
  246. .area2 {
  247. width: 25%;
  248. }
  249. .area3 {
  250. width: 20%;
  251. }
  252. .item-padding {
  253. padding: 20rpx 0;
  254. }
  255. .item {
  256. padding: 5rpx;
  257. display: flex;
  258. border-bottom: 1rpx solid #DDDDDD;
  259. }
  260. .item:last-child{
  261. border: none;
  262. }
  263. }
  264. </style>