ordercommissionComp.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <basicContainer :visible="visible">
  3. <avue-tabs :option="tabsOption" @change="changeTab" :visible="visible"></avue-tabs>
  4. <el-form :visible="visible">
  5. <el-form-item>
  6. <el-button-group>
  7. <el-col :span="12">
  8. <el-button size="small" :type="buttonDay" icon="el-icon-document" @click="handleDay">按日
  9. </el-button>
  10. </el-col>
  11. <el-col :span="12">
  12. <el-button size="small" :type="buttonMonth" icon="el-icon-data-line" @click="handleMonth">按月
  13. </el-button>
  14. </el-col>
  15. </el-button-group>
  16. <el-date-picker value-format="yyyy-MM-dd" size="small" v-model="selectDate" :type="dateType" :placeholder="dataPlace">
  17. </el-date-picker>
  18. <el-button-group>
  19. <!-- <el-col :span="12">
  20. <el-button size="small" :type="buttonList" icon="el-icon-document" @click="handleList">列表
  21. </el-button>
  22. </el-col> -->
  23. <el-col :span="12">
  24. <el-button size="small" :type="buttonChart" icon="el-icon-data-line" @click="handleStatic">统计
  25. </el-button>
  26. </el-col>
  27. </el-button-group>
  28. <el-button-group>
  29. <el-col :span="12">
  30. <el-button size="small" icon="el-icon-wallet" v-if="type.prop === 'paying'">结算
  31. </el-button>
  32. </el-col>
  33. </el-button-group>
  34. </el-form-item>
  35. </el-form>
  36. <!-- 图形 -->
  37. <div v-if="buttonChart == 'primary'" id="orderStatistics" :style="{ width: '100%', height: '450px' }">
  38. </div>
  39. <!-- <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :before-open="beforeOpen"
  40. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  41. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" v-if="buttonList == 'primary'">
  42. </avue-crud> -->
  43. </basicContainer>
  44. </template>
  45. <script>
  46. import echarts from "echarts";
  47. import {
  48. getList,
  49. getDetail,
  50. add,
  51. update,
  52. remove,
  53. getByAgenterAndTime
  54. } from "@/api/guosen/ordercommission";
  55. export default {
  56. props: {
  57. agenterId: {
  58. },
  59. visible:{
  60. }
  61. },
  62. data() {
  63. return {
  64. type: {},
  65. query: {
  66. status: 0,
  67. staticType: 1
  68. },
  69. chart: null,
  70. selectDate: [],
  71. dateType: "daterange",
  72. dataPlace: "选择日期",
  73. buttonList: "", //默认显示表格
  74. buttonChart: "primary", //默认图形不显示
  75. buttonDay: "primary", //默认显示按日
  76. buttonMonth: "", //默认图形不显示
  77. legendData: ['正向有功实时需量', '反向有功实时需量', '正向无功实时需量', '反向无功实时需量'],
  78. tableData: [],
  79. tabsOption: {
  80. column: [{
  81. icon: 'el-icon-warning',
  82. label: '待结算',
  83. prop: 'paying',
  84. }, {
  85. icon: 'el-icon-info',
  86. label: '已结算',
  87. prop: 'payed',
  88. }]
  89. },
  90. page: {
  91. pageSize: 10,
  92. currentPage: 1,
  93. total: 0
  94. },
  95. selectionList: [],
  96. option: {
  97. height: 'auto',
  98. calcHeight: 30,
  99. tip: false,
  100. searchShow: true,
  101. searchMenuSpan: 6,
  102. border: true,
  103. index: true,
  104. addBtn: false,
  105. menu: false,
  106. viewBtn: true,
  107. selection: true,
  108. dialogClickModal: false,
  109. column: [{
  110. label: "佣金金额",
  111. prop: "amt",
  112. rules: [{
  113. required: true,
  114. message: "请输入佣金金额",
  115. trigger: "blur"
  116. }]
  117. },
  118. {
  119. label: "佣金比例",
  120. prop: "rate",
  121. rules: [{
  122. required: true,
  123. message: "请输入佣金比例",
  124. trigger: "blur"
  125. }]
  126. },
  127. {
  128. label: "佣金类型",
  129. prop: "type",
  130. type: "select",
  131. dataType: "number",
  132. dicData: [{
  133. label: "城市分红",
  134. value: 1
  135. },
  136. {
  137. label: "推广分红",
  138. value: 2
  139. },
  140. ],
  141. rules: [{
  142. required: true,
  143. message: "请输入佣金类型:1-城市分红 2-推广分红",
  144. trigger: "blur"
  145. }]
  146. },
  147. {
  148. //-1: 取消 0:待结算 1:已结算
  149. label: "创建时间",
  150. prop: "createTime",
  151. }
  152. ]
  153. },
  154. }
  155. },
  156. mounted() {
  157. this.type = this.tabsOption.column[0];
  158. let befDate = new Date();
  159. let byear = befDate.getFullYear();
  160. let bmonth = befDate.getMonth() + 1;
  161. let bday = befDate.getDate();
  162. let startTime = `${byear}-${bmonth}-${bday}`;
  163. this.selectDate = [startTime, startTime];
  164. this.query.status = 0;
  165. },
  166. methods: {
  167. changeTab(column) {
  168. this.type = column;
  169. if (this.type.prop === "paying") {
  170. this.query.status = 0;
  171. } else if (this.type.prop === "payed") {
  172. this.query.status = 1;
  173. }
  174. },
  175. init() {
  176. this.type = this.tabsOption.column[0];
  177. let befDate = new Date();
  178. let byear = befDate.getFullYear();
  179. let bmonth = befDate.getMonth() + 1;
  180. let bday = befDate.getDate();
  181. let startTime = `${byear}-${bmonth}-${bday}`;
  182. this.selectDate = [startTime, startTime];
  183. this.query.agenterId = this.agenterId;
  184. this.query.status = 1; //默认已结算
  185. },
  186. //按日
  187. handleDay() {
  188. this.buttonDay = "primary";
  189. this.buttonMonth = "";
  190. this.query.staticType = 1;
  191. this.dateType = "daterange";
  192. this.dataPlace = "选择日期";
  193. },
  194. //按月
  195. handleMonth() {
  196. this.buttonDay = "";
  197. this.buttonMonth = "primary";
  198. this.query.staticType = 2;
  199. this.dateType = "monthrange";
  200. this.dataPlace = "选择月份";
  201. },
  202. //图表
  203. handleList() {
  204. this.buttonList = "primary";
  205. this.buttonChart = "";
  206. },
  207. //柱状图
  208. handleStatic() {
  209. this.buttonList = "";
  210. this.buttonChart = "primary";
  211. this.$nextTick(() => {
  212. this.loadData();
  213. })
  214. },
  215. loadData() {
  216. this.query.agenterId = this.agenterId;
  217. this.query.beginDate = this.selectDate[0];
  218. this.query.endDate = this.selectDate[1];
  219. getByAgenterAndTime(this.query).then(res => {
  220. this.drawRealDemandLine(res.data.data.dateList, res.data.data.dataList);
  221. console.log("dddd" + JSON.stringify(res.data))
  222. })
  223. },
  224. //柱形图
  225. drawRealDemandLine(dateList, dataList) {
  226. // 基于准备好的dom,初始化echarts实例
  227. let myChart = echarts.init(document.getElementById('orderStatistics'))
  228. // 基于准备好的dom,初始化echarts实例
  229. // 绘制图表
  230. myChart.setOption({
  231. title: {
  232. text: ''
  233. },
  234. tooltip: {},
  235. grid: { //直角坐标系内绘图网格
  236. show: true, //是否显示直角坐标系网格。[ default: false ]
  237. left: "20%", //grid 组件离容器左侧的距离。
  238. right: "30px",
  239. borderColor: "#c45455", //网格的边框颜色
  240. bottom: "20%" //
  241. },
  242. // x轴拖动
  243. dataZoom: [{
  244. type: "slider",
  245. realtime: true, //拖动滚动条时是否动态的更新图表数据
  246. height: 25, //滚动条高度
  247. start: 40, //滚动条开始位置(共100等份)
  248. end: 65 //结束位置(共100等份)
  249. }],
  250. xAxis: {
  251. data: dateList,
  252. axisLabel: { //坐标轴刻度标签的相关设置。
  253. interval: 0,
  254. rotate: "45"
  255. }
  256. },
  257. yAxis: {},
  258. series: [{
  259. name: '佣金(元)',
  260. type: 'bar',
  261. data: dataList
  262. }]
  263. });
  264. }
  265. },
  266. }
  267. </script>
  268. <style>
  269. </style>