pointBillStatistics.vue 6.3 KB

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