guhongwei 2 年之前
父節點
當前提交
3463787356

+ 2 - 1
app.json

@@ -49,7 +49,8 @@
                 "superAdmin/dict/add",
                 "superAdmin/dict/add",
                 "schAdmin/coach/add",
                 "schAdmin/coach/add",
                 "schAdmin/student/add",
                 "schAdmin/student/add",
-                "schAdmin/course/add"
+                "schAdmin/course/add",
+                "schAdmin/course/coachlist"
             ]
             ]
         },
         },
         {
         {

+ 3 - 2
pages/index/index.js

@@ -17,9 +17,10 @@ Page({
         wx.getStorage({
         wx.getStorage({
             key: 'user',
             key: 'user',
             success: async res => {
             success: async res => {
-                if (res.data) wx.redirectTo({ url: '/pages/school/index' })
+                if (res.data) wx.redirectTo({ url: '/pagesSchool/common/lessoninfo' })
                 // /pages/school/index
                 // /pages/school/index
-                // /pagesSchool/schAdmin/coach/list
+                // /pagesSchool/common/lessoninfo
+                // /pagesSchool/schAdmin/course/coachlist
             },
             },
             fail: async res => {
             fail: async res => {
                 wx.login({
                 wx.login({

+ 12 - 20
pagesSchool/common/coachinfo.js

@@ -26,7 +26,7 @@ Page({
      */
      */
     onLoad: async function (options) {
     onLoad: async function (options) {
         const that = this;
         const that = this;
-        that.setData({ id: options.id || '63561112cb0f85380e8354b9' })
+        that.setData({ id: options.id || '' })
         // 查询其他信息
         // 查询其他信息
         await that.searchOther();
         await that.searchOther();
         // 监听用户是否登录
         // 监听用户是否登录
@@ -48,26 +48,18 @@ Page({
         let genderList = that.data.genderList;
         let genderList = that.data.genderList;
         let levelList = that.data.levelList;
         let levelList = that.data.levelList;
         let id = that.data.id;
         let id = that.data.id;
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
-                if (id) {
-                    let arr = await app.$get(`/coach/${id}`);
-                    if (arr.errcode == '0') {
-                        let gender = genderList.find(i => i.value == arr.data.gender)
-                        if (gender) arr.data.zhGender = gender.label;
-                        let level = levelList.find(i => i.value == arr.data.level)
-                        if (level) arr.data.zhLevel = level.label;
-                        that.setData({ form: arr.data })
-                    } else {
-                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
-                    }
-                }
-            },
-            fail: async res => {
-                wx.redirectTo({ url: '/pages/index/index' })
+        if (id) {
+            let arr = await app.$get(`/coach/${id}`);
+            if (arr.errcode == '0') {
+                let gender = genderList.find(i => i.value == arr.data.gender)
+                if (gender) arr.data.zhGender = gender.label;
+                let level = levelList.find(i => i.value == arr.data.level)
+                if (level) arr.data.zhLevel = level.label;
+                that.setData({ form: arr.data })
+            } else {
+                wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
             }
             }
-        })
+        }
     },
     },
     /**
     /**
      * 生命周期函数--监听页面初次渲染完成
      * 生命周期函数--监听页面初次渲染完成

+ 117 - 28
pagesSchool/common/lessoninfo.js

@@ -1,10 +1,22 @@
 const app = getApp()
 const app = getApp()
+const moment = require("../../utils/moment.min")
 Page({
 Page({
     data: {
     data: {
         frameStyle: { useTop: true, name: '课程详细信息', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '课程详细信息', leftArrow: true, useBar: false },
         id: '',
         id: '',
+        tabs: {
+            active: 'a',
+            menu: [
+                { title: '课程信息', active: 'a' },
+                { title: '教练信息', active: 'b' },
+                { title: '学员信息', active: 'c' },
+            ],
+        },
+        // 课程信息
         form: {},
         form: {},
-        user: {},
+        // 教练信息
+        coachList: [],
+        // 字典表
         //状态
         //状态
         statusList: [],
         statusList: [],
     },
     },
@@ -12,17 +24,119 @@ Page({
     back(e) {
     back(e) {
         wx.navigateBack({ delta: 1 })
         wx.navigateBack({ delta: 1 })
     },
     },
+    tabsChange: function (e) {
+        const that = this;
+        let { active } = e.detail;
+        that.setData({ 'tabs.active': active });
+    },
+    // 报名
+    async toSign(e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        let id = that.data.id;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let user = res.data;
+                if (user && user.type == '3') {
+                    let time = moment().format('YYYY-MM-DD HH:mm:ss');
+                    let obj = { openid: user.openid, money: item.money, school_id: item.school_id, student_id: user.info._id, lesson_id: id };
+                    // 创建报名
+                    await that.createLesson(obj);
+                } else {
+                    wx.showToast({
+                        title: '账号角色不对,不可报名',
+                        icon: 'none'
+                    })
+                }
+
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
+    },
+    // 创建报名信息
+    async createLesson(e) {
+        const that = this;
+        let res = await app.$post(`/lessonStudent`, e);
+        if (res.errcode == '0') {
+            // wxSign有值:余额不够,需手动支付
+            // 无值:余额够,无需支付
+            if (res?.data?.wxSign) {
+                // 调取支付窗口
+                let wxSign = res.data.wxSign;
+                wx.requestPayment({
+                    timeStamp: wxSign.timestamp,
+                    nonceStr: wxSign.nonceStr,
+                    package: `prepay_id=${wxSign.prepay_id}`,
+                    signType: wxSign.signType,
+                    paySign: wxSign.paySign,
+                    async success(payRes) {
+                        wx.showToast({ title: '报名成功', icon: 'none' })
+                        that.watchLogin();
+                    },
+                    async fail(payErr) {
+                        wx.showToast({ title: '支付不成功', icon: 'none' })
+                    }
+                })
+            } else {
+                wx.showToast({ title: '报名成功', icon: 'none' });
+                that.watchLogin()
+            }
+        } else {
+            wx.showToast({
+                title: res.errmsg,
+                icon: 'none'
+            })
+        }
+    },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad: async function (options) {
     onLoad: async function (options) {
         const that = this;
         const that = this;
-        await that.setData({ id: options.id || null })
+        await that.setData({ id: options.id || '63563bbd8018a39220eca774' })
         // 查询其他信息
         // 查询其他信息
         await that.searchOther();
         await that.searchOther();
         // 监听用户是否登录
         // 监听用户是否登录
         await that.watchLogin();
         await that.watchLogin();
     },
     },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        if (that.data.id) {
+            await that.searchInfo();
+            // 查询教练
+            await that.searchCoach();
+        }
+    },
+    async searchInfo() {
+        const that = this;
+        const res = await app.$get(`/lesson/${that.data.id}`);
+        if (res.errcode == '0') {
+            // 课程状态
+            res.data.zhStatus = that.searchStatus(res.data.status);
+            // 课程信息
+            that.setData({ form: res.data })
+        }
+        else { wx.showToast({ title: res.errmsg, icon: 'none' }) }
+    },
+    searchStatus(e) {
+        const that = this;
+        let data = that.data.statusList.find(i => i.value == e);
+        if (data) return data.label
+    },
+    async searchCoach() {
+        const that = this;
+        let id = that.data.id;
+        let res = await app.$get(`/lessonCoach`, { lesson_id: id });
+        if (res.errcode == '0') {
+            that.setData({ coachList: res.data })
+        } else {
+            wx.showToast({ title: res.errmsg, icon: 'none' })
+        }
+    },
     searchOther: async function () {
     searchOther: async function () {
         const that = this;
         const that = this;
         let arr;
         let arr;
@@ -30,31 +144,6 @@ Page({
         arr = await app.$get(`/dict`, { code: 'lesson_status' });
         arr = await app.$get(`/dict`, { code: 'lesson_status' });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
     },
     },
-    // 监听用户是否登录
-    watchLogin: async function () {
-        const that = this;
-        let statusList = that.data.statusList;
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
-                that.setData({ user: res.data })
-                if (that.data.id) {
-                    const arr = await app.$get(`/lesson/${that.data.id}`);
-                    if (arr.errcode == '0') {
-                        // 课程状态
-                        let status = statusList.find(i => i.value == arr.data.status)
-                        if (status) arr.data.zhStatus = status.label;
-                        // 课程信息
-                        that.setData({ form: arr.data })
-                    }
-                    else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
-                }
-            },
-            fail: async res => {
-                wx.redirectTo({ url: '/pages/index/index' })
-            }
-        })
-    },
     /**
     /**
      * 生命周期函数--监听页面初次渲染完成
      * 生命周期函数--监听页面初次渲染完成
      */
      */
@@ -62,7 +151,7 @@ Page({
     /**
     /**
      * 生命周期函数--监听页面显示
      * 生命周期函数--监听页面显示
      */
      */
-    onShow: function () {},
+    onShow: function () { },
 
 
     /**
     /**
      * 页面上拉触底事件的处理函数
      * 页面上拉触底事件的处理函数

+ 2 - 1
pagesSchool/common/lessoninfo.json

@@ -1,6 +1,7 @@
 {
 {
     "component": true,
     "component": true,
     "usingComponents": {
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+      "mobile-main": "/commpents/mobile-frame/index",
+      "s-tab": "/commpents/tabs/index"
     }
     }
   }
   }

+ 77 - 16
pagesSchool/common/lessoninfo.less

@@ -4,25 +4,86 @@
     background-color: var(--mainColor);
     background-color: var(--mainColor);
 
 
     .one {
     .one {
-        padding: 0 2vw;
-
-        .one_1 {
-            display: flex;
-            justify-content: space-between;
-            border: 1px dashed #858585;
-            padding: 2vw;
-            border-radius: 5px;
-            margin: 2vw 0 0 0;
-
-            .money {
-                color: var(--redColor);
+        margin: 0 0 2vw 0;
+    }
+
+    .two {
+        .a {
+            position: relative;
+            width: 100vw;
+            height: 83vh;
+            background-color: #ffffff;
+        }
+
+        .a_1 {
+            padding: 0 2vw;
+
+            .a_1_1 {
+                display: flex;
+                display: flex;
+                justify-content: space-between;
+                border: 1px dashed #858585;
+                padding: 2vw;
+                border-radius: 5px;
+                margin: 2vw 0 0 0;
+
+                .money {
+                    color: var(--redColor);
+                }
+
+                view:last-child {
+                    flex-grow: 1;
+                    width: 10vw;
+                    text-align: right;
+                }
             }
             }
 
 
-            view:last-child {
-                flex-grow: 1;
-                width: 10vw;
-                text-align: right;
+            .btn {
+                margin: 2vw 0 0 0;
+                text-align: center;
             }
             }
         }
         }
+
+        .b_1 {
+            margin: 0 0 2vw 0;
+            padding: 0 2vw;
+        }
+
+        .c_1 {
+            margin: 0 0 2vw 0;
+            padding: 0 2vw;
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
     }
     }
+}
+
+// 固定定位-课程报名
+.btnSign {
+    position: fixed;
+    width: 100vw;
+    right: 2vw;
+    bottom: 10vw;
+    text-align: right;
+
+    button {
+        width: 16vw !important;
+        height: 16vw;
+        line-height: 1.5 !important;
+        padding: 2vw 3vw !important;
+        border-radius: 90px;
+        font-size: 14px !important;
+    }
+
 }
 }

+ 103 - 61
pagesSchool/common/lessoninfo.wxml

@@ -1,70 +1,112 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
     <view slot="info" class="container main">
         <view class="one">
         <view class="one">
-            <view class="one_1">
-                <view>
-                    <text>课程标题:</text>
-                </view>
-                <view>
-                    <text>{{form.title||'暂无'}}</text>
-                </view>
-            </view>
-            <view class="one_1">
-                <view>
-                    <text>人数上限:</text>
-                </view>
-                <view>
-                    <text>{{form.limit||'暂无'}}</text>
-                </view>
-            </view>
-            <view class="one_1">
-                <view>
-                    <text>开始时间:</text>
-                </view>
-                <view>
-                    <text>{{form.time_start||'暂无'}}</text>
-                </view>
-            </view>
-            <view class="one_1">
-                <view>
-                    <text>结束时间:</text>
-                </view>
-                <view>
-                    <text>{{form.time_end||'暂无'}}</text>
-                </view>
-            </view>
-            <view class="one_1">
-                <view>
-                    <text>状态:</text>
-                </view>
-                <view>
-                    <text>{{form.zhStatus||'暂无'}}</text>
-                </view>
-            </view>
-            <view class="one_1">
-                <view>
-                    <text>课程费(元):</text>
-                </view>
-                <view>
-                    <text class="money">{{form.money||'暂无'}}</text>
-                </view>
+            <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
+        </view>
+        <view class="two">
+            <view wx:if="{{tabs.active=='a'}}" class="a">
+                <scroll-view scroll-y="true" class="scroll-view">
+                    <view class="list-scroll-view">
+                        <view class="a_1">
+                            <view class="a_1_1">
+                                <view>
+                                    <text>课程标题:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.title||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>人数上限:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.limit||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>开始时间:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.time_start||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>结束时间:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.time_end||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>状态:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.zhStatus||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>课程费(元):</text>
+                                </view>
+                                <view>
+                                    <text class="money">{{form.money||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>退款期限:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.refund_hour||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <view class="a_1_1">
+                                <view>
+                                    <text>简介:</text>
+                                </view>
+                                <view>
+                                    <text>{{form.brief||'暂无'}}</text>
+                                </view>
+                            </view>
+                            <!-- <view class="btn">
+                                <button type="primary" size="mini" bindtap="toSign" data-item="{{form}}" wx:if="{{form.status=='1'}}">报名课程</button>
+                            </view> -->
+                        </view>
+                    </view>
+                </scroll-view>
             </view>
             </view>
-            <view class="one_1">
-                <view>
-                    <text>退款期限:</text>
-                </view>
-                <view>
-                    <text>{{form.refund_hour||'暂无'}}</text>
-                </view>
+            <view wx:elif="{{tabs.active=='b'}}" class="a b">
+                <scroll-view scroll-y="true" class="scroll-view">
+                    <view class="list-scroll-view">
+                        <view class="b_1">
+                            <view class="list" wx:for="{{coachList}}" wx:key="index">
+                                <view class="list_1">
+                                    <image></image>
+                                </view>
+                                <view class="list_2">
+                                    2
+                                </view>
+                            </view>
+                        </view>
+                    </view>
+                </scroll-view>
             </view>
             </view>
-            <view class="one_1">
-                <view>
-                    <text>简介:</text>
-                </view>
-                <view>
-                    <text>{{form.brief||'暂无'}}</text>
-                </view>
+            <view wx:elif="{{tabs.active=='c'}}" class="a c">
+                <scroll-view scroll-y="true" class="scroll-view">
+                    <view class="list-scroll-view">
+                        <view class="c_1">
+                            3
+                        </view>
+                    </view>
+                </scroll-view>
             </view>
             </view>
         </view>
         </view>
+        <view class="btnSign">
+            <button type="primary" size="mini" bindtap="toSign" data-item="{{form}}" wx:if="{{form.status=='1'}}">报名课程</button>
+        </view>
     </view>
     </view>
 </mobile-main>
 </mobile-main>

+ 50 - 3
pagesSchool/common/lessoninfo.wxss

@@ -3,9 +3,18 @@
   background-color: var(--mainColor);
   background-color: var(--mainColor);
 }
 }
 .main .one {
 .main .one {
+  margin: 0 0 2vw 0;
+}
+.main .two .a {
+  position: relative;
+  width: 100vw;
+  height: 83vh;
+  background-color: #ffffff;
+}
+.main .two .a_1 {
   padding: 0 2vw;
   padding: 0 2vw;
 }
 }
-.main .one .one_1 {
+.main .two .a_1 .a_1_1 {
   display: flex;
   display: flex;
   justify-content: space-between;
   justify-content: space-between;
   border: 1px dashed #858585;
   border: 1px dashed #858585;
@@ -13,11 +22,49 @@
   border-radius: 5px;
   border-radius: 5px;
   margin: 2vw 0 0 0;
   margin: 2vw 0 0 0;
 }
 }
-.main .one .one_1 .money {
+.main .two .a_1 .a_1_1 .money {
   color: var(--redColor);
   color: var(--redColor);
 }
 }
-.main .one .one_1 view:last-child {
+.main .two .a_1 .a_1_1 view:last-child {
   flex-grow: 1;
   flex-grow: 1;
   width: 10vw;
   width: 10vw;
   text-align: right;
   text-align: right;
 }
 }
+.main .two .a_1 .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}
+.main .two .b_1 {
+  margin: 0 0 2vw 0;
+  padding: 0 2vw;
+}
+.main .two .c_1 {
+  margin: 0 0 2vw 0;
+  padding: 0 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}
+.btnSign {
+  position: fixed;
+  width: 100vw;
+  right: 2vw;
+  bottom: 10vw;
+  text-align: right;
+}
+.btnSign button {
+  width: 16vw !important;
+  height: 16vw;
+  line-height: 1.5 !important;
+  padding: 2vw 3vw !important;
+  border-radius: 90px;
+  font-size: 14px !important;
+}

+ 204 - 0
pagesSchool/schAdmin/course/coachlist.js

@@ -0,0 +1,204 @@
+const app = getApp();
+import WxValidate from '../../../utils/wxValidate'
+Page({
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '课程教练信息', leftArrow: true, useBar: false },
+        user: {},
+        id: '',
+        // 查询
+        search: {},
+        list: [],
+        total: 0,
+        skip: 0,
+        limit: 6,
+        page: 0,
+        // dialog弹框
+        dialog: { title: '添加教练', show: false, type: '1' },
+        form: {},
+        // 教练列表
+        coachList: [],
+    },
+    initValidate() {
+        const rules = { coach_id: { required: true }, money: { required: true }, }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { coach_id: { required: '请选择教练', }, money: { required: '请输入金额', } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 查询
+    toInput(e) {
+        const that = this;
+        let value = e.detail.value;
+        if (value) that.setData({ 'search.coach_id_name': value })
+        else that.setData({ search: {} })
+        that.clearPage(); that.watchLogin();
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [], skip: 0, limit: 6, page: 0 })
+    },
+    // 添加
+    toAdd() {
+        const that = this;
+        that.clearPage();
+        that.setData({ dialog: { title: '添加教练', show: true, type: '1' } })
+    },
+    // 选择教练
+    coachChange(e) {
+        const that = this;
+        let data = that.data.coachList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.coach_id': data.coach_id });
+            that.setData({ 'form.zhcoach': data.coach_id_name });
+        }
+    },
+    // 提交保存
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const form = that.data.form;
+        params.school_id = that.data.user.info.id;
+        params.lesson_id = that.data.id;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let res;
+            if (form._id) res = await app.$post(`/lessonCoach/${form._id}`, params);
+            else res = await app.$post(`/lessonCoach`, params);
+            if (res.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.toClose(); }
+            else wx.showToast({ title: res.errmsg, icon: 'none' })
+        }
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '添加教练', show: false, type: '1' } })
+        that.search()
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '63563bbd8018a39220eca774' })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: async function () {
+        const that = this;
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data });
+                // 查询教练信息
+                await that.searchCoach();
+                // 查询列表
+                await that.search()
+
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 查询教练信息
+    async searchCoach() {
+        const that = this;
+        let user = that.data.user;
+        let res = await app.$get(`/rcs`, { school_id: user.info.id });
+        if (res.errcode == '0') {
+            that.setData({ coachList: res.data })
+        } else { wx.showToast({ title: res.errmsg, icon: 'none' }) }
+    },
+    // 查询列比饿哦
+    async search() {
+        const that = this;
+        let user = that.data.user;
+        let id = that.data.id;
+        let info = { skip: that.data.skip, limit: that.data.limit, lesson_id: id, shchool_id: user.info.id };
+        const arr = await app.$get(`/lessonCoach`, { ...info });
+        if (arr.errcode == '0') {
+            let list = [...that.data.list, ...arr.data];
+            that.setData({ list });
+            that.setData({ total: arr.total });
+        }
+        else { wx.showToast({ title: arr.errmsg, icon: 'none' }) }
+    },
+
+    // 分页
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.search();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
+    },
+
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pagesSchool/schAdmin/course/coachlist.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/index",
+        "dialog": "/commpents/dialog/index"
+    }
+}

+ 87 - 0
pagesSchool/schAdmin/course/coachlist.less

@@ -0,0 +1,87 @@
+@import (css) "/app.wxss";
+
+.main {
+    height: 91vh;
+
+    .one {
+        display: flex;
+        padding: 2vw;
+        border-bottom: 1px solid #858585;
+        margin: 0 0 2vw 0;
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 2vw;
+                font-size: 12px;
+                border-radius: 5px;
+                background-color: #fff;
+            }
+        }
+
+        .one_2 {
+            button {
+                line-height: 2.6;
+                font-size: 14px;
+            }
+        }
+    }
+
+    .two {
+        position: relative;
+        flex-grow: 1;
+
+
+        .list:last-child {
+            margin: 0 2vw 0 2vw;
+        }
+    }
+}
+
+.dialog {
+    .dialog_1 {
+        .content {
+            display: flex;
+            flex-direction: row;
+            border-bottom: 1px dashed var(--f1Color);
+            padding: 2vw 0;
+            margin: 0 2vw 2vw 2vw;
+
+            .value {
+                flex-grow: 1;
+                color: var(--blackColor);
+
+                textarea {
+                    width: 100%;
+                    height: 120px;
+                }
+
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 60 - 0
pagesSchool/schAdmin/course/coachlist.wxml

@@ -0,0 +1,60 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">
+                <input type="text" value="{{search.coach_id_name}}" bindconfirm="toInput" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <button type="primary" size="mini" bindtap="toAdd">添加</button>
+            </view>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="index">
+                        <view class="name">
+                            {{item.coach_id_name}}
+                        </view>
+                        <view class="money">
+                            <text>课时费:</text>
+                            <text>{{item.money}}</text>
+                        </view>
+                        <view class="other_1">
+                            <text>课程:</text>
+                            <text>{{item.lesson_id_title}}</text>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toEdit" data-item="{{item}}">维护信息</button>
+                            <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">删除信息</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>
+<dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info" class="dialog">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">教练:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="coachChange" name="coach_id" value="{{form.coach_id}}" range="{{coachList}}" range-key="coach_id_name">
+                            <view class="picker">{{form.zhcoach||'请选择教练'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">课时费:</view>
+                    <view class="value">
+                        <input name="money" type="number" value="{{form.money}}" placeholder="请输入金额" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</dialog>

+ 65 - 0
pagesSchool/schAdmin/course/coachlist.wxss

@@ -0,0 +1,65 @@
+@import "/app.wxss";
+.main {
+  height: 91vh;
+}
+.main .one {
+  display: flex;
+  padding: 2vw;
+  border-bottom: 1px solid #858585;
+  margin: 0 0 2vw 0;
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 2vw;
+  font-size: 12px;
+  border-radius: 5px;
+  background-color: #fff;
+}
+.main .one .one_2 button {
+  line-height: 2.6;
+  font-size: 14px;
+}
+.main .two {
+  position: relative;
+  flex-grow: 1;
+}
+.main .two .list:last-child {
+  margin: 0 2vw 0 2vw;
+}
+.dialog .dialog_1 .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog .dialog_1 .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.dialog .dialog_1 .content .value textarea {
+  width: 100%;
+  height: 120px;
+}
+.dialog .dialog_1 .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.dialog .dialog_1 .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 7 - 0
pagesSchool/schAdmin/course/list.js

@@ -68,6 +68,13 @@ Page({
             }
             }
         })
         })
     },
     },
+    // 课程教练管理
+    toCoach(e) {
+        const that = this;
+        let { item } = e.currentTarget.dataset;
+        that.clearPage();
+        wx.navigateTo({ url: `/pagesSchool/schAdmin/course/coachlist?id=${item.id}` })
+    },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */

+ 1 - 0
pagesSchool/schAdmin/course/list.wxml

@@ -29,6 +29,7 @@
                         </view>
                         </view>
                         <view class="btn">
                         <view class="btn">
                             <button type="primary" size="mini" bindtap="toEdit" data-item="{{item}}">信息维护</button>
                             <button type="primary" size="mini" bindtap="toEdit" data-item="{{item}}">信息维护</button>
+                            <button type="primary" size="mini" bindtap="toCoach" data-item="{{item}}">教练管理</button>
                             <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">删除信息</button>
                             <button type="warn" size="mini" bindtap="toDel" data-item="{{item}}">删除信息</button>
                         </view>
                         </view>
                     </view>
                     </view>