dayReport.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <template>
  2. <el-scrollbar style="height:100%">
  3. <div>
  4. <div>
  5. <el-form
  6. :model="queryParams"
  7. style="margin-left: 20px;"
  8. ref="queryForm"
  9. :inline="true"
  10. v-show="showSearch"
  11. label-width="68px"
  12. >
  13. <el-form-item>
  14. <el-button size="mini" @click="dayDataSource">今天</el-button>
  15. <el-button size="mini" @click="yesDataSource">昨天</el-button>
  16. <el-button size="mini" @click="workDataSource">本周</el-button>
  17. <el-button size="mini" @click="monthDataSource">本月</el-button>
  18. <el-date-picker
  19. style="margin: 0px 10px;"
  20. size="mini"
  21. v-model="dateRangeCreatedDate"
  22. type="daterange"
  23. range-separator="至"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. ></el-date-picker>
  27. <el-button size="mini" @click="queryDataSource">查询</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <span style="color:#ff9955;font-size:25px;">|</span>
  31. <span style="font-size:20px;">数据概览</span>
  32. <el-row :gutter="10" class="panel-group">
  33. <el-col :xs="12" :sm="12" :lg="6">
  34. <div class="flex xiaoliang">
  35. <div style="line-height: 62px;font-size: 44px;">{{ form.zongliters }}L</div>
  36. <div style="font-size: 28px;">总销量</div>
  37. </div>
  38. </el-col>
  39. <el-col :xs="12" :sm="12" :lg="6">
  40. <div class="flex xiaoe">
  41. <div style="line-height: 62px;font-size: 44px;">{{ form.zongAmt }}元</div>
  42. <div style="font-size: 28px;">总金额</div>
  43. </div>
  44. </el-col>
  45. <el-col :xs="12" :sm="12" :lg="6">
  46. <div class="flex xiaoliang">
  47. <div style="line-height: 62px;font-size: 44px;">{{ form.qyamt }}元</div>
  48. <div style="font-size: 28px;">汽油</div>
  49. </div>
  50. </el-col>
  51. <el-col :xs="12" :sm="12" :lg="6">
  52. <div class="flex xiaoliang">
  53. <div style="line-height: 62px;font-size: 44px;">{{ form.cyamt}}元</div>
  54. <div style="font-size: 28px;">柴油</div>
  55. </div>
  56. </el-col>
  57. </el-row>
  58. </div>
  59. <div style="width:100%; height: 360px;background: #FFFFFF;">
  60. <span style="color:#ff9955;font-size:25px;">|</span>
  61. <span style="font-size:20px;">销售情况</span>
  62. <div ref="myChart" style="width:100%; height: 350px;margin: 0px 25px;"></div>
  63. </div>
  64. <div style="width:100%; height: 181px;">
  65. <span style="color:#ff9955;font-size:25px;">|</span>
  66. <span style="font-size:20px;">详情:</span>
  67. <el-table v-loading="loading" :data="dayReportList">
  68. <el-table-column label="日期" align="center" prop="payDate">
  69. <template slot-scope="scope">
  70. <span>{{ parseTime(scope.row.createdDate, '{y}-{m}-{d}') }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="销额" align="center" prop="amt" />
  74. <el-table-column label="销量(L)" align="center" prop="orderLiters" v-if="false" />
  75. <el-table-column label="汽油" align="center" prop="qyAmt" />
  76. <el-table-column label="柴油" align="center" prop="cyAmt" />
  77. <el-table-column label="订单数" align="center" prop="orderNo" />
  78. <el-table-column label="应收" align="center" prop="receivableAmt" />
  79. <el-table-column label="到账" align="center" prop ="receivedAmt"/>
  80. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  81. <template slot-scope="scope">
  82. <el-button
  83. size="mini"
  84. type="text"
  85. icon="el-icon-edit"
  86. @click="handleLook(scope.row)"
  87. >详情</el-button>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <pagination
  92. v-show="total>0"
  93. :total="total"
  94. :page.sync="queryParams.pageNum"
  95. :limit.sync="queryParams.pageSize"
  96. @pagination="dayReportDetail"
  97. />
  98. </div>
  99. <el-dialog :title="title" width="800px" :visible.sync="open" append-to-body>
  100. <el-table v-loading="loading" :data="dayReportDetailsList">
  101. <el-table-column label="油品" align="center" prop="oilName" />
  102. <el-table-column label="油枪号" align="center" prop="oilGun" />
  103. <el-table-column label="销量(L)" align="center" prop="orderLiters" />
  104. <el-table-column label="应收金额(元)" align="center" prop="receivableAmt" />
  105. <el-table-column label="实收金额(元)" align="center" prop="amt" />
  106. <el-table-column label="优惠金额(元)" align="center" prop="discountAmt" />
  107. <el-table-column label="优惠劵" align="center" prop="discountCouponAmt" v-if="false"/>
  108. <el-table-column label="会员支付" align="center" prop="menberAmt" v-if="false" />
  109. <el-table-column label="微信支付" align="center" prop="wxAmt" v-if="false" />
  110. <el-table-column label="支付宝支付" align="center" prop="zfbAmt"v-if="false" />
  111. <el-table-column label="会员充值" align="center" prop v-if="false" />
  112. <el-table-column label="积分消费" align="center" prop v-if="false" />
  113. </el-table>
  114. <pagination
  115. v-show="total1>0"
  116. :total="total1"
  117. :page.sync="queryInfo.pageNum"
  118. :limit.sync="queryInfo.pageSize"
  119. @pagination="getLookOrder"
  120. />
  121. </el-dialog>
  122. </div>
  123. </el-scrollbar>
  124. </template>
  125. <script>
  126. import echarts from "echarts";
  127. require("echarts/theme/macarons"); // echarts theme
  128. import {
  129. listSum,
  130. listOilType,
  131. listDayReport,
  132. selectDayReportDetail,
  133. getDetails,
  134. listXdata,
  135. listQydata92,
  136. listQydata95,
  137. listQydata97,
  138. listQydata0,
  139. listQydata10,
  140. listQydata20
  141. } from "@/api/dataSource/saleReport";
  142. export default {
  143. name: "source",
  144. data() {
  145. return {
  146. charts: null,
  147. // 遮罩层
  148. loading: true,
  149. // 选中数组
  150. ids: [],
  151. // 非单个禁用
  152. single: true,
  153. // 非多个禁用
  154. multiple: true,
  155. // 显示搜索条件
  156. showSearch: true,
  157. // 总条数
  158. total: 0,
  159. total1: 0,
  160. // 优惠劵管理表格数据
  161. couponList: [],
  162. dayReportDetailsList: [],
  163. dateRangeCreatedDate: [],
  164. //x轴数据
  165. xdata: [],
  166. //92#汽油数据
  167. qydata92: [],
  168. //95#汽油数据
  169. qydata95: [],
  170. //97#汽油数据
  171. qydata97: [],
  172. //0#柴油数据
  173. cydata0: [],
  174. //-10#柴油数据
  175. cydata10: [],
  176. //-20#柴油数据
  177. cydata20: [],
  178. // 弹出层标题
  179. title: "",
  180. // 是否显示弹出层
  181. open: false,
  182. // 查询参数
  183. queryParams: {
  184. createdDate: null,
  185. stationId:null,
  186. stationName: null,
  187. beginTime: null,
  188. endTime: null,
  189. payDate: null,
  190. status:"1"
  191. },
  192. // 查询参数
  193. queryInfo: {
  194. pageNum: 1,
  195. pageSize: 10,
  196. payDate: null,
  197. status: null,
  198. createdDate: null,
  199. beginTime: null,
  200. endTime: null,
  201. orderType: null,
  202. stationId:null
  203. },
  204. //日报数据
  205. dayReportList: [],
  206. // 表单参数
  207. form: {
  208. zongAmt: 0,
  209. zongliters: 0,
  210. qyamt: 0,
  211. cyamt: 0
  212. },
  213. // 表单校验
  214. rules: {}
  215. };
  216. },
  217. mounted() {
  218. this.$nextTick(() => {
  219. this.queryParams.beginTime = this.getMonthDate();
  220. this.queryParams.endTime = this.getEndFormatDate(new Date());
  221. this.queryParams.stationId=this.$store.selectDeptId;
  222. setTimeout(() => {
  223. this.initChart();
  224. }, 1000);
  225. });
  226. },
  227. created() {
  228. this.dayDataSource();
  229. //获取折线图的数据
  230. this.reset();
  231. this.queryParams.beginTime = this.getMonthDate();
  232. this.queryParams.endTime = this.getEndFormatDate(new Date());
  233. this.queryParams.stationId=this.$store.selectDeptId;
  234. this.getDatas();
  235. },
  236. methods: {
  237. initChart() {
  238. // 初始化echarts
  239. this.charts = echarts.init(this.$refs.myChart, "macarons");
  240. this.charts.setOption(
  241. {
  242. xAxis: {
  243. data: this.xdata,
  244. boundaryGap: false,
  245. axisTick: {
  246. show: false
  247. }
  248. },
  249. tooltip: {
  250. trigger: "axis",
  251. axisPointer: {
  252. type: "cross"
  253. },
  254. padding: [5, 10]
  255. },
  256. yAxis: {
  257. axisTick: {
  258. show: false
  259. }
  260. },
  261. legend: {
  262. data: ["92#", "95#", "97#", "0#", "-10#", "-20#"]
  263. },
  264. animation: false,
  265. series: [
  266. {
  267. name: "92#",
  268. itemStyle: {
  269. normal: {
  270. color: "#FF005A",
  271. lineStyle: {
  272. color: "#FF005A",
  273. width: 2
  274. }
  275. }
  276. },
  277. smooth: true,
  278. type: "line",
  279. data: this.qydata92
  280. },
  281. {
  282. name: "95#",
  283. smooth: true,
  284. type: "line",
  285. itemStyle: {
  286. normal: {
  287. color: "#3888fa",
  288. lineStyle: {
  289. color: "#3888fa",
  290. width: 2
  291. }
  292. }
  293. },
  294. data: this.qydata95
  295. },
  296. {
  297. name: "97#",
  298. smooth: true,
  299. type: "line",
  300. itemStyle: {
  301. normal: {
  302. color: "#ffff00",
  303. lineStyle: {
  304. color: "#ffff00",
  305. width: 2
  306. }
  307. }
  308. },
  309. data: this.qydata97
  310. },
  311. {
  312. name: "0#",
  313. smooth: true,
  314. type: "line",
  315. itemStyle: {
  316. normal: {
  317. color: "#00ff00",
  318. lineStyle: {
  319. color: "#00ff00",
  320. width: 2
  321. }
  322. }
  323. },
  324. data: this.cydata0
  325. },
  326. {
  327. name: "-10#",
  328. smooth: true,
  329. type: "line",
  330. itemStyle: {
  331. normal: {
  332. color: "#00bfff",
  333. lineStyle: {
  334. color: "#00bfff",
  335. width: 2
  336. }
  337. }
  338. },
  339. data: this.cydata10
  340. },
  341. {
  342. name: "-20#",
  343. smooth: true,
  344. type: "line",
  345. itemStyle: {
  346. normal: {
  347. color: "#ffb6c1",
  348. lineStyle: {
  349. color: "#ffb6c1",
  350. width: 2
  351. }
  352. }
  353. },
  354. data: this.cydata20
  355. /* animationDuration: 2800,
  356. animationEasing: 'quadraticOut'*/
  357. }
  358. ]
  359. },
  360. true
  361. );
  362. },
  363. getXData() {
  364. return listXdata(this.queryParams).then(response => {
  365. this.xdata = [];
  366. if(response.hasOwnProperty('rows')){
  367. for (let i in response.rows) {
  368. this.xdata.push(response.rows[i].createdDate);
  369. }
  370. }
  371. });
  372. },
  373. getQyData92() {
  374. return listQydata92(this.queryParams).then(response => {
  375. this.qydata92 = [];
  376. if(response.hasOwnProperty('rows')){
  377. for (let i in response.rows) {
  378. let data = [];
  379. data.push(response.rows[i].createdDate);
  380. data.push(response.rows[i].amt);
  381. this.qydata92.push(data);
  382. }
  383. }
  384. });
  385. },
  386. getQydata95() {
  387. return listQydata95(this.queryParams).then(response => {
  388. this.qydata95 = [];
  389. if(response.hasOwnProperty('rows')){
  390. for (let i in response.rows) {
  391. let data = [];
  392. data.push(response.rows[i].createdDate);
  393. data.push(response.rows[i].amt);
  394. this.qydata95.push(data);
  395. }
  396. }
  397. });
  398. },
  399. getQydata97() {
  400. return listQydata97(this.queryParams).then(response => {
  401. this.qydata97 = [];
  402. if(response.hasOwnProperty('rows')){
  403. for (let i in response.rows) {
  404. let data = [];
  405. data.push(response.rows[i].createdDate);
  406. data.push(response.rows[i].amt);
  407. this.qydata97.push(data);
  408. }
  409. }
  410. });
  411. },
  412. getQydata0() {
  413. return listQydata0(this.queryParams).then(response => {
  414. this.cydata0 = [];
  415. if(response.hasOwnProperty('rows')){
  416. for (let i in response.rows) {
  417. let data = [];
  418. data.push(response.rows[i].createdDate);
  419. data.push(response.rows[i].amt);
  420. this.cydata0.push(data);
  421. }
  422. }
  423. });
  424. },
  425. getQydata10() {
  426. return listQydata10(this.queryParams).then(response => {
  427. this.cydata10 = [];
  428. if(response.hasOwnProperty('rows')){
  429. for (let i in response.rows) {
  430. let data = [];
  431. data.push(response.rows[i].createdDate);
  432. data.push(response.rows[i].amt);
  433. this.cydata10.push(data);
  434. }
  435. }
  436. });
  437. },
  438. getQydata20() {
  439. return listQydata20(this.queryParams).then(response => {
  440. this.cydata20 = [];
  441. if(response.hasOwnProperty('rows')){
  442. for (let i in response.rows) {
  443. let data = [];
  444. data.push(response.rows[i].createdDate);
  445. data.push(response.rows[i].amt);
  446. this.cydata20.push(data);
  447. }
  448. }
  449. });
  450. },
  451. //获取折线图用到的数据
  452. getDatas() {
  453. Promise.all([
  454. this.getXData(),
  455. this.getQyData92(),
  456. this.getQydata95(),
  457. this.getQydata97(),
  458. this.getQydata0(),
  459. this.getQydata10(),
  460. this.getQydata20()
  461. ]).then(res => {
  462. this.initChart();
  463. });
  464. },
  465. /** 查询优惠劵管理列表 */
  466. getList() {
  467. listSum(this.queryParams).then(response => {
  468. if (response.hasOwnProperty('data')) {
  469. this.form.zongAmt = response.data.amt;
  470. this.form.zongliters = response.data.orderLiters;
  471. }
  472. });
  473. listOilType(this.queryParams).then(response => {
  474. if(response.hasOwnProperty('rows')){
  475. for (let i in response.rows) {
  476. if (response.rows[i].oilType === "2") {
  477. this.form.qyamt = response.rows[i].amt;
  478. } else if (response.rows[i].oilType === "1") {
  479. this.form.cyamt = response.rows[i].amt;
  480. }
  481. }
  482. }
  483. });
  484. this.dayReportDetail();
  485. },
  486. dayReportDetail(){
  487. selectDayReportDetail(this.queryParams).then(response => {
  488. this.dayReportList = response.rows;
  489. this.total = response.total;
  490. this.loading = false;
  491. });
  492. },
  493. //本日的数据
  494. dayDataSource() {
  495. this.reset();
  496. this.queryParams.beginTime = this.getNowFormatDate(new Date());
  497. this.queryParams.endTime = this.getEndFormatDate(new Date());
  498. this.queryParams.stationId=this.$store.selectDeptId;
  499. this.getList();
  500. },
  501. //昨天的数据
  502. yesDataSource() {
  503. this.reset();
  504. this.queryParams.beginTime = this.getFormatDate(new Date());
  505. this.queryParams.endTime = this.getNowFormatDate(new Date());
  506. this.queryParams.stationId=this.$store.selectDeptId;
  507. this.getList();
  508. },
  509. //本周的数据
  510. workDataSource() {
  511. this.reset();
  512. this.queryParams.beginTime = this.getDates();
  513. this.queryParams.endTime = this.getEndFormatDate(new Date());
  514. this.queryParams.stationId=this.$store.selectDeptId;
  515. //this.initChart();
  516. this.getDatas();
  517. this.getList();
  518. },
  519. //本月数据
  520. monthDataSource() {
  521. this.reset();
  522. this.queryParams.beginTime = this.getMonthDate();
  523. this.queryParams.endTime = this.getEndFormatDate(new Date());
  524. this.queryParams.stationId=this.$store.selectDeptId;
  525. this.getDatas();
  526. this.getList();
  527. },
  528. //按照指定日期
  529. queryDataSource() {
  530. this.reset();
  531. this.queryParams.beginTime = this.dateRangeCreatedDate[0];
  532. this.queryParams.endTime = this.dateRangeCreatedDate[1];
  533. this.queryParams.stationId=this.$store.selectDeptId;
  534. this.getDatas();
  535. this.getList();
  536. },
  537. //今天
  538. getNowFormatDate(date) {
  539. let seperator1 = "-";
  540. let month = date.getMonth() + 1;
  541. let strDate = date.getDate();
  542. if (month >= 1 && month <= 9) {
  543. month = "0" + month;
  544. }
  545. if (strDate >= 0 && strDate <= 9) {
  546. strDate = "0" + strDate;
  547. }
  548. let currentdate1 =
  549. date.getFullYear() + seperator1 + month + seperator1 + strDate;
  550. return currentdate1;
  551. },
  552. //明天
  553. getEndFormatDate(myDate) {
  554. let date = myDate.getDate();
  555. date = date + 1;
  556. myDate.setDate(date);
  557. let seperator2 = "-";
  558. let month = myDate.getMonth() + 1;
  559. let strDate = myDate.getDate();
  560. if (month >= 1 && month <= 9) {
  561. month = "0" + month;
  562. }
  563. if (strDate >= 0 && strDate <= 9) {
  564. strDate = "0" + strDate;
  565. }
  566. let currentdate2 =
  567. myDate.getFullYear() + seperator2 + month + seperator2 + strDate;
  568. return currentdate2;
  569. },
  570. //昨天
  571. getFormatDate(myDate) {
  572. let date = myDate.getDate();
  573. date = date - 1;
  574. myDate.setDate(date);
  575. let seperator3 = "-";
  576. let month = myDate.getMonth() + 1;
  577. let strDate = myDate.getDate();
  578. if (month >= 1 && month <= 9) {
  579. month = "0" + month;
  580. }
  581. if (strDate >= 0 && strDate <= 9) {
  582. strDate = "0" + strDate;
  583. }
  584. let currentdate3 =
  585. myDate.getFullYear() + seperator3 + month + seperator3 + strDate;
  586. return currentdate3;
  587. },
  588. getDates() {
  589. var new_Date = new Date();
  590. var timesStamp = new_Date.getTime();
  591. var currenDay = new_Date.getDay();
  592. var dates = new Date(
  593. timesStamp + 24 * 60 * 60 * 1000 * (0 - ((currenDay + 6) % 7))
  594. )
  595. .toLocaleDateString()
  596. .replace(/[年月]/g, "-")
  597. .replace(/[日上下午]/g, "");
  598. let s = dates.replace(/-/g, "/");
  599. var dt = new Date(s);
  600. var m = dt.getMonth() + 1;
  601. var d = dt.getDate();
  602. m = m < 10 ? "0" + m : m;
  603. d = d < 10 ? "0" + d : d;
  604. dates = dt.getFullYear() + "-" + m + "-" + d;
  605. return dates;
  606. },
  607. //本月第一天
  608. getMonthDate() {
  609. let date = new Date();
  610. let seperator1 = "-";
  611. let month = date.getMonth() + 1;
  612. if (month >= 1 && month <= 9) {
  613. month = "0" + month;
  614. }
  615. let currentdate =
  616. date.getFullYear() + seperator1 + month + seperator1 + "01";
  617. return currentdate;
  618. },
  619. // 表单重置
  620. reset() {
  621. this.queryParams = {
  622. createdDate: null,
  623. stationId: null,
  624. stationName: null,
  625. beginTime:null,
  626. endTime:null
  627. };
  628. this.form = {
  629. zongAmt: 0,
  630. zongliters: 0,
  631. qyamt: 0,
  632. cyamt: 0
  633. };
  634. },
  635. /** 查看详情按钮操作 */
  636. handleLook(row) {
  637. this.row =row;
  638. row.page= this.queryInfo.pageNum;
  639. row.limit= this.queryInfo.pageSize;
  640. this.getLookOrder(row);
  641. },
  642. getLookOrder(row) {
  643. const createdDate = this.row.createdDate;
  644. this.queryInfo.beginTime =createdDate.substring(0,10) +" 00:00:00";
  645. this.queryInfo.endTime =createdDate.substring(0,10) +" 23:59:59";
  646. this.queryInfo.status = "1";
  647. this.queryInfo.pageNum=row.page;
  648. this.queryInfo.pageSize =row.limit;
  649. this.queryInfo.orderType = "1";
  650. this.queryInfo.stationId=this.$store.selectDeptId;
  651. getDetails(this.queryInfo).then(response => {
  652. this.dayReportDetailsList = response.rows;
  653. this.total1 = response.total;
  654. this.open = true;
  655. this.title = "日报详细信息";
  656. });
  657. }
  658. }
  659. };
  660. </script>
  661. <style lang="scss" scoped>
  662. .flex {
  663. display: flex;
  664. align-items: center;
  665. justify-content: center;
  666. width: 100%;
  667. height: 270px;
  668. flex-direction: column;
  669. }
  670. .flex-qy {
  671. display: flex;
  672. align-items: center;
  673. justify-content: center;
  674. }
  675. .flex-qy-sx {
  676. display: flex;
  677. align-items: center;
  678. justify-content: center;
  679. flex-direction: column;
  680. }
  681. .panel-group {
  682. padding-left: 10px;
  683. }
  684. .flex-sr {
  685. display: flex;
  686. align-items: center;
  687. justify-content: center;
  688. width: 100%;
  689. flex-direction: column;
  690. }
  691. .sr-font {
  692. font-size: 20px;
  693. color: #f4a645;
  694. }
  695. </style>