statistics.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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="bg-white safe-area-inset-bottom" style="height: 100%;">
  27. <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  28. :down="downOption" :up="upOption">
  29. <view style="font-size: 34rpx;font-weight: 800;padding: 40rpx 40rpx 20rpx">收入记录</view>
  30. <navigator :url="'/pages/my-bills/bills-detail?id='+item.id+'&type=all'" class="u-border-bottom flex" v-for="(item,index) in list" :key="index">
  31. <view class="area1">
  32. <image v-if="$isNotEmpty(item.avatar)" :src="item.avatar" ></image>
  33. <block v-else>
  34. <image v-if="item.payWay=='WECHAT'" src="@/static/icon/wx.png" ></image>
  35. <image v-else-if="item.payWay=='ALIPAY'" src="@/static/icon/ALIPAY.png" ></image>
  36. <image v-else-if="item.payWay=='UNIONPAY'" src="@/static/icon/UNIONPAY.png" ></image>
  37. <image v-else-if="item.payWay=='APPLEPAY'" src="@/static/icon/apple.png" ></image>
  38. <image v-else src="@/static/icon/avatar.png" ></image>
  39. </block>
  40. <view>
  41. <text v-if="$isNotEmpty(item.nickName)">{{item.nickName}}</text>
  42. <block v-else >
  43. <text v-if="item.payWay=='WECHAT'">微信用户</text>
  44. <text v-else-if="item.payWay=='ALIPAY'">支付宝用户</text>
  45. <text v-else-if="item.payWay=='UNIONPAY'">银联用户</text>
  46. <text v-else-if="item.payWay=='APPLEPAY'">苹果用户</text>
  47. <text v-else>用户昵称</text>
  48. </block>
  49. <text>{{item.createTime}}</text>
  50. </view>
  51. </view>
  52. <view class="area2">
  53. <text>{{item.discount==-1 || item.discount==0 || item.discount==1?'无折扣':item.discount +'折'}}</text>
  54. </view>
  55. <view class="area3">
  56. <text class="text-base price" v-if="$isNotEmpty(item.receiveNumTotal)">{{item.receiveNumTotal}}</text>
  57. <text class="text-base price" v-else>{{item.cost || 0}}</text>
  58. </view>
  59. </navigator>
  60. </mescroll-body>
  61. </view>
  62. <u-picker v-model="showTime" mode="time" :params="params" @confirm="confirmTime">
  63. </u-picker>
  64. </view>
  65. </template>
  66. <script>
  67. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  68. import qiunDataCharts from "@/components/echarts/qiun-data-charts/qiun-data-charts.vue"
  69. export default {
  70. mixins: [MescrollMixin],
  71. components: {
  72. qiunDataCharts
  73. },
  74. data() {
  75. return {
  76. height: '',
  77. list: [],
  78. //统计数据
  79. statistics: {},
  80. //图表数据
  81. chartData: {},
  82. defaultTime: '',
  83. showTime: false,
  84. params: {
  85. year: true,
  86. },
  87. downOption:{
  88. use:false
  89. },
  90. }
  91. },
  92. onLoad() {
  93. this.defaultTime = this.$dateTime.format(new Date(), 'YYYY')
  94. this.getData()
  95. },
  96. methods: {
  97. async getElInfo() {
  98. let rectInfo = await this.$u.getRect('.card2');
  99. this.height = this.$u.sys().windowHeight - rectInfo.top + 'px'
  100. this.$forceUpdate()
  101. },
  102. async getData() {
  103. let params = {
  104. queryColumn: 'cost',
  105. queryDate: this.$dateTime.format(new Date(this.defaultTime)),
  106. receiveId: this.vuex_shopId
  107. }
  108. this.statistics = (await this.$api.statistics.getBillStatistics(params)).data
  109. this.chartData = {
  110. categories: this.statistics.monthList,
  111. series: [{
  112. color: "#facba8",
  113. name: "积分值(单位:元) ",
  114. data: this.statistics.dataList
  115. }]
  116. }
  117. },
  118. confirmTime(e) {
  119. this.defaultTime = e.year
  120. this.getData()
  121. this.downCallback()
  122. },
  123. upCallback(mescroll) {
  124. let params = {
  125. receiveId: this.vuex_shopId,
  126. current: mescroll.num,
  127. size: mescroll.size,
  128. payStatus:this.$global.PAY_STATUS.SUCCESS
  129. }
  130. if (this.defaultTime) {
  131. params.format = this.defaultTime
  132. }
  133. try {
  134. this.$api.bills.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. .area1 {
  211. $img-width: 70rpx;
  212. width: 54%;
  213. display: flex;
  214. height: 120rpx;
  215. justify-content: center;
  216. align-items: center;
  217. image {
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. width: $img-width;
  222. height: $img-width;
  223. border-radius: 50%;
  224. }
  225. view {
  226. width: calc(100% - $img-width);
  227. display: flex;
  228. flex-direction: column;
  229. justify-content: space-between;
  230. margin-left: 10rpx;
  231. }
  232. text:first-child {
  233. margin-bottom: 8rpx;
  234. }
  235. text:last-child {
  236. margin-top: 8rpx;
  237. color: #999;
  238. }
  239. }
  240. .area2 {
  241. display: flex;
  242. justify-content: center;
  243. align-items: center;
  244. text-align: center;
  245. width: 22%;
  246. margin-top: 10rpx;
  247. font-weight: 300;
  248. color: #666;
  249. }
  250. .area3 {
  251. display: flex;
  252. justify-content: center;
  253. align-items: center;
  254. width: 24%;
  255. font-size: 32rpx;
  256. margin-top: 10rpx;
  257. }
  258. </style>