Dzk_Report.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <el-scrollbar style="height:100%">
  3. <div>
  4. <div style="width:99%;">
  5. <span style="color:#ff9955;font-size:25px;">|</span>
  6. <span style="font-size:20px;">数据概览</span>
  7. <el-row :gutter="10" class="panel-group">
  8. <el-col :xs="12" :sm="12" :lg="6">
  9. <div class="flex xiaoliang">
  10. <div style="font-size: 28px;">电子会员余额</div>
  11. <div style="line-height: 62px;font-size: 32px;">{{hzAmt }}元</div>
  12. </div>
  13. </el-col>
  14. <el-col :xs="12" :sm="12" :lg="6">
  15. <div class="flex xiaoe">
  16. <div style="font-size: 28px;">电子会员总数</div>
  17. <div style="line-height: 62px;font-size: 32px;">{{ cardNum }}个</div>
  18. </div>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. <div style="width:99%; height: 181px;">
  23. <span style="color:#ff9955;font-size:25px;">|</span>
  24. <span style="font-size:20px;">详情:</span>
  25. <el-table v-loading="loading" :data="dayReportList">
  26. <el-table-column label="日期" align="center" prop="createTime">
  27. <template slot-scope="scope">
  28. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="充值金额" align="center" prop="czamt" />
  32. <el-table-column label="消费金额" align="center" prop="xfamt"/>
  33. <el-table-column label="新增电子会员" align="center" prop="cardnum" />
  34. </el-table>
  35. <div style="float:right;">
  36. <el-pagination
  37. style="padding-top: 15px;"
  38. @size-change="findSizeChange"
  39. @current-change="findPage"
  40. :current-page.sync="pageNow"
  41. background
  42. :pager-count="6"
  43. :page-sizes="[5,10,20,50,100]"
  44. :page-size="size"
  45. layout="total, sizes, prev, pager, next, jumper"
  46. :total="total">
  47. </el-pagination>
  48. </div>
  49. </div>
  50. <el-dialog :title="title" width="800px" :visible.sync="open" append-to-body>
  51. <el-table v-loading="loading" :data="dayReportDetailsList">
  52. <el-table-column label="订单单号" align="center" prop="orderNo" />
  53. <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if="false" />
  54. <el-table-column label="会员号ID" align="center" prop="customerNo" />
  55. <el-table-column label="会员名" align="center" prop="customerName" />
  56. <el-table-column label="油品" align="center" prop="cardOilsType" :formatter="cardOilsTypeFotmat"/>
  57. <el-table-column label="订单类型" align="center" prop="usageType" :formatter="usageTypeFotmat"/>
  58. <el-table-column label="消费金额" align="center" prop="amt" />
  59. <el-table-column label="余额" align="center" prop="balance" />
  60. <el-table-column label="消费方式" align="center" prop="payType" :formatter="payTypeFotmat"/>
  61. <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
  62. <el-table-column label="油站名称" align="center" prop="stationName" />
  63. <el-table-column label="油站名称" align="center" prop="create_time" v-if="false"/>
  64. </el-table>
  65. <div class="pagination-container">
  66. <el-pagination
  67. style="padding-top: 15px"
  68. @size-change="sizeChange"
  69. @current-change="currentChange"
  70. :current-page.sync="pageNow2"
  71. background
  72. :pager-count="6"
  73. :page-sizes="[5,10,20,50,100]"
  74. :page-size="setting"
  75. layout="total, sizes, prev, pager, next, jumper"
  76. :total="total1">
  77. </el-pagination>
  78. </div>
  79. </el-dialog>
  80. </div>
  81. </el-scrollbar>
  82. </template>
  83. <script>
  84. import {listSum,selectCard} from "@/api/customer/card";
  85. import { xfAmtQuery } from "@/api/customer/consumption";
  86. import { czAmtQuery,selectCardDetail } from "@/api/customer/recharge";
  87. export default {
  88. name: "source",
  89. data() {
  90. return {
  91. charts: null,
  92. size:10,
  93. pageNow:1,
  94. pageNow2:1,
  95. setting:10,
  96. // 遮罩层
  97. loading: true,
  98. // 选中数组
  99. ids: [],
  100. // 非单个禁用
  101. single: true,
  102. // 非多个禁用
  103. multiple: true,
  104. // 显示搜索条件
  105. showSearch: true,
  106. // 总条数
  107. total: 0,
  108. total1: 0,
  109. hzAmt: 0,
  110. cardNum:0,
  111. // 优惠劵管理表格数据
  112. couponList: [],
  113. dayReportDetailsList: [],
  114. dateRangeCreatedDate: [],
  115. //x轴数据
  116. xdata: [],
  117. //92#汽油数据
  118. czdata: [],
  119. //95#汽油数据
  120. xfdata: [],
  121. // 弹出层标题
  122. title: "",
  123. rows:[],
  124. // 是否显示弹出层
  125. open: false,
  126. // 查询参数
  127. queryParams: {
  128. pageSetting:10,
  129. pageNum:1,
  130. createdDate: null,
  131. stationId:null,
  132. stationName: null,
  133. beginTime: null,
  134. endTime: null,
  135. payDate: null,
  136. status:"1"
  137. },
  138. // 查询参数
  139. queryInfo: {
  140. pageSetting:10,
  141. pageNo:1,
  142. createDate: null
  143. },
  144. query:{
  145. stationId:null
  146. },
  147. //日报数据
  148. dayReportList: [],
  149. // 表单参数
  150. form: {
  151. czAmt: 0,
  152. xfAmt: 0
  153. },
  154. // 表单校验
  155. rules: {}
  156. };
  157. },
  158. created() {
  159. this.dayDataSource();
  160. this.getHZlist();
  161. //获取折线图的数据
  162. this.reset();
  163. this.queryParams.beginTime = this.getMonthDate();
  164. this.queryParams.endTime = this.getEndFormatDate(new Date());
  165. this.queryParams.stationId=this.$store.selectDeptId;
  166. },
  167. methods: {
  168. usageTypeFotmat(row, column){
  169. if(row.usageType === '+'){
  170. return '充值'
  171. }else if(row.usageType === '-'){
  172. return '消费'
  173. }
  174. },
  175. payTypeFotmat(row, column){
  176. if(row.payType === '1'){
  177. return '小程序'
  178. }else if(row.payType === '2'){
  179. return 'POS'
  180. }
  181. },
  182. cardOilsTypeFotmat(row, column){
  183. if(row.cardOilsType === '1'){
  184. return '汽油'
  185. }else if(row.cardOilsType === '2'){
  186. return '柴油'
  187. }
  188. },
  189. /** 查询电子会员数据 */
  190. getList() {
  191. if(this.queryParams.stationId==null || this.queryParams.stationId==""){
  192. this.queryParams.stationId =this.$store.state.user.deptId;
  193. }
  194. xfAmtQuery(this.queryParams).then(response => {
  195. if (response.hasOwnProperty('data')) {
  196. this.form.xfAmt = response.data.amt;
  197. }
  198. });
  199. czAmtQuery(this.queryParams).then(response => {
  200. if (response.hasOwnProperty('data')) {
  201. this.form.czAmt = response.data.amt;
  202. }
  203. });
  204. this.dayReportDetail();
  205. },
  206. getHZlist(){
  207. //汇总电子会员数据
  208. this.query.stationId=this.$store.selectDeptId;
  209. if(this.query.stationId==null || this.query.stationId==""){
  210. this.query.stationId =this.$store.state.user.deptId;
  211. }
  212. listSum(this.query).then(response => {
  213. if (response.hasOwnProperty('data')) {
  214. this.cardNum= response.data.num;
  215. this.hzAmt = response.data.amt;
  216. }
  217. });
  218. },
  219. findPage(val){
  220. this.pageNow = val;
  221. this.dayReportDetail();
  222. },
  223. findSizeChange(size) {
  224. //将val赋值给size
  225. this.size = size;
  226. //重新去后台查询数据
  227. this.dayReportDetail();
  228. },
  229. dayReportDetail(){
  230. this.loading = false;
  231. this.queryParams.pageNo =this.pageNow;
  232. this.queryParams.pageSetting =this.size;
  233. selectCard(this.queryParams).then(response => {
  234. this.dayReportList= response.rows;
  235. this.total = response.total;
  236. });
  237. },
  238. //本日的数据
  239. dayDataSource() {
  240. this.reset();
  241. this.queryParams.beginTime = this.getNowFormatDate(new Date());
  242. this.queryParams.endTime = this.getEndFormatDate(new Date());
  243. this.queryParams.stationId=this.$store.selectDeptId;
  244. if(this.queryParams.stationId==null || this.queryParams.stationId==""){
  245. this.queryParams.stationId =this.$store.state.user.deptId;
  246. }
  247. this.getList();
  248. },
  249. //今天
  250. getNowFormatDate(date) {
  251. let seperator1 = "-";
  252. let month = date.getMonth() + 1;
  253. let strDate = date.getDate();
  254. if (month >= 1 && month <= 9) {
  255. month = "0" + month;
  256. }
  257. if (strDate >= 0 && strDate <= 9) {
  258. strDate = "0" + strDate;
  259. }
  260. let currentdate1 =
  261. date.getFullYear() + seperator1 + month + seperator1 + strDate;
  262. return currentdate1;
  263. },
  264. //明天
  265. getEndFormatDate(myDate) {
  266. let date = myDate.getDate();
  267. date = date + 1;
  268. myDate.setDate(date);
  269. let seperator2 = "-";
  270. let month = myDate.getMonth() + 1;
  271. let strDate = myDate.getDate();
  272. if (month >= 1 && month <= 9) {
  273. month = "0" + month;
  274. }
  275. if (strDate >= 0 && strDate <= 9) {
  276. strDate = "0" + strDate;
  277. }
  278. let currentdate2 =
  279. myDate.getFullYear() + seperator2 + month + seperator2 + strDate;
  280. return currentdate2;
  281. },
  282. //昨天
  283. getFormatDate(myDate) {
  284. let date = myDate.getDate();
  285. date = date - 1;
  286. myDate.setDate(date);
  287. let seperator3 = "-";
  288. let month = myDate.getMonth() + 1;
  289. let strDate = myDate.getDate();
  290. if (month >= 1 && month <= 9) {
  291. month = "0" + month;
  292. }
  293. if (strDate >= 0 && strDate <= 9) {
  294. strDate = "0" + strDate;
  295. }
  296. let currentdate3 =
  297. myDate.getFullYear() + seperator3 + month + seperator3 + strDate;
  298. return currentdate3;
  299. },
  300. getDates() {
  301. var new_Date = new Date();
  302. var timesStamp = new_Date.getTime();
  303. var currenDay = new_Date.getDay();
  304. var dates = new Date(
  305. timesStamp + 24 * 60 * 60 * 1000 * (0 - ((currenDay + 6) % 7))
  306. )
  307. .toLocaleDateString()
  308. .replace(/[年月]/g, "-")
  309. .replace(/[日上下午]/g, "");
  310. let s = dates.replace(/-/g, "/");
  311. var dt = new Date(s);
  312. var m = dt.getMonth() + 1;
  313. var d = dt.getDate();
  314. m = m < 10 ? "0" + m : m;
  315. d = d < 10 ? "0" + d : d;
  316. dates = dt.getFullYear() + "-" + m + "-" + d;
  317. return dates;
  318. },
  319. //本月第一天
  320. getMonthDate() {
  321. let date = new Date();
  322. let seperator1 = "-";
  323. let month = date.getMonth() + 1;
  324. if (month >= 1 && month <= 9) {
  325. month = "0" + month;
  326. }
  327. let currentdate =
  328. date.getFullYear() + seperator1 + month + seperator1 + "01";
  329. return currentdate;
  330. },
  331. // 表单重置
  332. reset() {
  333. this.queryParams = {
  334. pageSetting:10,
  335. pageNo:1,
  336. createDate: null,
  337. stationId: null,
  338. stationName: null,
  339. beginTime:null,
  340. endTime:null
  341. };
  342. this.form = {
  343. czAmt: 0,
  344. xfAmt: 0
  345. };
  346. this.queryInfo={
  347. pageSetting:10,
  348. pageNo:1,
  349. createDate: null
  350. };
  351. },
  352. /** 查看详情按钮操作 */
  353. handleLook(row) {
  354. this.rows=row;
  355. this.getLookOrder(row);
  356. },
  357. sizeChange(psize){
  358. //将val赋值给size
  359. this.setting = psize;
  360. this.getLookOrder(this.rows);
  361. },
  362. currentChange(val) {
  363. this.pageNow2 = val;
  364. //重新去后台查询数据
  365. this.getLookOrder(this.rows);
  366. },
  367. getLookOrder(row) {
  368. const createDate = row.createTime;
  369. this.queryInfo.createDate =createDate.substring(0,10);
  370. this.queryInfo.pageNo =this.pageNow2;
  371. this.queryInfo.pageSetting =this.setting;
  372. return selectCardDetail(this.queryInfo).then(response => {
  373. this.dayReportDetailsList = response.rows;
  374. this.total1 = response.total;
  375. this.open = true;
  376. this.title = "电子会员明细";
  377. });
  378. }
  379. }
  380. };
  381. </script>
  382. <style lang="scss" scoped>
  383. .flex {
  384. display: flex;
  385. align-items: center;
  386. justify-content: center;
  387. width: 100%;
  388. height: 170px;
  389. flex-direction: column;
  390. }
  391. .flex-qy {
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. }
  396. .flex-qy-sx {
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. flex-direction: column;
  401. }
  402. .panel-group {
  403. padding-left: 10px;
  404. }
  405. .flex-sr {
  406. display: flex;
  407. align-items: center;
  408. justify-content: center;
  409. width: 100%;
  410. flex-direction: column;
  411. }
  412. .sr-font {
  413. font-size: 20px;
  414. color: #f4a645;
  415. }
  416. </style>