index.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619
  1. <template>
  2. <view>
  3. <view class="navbar-tit">{{title}}</view>
  4. <view class="statisticsChart" style="margin-top: 120rpx;margin-bottom: 0px">
  5. <view class="statisticsChart-head">
  6. <h4>充电统计</h4>
  7. <view class="navbar-screen ">
  8. <u-button text="月落" size="mini" class="headbotton1" style="border-radius: 10px 0 0 10px;"
  9. :type="current==1?'primary':'info'" @click="changesub(1)">按天</u-button>
  10. <u-button text="月落" size="mini" class="headbotton2" style="border-radius: 0 10px 10px 0;"
  11. :type="current==2?'primary':'info'" @click="changesub(2)">按月</u-button>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="statisticsData">
  16. <view class="detailstableHead" style="
  17. padding-top: 1px;
  18. ">
  19. <view id="pieEcharts" style="min-height:250px;margin-top: 20px">
  20. </view>
  21. </view>
  22. <view class="detailstableHead" v-if="indexData&&false">
  23. <view class="detailsline">
  24. <view class="details-row details-row-head-1 ">
  25. <view class="span1">今日收入</view>
  26. <view class="span2">{{indexData.todayAmount?indexData.todayAmount.toFixed(2):0}}<span>元</span>
  27. </view>
  28. </view>
  29. <view class="details-row details-row-head-2">
  30. <view class="span1">今日利润</view>
  31. <view class="span2">{{indexData.todayProfit?indexData.todayProfit.toFixed(2):0}}<span>元</span>
  32. </view>
  33. </view>
  34. <view class="details-row details-row-head-3">
  35. <view class="span1">今日笔数</view>
  36. <view class="span2">{{indexData.todayEQNum?indexData.todayEQNum:0}}<span>笔</span></view>
  37. </view>
  38. </view>
  39. <view class="detailsline">
  40. <view class="details-row details-row-head-1 ">
  41. <view class="span1">昨日收入</view>
  42. <view class="span2">
  43. {{indexData.yesterdayAmount?indexData.yesterdayAmount.toFixed(2):0}}<span>元</span>
  44. </view>
  45. </view>
  46. <view class="details-row details-row-head-2">
  47. <view class="span1">昨日利润</view>
  48. <view class="span2">
  49. {{indexData.yesterdayProfit?indexData.yesterdayProfit.toFixed(2):0}}<span>元</span>
  50. </view>
  51. </view>
  52. <view class="details-row details-row-head-3">
  53. <view class="span1">昨日笔数</view>
  54. <view class="span2">{{indexData.yesterdayEQNum?indexData.yesterdayEQNum:0}}<span>笔</span></view>
  55. </view>
  56. </view>
  57. <view class="detailsline—bottom">
  58. <view class="details-row details-row-head-1">
  59. <view class="span1">本月收入</view>
  60. <view class="span2">
  61. {{indexData.thisMonthAmount?indexData.thisMonthAmount.toFixed(2):0}}<span>元</span>
  62. </view>
  63. </view>
  64. <view class="details-row details-row-head-2">
  65. <view class="span1">本月利润</view>
  66. <view class="span2">
  67. {{indexData.thisMonthProfit?indexData.thisMonthProfit.toFixed(2):0}}<span>元</span>
  68. </view>
  69. </view>
  70. <view class="details-row details-row-head-3">
  71. <view class="span1">本月笔数</view>
  72. <view class="span2">{{indexData.thisMonthEQNum?indexData.thisMonthEQNum:0}}<span>笔</span></view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <u-picker mode="time" v-model="popupShow" @confirm="changedate" :default-time="queryTime" :params="params">
  78. </u-picker>
  79. <u-picker mode="time" v-model="popupShow2" @confirm="changedate2" :default-time="queryTime2+'-01'"
  80. :params="params"></u-picker>
  81. <u-picker mode="selector" v-model="popupShow3" @confirm="changedate3" :range="stationList" range-key="name"
  82. :default-selector="[selectstationIndex]"></u-picker>
  83. <view class="statisticsChart">
  84. <view class="statisticsChart-head" style="margin-top: 20px;">
  85. <h4>流水统计</h4>
  86. <!-- <view class="navbar-screen" >
  87. {{startTime}}至{{endTime}}
  88. </view> -->
  89. <view class="navbar-screen" @click="popupShow = true" v-if="false">
  90. <span>{{showTime(queryTime)}}</span>
  91. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow"></u-icon>
  92. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow"></u-icon>
  93. </view>
  94. </view>
  95. <u-calendar v-model="popupShow4" mode="range" @change="changedate4"></u-calendar>
  96. <view class="details detailstable">
  97. <p style="text-align: center; margin-bottom: 5px;" @click="popupShow4 = true">
  98. <img src="@/assets/img/riLine-calendar-todo-line.svg" align="absmiddle"
  99. style="height:40rpx;width: 40rpx ;">
  100. {{startTime}}至{{endTime}}
  101. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow4"></u-icon>
  102. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow4"></u-icon>
  103. </p>
  104. <view class="detailsline detailslineHead" v-if="stationFlowList.length>1">
  105. <view class="details-row ">
  106. <view class="span1">总收入</view>
  107. <view class="span2">{{(allMoneySum).toFixed(2)}}<span>元</span></view>
  108. </view>
  109. <view class="details-row">
  110. <view class="span1">总利润<span>(服务费+月卡)</span></view>
  111. <view class="span2">{{(serviceMoneySum).toFixed(2)}}<span>元</span></view>
  112. </view>
  113. </view>
  114. <view v-if="stationFlowList.length==0"
  115. style="color: rgba(153, 153, 153, 1);font-size: 28rpx;text-align: center;margin-top: 16rpx;">
  116. 站点列表为空
  117. </view>
  118. <view v-if="stationFlowList.length&&stationFlowList.length>3"
  119. @click="gotoUrl('pagesFinance/statistics/list')"
  120. style="color: rgba(153, 153, 153, 1);font-size: 28rpx;text-align: center;margin-top: 16rpx;">
  121. 查看站点流水统计 <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#b0b8c8" size="28"></u-icon>
  122. </view>
  123. <u-collapse :headStyle="{
  124. color:'#101010',
  125. fontWeight: 'bold',
  126. padding:'24rpx 0',
  127. borderBottom: '1px solid #ededed'
  128. }" v-if="stationFlowList.length&&stationFlowList.length<=3">
  129. <u-collapse-item @change="changeitem" v-for="(item, index) in stationFlowList" :index="index"
  130. :key="index">
  131. <view slot="title" class="u-collapse-title u-line-1" style="width: 100%;">
  132. {{item.stationName}} <span style="float:right;"><span
  133. style="font-size: 24rpx;margin-right: 8rpx;font-weight: normal;">总收入</span>{{item.actualMoney.toFixed(2)}}元</span>
  134. </view>
  135. <!-- -->
  136. <view class="detailsline">
  137. <view class="details-row details-row-1">
  138. <view class="span1">电费</view>
  139. <view class="span2">{{item.elecMoney.toFixed(2)}}<span>元</span></view>
  140. </view>
  141. <view class="details-row">
  142. <view class="span1">服务费</view>
  143. <view class="span2">{{item.serviceMoney.toFixed(2)}}<span>元</span></view>
  144. </view>
  145. </view>
  146. <view class="detailsline">
  147. <view class="details-row details-row-1">
  148. <view class="span1">总用电量</view>
  149. <view class="span2">{{(item.eq/10000).toFixed(1)}}<span>度</span></view>
  150. </view>
  151. <view class="details-row">
  152. <view class="span1">充电枪数量</view>
  153. <view class="span2">快充{{item.fastNum}}/慢充{{item.slowNum}}</view>
  154. </view>
  155. </view>
  156. <view class="detailsline" v-if="item.fastNum&&item.slowNum">
  157. <view class="details-row details-row-1">
  158. <view class="span1">快充枪平均充电量</view>
  159. <view class="span2" v-if="item.fastNum">
  160. {{(item.averageFast/10000).toFixed(1)}}<span>度/枪/天</span>
  161. </view>
  162. <view class="span2" v-else>0<span>度/枪/天</span></view>
  163. </view>
  164. <view class="details-row">
  165. <view class="span1">慢充枪平均充电量</view>
  166. <view class="span2" v-if="item.slowNum">
  167. {{(item.averageSlow/10000).toFixed(1)}}<span>度/枪/天</span>
  168. </view>
  169. <view class="span2" v-else>0<span>度/枪/天</span></view>
  170. </view>
  171. </view>
  172. <view class="detailsline" v-if="item.fastNum&&item.slowNum">
  173. <view class="details-row details-row-1">
  174. <view class="span1">月卡收益</view>
  175. <view class="span2">{{(item.cardMoney).toFixed(2)}}<span>元</span></view>
  176. </view>
  177. <view class="details-row">
  178. </view>
  179. </view>
  180. <view v-if="item.fastNum&&item.slowNum"
  181. :style="item.slowDayNum==nowTime?'color: #ffffff;':'border-bottom: 1px solid #ededed;'">
  182. 查询范围内实际订单天数{{item.slowDayNum}}</view>
  183. </u-collapse-item>
  184. </u-collapse>
  185. </view>
  186. <view class="statisticsChart-head" style="margin-top: 20px;">
  187. <h4>站主/桩主收益统计</h4>
  188. <!-- <view class="navbar-screen" >
  189. {{startTime}}至{{endTime}}
  190. </view> -->
  191. <!-- <view class="navbar-screen" @click="popupShow2 = true"><span>筛选</span>
  192. <u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
  193. </view> -->
  194. </view>
  195. <view class="details" v-if="indexData2&&indexData2.incomeMap">
  196. <view class="details-row2">
  197. <p @click="popupShow3 = true">{{selectstationName}}
  198. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow3"></u-icon>
  199. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow3"></u-icon>
  200. </p>
  201. <p @click="popupShow2 = true">
  202. {{showTime(queryTime2)}}
  203. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow2"></u-icon>
  204. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow2"></u-icon>
  205. </p>
  206. </view>
  207. <view class="details-row">
  208. <p>充电总收入</p>
  209. <span>{{(indexData2.incomeMap.chargingAmount).toFixed(2)}}元</span>
  210. </view>
  211. <view class="details-row">
  212. <p>站主/桩主收入</p>
  213. <span>{{indexData2.incomeMap.incomeAmount.toFixed(2)}}元</span>
  214. </view>
  215. <view class="details-row">
  216. <p>预估用电度数</p>
  217. <span>{{(indexData2.incomeMap.electricQuantity/10000).toFixed(1)}}度</span>
  218. </view>
  219. <view class="details-row">
  220. <p>预估电费</p>
  221. <span>{{indexData2.incomeMap.costAmount.toFixed(2)}}元</span>
  222. </view>
  223. <view class="details-row">
  224. <p>服务费预估收益</p>
  225. <span>{{indexData2.incomeMap.serviceAmount.toFixed(2)}}元</span>
  226. </view>
  227. <view class="details-row">
  228. <p>月卡收益</p>
  229. <span>{{indexData2.incomeMap.cardIncomeAmount.toFixed(2)}}元</span>
  230. </view>
  231. <view class="details-row">
  232. <p>预估总利润</p>
  233. <span>{{(indexData2.incomeMap.serviceAmount+indexData2.incomeMap.cardIncomeAmount).toFixed(2)}}元</span>
  234. </view>
  235. </view>
  236. </view>
  237. <Tabbar :current="0" ref="tabbarMain"></Tabbar>
  238. <!-- <u-tabbar v-model="current" :list="tabbarList" active-color="#185ac6"></u-tabbar>
  239. -->
  240. </view>
  241. </template>
  242. <script>
  243. import Tabbar from '@/components/TabbarFinance.vue'
  244. import * as API from '@/apis/finance.js'
  245. import * as echarts from "echarts";
  246. //require("@/apis/echarts-5-3.min.js")
  247. //import * as echarts from "@/apis/echarts-5-3.min.js";
  248. import {
  249. daysDistance,
  250. beforeTimeStamp,
  251. currentTimeStamp,
  252. parseUnixTime, newDate
  253. } from '@/utils'
  254. export default {
  255. data() {
  256. return {
  257. popupShow3: false,
  258. params: {
  259. year: true,
  260. month: true,
  261. day: false,
  262. hour: false,
  263. minute: false,
  264. second: false
  265. },
  266. headitemby:"",
  267. isinit: true,
  268. form: {},
  269. form2: {},
  270. selecttype: "",
  271. selectstationId: "",
  272. selectdeviceNo: "",
  273. popupShow2: false,
  274. popupShow: false,
  275. popupShow4: false,
  276. nowTime: 0,
  277. selectstationId2: "",
  278. selectstationIndex: 0,
  279. selectstationName: "",
  280. info: {},
  281. title: "",
  282. showdate: false,
  283. showdate2: false,
  284. queryTime: "",
  285. queryTime2: "",
  286. indexData: {},
  287. indexData3: null,
  288. indexData2: null,
  289. type_head: '1',
  290. startDate_head: '',
  291. changeitemBl: false,
  292. myChart: null,
  293. myChartReady: false,
  294. myChartTime: false,
  295. subsection: [{
  296. name: '金额'
  297. },
  298. {
  299. name: '笔数'
  300. }
  301. ],
  302. stationFlowList: [],
  303. serviceMoneySum: 0,
  304. allMoneySum: 0,
  305. stationList: [],
  306. stationListSon: [],
  307. tabbarList: [{
  308. iconPath: "bar-chart-box-fill",
  309. selectedIconPath: "bar-chart-box-fill",
  310. text: '统计',
  311. count: 0,
  312. isDot: true,
  313. customIcon: true,
  314. },
  315. {
  316. iconPath: "article-fill",
  317. selectedIconPath: "article-fill",
  318. text: '明细',
  319. midButton: true,
  320. customIcon: true,
  321. },
  322. {
  323. iconPath: "account-pin-box-fill",
  324. selectedIconPath: "account-pin-box-fill",
  325. text: '我的',
  326. count: 0,
  327. isDot: false,
  328. customIcon: true,
  329. },
  330. ],
  331. endTime: '',
  332. endTime2: '',
  333. current: 1,
  334. background: {
  335. background: 'none'
  336. },
  337. value: '',
  338. type: 'select',
  339. show: false,
  340. border: true,
  341. step: 0,
  342. stepname: '',
  343. startTime: '',
  344. stepid: 0,
  345. }
  346. },
  347. onShow() {
  348. if (this.$refs.tabbarMain) {
  349. this.$refs.tabbarMain.setcount(0);
  350. }
  351. },
  352. onLoad() {
  353. this.info = this.carhelp.getPersonInfo("merchantUser")
  354. this.title = this.info.merchantAccountName
  355. },
  356. components: {
  357. Tabbar
  358. },
  359. onReady() {
  360. var date = new Date();
  361. this.nowTime = 7
  362. this.queryTime = parseUnixTime(currentTimeStamp(), '{y}-{m}');
  363. this.queryTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}'),
  364. this.startDate_head = parseUnixTime(beforeTimeStamp(30), '{y}-{m}-{d}')
  365. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  366. this.endTime = parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}')
  367. //this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  368. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  369. this.getStation()
  370. },
  371. computed: {
  372. // startTime(){
  373. // return this.queryTime+'-1'
  374. // },
  375. startTime2() {
  376. return this.queryTime2 + '-01'
  377. },
  378. },
  379. methods: {
  380. changeitem(e) {
  381. if (this.stationFlowList.length > 1 && e.index == this.stationFlowList.length - 1 && e.show) {
  382. this.changeitemBl = true;
  383. } else {
  384. this.changeitemBl = false;
  385. }
  386. },
  387. showTime(name) {
  388. if (!name) {
  389. return ''
  390. }
  391. return name.replace('-', '年') + '月';
  392. },
  393. getStation(bl) {
  394. API.stationList().then((res) => {
  395. this.stationList = res.data.stationList
  396. this.stationList.unshift({
  397. id: '',
  398. name: "全部站点"
  399. })
  400. this.selectstationName = "全部站点"
  401. this.stationListSon = res.data.deviceList
  402. this.getDataHome2()
  403. this.getData()
  404. this.getData2()
  405. }).catch(error => {
  406. uni.showToast({
  407. title: error
  408. })
  409. })
  410. },
  411. resetBtn() {
  412. this.nowTime = 7
  413. this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  414. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  415. this.selecttype = ""
  416. this.selectstationId = ""
  417. this.selectdeviceNo = ""
  418. this.form = {
  419. type: this.selecttype,
  420. stationId: this.selectstationId,
  421. deviceNo: this.selectdeviceNo,
  422. };
  423. this.popupShow = false;
  424. this.list = [];
  425. this.getData()
  426. },
  427. okbtn() {
  428. this.popupShow = false;
  429. this.form = {
  430. type: this.selecttype,
  431. stationId: this.selectstationId,
  432. deviceNo: this.selectdeviceNo,
  433. };
  434. this.list = [];
  435. this.getData()
  436. },
  437. resetBtn2() {
  438. this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
  439. this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  440. this.selectstationId2 = ""
  441. this.form2 = {
  442. stationId: this.selectstationId2,
  443. };
  444. this.popupShow2 = false;
  445. this.getData2()
  446. },
  447. okbtn2() {
  448. this.popupShow2 = false;
  449. this.form2 = {
  450. stationId: this.selectstationId2,
  451. };
  452. this.getData2()
  453. },
  454. getDataHome2() {
  455. var endtime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  456. API.homeHeadChargingStatistics({
  457. type: this.type_head,
  458. startDate: this.startDate_head,
  459. endDate: endtime
  460. }).then((res) => {
  461. this.indexData3 = res.data;
  462. if( this.info.accountType==3){
  463. //getPie2
  464. this.getPie2()
  465. }else{
  466. //getPie
  467. this.getPie()
  468. }
  469. }).catch(error => {
  470. uni.showToast({
  471. title: error
  472. })
  473. })
  474. },
  475. getDataHome() {
  476. API.homeHeadStatistics().then((res) => {
  477. this.indexData = res.data;
  478. }).catch(error => {
  479. uni.showToast({
  480. title: error
  481. })
  482. })
  483. },
  484. getData() {
  485. this.form.startDate = this.startTime,
  486. this.form.endDate = this.endTime
  487. API.homeFlowStatistics(this.form).then((res) => {
  488. this.stationFlowList = res.data.stationFlowList;
  489. this.nowTime = daysDistance(this.startTime, this.endTime) + 1;
  490. this.serviceMoneySum = 0;
  491. this.allMoneySum = 0;
  492. for (var i in this.stationFlowList) {
  493. var item = this.stationFlowList[i];
  494. this.allMoneySum += item.actualMoney
  495. this.serviceMoneySum += item.serviceMoney
  496. this.serviceMoneySum += item.cardMoney
  497. }
  498. }).catch(error => {
  499. uni.showToast({
  500. title: error
  501. })
  502. })
  503. },
  504. getData2() {
  505. uni.showLoading({
  506. title: "加载中",
  507. mask: true,
  508. })
  509. this.form2.startDate = this.startTime2,
  510. this.form2.endDate = this.endTime2
  511. API.homeIncomeStatistics(this.form2).then((res) => {
  512. this.indexData2 = res.data
  513. uni.hideLoading()
  514. }).catch(error => {
  515. uni.showToast({
  516. title: error
  517. })
  518. })
  519. },
  520. changesub(e) {
  521. this.current = e
  522. this.type_head = e;
  523. if (e == 1) {
  524. this.startDate_head = parseUnixTime(beforeTimeStamp(30), '{y}-{m}-{d}')
  525. } else {
  526. this.startDate_head = parseUnixTime(beforeTimeStamp(365), '{y}-{m}-01')
  527. }
  528. // this.getPie()
  529. this.getDataHome2()
  530. },
  531. changedate4(e) {
  532. this.startTime = e.startDate
  533. this.endTime = e.endDate
  534. this.okbtn()
  535. },
  536. changedate3(e) {
  537. var index = e[0];
  538. var obj = this.stationList[index];
  539. this.selectstationId2 = obj.id;
  540. this.selectstationIndex = index;
  541. this.selectstationName = obj.name;
  542. this.okbtn2()
  543. },
  544. changedate(e) {
  545. this.queryTime = e.year + '-' + e.month;
  546. this.startTime = e.year + '-' + e.month + '-01';
  547. if (e.month == '12') {
  548. this.endTime = (e.year) + "-12-31"
  549. } else {
  550. var b = e.year + '/' + (parseInt(e.month) + 1) + '/1';
  551. var a = beforeTimeStamp(1, b);
  552. this.endTime = parseUnixTime(a, '{y}-{m}-{d}')
  553. }
  554. this.okbtn()
  555. },
  556. changedate2(e) {
  557. this.queryTime2 = e.year + '-' + e.month;
  558. if (e.month == '12') {
  559. this.endTime2 = (e.year) + "-12-31"
  560. } else {
  561. var b = e.year + '/' + (parseInt(e.month) + 1) + '/1';
  562. var a = beforeTimeStamp(1, b);
  563. this.endTime2 = parseUnixTime(a, '{y}-{m}-{d}')
  564. }
  565. this.okbtn2()
  566. },
  567. getPie2(){
  568. this.headitemby="";
  569. var showkey = "";
  570. var getData = this.indexData3.graphMap;
  571. //var unit = this.current ? '笔' : '元'
  572. var colorName = "#333"
  573. this.showlist1 = ['收入', '利润', '次数'];
  574. var sz2 = ['todayAmount', 'todayProfit', 'todayEQNum'];
  575. if (!this.myChart) {
  576. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  577. this.myChart.on("dataZoom", (res) => {
  578. showkey = "";
  579. this.headitemby ="";
  580. });
  581. }
  582. this.myChart.clear();
  583. //
  584. var timelist = []
  585. for (var i in getData) {
  586. if (this.type_head == 1) {
  587. timelist.push(i.substring(5))
  588. } else {
  589. timelist.push(i)
  590. }
  591. }
  592. var list = [];
  593. for (var j in this.showlist1) {
  594. var ap = {
  595. name: this.showlist1[j],
  596. type: 'line',
  597. // label: {
  598. // show: true,
  599. // position: 'top'
  600. // },
  601. data: []
  602. }
  603. if (this.type_head == 1) {
  604. ap.symbolSize = 3;
  605. }
  606. var bl=true;
  607. for (var i in getData) {
  608. //var time=this.queryDate.replace("-","/").replace("-","/")
  609. //time+' '+i
  610. var obj = getData[i][sz2[j]];
  611. //'todayAmount', 'todayProfit', 'todayEQNum'
  612. if (bl&&getData[i].todayAmount == 0 && getData[i].todayProfit == 0 && getData[i].todayEQNum == 0 ) {
  613. //&& &&getData[i].todayEQNum == 0
  614. continue;
  615. }
  616. bl=false;
  617. var time = i
  618. if (this.type_head == 1) {
  619. // time = i.substring(5)
  620. } else {
  621. }
  622. if(j!=2){
  623. obj=obj.toFixed(2)
  624. }
  625. ap.data.push([time, obj]);
  626. }
  627. if(bl){
  628. ap.data=[];
  629. for (var i in getData) {
  630. //var time=this.queryDate.replace("-","/").replace("-","/")
  631. //time+' '+i
  632. var obj = getData[i][sz2[j]];
  633. var time = i
  634. if (this.type_head == 1) {
  635. time = i.substring(5)
  636. } else {
  637. }
  638. if(j!=2){
  639. obj=obj.toFixed(2)
  640. }
  641. ap.data.push([time, obj]);
  642. }
  643. }
  644. list.push(ap)
  645. }
  646. // 指定图表的配置项和数据
  647. var option = {
  648. tooltip: {
  649. formatter: (value) => {
  650. //getPie2
  651. var info = value;
  652. console.log(value)
  653. var name = value[0].data[0];
  654. var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  655. var now = newDate(name);
  656. var day = now.getDay();
  657. var week = weeks[day];
  658. var style = "float: right;margin-left: 3px;"
  659. var text1 = ""
  660. for (var i in value) {
  661. var u = "元"
  662. if (value[i].seriesName == '次数') {
  663. u = '次'
  664. }
  665. text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
  666. '">' + value[i].data[1] + u + '</span></p>';
  667. }
  668. if (this.type_head == 1) {
  669. //time = i.substring(5)
  670. var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  671. var now = newDate(name);
  672. var day = now.getDay();
  673. var week = weeks[day];
  674. return `<p>${name} ${week}</p>` + text1
  675. } else {
  676. return `<p>${name}</p>` + text1
  677. }
  678. },
  679. trigger: 'axis',
  680. borderColor: "#F0F0F0",
  681. borderWidth: 1,
  682. backgroundColor: "#ffffff",
  683. textStyle: {
  684. color: "#333"
  685. }
  686. },
  687. legend: {
  688. data: this.showlist1,
  689. textStyle: {
  690. color: "#333"
  691. }
  692. },
  693. grid: {
  694. top: '13%',
  695. left: '3%',
  696. right: '8%',
  697. bottom: '18%',
  698. containLabel: true
  699. },
  700. xAxis: {
  701. //type: 'value',
  702. type: 'category',
  703. splitNumber: 4,
  704. boundaryGap: false,
  705. axisLabel: {
  706. formatter: (value) => {
  707. if(this.headitemby==""){
  708. this.headitemby=value
  709. }
  710. var i = 0
  711. if (this.type_head == 1) {
  712. i = 0;
  713. } else {
  714. i = 3;
  715. }
  716. var showvalue = "";
  717. var key = value.substring(0,8-i);
  718. if (showkey == ""||value==this.headitemby) {
  719. showkey = key
  720. showvalue = value
  721. showvalue = value.substring(5-i)
  722. } else {
  723. if (key != showkey) {
  724. showkey = key
  725. showvalue = value
  726. showvalue = value.substring(5-i)
  727. } else {
  728. showvalue = value.substring(8-i)
  729. }
  730. }
  731. return showvalue.replace("-",".");
  732. },
  733. // formatter: (value) => {
  734. // if(this.headitemby==""){
  735. // this.headitemby=value
  736. // }
  737. // var i = 0
  738. // if (this.type_head == 1) {
  739. // i = 3;
  740. // } else {
  741. // i = 5;
  742. // }
  743. // var showvalue = "";
  744. // var key = value.substring(0, i);
  745. // if (showkey == ""||value==this.headitemby) {
  746. // showkey = key
  747. // showvalue = value
  748. // } else {
  749. // if (key != showkey) {
  750. // showkey = key
  751. // showvalue = value
  752. // } else {
  753. // showvalue = value.substring(i)
  754. // }
  755. // }
  756. // return showvalue.replace("-",".");
  757. // },
  758. textStyle: {
  759. color: "#333"
  760. }
  761. },
  762. axisLine: {
  763. show: true,
  764. lineStyle: {
  765. color: "#333"
  766. }
  767. },
  768. },
  769. yAxis: {
  770. //type: 'log',
  771. // name: '单位('+this.typeN+')',
  772. axisLabel: {
  773. textStyle: {
  774. color: "#333"
  775. }
  776. },
  777. axisLine: {
  778. show: true,
  779. lineStyle: {
  780. color: "#333"
  781. }
  782. },
  783. },
  784. series: list
  785. };
  786. option.dataZoom = [{
  787. type: 'inside',
  788. start: 0,
  789. end: 100
  790. },
  791. {
  792. start: 0,
  793. end: 100
  794. }
  795. ]
  796. if (this.type_head == 1) {
  797. } else {
  798. //timelist.push(i)
  799. }
  800. // 使用刚指定的配置项和数据显示图表。
  801. this.myChart.setOption(option);
  802. },
  803. getPie() {
  804. var dataInterval =null;
  805. if (this.type_head == 1) {
  806. dataInterval= [0,25,50,75,100,
  807. 125,150,200,250,300,400,500,
  808. 600,800,1000,1200,1400,1600,1800,
  809. 2000,2300,2600,2800,
  810. 3000,3400,3800,4200,
  811. 4800,5200,5600,6000,6500,7000,7500,8000,9000, 10000,12000,14000, 16000, 20000, 30000,999999];
  812. }else{
  813. dataInterval= [0,500,1000,2000,5000, 10000, 20000, 30000, 40000,50000, 60000,70000, 80000,90000, 100000, 120000, 140000, 160000, 180000, 200000, 250000,300000, 400000, 500000,999999];
  814. }
  815. this.headitemby="";
  816. var showkey = "";
  817. var getData = this.indexData3.graphMap;
  818. //var unit = this.current ? '笔' : '元'
  819. var colorName = "#333"
  820. this.showlist1 = ['收入', '利润', '次数'];
  821. var sz2 = ['todayAmount', 'todayProfit', 'todayEQNum'];
  822. if (!this.myChart) {
  823. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  824. this.myChart.on("dataZoom", (res) => {
  825. showkey = "";
  826. this.headitemby ="";
  827. });
  828. }
  829. this.myChart.clear();
  830. //
  831. var timelist = []
  832. for (var i in getData) {
  833. if (this.type_head == 1) {
  834. timelist.push(i.substring(5))
  835. } else {
  836. timelist.push(i)
  837. }
  838. }
  839. var list = [];
  840. for (var j in this.showlist1) {
  841. var ap = {
  842. name: this.showlist1[j],
  843. type: 'line',
  844. // label: {
  845. // show: true,
  846. // position: 'top'
  847. // },
  848. data: []
  849. }
  850. if (this.type_head == 1) {
  851. ap.symbolSize = 3;
  852. }
  853. var bl=true;
  854. for (var i in getData) {
  855. //var time=this.queryDate.replace("-","/").replace("-","/")
  856. //time+' '+i
  857. var obj = getData[i][sz2[j]];
  858. //**********
  859. if(true){
  860. const min_v = Math.max(...dataInterval.filter((v) => v <= obj));
  861. // 2.寻找在数据间隔里大于amount的最小值
  862. const max_v = Math.min(...dataInterval.filter((v) => v > obj));
  863. // 3.寻找 min_v 所在的下标
  864. const index = dataInterval.findIndex((v) => v === min_v);
  865. // 4.计算该amount在y轴上应该展示的位置
  866. const y_value = ((obj - min_v) / (max_v - min_v)) * 10 + index * 10;
  867. obj = y_value;
  868. }
  869. //**********
  870. //'todayAmount', 'todayProfit', 'todayEQNum'
  871. if (bl&&getData[i].todayAmount == 0 && getData[i].todayProfit == 0 &&getData[i].todayEQNum == 0) {
  872. //&& &&getData[i].todayEQNum == 0
  873. continue;
  874. }
  875. bl=false;
  876. var time = i
  877. if (this.type_head == 1) {
  878. //time = i.substring(5)
  879. } else {
  880. }
  881. ap.data.push([time, obj]);
  882. }
  883. if(bl){
  884. ap.data=[];
  885. for (var i in getData) {
  886. //var time=this.queryDate.replace("-","/").replace("-","/")
  887. //time+' '+i
  888. var obj = getData[i][sz2[j]];
  889. var time = i
  890. if (this.type_head == 1) {
  891. time = i.substring(5)
  892. } else {
  893. }
  894. if(j!=2){
  895. obj=obj.toFixed(2)
  896. }
  897. ap.data.push([time, obj]);
  898. }
  899. }
  900. list.push(ap)
  901. }
  902. var yshow=0;
  903. // 指定图表的配置项和数据
  904. var option = {
  905. tooltip: {
  906. formatter: (value) => {
  907. //getPie
  908. var name = value[0].data[0];
  909. var info = getData[name];
  910. var style = "float: right;margin-left: 3px;"
  911. var text1 = ""
  912. for (var i in value) {
  913. var u = "元"
  914. var num=info[sz2[value[i].seriesIndex]];
  915. if (value[i].seriesName == '次数') {
  916. u = '次'
  917. }else{
  918. num=num.toFixed(2)
  919. }
  920. text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
  921. '">' + num + u + '</span></p>';
  922. }
  923. if (this.type_head == 1) {
  924. //time = i.substring(5)
  925. var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  926. var now = newDate(name);
  927. var day = now.getDay();
  928. var week = weeks[day];
  929. return `<p>${name} ${week}</p>` + text1
  930. } else {
  931. return `<p>${name}</p>` + text1
  932. }
  933. },
  934. trigger: 'axis',
  935. borderColor: "#F0F0F0",
  936. borderWidth: 1,
  937. backgroundColor: "#ffffff",
  938. textStyle: {
  939. color: "#333"
  940. }
  941. },
  942. legend: {
  943. data: this.showlist1,
  944. textStyle: {
  945. color: "#333"
  946. }
  947. },
  948. grid: {
  949. top: '13%',
  950. left: '3%',
  951. right: '8%',
  952. bottom: '18%',
  953. containLabel: true
  954. },
  955. xAxis: {
  956. //type: 'value',
  957. type: 'category',
  958. splitNumber: 4,
  959. boundaryGap: false,
  960. axisLabel: {
  961. formatter: (value) => {
  962. if(this.headitemby==""){
  963. this.headitemby=value
  964. }
  965. var i = 0
  966. if (this.type_head == 1) {
  967. i = 0;
  968. } else {
  969. i = 3;
  970. }
  971. var showvalue = "";
  972. var key = value.substring(0,8-i);
  973. if (showkey == ""||value==this.headitemby) {
  974. showkey = key
  975. showvalue = value
  976. showvalue = value.substring(5-i)
  977. } else {
  978. if (key != showkey) {
  979. showkey = key
  980. showvalue = value
  981. showvalue = value.substring(5-i)
  982. } else {
  983. showvalue = value.substring(8-i)
  984. }
  985. }
  986. return showvalue.replace("-",".");
  987. },
  988. textStyle: {
  989. color: "#333"
  990. }
  991. },
  992. axisLine: {
  993. show: true,
  994. lineStyle: {
  995. color: "#333"
  996. }
  997. },
  998. },
  999. yAxis: {
  1000. type: 'value',
  1001. // name: '单位('+this.typeN+')',
  1002. axisLabel: {
  1003. formatter:(v,i)=>{
  1004. //console.log(v,i)
  1005. if(i==0){
  1006. yshow=0
  1007. return 0
  1008. }
  1009. if(yshow!=parseInt(v/10)){
  1010. yshow=parseInt(v/10);
  1011. return dataInterval[parseInt(v/10)]
  1012. }else{
  1013. return ''
  1014. }
  1015. },
  1016. textStyle: {
  1017. color: "#333"
  1018. }
  1019. },
  1020. axisLine: {
  1021. show: true,
  1022. lineStyle: {
  1023. color: "#333"
  1024. }
  1025. },
  1026. },
  1027. series: list
  1028. };
  1029. option.dataZoom = [{
  1030. type: 'inside',
  1031. start: 0,
  1032. end: 100
  1033. },
  1034. {
  1035. start: 0,
  1036. end: 100
  1037. }
  1038. ]
  1039. if (this.type_head == 1) {
  1040. } else {
  1041. //timelist.push(i)
  1042. }
  1043. // 使用刚指定的配置项和数据显示图表。
  1044. this.myChart.setOption(option);
  1045. }
  1046. }
  1047. }
  1048. </script>
  1049. <style>
  1050. page {
  1051. background: url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  1052. background-size: 100%;
  1053. }
  1054. </style>
  1055. <style lang="scss" scoped>
  1056. .headbotton1:after {
  1057. border-radius: 15px 0 0 15px;
  1058. }
  1059. .headbotton2:after {
  1060. border-radius: 0 15px 15px 0;
  1061. }
  1062. .detailstable {
  1063. padding: 30rpx 30rpx !important;
  1064. }
  1065. .detailstableHead {
  1066. .span1 {
  1067. font-size: 32rpx !important;
  1068. }
  1069. .details-row-head-1 {}
  1070. .details-row-head-2 {}
  1071. .details-row-head-3 {
  1072. width: 30% !important;
  1073. max-width: 150rpx;
  1074. .span {}
  1075. }
  1076. .span2 {
  1077. font-size: 44rpx !important;
  1078. font-weight: bold;
  1079. width: 100%;
  1080. color: #101010;
  1081. span {
  1082. font-size: 24rpx !important;
  1083. }
  1084. }
  1085. }
  1086. .detailslineHead {
  1087. border-top: 1px solid #ededed;
  1088. ;
  1089. .details-row {
  1090. padding-left: 8rpx !important;
  1091. }
  1092. font-size: 30rpx !important;
  1093. .span1 span {
  1094. font-size: 28rpx;
  1095. }
  1096. }
  1097. .detailstable,
  1098. .detailstableHead {
  1099. font-size: 16px;
  1100. p {
  1101. font-size: 14px;
  1102. }
  1103. .details-row-main {
  1104. border-bottom: 1px solid #ededed;
  1105. padding: 10px 0;
  1106. }
  1107. .detailsline {
  1108. border-bottom: 1px solid #ededed;
  1109. }
  1110. .detailsline,
  1111. .detailsline—bottom {
  1112. display: flex;
  1113. .details-row {
  1114. width: 50%;
  1115. display: flex;
  1116. justify-content: space-between;
  1117. flex-direction: column;
  1118. padding-left: 16rpx;
  1119. margin-bottom: 20rpx;
  1120. .span1 {
  1121. color: rgba(136, 136, 136, 100);
  1122. font-size: 28rpx;
  1123. width: 100%;
  1124. }
  1125. .span2 {
  1126. font-size: 36rpx;
  1127. width: 100%;
  1128. color: #101010;
  1129. span {
  1130. font-size: 24rpx;
  1131. }
  1132. }
  1133. }
  1134. }
  1135. .details-row-1 {
  1136. width: 47%;
  1137. padding-left: 0px !important;
  1138. border-right: 1px solid #ededed;
  1139. }
  1140. }
  1141. .details {
  1142. padding: 20px;
  1143. background-color: #fff;
  1144. border-radius: 8px;
  1145. }
  1146. .details-title {
  1147. margin-bottom: 16px;
  1148. h4 {
  1149. font-weight: normal;
  1150. font-size: 16px;
  1151. position: relative;
  1152. padding-left: 10px;
  1153. &::after {
  1154. content: '';
  1155. position: absolute;
  1156. height: 12px;
  1157. width: 4px;
  1158. background-color: #27B148;
  1159. left: 0;
  1160. top: 5px;
  1161. }
  1162. }
  1163. }
  1164. .details-row {
  1165. display: flex;
  1166. justify-content: space-between;
  1167. align-items: center;
  1168. margin-top: 15px;
  1169. p {
  1170. color: #37393c;
  1171. font-weight: bold;
  1172. }
  1173. }
  1174. .details-row2 {
  1175. display: flex;
  1176. justify-content: space-between;
  1177. align-items: center;
  1178. // margin-top: 15px;
  1179. p {
  1180. // color: #37393c;
  1181. // font-weight: bold;
  1182. }
  1183. }
  1184. .popup-screen {
  1185. padding: 20px;
  1186. position: relative;
  1187. .screen {
  1188. padding-bottom: 30px;
  1189. }
  1190. .screen-item {
  1191. margin-bottom: 20px;
  1192. .screen-head {
  1193. margin-bottom: 8px;
  1194. font-size: 16px;
  1195. }
  1196. .screen-main {
  1197. display: flex;
  1198. // display: -webkit-box;
  1199. flex-wrap: wrap;
  1200. }
  1201. .screen-entry {
  1202. width: 29%;
  1203. padding: 6px 0;
  1204. display: flex;
  1205. align-items: center;
  1206. justify-content: center;
  1207. background-color: #F2F5FA;
  1208. text-align: center;
  1209. margin-bottom: 10px;
  1210. border-radius: 3px;
  1211. margin-right: 6px;
  1212. }
  1213. .screen-entry.active {
  1214. background-color: #185AC6;
  1215. color: #fff;
  1216. }
  1217. }
  1218. .screen-foot {
  1219. position: fixed;
  1220. left: 0;
  1221. right: 0;
  1222. bottom: 0;
  1223. display: flex;
  1224. height: 50px;
  1225. border-top: 1px solid #ededed;
  1226. .screen-btn-l {
  1227. background-color: #fff;
  1228. flex: 0.2;
  1229. text-align: center;
  1230. line-height: 50px;
  1231. }
  1232. .screen-btn-r {
  1233. flex: 0.8;
  1234. text-align: center;
  1235. line-height: 50px;
  1236. background-color: #185AC6;
  1237. color: #fff;
  1238. }
  1239. }
  1240. }
  1241. .navbar-tit {
  1242. color: #fff;
  1243. font-size: 24px;
  1244. padding-left: 15px;
  1245. padding-top: 10px;
  1246. }
  1247. .statisticsData {
  1248. background-color: #fff;
  1249. margin: 0px 24rpx 24rpx;
  1250. //padding:0px 24rpx 24rpx;
  1251. border-radius: 8px;
  1252. }
  1253. .statisticsDataMain {
  1254. flex-wrap: wrap;
  1255. display: flex;
  1256. }
  1257. .statisticsData-item {
  1258. flex: 1;
  1259. width: 40%;
  1260. .statisticsData-head {
  1261. display: flex;
  1262. align-items: center;
  1263. p {
  1264. color: #637AA2;
  1265. font-size: 12px;
  1266. }
  1267. }
  1268. .statisticsData-main {
  1269. margin-top: 4px;
  1270. font-size: 18px;
  1271. }
  1272. .statisticsData-foot {
  1273. display: flex;
  1274. align-items: center;
  1275. margin-top: 16px;
  1276. p {
  1277. color: #637AA2;
  1278. }
  1279. h4 {
  1280. margin-left: 8px;
  1281. }
  1282. }
  1283. }
  1284. .statisticsChart {
  1285. margin: 16px;
  1286. .statisticsChart-head {
  1287. margin-bottom: 5px;
  1288. display: flex;
  1289. justify-content: space-between;
  1290. align-items: center;
  1291. h4 {
  1292. font-weight: normal;
  1293. font-size: 16px;
  1294. position: relative;
  1295. padding-left: 10px;
  1296. &::after {
  1297. content: '';
  1298. position: absolute;
  1299. height: 12px;
  1300. width: 4px;
  1301. background-color: #4E8DF6;
  1302. left: 0;
  1303. top: 5px;
  1304. }
  1305. }
  1306. .statisticsChart-time {
  1307. display: flex;
  1308. align-items: center;
  1309. p {
  1310. color: #666;
  1311. }
  1312. }
  1313. }
  1314. .statisticsChart-main {
  1315. background-color: #fff;
  1316. padding: 10px 16px 16px 16px;
  1317. border-radius: 8px;
  1318. }
  1319. }
  1320. </style>