Prechádzať zdrojové kódy

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

YY 2 rokov pred
rodič
commit
857d938766
52 zmenil súbory, kde vykonal 1707 pridanie a 100 odobranie
  1. 5 0
      .vscode/extensions.json
  2. 4 0
      app.json
  3. 1 1
      pages/coaAdmin/archives/info.wxml
  4. 1 1
      pages/coaAdmin/course/list.js
  5. 1 1
      pages/coaAdmin/course/list.wxml
  6. 1 0
      pages/coaAdmin/course/statusadd.js
  7. 3 3
      pages/coaAdmin/course/statusadd.wxml
  8. 141 0
      pages/coaAdmin/money/add.js
  9. 6 0
      pages/coaAdmin/money/add.json
  10. 34 0
      pages/coaAdmin/money/add.less
  11. 17 0
      pages/coaAdmin/money/add.wxml
  12. 27 0
      pages/coaAdmin/money/add.wxss
  13. 64 12
      pages/coaAdmin/money/list.js
  14. 4 1
      pages/coaAdmin/money/list.json
  15. 91 0
      pages/coaAdmin/money/list.less
  16. 30 2
      pages/coaAdmin/money/list.wxml
  17. 75 1
      pages/coaAdmin/money/list.wxss
  18. 177 0
      pages/coaAdmin/student/add.js
  19. 6 0
      pages/coaAdmin/student/add.json
  20. 34 0
      pages/coaAdmin/student/add.less
  21. 51 0
      pages/coaAdmin/student/add.wxml
  22. 27 0
      pages/coaAdmin/student/add.wxss
  23. 79 12
      pages/coaAdmin/student/list.js
  24. 4 1
      pages/coaAdmin/student/list.json
  25. 90 0
      pages/coaAdmin/student/list.less
  26. 29 2
      pages/coaAdmin/student/list.wxml
  27. 74 1
      pages/coaAdmin/student/list.wxss
  28. 66 0
      pages/schAdmin/course/info.js
  29. 3 0
      pages/schAdmin/course/info.json
  30. 0 0
      pages/schAdmin/course/info.less
  31. 2 0
      pages/schAdmin/course/info.wxml
  32. 1 0
      pages/schAdmin/course/info.wxss
  33. 3 3
      pages/stuAdmin/coach/list.js
  34. 0 16
      pages/stuAdmin/coach/list.less
  35. 0 5
      pages/stuAdmin/coach/list.wxml
  36. 0 13
      pages/stuAdmin/coach/list.wxss
  37. 27 1
      pages/stuAdmin/course/list.js
  38. 2 0
      pages/stuAdmin/course/list.wxml
  39. 2 5
      pages/stuAdmin/course/sign.js
  40. 1 1
      pages/stuAdmin/course/sign.wxml
  41. 160 0
      pages/stuAdmin/money/add.js
  42. 6 0
      pages/stuAdmin/money/add.json
  43. 50 0
      pages/stuAdmin/money/add.less
  44. 35 0
      pages/stuAdmin/money/add.wxml
  45. 39 0
      pages/stuAdmin/money/add.wxss
  46. 63 12
      pages/stuAdmin/money/list.js
  47. 4 1
      pages/stuAdmin/money/list.json
  48. 78 0
      pages/stuAdmin/money/list.less
  49. 23 2
      pages/stuAdmin/money/list.wxml
  50. 64 1
      pages/stuAdmin/money/list.wxss
  51. 1 1
      pages/stuAdmin/school/info.wxml
  52. 1 1
      utils/dict.js

+ 5 - 0
.vscode/extensions.json

@@ -0,0 +1,5 @@
+{
+    "recommendations": [
+        "mrcrowl.easy-less"
+    ]
+}

+ 4 - 0
app.json

@@ -31,6 +31,7 @@
         "pages/schAdmin/studentexam/info",
         "pages/schAdmin/course/list",
         "pages/schAdmin/course/add",
+        "pages/schAdmin/course/info",
         "pages/schAdmin/course/coachlist",
         "pages/schAdmin/course/coachadd",
         "pages/schAdmin/coursestu/list",
@@ -43,6 +44,7 @@
         "pages/schAdmin/stustat/list",
         "pages/schAdmin/coachstat/list",
         "pages/coaAdmin/money/list",
+        "pages/coaAdmin/money/add",
         "pages/coaAdmin/archives/info",
         "pages/coaAdmin/cashout/list",
         "pages/coaAdmin/cashout/add",
@@ -54,10 +56,12 @@
         "pages/coaAdmin/course/statuslist",
         "pages/coaAdmin/course/statusadd",
         "pages/coaAdmin/student/list",
+        "pages/coaAdmin/student/add",
         "pages/coaAdmin/lecturestat/list",
         "pages/coaAdmin/incomestat/list",
         "pages/coaAdmin/studentstat/list",
         "pages/stuAdmin/money/list",
+        "pages/stuAdmin/money/add",
         "pages/stuAdmin/archives/list",
         "pages/stuAdmin/school/list",
         "pages/stuAdmin/school/info",

+ 1 - 1
pages/coaAdmin/archives/info.wxml

@@ -2,7 +2,7 @@
     <view slot="info" class="container main">
         <view class="one">
             <form catchsubmit="onSubmit">
-                <view class="content">
+                <view class="content" style="display: none;">
                     <view class="label">数据id:</view>
                     <view class="value">
                         <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />

