You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <view class="content">
  3. <view class="title_name">{{dealDateTime[0]}}年{{dealDateTime[1]}}月{{dealDateTime[2]}}日黔通智联ETC事业部全国发行日报表
  4. </view>
  5. <view class="change_type">
  6. <view class='time'>
  7. <uni-datetime-picker v-if="!isAli" type="date" :clear-icon="false" v-model="dateTime" @change="change"
  8. @show="showTan" @close="closeTan" />
  9. <view v-if="isAli" class="info_plate">
  10. <text>日期</text>
  11. <u-input v-model="dateTime" @click="aliDate" class="input" disabled placeholder="请选择日期" />
  12. </view>
  13. </view>
  14. </view>
  15. <view class="table_wrap" v-if="dataAll">
  16. <t-table>
  17. <t-tr font-size="12">
  18. <t-td>车型</t-td>
  19. <t-td>记账卡当日开卡数</t-td>
  20. <t-td>记账卡累计发行量</t-td>
  21. </t-tr>
  22. <t-tr v-if="dataAll.vehicleData" v-for="(item,index) in dataAll.vehicleData.vehicleDataDetails"
  23. :key="index" fontSize="12">
  24. <t-td>{{ item.vehicleType }}</t-td>
  25. <t-td>{{ item.dayCardCount }}</t-td>
  26. <t-td>{{ item.cardCount }}</t-td>
  27. </t-tr>
  28. <t-tr font-size="12">
  29. <t-td>合计</t-td>
  30. <t-td>{{ dataAll.vehicleData? dataAll.vehicleData.vehicleDataCount.dayCardCount:null }}</t-td>
  31. <t-td>{{ dataAll.vehicleData? dataAll.vehicleData.vehicleDataCount.cardCount:null }}</t-td>
  32. </t-tr>
  33. </t-table>
  34. </view>
  35. <!-- 改变卡类型和饼状图 -->
  36. <view class="change_type">
  37. <uni-data-select v-if="!isAli" v-model="selectTypeValue" :localdata="typeRange" @change="changeType"
  38. :clear="false" @close="showTan"></uni-data-select>
  39. </view>
  40. <view class="change_type">
  41. <view class="choice_item1" v-if="isShow===0">
  42. <uni-data-select v-if="!isAli" v-model="selectPieValue" :localdata="pieRange" @change="changePie"
  43. :clear="false" @close="showTan">
  44. </uni-data-select>
  45. </view>
  46. <view v-else-if="isShow===1">
  47. <zxzUniDataSelect v-model="value1" filterable multiple dataKey="label" dataValue="value"
  48. :localdata="data" @change="changeLine" @close="showTan" />
  49. </view>
  50. <view class="title_pie" v-else>
  51. <zxzUniDataSelect v-model="value2" filterable multiple dataKey="label" dataValue="value"
  52. :localdata="colRange" @change="changeCol" @close="showTan" />
  53. </view>
  54. </view>
  55. <view v-if="pieData !={} || chartData !={} || lineData !={} ">
  56. <view v-if="isShow===0 ">
  57. <view class="charts-box" v-if="hideCanvas">
  58. <qiun type="pie" :opts="opts" :chartData="pieData" />
  59. </view>
  60. </view>
  61. <view v-else-if="isShow === 1">
  62. <view class="charts-box" v-if="hideCanvas">
  63. <qiun type="line" :opts="optsLine" :chartData="lineData" :ontouch="true" />
  64. </view>
  65. </view>
  66. <view v-else>
  67. <view class="charts-box" v-if="hideCanvas">
  68. <qiun type="column" :opts="optsCol" :chartData="chartData" :ontouch="true" />
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import * as IFCODE from "@/utils/network/api.js";
  76. import {
  77. request
  78. } from "@/utils/network/request.js";
  79. const tools = require("../../../static/etcUtil/tools.js");
  80. import {
  81. stringToJson
  82. } from "@/utils/network/encryption";
  83. import {
  84. nowDate
  85. } from "@/utils/utils";
  86. import {
  87. getItem
  88. } from "@/utils/storage";
  89. // 表格
  90. import tTable from "@/components/t-table/t-table.vue"
  91. import tTh from '@/components/t-table/t-th.vue'
  92. import tTr from '@/components/t-table/t-tr.vue'
  93. import tTd from '@/components/t-table/t-td.vue'
  94. import qiun from "../qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue";
  95. import zxzUniDataSelect from ".././components/zxz-uni-data-select/zxz-uni-data-select.vue";
  96. export default {
  97. data() {
  98. return {
  99. canvasId: "",
  100. value1: [0], //折线图
  101. data: [],
  102. value2: [0], //柱状图
  103. data2: [],
  104. isAli: false,
  105. hideCanvas: true,
  106. canvasShow: false,
  107. dateTime: "", //日期
  108. noDealDateTime: '', //没有处理过的时间,传给后端
  109. dealDateTime: [], //处理过后的时间,前端展示
  110. dataAll: '', //总的数据
  111. //标题名称
  112. titleArr: {
  113. 'dayCardCount': '当日开户数',
  114. 'monthCardCount': '当月开户数',
  115. "monthCancelCount": "当月注销",
  116. 'yearCardCount': '当年累积开户数',
  117. 'cardCount': '总计开户数',
  118. 'dayCancelCount': '当日注销',
  119. 'yearCancelCount': '当年注销数',
  120. 'cancelCount': '总计注销数'
  121. },
  122. isShow: 0,
  123. pieData: {},
  124. chartData: {},
  125. lineData: {},
  126. opts: {
  127. fontSize: 11,
  128. },
  129. optsLine: {
  130. fontSize: 11,
  131. enableScroll: true,
  132. xAxis: {
  133. disableGrid: true,
  134. scrollShow: true,
  135. itemCount: 3
  136. },
  137. extra: {
  138. line: {
  139. type: "straight",
  140. width: 2,
  141. activeType: "hollow"
  142. }
  143. }
  144. },
  145. optsCol: {
  146. fontSize: 11,
  147. enableScroll: true,
  148. xAxis: {
  149. disableGrid: true,
  150. scrollShow: true,
  151. itemCount: 3.5
  152. },
  153. yAxis: {
  154. data: [{
  155. min: 0
  156. }]
  157. },
  158. extra: {
  159. column: {
  160. type: "group",
  161. width: 25,
  162. }
  163. }
  164. },
  165. selectPieValue: 2, //默认是全部
  166. pieRange: [],
  167. pieDataAll: [],
  168. selectLineValue: 0,
  169. lineRange: [],
  170. lineDataAll: [],
  171. selectColValue: [0],
  172. colRange: [],
  173. colData: {
  174. xData: ["当日开户数", "当月开户数", "当年累积开户数", "总计开户数", "当日注销", "当年注销数", "总计注销数"],
  175. yData: {}
  176. },
  177. selectTypeValue: 0,
  178. typeRange: [{
  179. value: 0,
  180. text: "饼状图"
  181. },
  182. {
  183. value: 1,
  184. text: "折线图"
  185. },
  186. {
  187. value: 2,
  188. text: "柱状图"
  189. },
  190. ],
  191. cardRange: [{
  192. value: 0,
  193. text: "全部"
  194. },
  195. {
  196. value: 1,
  197. text: "记账卡"
  198. },
  199. {
  200. value: 2,
  201. text: "储值卡"
  202. },
  203. ]
  204. };
  205. },
  206. components: {
  207. tTable,
  208. tTh,
  209. tTr,
  210. tTd,
  211. qiun,
  212. zxzUniDataSelect
  213. },
  214. onLoad() {
  215. // #ifdef MP-ALIPAY
  216. this.isAli = true
  217. // #endif
  218. // #ifdef MP-WEIXIN
  219. this.isAli = false
  220. // #endif
  221. this.noDealDateTime = nowDate(new Date());
  222. this.dateTime = nowDate(new Date());
  223. this.dealDateTime = nowDate(new Date()).split('-');
  224. this.reqPie(); //饼状图数据请求
  225. },
  226. methods: {
  227. changeLine(e) {
  228. const choiceAllData = []
  229. for (var i = 0; i < e.length; i++) {
  230. choiceAllData.push(this.lineDataAll[e[i]['value']])
  231. }
  232. this.getLineData(choiceAllData);
  233. console.log('e:', e);
  234. },
  235. showTan() {
  236. console.log("隐藏")
  237. this.hideCanvas = false;
  238. },
  239. closeTan() {
  240. console.log("展示")
  241. this.hideCanvas = true;
  242. },
  243. getPieData(data) {
  244. //模拟从服务器获取数据时的延时
  245. setTimeout(() => {
  246. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  247. let res = {
  248. series: [{
  249. data: data
  250. }]
  251. };
  252. this.pieData = JSON.parse(JSON.stringify(res));
  253. this.closeTan()
  254. }, 500);
  255. },
  256. getColumnData(xData, yData) {
  257. //模拟从服务器获取数据时的延时
  258. setTimeout(() => {
  259. let res = {
  260. categories: xData,
  261. series: yData
  262. };
  263. this.chartData = JSON.parse(JSON.stringify(res));
  264. this.closeTan()
  265. }, 500);
  266. },
  267. getLineData(data) {
  268. console.log("data", data)
  269. if (data.length > 0) {
  270. //模拟从服务器获取数据时的延时
  271. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  272. let res = {
  273. 'categories': "",
  274. "series": []
  275. }
  276. res['categories'] = data[0]['xData']
  277. for (var i = 0; i < data.length; i++) {
  278. res['series'].push(data[i]['yData'][0])
  279. }
  280. setTimeout(() => {
  281. console.log("data", data, res)
  282. this.lineData = JSON.parse(JSON.stringify(res));
  283. this.closeTan()
  284. }, 500);
  285. } else {
  286. this.showTan()
  287. }
  288. },
  289. selectitem(index, item) {
  290. if (index >= 0) {
  291. this.tval = item.value;
  292. } else {
  293. this.tval = ""
  294. }
  295. },
  296. //饼状图改变
  297. changePie(e) {
  298. this.getPieData(this.pieDataAll[e]);
  299. },
  300. // 柱状图改变
  301. changeCol(e) {
  302. let allyData = []
  303. for (var i = 0; i < e.length; i++) {
  304. let index = e[i]['value']
  305. allyData.push(this.colData.yData[index])
  306. }
  307. this.getColumnData(this.colData.xData, allyData);
  308. },
  309. // 改变类型
  310. changeType(e) {
  311. this.isShow = e;
  312. this.closeTan()
  313. },
  314. // 改变卡类型
  315. changeCard(e) {
  316. console.log("e", e)
  317. },
  318. reqPie() {
  319. tools.showLoadingAlert("加载中");
  320. let options = {
  321. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  322. data: {
  323. accountDate: this.noDealDateTime, //统计日期
  324. agencyId: [], //渠道编号
  325. cardType: [], //卡类型 1-记账卡(包含预存卡),2-储值卡
  326. vehicleType: '', //车辆类型 1-客车,2-货车,2-专项作业车
  327. }, //请求参数
  328. method: "POST", //提交方式(默认POST)
  329. showLoading: true, //是否显示加载中(默认显示)
  330. };
  331. // 调用方式
  332. request(IFCODE.dataStatistics, options)
  333. .then((res) => {
  334. tools.hideLoadingAlert();
  335. this.dataAll = stringToJson(res.bizContent);
  336. try {
  337. if (this.dataAll.cardData) {
  338. console.log("this.dataAll", this.dataAll)
  339. this.dealPieData(stringToJson(res.bizContent)); //处理饼状图数据
  340. this.getPieData(this.pieDataAll[0]); //饼状图展示
  341. this.dealLineData(stringToJson(res.bizContent)); //处理折线图数据
  342. this.getLineData([this.lineDataAll[0]]); //折线图展示
  343. this.dealColData(stringToJson(res.bizContent)) //处理柱状图数据
  344. this.getColumnData(this.colData.xData, [this.colData.yData[0]]); //柱状图
  345. }
  346. } catch (error) {
  347. console.log(error.name + ":" + error.message)
  348. }
  349. })
  350. },
  351. dealPieData(data) {
  352. // 记账卡合计
  353. this.pieRange = []; //清空一遍数据
  354. this.pieDataAll = []; //清空一遍数据
  355. var pieDataItem = []
  356. // ETC卡合计
  357. var pieDataItem2 = []
  358. if (data.cardData.cardDataCount) {
  359. var list = {
  360. value: 2,
  361. text: "全部"
  362. };
  363. this.pieRange.push(list);
  364. for (var i in data.cardData.cardDataCount) {
  365. if (this.titleArr[i]) {
  366. var obj = {};
  367. obj.name = this.titleArr[i];
  368. obj.value = (data.cardData.cardDataCount)[i];
  369. }
  370. pieDataItem2.push(obj);
  371. }
  372. this.pieDataAll.push(pieDataItem2);
  373. }
  374. if (data.cardData.accountCardData.accountCardDataCount) {
  375. var list = {
  376. value: 0,
  377. text: "记账卡合计"
  378. };
  379. this.pieRange.push(list);
  380. for (var i in data.cardData.accountCardData.accountCardDataCount) {
  381. if (this.titleArr[i]) {
  382. var obj = {};
  383. obj.name = this.titleArr[i];
  384. obj.value = (data.cardData.accountCardData.accountCardDataCount)[i];
  385. }
  386. pieDataItem.push(obj);
  387. }
  388. this.pieDataAll.push(pieDataItem);
  389. }
  390. // 储值卡合计
  391. var pieDataItem1 = []
  392. if (data.cardData.valueCardData.valueCardDataCount) {
  393. var list = {
  394. value: 1,
  395. text: "储值卡合计"
  396. };
  397. this.pieRange.push(list);
  398. for (var i in data.cardData.valueCardData.valueCardDataCount) {
  399. if (this.titleArr[i]) {
  400. var obj = {};
  401. obj.name = this.titleArr[i];
  402. obj.value = (data.cardData.valueCardData.valueCardDataCount)[i];
  403. }
  404. pieDataItem1.push(obj);
  405. }
  406. this.pieDataAll.push(pieDataItem1);
  407. }
  408. console.log("this.pieDataAll", this.pieDataAll)
  409. },
  410. dealLineData(data) {
  411. this.lineDataAll = [];
  412. // 全部
  413. var allData = data.cardData.accountCardData.accountCardDataDetail.concat(data.cardData.valueCardData
  414. .valueCardDataDetail)
  415. console.log("allData", allData)
  416. for (var i = 0; i < allData.length; i++) {
  417. var lineItem = {
  418. xData: ["当日开户数", "当月开户数", "当年累积开户数", "总计开户数", "当日注销", "当年注销数", "总计注销数"],
  419. yData: []
  420. }
  421. if (allData[i].agencyName) {
  422. var obj = {};
  423. obj.name = allData[i].agencyName
  424. obj.data = [];
  425. for (var n in this.titleArr) {
  426. obj.data.push(allData[i][n])
  427. }
  428. lineItem.yData.push(obj)
  429. // 处理折线图选择
  430. var option = {}
  431. option.value = i
  432. option.text = allData[i].agencyName
  433. this.lineRange.push(option)
  434. var optionNew = {}
  435. optionNew.value = i
  436. optionNew.label = allData[i].agencyName
  437. this.data.push(optionNew)
  438. }
  439. this.lineDataAll.push(lineItem)
  440. }
  441. console.log("this.lineDataAll", this.lineRange, this.data)
  442. },
  443. dealColData(data) {
  444. this.colRange = [];
  445. var allData = data.cardData.accountCardData.accountCardDataDetail.concat(data.cardData.valueCardData
  446. .valueCardDataDetail)
  447. for (var i = 0; i < allData.length; i++) {
  448. if (allData[i].agencyName) {
  449. var obj = {};
  450. obj.value = i;
  451. obj.label = allData[i].agencyName;
  452. this.colRange.push(obj); //获得选择类表
  453. this.colData.yData[i] = {};
  454. this.colData.yData[i]['name'] = allData[i].agencyName;
  455. this.colData.yData[i]['data'] = [];
  456. for (var n in this.titleArr) {
  457. this.colData.yData[i]['data'].push(allData[i][n])
  458. }
  459. }
  460. }
  461. },
  462. // 日期事件
  463. change(e) {
  464. this.dealDateTime = e.split('-');
  465. this.dateTime = e;
  466. this.noDealDateTime = e;
  467. this.reqPie(); //饼状图数据请求
  468. // window.addEventListener("show", () => {
  469. // console.log('它发生变化了')
  470. // });
  471. // this.hideCanvas = false;
  472. // this.canvasShow = getItem("show")
  473. console.log("111111111111")
  474. },
  475. aliDate() {
  476. my.datePicker({
  477. success: (res) => {
  478. console.log("您选择的日期为:" + res.date)
  479. this.dateTime = res.date;
  480. console.log("您选择的日期为:" + this.dateTime)
  481. this.dealDateTime = res.date.split('-');
  482. console.log("您选择的日期为:" + this.dealDateTime)
  483. this.noDealDateTime = res.date;
  484. console.log("您选择的日期为:" + this.noDealDateTime)
  485. this.reqPie();
  486. },
  487. });
  488. }
  489. },
  490. };
  491. </script>
  492. <style scoped>
  493. .content {
  494. overflow: hidden;
  495. min-height: 100vh;
  496. }
  497. .charts-box {
  498. width: 100%;
  499. height: 300px;
  500. }
  501. .title {
  502. font-size: 32rpx;
  503. margin: 6px 10px;
  504. border-radius: 8rpx;
  505. }
  506. .table_wrap {
  507. font-size: 14rpx;
  508. margin: 40rpx auto;
  509. width: 700rpx;
  510. height: auto
  511. }
  512. t-tr t-td:nth-child(1) {
  513. width: 20% !important;
  514. }
  515. t-tr t-td:nth-child(2) {
  516. width: 43% !important;
  517. }
  518. t-tr t-td:nth-child(3) {
  519. width: 37% !important;
  520. }
  521. .uni-stat__select {
  522. width: 40% !important;
  523. }
  524. .info_plate {
  525. display: flex;
  526. flex-direction: row;
  527. width: 94%;
  528. height: 100rpx;
  529. margin: 0 auto;
  530. border-bottom: 2rpx solid #f2f2f2;
  531. }
  532. .title_pie {
  533. display: flex;
  534. justify-content: flex-end;
  535. align-items: center;
  536. }
  537. .uni-select {
  538. font-size: 13px !important;
  539. height: 30px !important;
  540. }
  541. .change_type {
  542. padding: 0 3%;
  543. display: flex;
  544. margin-bottom: 36rpx;
  545. margin-top: 16rpx;
  546. }
  547. .change_type>uni-data-select {
  548. width: 40%;
  549. }
  550. .time {
  551. width: 40%;
  552. }
  553. .title_name {
  554. width: 95%;
  555. font-weight: 600;
  556. text-align: center;
  557. margin: auto;
  558. }
  559. .choice_item {
  560. min-width: 50%;
  561. }
  562. .choice_item1 {
  563. min-width: 40%;
  564. }
  565. /deep/.uni-date__x-input,
  566. /deep/.uni-select {
  567. height: 32px;
  568. line-height: 32px !important;
  569. font-size: 13px !important;
  570. }
  571. .no {
  572. text-align: center;
  573. margin: 50rpx auto;
  574. }
  575. </style>