Przeglądaj źródła

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

guhongwei 2 lat temu
rodzic
commit
fcedd85428

+ 65 - 61
pagesSchool/schAdmin/coachprofit/list.js

@@ -1,74 +1,78 @@
 const app = getApp()
 const app = getApp()
 
 
 Page({
 Page({
-  data: {
-    frameStyle: { useTop: true, name: '教练收益管理', leftArrow: true, useBar: false },
+    data: {
+        frameStyle: { useTop: true, name: '教练收益管理', leftArrow: true, useBar: false },
 
 
-  },
-  // 返回
-  back(e) {
-    wx.navigateBack({ delta: 1 })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) { },
-  // 监听用户是否登录
-  watchLogin: async function () {
-    const that = this;
-    wx.getStorage({
-      key: 'user',
-      success: async res => {
-
-      },
-      fail: async res => {
-        // wx.redirectTo({ url: '/pages/index/index' })
-      }
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () { },
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-    const that = this;
+    },
+    // 返回
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) { },
     // 监听用户是否登录
     // 监听用户是否登录
-    that.watchLogin();
-  },
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-    const that = this;
-    that.setData({ skip: 0, page: 0, list: [] })
-  },
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                const arr = await app.$get(`/coachInBill`, { school_id: res.data.info.id });
+                if (arr.errcode == '0') {
+                    // that.setData({ coachList: arr.data })
+                    console.log(arr.data);
+                }
+            },
+            fail: async res => {
+                // wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
+    },
 
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
 
 
-  },
+    },
 
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
 
 
-  },
+    },
 
 
 
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function (res) {
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function (res) {
 
 
-  },
+    },
 })
 })

+ 60 - 21
pagesSchool/schAdmin/stat/coach.js