+ 1 - 1
pages/coaAdmin/course/list.js

@@ -6,7 +6,7 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '详细信息', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '课程列表', leftArrow: true, useBar: false },
         list: [],
         total: 0,
         page: 0,

+ 1 - 1
pages/coaAdmin/course/list.wxml

@@ -20,7 +20,7 @@
                         </view>
                         <view class="btn">
                             <button size="mini" type="primary" bindtap="toCommon" data-item="{{item}}" data-route="coaAdmin/course/info">详细信息</button>
-                            <button size="mini" type="primary" bindtap="toCommon" data-item="{{item}}" data-route="coaAdmin/course/coachlist">教练信息</button>
+                            <button size="mini" type="primary" bindtap="toCommon" data-item="{{item}}" data-route="coaAdmin/course/coachlist" wx:if="{{item.type=='1'}}">教练信息</button>
                             <button size="mini" type="primary" bindtap="toCommon" data-item="{{item}}" data-route="coaAdmin/course/add" wx:if="{{item.type=='1'}}">信息维护</button>
                             <button size="mini" type="primary" bindtap="toCommon" data-item="{{item}}" data-route="coaAdmin/course/statuslist" wx:if="{{item.type=='1'}}">临时添加学员</button>
                         </view>

+ 1 - 0
pages/coaAdmin/course/statusadd.js

