Переглянути джерело

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

Changpeng Duan 5 роки тому
батько
коміт
4332919edf
3 змінених файлів з 112 додано та 34 видалено
  1. 11 0
      pc/src/api/getApiRes.js
  2. 40 16
      pc/src/views/Lesson.vue
  3. 61 18
      pc/src/views/LessonTable.vue

+ 11 - 0
pc/src/api/getApiRes.js

@@ -192,6 +192,17 @@ export function SttPlanBasicListQuery(postdata) {
     return getApiBasic(url, postdata);
 }
 
+// 课程表模板店铺通用修改
+export function SttPlanBasicShopEdit(postdata) {
+    let url = headapi + '/v1/SttPlan/SttPlanBasicShopEdit';
+    return getApiBasic(url, postdata);
+}
+
+// 课程表模板复制
+export function SttPlanCopy(postdata) {
+    let url = headapi + '/v1/SttPlan/SttPlanCopy';
+    return getApiBasic(url, postdata);
+}
 // 课程表模板基本信息状态修改
 export function SttPlanBasicStatusEdit(postdata) {
     let url = headapi + '/v1/SttPlan/SttPlanBasicStatusEdit';

+ 40 - 16
pc/src/views/Lesson.vue

@@ -100,14 +100,6 @@
                                          @change="changeColor(scope.row.ClassSelf.ClassColor,scope.row.ClassSelf)"></el-color-picker>
                     </template>
                 </el-table-column>
-                <el-table-column
-                        prop="ClassSelf.CreatedAt"
-                        label="创建时间"
-                        width="210"
-                        :formatter="filterFmtDate"
-                        sortable
-                >
-                </el-table-column>
                 <el-table-column
                         prop="ClassSelf.Memo"
                         label="备注">
@@ -197,7 +189,8 @@
                 <div class="pull-right">
                     <el-form ref="form" :model="form" label-width="160px">
                         <el-form-item label="课程会员人数">
-                            <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"></el-transfer>
+                            <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"
+                                         :titles="['全部会员','已选会员']"></el-transfer>
                         </el-form-item>
                     </el-form>
                 </div>
@@ -219,7 +212,7 @@
                              :titles="['会员列表', '已添加会员']"></el-transfer>
             </div>
             <div class="dialogFooter">
-                <el-button type="primary" size="small">确定</el-button>
+                <el-button type="primary" size="small" @click="cofirmClassVipuserEdit">确定</el-button>
                 <el-button @click=" dialogVisible = false" size="small">取消</el-button>
             </div>
         </el-dialog>
@@ -251,6 +244,7 @@
         VipUserListQuery,
         ClassVisibleStatusEdit,
         ClassVipuserQuery,
+        ClassVipuserEdit,
         testTable,
         testSelect
     } from "../api/getApiRes";