@@ -18,7 +18,6 @@ Page({
         coachList: [],
         coachList: [],
         value: [],
         value: [],
         date: [],
         date: [],
-        money: [],
     },
     },
     // 返回
     // 返回
     back(e) {
     back(e) {
@@ -29,28 +28,26 @@ Page({
         const that = this;
         const that = this;
         let data = e.detail;
         let data = e.detail;
         that.setData({ 'tabs.active': data.active })
         that.setData({ 'tabs.active': data.active })
-        console.log(data.active);
+        that.watchLogin();
     },
     },
     // 选择教练
     // 选择教练
-    coachChange: function (e) {
+    coachChange: async function (e) {
         const that = this;
         const that = this;
         let data = that.data.coachList[e.detail.value];
         let data = that.data.coachList[e.detail.value];
         if (data) {
         if (data) {
             that.setData({ coach_id: data.coach_id });
             that.setData({ coach_id: data.coach_id });
             that.setData({ zhcoach: data.coach_id_name });
             that.setData({ zhcoach: data.coach_id_name });
         }
         }
-        that.watchLogin();
-
+        await that.watchLogin();
     },
     },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad: async function (options) {
     onLoad: async function (options) {
         const that = this;
         const that = this;
+        that.setData({ ec: { onInit: that.initChart } })
         // 监听用户是否登录
         // 监听用户是否登录
         await that.watchLogin();
         await that.watchLogin();
-        that.setData({ ec: { onInit: that.initChart } })
-
     },
     },
     // 监听用户是否登录
     // 监听用户是否登录
     watchLogin: async function () {
     watchLogin: async function () {
@@ -64,7 +61,7 @@ Page({
                     that.setData({ coachList: abb.data })
                     that.setData({ coachList: abb.data })
                 }
                 }
                 if (that.data.coach_id) {
                 if (that.data.coach_id) {
-                    if (that.data.tabs.activa == 0) {
+                    if (that.data.tabs.active == '0') {
                         const arr = await app.$get(`/statistics/schoolSignCoach`, { school_id: res.data.info.id, coach_id: that.data.coach_id });
                         const arr = await app.$get(`/statistics/schoolSignCoach`, { school_id: res.data.info.id, coach_id: that.data.coach_id });
                         if (arr.errcode == '0') {
                         if (arr.errcode == '0') {
                             var date = []
                             var date = []
@@ -77,17 +74,57 @@ Page({
                             })
                             })
                             that.setData({ date: date })
                             that.setData({ date: date })
                             that.setData({ value: value })
                             that.setData({ value: value })
-                            console.log(date);
-                            console.log(value);
                             const option = {
                             const option = {
-                                series: [{ data: date }],
-                                yAxis: [{ data: value }]
+                                xAxis: [{ data: date, }],
+                                yAxis: [{
+                                    axisLabel: {
+                                        formatter: '{value}%',
+                                    },
+                                }],
+                                series: [{
+                                    data: value,
+                                    itemStyle: {
+                                        normal: {
+                                            label: { show: true, formatter: '{c}%', }
+                                        }
+                                    },
+                                }],
+                                tooltip: [{ formatter: '{b}月:出勤率{c}%' }]
+                            }
+                            if (chart) chart.setOption(option)
+                        }
+                    } else {
+                        const arr = await app.$get(`/statistics/schoolCoachIn`, { school_id: res.data.info.id, coach_id: that.data.coach_id });
+                        if (arr.errcode == '0') {
+                            var date = []
+                            var value = []
+                            arr.data.map(function (item) {
+                                var m = ''; m = item.m; date.push(m)
+                                var sevm = ''; sevm = item.total; value.push(sevm)
+                            })
+                            that.setData({ date: date })
+                            that.setData({ value: value })
+                            const option = {
+                                xAxis: [{ data: date, }],
+                                yAxis: [{
+                                    axisLabel: {
+                                        formatter: '{value}元',
+                                    },
+                                }],
+                                series: [{
+                                    data: value,
+                                    itemStyle: {
+                                        normal: {
+                                            label: { show: true, formatter: '{c}元', }
+                                        }
+                                    },
+                                }],
+                                tooltip: [{ formatter: '{b}月:收入{c}元' }]
                             }
                             }
                             if (chart) chart.setOption(option)
                             if (chart) chart.setOption(option)
                         }
                         }
                     }
                     }
                 }
                 }
-
             },
             },
             fail: async res => {
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -96,10 +133,10 @@ Page({
     },
     },
     // 折线图
     // 折线图
     initChart(canvas, width, height, dpr) {
     initChart(canvas, width, height, dpr) {
-        let that = this;
+        const that = this;
         var date = that.data.date;
         var date = that.data.date;
         var value = that.data.value;
         var value = that.data.value;
-        const chart = echarts.init(canvas, null, {
+        chart = echarts.init(canvas, null, {
             width: width,
             width: width,
             height: height,
             height: height,
             devicePixelRatio: dpr
             devicePixelRatio: dpr
@@ -116,7 +153,7 @@ Page({
             tooltip: {
             tooltip: {
                 show: true,
                 show: true,
                 trigger: 'axis',
                 trigger: 'axis',
-                formatter: '{b}:{c}%' // 格式化数值百分比输出
+                formatter: '{b}:{c}' // 格式化数值百分比输出
             },
             },
             xAxis: {
             xAxis: {
                 type: 'category',
                 type: 'category',
@@ -124,14 +161,17 @@ Page({
                 data: date,
                 data: date,
                 // 设置x轴线的属性
                 // 设置x轴线的属性
                 //使x轴文字显示全
                 //使x轴文字显示全
-                axisLabel: { show: true, interval: 0, },
+                axisLabel: {
+                    formatter: '{value}月',
+                    show: true, interval: 0,
+                },
             },
             },
             yAxis: {
             yAxis: {
                 x: 'center',
                 x: 'center',
                 type: 'value',
                 type: 'value',
                 splitLine: {
                 splitLine: {
                     lineStyle: { type: 'dashed' }
                     lineStyle: { type: 'dashed' }
-                }
+                },
             },
             },
             series: [
             series: [
                 {
                 {
@@ -141,9 +181,8 @@ Page({
                     itemStyle: {
                     itemStyle: {
                         normal: {
                         normal: {
                             color: '#ff7f50',
                             color: '#ff7f50',
-                            lineStyle: {
-                                color: '#5470C6'
-                            }
+                            lineStyle: { color: '#5470C6' },
+                            label: { show: true }
                         }
                         }
                     },
                     },
                 }
                 }

+ 18 - 27
pagesSchool/schAdmin/stat/income.js

@@ -25,10 +25,11 @@ Page({
      */
      */
     onLoad: async function (options) {
     onLoad: async function (options) {
         const that = this;
         const that = this;
+        that.setData({ ec: { onInit: that.initChart } })
+
         // 监听用户是否登录
         // 监听用户是否登录
         await that.watchLogin();
         await that.watchLogin();
-        
-        that.setData({ ec: { onInit: that.initChart } })
+
     },
     },
     // 监听用户是否登录
     // 监听用户是否登录
     watchLogin: async function () {
     watchLogin: async function () {
@@ -70,7 +71,7 @@ Page({
                 confine: true,
                 confine: true,
                 formatter: '{b}:收入{c}元' // 格式化数值百分比输出
                 formatter: '{b}:收入{c}元' // 格式化数值百分比输出
             },
             },
-            legend: { data: [] },
+            // legend: { data: [] },
             grid: {
             grid: {
                 left: 20,
                 left: 20,
                 right: 60,
                 right: 60,
@@ -78,34 +79,24 @@ Page({
                 top: 40,
                 top: 40,
                 containLabel: true
                 containLabel: true
             },
             },
-            xAxis: [
-                {
-                    type: 'value',
-                    name: '金额',
-                    axisLine: { lineStyle: { color: '#999' } },
-                    axisLabel: { color: '#666', formatter: '{value} 元' }
-
-                }
-            ],
-            yAxis:
-            {
+            xAxis: [{
+                type: 'value',
+                axisLine: { lineStyle: { color: '#999' } },
+                axisLabel: { color: '#666', formatter: '{value} 元' }
+            }],
+            yAxis: [{
                 type: 'category',
                 type: 'category',
-                name: '日期',
                 axisTick: { show: false },
                 axisTick: { show: false },
                 data: date,
                 data: date,
                 axisLine: { lineStyle: { color: '#999' } },
                 axisLine: { lineStyle: { color: '#999' } },
-                axisLabel: {
-                    color: '#666',
-                },
-            },
-            series: [
-                {
-                    name: '收入',
-                    type: 'bar',
-                    label: { normal: { show: true, position: 'inside' } },
-                    data: money,
-                },
-            ],
+                axisLabel: { color: '#666', },
+            }],
+            series: [{
+                name: '收入',
+                type: 'bar',
+                label: { normal: { show: true, position: 'inside' } },
+                data: money,
+            },],
 
 
         };
         };
         chart.setOption(option, true);
         chart.setOption(option, true);

+ 10 - 11
pagesSchool/schAdmin/stat/student.js

@@ -16,9 +16,9 @@ Page({
 
 
     onLoad: async function (options) {
     onLoad: async function (options) {
         const that = this;
         const that = this;
+        that.setData({ ec: { onInit: that.initChart } })
         // 监听用户是否登录
         // 监听用户是否登录
         await that.watchLogin();
         await that.watchLogin();
-        that.setData({ ec: { onInit: that.initChart } })
     },
     },
     // 监听用户是否登录
     // 监听用户是否登录
     watchLogin: async function () {
     watchLogin: async function () {
@@ -28,14 +28,12 @@ Page({
             success: async res => {
             success: async res => {
                 const arr = await app.$get(`/statistics/schoolStudentAge`, { school_id: res.data.info.id });
                 const arr = await app.$get(`/statistics/schoolStudentAge`, { school_id: res.data.info.id });
                 if (arr.errcode == '0') {
                 if (arr.errcode == '0') {
-
                     that.setData({ piedata: arr.data })
                     that.setData({ piedata: arr.data })
                     const option = {
                     const option = {
                         series: [{ data: arr.data }],
                         series: [{ data: arr.data }],
                     }
                     }
                     if (chart) chart.setOption(option)
                     if (chart) chart.setOption(option)
                 }
                 }
-
             },
             },
             fail: async res => {
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
                 wx.redirectTo({ url: '/pages/index/index' })
@@ -46,7 +44,7 @@ Page({
     initChart(canvas, width, height, dpr) {
     initChart(canvas, width, height, dpr) {
         let that = this;
         let that = this;
         var piedata = that.data.piedata;
         var piedata = that.data.piedata;
-        const chart = echarts.init(canvas, null, {
+        chart = echarts.init(canvas, null, {
             width: width,
             width: width,
             height: height,
             height: height,
             devicePixelRatio: dpr
             devicePixelRatio: dpr
@@ -54,22 +52,23 @@ Page({
         canvas.setChart(chart);
         canvas.setChart(chart);
         var option = {
         var option = {
             backgroundColor: "#ffffff",
             backgroundColor: "#ffffff",
-            legend: {
-                orient: 'vertical',
-                height: 40,
-                padding: 50
-            },
             series: [{
             series: [{
                 label: {
                 label: {
                     normal: {
                     normal: {
-                        fontSize: 16,
-                    }
+                        show: true,
+                        formatter: '{b}:{c}人' + '\n\r' + '({d}%)'
+                    },
                 },
                 },
                 type: 'pie',
                 type: 'pie',
                 center: ['50%', '50%'],
                 center: ['50%', '50%'],
                 radius: ['20%', '40%'],
                 radius: ['20%', '40%'],
                 data: piedata
                 data: piedata
             }],
             }],
+            legend: {
+                orient: 'vertical',
+                height: 40,
+                padding: 50,
+            },
             tooltip: {
             tooltip: {
                 trigger: 'item',
                 trigger: 'item',
                 formatter: '{b}:{c}人' + '\n\r' + '({d}%)' // 格式化数值百分比输出
                 formatter: '{b}:{c}人' + '\n\r' + '({d}%)' // 格式化数值百分比输出