lex-xin il y a 4 ans
Parent
commit
93cb917b3d

+ 10 - 1
src/views/workBenchManager/journal/index.vue

@@ -86,6 +86,14 @@
                :dialogDetail="dialogDetail"
                @close="dialogLeave = false" />
     </el-dialog>
+    <!-- 请假 -->
+    <el-dialog :title="dialogTitle"
+               :visible.sync="dialogVipApply"
+               width="500px">
+      <vip-apply-model v-if="dialogVipApply"
+               :dialogDetail="dialogDetail"
+               @close="dialogVipApply = false" />
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -95,8 +103,9 @@ import { queryCountOfUnread, sysMessageList, setRead } from '@/api/journal'
 import { journalType } from '@/constant'
 import StudentModel from './model/student'
 import LeaveModel from './model/leave'
+import vipApplyModel from './model/vipApply'
 export default {
-  components: { pagination, StudentModel, LeaveModel },
+  components: { pagination, StudentModel, LeaveModel, vipApplyModel },
   name: 'journal',
   data () {
     return {

+ 0 - 2
src/views/workBenchManager/journal/model/leave.vue

@@ -123,7 +123,6 @@ export default {
                     let tempJson = result.coursesScheduleJson ? JSON.parse(result.coursesScheduleJson) : []
                     let musicGroupCourse = []
                     let vipCourse = []
-                    console.log(tempJson)
                     tempJson.forEach(item => {
                         if (item.before.type == 'VIP') {
                             vipCourse.push(item)
@@ -131,7 +130,6 @@ export default {
                             musicGroupCourse.push(item)
                         }
                     })
-                    console.log(vipCourse)
                     this.musicGroupCourse = musicGroupCourse
                     this.vipCourse = vipCourse
                 }

+ 64 - 113
src/views/workBenchManager/journal/model/vipApply.vue

@@ -1,85 +1,63 @@
 <template>
     <div>
-        <el-form ref="studentForm"
-                 :model="rateForm"
-                 v-if="studentForm"
-                 class="studentForm"
+        <el-form ref="vipForm"
+                 :model="vipForm"
+                 class="vipForm"
                  label-width="110px">
-            <el-alert title="已拒绝" show-icon center v-if="studentForm.complaints.status == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
-            <el-alert title="已同意" show-icon center v-if="studentForm.complaints.status == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
-            <el-form-item label="发起投诉时间">
-                <el-input disabled v-model.trim="studentForm.courseSchedule.createTime"></el-input>
+            <el-alert title="已拒绝" show-icon center v-if="vipForm.auditStatus == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
+            <el-alert title="已同意" show-icon center v-if="vipForm.auditStatus == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
+            <el-form-item label="开始时间">
+                <el-input disabled v-model.trim="vipForm.createTime"></el-input>
             </el-form-item>
-            <el-form-item label="学员姓名">
-                <el-input disabled v-model.trim="studentForm.complaints.user.username"></el-input>
+            <el-form-item label="老师姓名">
+                <el-input disabled v-model.trim="vipForm.userName"></el-input>
             </el-form-item>
-            <el-form-item label="课程名称">
-                <el-input disabled v-model.trim="studentForm.courseSchedule.name"></el-input>
+            <el-form-item label="线上课数">
+                <el-input disabled v-model.trim="vipForm.onlineClassesNum"></el-input>
             </el-form-item>
-            <el-form-item label="课程时间">
-                <!-- {{ showMessage.courseSchedule.classDate | formatTimer }} {{ showMessage.courseSchedule.startClassTime | timer }} -->
-                <el-input disabled v-model.trim="studentForm.courseSchedule.classDate"></el-input>
+            <el-form-item label="线上课单价">
+                <el-input disabled v-model.trim="vipForm.onlineClassesUnitPrice"></el-input>
             </el-form-item>
-            <el-form-item label="老师名称">
-                <el-input disabled v-model.trim="studentForm.courseSchedule.teacher.username"></el-input>
+            <el-form-item label="线上课课酬">
+                <el-input disabled v-model.trim="vipForm.onlineTeacherSalary"></el-input>
             </el-form-item>
-            <el-form-item label="投诉理由">
-                <el-input type="textarea" disabled v-model.trim="studentForm.complaints.reason"></el-input>
+            <el-form-item label="线下课数">
+                <el-input disabled v-model.trim="vipForm.offlineClassesNum"></el-input>
             </el-form-item>
-            <el-alert title="责任比" :closable="false" class="alert" type="info"></el-alert>
-            <el-form-item label="老师比例"
-                          prop="teacherRate"
-                          :rules="[{ required: true, message: '请输入老师比例', trigger: 'blur'},
-                            { required: true, validator: validateRate, trigger: 'blur' }]">
-                <el-input type="number"
-                      @mousewheel.native.prevent
-                      :disabled="studentForm.complaints.status !== 'ING'"
-                      v-model.number="rateForm.teacherRate"
-                      placeholder="请输入内容">
-                    <template slot="append">%</template>
-                </el-input>
+            <el-form-item label="线下课单价">
+                <el-input disabled v-model.trim="vipForm.offlineClassesUnitPrice"></el-input>
             </el-form-item>
-            <el-form-item label="学生比例"
-                          prop="studentRate"
-                          :rules="[{ required: true, message: '请输入学生比例', trigger: 'blur'},
-                            { required: true, validator: validateRate, trigger: 'blur' }]">
-                <el-input type="number"
-                      @mousewheel.native.prevent
-                      :disabled="studentForm.complaints.status !== 'ING'"
-                      v-model.number="rateForm.studentRate"
-                      placeholder="请输入内容">
-                <template slot="append">%</template>
-              </el-input>
+            <el-form-item label="线下课课酬">
+                <el-input disabled v-model.trim="vipForm.offlineTeacherSalary"></el-input>
+            </el-form-item>
+            <el-form-item label="科目名">
+                <el-input disabled v-model.trim="vipForm.subjectName"></el-input>
+            </el-form-item>
+            <el-form-item label="活动名称">
+                <el-input disabled v-model.trim="vipForm.vipGroupActivityName"></el-input>
+            </el-form-item>
+            <el-form-item label="商品价格">
+                <el-input disabled v-model.trim="vipForm.totalPrice"></el-input>
+            </el-form-item>
+            <el-form-item label="原因" prop="memo" :rules="[{ required: true, message: '请输入原因', trigger: 'blur' }]">
+                <el-input type="textarea" :disabled="vipForm.auditStatus !== 'ING'" v-model.trim="vipForm.memo"></el-input>
             </el-form-item>
         </el-form>
-        <div slot="footer" class="dialog-footer" v-permission="'courseSchedule/courseScheduleCommplaintAudit'" v-if="studentForm && studentForm.complaints.status === 'ING'">
-            <el-button type="primary" @click="onSubmit('studentForm', 'submit')">确 定</el-button>
-            <el-button type="danger" @click="onSubmit('studentForm', 'reject')">拒 绝</el-button>
+        <div slot="footer" class="dialog-footer" v-permission="'vipGroupManage/vipApplyAudit'" v-if="vipForm.auditStatus === 'ING'">
+            <el-button type="primary" @click="onSubmit('vipForm', 'PASS')">确 定</el-button>
+            <el-button type="danger" @click="onSubmit('vipForm', 'REJECT')">拒 绝</el-button>
         </div>
     </div>
 </template>
 
 <script>
-import { queryCourseScheduleComplaintsDetail, courseScheduleCommplaintAudit } from '@/api/journal'
-const validateRate = (rule, value, callback) => {
-    if (value == '' && typeof value == 'string' || value == null) {
-        callback(new Error('请输入比例'))
-    } else if (value < 0 || value > 100) {
-        callback(new Error('比例必须在0~100之间'))
-    } else {
-        callback()
-    }
-}
+import { getVipGroupDetailForAudit } from '@/api/vipSeting'
+import { vipApplyAudit } from '@/api/journal'
 export default {
     props: ['dialogDetail'],
     data() {
         return {
-            validateRate: validateRate,
-            studentForm: null,
-            rateForm: {
-                studentRate: null,
-                teacherRate: null
-            }
+            vipForm: {},
         }
     },
     mounted() {
@@ -93,69 +71,42 @@ export default {
                 this.$message.error('参数有误')
                 return
             }
-            await queryCourseScheduleComplaintsDetail({ courseScheduleComplaintsId: memo.courseScheduleComplaintsId }).then(res => {
+            await getVipGroupDetailForAudit({  vipGroupId: memo.vipGroupId }).then(res => {
                 let result = res.data
                 if (res.code == 200) {
-                    this.studentForm = result
-                    const { complaints } = result
-                    if (complaints.status != 'ING') {
-                        this.rateForm.teacherRate = complaints.teacherLiabilityRatio
-                        this.rateForm.studentRate = complaints.studentLiabilityRatio
-                    }
+                    this.vipForm = result
                 }
             })
         },
         async onSubmit(formName, type) {
             const params = {
-                id: this.studentForm.complaints.id
+                vipGroupId: this.vipForm.id,
+                reason: this.vipForm.memo,
+                auditStatus: type,
             }
-            if(type == 'reject') {
-                this.$confirm('您确定拒绝吗?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(async () => {
-                    params.status = 'REJECT'
-                    params.studentLiabilityRatio = 0
-                    params.teacherLiabilityRatio = 0
-                    await this.onComm(params)
-                }).catch(() => {
-                    //
-                });
-            } else {
-                this.$refs[formName].validate(async (valid) => {
-                    if(valid) {
-                        params.status = 'PASS'
-                        params.studentLiabilityRatio = this.rateForm.studentRate
-                        params.teacherLiabilityRatio = this.rateForm.teacherRate
-                        await this.onComm(params)
-                    }
-                })
-            }
-        },
-        async onComm(params) {
-            await courseScheduleCommplaintAudit(params).then(res => {
-                if (res.code == 200) {
-                    this.$message.success('处理成功')
-                    this.$listeners.close()
-                } else {
-                    this.$message.error(res.msg)
+            this.$refs[formName].validate(async (valid) => {
+                if(valid) {
+                    const str = type == 'PASS' ? '同意' : '拒绝'
+                    this.$confirm(`您确定${str}申请吗?`, '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(async () => {
+                        await vipApplyAudit(params).then(res => {
+                            if (res.code == 200) {
+                                this.$message.success('处理成功')
+                                this.$listeners.close()
+                            } else {
+                                this.$message.error(res.msg)
+                            }
+                        })
+                    }).catch(() => {
+                        //
+                    })
                 }
             })
         }
-    },
-    watch: {
-        'rateForm.teacherRate' (newValue, old) {
-            if (newValue) {
-                this.rateForm.studentRate = parseInt(100 - newValue)
-            }
-        },
-        'rateForm.studentRate' (newValue, old) {
-            if (newValue) {
-                this.rateForm.teacherRate = parseInt(100 - newValue)
-            }
-        }
-    },
+    }
 }
 </script>