incomeAnalysis.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <!-- 收入分析 -->
  2. <template>
  3. <view class="revenue">
  4. <view class="revenue-search">
  5. <view class="revenue-search-item" @click="incomeTypePicker = true">
  6. <u--input
  7. placeholder="请输入内容"
  8. v-model="searchContent.text"
  9. suffixIcon="arrow-down"
  10. :readonly="true"
  11. ></u--input>
  12. </view>
  13. <view class="revenue-search-item">
  14. <!-- <u-button text="搜索" type="primary" class="revenue-search-item-btn" @click="searchClick"></u-button> -->
  15. </view>
  16. </view>
  17. <view class="revenue-line">
  18. <ColumnChart v-if="chartData.series[0].data.length || chartData.series[1].data.length" :chartData="chartData" :title="title" :opts="opts"/>
  19. <view class="empty" v-else>
  20. <u-empty></u-empty>
  21. </view>
  22. </view>
  23. <u-picker
  24. :show="incomeTypePicker"
  25. :columns="dictList"
  26. @confirm="incomeTypeConfirm"
  27. @cancel="incomeTypePicker = false"
  28. ></u-picker>
  29. </view>
  30. </template>
  31. <script>
  32. import ColumnChart from '@/components/columnChart.vue'
  33. export default {
  34. components: {
  35. ColumnChart
  36. },
  37. props: {
  38. title: {
  39. type: String,
  40. default: ''
  41. },
  42. opts: {
  43. type: Object,
  44. default: () => {
  45. return {
  46. enableScroll: true,
  47. xAxis: {
  48. rotateLabel: false,
  49. scrollShow: true,
  50. itemCount: 8
  51. },
  52. yAxis: {
  53. showTitle: true,
  54. splitNumber: 5,
  55. data: [{
  56. title: '元',
  57. titleOffsetY: -3
  58. }]
  59. },
  60. legend: {
  61. show: false
  62. },
  63. dataLabel: false,
  64. padding: [20, 0, 10, 0],
  65. extra: {
  66. column: {
  67. width: 20
  68. }
  69. }
  70. }
  71. }
  72. }
  73. },
  74. data() {
  75. return {
  76. chartData: {
  77. categories: [],
  78. series: [
  79. {
  80. name: '路段',
  81. data: []
  82. }, {
  83. name: '停车场',
  84. data: []
  85. }]
  86. },
  87. searchContent: {
  88. text: '',
  89. value: ''
  90. },
  91. dictList: [[]],
  92. incomeTypePicker: false,
  93. reportType: '',
  94. queryDate: ''
  95. }
  96. },
  97. // created() {
  98. // this.getDict();
  99. // },
  100. methods: {
  101. getData({ reportType, queryDate }) {
  102. this.reportType = reportType
  103. this.queryDate = queryDate
  104. this.getDict();
  105. },
  106. getDict() {
  107. uni.$u.api.getDictApi({ type: 'income_type'}).then(res => {
  108. if (res.code === 200) {
  109. let list = res.data.map((item => {
  110. return {
  111. text: item.dictLabel,
  112. value: item.dictValue
  113. }
  114. }))
  115. this.dictList = [list]
  116. if (!this.searchContent.value) {
  117. this.searchContent = this.dictList[0][0]
  118. }
  119. this.getIncomeData()
  120. }
  121. })
  122. },
  123. getIncomeData() {
  124. this.chartData.categories = []
  125. this.chartData.series[0].data = []
  126. this.chartData.series[1].data = []
  127. uni.$u.api.operationalAnalysisApi.getIncomeDataApi({
  128. reportType: this.reportType,
  129. queryDate: this.queryDate,
  130. incomeType: this.searchContent.value
  131. }).then(res => {
  132. if (res.code === 200) {
  133. if (res.data.itemList && res.data.itemList.length) {
  134. this.chartData.categories = res.data.itemList.map(item => {
  135. return item.statisTime
  136. })
  137. this.chartData.series[0].data = res.data.itemList.map(item => {
  138. return item.amt
  139. })
  140. }
  141. }
  142. })
  143. uni.$u.api.operationalAnalysisApi.getParkingIncomeDataApi({
  144. reportType: this.reportType,
  145. queryDate: this.queryDate,
  146. incomeType: this.searchContent.value
  147. }).then(res => {
  148. if (res.code === 200) {
  149. if (res.data.itemList && res.data.itemList.length) {
  150. this.chartData.categories = res.data.itemList.map(item => {
  151. return item.statisTime
  152. })
  153. this.chartData.series[1].data = res.data.itemList.map(item => {
  154. return item.amt
  155. })
  156. }
  157. }
  158. })
  159. },
  160. incomeTypeConfirm(e) {
  161. this.searchContent = e.value[0]
  162. this.getIncomeData()
  163. this.incomeTypePicker = false
  164. },
  165. searchClick() {
  166. // this.getIncomeData()
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .revenue {
  173. background-color: #fff;
  174. border-radius: 5px;
  175. &-search {
  176. margin-bottom: 12px;
  177. padding: 19px 15px 0 15px;
  178. display: flex;
  179. &-item {
  180. width: 48%;
  181. margin-right: 2%;
  182. &-btn {
  183. width: 50%;
  184. height: 38px;
  185. }
  186. }
  187. }
  188. }
  189. .empty {
  190. padding: 15px;
  191. }
  192. </style>