@@ -56,6 +56,7 @@ Page({
             return false
         } else {
             console.log(params);
+            //  config: { type: Object, required: false, zh: '设置' }, // 打折方式 discount_type:fixed 固定;subtract 减; discount折 ;number
         }
     },
     /**

+ 3 - 3
pages/coaAdmin/course/statusadd.wxml

@@ -2,19 +2,19 @@
     <view slot="info" class="container main">
         <view class="one">
             <form catchsubmit="onSubmit">
-                <view class="content">
+                <view class="content" style="display: none;">
                     <view class="label">数据id:</view>
                     <view class="value">
                         <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
                     </view>
                 </view>
-                <view class="content">
+                <view class="content" style="display: none;">
                     <view class="label">学校id:</view>
                     <view class="value">
                         <input type="text" name="school_id" value="{{form.school_id}}" placeholder="请输入学校id" />
                     </view>
                 </view>
-                <view class="content">
+                <view class="content" style="display: none;">
                     <view class="label">课程id:</view>
                     <view class="value">
                         <input type="text" name="lesson_id" value="{{form.lesson_id}}" placeholder="请输入课程id" />

+ 141 - 0
pages/coaAdmin/money/add.js

@@ -0,0 +1,141 @@
+const app = getApp()
+import WxValidate from '../../../utils/wxValidate';
+const moment = require("../../../utils/moment.min")
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '账号充值', leftArrow: true, useBar: false },
+        user: {},
+        // 关系信息
+        id: '',
+        rcsInfo: {},
+        form: {}
+    },
+    initValidate() {
+        const rules = { money: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { money: { required: '充值金额' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const rcsInfo = that.data.rcsInfo;
+        const user = that.data.user;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let obj = { school_id: rcsInfo.school_id, openid: user.openid, payer_id: user.info.id, payer_role: 'Coach', pay_for: '充值', money: params.money, time: moment().format('YYYY-MM-DD HH:mm:ss') }
+            const arr = await app.$post(`/payOrder`, obj)
+            if (arr.errcode == '0') {
+                wx.requestPayment({
+                    "timeStamp": arr.data.wxSign.timestamp,
+                    "nonceStr": arr.data.wxSign.nonceStr,
+                    "package": `prepay_id=${arr.data.wxSign.prepay_id}`,
+                    "signType": arr.data.wxSign.signType,
+                    "paySign": arr.data.wxSign.paySign,
+                    "success": async function (res) {
+                        let money = Math.floor((Number(rcsInfo.money || 0) + Number(params.money)) * 100) / 100;
+                        const aee = await app.$post(`/rcs/${rcsInfo._id}`, { money: money });
+                        if (aee.errcode == '0') {
+                            wx.showToast({ title: `支付成功`, icon: 'success', duration: 2000 });
+                            that.back()
+                        } else { wx.showToast({ title: `${aee.errmsg}`, icon: 'error', duration: 2000 }) }
+                    },
+                    "fail": function (res) {
+                        wx.showToast({ title: `支付未成功`, icon: 'error', duration: 2000 })
+                        that.back()
+                    },
+                })
+            }
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options.id || '62ff243908c3ce998df1602a' });
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data })
+                let arr;
+                if (that.data.id) {
+                    // 关系信息
+                    arr = await app.$get(`/rcs/${that.data.id}`);
+                    if (arr.errcode == '0') that.setData({ rcsInfo: arr.data })
+                    else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () { },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/coaAdmin/money/add.json

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

+ 34 - 0
pages/coaAdmin/money/add.less

@@ -0,0 +1,34 @@
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .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 {
+                    position: static;
+                    width: 73vw;
+                }
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 17 - 0
pages/coaAdmin/money/add.wxml

@@ -0,0 +1,17 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">充值金额:</view>
+                    <view class="value">
+                        <input type="number" name="money" value="{{form.money}}" placeholder="请输入充值金额" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交充值</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 27 - 0
pages/coaAdmin/money/add.wxss

@@ -0,0 +1,27 @@
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.main .one .content .value textarea {
+  position: static;
+  width: 73vw;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 64 - 12
pages/coaAdmin/money/list.js

@@ -1,66 +1,118 @@
-// pages/stuAdmin/money/list.js
+const app = getApp()
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '账号余额', leftArrow: true, useBar: false },
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //添加信息,信息维护
+    toCommon: function (e) {
+        const that = this;
+        const { item, route } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] });
+        wx.navigateTo({ url: `/pages/${route}?id=${item && item._id ? item._id : ''}` })
+    },
+    // 分页
+    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.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
 
     },
 
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: async function () {
+        const that = this;
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit, coach_id: res.data.info.id };
+                let arr = await app.$get(`/rcs`, { ...info });
+                if (arr.errcode == '0') {
+                    let list = [...that.data.list, ...arr.data];
+                    console.log(list);
+                    that.setData({ list: list })
+                    that.setData({ total: arr.total })
+                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 4 - 1
pages/coaAdmin/money/list.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/index"
+    }
 }

+ 91 - 0
pages/coaAdmin/money/list.less

@@ -0,0 +1,91 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        display: flex;
+        flex-direction: row;
+        padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 0 2vw 2vw;
+                background-color: var(--f1Color);
+                border-radius: 5px;
+            }
+        }
+
+        .one_2 {
+            width: 20vw;
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 96vw;
+        margin: 2vw;
+        background-color: var(--mainColor);
+
+        .list {
+            display: flex;
+            flex-direction: column;
+            border: 2px dashed var(--f1Color);
+            padding: 2vw;
+            margin: 0 0 2vw 0;
+            border-radius: 10px;
+
+            .name {
+                font-size: var(--font16Szie);
+                font-weight: bold;
+                margin: 0 0 2vw 0;
+                color: var(--redColor);
+            }
+
+            .other {
+                margin: 0 0 2vw 0;
+
+                .other_1 {
+                    font-size: var(--font14Szie);
+                    margin: 0 0 1vw 0;
+
+                    text:first-child {
+                        color: var(--f85Color);
+                    }
+                }
+            }
+
+            .btn {
+                margin: 2vw 0 0 0;
+                text-align: center;
+
+                button {
+                    margin: 0 2vw;
+                }
+            }
+        }
+
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 30 - 2
pages/coaAdmin/money/list.wxml

@@ -1,2 +1,30 @@
-<!--pages/stuAdmin/money/list.wxml-->
-<text>pages/stuAdmin/money/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <!-- <view class="one_2">
+                <button type="primary" bindtap="toCommon" data-route="coaAdmin/money/add">充值</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="item">
+                        <view class="name">{{item.money||0}}元</view>
+                        <view class="other">
+                            <!-- <view class="other_1"><text>教练姓名:</text><text>{{item.coach_id_name}}</text></view>
+                            <view class="other_1"><text>教练联系方式:</text><text>{{item.coach_id_phone}}</text></view> -->
+                            <view class="other_1"><text>学校名称:</text><text>{{item.school_id_name}}</text></view>
+                            <view class="other_1"><text>学校联系方式:</text><text>{{item.school_id_phone}}</text></view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toCommon" data-route="coaAdmin/money/add" data-item="{{item}}">充值</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 75 - 1
pages/coaAdmin/money/list.wxss

@@ -1 +1,75 @@
-/* pages/stuAdmin/money/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  display: flex;
+  flex-direction: row;
+  padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 0 2vw 2vw;
+  background-color: var(--f1Color);
+  border-radius: 5px;
+}
+.main .one .one_2 {
+  width: 20vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 96vw;
+  margin: 2vw;
+  background-color: var(--mainColor);
+}
+.main .two .list {
+  display: flex;
+  flex-direction: column;
+  border: 2px dashed var(--f1Color);
+  padding: 2vw;
+  margin: 0 0 2vw 0;
+  border-radius: 10px;
+}
+.main .two .list .name {
+  font-size: var(--font16Szie);
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+  color: var(--redColor);
+}
+.main .two .list .other {
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--font14Szie);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text:first-child {
+  color: var(--f85Color);
+}
+.main .two .list .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 0 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 177 - 0
pages/coaAdmin/student/add.js

@@ -0,0 +1,177 @@
+const app = getApp()
+import WxValidate from '../../../utils/wxValidate';
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        frameStyle: { useTop: true, name: '学员信息维护', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        user: {},
+        // 教练学校
+        coachSchool: {},
+        // 学校学员
+        studentList: [],
+        // 折扣设置
+        discount_typeList: []
+    },
+    initValidate() {
+        const rules = { student_id: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { student_id: { required: '请选择学员' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 选择学生
+    stuChange: function (e) {
+        const that = this;
+        let data = that.data.studentList[e.detail.value];
+        if (data) {
+            console.log(data);
+            that.setData({ 'form.student_id': data.student_id })
+            that.setData({ 'form.student_id_name': data.student_id_name })
+        }
+    },
+    // 选择折扣类型
+    typeChange: function (e) {
+        const that = this;
+        let data = that.data.discount_typeList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.config.discount_type': data.value });
+            that.setData({ 'form.config.number': null })
+        }
+    },
+    // 折扣判断
+    moneyInput: function (e) {
+        const that = this;
+        const form = that.data.form;
+        if (form.config && form.config.discount_type && form.config.discount_type == 'discount') {
+            var regex = /^(10|\d)(\.\d{1,1})?$/;
+            if (!regex.test(e.detail.value)) {
+                wx.showToast({ title: `数据不允许`, icon: 'error', duration: 1000 });
+                that.setData({ 'form.config.number': null })
+            }
+        }
+    },
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            params.config = { discount_type: params['config.discount_type'], number: params['config.number'] }
+            let arr;
+            if (that.data.id) arr = await app.$post(`/rsc/${that.data.id}`, params);
+            else arr = await app.$post(`/rsc`, params);
+            if (arr.errcode == '0') {
+                wx.showToast({ title: `信息维护成功`, icon: 'success', duration: 2000 });
+                that.back()
+            } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' });
+        //验证规则函数
+        that.initValidate();
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 折扣设置
+        arr = await app.$get(`/dict`, { code: 'rsc_type' });
+        if (arr.errcode == '0' && arr.total > 0) { that.setData({ discount_typeList: arr.data[0].list }) }
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data });
+                // 查询教练学校
+                let arr;
+                arr = await app.$get(`/rcs`, { coach_id: res.data.info.id });
+                if (arr.errcode == '0' && arr.total > 0) that.setData({ coachSchool: arr.data[0] });
+                // 查询学校学员
+                arr = await app.$get(`/rss`, { school_id: that.data.coachSchool.school_id });
+                if (arr.errcode == '0') that.setData({ studentList: arr.data });
+                let form = { school_id: that.data.coachSchool.school_id, coach_id: that.data.user.info.id }
+                if (that.data.id) {
+                    arr = await app.$get(`/rsc/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        let student = that.data.studentList.find(i => i.student_id == arr.data.student_id);
+                        if (student) arr.data.student_id_name = student.student_id_name;
+                        form = arr.data;
+                    }
+                }
+                that.setData({ form })
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () { },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/coaAdmin/student/add.json

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

+ 34 - 0
pages/coaAdmin/student/add.less

@@ -0,0 +1,34 @@
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .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 {
+                    position: static;
+                    width: 73vw;
+                }
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+            }
+        }
+    }
+}

+ 51 - 0
pages/coaAdmin/student/add.wxml

@@ -0,0 +1,51 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id:</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">学校id:</view>
+                    <view class="value">
+                        <input type="text" name="school_id" value="{{form.school_id}}" placeholder="请输入学校id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">教练id:</view>
+                    <view class="value">
+                        <input type="text" name="coach_id" value="{{form.coach_id}}" placeholder="请输入教练id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">学生:</view>
+                    <view class="value">
+                        <picker mode="selector" name="student_id" value="{{form.student_id}}" bindchange="stuChange" range="{{studentList}}" range-key="student_id_name">
+                            <view class="picker">{{form.student_id_name||'请选择学生'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">折扣方式:</view>
+                    <view class="value">
+                        <picker mode="selector" name="config.discount_type" value="{{form.config.discount_type}}" bindchange="typeChange" range="{{discount_typeList}}" range-key="label">
+                            <view class="picker">{{form.config.discount_type||'请选择折扣方式'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">折扣金额:</view>
+                    <view class="value">
+                        <input type="digit" name="config.number" value="{{form.config.number}}" bindblur="moneyInput" placeholder="请输入折扣金额" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 27 - 0
pages/coaAdmin/student/add.wxss

@@ -0,0 +1,27 @@
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.main .one .content .value textarea {
+  position: static;
+  width: 73vw;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+}

+ 79 - 12
pages/coaAdmin/student/list.js

@@ -1,66 +1,133 @@
-// pages/coaAdmin/mystudent/list.js
+const app = getApp()
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '学员信息', leftArrow: true, useBar: false },
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        // 折扣设置
+        discount_typeList: []
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //添加信息,信息维护
+    toCommon: function (e) {
+        const that = this;
+        const { item, route } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] });
+        wx.navigateTo({ url: `/pages/${route}?id=${item && item._id ? item._id : ''}` })
+    },
+    // 分页
+    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.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
 
     },
 
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: async function () {
+        const that = this;
+        // 查询其他信息
+        await that.searchOther();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        // 折扣设置
+        arr = await app.$get(`/dict`, { code: 'rsc_type' });
+        if (arr.errcode == '0' && arr.total > 0) { that.setData({ discount_typeList: arr.data[0].list }) }
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        const discount_typeList = that.data.discount_typeList;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit, coach_id: res.data.info.id };
+                let arr = await app.$get(`/rsc`, { ...info });
+                if (arr.errcode == '0') {
+                    let list = [...that.data.list, ...arr.data];
+                    for (const val of list) {
+                        let discount_type = discount_typeList.find(i => i.value == val.config.discount_type);
+                        if (discount_type) val.config.zhDiscount_type = discount_type.label;
+                    }
+                    that.setData({ list: list })
+                    that.setData({ total: arr.total })
+                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 4 - 1
pages/coaAdmin/student/list.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/index"
+    }
 }

+ 90 - 0
pages/coaAdmin/student/list.less

@@ -0,0 +1,90 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        display: flex;
+        flex-direction: row;
+        padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 0 2vw 2vw;
+                background-color: var(--f1Color);
+                border-radius: 5px;
+            }
+        }
+
+        .one_2 {
+            width: 20vw;
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 96vw;
+        margin: 2vw;
+        background-color: var(--mainColor);
+
+        .list {
+            display: flex;
+            flex-direction: column;
+            border: 2px dashed var(--f1Color);
+            padding: 2vw;
+            margin: 0 0 2vw 0;
+            border-radius: 10px;
+
+            .name {
+                font-size: var(--font16Szie);
+                font-weight: bold;
+                margin: 0 0 2vw 0;
+            }
+
+            .other {
+                margin: 0 0 2vw 0;
+
+                .other_1 {
+                    font-size: var(--font14Szie);
+                    margin: 0 0 1vw 0;
+
+                    text:first-child {
+                        color: var(--f85Color);
+                    }
+                }
+            }
+
+            .btn {
+                margin: 2vw 0 0 0;
+                text-align: center;
+
+                button {
+                    margin: 0 2vw;
+                }
+            }
+        }
+
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 29 - 2
pages/coaAdmin/student/list.wxml

@@ -1,2 +1,29 @@
-<!--pages/coaAdmin/mystudent/list.wxml-->
-<text>pages/coaAdmin/mystudent/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <button type="primary" bindtap="toCommon" data-route="coaAdmin/student/add">添加</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="item">
+                        <view class="name">{{item.student_id_name}}</view>
+                        <view class="other">
+                            <view class="other_1"><text>折扣类型:</text><text>{{item.config.zhDiscount_type}}</text></view>
+                            <view class="other_1"><text>折扣金额:</text><text>{{item.config.number}}</text></view>
+                            <view class="other_1"><text>所在学校:</text><text>{{item.school_id_name}}</text></view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toCommon" data-route="coaAdmin/student/add" data-item="{{item}}">信息维护</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 74 - 1
pages/coaAdmin/student/list.wxss

@@ -1 +1,74 @@
-/* pages/coaAdmin/mystudent/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  display: flex;
+  flex-direction: row;
+  padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 0 2vw 2vw;
+  background-color: var(--f1Color);
+  border-radius: 5px;
+}
+.main .one .one_2 {
+  width: 20vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 96vw;
+  margin: 2vw;
+  background-color: var(--mainColor);
+}
+.main .two .list {
+  display: flex;
+  flex-direction: column;
+  border: 2px dashed var(--f1Color);
+  padding: 2vw;
+  margin: 0 0 2vw 0;
+  border-radius: 10px;
+}
+.main .two .list .name {
+  font-size: var(--font16Szie);
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other {
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--font14Szie);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text:first-child {
+  color: var(--f85Color);
+}
+.main .two .list .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 0 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 66 - 0
pages/schAdmin/course/info.js

@@ -0,0 +1,66 @@
+// pages/schAdmin/course/info.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pages/schAdmin/course/info.json

@@ -0,0 +1,3 @@
+{
+    "usingComponents": {}
+}

+ 0 - 0
pages/schAdmin/course/info.less


+ 2 - 0
pages/schAdmin/course/info.wxml

@@ -0,0 +1,2 @@
+<!--pages/schAdmin/course/info.wxml-->
+<text>pages/schAdmin/course/info.wxml</text>

+ 1 - 0
pages/schAdmin/course/info.wxss

@@ -0,0 +1 @@
+/* pages/schAdmin/course/info.wxss */

