statistics.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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.receiverLogo" style="border-radius: 50%;" ></image>
  34. <view class="">
  35. <text>{{item.receiverName}}</text>
  36. <text>{{item.createTime}}</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. },
  76. upOption:{
  77. empty:{
  78. use:false
  79. }
  80. }
  81. }
  82. },
  83. onLoad() {
  84. this.defaultTime =this.$dateTime.format(new Date(),'YYYY')
  85. this.getData()
  86. },
  87. methods: {
  88. async getElInfo() {
  89. let rectInfo = await this.$u.getRect('.card2');
  90. this.height = this.$u.sys().windowHeight - rectInfo.top + 'px'
  91. this.$forceUpdate()
  92. },
  93. async getData() {
  94. let params={
  95. queryColumn:'total_price',
  96. queryDate: this.$dateTime.format(new Date(this.defaultTime)),
  97. payId:this.vuex_userId
  98. }
  99. this.statistics=(await this.$api.statistics.getBillStatistics(params)).data
  100. this.chartData = {
  101. categories: this.statistics.monthList,
  102. series: [{
  103. color: "#facba8",
  104. name: "积分值(单位:元) ",
  105. data: this.statistics.dataList
  106. }]
  107. }
  108. },
  109. confirmTime(e){
  110. this.defaultTime = e.year
  111. this.getData()
  112. this.downCallback()
  113. },
  114. upCallback(mescroll) {
  115. let params = {
  116. current:mescroll.num,
  117. size:mescroll.size,
  118. payId:this.vuex_userId,
  119. payStatus:'付款成功'
  120. }
  121. if (this.defaultTime) {
  122. params.createTime = this.$dateTime.format(new Date(this.defaultTime))
  123. } else {
  124. params.createTime = this.$dateTime.format(new Date())
  125. }
  126. try {
  127. this.$api.bills.list(params).then(res => {
  128. let data = res.data.records
  129. let total = res.data.total
  130. mescroll.endBySize(data.length, total);
  131. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  132. this.list = this.list.concat(data); //追加新数据
  133. this.getElInfo()
  134. })
  135. } catch (e) {
  136. this.mescroll.endErr()
  137. }
  138. },
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. .echart {
  144. margin-top: 30rpx;
  145. background-color: #FFFFFF;
  146. padding-bottom: 40rpx;
  147. .title {
  148. font-weight: 800;
  149. font-size: 34rpx;
  150. padding: 40rpx 40rpx 60rpx;
  151. }
  152. }
  153. .empty{
  154. margin: 60rpx;
  155. display: flex;
  156. justify-content: center;
  157. align-items: center;
  158. flex-direction: column;
  159. image{
  160. width: 200rpx;
  161. height: 200rpx;
  162. }
  163. text{
  164. color: #999999;
  165. font-weight: 300;
  166. margin-top: 40rpx;
  167. }
  168. }
  169. .card {
  170. background-color: #FC8D38;
  171. padding: 60rpx 0 60rpx 50rpx;
  172. height: 360rpx;
  173. display: flex;
  174. flex-direction: column;
  175. justify-content: space-between;
  176. position: relative;
  177. .logo{
  178. z-index: 999;
  179. position: absolute;
  180. right: 0rpx;
  181. bottom: 0rpx;
  182. width: 220rpx;
  183. height: 200rpx;
  184. }
  185. .top {
  186. color: #FFFFFF;
  187. font-size: 36rpx;
  188. }
  189. .bottom {
  190. display: flex;
  191. flex-direction: column;
  192. text:first-child {
  193. color: #FFD1AE;
  194. font-size: 28rpx;
  195. }
  196. text:last-child {
  197. margin-top: 16rpx;
  198. font-size: 56rpx;
  199. color: #FFFFFF;
  200. }
  201. }
  202. }
  203. .card2 {
  204. margin-top: 30rpx;
  205. background-color: #FFFFFF;
  206. .title{
  207. font-size: 34rpx;
  208. font-weight: 800;
  209. padding: 40rpx 40rpx 20rpx;
  210. }
  211. .area-padding {
  212. padding: 40rpx 0 20rpx;
  213. }
  214. .text-area{
  215. display: flex;
  216. justify-content: flex-start;
  217. align-items: center;
  218. }
  219. .area1 {
  220. padding-left: 30rpx;
  221. width: 55%;
  222. view:first-child {
  223. display: flex;
  224. image {
  225. width: 80rpx;
  226. height: 80rpx
  227. }
  228. view {
  229. padding-left: 15rpx;
  230. padding-bottom: 5rpx;
  231. display: flex;
  232. flex-direction: column;
  233. text:first-child {
  234. font-size: 32rpx;
  235. padding-bottom: 10rpx;
  236. color: #000;
  237. }
  238. text:last-child {
  239. font-size: 22rpx;
  240. color: #888888;
  241. }
  242. }
  243. }
  244. }
  245. .area2 {
  246. width: 25%;
  247. }
  248. .area3 {
  249. width: 20%;
  250. }
  251. .item-padding {
  252. padding: 20rpx 0;
  253. }
  254. .item {
  255. padding: 5rpx;
  256. display: flex;
  257. border-bottom: 1rpx solid #DDDDDD;
  258. }
  259. .item:last-child{
  260. border: none;
  261. }
  262. }
  263. </style>