Browse Source

修改显示

lex-xin 4 years ago
parent
commit
1e0db9af0c

+ 20 - 0
src/api/buildTeam.js

@@ -1500,6 +1500,16 @@ export function getInstrument(data) {
   })
   })
 }
 }
 
 
+// 获取乐保列表
+export function studentInstrumentDel(data) {
+  return request2({
+    url: api + `/studentInstrument/del`,
+    method: 'post',
+    requestType: 'form',
+    data: data
+  })
+}
+
 // 新增乐保乐器
 // 新增乐保乐器
 
 
 export function addStudentInstrument(data) {
 export function addStudentInstrument(data) {
@@ -1511,6 +1521,16 @@ export function addStudentInstrument(data) {
     requestType:'form'
     requestType:'form'
   })
   })
 }
 }
+// 新增乐保乐器
+
+export function updateStudentInstrument(data) {
+  return request2({
+    url: api + `/studentInstrument/update`,
+    method: 'post',
+    data:data,
+    requestType:'form'
+  })
+}
 
 
 // 获取对应角色的员工
 // 获取对应角色的员工
 
 

+ 34 - 10
src/views/musicalManager/index.vue

@@ -9,18 +9,19 @@
       <save-form
       <save-form
         :inline="true"
         :inline="true"
         :model="searchForm"
         :model="searchForm"
+        ref="searchForm"
         @submit="search"
         @submit="search"
         @reset="onReSet"
         @reset="onReSet"
       >
       >
-        <el-form-item>
+        <el-form-item prop="search">
           <el-input
           <el-input
             v-model.trim="searchForm.search"
             v-model.trim="searchForm.search"
             clearable
             clearable
             @keyup.enter.native="search"
             @keyup.enter.native="search"
-            placeholder="学生姓名、编号、电话"
+            placeholder="学生姓名/编号/电话"
           ></el-input>
           ></el-input>
         </el-form-item>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="organId">
           <el-select
           <el-select
             class="multiple"
             class="multiple"
             v-model.trim="searchForm.organId"
             v-model.trim="searchForm.organId"
@@ -36,7 +37,7 @@
             ></el-option>
             ></el-option>
           </el-select>
           </el-select>
         </el-form-item>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="goodsCategoryId">
           <el-select
           <el-select
             placeholder="请选择乐器分类"
             placeholder="请选择乐器分类"
             v-model="searchForm.goodsCategoryId"
             v-model="searchForm.goodsCategoryId"
@@ -77,27 +78,47 @@
             align="center"
             align="center"
             prop="id"
             prop="id"
             label="维护编号"
             label="维护编号"
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              <copy-text>{{ scope.row.id }}</copy-text>
+            </template>
+          </el-table-column>
           <el-table-column
           <el-table-column
             align="center"
             align="center"
             prop="organName"
             prop="organName"
             label="分部"
             label="分部"
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              <copy-text>{{ scope.row.organName }}</copy-text>
+            </template>
+          </el-table-column>
           <el-table-column
           <el-table-column
             align="center"
             align="center"
             prop="studentId"
             prop="studentId"
             label="学员编号"
             label="学员编号"
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              <copy-text>{{ scope.row.studentId }}</copy-text>
+            </template>
+          </el-table-column>
           <el-table-column
           <el-table-column
             align="center"
             align="center"
             prop="studentName"
             prop="studentName"
             label="学员姓名"
             label="学员姓名"
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              <copy-text>{{ scope.row.studentName }}</copy-text>
+            </template>
+          </el-table-column>
           <el-table-column
           <el-table-column
             align="center"
             align="center"
             prop="phone"
             prop="phone"
             label="联系电话"
             label="联系电话"
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              <copy-text>{{ scope.row.phone }}</copy-text>
+            </template>
+          </el-table-column>
           <el-table-column
           <el-table-column
             align="center"
             align="center"
             prop="goodsName"
             prop="goodsName"
@@ -193,7 +214,10 @@ export default {
       this.rules.page = 1;
       this.rules.page = 1;
       this.getList()
       this.getList()
     },
     },