+ 3 - 3
pages/stuAdmin/coach/list.js

@@ -9,7 +9,7 @@ Page({
         limit: 5,
         // 性别
         genderList: [],
-        //运动等级
+        //教练等级
         levelList: [],
     },
     // 返回
@@ -63,8 +63,8 @@ Page({
         // 性别
         arr = await app.$get(`/dict`, { code: 'gender' });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
-        // 运动等级
-        arr = await app.$get(`/dict`, { code: 'student_grade' });
+        // 教练等级
+        arr = await app.$get(`/dict`, { code: 'coach_grade' });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ levelList: arr.data[0].list });
     },
     // 监听用户是否登录

+ 0 - 16
pages/stuAdmin/coach/list.less

@@ -55,22 +55,6 @@
                     .txt text:nth-child(1) {
                         color: #666;
                     }
-
-                    .other {
-                        display: flex;
-                        flex-direction: row;
-                        justify-content: space-between;
-                        font-size: var(--font14Size);
-                        border-bottom: 1px dashed var(--f1Color);
-
-                        .other_1 {
-                            padding: 0 0 1vw 0;
-                        }
-
-                        .other_1 text:nth-child(1) {
-                            color: #666;
-                        }
-                    }
                 }
             }
 

+ 0 - 5
pages/stuAdmin/coach/list.wxml

