mainStatistics.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="">
  5. <image class="userFlagimg" src="../../static/img/userFlag.png" mode=""></image>
  6. </view>
  7. <view class="pname">
  8. <font class="wenzi" style="color: #BDD6F3;font-size:28upx"> {{$t('mainStatistics.name')}}: {{pnameData}}</font>
  9. </view>
  10. <view class="company">
  11. <font style="color: #BDD6F3;font-size:28upx">{{$t('mainStatistics.company')}}</font>
  12. </view>
  13. </view>
  14. <view class="ri">
  15. <view class="riShell">
  16. <view class="riImg">
  17. <image style="width: 64upx;height: 64upx;padding-top: 20upx;" :src="$t('mainStatistics.dayImg')"></image>
  18. </view>
  19. <view class="riTitle">
  20. <view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
  21. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.dayTotalMoney')}}:</font>
  22. <font style="color: #ED341F;">{{dayTotalMoney}}</font>
  23. </view>
  24. <view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
  25. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.dayTotalNum')}}:</font>
  26. <font style="color: #ED341F;">{{dayTotalNum}}</font>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="riqi">
  31. <view style="text-align:right" class="tody">
  32. <font style="color: #596D83;">{{today}}</font>
  33. </view>
  34. <view style="text-align:right" class="xingqi">
  35. <font style="color: #596D83;">{{week}}</font>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="fourTitle">
  40. <view class="four">
  41. <view class="fourImg">
  42. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.weekImg')" mode=""></image>
  43. </view>
  44. <view class="fourShell">
  45. <view class="one">
  46. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.weekTotalMoney')}}:</font>
  47. <font style="color: #ED341F;">{{weekTotalMoney}}</font>
  48. </view>
  49. <view class="two">
  50. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.weekTotalNum')}}:</font>
  51. <font style="color: #ED341F;">{{weekTotalNum}}</font>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="four">
  56. <view class="fourImg">
  57. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.monthImg')" mode=""></image>
  58. </view>
  59. <view class="fourShell">
  60. <view class="one">
  61. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.monthTotalMoney')}}:</font>
  62. <font style="color: #ED341F;">{{monthTotalMoney}}</font>
  63. </view>
  64. <view class="two">
  65. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.monthTotalNum')}}:</font>
  66. <font style="color: #ED341F;">{{monthTotalNum}}</font>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="four">
  71. <view class="fourImg">
  72. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.yearImg')" mode=""></image>
  73. </view>
  74. <view class="fourShell">
  75. <view class="one">
  76. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.yearTotalMoney')}}:</font>
  77. <font style="color: #ED341F;">{{yearTotalMoney}}</font>
  78. </view>
  79. <view class="two">
  80. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.yearTotalNum')}}:</font>
  81. <font style="color: #ED341F;">{{yearTotalNum}}</font>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="four">
  86. <view class="fourImg">
  87. <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.allImg')" mode=""></image>
  88. </view>
  89. <view class="fourShell">
  90. <view class="one">
  91. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.machineTotalNum')}}:</font>
  92. <font style="color: #ED341F;">{{machineTotalNum}}</font>
  93. </view>
  94. <view class="two">
  95. <font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.machineUseNum')}}:</font>
  96. <font style="color: #ED341F;">{{machineUseNum}}</font>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="qiun-columns">
  102. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  103. <view class="qiun-title-dot-light">
  104. <view class="dis">{{$t('mainStatistics.day')}}</view>
  105. </view>
  106. <view class="shijian" style="text-align: center;position: relative;">
  107. <image @click="pre('day')" class="preImg" src="/static/img/leftTriangle.png"></image>
  108. <span>{{startDate1}}</span>
  109. <image @click="next('day')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  110. </view>
  111. </view>
  112. <view class="qiun-charts" style="background-color: #FFFFFF;">
  113. <canvas canvas-id="canvaColumn1" id="canvaColumn1" class="charts" disable-scroll=true @touchstart="touchLine1"
  114. @touchmove="moveLine1" @touchend="touchEndLine1" style="background-color: #FFFFFF;"></canvas>
  115. </view>
  116. </view>
  117. <view class="line"></view>
  118. <view class="qiun-columns">
  119. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  120. <view class="qiun-title-dot-light">
  121. <view class="dis">{{$t('mainStatistics.week')}}</view>
  122. </view>
  123. <view class="shijian" style="text-align: center;position: relative;">
  124. <image @click="pre('week')" class="preImg" src="/static/img/leftTriangle.png"></image>
  125. <span>{{startDate2}} -- {{endDate2}}</span>
  126. <image @click="next('week')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  127. </view>
  128. </view>
  129. <view class="qiun-charts" style="background-color: #FFFFFF;">
  130. <canvas canvas-id="canvaColumn2" id="canvaColumn2" class="charts" disable-scroll=true @touchstart="touchLine2"
  131. @touchmove="moveLine2" @touchend="touchEndLine2" style="background-color: #FFFFFF;"></canvas>
  132. </view>
  133. </view>
  134. <view class="line"></view>
  135. <view class="qiun-columns">
  136. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  137. <view class="qiun-title-dot-light">
  138. <view class="dis">{{$t('mainStatistics.month')}}</view>
  139. </view>
  140. <view class="shijian" style="text-align: center;position: relative;">
  141. <image @click="pre('month')" class="preImg" src="/static/img/leftTriangle.png"></image>
  142. <span>{{startDate3}} -- {{endDate3}}</span>
  143. <image @click="next('month')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  144. </view>
  145. </view>
  146. <view class="qiun-charts" style="background-color: #FFFFFF;">
  147. <canvas canvas-id="canvaColumn3" id="canvaColumn3" class="charts" disable-scroll=true @touchstart="touchLine3"
  148. @touchmove="moveLine3" @touchend="touchEndLine3" style="background-color: #FFFFFF;"></canvas>
  149. </view>
  150. </view>
  151. <view class="line"></view>
  152. <view class="qiun-columns">
  153. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  154. <view class="qiun-title-dot-light">
  155. <view class="dis">{{$t('mainStatistics.year')}}</view>
  156. </view>
  157. <view class="shijian" style="text-align: center;position: relative;">
  158. <image @click="pre('year')" class="preImg" src="/static/img/leftTriangle.png"></image>
  159. <span>{{startDate4}} -- {{endDate4}}</span>
  160. <image @click="next('year')" class="nextImg" src="/static/img/rightTriangle.png"></image>
  161. </view>
  162. </view>
  163. <view class="qiun-charts" style="background-color: #FFFFFF;">
  164. <canvas canvas-id="canvaColumn4" id="canvaColumn4" class="charts" disable-scroll=true @touchstart="touchLine4"
  165. @touchmove="moveLine4" @touchend="touchEndLine4" style="background-color: #FFFFFF;"></canvas>
  166. </view>
  167. </view>
  168. </view>
  169. </template>
  170. <script>
  171. import {
  172. mapState,
  173. mapActions,
  174. mapMutations
  175. } from 'vuex';
  176. import uCharts from '@/components/u-charts/u-charts.js';
  177. import {
  178. dateUtils
  179. } from '@/common/util.js';
  180. var _self;
  181. var canvaColumn1 = null;
  182. var canvaColumn2 = null;
  183. var canvaColumn3 = null;
  184. var canvaColumn4 = null;
  185. export default {
  186. name: 'mainStatistics',
  187. props: {
  188. equipmentId: '',
  189. adminId: '',
  190. pname: '',
  191. },
  192. data() {
  193. return {
  194. machineTotalNum: 0,
  195. machineUseNum: 0,
  196. dayTotalMoney: 0,
  197. dayTotalNum: 0,
  198. weekTotalMoney: 0,
  199. weekTotalNum: 0,
  200. monthTotalMoney: 0,
  201. monthTotalNum: 0,
  202. yearTotalMoney: 0,
  203. yearTotalNum: 0,
  204. cWidth: '',
  205. cHeight: '',
  206. pixelRatio: 1,
  207. startDate1: '',
  208. startDate2: '',
  209. endDate2: '',
  210. startDate3: '',
  211. endDate3: '',
  212. startDate4: '',
  213. endDate4: '',
  214. today: '',
  215. week: ''
  216. }
  217. },
  218. computed: {
  219. ...mapState(['loginUser']),
  220. pnameData: {
  221. get() {
  222. return this.pname;
  223. }
  224. },
  225. },
  226. onShow() {
  227. uni.setNavigationBarTitle({
  228. title: this.$t('mainStatistics.title')
  229. });
  230. uni.setTabBarItem({
  231. index: 0,
  232. text: this.$t('tabs.tab1')
  233. });
  234. var token = uni.getStorageSync("token");
  235. if (token.toString().length > 1) {
  236. this.init();
  237. } else {
  238. uni.reLaunch({
  239. url: '../Login/Login',
  240. });
  241. }
  242. // console.log("onShow");
  243. var test = uni.getStorageSync('test');
  244. var globalUser = uni.getStorageSync("globalUser");
  245. if (globalUser.toString().length > 1) {
  246. //判断是不是初次登陆
  247. if (test == 2) {
  248. this.init();
  249. }
  250. }
  251. var id = this.adminId;
  252. this.day();
  253. // this.equipmentStatus();
  254. },
  255. mounted() {
  256. var token = uni.getStorageSync("token");
  257. if (token.toString().length > 1) {
  258. this.init();
  259. } else {
  260. uni.reLaunch({
  261. url: '../Login/Login',
  262. });
  263. }
  264. // this.day();
  265. this.equipmentStatus();
  266. },
  267. methods: {
  268. ...mapActions('chart', ['getStatistics', 'getMainStatistics', 'getMachineNum']),
  269. async init() {
  270. if (!this.pname) {
  271. this.pname = this.loginUser.name;
  272. }
  273. _self = this;
  274. //图表中图
  275. this.cWidth = uni.upx2px(690);
  276. this.cHeight = uni.upx2px(370);
  277. await this.getMainStatisticsData();
  278. await this.initDateRang(new Date(), 'day');
  279. await this.initDateRang(new Date(), 'week');
  280. await this.initDateRang(new Date(), 'month');
  281. await this.initDateRang(new Date(), 'year');
  282. //初次登陆跳转后,把test变成2
  283. uni.setStorageSync('test', '2');
  284. },
  285. day() {
  286. var date = new Date();
  287. // var daystr = dateUtils.formateDate(date, 'yyyy年MM月dd日');
  288. var daystr = dateUtils.formateDate(date, 'yyyy-MM-dd');
  289. this.today = daystr;
  290. // var str= '星期'+'日一二三四五六'.charAt(date.getDay());
  291. this.week = this.$t('mainStatistics.week' + date.getDay());
  292. },
  293. equipmentStatus() {
  294. var that = this;
  295. var id = uni.getStorageSync("globalUser").id;
  296. var token = uni.getStorageSync("token");
  297. uni.request({
  298. url: this.serverurl + '/TEquipment/equipmentStatus',
  299. data: {
  300. "adminId": id
  301. },
  302. header: {
  303. 'token': token
  304. },
  305. method: "POST",
  306. success: (res) => {
  307. setTimeout(function() {
  308. that.checkEquipmentStatus(id);
  309. }, 5000);
  310. },
  311. });
  312. },
  313. checkEquipmentStatus(id){
  314. var token = uni.getStorageSync("token");
  315. uni.request({
  316. url: this.serverurl + '/TEquipment/checkEquipmentStatus',
  317. data: {
  318. "adminId": id
  319. },
  320. header: {
  321. 'token': token
  322. },
  323. method: "POST",
  324. success: (res) => {
  325. },
  326. });
  327. },
  328. initDateRang(day, chartType) {
  329. const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
  330. if (chartType === 'day') {
  331. this.startDate1 = dateUtils.formateDate(day, 'yyyy/MM/dd');
  332. }
  333. if (chartType === 'week') {
  334. this.startDate2 = dateUtils.formateDate(dateUtils.getFirstDayOfWeek(day), 'yyyy/MM/dd');
  335. this.endDate2 = dateUtils.formateDate(dateUtils.getLastDayOfWeek(day), 'yyyy/MM/dd');
  336. }
  337. if (chartType === 'month') {
  338. this.startDate3 = dateUtils.formateDate(dateUtils.getCurrentMonFirstDate(day), 'yyyy/MM/dd');
  339. this.endDate3 = dateUtils.formateDate(dateUtils.getCurrentMonLastDate(day), 'yyyy/MM/dd');
  340. }
  341. if (chartType === 'year') {
  342. this.startDate4 = dateUtils.formateDate(dateUtils.getCurrentYearFirstDate(day), 'yyyy/MM/dd');
  343. this.endDate4 = dateUtils.formateDate(dateUtils.getCurrentYearLastDate(day), 'yyyy/MM/dd');
  344. }
  345. return this.getStatisticsData(chartType);
  346. },
  347. /**上一个 */
  348. pre(chartType) {
  349. let day;
  350. if (chartType === 'day') { // 日
  351. day = new Date(this.startDate1);
  352. day.setDate(day.getDate() - 1);
  353. }
  354. if (chartType === 'week') { // 周
  355. day = new Date(this.startDate2);
  356. day.setDate(day.getDate() - 7);
  357. }
  358. if (chartType === 'month') { // 月
  359. day = new Date(this.startDate3);
  360. day.setMonth(day.getMonth() - 1);
  361. }
  362. if (chartType === 'year') { // 年
  363. day = new Date(this.startDate4);
  364. day.setFullYear(day.getFullYear() - 1);
  365. }
  366. this.initDateRang(day, chartType);
  367. },
  368. /**下一个 */
  369. next(chartType) {
  370. let day;
  371. if (chartType === 'day') { // 日
  372. day = new Date(this.startDate1);
  373. day.setDate(day.getDate() + 1);
  374. }
  375. if (chartType === 'week') { // 周
  376. day = new Date(this.startDate2);
  377. day.setDate(day.getDate() + 7);
  378. }
  379. if (chartType === 'month') { // 月
  380. day = new Date(this.startDate3);
  381. day.setMonth(day.getMonth() + 1);
  382. }
  383. if (chartType === 'year') { // 年
  384. day = new Date(this.startDate4);
  385. day.setFullYear(day.getFullYear() + 1);
  386. }
  387. this.initDateRang(day, chartType);
  388. },
  389. getStatisticsData(chartType) {
  390. const param = {
  391. 'chartType': chartType
  392. };
  393. if (chartType == 'day') {
  394. param['startDate'] = this.startDate1;
  395. param['endDate'] = this.startDate1;
  396. }
  397. if (chartType == 'week') {
  398. param['startDate'] = this.startDate2;
  399. param['endDate'] = this.endDate2;
  400. }
  401. if (chartType == 'month') {
  402. param['startDate'] = this.startDate3;
  403. param['endDate'] = this.endDate3;
  404. }
  405. if (chartType == 'year') {
  406. param['startDate'] = this.startDate4;
  407. param['endDate'] = this.endDate4;
  408. }
  409. if (this.adminId) { // 子组件,则拿传过来的参
  410. param['adminId'] = this.adminId;
  411. } else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
  412. param['adminId'] = this.loginUser['id'];
  413. }
  414. var globalUser = uni.getStorageSync("globalUser");
  415. if (globalUser.id != 1) {
  416. if (param.adminId == null || param.adminId == undefined) {
  417. param['adminId'] = globalUser.id;
  418. }
  419. }
  420. if (this.equipmentId) {
  421. param['equipmentId'] = this.equipmentId;
  422. }
  423. return this.getStatistics(param)
  424. .then(data => {
  425. uni.stopPullDownRefresh();
  426. if (param['chartType'] == 'day') {
  427. canvaColumn1 = this.initChart('canvaColumn1', data);
  428. }
  429. if (param['chartType'] == 'week') {
  430. canvaColumn2 = this.initChart('canvaColumn2', data);
  431. }
  432. if (param['chartType'] == 'month') {
  433. canvaColumn3 = this.initChart('canvaColumn3', data);
  434. }
  435. if (param['chartType'] == 'year') {
  436. canvaColumn4 = this.initChart('canvaColumn4', data);
  437. }
  438. }, _ => {
  439. uni.stopPullDownRefresh();
  440. if (param['chartType'] == 'day') {
  441. canvaColumn1 = this.initChart('canvaColumn1', {
  442. categories: ['暂无数据'],
  443. series: [{
  444. name: '销售个数',
  445. data: [0]
  446. }]
  447. });
  448. }
  449. if (param['chartType'] == 'week') {
  450. canvaColumn2 = this.initChart('canvaColumn2', {
  451. categories: ['暂无数据'],
  452. series: [{
  453. name: '销售个数',
  454. data: [0]
  455. }]
  456. });
  457. }
  458. if (param['chartType'] == 'month') {
  459. canvaColumn3 = this.initChart('canvaColumn3', {
  460. categories: ['暂无数据'],
  461. series: [{
  462. name: '销售个数',
  463. data: [0]
  464. }]
  465. });
  466. }
  467. if (param['chartType'] == 'year') {
  468. canvaColumn4 = this.initChart('canvaColumn4', {
  469. categories: ['暂无数据'],
  470. series: [{
  471. name: '销售个数',
  472. data: [0]
  473. }]
  474. });
  475. }
  476. });
  477. },
  478. initChart(canvasId, chartData) {
  479. if (this.$t('lang') != 'zh') {
  480. chartData.categories = chartData.categories.map(e => {
  481. if (e.indexOf('点') >= 0) {
  482. return e.replace('点', this.$t('mainStatistics.oclock'));
  483. }
  484. if (e.indexOf('周') >= 0) {
  485. const weekNum = e.substring(e.length - 1) == '日' ? '0' : e.substring(e.length - 1);
  486. return this.$t('mainStatistics.week' + weekNum);
  487. }
  488. if (e.indexOf('月') >= 0) {
  489. var res = e.toString();
  490. if (res.length > 3) {
  491. return e.replace('月', this.$t('mainStatistics.mon'));
  492. } else {
  493. return e.replace('月', this.$t('mainStatistics.y'));
  494. }
  495. }
  496. return e;
  497. });
  498. chartData.series = chartData.series.map(e => {
  499. if (e['name'] == '销售个数') {
  500. e['name'] = this.$t('mainStatistics.saleNum');
  501. }
  502. if (e['name'] == '销售额') {
  503. e['name'] = this.$t('mainStatistics.saleroom');
  504. }
  505. return e;
  506. });
  507. }
  508. return new uCharts({
  509. $this: _self,
  510. canvasId: canvasId,
  511. enableScroll: true,
  512. type: 'column',
  513. legend: true,
  514. fontSize: 10,
  515. background: '#FFFFFF', //y轴颜色
  516. pixelRatio: 1,
  517. animation: true,
  518. categories: chartData.categories,
  519. series: chartData.series,
  520. xAxis: {
  521. type: 'grid',
  522. gridType: 'dash',
  523. itemCount: 5, //x轴单屏显示数据的数量,默认为5个
  524. scrollShow: true, //新增是否显示滚动条,默认false
  525. scrollAlign: 'left', //滚动条初始位置
  526. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF 滚动条颜色底色
  527. scrollColor: '#DEE7F7', //默认为 #A6A6A6 滚动条颜色
  528. disableGrid: true,
  529. },
  530. yAxis: {
  531. type: 'grid',
  532. gridType: 'soild',
  533. // disabled:true
  534. // disableGrid:true,
  535. },
  536. dataLabel: true,
  537. width: _self.cWidth * _self.pixelRatio,
  538. height: _self.cHeight * _self.pixelRatio,
  539. extra: {
  540. column: {
  541. // width: _self.cWidth*_self.pixelRatio*0.45/chartData.categories.length
  542. width: 18
  543. }
  544. }
  545. });
  546. },
  547. getMainStatisticsData() {
  548. const param = {};
  549. if (this.adminId) { // 子组件,则拿传过来的参
  550. param['adminId'] = this.adminId;
  551. } else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
  552. param['adminId'] = this.loginUser['id'];
  553. }
  554. var globalUser = uni.getStorageSync("globalUser");
  555. if (globalUser.id != 1) {
  556. if (param.adminId == null || param.adminId == undefined) {
  557. param['adminId'] = globalUser.id;
  558. }
  559. }
  560. if (this.equipmentId) {
  561. param['equipmentId'] = this.equipmentId;
  562. }
  563. // console.log('getMainStatisticsData:{}', param);
  564. var adminId = param.adminId;
  565. var equipmentId = this.equipmentId;
  566. var serverurl = this.serverurl;
  567. var token = uni.getStorageSync("token");
  568. uni.request({
  569. url: serverurl + '/TEquipment/getMachineNum',
  570. data: {
  571. "adminId": adminId,
  572. "equipmentId": equipmentId
  573. },
  574. method: "POST",
  575. header: {
  576. 'token': token
  577. },
  578. success: (res) => {
  579. var list = res.data.data;
  580. this.machineTotalNum = list[0];
  581. this.machineUseNum = list[1];
  582. }
  583. });
  584. return this.getMainStatistics(param)
  585. .then(data => {
  586. for (let bean of data) {
  587. if (bean['categorie'] === 'day') {
  588. this.dayTotalMoney = bean['salePrice'];
  589. this.dayTotalNum = bean['saleNum'];
  590. }
  591. if (bean['categorie'] === 'week') {
  592. this.weekTotalMoney = bean['salePrice'];
  593. this.weekTotalNum = bean['saleNum'];
  594. }
  595. if (bean['categorie'] === 'month') {
  596. this.monthTotalMoney = bean['salePrice'];
  597. this.monthTotalNum = bean['saleNum'];
  598. }
  599. if (bean['categorie'] === 'year') {
  600. this.yearTotalMoney = bean['salePrice'];
  601. this.yearTotalNum = bean['saleNum'];
  602. }
  603. }
  604. uni.stopPullDownRefresh();
  605. }, _ => void uni.stopPullDownRefresh());
  606. },
  607. touchLine1(e) {
  608. if (canvaColumn1) {
  609. canvaColumn1.scrollStart(e);
  610. }
  611. },
  612. moveLine1(e) {
  613. if (canvaColumn1) {
  614. canvaColumn1.scroll(e);
  615. }
  616. },
  617. touchEndLine1(e) {
  618. if (canvaColumn1) {
  619. canvaColumn1.scrollEnd(e);
  620. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  621. canvaColumn1.showToolTip(e, {
  622. format: function(item, category) {
  623. return category + ' ' + item.name + ':' + item.data
  624. }
  625. });
  626. }
  627. },
  628. touchLine2(e) {
  629. if (canvaColumn2) {
  630. canvaColumn2.scrollStart(e);
  631. }
  632. },
  633. moveLine2(e) {
  634. if (canvaColumn2) {
  635. canvaColumn2.scroll(e);
  636. }
  637. },
  638. touchEndLine2(e) {
  639. if (canvaColumn2) {
  640. canvaColumn2.scrollEnd(e);
  641. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  642. canvaColumn2.showToolTip(e, {
  643. format: function(item, category) {
  644. return category + ' ' + item.name + ':' + item.data
  645. }
  646. });
  647. }
  648. },
  649. touchLine3(e) {
  650. if (canvaColumn3) {
  651. canvaColumn3.scrollStart(e);
  652. }
  653. },
  654. moveLine3(e) {
  655. if (canvaColumn3) {
  656. canvaColumn3.scroll(e);
  657. }
  658. },
  659. touchEndLine3(e) {
  660. if (canvaColumn3) {
  661. canvaColumn3.scrollEnd(e);
  662. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  663. canvaColumn3.showToolTip(e, {
  664. format: function(item, category) {
  665. return category + ' ' + item.name + ':' + item.data
  666. }
  667. });
  668. }
  669. },
  670. touchLine4(e) {
  671. if (canvaColumn4) {
  672. canvaColumn4.scrollStart(e);
  673. }
  674. },
  675. moveLine4(e) {
  676. if (canvaColumn4) {
  677. canvaColumn4.scroll(e);
  678. }
  679. },
  680. touchEndLine4(e) {
  681. if (canvaColumn4) {
  682. canvaColumn4.scrollEnd(e);
  683. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  684. canvaColumn4.showToolTip(e, {
  685. format: function(item, category) {
  686. return category + ' ' + item.name + ':' + item.data
  687. }
  688. });
  689. }
  690. },
  691. }
  692. }
  693. </script>
  694. <style>
  695. page {
  696. /* background: #F2F2F2; */
  697. background: #FFFFFF;
  698. width: 750upx;
  699. overflow-x: hidden;
  700. }
  701. .head {
  702. display: flex;
  703. flex-direction: row;
  704. background: #206DC3;
  705. width: 750upx;
  706. height: 180upx;
  707. }
  708. .company {
  709. width: 48%;
  710. text-align: right;
  711. }
  712. .pname {
  713. display: flex;
  714. flex-direction: row;
  715. width: 40%;
  716. }
  717. .userFlagimg {
  718. padding-left: 30upx;
  719. padding-top: 10upx;
  720. width: 26upx;
  721. height: 28upx;
  722. }
  723. .wenzi {
  724. padding-left: 5upx;
  725. /* text-align:right; */
  726. white-space: nowrap;
  727. overflow: hidden;
  728. /* text-overflow: ellipsis; */
  729. }
  730. .ri {
  731. width: 690upx;
  732. height: 180upx;
  733. background: #FFFFFF;
  734. border-radius: 15upx;
  735. /* 上移 */
  736. transform: translateY(-90upx);
  737. text-align: center;
  738. margin: auto;
  739. display: flex;
  740. flex-direction: row;
  741. /* 阴影 */
  742. box-shadow: 0upx -1upx 20upx #D3D3D3;
  743. /* box-shadow:0px 0px 10px 5px #aaa; */
  744. }
  745. .riShell {
  746. display: flex;
  747. flex-direction: row;
  748. margin: auto;
  749. }
  750. .riTitle {
  751. display: flex;
  752. flex-direction: column;
  753. margin: auto;
  754. }
  755. .riqi {
  756. display: flex;
  757. flex-direction: column;
  758. margin: auto;
  759. }
  760. .fourTitle {
  761. width: 690upx;
  762. height: 294upx;
  763. display: flex;
  764. flex-direction: row;
  765. flex-wrap: wrap;
  766. background: #FFFFFF;
  767. box-shadow: 0upx 0upx 20upx #D3D3D3;
  768. margin: auto;
  769. border-radius: 15upx;
  770. transform: translateY(-60upx);
  771. }
  772. .four {
  773. display: flex;
  774. flex-direction: row;
  775. margin: auto;
  776. width: 48%;
  777. }
  778. .fourImg {
  779. width: 54upx;
  780. height: 54upx;
  781. }
  782. .qiun-padding {
  783. padding: 2%;
  784. width: 96%;
  785. }
  786. .qiun-wrap {
  787. display: flex;
  788. flex-wrap: wrap;
  789. }
  790. .qiun-rows {
  791. display: flex;
  792. flex-direction: row !important;
  793. }
  794. .qiun-columns {
  795. display: flex;
  796. flex-direction: column !important;
  797. }
  798. .qiun-common-mt {
  799. margin-top: 0upx;
  800. height: 160upx;
  801. }
  802. .qiun-bg-white {
  803. background: #FFFFFF;
  804. }
  805. .qiun-title-bar {
  806. width: 100%;
  807. /* padding: 10upx 2%; */
  808. flex-wrap: nowrap;
  809. border-radius: 15upx;
  810. }
  811. .qiun-title-dot-light {
  812. width: 92%;
  813. border-left: 20upx;
  814. border-left: 10upx solid #206DC3;
  815. padding-left: 10upx;
  816. height: 32upx;
  817. /* padding-bottom: 40upx; */
  818. font-family: "PingFang-SC-Bold";
  819. font-weight: bold;
  820. margin: auto;
  821. font-size: 32upx;
  822. color: #363D44;
  823. transform: translateY(20upx);
  824. }
  825. .dis {
  826. transform: translateY(-13upx);
  827. font-size: 32upx;
  828. font-family: "PingFang-SC-Bold";
  829. color: #363D44;
  830. }
  831. .shijian {
  832. transform: translateY(40upx);
  833. padding-top: 30upx;
  834. height: 80upx;
  835. width: 690upx;
  836. margin: auto;
  837. box-shadow: 0upx 0upx 10upx #D3D3D3;
  838. }
  839. .line {
  840. background: #ECECEC;
  841. height: 20upx;
  842. }
  843. .qiun-charts {
  844. width: 690upx;
  845. height: 370upx;
  846. padding-top: 50upx;
  847. background-color: #FFFFFF;
  848. margin: auto;
  849. }
  850. .charts {
  851. width: 690upx;
  852. height: 370upx;
  853. background-color: #FFFFFF;
  854. margin: auto;
  855. }
  856. .preImg {
  857. position: absolute;
  858. left: 30upx;
  859. width: 71upx;
  860. height: 57upx;
  861. }
  862. .nextImg {
  863. position: absolute;
  864. right: 30upx;
  865. width: 71upx;
  866. height: 57upx;
  867. }
  868. .fontLeft {
  869. margin-right: 6upx;
  870. }
  871. </style>