-    onReSet() {},
+    onReSet() {
+      this.$refs['searchForm'].resetFields()
+      this.getList()
+    },
     async getList() {
     async getList() {
      try{
      try{
        const res = await getInstrument({...this.searchForm,rows:this.rules.limit,page:this.rules.page})
        const res = await getInstrument({...this.searchForm,rows:this.rules.limit,page:this.rules.page})

+ 26 - 4
src/views/repairManager/repairList.vue

@@ -155,11 +155,11 @@
               <copy-text>{{ scope.row.employeeName }}</copy-text>
               <copy-text>{{ scope.row.employeeName }}</copy-text>
             </template>
             </template>
           </el-table-column>
           </el-table-column>
-          <el-table-column align="center" prop="subjectName" label="乐器种类">
+          <!-- <el-table-column align="center" prop="subjectName" label="乐器种类">
             <template slot-scope="scope">
             <template slot-scope="scope">
               <copy-text>{{ scope.row.subjectName }}</copy-text>
               <copy-text>{{ scope.row.subjectName }}</copy-text>
             </template>
             </template>
-          </el-table-column>
+          </el-table-column> -->
           <el-table-column align="center" prop="type" label="维修类型">
           <el-table-column align="center" prop="type" label="维修类型">
             <template slot-scope="scope">{{
             <template slot-scope="scope">{{
               scope.row.type ? "线上" : "线下"
               scope.row.type ? "线上" : "线下"
@@ -225,7 +225,15 @@
               </p>
               </p>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
+          <el-col :span="12" v-if="activeRow && activeRow.studentInstrumentId">
+            <el-form-item label="维护编号:">
+              <p class="visibleCell">
+                {{ activeRow.studentInstrumentId }}
+              </p>
+            </el-form-item>
+          </el-col>
         </el-row>
         </el-row>
+
         <el-row>
         <el-row>
           <el-col :span="12">
           <el-col :span="12">
             <el-form-item label="学生姓名:">
             <el-form-item label="学生姓名:">
@@ -291,10 +299,17 @@
           </el-col>
           </el-col>
         </el-row>
         </el-row>
         <el-row>
         <el-row>
-          <el-col>
+          <el-col :span="12">
             <el-form-item label="特权减免金额">
             <el-form-item label="特权减免金额">
               <p v-if="activeRow">
               <p v-if="activeRow">
-                {{ activeRow.exemptionAmount | moneyFormat }}
+                {{ activeRow.exemptionAmount | moneyFormat }}元
+              </p>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="应付金额">
+              <p v-if="activeRow">
+                {{ activeRow.payableAmount | moneyFormat }}元
               </p>
               </p>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -526,6 +541,13 @@ export default {
     showDetail(row) {
     showDetail(row) {
       let goodsList = row.goodsJson ? JSON.parse(row.goodsJson) : [];
       let goodsList = row.goodsJson ? JSON.parse(row.goodsJson) : [];
       row.goodsList = goodsList;
       row.goodsList = goodsList;
+      let payableAmount = row.amount
+      goodsList.forEach(item => {
+        payableAmount += parseFloat(item.discountPrice ? item.discountPrice : item.groupPurchasePrice)
+      });
+
+      payableAmount = (payableAmount - (row.exemptionAmount || 0)).toFixed(2)
+      row.payableAmount = payableAmount
       this.activeRow = row;
       this.activeRow = row;
       this.repairVisible = true;
       this.repairVisible = true;
     },
     },

+ 49 - 7
src/views/studentManager/components/studentLebao.vue

@@ -49,7 +49,7 @@
         <el-button type="primary" native-type="reset">重置</el-button>
         <el-button type="primary" native-type="reset">重置</el-button>
       </el-form-item>
       </el-form-item>
     </save-form>
     </save-form>
-    <el-button @click="addMusicVisible = true" type="primary" v-permission="'studentInstrument/add'"
+    <el-button @click="operationStudent('create')" type="primary" v-permission="'studentInstrument/add'"
       >新增乐器</el-button
       >新增乐器</el-button
     >
     >
     <div class="tableWrap">
     <div class="tableWrap">
@@ -77,13 +77,30 @@
             {{ scope.row.status?'是':'否' }}
             {{ scope.row.status?'是':'否' }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column label="乐保有效期" align="center" prop="studentNum">
+        <el-table-column label="乐保有效期" align="center" width="350px" prop="studentNum">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <div>
             <div>
-              {{ scope.row.startTime|formatTimer}}~{{scope.row.endTime | formatTimer}}
+              {{ scope.row.startTime}}~{{scope.row.endTime}}
             </div>
             </div>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
+        <el-table-column label="操作" align="center">
+          <template slot-scope="scope">
+            <auth :auths="['studentInstrument/update']">
+              <el-button
+                type="text"
+                @click="operationStudent('update', scope.row)"
+              >修改</el-button>
+            </auth>
+            <auth :auths="['studentInstrument/del']">
+              <el-button
+                type="text"
+                @click="removeMusic(scope.row)"
+              >删除</el-button>
+            </auth>
+
+          </template>
+        </el-table-column>
       </el-table>
       </el-table>
       <pagination
       <pagination
         save-key="studentDetail-studentLebao"
         save-key="studentDetail-studentLebao"
@@ -96,12 +113,12 @@
       />
       />
     </div>
     </div>
     <el-dialog
     <el-dialog
-      title="新增乐器"
+      :title="operationStatus == 'create' ? '新增乐器' : '修改乐器'"
       width="600px"
       width="600px"
       :visible.sync="addMusicVisible"
       :visible.sync="addMusicVisible"
       v-if="addMusicVisible"
       v-if="addMusicVisible"
     >
     >
-      <addMusic :categoryList='categoryList' ref='addMusic' @getList='getList' @close='addMusicVisible = false'/>
+      <addMusic :categoryList='categoryList' :operationData="operationData" :operationStatus="operationStatus" ref='addMusic' @getList='getList' @close='addMusicVisible = false'/>
       <span slot="footer" class="dialog-footer">
       <span slot="footer" class="dialog-footer">
         <el-button @click="addMusicVisible = false">取 消</el-button>
         <el-button @click="addMusicVisible = false">取 消</el-button>
         <el-button type="primary" @click="addMusicSubmit">确 定</el-button>
         <el-button type="primary" @click="addMusicSubmit">确 定</el-button>
@@ -112,7 +129,7 @@
 <script>
 <script>
 import pagination from "@/components/Pagination/index";
 import pagination from "@/components/Pagination/index";
 import addMusic from "../modals/addMusic";
 import addMusic from "../modals/addMusic";
-import { getInstrument } from "@/api/buildTeam";
+import { getInstrument, studentInstrumentDel } from "@/api/buildTeam";
 import { categoryListTree } from "@/api/businessManager";
 import { categoryListTree } from "@/api/businessManager";
 export default {
 export default {
   components: { pagination, addMusic },
   components: { pagination, addMusic },
@@ -123,7 +140,7 @@ export default {
       searchForm: {
       searchForm: {
         specification:'',
         specification:'',
         goodsCategoryId: "",
         goodsCategoryId: "",
-        studentId:this.$route.query.userId
+        studentId: this.$route.query.userId
       },
       },
       pageInfo: {
       pageInfo: {
         // 分页规则
         // 分页规则
@@ -132,6 +149,8 @@ export default {
         total: 0, // 总条数
         total: 0, // 总条数
         page_size: [10, 20, 40, 50], // 选择限制显示条数
         page_size: [10, 20, 40, 50], // 选择限制显示条数
       },
       },
+      operationStatus: 'create',
+      operationData: null,
       addMusicVisible: false,
       addMusicVisible: false,
       categoryList: [],
       categoryList: [],
     };
     };
@@ -162,6 +181,29 @@ export default {
     addMusicSubmit() {
     addMusicSubmit() {
       this.$refs.addMusic.addMusicSubmit()
       this.$refs.addMusic.addMusicSubmit()
     },
     },
+    operationStudent(type, row) {
+      if(type == 'update') {
+        this.operationData = row
+      } else if(type == 'create') {
+        this.operationData = null
+      }
+      this.operationStatus = type
+      this.addMusicVisible = true
+    },
+    removeMusic(row) {
+      // 删除乐器
+      this.$confirm(`您确定删除吗?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(async() => {
+        try {
+          let res = await studentInstrumentDel({ id: row.id, studentId: this.searchForm.studentId})
+          this.$message.success("修改成功");
+          this.getList()
+        } catch { }
+      });
+    },
     getCategory() {
     getCategory() {
       let params = {
       let params = {
         delFlag: 0,
         delFlag: 0,

+ 31 - 7
src/views/studentManager/modals/addMusic.vue

@@ -78,8 +78,8 @@
           style="width: 400px"
           style="width: 400px"
           v-model="musicForm.date"
           v-model="musicForm.date"
           :clearable="false"
           :clearable="false"
-          type="daterange"
-          value-format="yyyy-MM-dd"
+          type="datetimerange"
+          value-format="yyyy-MM-dd HH:mm:ss"
           range-separator="至"
           range-separator="至"
           :picker-options="{ firstDayOfWeek: 1 }"
           :picker-options="{ firstDayOfWeek: 1 }"
           start-placeholder="开始日期"
           start-placeholder="开始日期"
@@ -92,10 +92,11 @@
 </template>
 </template>
 <script>
 <script>
 import { goodsQuery } from "@/api/businessManager";
 import { goodsQuery } from "@/api/businessManager";
-import { addStudentInstrument } from "@/api/buildTeam";
+import { addStudentInstrument, updateStudentInstrument } from "@/api/buildTeam";
 import { getTimes } from "@/utils";
 import { getTimes } from "@/utils";
+import dayjs from 'dayjs'
 export default {
 export default {
-  props: ["categoryList"],
+  props: ["categoryList", "operationData", "operationStatus"],
   data() {
   data() {
     return {
     return {
       musicForm: {
       musicForm: {
@@ -109,6 +110,24 @@ export default {
       musicList: [],
       musicList: [],
     };
     };
   },
   },
+  async mounted() {
+    console.log(this.operationData)
+    let operationData = this.operationData
+    if(operationData) {
+      let musicForm = this.musicForm
+      musicForm.goodsCategoryId = operationData.goodsCategoryId
+      if(operationData.goodsCategoryId) {
+        await this.changeCategory(operationData.goodsCategoryId)
+      }
+      musicForm.goodsId = operationData.goodsId
+      musicForm.goodsName = operationData.goodsName
+      musicForm.status = operationData.status + ''
+
+      musicForm.date = [(operationData.startTime), (operationData.endTime)]
+      musicForm.id = operationData.id
+      console.log(musicForm)
+    }
+  },
   methods: {
   methods: {
     changeCategory(val) {
     changeCategory(val) {
       this.musicForm.goodsName = "";
       this.musicForm.goodsName = "";
@@ -127,10 +146,15 @@ export default {
             const { date, ...rest } = this.musicForm;
             const { date, ...rest } = this.musicForm;
             let obj = {
             let obj = {
               ...rest,
               ...rest,
-              ...getTimes(date, ["startTime", "endTime"]),
+              ...getTimes(date, ["startTime", "endTime"], 'YYYY-MM-DD HH:mm:ss'),
             };
             };
-            const res = await addStudentInstrument(obj);
-            this.$message.success('添加成功')
+            if(this.operationStatus == 'create') {
+              const res = await addStudentInstrument(obj);
+              this.$message.success('添加成功')
+            } else if(this.operationStatus == 'update') {
+              const res = await updateStudentInstrument(obj);
+              this.$message.success('修改成功')
+            }
             this.$emit('close')
             this.$emit('close')
             this.$emit('getList')
             this.$emit('getList')
           } catch (e) {
           } catch (e) {