@@ -12,12 +12,7 @@
                             <view class="content">
                                 <view class="name textOver">{{item.coach_id_name||'暂无'}}</view>
                                 <view class="txt textOver"><text>联系电话:</text><text>{{item.coach_id_phone||'暂无'}}</text></view>
-                                <view class="other textOver">
-                                    <view class="other_1 textOver"><text>性别:</text><text>{{item.zhGender||'暂无'}}</text></view>
-                                    <view class="other_1 textOver"><text>年龄:</text><text>{{item.coach_id_age||'暂无'}}岁</text></view>
-                                </view>
                                 <view class="txt textOver"><text>教练等级:</text><text>{{item.zhLevel||'暂无'}}</text></view>
-                                <view class="txt textOver"><text>所获荣誉:</text><text>{{item.coach_id_honor||'暂无'}}</text></view>
                             </view>
                         </view>
                         <view class="btn">

+ 0 - 13
pages/stuAdmin/coach/list.wxss

@@ -50,19 +50,6 @@
 .main .two .list .list_1 .content .txt text:nth-child(1) {
   color: #666;
 }
-.main .two .list .list_1 .content .other {
-  display: flex;
-  flex-direction: row;
-  justify-content: space-between;
-  font-size: var(--font14Size);
-  border-bottom: 1px dashed var(--f1Color);
-}
-.main .two .list .list_1 .content .other .other_1 {
-  padding: 0 0 1vw 0;
-}
-.main .two .list .list_1 .content .other .other_1 text:nth-child(1) {
-  color: #666;
-}
 .main .two .list .btn {
   width: 92vw;
   text-align: center;

+ 27 - 1
pages/stuAdmin/course/list.js

@@ -7,6 +7,7 @@ Page({
         page: 0,
         skip: 0,
         limit: 5,
+        user: {},
         //状态
         statusList: [],
         // 选中
@@ -37,6 +38,30 @@ Page({
         const { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/stuAdmin/course/info?id=${item._id}` })
     },
+    // 签到
+    toSign: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        const user = that.data.user;
+        wx.showModal({
+            title: '提示',
+            content: '您是否确定签到?',
+            async success(res) {
+                if (res.confirm) {
+                    let params = { school_id: item.school_id, lesson_id: item._id, student_id: user.info.id, is_pay: '1' }
+                    let lessonStudent = await app.$get(`/lessonStudent`, params);
+                    if (lessonStudent.errcode == '0' && lessonStudent.total > 0) {
+                        const arr = await app.$post(`/lessonStudent/${lessonStudent.data[0]._id}`, { is_sign: '1' });
+                        if (arr.errcode == '0') {
+                            wx.showToast({ title: `签到成功`, icon: 'success', duration: 2000 });
+                            that.setData({ skip: 0, page: 0, list: [] })
+                            that.watchLogin();
+                        }
+                    }
+                } else if (res.cancel) { }
+            }
+        });
+    },
     // 分页
     toPage: function () {
         const that = this;
@@ -85,9 +110,10 @@ Page({
         wx.getStorage({
             key: 'user',
             success: async res => {
+                that.setData({ user: res.data })
                 let info = { skip: that.data.skip, limit: that.data.limit, type: that.data.tabs.active, student_id: res.data.info._id, is_pay: '1' };
                 let arr = await app.$get(`/studentView/lessonList`, { ...info });
-                if (arr.errcode == '0') { 
+                if (arr.errcode == '0') {
                     for (const val of arr.data) { let status = statusList.find(i => i.value == val.status); if (status) val.zhStatus = status.label; }
                     that.setData({ list: [...that.data.list, ...arr.data] })
                     that.setData({ total: arr.total })

+ 2 - 0
pages/stuAdmin/course/list.wxml

@@ -26,6 +26,7 @@
                             <view class="btn">
                                 <button size="mini" type="primary" bindtap="toView" data-item="{{item}}">详细信息</button>
                                 <button size="mini" type="primary" bindtap="toDrop" data-item="{{item}}">退课</button>
+                                <button wx:if="{{item.type=='3'&&item.is_sign=='0'}}" size="mini" type="primary" bindtap="toSign" data-item="{{item}}">签到</button>
                             </view>
                         </view>
                     </view>
@@ -48,6 +49,7 @@
                             <view class="btn">
                                 <button size="mini" type="primary" bindtap="toView" data-item="{{item}}">详细信息</button>
                                 <button size="mini" type="primary" bindtap="toDrop" data-item="{{item}}">退课</button>
+                                <button wx:if="{{item.type=='3'&&item.is_sign=='0'}}" size="mini" type="primary" bindtap="toSign" data-item="{{item}}">签到</button>
                             </view>
                         </view>
                     </view>

+ 2 - 5
pages/stuAdmin/course/sign.js

@@ -1,4 +1,5 @@
 const app = getApp()
+const moment = require("../../../utils/moment.min")
 Page({
     data: {
         frameStyle: { useTop: true, name: '详细信息', leftArrow: true, useBar: false },
@@ -56,13 +57,9 @@ Page({
         const that = this;
         const form = that.data.form;
         const user = that.data.user;
-        var payer_role = '';
         var money = '';
         if (form.type == '0') money = form.real_money;
         else if (form.type == '1') money = form.money;
-        if (user.type == '0') payer_role = 'User';
-        else if (user.type == '2') payer_role = 'Coach';
-        else if (user.type == '3') payer_role = 'Student';
         wx.showModal({
             title: '提示',
             content: '您是否确定报名?',
@@ -71,7 +68,7 @@ Page({
                     wx.getStorage({
                         key: 'user',
                         success: async (res) => {
-                            let obj = { openid: res.data.openid, money: 0.1, school_id: form.school_id, payer_id: user.info.id, payer_role: payer_role, pay_for: 'lessonStudent' }
+                            let obj = { openid: res.data.openid, money: money, school_id: form.school_id, payer_id: user.info.id, payer_role: 'Student', pay_for: 'lessonStudent', time: moment().format('YYYY-MM-DD HH:mm:ss') }
                             const arr = await app.$post(`/payOrder`, obj)
                             if (arr.errcode == '0') {
                                 wx.requestPayment({

+ 1 - 1
pages/stuAdmin/course/sign.wxml

@@ -48,7 +48,7 @@
                                 <text class="text">是否试课:</text>
                                 <button type="primary" size="mini" bindtap="toClass">试课</button>
                             </view>
-                            <view class="btn" wx:if="{{user.type=='3'&&form.sign=='0'}}">
+                            <view class="btn" wx:if="{{form.type_try=='0'&&user.type=='3'&&form.sign=='0'}}">
                                 <button type="primary" size="mini" formType="submit">报名</button>
                             </view>
                         </form>

+ 160 - 0
pages/stuAdmin/money/add.js

@@ -0,0 +1,160 @@
+const app = getApp()
+import WxValidate from '../../../utils/wxValidate';
+const moment = require("../../../utils/moment.min")
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '充值', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        user: {},
+    },
+    initValidate() {
+        const rules = { paymoney: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { paymoney: { required: '请输入金额' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //提交
+    onSubmit: async function (e) {
+        const that = this;
+        const user = that.data.user;
+        const form = that.data.form;
+        const params = e.detail.value;
+        var money = params.paymoney;
+        if (form.money) money = Math.floor((Number(form.money) + Number(params.paymoney)) * 100) / 100;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            wx.showModal({
+                title: '提示',
+                content: '您确定是否充值?',
+                async success(res) {
+                    if (res.confirm) {
+                        wx.getStorage({
+                            key: 'user',
+                            success: async (res) => {
+                                let obj = { openid: res.data.openid, money: params.paymoney, school_id: params.school_id, payer_role: 'Student', pay_for: '充值', payer_id: user.info.id, time: moment().format('YYYY-MM-DD HH:mm:ss') }
+                                const arr = await app.$post(`/payOrder`, obj)
+                                if (arr.errcode == '0') {
+                                    wx.requestPayment({
+                                        "timeStamp": arr.data.wxSign.timestamp,
+                                        "nonceStr": arr.data.wxSign.nonceStr,
+                                        "package": `prepay_id=${arr.data.wxSign.prepay_id}`,
+                                        "signType": arr.data.wxSign.signType,
+                                        "paySign": arr.data.wxSign.paySign,
+                                        "success": async function (res) {
+                                            const rss = await app.$post(`/rss/${that.data.id}`, { money: money });
+                                            if (rss.errcode == '0') {
+                                                wx.showToast({ title: `充值成功`, icon: 'success', duration: 2000 });
+                                                that.back();
+                                            }
+                                        },
+                                        "fail": async function (res) {
+                                            wx.showToast({ title: `充值未成功`, icon: 'error', duration: 2000 })
+                                            that.watchLogin()
+                                        },
+                                    })
+                                }
+                            },
+                            fail: async (res) => {
+                                wx.redirectTo({ url: '/pages/index/index' });
+                            },
+                        });
+                    } else if (res.cancel) { }
+                }
+            });
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options.id || null })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                that.setData({ user: res.data });
+                let arr;
+                if (that.data.id) {
+                    arr = await app.$get(`/rss/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ form: arr.data });
+                    }
+                };
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    // 查询其他信息
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        arr = await app.$get(`/dict`, { code: 'lesson_status' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pages/stuAdmin/money/add.json

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

+ 50 - 0
pages/stuAdmin/money/add.less

@@ -0,0 +1,50 @@
+.main {
+    .one {
+        .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);
+            }
+        }
+
+        .contentmoney {
+            display: flex;
+            flex-direction: column;
+            background-color: var(--mainColor);
+            width: 96vw;
+            margin: 2vw;
+            border-radius: 10px;
+
+            .label {
+                padding: 10px 5px;
+            }
+
+            .value {
+                display: flex;
+                padding: 20px 5px;
+
+                text {
+                    font-size: var(--font18Szie);
+                }
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 5vw 0 0 0;
+
+            button {
+                width: 40vw;
+                margin: 0 2vw;
+                padding: 1vw 0;
+                background: #1E90FF;
+            }
+        }
+    }
+}

+ 35 - 0
pages/stuAdmin/money/add.wxml

@@ -0,0 +1,35 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id:</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">学校id:</view>
+                    <view class="value">
+                        <input type="text" name="school_id" value="{{form.school_id}}" placeholder="请输入学校id" />
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">学生id:</view>
+                    <view class="value">
+                        <input type="text" name="student_id" value="{{form.student_id}}" placeholder="请输入学生id" />
+                    </view>
+                </view>
+                <view class="contentmoney">
+                    <view class="label">充值金额:</view>
+                    <view class="value">
+                        <text>¥</text><input type="number" name="paymoney" value="{{form.paymoney}}" placeholder="请输入充值金额" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">充值</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 39 - 0
pages/stuAdmin/money/add.wxss

@@ -0,0 +1,39 @@
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.main .one .contentmoney {
+  display: flex;
+  flex-direction: column;
+  background-color: var(--mainColor);
+  width: 96vw;
+  margin: 2vw;
+  border-radius: 10px;
+}
+.main .one .contentmoney .label {
+  padding: 10px 5px;
+}
+.main .one .contentmoney .value {
+  display: flex;
+  padding: 20px 5px;
+}
+.main .one .contentmoney .value text {
+  font-size: var(--font18Szie);
+}
+.main .one .btn {
+  text-align: center;
+  margin: 5vw 0 0 0;
+}
+.main .one .btn button {
+  width: 40vw;
+  margin: 0 2vw;
+  padding: 1vw 0;
+  background: #1E90FF;
+}

+ 63 - 12
pages/stuAdmin/money/list.js

@@ -1,66 +1,117 @@
-// pages/stuAdmin/money/list.js
+const app = getApp()
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '账户余额', leftArrow: true, useBar: false },
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //充值
+    toCommon: function (e) {
+        const that = this;
+        const { item, route } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] });
+        wx.navigateTo({ url: `/pages/${route}?id=${item && item._id ? item._id : ''}` })
+    },
+    // 分页
+    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.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    onLoad: function (options) {
 
     },
 
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: async function () {
+        const that = this;
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit, student_id: res.data.info.id };
+                let arr = await app.$get(`/rss`, { ...info });
+                if (arr.errcode == '0') {
+                    let list = [...that.data.list, ...arr.data];
+                    that.setData({ list: list })
+                    that.setData({ total: arr.total })
+                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 4 - 1
pages/stuAdmin/money/list.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
+    "component": true,
+    "usingComponents": {
+        "mobile-main": "/commpents/mobile-frame/index"
+    }
 }

