123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622 |
- <template>
- <view class="body">
-
- <allArea @getChild="childMess"></allArea>
-
- <swiper :interval="3000" :duration="500" :style="{ height:mainHeight+ 'px' }" style="background-color: #FFFFFF;" v-bind:current="swiperTabIdx">
- <swiper-item>
- <view class="swiper-item" style="padding-top: 10%;overflow-x: scroll;">
- <view class="qiun-columns" style=" display: flex;">
- <view class="bt" style="flex: 1;">
- <button type="default" v-for="(item,index) in indexList" :key='index' @click="changeDate(index)">{{item}}</button>
- </view>
- <view class="qiun-charts-rotate" style="flex: 0 0 50%;padding: 0;">
- <canvas canvas-id="canvasColumn" id="canvasColumn" class="charts-rotate"></canvas>
- </view>
- <view class="" style="flex:0 0 20%;">
- <view class="text">
- 日新增订单
- </view>
-
- </view>
- </view>
- </view>
- </swiper-item>
- <swiper-item>
- <view class="swiper-item">
- <view class="swiper-item" style="padding-top: 10%;overflow-x: scroll;">
- <view class="qiun-columns" style=" display: flex;">
- <view class="qiun-charts-rotate" style="flex: 0 0 80%;padding: 0upx;">
- <canvas canvas-id="canvasColumnA" id="canvasColumnA" class="charts-rotate"></canvas>
- </view>
- <view class="" style="flex:1">
- <view class="text">
- 用户数据
- </view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- <swiper-item>
- <view class="swiper-item">
- <view class="swiper-item" style="padding-top: 10%;overflow-x: scroll;">
- <view class="qiun-columns" style=" display: flex;">
- <view class="bt" style="flex:0 0 10%;">
- {{item}}
- </view>
- <view class="qiun-charts-rotate" style="flex: 0 0 70%;padding: 0;">
-
-
- <canvas canvas-id="canvasLineA" id="canvasLineA" class="charts-rotate" :width="cWidth*pixelRatio" :height="cHeight*pixelRatio"
- :style="{'width':cWidth+'px','height':cHeight+'px'}" disable-scroll=true @touchstart="touchIt($event,'canvasLineA')"
- @touchmove="moveLineA"></canvas>
-
-
-
- <canvas canvas-id="canvasLineA" style="width:100%;" class="charts-rotate" id="canvasLineA" disable-scroll=true
- @touchstart="touchIt($event,'canvasLineA')" @touchmove="moveLineA"></canvas>
-
-
-
- </view>
- <view class="" style="flex:0 0 20%;">
- <view class="text">
- 收益详情
- </view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import uCharts from '@/pages/mine/uchart/u-charts.js';
- import allArea from '../../component/allArea/allArea.vue'
- import {
- isJSON
- } from '@/pages/mine/uchart/checker.js';
- var _self;
- var canvaColumn = null;
- var app = getApp()
- var canvasObj = {};
- export default {
- data() {
- return {
- swiperTabIdx:2,
-
-
- cWidth2: '',
- cHeight2: '',
- pixelRatio: 1,
- serverData: '',
- indexList: "",
- dayIndex: "",
- dayTabIndex: 0,
- }
- },
- onLoad() {
- uni.getSystemInfo({
- success: res => {
- console.log(res, "这是屏幕信息")
- this.mainHeight = res.windowHeight;
- }
- })
- console.log(12344)
- _self = this;
- this.cWidth = uni.upx2px(500);
- this.cHeight = uni.upx2px(1100);
-
-
- this.dayDate();
- this.userDate();
- this.getServerData();
- },
- methods: {
-
- childMess: function(e) {
- console.log(e, '这是子组件穿过来的值')
- this.areaID = e.areaID
- this.getServerData();
-
- },
- changeDate: function(e) {
- this.dayTabIndex = e
- console.log(e, "3333")
- this.dayDate();
- },
- getServerData() {
- let date = {
- area_id: 1,
- days: 'thirtyDays'
- }
- app.request('order/profitChart', date, 'GET').then(res => {
- let LineA = {
- categories: [],
- series: []
- };
- console.log(res, '这是所有数据999999999')
- var arr = new Array
- arr = res.data
- var data = new Array
- for (let i = 0, len = res.data.length; i < len; i++) {
- console.log("for循环", arr[i]);
- console.log(arr[i].data, "数组")
- var aa = arr[i].data
- console.log(aa, "这是第" + i)
- LineA.series.push({
- name: arr[i].name,
- data: arr[i].data
- })
- }
- for (let k = 0, leng = aa.length; k < leng; k++) {
-
-
- LineA.categories.push(aa[k].date)
-
-
- }
- console.log(res.data.data, "333")
-
-
-
-
-
- _self.textarea = JSON.stringify(LineA);
- _self.showLineA("canvasLineA", LineA);
- })
- },
-
- dayDate() {
- _self = this;
- this.cWidth = uni.upx2px(500);
- this.cHeight = uni.upx2px(1400);
-
-
- let date = {
- area_id: 1,
- days: 'thirtyDays'
- }
- app.request('order/hourOrderNumber', date, 'GET').then(res => {
- let Column = {
- categories: [],
- series: []
- };
-
- console.log(res, '22222')
-
- _self.indexList = res.data.date
- Column.categories = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
- "17", "18", "19", "20", "21", "22", '23', "24"
- ]
- var arr = []
- var day = res.data.date[_self.dayTabIndex]
- console.log(day, "444444555555555")
- arr.push({
- name: day,
- data: res.data.data[day]
- })
- console.log(arr, "444")
- Column.series = arr
-
- console.log(Column, "6666")
- _self.showColumn("canvasColumn", Column);
- })
- },
-
- userDate() {
- let date = {
- area_id: 1,
- days: 'thirtyDays'
- }
- app.request('user/newUsersChart', date, 'GET').then(res => {
- let Column = {
- categories: [],
- series: [
- ]
- };
- console.log(res.data, "88888888")
- var arr = []
- for (let i = 0, len = res.data.length; i < len; i++) {
- console.log("for循环", res.data[i]);
- Column.categories.push(res.data[i].date)
- arr.push(res.data[i].value)
- Column.series.push({
- name: res.data[i].date,
- data: arr,
- color: '#55ff00'
- })
- }
- console.log(arr, "898988989898")
- console.log(Column, "数组5656565655")
-
- _self.showColumn1("canvasColumnA", Column);
- })
- },
- showColumn(canvasId, chartData) {
- canvaColumn = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'column',
- legend: true,
- fontSize: 11,
- background: '#55ff00',
- pixelRatio: _self.pixelRatio,
- animation: true,
- rotate: true,
- categories: chartData.categories,
- series: chartData.series,
- xAxis: {
- disableGrid: true,
- },
- yAxis: {
-
- },
- dataLabel: true,
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight * _self.pixelRatio,
- extra: {
- column: {
- type: 'group',
- width: _self.cWidth * _self.pixelRatio * 0.45 / chartData.categories.length
- }
- }
- });
- },
- changeGaugeData() {
- let series = [{
- name: "完成率",
- data: Math.random()
- }];
-
- let newTitleColor;
- for (let i = 0; i < _self.serverData.Gauge.categories.length; i++) {
- if (series[0].data <= _self.serverData.Gauge.categories[i].value) {
- newTitleColor = _self.serverData.Gauge.categories[i].color;
- break;
- }
- }
- canvasObj['canvasGauge'].updateData({
- series: series,
- categories: _self.serverData.Gauge.categories,
- title: {
- name: Math.round(series[0].data * 100) + '%',
- color: newTitleColor,
- fontSize: 25 * _self.pixelRatio,
- offsetY: 50 * _self.pixelRatio,
- },
- subtitle: {
- name: '更新数据',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: -50 * _self.pixelRatio,
- }
- });
- },
- touchLineA(e) {
- canvasObj['canvasLineA'].scrollStart(e);
- },
- moveLineA(e) {
- canvasObj['canvasLineA'].scroll(e);
- },
- touchEndLineA(e) {
- console.log(e, "00")
- canvasObj['canvasLineA'].scrollEnd(e);
-
- canvasObj['canvasLineA'].showToolTip(e, {
- format: function(item, category) {
- return category + ' ' + item.name + ':' + item.data
- }
- });
- },
- touchIt(e, id) {
- canvasObj['canvasLineA'].scrollStart(e);
- canvasObj[id].touchLegend(e, {
- animation: false
- });
- canvasObj[id].showToolTip(e, {
- format: function(item, category) {
- if (typeof item.data === 'object') {
- return category + ' ' + item.name + ':' + item.data.value
- } else {
- return category + ' ' + item.name + ':' + item.data
- }
- }
- });
- },
- touchMix(e) {
- canvasObj['canvasMix'].scrollStart(e);
- },
- moveMix(e) {
- canvasObj['canvasMix'].scroll(e);
- },
- showLineA(canvasId, chartData) {
- canvasObj[canvasId] = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'line',
- fontSize: 8,
- rotate: true,
- dataLabel:false,
-
- padding: [15, 15, 0, 15],
- legend: {
- show: true,
- padding: 5,
- lineHeight: 11,
- margin: 5,
- },
-
- dataPointShape: false,
- background: '#FFFFFF',
- pixelRatio: _self.pixelRatio,
- categories: chartData.categories,
- series: chartData.series,
- animation: false,
- enableScroll: true,
- xAxis: {
-
-
-
-
-
- disableGrid: true,
- type: 'grid',
- rotateLabel: true,
-
- itemCount: 30,
-
- scrollAlign: 'left',
-
-
- },
- yAxis: {
-
- gridType: 'dash',
- splitNumber: 8,
- min: 10,
- max: 180,
- format: (val) => {
- return val.toFixed(0)
- }
- },
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight * _self.pixelRatio,
- dataLabel: true,
- dataPointShape: true,
- extra: {
- lineStyle: 'straight'
- },
- });
- },
- showColumn1(canvasId, chartData) {
- canvaColumn = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'line',
- legend: true,
- fontSize: 8,
- background: '#55ff00',
-
-
- rotate: true,
- legend: {
- show: false
- },
-
- categories: chartData.categories,
- series: chartData.series,
- xAxis: {
- rotateLabel: true,
- disableGrid: true,
- itemCount: chartData.length,
- labelCount: 30,
- gridType: 'dash',
- },
- yAxis: {
-
- },
- dataLabel: true,
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight * _self.pixelRatio,
-
-
-
-
-
-
- extra: {
- lineStyle: 'straight'
- }
- });
- },
-
-
-
-
-
-
-
-
-
-
-
- }
- }
- </script>
- <style>
-
- .qiun-charts-rotate {
- width: 500upx;
- height: 1400upx;
- background-color: #FFFFFF;
- padding: 25upx;
- }
- .charts-rotate {
- width: 500upx;
- height: 1400upx;
- background-color: #FFFFFF;
- }
- page {
- background: #F2F2F2;
- width: 750upx;
- overflow-x: hidden;
- }
- .bt {
- width: 20%;
-
- }
- .bt1 {
- height: 50upx;
- width: 180upx;
- line-height: 50upx;
- }
- .bt button {
- font-size: 24upx;
- text-align: center;
- display: inline-block;
- vertical-align: bottom;
- height: 50upx;
- width: 180upx;
- line-height: 50upx;
- margin-top: 80upx;
- margin-bottom: 80upx;
- transform: rotate(90deg);
- -ms-transform: rotate(90deg);
-
- -moz-transform: rotate(90deg);
-
- -webkit-transform: rotate(90deg);
-
- -o-transform: rotate(90deg);
-
- filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
- }
- ..bt button:first-child {
-
- }
- .text {
- font-size: 36upx;
- height: 20upx;
- font-weight: 550;
- line-height: 280upx;
- width: 350upx;
- border-top: solid 2upx #004FB6;
- margin-top: 21%;
-
-
- color: #004FB6 !important;
- text-align: center;
- transform: rotate(90deg);
- -ms-transform: rotate(90deg);
-
- -moz-transform: rotate(90deg);
-
- -webkit-transform: rotate(90deg);
-
- -o-transform: rotate(90deg);
-
- filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
- }
-
- </style>
|