Browse Source

红德堂-增加销售公司红包开关、营期公司红包开关

Long 1 week ago
parent
commit
d0246694c7

+ 9 - 0
src/api/course/userCoursePeriod.js

@@ -207,3 +207,12 @@ export function batchSaveRedPacketByCompany(data) {
     data: data
     data: data
   })
   })
 }
 }
+
+// 修改红包状态
+export function changeRedPacketState(data) {
+  return request({
+    url: '/course/period/changeRedPacketState',
+    method: 'post',
+    data: data
+  })
+}

+ 9 - 0
src/api/his/company.js

@@ -71,3 +71,12 @@ export function exportCompany(query) {
     params: query
     params: query
   })
   })
 }
 }
+
+// 修改红包状态
+export function changeRedPacketState(data) {
+  return request({
+    url: '/his/company/changeRedPacketState',
+    method: 'post',
+    data: data
+  })
+}

+ 42 - 3
src/views/course/userCoursePeriod/redPacket.vue

@@ -17,14 +17,29 @@
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column type="index" label="序号" width="60" align="center" />
       <el-table-column type="index" label="序号" width="60" align="center" />
       <el-table-column label="公司名称" prop="companyName" align="center" />
       <el-table-column label="公司名称" prop="companyName" align="center" />
-      <el-table-column label="操作" align="center" width="120">
+      <el-table-column label="操作" align="center" width="220">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <el-button
           <el-button
             size="mini"
             size="mini"
             type="text"
             type="text"
             @click="handleInputAmount(scope.row)"
             @click="handleInputAmount(scope.row)"
+            v-if="scope.row.openRedPacket === 1"
             v-hasPermi="['course:period:setCourseRedPacket']"
             v-hasPermi="['course:period:setCourseRedPacket']"
           >设置红包</el-button>
           >设置红包</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleOpenRedPacket(scope.row)"
+            v-if="scope.row.openRedPacket === 0"
+            v-hasPermi="['course:period:changeRedPacketState']"
+          >打开红包</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleCloseRedPacket(scope.row)"
+            v-if="scope.row.openRedPacket === 1"
+            v-hasPermi="['course:period:changeRedPacketState']"
+          >关闭红包</el-button>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>
@@ -95,8 +110,8 @@ import {
   getPeriodCompanyList,
   getPeriodCompanyList,
   batchSaveRedPacket,
   batchSaveRedPacket,
   getPeriodRedPacketList,
   getPeriodRedPacketList,
-  batchSaveRedPacketByCompany
-} from "@/api/course/userCoursePeriod";
+  batchSaveRedPacketByCompany, changeRedPacketState
+} from '@/api/course/userCoursePeriod'
 import redPacket from "@/views/course/userCoursePeriod/redPacket.vue";
 import redPacket from "@/views/course/userCoursePeriod/redPacket.vue";
 
 
 export default {
 export default {
@@ -175,6 +190,30 @@ export default {
       this.courseDialogVisible = true;
       this.courseDialogVisible = true;
       this.getCourseList();
       this.getCourseList();
     },
     },
+    // 打开红包
+    handleOpenRedPacket(row) {
+      const params = {
+        periodId: this.periodId,
+        companyId: row.companyId,
+        state: 1
+      }
+      changeRedPacketState(params).then(response => {
+        this.msgSuccess(response.msg)
+        this.getCompanyList()
+      })
+    },
+    // 关闭红包
+    handleCloseRedPacket(row) {
+      const params = {
+        periodId: this.periodId,
+        companyId: row.companyId,
+        state: 0
+      }
+      changeRedPacketState(params).then(response => {
+        this.msgSuccess(response.msg)
+        this.getCompanyList()
+      })
+    },
     // 获取课程列表
     // 获取课程列表
     getCourseList() {
     getCourseList() {
       getPeriodRedPacketList({
       getPeriodRedPacketList({

+ 42 - 2
src/views/his/company/index.vue

@@ -134,7 +134,7 @@
       <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
       <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
       <el-table-column label="更新时间" align="center" prop="updateTime" width="180"/>
       <el-table-column label="更新时间" align="center" prop="updateTime" width="180"/>
       <!--      <el-table-column label="主机重启时间" align="center" prop="restartTime" width="180" />-->
       <!--      <el-table-column label="主机重启时间" align="center" prop="restartTime" width="180" />-->
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200px">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="220px">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <el-button
           <el-button
             size="mini"
             size="mini"
@@ -176,6 +176,24 @@
             v-hasPermi="['his:company:deduct']"
             v-hasPermi="['his:company:deduct']"
           >扣款
           >扣款
           </el-button>
           </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            v-if="scope.row.openRedPacket === 0"
+            @click="handleOpenRedPacket(scope.row)"
+            v-hasPermi="['his:company:changeRedPacketState']"
+          >开启红包
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            v-if="scope.row.openRedPacket === 1"
+            @click="handCloseRedPacket(scope.row)"
+            v-hasPermi="['his:company:changeRedPacketState']"
+          >关闭红包
+          </el-button>
 
 
         </template>
         </template>
       </el-table-column>
       </el-table-column>
@@ -486,7 +504,7 @@ import {
   recharge,
   recharge,
   deduct,
   deduct,
   exportCompany,
   exportCompany,
-  resetPwd
+  resetPwd, changeRedPacketState
 } from '@/api/his/company'
 } from '@/api/his/company'
 import { getFollowDoctorList } from '@/api/his/doctor'
 import { getFollowDoctorList } from '@/api/his/doctor'
 import { docList } from '@/api/his/doctor'
 import { docList } from '@/api/his/doctor'
@@ -686,6 +704,28 @@ export default {
       this.deductForm.money = null
       this.deductForm.money = null
       this.deduct.open = true
       this.deduct.open = true
     },
     },
+    // 开启红包
+    handleOpenRedPacket(row) {
+      const params = {
+        companyId: row.companyId,
+        state: 1
+      }
+      changeRedPacketState(params).then(response => {
+        this.msgSuccess(response.msg)
+        this.getList()
+      })
+    },
+    // 关闭红包
+    handCloseRedPacket(row) {
+      const params = {
+        companyId: row.companyId,
+        state: 0
+      }
+      changeRedPacketState(params).then(response => {
+        this.msgSuccess(response.msg)
+        this.getList()
+      })
+    },
     /** 提交按钮 */
     /** 提交按钮 */
     submitRechargeForm() {
     submitRechargeForm() {
       this.$refs['rechargeForm'].validate(valid => {
       this.$refs['rechargeForm'].validate(valid => {