+ 78 - 0
pages/stuAdmin/money/list.less

@@ -0,0 +1,78 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        width: 96vw;
+        padding: 2vw;
+
+        input {
+            padding: 2vw;
+            background-color: var(--f1Color);
+            border-radius: 5px;
+        }
+    }
+
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 96vw;
+        margin: 2vw;
+        background-color: var(--mainColor);
+
+        .list {
+            display: flex;
+            flex-direction: column;
+            border: 2px dashed var(--f1Color);
+            padding: 2vw;
+            margin: 0 0 2vw 0;
+            border-radius: 10px;
+
+            .name {
+                font-size: var(--font18Szie);
+                font-weight: bold;
+                margin: 0 0 2vw 0;
+                color: red;
+            }
+
+            .other {
+                margin: 0 0 2vw 0;
+
+                .other_1 {
+                    font-size: var(--font14Szie);
+                    margin: 0 0 1vw 0;
+
+                    text:first-child {
+                        color: var(--f85Color);
+                    }
+                }
+            }
+
+            .btn {
+                margin: 2vw 0 0 0;
+                text-align: center;
+
+                button {
+                    margin: 0 2vw;
+                    font-size: var(--font14Size);
+                    background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+                }
+            }
+        }
+
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 23 - 2
pages/stuAdmin/money/list.wxml

