mainStatistics.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  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. },
  266. methods: {
  267. ...mapActions('chart', ['getStatistics', 'getMainStatistics', 'getMachineNum']),
  268. async init() {
  269. if (!this.pname) {
  270. this.pname = this.loginUser.name;
  271. }
  272. _self = this;
  273. //图表中图
  274. this.cWidth = uni.upx2px(690);
  275. this.cHeight = uni.upx2px(370);
  276. await this.getMainStatisticsData();
  277. await this.initDateRang(new Date(), 'day');
  278. await this.initDateRang(new Date(), 'week');
  279. await this.initDateRang(new Date(), 'month');
  280. await this.initDateRang(new Date(), 'year');
  281. //初次登陆跳转后,把test变成2
  282. uni.setStorageSync('test', '2');
  283. },
  284. day() {
  285. var date = new Date();
  286. // var daystr = dateUtils.formateDate(date, 'yyyy年MM月dd日');
  287. var daystr = dateUtils.formateDate(date, 'yyyy-MM-dd');
  288. this.today = daystr;
  289. // var str= '星期'+'日一二三四五六'.charAt(date.getDay());
  290. this.week = this.$t('mainStatistics.week' + date.getDay());
  291. },
  292. equipmentStatus(){
  293. var id = uni.getStorageSync("globalUser").id;
  294. var token = uni.getStorageSync("token");
  295. uni.request({
  296. url: this.serverurl + '/TEquipment/equipmentStatus',
  297. data: {
  298. "adminId": id
  299. },
  300. header:{
  301. 'token':token
  302. },
  303. method: "POST",
  304. success: (res) => {
  305. },
  306. });
  307. },
  308. initDateRang(day, chartType) {
  309. const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
  310. if (chartType === 'day') {
  311. this.startDate1 = dateUtils.formateDate(day, 'yyyy/MM/dd');
  312. }
  313. if (chartType === 'week') {
  314. this.startDate2 = dateUtils.formateDate(dateUtils.getFirstDayOfWeek(day), 'yyyy/MM/dd');
  315. this.endDate2 = dateUtils.formateDate(dateUtils.getLastDayOfWeek(day), 'yyyy/MM/dd');
  316. }
  317. if (chartType === 'month') {
  318. this.startDate3 = dateUtils.formateDate(dateUtils.getCurrentMonFirstDate(day), 'yyyy/MM/dd');
  319. this.endDate3 = dateUtils.formateDate(dateUtils.getCurrentMonLastDate(day), 'yyyy/MM/dd');
  320. }
  321. if (chartType === 'year') {
  322. this.startDate4 = dateUtils.formateDate(dateUtils.getCurrentYearFirstDate(day), 'yyyy/MM/dd');
  323. this.endDate4 = dateUtils.formateDate(dateUtils.getCurrentYearLastDate(day), 'yyyy/MM/dd');
  324. }
  325. return this.getStatisticsData(chartType);
  326. },
  327. /**上一个 */
  328. pre(chartType) {
  329. let day;
  330. if (chartType === 'day') { // 日
  331. day = new Date(this.startDate1);
  332. day.setDate(day.getDate() - 1);
  333. }
  334. if (chartType === 'week') { // 周
  335. day = new Date(this.startDate2);
  336. day.setDate(day.getDate() - 7);
  337. }
  338. if (chartType === 'month') { // 月
  339. day = new Date(this.startDate3);
  340. day.setMonth(day.getMonth() - 1);
  341. }
  342. if (chartType === 'year') { // 年
  343. day = new Date(this.startDate4);
  344. day.setFullYear(day.getFullYear() - 1);
  345. }
  346. this.initDateRang(day, chartType);
  347. },
  348. /**下一个 */
  349. next(chartType) {
  350. let day;
  351. if (chartType === 'day') { // 日
  352. day = new Date(this.startDate1);
  353. day.setDate(day.getDate() + 1);
  354. }
  355. if (chartType === 'week') { // 周
  356. day = new Date(this.startDate2);
  357. day.setDate(day.getDate() + 7);
  358. }
  359. if (chartType === 'month') { // 月
  360. day = new Date(this.startDate3);
  361. day.setMonth(day.getMonth() + 1);
  362. }
  363. if (chartType === 'year') { // 年
  364. day = new Date(this.startDate4);
  365. day.setFullYear(day.getFullYear() + 1);
  366. }
  367. this.initDateRang(day, chartType);
  368. },
  369. getStatisticsData(chartType) {
  370. const param = {
  371. 'chartType': chartType
  372. };
  373. if (chartType == 'day') {
  374. param['startDate'] = this.startDate1;
  375. param['endDate'] = this.startDate1;
  376. }
  377. if (chartType == 'week') {
  378. param['startDate'] = this.startDate2;
  379. param['endDate'] = this.endDate2;
  380. }
  381. if (chartType == 'month') {
  382. param['startDate'] = this.startDate3;
  383. param['endDate'] = this.endDate3;
  384. }
  385. if (chartType == 'year') {
  386. param['startDate'] = this.startDate4;
  387. param['endDate'] = this.endDate4;
  388. }
  389. if (this.adminId) { // 子组件,则拿传过来的参
  390. param['adminId'] = this.adminId;
  391. } else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
  392. param['adminId'] = this.loginUser['id'];
  393. }
  394. var globalUser = uni.getStorageSync("globalUser");
  395. if (globalUser.id != 1) {
  396. if (param.adminId == null || param.adminId == undefined) {
  397. param['adminId'] = globalUser.id;
  398. }
  399. }
  400. if (this.equipmentId) {
  401. param['equipmentId'] = this.equipmentId;
  402. }
  403. return this.getStatistics(param)
  404. .then(data => {
  405. uni.stopPullDownRefresh();
  406. if (param['chartType'] == 'day') {
  407. canvaColumn1 = this.initChart('canvaColumn1', data);
  408. }
  409. if (param['chartType'] == 'week') {
  410. canvaColumn2 = this.initChart('canvaColumn2', data);
  411. }
  412. if (param['chartType'] == 'month') {
  413. canvaColumn3 = this.initChart('canvaColumn3', data);
  414. }
  415. if (param['chartType'] == 'year') {
  416. canvaColumn4 = this.initChart('canvaColumn4', data);
  417. }
  418. }, _ => {
  419. uni.stopPullDownRefresh();
  420. if (param['chartType'] == 'day') {
  421. canvaColumn1 = this.initChart('canvaColumn1', {
  422. categories: ['暂无数据'],
  423. series: [{
  424. name: '销售个数',
  425. data: [0]
  426. }]
  427. });
  428. }
  429. if (param['chartType'] == 'week') {
  430. canvaColumn2 = this.initChart('canvaColumn2', {
  431. categories: ['暂无数据'],
  432. series: [{
  433. name: '销售个数',
  434. data: [0]
  435. }]
  436. });
  437. }
  438. if (param['chartType'] == 'month') {
  439. canvaColumn3 = this.initChart('canvaColumn3', {
  440. categories: ['暂无数据'],
  441. series: [{
  442. name: '销售个数',
  443. data: [0]
  444. }]
  445. });
  446. }
  447. if (param['chartType'] == 'year') {
  448. canvaColumn4 = this.initChart('canvaColumn4', {
  449. categories: ['暂无数据'],
  450. series: [{
  451. name: '销售个数',
  452. data: [0]
  453. }]
  454. });
  455. }
  456. });
  457. },
  458. initChart(canvasId, chartData) {
  459. if (this.$t('lang') != 'zh') {
  460. chartData.categories = chartData.categories.map(e => {
  461. if (e.indexOf('点') >= 0) {
  462. return e.replace('点', this.$t('mainStatistics.oclock'));
  463. }
  464. if (e.indexOf('周') >= 0) {
  465. const weekNum = e.substring(e.length - 1) == '日' ? '0' : e.substring(e.length - 1);
  466. return this.$t('mainStatistics.week' + weekNum);
  467. }
  468. if (e.indexOf('月') >= 0) {
  469. var res = e.toString();
  470. if (res.length > 3) {
  471. return e.replace('月', this.$t('mainStatistics.mon'));
  472. } else {
  473. return e.replace('月', this.$t('mainStatistics.y'));
  474. }
  475. }
  476. return e;
  477. });
  478. chartData.series = chartData.series.map(e => {
  479. if (e['name'] == '销售个数') {
  480. e['name'] = this.$t('mainStatistics.saleNum');
  481. }
  482. if (e['name'] == '销售额') {
  483. e['name'] = this.$t('mainStatistics.saleroom');
  484. }
  485. return e;
  486. });
  487. }
  488. return new uCharts({
  489. $this: _self,
  490. canvasId: canvasId,
  491. enableScroll: true,
  492. type: 'column',
  493. legend: true,
  494. fontSize: 10,
  495. background: '#FFFFFF', //y轴颜色
  496. pixelRatio: 1,
  497. animation: true,
  498. categories: chartData.categories,
  499. series: chartData.series,
  500. xAxis: {
  501. type: 'grid',
  502. gridType: 'dash',
  503. itemCount: 5, //x轴单屏显示数据的数量,默认为5个
  504. scrollShow: true, //新增是否显示滚动条,默认false
  505. scrollAlign: 'left', //滚动条初始位置
  506. scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF 滚动条颜色底色
  507. scrollColor: '#DEE7F7', //默认为 #A6A6A6 滚动条颜色
  508. disableGrid: true,
  509. },
  510. yAxis: {
  511. type: 'grid',
  512. gridType: 'soild',
  513. // disabled:true
  514. // disableGrid:true,
  515. },
  516. dataLabel: true,
  517. width: _self.cWidth * _self.pixelRatio,
  518. height: _self.cHeight * _self.pixelRatio,
  519. extra: {
  520. column: {
  521. // width: _self.cWidth*_self.pixelRatio*0.45/chartData.categories.length
  522. width: 18
  523. }
  524. }
  525. });
  526. },
  527. getMainStatisticsData() {
  528. const param = {};
  529. if (this.adminId) { // 子组件,则拿传过来的参
  530. param['adminId'] = this.adminId;
  531. } else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
  532. param['adminId'] = this.loginUser['id'];
  533. }
  534. var globalUser = uni.getStorageSync("globalUser");
  535. if (globalUser.id != 1) {
  536. if (param.adminId == null || param.adminId == undefined) {
  537. param['adminId'] = globalUser.id;
  538. }
  539. }
  540. if (this.equipmentId) {
  541. param['equipmentId'] = this.equipmentId;
  542. }
  543. // console.log('getMainStatisticsData:{}', param);
  544. var adminId = param.adminId;
  545. var equipmentId = this.equipmentId;
  546. var serverurl = this.serverurl;
  547. var token = uni.getStorageSync("token");
  548. uni.request({
  549. url: serverurl + '/TEquipment/getMachineNum',
  550. data: {
  551. "adminId": adminId,
  552. "equipmentId": equipmentId
  553. },
  554. method: "POST",
  555. header:{'token':token},
  556. success: (res) => {
  557. var list = res.data.data;
  558. this.machineTotalNum = list[0];
  559. this.machineUseNum = list[1];
  560. }
  561. });
  562. return this.getMainStatistics(param)
  563. .then(data => {
  564. for (let bean of data) {
  565. if (bean['categorie'] === 'day') {
  566. this.dayTotalMoney = bean['salePrice'];
  567. this.dayTotalNum = bean['saleNum'];
  568. }
  569. if (bean['categorie'] === 'week') {
  570. this.weekTotalMoney = bean['salePrice'];
  571. this.weekTotalNum = bean['saleNum'];
  572. }
  573. if (bean['categorie'] === 'month') {
  574. this.monthTotalMoney = bean['salePrice'];
  575. this.monthTotalNum = bean['saleNum'];
  576. }
  577. if (bean['categorie'] === 'year') {
  578. this.yearTotalMoney = bean['salePrice'];
  579. this.yearTotalNum = bean['saleNum'];
  580. }
  581. }
  582. uni.stopPullDownRefresh();
  583. }, _ => void uni.stopPullDownRefresh());
  584. },
  585. touchLine1(e) {
  586. if (canvaColumn1) {
  587. canvaColumn1.scrollStart(e);
  588. }
  589. },
  590. moveLine1(e) {
  591. if (canvaColumn1) {
  592. canvaColumn1.scroll(e);
  593. }
  594. },
  595. touchEndLine1(e) {
  596. if (canvaColumn1) {
  597. canvaColumn1.scrollEnd(e);
  598. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  599. canvaColumn1.showToolTip(e, {
  600. format: function(item, category) {
  601. return category + ' ' + item.name + ':' + item.data
  602. }
  603. });
  604. }
  605. },
  606. touchLine2(e) {
  607. if (canvaColumn2) {
  608. canvaColumn2.scrollStart(e);
  609. }
  610. },
  611. moveLine2(e) {
  612. if (canvaColumn2) {
  613. canvaColumn2.scroll(e);
  614. }
  615. },
  616. touchEndLine2(e) {
  617. if (canvaColumn2) {
  618. canvaColumn2.scrollEnd(e);
  619. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  620. canvaColumn2.showToolTip(e, {
  621. format: function(item, category) {
  622. return category + ' ' + item.name + ':' + item.data
  623. }
  624. });
  625. }
  626. },
  627. touchLine3(e) {
  628. if (canvaColumn3) {
  629. canvaColumn3.scrollStart(e);
  630. }
  631. },
  632. moveLine3(e) {
  633. if (canvaColumn3) {
  634. canvaColumn3.scroll(e);
  635. }
  636. },
  637. touchEndLine3(e) {
  638. if (canvaColumn3) {
  639. canvaColumn3.scrollEnd(e);
  640. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  641. canvaColumn3.showToolTip(e, {
  642. format: function(item, category) {
  643. return category + ' ' + item.name + ':' + item.data
  644. }
  645. });
  646. }
  647. },
  648. touchLine4(e) {
  649. if (canvaColumn4) {
  650. canvaColumn4.scrollStart(e);
  651. }
  652. },
  653. moveLine4(e) {
  654. if (canvaColumn4) {
  655. canvaColumn4.scroll(e);
  656. }
  657. },
  658. touchEndLine4(e) {
  659. if (canvaColumn4) {
  660. canvaColumn4.scrollEnd(e);
  661. //下面是toolTip事件,如果滚动后不需要显示,可不填写
  662. canvaColumn4.showToolTip(e, {
  663. format: function(item, category) {
  664. return category + ' ' + item.name + ':' + item.data
  665. }
  666. });
  667. }
  668. },
  669. }
  670. }
  671. </script>
  672. <style>
  673. page {
  674. /* background: #F2F2F2; */
  675. background: #FFFFFF;
  676. width: 750upx;
  677. overflow-x: hidden;
  678. }
  679. .head {
  680. display: flex;
  681. flex-direction: row;
  682. background: #206DC3;
  683. width: 750upx;
  684. height: 180upx;
  685. }
  686. .company {
  687. width: 48%;
  688. text-align: right;
  689. }
  690. .pname {
  691. display: flex;
  692. flex-direction: row;
  693. width: 40%;
  694. }
  695. .userFlagimg {
  696. padding-left: 30upx;
  697. padding-top: 10upx;
  698. width: 26upx;
  699. height: 28upx;
  700. }
  701. .wenzi {
  702. padding-left: 5upx;
  703. /* text-align:right; */
  704. white-space: nowrap;
  705. overflow: hidden;
  706. /* text-overflow: ellipsis; */
  707. }
  708. .ri {
  709. width: 690upx;
  710. height: 180upx;
  711. background: #FFFFFF;
  712. border-radius: 15upx;
  713. /* 上移 */
  714. transform: translateY(-90upx);
  715. text-align: center;
  716. margin: auto;
  717. display: flex;
  718. flex-direction: row;
  719. /* 阴影 */
  720. box-shadow: 0upx -1upx 20upx #D3D3D3;
  721. /* box-shadow:0px 0px 10px 5px #aaa; */
  722. }
  723. .riShell {
  724. display: flex;
  725. flex-direction: row;
  726. margin: auto;
  727. }
  728. .riTitle {
  729. display: flex;
  730. flex-direction: column;
  731. margin: auto;
  732. }
  733. .riqi {
  734. display: flex;
  735. flex-direction: column;
  736. margin: auto;
  737. }
  738. .fourTitle {
  739. width: 690upx;
  740. height: 294upx;
  741. display: flex;
  742. flex-direction: row;
  743. flex-wrap: wrap;
  744. background: #FFFFFF;
  745. box-shadow: 0upx 0upx 20upx #D3D3D3;
  746. margin: auto;
  747. border-radius: 15upx;
  748. transform: translateY(-60upx);
  749. }
  750. .four {
  751. display: flex;
  752. flex-direction: row;
  753. margin: auto;
  754. width: 48%;
  755. }
  756. .fourImg {
  757. width: 54upx;
  758. height: 54upx;
  759. }
  760. .qiun-padding {
  761. padding: 2%;
  762. width: 96%;
  763. }
  764. .qiun-wrap {
  765. display: flex;
  766. flex-wrap: wrap;
  767. }
  768. .qiun-rows {
  769. display: flex;
  770. flex-direction: row !important;
  771. }
  772. .qiun-columns {
  773. display: flex;
  774. flex-direction: column !important;
  775. }
  776. .qiun-common-mt {
  777. margin-top: 0upx;
  778. height: 160upx;
  779. }
  780. .qiun-bg-white {
  781. background: #FFFFFF;
  782. }
  783. .qiun-title-bar {
  784. width: 100%;
  785. /* padding: 10upx 2%; */
  786. flex-wrap: nowrap;
  787. border-radius: 15upx;
  788. }
  789. .qiun-title-dot-light {
  790. width: 92%;
  791. border-left: 20upx;
  792. border-left: 10upx solid #206DC3;
  793. padding-left: 10upx;
  794. height: 32upx;
  795. /* padding-bottom: 40upx; */
  796. font-family: "PingFang-SC-Bold";
  797. font-weight: bold;
  798. margin: auto;
  799. font-size: 32upx;
  800. color: #363D44;
  801. transform: translateY(20upx);
  802. }
  803. .dis {
  804. transform: translateY(-13upx);
  805. font-size: 32upx;
  806. font-family: "PingFang-SC-Bold";
  807. color: #363D44;
  808. }
  809. .shijian {
  810. transform: translateY(40upx);
  811. padding-top: 30upx;
  812. height: 80upx;
  813. width: 690upx;
  814. margin: auto;
  815. box-shadow: 0upx 0upx 10upx #D3D3D3;
  816. }
  817. .line {
  818. background: #ECECEC;
  819. height: 20upx;
  820. }
  821. .qiun-charts {
  822. width: 690upx;
  823. height: 370upx;
  824. padding-top: 50upx;
  825. background-color: #FFFFFF;
  826. margin: auto;
  827. }
  828. .charts {
  829. width: 690upx;
  830. height: 370upx;
  831. background-color: #FFFFFF;
  832. margin: auto;
  833. }
  834. .preImg {
  835. position: absolute;
  836. left: 30upx;
  837. width: 71upx;
  838. height: 57upx;
  839. }
  840. .nextImg {
  841. position: absolute;
  842. right: 30upx;
  843. width: 71upx;
  844. height: 57upx;
  845. }
  846. .fontLeft {
  847. margin-right: 6upx;
  848. }
  849. </style>