Просмотр исходного кода

Signed-off-by: Changpeng Duan <838560574@qq.com>

Changpeng Duan 5 лет назад
Родитель
Сommit
4898c09408
3 измененных файлов с 258 добавлено и 92 удалено
  1. 58 21
      pc/src/api/getApiRes.js
  2. 110 52
      pc/src/views/Lesson.vue
  3. 90 19
      pc/src/views/ShopManage.vue

+ 58 - 21
pc/src/api/getApiRes.js

@@ -1,80 +1,117 @@
 import axios from 'axios';
 import global from '../Global.js'
+
 // 基础方法进行封装
 function getApiBasic(url, postdata) {
-    return  axios.post(url, postdata).then(function(data){
+    return axios.post(url, postdata).then(function (data) {
         let json = data.data;
         return json
-    },function(response){
+    }, function (response) {
         console.info(response);
     })
 }
 
 // 调用的api改写成方法
 export function worldDetail(postdata) {
-        let url = headapi + 'worldDetail';
-        return getApiBasic(url,postdata);
+    let url = headapi + 'worldDetail';
+    return getApiBasic(url, postdata);
 }
 
-export function SignIn(postdata) {
-        let url = headapi + '/v1/Auth/SignInSignIn';
-        return getApiBasic(url,postdata);
-}
 export function GenVerifyPic(postdata) {
-        let url = headapi + '/v1/Auth/GenVerifyPic';
-        return getApiBasic(url,postdata);
+    let url = headapi + '/v1/Auth/GenVerifyPic';
+    return getApiBasic(url, postdata);
 }
 
 export function editbasicinfo(postdata) {
     let url = headapi + 'editbasicinfo';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function modPwd(postdata) {
     let url = headapi + 'modPwd';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function logout(postdata) {
     let url = headapi + 'logout';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 调用的api改写成方法
 export function testTable(postdata) {
     let url = headapi + 'testTable';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function testSelect(postdata) {
     let url = headapi + 'testSelect';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
+}
+
+// Auth
+export function PassEdit(postdata) {
+    let url = headapi + '/v1/Auth/PassEdit';
+    return getApiBasic(url, postdata);
+}
+
+export function SignIn(postdata) {
+    let url = headapi + '/v1/Auth/SignIn';
+    return getApiBasic(url, postdata);
+}
+
+export function SignOut(postdata) {
+    let url = headapi + '/v1/Auth/SignOut';
+    return getApiBasic(url, postdata);
+}
+
+export function SignUp(postdata) {
+    let url = headapi + '/v1/Auth/SignUp';
+    return getApiBasic(url, postdata);
+}
+export function WXSignIn(postdata) {
+    let url = headapi + '/v1/Auth/WXSignIn';
+    return getApiBasic(url, postdata);
 }
 
 // class
+// √
 export function ClassAdd(postdata) {
     let url = headapi + '/v1/Class/ClassAdd';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+// √
 export function ClassEdit(postdata) {
     let url = headapi + '/v1/Class/ClassEdit';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+// √
 export function ClassListQuery(postdata) {
     let url = headapi + '/v1/Class/ClassListQuery';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
+// shop
+// √
+export function ShopAdd(postdata) {
+    let url = headapi + '/v1/Shop/ShopAdd\n';
+    return getApiBasic(url, postdata);
+}
 
 // User
+// √
 export function ShopManagerAdd(postdata) {
     let url = headapi + '/v1/User/ShopManagerAdd';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function ShopManagerListQuery(postdata) {
     let url = headapi + '/v1/User/ShopManagerListQuery';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function VipUserListQuery(postdata) {
     let url = headapi + '/v1/User/VipUserListQuery';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 

+ 110 - 52
pc/src/views/Lesson.vue

@@ -67,14 +67,14 @@
                         sortable
                 >
                 </el-table-column>
-<!--                <el-table-column-->
-<!--                        prop="Recovered"-->
-<!--                        label="课程会员人数"-->
-<!--                        sortable-->
-<!--                >-->
-<!--                </el-table-column>-->
+                <!--                <el-table-column-->
+                <!--                        prop="Recovered"-->
+                <!--                        label="课程会员人数"-->
+                <!--                        sortable-->
+                <!--                >-->
+                <!--                </el-table-column>-->
                 <el-table-column
-                        prop="WxVisible"
+                        prop="wxVisible"
                         label="微信可见"
                 >
                     <template slot-scope="scope">
@@ -147,19 +147,19 @@
                 <div class="pull-left">
                     <el-form ref="form" :model="form" label-width="160px">
                         <el-form-item label="课程名称">
-                            <el-input v-model="form.className"></el-input>
+                            <el-input v-model="form.ClassName"></el-input>
                         </el-form-item>
                         <el-form-item label="消耗课时">
-                            <el-input-number v-model="form.consumeHour" :min="0" :max="99999"
+                            <el-input-number v-model="form.ConsumeHour" :min="0" :max="99999"
                                              label="(天)"></el-input-number>
                         </el-form-item>
                         <el-form-item label="建议上课人数">
-                            <el-input-number v-model="form.topLimit" :min="0" :max="99999"
+                            <el-input-number v-model="form.TopLimit" :min="0" :max="99999"
                                              label="(天)"></el-input-number>
                         </el-form-item>
                         <el-form-item label="微信可见">
                             <el-switch
-                                    v-model="form.wxvisible"
+                                    v-model="form.wxVisible"
                                     active-value="1"
                                     inactive-value="0"
                                     active-color="#409EFF"
@@ -185,10 +185,10 @@
                             </el-switch>
                         </el-form-item>
                         <el-form-item label="课程颜色">
-                            <el-color-picker v-model="form.classColor"></el-color-picker>
+                            <el-color-picker v-model="form.ClassColor"></el-color-picker>
                         </el-form-item>
                         <el-form-item label="备注">
-                            <el-input v-model="form.memo"></el-input>
+                            <el-input v-model="form.Memo"></el-input>
                         </el-form-item>
                     </el-form>
                 </div>
@@ -201,7 +201,9 @@
                 </div>
             </div>
             <div class="dialogFooter">
-                <el-button type="primary" size="small" @click="confirmAddLesson">确定</el-button>
+                <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmAddLesson">确定</el-button>
+                <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditLesson">确定
+                </el-button>
                 <el-button size="small" @click="dialogLesson = false">取消</el-button>
             </div>
         </el-dialog>
@@ -282,15 +284,16 @@
                     time1: globalBt(),
                 },
                 form: {
-                    className: "",
-                    consumeHour: 0,
-                    topLimit: 0,
-                    wxvisible: 1,
+                    ClassName: "",
+                    ConsumeHour: 0,
+                    TopLimit: 0,
+                    wxVisible: 1,
                     classType: 1,
-                    classColor: "#ffffff",
+                    ClassColor: "#ffffff",
                     teacherId: "",
+                    classId: "",
                     allUse: "",
-                    memo: "",
+                    Memo: "",
                     dialogdata: [],//穿梭待选
                     dialogValue: [],//穿梭已选
                 },
@@ -314,33 +317,33 @@
                 let that = this;
 
                 // checkNum
-                if (!that.form.className) {
+                if (!that.form.ClassName) {
                     this.$message.error('错了哦,课程名称不能为空');
                     return false
                 }
-                if (that.form.className.length > 20) {
+                if (that.form.ClassName.length > 20) {
                     this.$message.error('错了哦,课程名称字数超过20个字');
                     return false
                 }
-                if (that.form.memo) {
-                    if (that.form.memo.length > 200) {
+                if (that.form.Memo) {
+                    if (that.form.Memo.length > 200) {
                         this.$message.error('错了哦,备注字数超过200个字');
                         return false
                     }
                 }
 
-                let teacherId =  that.form.dialogValue.toString();
+                let teacherId = that.form.dialogValue.toString();
                 let param = {
                     token: localStorage.token,
                     shopId: localStorage.shopId,
-                    className: that.form.className,
-                    consumeHour: that.form.consumeHour,
-                    topLimit: that.form.topLimit,
+                    ClassName: that.form.ClassName,
+                    ConsumeHour: that.form.ConsumeHour,
+                    TopLimit: that.form.TopLimit,
                     classType: that.form.classType,
-                    wxVisible: that.form.wxvisible,
-                    classColor: that.form.classColor,
-                    teacherId:teacherId,
-                    memo: that.form.memo,
+                    wxVisible: that.form.wxVisible,
+                    ClassColor: that.form.ClassColor,
+                    teacherId: teacherId,
+                    Memo: that.form.Memo,
                 };
                 let postdata = qs.stringify(param);
                 ClassAdd(postdata).then(res => {
@@ -360,17 +363,71 @@
                     }
                 })
             },
+            confirmEditLesson() {
+                let that = this;
+
+                // checkNum
+                if (!that.form.ClassName) {
+                    this.$message.error('错了哦,课程名称不能为空');
+                    return false
+                }
+                if (that.form.ClassName.length > 20) {
+                    this.$message.error('错了哦,课程名称字数超过20个字');
+                    return false
+                }
+                if (that.form.Memo) {
+                    if (that.form.Memo.length > 200) {
+                        this.$message.error('错了哦,备注字数超过200个字');
+                        return false
+                    }
+                }
+
+                let teacherId = that.form.dialogValue ? that.form.dialogValue.toString() :'';
+                let param = {
+                    token: localStorage.token,
+                    shopId: localStorage.shopId,
+                    classId: that.form.classId,
+                    className: that.form.ClassName,
+                    consumeHour: that.form.ConsumeHour,
+                    topLimit: that.form.TopLimit,
+                    classType: that.form.classType,
+                    wxVisible: that.form.wxVisible,
+                    classColor: that.form.ClassColor,
+                    teacherId: teacherId,
+                    memo: that.form.Memo,
+                };
+                let postdata = qs.stringify(param);
+                ClassEdit(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        // 关闭弹窗
+                        that.dialogLesson = false;
+                        // 重载列表
+                        that.getTableQuery();
+                        that.$message({
+                            showClose: true,
+                            message: '会员课程调整成功!',
+                            type: 'success'
+                        });
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
             // 新增课程
             addLesson() {
+                this.form.btnType = 0; //新增
                 // clear
-                this.form.className = '';
-                this.form.consumeHour = 0;
-                this.form.topLimit = 0;
-                this.form.wxvisible = 1;
-                this.form.classColor = "#ffffff";
-                this.form.memo = "";
+                this.form.ClassName = '';
+                this.form.ConsumeHour = 0;
+                this.form.TopLimit = 0;
+                this.form.wxVisible = 1;
+                this.form.ClassColor = "#ffffff";
+                this.form.Memo = "";
                 this.form.dialogValue = [];
                 this.dialogLesson = true;
+
+
             },
             // 改色
             changeColor(c, row) {
@@ -521,27 +578,28 @@
             },
             clearForm() {
                 // clear
-                this.form.className = '';
-                this.form.consumeHour = 0;
-                this.form.topLimit = 0;
-                this.form.wxvisible = 1;
-                this.form.classColor = '';
-                this.form.memo = '';
+                this.form.ClassName = '';
+                this.form.ConsumeHour = 0;
+                this.form.TopLimit = 0;
+                this.form.wxVisible = 1;
+                this.form.ClassColor = '';
+                this.form.Memo = '';
             },
             // 编辑
             editLesson(row) {
                 let that = this;
                 this.clearForm();
-
-                this.form.className = row.name;
-                this.form.consumeHour = row.Recovered;
-                this.form.topLimit = row.Recovered;
-                this.form.wxvisible = row.wxVisible;
-                this.form.classColor = row.color;
-                this.form.memo = row.memo;
-                this.form.dialogValue = row.dialogValue;
                 this.form.btnType = 1; //编辑
 
+                this.form.ClassName = row.ClassName;
+                this.form.ConsumeHour = row.ConsumeHour;
+                this.form.TopLimit = row.TopLimit;
+                this.form.wxVisible = row.wxVisible;
+                this.form.ClassColor = row.ClassColor;
+                this.form.Memo = row.Memo;
+                this.form.dialogValue = row.teacherId;
+                this.form.classId = row.ClassId
+                this.form.ShopId = row.ShopId;
                 this.dialogLesson = true
                 this.dialogTitle = '编辑课程'
             },

+ 90 - 19
pc/src/views/ShopManage.vue

@@ -85,18 +85,19 @@
                         <el-input v-model="form.shopName"></el-input>
                     </el-form-item>
                     <el-form-item label="位置">
-                        <el-input v-model="form.location"></el-input>
+                        <el-input v-model="form.addr"></el-input>
                     </el-form-item>
                     <el-form-item label="负责人">
-                        <el-input v-model="form.name"></el-input>
+                        <el-input v-model="form.contacts"></el-input>
                     </el-form-item>
                     <el-form-item label="手机号">
-                        <el-input v-model="form.userCode"></el-input>
+                        <el-input v-model="form.phone"></el-input>
                     </el-form-item>
                 </el-form>
             </div>
             <div class="dialogFooter">
-                <el-button type="primary" size="small" @click="confirmAdmin">确定</el-button>
+                <el-button type="primary" size="small" @click="confirmAdmin" v-if="form.btnState == 0">确定</el-button>
+                <el-button type="primary" size="small" @click="confirmEdite" v-if="form.btnState == 1">确定</el-button>
                 <el-button @click="dialogVisible = false" size="small">取消</el-button>
             </div>
         </el-dialog>
@@ -106,6 +107,7 @@
 <script>
     import Global from '../Global.js'
     import {
+        ShopAdd,
         testTable,
         testSelect
     } from "../api/getApiRes";
@@ -144,10 +146,13 @@
                 },
                 form: {
                     shopName: '',
-                    location: '',
+                    addr: '',
                     name: '',
+                    contacts: '',
+                    phone: '',
                     userCode: '',
                     shopId: '',
+                    btnState: 0,
                 },
                 shops: [],
                 tableData: []
@@ -169,40 +174,40 @@
                     this.$message.error('错了哦,姓名字数超过18个字');
                     return false
                 }
-                if (!that.form.location) {
+                if (!that.form.addr) {
                     this.$message.error('错了哦,位置不能为空');
                     return false
                 }
-                if (that.form.location.length > 38) {
+                if (that.form.addr.length > 38) {
                     this.$message.error('错了哦,位置字数超过38个字');
                     return false
                 }
-                if (!that.form.name) {
+                if (!that.form.contacts) {
                     this.$message.error('错了哦,负责人不能为空');
                     return false
                 }
-                if (that.form.name.length > 8) {
+                if (that.form.contacts.length > 8) {
                     this.$message.error('错了哦,负责人字数超过8个字');
                     return false
                 }
-                if (!that.form.userCode) {
+                if (!that.form.phone) {
                     this.$message.error('错了哦,手机号不能为空');
                     return false
                 }
-                if (!globalCheckPhone(that.form.userCode)) {
+                if (!globalCheckPhone(that.form.phone)) {
                     this.$message.error('错了哦,手机号格式不正确');
                     return false
                 }
                 let param = {
                     token: localStorage.token,
                     shopName: that.form.shopName,
-                    location: that.form.location,
-                    name: that.form.name,
-                    userCode: that.form.userCode,
+                    addr: that.form.addr,
+                    contacts: that.form.contacts,
+                    phone: that.form.phone,
                     shopid: that.form.shopid,
                 };
                 let postdata = qs.stringify(param);
-                testSelect(postdata).then(res => {
+                ShopAdd(postdata).then(res => {
                     let json = res;
                     if (json.Code == 0) {
                         // 关闭弹窗
@@ -219,6 +224,69 @@
                     }
                 })
             },
+            // 修改
+            confirmEdite() {
+                let that = this;
+                // checkNum
+                if (!that.form.shopName) {
+                    this.$message.error('错了哦,店面名称不能为空');
+                    return false
+                }
+                if (that.form.shopName.length > 18) {
+                    this.$message.error('错了哦,姓名字数超过18个字');
+                    return false
+                }
+                if (!that.form.addr) {
+                    this.$message.error('错了哦,位置不能为空');
+                    return false
+                }
+                if (that.form.addr.length > 38) {
+                    this.$message.error('错了哦,位置字数超过38个字');
+                    return false
+                }
+                if (!that.form.contacts) {
+                    this.$message.error('错了哦,负责人不能为空');
+                    return false
+                }
+                if (that.form.contacts.length > 8) {
+                    this.$message.error('错了哦,负责人字数超过8个字');
+                    return false
+                }
+                if (!that.form.phone) {
+                    this.$message.error('错了哦,手机号不能为空');
+                    return false
+                }
+                if (!globalCheckPhone(that.form.phone)) {
+                    this.$message.error('错了哦,手机号格式不正确');
+                    return false
+                }
+                let param = {
+                    token: localStorage.token,
+                    shopName: that.form.shopName,
+                    addr: that.form.addr,
+                    contacts: that.form.contacts,
+                    phone: that.form.phone,
+                    shopid: that.form.shopid,
+                };
+                let postdata = qs.stringify(param);
+                ShopAdd(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        // 关闭弹窗
+                        that.dialogVisible = false;
+
+                        // 重载列表
+                        that.getTableQuery();
+                        that.$message({
+                            showClose: true,
+                            message: '店面添加成功!',
+                            type: 'success'
+                        });
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
             // 删除
             delList() {
                 let that = this;
@@ -277,16 +345,19 @@
             clearForm() {
                 // clear
                 this.form.shopName = '';
-                this.form.location = '';
+                this.form.addr = '';
                 this.form.name = '';
                 this.form.userCode = '';
                 this.form.shopId = '';
+                this.form.phone = '';
+                this.form.contacts = '';
             },
             // 新增店面
             addAdmin() {
                 this.clearForm();
                 this.dialogVisible = true
                 this.dialogTitle = '新增店面'
+                this.form.btnState = 0; //新增
             },
             // 编辑店面
             editList() {
@@ -309,9 +380,10 @@
                     return false
                 }
                 this.clearForm();
+                this.form.btnState = 1; //编辑
                 let row = that.multipleSelection[0];
                 this.form.shopName = row.shopName;
-                this.form.location = row.location;
+                this.form.addr = row.addr;
                 this.form.name = row.name;
                 this.form.userCode = row.userCode;
                 this.form.shopId = row.Id;
@@ -329,12 +401,11 @@
             // 页面数据查询
             getTableQuery() {
                 let that = this;
-                // this.getGetChildRegionSelect(0, 1);
                 that.loading = true;
                 // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
                 let param = {
                     token: localStorage.token,
-                    supregionid: 0,//
+                    shopId: 0,//
                     regionid: this.panel.regionid,//
                     comid: 1,//
                     tagname: that.panel.tagname,//标签名