@@ -1,2 +1,23 @@
-<!--pages/stuAdmin/money/list.wxml-->
-<text>pages/stuAdmin/money/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <input type="text" placeholder="请输入关键词" />
+        </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="item">
+                        <view class="name">{{item.money||0}}元</view>
+                        <view class="other">
+                            <view class="other_1"><text>学校名称:</text><text>{{item.school_id_name||'暂无'}}</text></view>
+                            <view class="other_1"><text>学校联系电话:</text><text>{{item.school_id_phone||'暂无'}}</text></view>
+                        </view>
+                        <view class="btn">
+                            <button size="mini" type="primary" bindtap="toCommon" data-item="{{item}}" data-route="stuAdmin/money/add">充值</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 64 - 1
pages/stuAdmin/money/list.wxss

@@ -1 +1,64 @@
-/* pages/stuAdmin/money/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 96vw;
+  padding: 2vw;
+}
+.main .one input {
+  padding: 2vw;
+  background-color: var(--f1Color);
+  border-radius: 5px;
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 96vw;
+  margin: 2vw;
+  background-color: var(--mainColor);
+}
+.main .two .list {
+  display: flex;
+  flex-direction: column;
+  border: 2px dashed var(--f1Color);
+  padding: 2vw;
+  margin: 0 0 2vw 0;
+  border-radius: 10px;
+}
+.main .two .list .name {
+  font-size: var(--font18Szie);
+  font-weight: bold;
+  margin: 0 0 2vw 0;
+  color: red;
+}
+.main .two .list .other {
+  margin: 0 0 2vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--font14Szie);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text:first-child {
+  color: var(--f85Color);
+}
+.main .two .list .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}
+.main .two .list .btn button {
+  margin: 0 2vw;
+  font-size: var(--font14Size);
+  background: -webkit-linear-gradient(right, lightblue, #53C9F8);
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 1 - 1
pages/stuAdmin/school/info.wxml

@@ -39,7 +39,7 @@
                 <text class="text1">{{form.brief||'暂无'}}</text>
             </view>
             <view class="one_1">
-                <image bindtap="toView" data-item="{{form.yyzz[0]}}" class="image" src="{{form.yyzz&&form.yyzz.length>0?form.yyzz[0].url:''}}"></image>
+                <image mode="aspectFit" bindtap="toView" data-item="{{form.yyzz[0]}}" class="image" src="{{form.yyzz&&form.yyzz.length>0?form.yyzz[0].url:''}}"></image>
             </view>
         </view>
     </view>

+ 1 - 1
utils/dict.js

@@ -90,7 +90,7 @@ export const school_menu = [
                 btn: [
                     { title: '账号余额', route: 'coaAdmin/money/list', icon: 'icon-xuexiao_xuexiaoxinxi' },
                     { title: '个人档案', route: 'coaAdmin/archives/info', icon: 'icon-xuexiao_xuexiaoxinxi' },
-                    { title: '提现申请', route: 'coaAdmin/cashout/list', icon: 'icon-xuexiao_xuexiaoxinxi' },
+                    // { title: '提现申请', route: 'coaAdmin/cashout/list', icon: 'icon-xuexiao_xuexiaoxinxi' },
                 ]
             },
             {