@@ -322,6 +316,31 @@
             this.getTableQuery();
         },
         methods: {
+            // 课程会员增删
+            cofirmClassVipuserEdit() {
+                let that = this;
+                let userlist = that.dialogValue.toString();
+                let param = {
+                    token: localStorage.token,
+                    classId: this.form.classId,
+                    userlist: userlist,
+                };
+                let postdata = qs.stringify(param);
+                ClassVipuserEdit(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.$message({
+                            showClose: true,
+                            message: '接口修改成功!',
+                            type: 'success'
+                        });
+                        that.dialogVisible = false
+                        that.getTableQuery();
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
             // 确认添加课程
             confirmAddLesson() {
                 let that = this;
@@ -342,7 +361,7 @@
                     }
                 }
 
-                let teacherId = that.form.dialogValue.toString();
+                let userlist = that.form.dialogValue.toString();
                 let param = {
                     token: localStorage.token,
                     shopId: localStorage.shopId,
@@ -352,8 +371,8 @@
                     classType: that.form.classType,
                     wxVisible: that.form.wxVisible,
                     classColor: that.form.ClassColor,
-                    userlist: '',
-                    teacherId: teacherId,
+                    userlist: userlist,
+                    teacherId: 0,//预留
                     memo: that.form.Memo,
                 };
                 let postdata = qs.stringify(param);
@@ -534,7 +553,7 @@
                     let json = res;
                     if (json.Code == 0) {
                         // that.dialogdata = json.Rs;
-                        that.form.dialogdata =  turnResToOption(json.Rs)
+                        that.form.dialogdata = turnResToOption(json.Rs)
                     } else {
                         that.$message.error(json.Memo);
                     }
@@ -542,7 +561,6 @@
             },
             // 微信可见与否
             changeWechat(e, row) {
-                console.log(row);
                 let that = this;
                 let param = {
                     token: localStorage.token,
@@ -584,7 +602,12 @@
                     return false
                 }
                 let row = this.multipleSelection[0];
-                this.dialogValue = row.dialogValue;
+                let userArrary = [];
+                row.Userlist.map(function (item) {
+                    userArrary.push(item.Id)
+                })
+                this.form.classId = row.ClassSelf.ClassId;
+                this.dialogValue = userArrary;
                 this.dialogVisible = true
                 // 读取左侧会员列表
 
@@ -817,6 +840,7 @@
         width: 70%;
         float: right;
     }
+
     /deep/ .el-transfer-panel__item .el-checkbox__input {
         left: 15px;
     }

+ 61 - 18
pc/src/views/LessonTable.vue

@@ -48,13 +48,17 @@
                 <el-table-column
                         prop="ShopId"
                         label="是否通用"
-                        width="110"
-                        align="center"
-                        sortable
                 >
                     <template slot-scope="scope">
-                        <span v-if="scope.row.ShopId == 0">通用</span>
-                        <span v-else>不通用</span>
+                        <el-switch
+                                v-model="scope.row.ShopId"
+                                :active-value="1"
+                                :inactive-value="0"
+                                active-color="#409EFF"
+                                inactive-color="#D9D9D9"
+                                @change=changeShopId($event,scope.row)
+                        >
+                        </el-switch>
                     </template>
                 </el-table-column>
                 <el-table-column
@@ -75,10 +79,14 @@
                 >
                     <template slot-scope="scope">
                         <el-button type="text" @click="goEdit(scope.row)">编辑</el-button>
-<!--                        <el-button type="text" @click="goEdit(scope.row)">详情</el-button>-->
+                        <!--                        <el-button type="text" @click="goEdit(scope.row)">详情</el-button>-->
                         <el-button type="text" @click="goEdit(scope.row)">预览本周</el-button>
-                        <el-button type="success" size="mini" v-if="scope.row.Status == 1" @click="openLessonTable(scope.row)">发布</el-button>
-                        <el-button type="warning" size="mini" v-if="scope.row.Status == 2" @click="unpubilc(scope.row)">取消发布</el-button>
+                        <el-button type="success" size="mini" v-if="scope.row.Status == 1"
+                                   @click="openLessonTable(scope.row)">发布
+                        </el-button>
+                        <el-button type="warning" size="mini" v-if="scope.row.Status == 2" @click="unpubilc(scope.row)">
+                            取消发布
+                        </el-button>
                     </template>
                 </el-table-column>
 
@@ -92,6 +100,10 @@
             ></el-pagination>
         </div>
 
+        <el-dialog title="课程表模板复制" :visible.sync="dialogCopyVisible" width="640px">
+            
+        </el-dialog>
+
         <el-dialog title="发布课程表" :visible.sync="dialogVisible" width="640px">
             <div class="dialogTitle">
                 <span>{{form.name}}</span>
@@ -143,8 +155,12 @@
     import Global from '../Global.js'
     import {
         SttPlanBasicListQuery,
+        ClassVisibleStatusEdit,
+        SttPlanBasicShopEdit,
+        SttPlanBasicStatusEdit,
+        SttPlanCopy,
         testTable,
-        testSelect
+        testSelect,
     } from "../api/getApiRes";
 
     let qs = require('qs');
@@ -152,6 +168,7 @@
         data() {
             return {
                 dialogVisible: false,
+                dialogCopyVisible: false,
                 dialogdata: [],
                 dialogValue: [],
                 // panel 配置项目
@@ -162,12 +179,12 @@
                     total: 100,
                     pageIndex: 1,
                 },
-                form:{
-                    Id:'',
-                    name:'',
-                    week:'',
-                    wechat:1,
-                    appoint:1,
+                form: {
+                    Id: '',
+                    name: '',
+                    week: '',
+                    wechat: 1,
+                    appoint: 1,
                 },
                 tableData: []
             }
@@ -176,6 +193,32 @@
             this.getTableQuery();
         },
         methods: {
+            // 通用修改
+            changeShopId(e, row) {
+                console.log(e);
+                let that = this;
+                let shopId = e == 1 ? localStorage.shopId : 0;
+                let param = {
+                    token: localStorage.token,
+                    planId: row.PlanId,//
+                    shopId: shopId,//0:跨店课程,通用 >0: 本店特有课程,不通用
+                };
+                let postdata = qs.stringify(param);
+                SttPlanBasicShopEdit(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.$message({
+                            showClose: true,
+                            message: '当前课程表模板已' + json.Memo,
+                            type: 'success'
+                        });
+                        // 重载列表
+                        that.getTableQuery();
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
             addLessonTable() {
                 this.$router.push({
                     path: '/editLessonTable', query: {
@@ -296,7 +339,7 @@
                 });
             },
             // 发布课程表
-            openLessonTable(row){
+            openLessonTable(row) {
                 this.dialogVisible = true;
                 this.form.name = row.name;
                 this.form.Id = row.Id;
@@ -368,7 +411,7 @@
                 this.$router.push({
                     path: '/editLessonTable', query: {
                         id: row.PlanId,
-                        name:row.PlanName
+                        name: row.PlanName
                     }
                 });
             },
@@ -460,7 +503,7 @@
             },
         },
         watch: {
-            $route(){
+            $route() {
                 this.getTableQuery()
             },
         },