Browse Source

乐团修改

wolyshaw 4 years ago
parent
commit
8305fcb3de

+ 35 - 11
src/views/resetTeaming/components/resetPayList.vue

@@ -142,8 +142,6 @@
                          @click="lookDetail(scope.row)"
                          v-permission="'/strudentPayInfo'">查看</el-button>
               <el-button type="text"
-                         v-if="scope.row.status == 'REJECT'"
-                         v-permission="'musicGroupPaymentCalender/updateStartTime'"
                          @click="resetPay(scope.row)">修改</el-button>
 
               <el-button type="text" v-if="!isNewGropu" @click="onCreateQRCode(scope.row)">续费二维码</el-button>
@@ -324,12 +322,14 @@
       :title="payFormTitle"
       :visible.sync="userVisible"
       width="800px"
-      
+
     >
       <userPayForm
-      v-if="userVisible"
+        v-if="userVisible"
         @close="userVisible = false"
         @submited="payedSubmited"
+        @changeActive="$listeners.changeActive"
+        :organizationCourseUnitPriceSettings="organizationCourseUnitPriceSettings"
         :rowDetail='activeRow'
         :type="payFormType"
         :baseInfo="baseInfo"
@@ -345,6 +345,7 @@
                width='800px'>
       <setStudentFee @chioseStudent='chioseStudent'
                      ref='setStudentFee'
+                     @submited="chioseStudentSubmited"
                      :clearTale="clearStduent"></setStudentFee>
       <div slot="footer"
            class="dialog-footer">
@@ -366,6 +367,9 @@ import dayjs from 'dayjs'
 import QrCode from "@/components/QrCode/index";
 import { vaildStudentUrl } from '@/utils/validate'
 import { addMusicGroupPaymentCalender, getMusicGroupPaymentCalender, resetMusicGroupPaymentCalender, delMusicGroupPaymentCalender } from "@/api/buildTeam";
+import {
+  getOrganizationCourseUnitPriceSettings
+} from '@/api/specialSetting'
 import { musicGroupPaymentCalenderQueryPage, getMusicGroupStu, musicGroupPaymentCalenderDetailBatchAdd } from '../api'
 import setStudentFee from './studentPayBase'
 import userPayForm from '../modals/user-pay-form'
@@ -393,6 +397,7 @@ export default {
       userVisible: false,
       schoolVisible: false,
       reviewVisible: false,
+      organizationCourseUnitPriceSettings: [],
       searchForm: {
         payUserType: null,
       },
@@ -439,9 +444,13 @@ export default {
   //生命周期 - 挂载完成(可以访问DOM元素)
   async mounted() {
     // 获取分部
-
+    try {
+      const res = await getOrganizationCourseUnitPriceSettings({
+        rows: 9999
+      })
+      this.organizationCourseUnitPriceSettings = res.data.rows
+    } catch (error) {}
     this.init();
-    console.log(this.baseInfo)
   },
   computed: {
     payOrderTypeList() {
@@ -473,7 +482,6 @@ export default {
       this.isNew = true;
       this.activeRow = null
       this.userVisible = true;
-      
     },
     newSchoolPay() {
       this.payFormType = "school";
@@ -514,6 +522,20 @@ export default {
       this.payFormType = row.payUserType==='SCHOOL'?'school':'user'
       this.userVisible = true;
     },
+    async chioseStudentSubmited() {
+      try {
+        await this.$confirm('缴费创建完成, 是否立即排课?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+        if (this.$listeners.changeActive) {
+          this.$listeners.changeActive({
+            name: '5'
+          })
+        }
+      } catch (error) {}
+    },
     detelePay(row) {
       let id = row.id;
       this.$confirm(`确定删除该缴费周期?`, "提示", {
@@ -641,12 +663,14 @@ export default {
     onReSet() {
       this.searchForm = { payUserType: null };
     },
-        async payedSubmited(data) {
+    async payedSubmited(data) {
       try {
         await this.getList();
-        this.chioseStudentVisible = true;
-        if (data) {
-          this.musicGroupPaymentCalenderId = data.musicGroupPaymentCalenderId;
+        if (!this.isNewGropu) {
+          this.chioseStudentVisible = true;
+          if (data) {
+            this.musicGroupPaymentCalenderId = data.musicGroupPaymentCalenderId;
+          }
         }
       } catch (error) {}
     },

+ 8 - 5
src/views/resetTeaming/components/studentPayBase.vue

@@ -254,16 +254,19 @@ export default {
           return item.id
         }).join(',')
       }
-      obj.courseFee = this.resetPayForm.momey;
-      if (!obj.courseFee || obj.courseFee < 0) {
-        this.$message.error('请输入正确的金额')
-        return
-      }
+      // obj.courseFee = this.resetPayForm.momey;
+      // if (!obj.courseFee || obj.courseFee < 0) {
+      //   this.$message.error('请输入正确的金额')
+      //   return
+      // }
       resetMusicGroupStudentFee(obj).then(res => {
         if (res.code == 200) {
           this.$message.success('修改成功')
           this.resetPayVisible = false
           this.getList()
+          if (this.$listeners.submited) {
+            this.$listeners.submited()
+          }
         }
       })
     }

+ 6 - 2
src/views/resetTeaming/index.vue

@@ -14,7 +14,7 @@
                      v-if="permission('/resetTeaming/teamBaseInfo')"
                      name="1">
           <teamBaseInfo v-if="activeIndex == 1"
-                        @getBaseInfo="getBaseInfo" 
+                        @getBaseInfo="getBaseInfo"
                         :baseInfo="baseInfo"
                         @getName='getName' />
         </el-tab-pane>
@@ -31,7 +31,11 @@
         <el-tab-pane label="缴费设置"
                      v-if="permission('/resetTeaming/resetPayList')"
                      name="3">
-          <resetPayList :baseInfo="baseInfo" v-if="activeIndex == 3" />
+          <resetPayList
+            :baseInfo="baseInfo"
+            v-if="activeIndex == 3"
+            @changeActive="handleClick"
+          />
         </el-tab-pane>
 
         <el-tab-pane label="班级调整"

+ 21 - 2
src/views/resetTeaming/modals/extra-class.vue

@@ -9,6 +9,8 @@
     >
       <el-table-column
         label="课程类型"
+        prop="courseType"
+        key="courseType"
         width="150">
         <template slot-scope="scope">
           <el-form-item
@@ -21,11 +23,13 @@
               v-model="list.form[scope.$index].courseType"
               placeholder="课程类型"
               clearable
+              @change="$listeners.priceChange(scope.row, scope.$index)"
               :disabled="isDisabled"
             >
               <el-option
                 v-for="(item, index) in courseTypeOptions"
                 :key="index"
+                :disabled="isOptionDisabled(item.value)"
                 :label="item.label"
                 :value="item.value"
               ></el-option>
@@ -36,6 +40,8 @@
       <el-table-column
         label="是否可选"
         v-if="isCommon"
+        prop="isStudentOptional"
+        key="isStudentOptional"
         width="150">
         <template slot-scope="scope">
           <el-form-item
@@ -62,6 +68,8 @@
       </el-table-column>
       <el-table-column
         label="课程时长(分钟)"
+        prop="courseTotalMinuties"
+        key="courseTotalMinuties"
         width="150">
         <template slot-scope="scope">
           <el-form-item
@@ -75,6 +83,7 @@
               v-model="list.form[scope.$index].courseTotalMinuties"
               :controls="false"
               :precision="0"
+              @change="$listeners.priceChange(scope.row, scope.$index)"
               :min="1"
               :disabled="isDisabled"
               placeholder="课程时长"
@@ -84,6 +93,8 @@
       </el-table-column>
       <el-table-column
         label="现价(元)"
+        prop="courseCurrentPrice"
+        key="courseCurrentPrice"
         width="150">
         <template slot-scope="scope">
           <el-form-item
@@ -107,6 +118,8 @@
         </template>
       </el-table-column>
       <el-table-column
+        prop="courseOriginalPrice"
+        key="courseOriginalPrice"
         label="原价(元)">
         <template slot-scope="scope">
           <el-form-item
@@ -117,7 +130,7 @@
               size="small"
               style="width: 90%!important;"
               class="number-input"
-              disabled
+              :disabled="isDisabled"
               v-model="list.form[scope.$index].courseOriginalPrice"
               :controls="false"
               :precision="0"
@@ -129,6 +142,8 @@
       </el-table-column>
       <el-table-column
         v-if="!isCommon"
+        prop="close"
+        key="close"
         width="60">
         <template slot-scope="scope">
           <i v-if="form.length > 1" @click="$listeners.remove(scope.$index)" class="el-icon-circle-close"></i>
@@ -169,9 +184,13 @@ export default {
     change(val) {
       this.$listeners.moneyChange()
     },
+    isOptionDisabled(key) {
+      const selected = this.form.map(item => item.courseType)
+      return selected.includes(key)
+    },
     getOldMoney(index) {
       return numeral(this.list.form[index].courseTotalMinuties * this.list.form[index].unitPrice).format('0,0.00')
-    }
+    },
   },
 }
 </script>

+ 2 - 2
src/views/resetTeaming/modals/user-baseinfo.vue

@@ -54,11 +54,11 @@
     <el-alert
       :closable="false"
       style="margin-left: 160px;width: auto;"
-      v-if="isCommon"
+      v-if="paymentType != 0 && isCommon"
       type="warning">
       <template #title>
         <p>该乐团为3.0模式,若需创建其他模式的收费标准,请先乐团基本信息的乐团模式
-          <strong style="font-weight: 600;margin-left: 10px;cursor: pointer;">立即修改>></strong>
+          <strong style="font-weight: 600;margin-left: 10px;cursor: pointer;" @click="$listeners.changeActive({name: '1'})">立即修改>></strong>
       </p>
       </template>
     </el-alert>

+ 41 - 18
src/views/resetTeaming/modals/user-pay-form.vue

@@ -7,6 +7,7 @@
       :isCommon="isCommon"
       :isUserType="isUserType"
       @getCharges="getCharges"
+      @changeActive="$listeners.changeActive"
       :typeList="typeList"
       :charges="charges"
       :paymentType="paymentType"
@@ -21,10 +22,12 @@
       >
       </el-alert>
       <extraClass
-        :form="eclass"
+        :form.sync="eclass"
         ref="eclass"
+        :organizationCourseUnitPriceSettings="organizationCourseUnitPriceSettings"
         @create="addExtraClass"
         @remove="removeExtraClass"
+        @priceChange="priceChange"
         @moneyChange="syncAllMoney"
       />
     </template>
@@ -55,7 +58,7 @@
     <otherform :form="other" ref="other" />
     <div slot="footer" class="dialog-footer">
       <el-button @click="$listeners.close">取 消</el-button>
-      <el-button type="primary" @click="submit">下一步</el-button>
+      <el-button type="primary" @click="submit">{{paymentType == '0' ? '确认' : '下一步'}}</el-button>
     </div>
     <el-dialog
       :title="nextTitle"
@@ -82,6 +85,7 @@ import paymentCycle from "./payment-cycle";
 import extraClass from "./extra-class";
 import classrooms from "./classrooms";
 import otherform from "./other";
+import baseInfoVue from '../../teamDetail/components/baseInfo.vue';
 
 const paymentTypeFormat = {
   0: "MUSIC_APPLY",
@@ -91,7 +95,7 @@ const paymentTypeFormat = {
 };
 
 export default {
-  props: ["type", "musicGroupId", "baseInfo", "paymentType", "rowDetail"],
+  props: ["type", "musicGroupId", "baseInfo", "paymentType", "rowDetail", 'organizationCourseUnitPriceSettings'],
   components: {
     userBaseinfo,
     paymentCycle,
@@ -137,6 +141,13 @@ export default {
       }
       return data;
     },
+    organizationCourseUnitPriceSettingsByType() {
+      const _ = {}
+      for (const item of this.organizationCourseUnitPriceSettings) {
+        _[item.courseType] = item
+      }
+      return _
+    }
   },
   watch: {
     type() {
@@ -149,16 +160,16 @@ export default {
     baseInfo(val) {
       this.getCharges();
     },
-    "form.leixing"() {
+    "form.leixing"(val) {
       this.cycles = [{}];
       this.collapse = [0];
       this.cycle = {};
-      this.cycle.paymentAmount = "";
-      if (this.form.leixing === "1") {
+      this.$set(this.form, "musicGroupOrganizationCourseSettingId", undefined);
+      this.$set(this.cycle, "paymentAmount", undefined);
+      if (val === "1") {
         this.eclass = [];
-      } else if (this.form.leixing === "2") {
+      } else if (val === "2") {
         this.eclass = [{}];
-        this.$set(this.form, "musicGroupOrganizationCourseSettingId", "");
       }
     },
     "form.musicGroupOrganizationCourseSettingId"(val) {
@@ -173,8 +184,7 @@ export default {
   },
   methods: {
     init() {
-      console.log(this.rowDetail);
-       this.getCharges();
+      this.getCharges();
       if (this.rowDetail) {
         this.form.musicGroupOrganizationCourseSettingId = this.rowDetail.musicGroupOrganizationCourseSettingId;
         this.$set(
@@ -185,12 +195,25 @@ export default {
         this.$set(this.other, "memo", this.rowDetail.memo);
       }
     },
+    priceChange(item, index) {
+      const _ = [...this.eclass]
+      const active = this.organizationCourseUnitPriceSettingsByType[item.courseType] || {}
+      const price = Math.ceil((item.courseTotalMinuties || 1) * (active.unitPrice || 1))
+      item.courseCurrentPrice = price
+      item.courseOriginalPrice = price
+      _[index] = item
+      this.eclass = [..._]
+    },
     syncAllMoney() {
       let money = 0;
       for (const item of this.eclass) {
         money += item.courseCurrentPrice;
       }
-      this.$set(this.cycle, "paymentAmount", money);
+      if (!money) {
+        this.$set(this.cycle, "paymentAmount", undefined);
+      } else {
+        this.$set(this.cycle, "paymentAmount", money);
+      }
       if(this.rowDetail){
           this.$set(
         this.cycle,
@@ -200,12 +223,12 @@ export default {
       let arr = [
         this.rowDetail?.paymentValidStartDate,
         this.rowDetail?.paymentValidEndDate,
-      ]; 
+      ];
       // paymentDate startPaymentDate deadlinePaymentDate
       this.$set(this.cycle, "paymentDate", [ this.rowDetail?.startPaymentDate, this.rowDetail?.deadlinePaymentDate]);
       this.$set(this.cycle, "paymentValid", arr);
       }
-    
+
       return money;
     },
     async getChargeTypeList() {
@@ -227,7 +250,7 @@ export default {
         const eclas = this.chargesById[
           this.form.musicGroupOrganizationCourseSettingId
         ];
-        this.eclass = eclas?.details || [];
+        this.eclass = eclas?.details || [{}];
 
         this.syncAllMoney();
       } catch (error) {}
@@ -298,10 +321,10 @@ export default {
           } catch (error) {}
         } else {
            try {
-          data.id = this.rowDetail.id
-          const res = await musicGroupPaymentCalenderDetailBatchUpdate(data);
-          this.$listeners.close();
-          this.$listeners.submited(res.data);
+            data.id = this.rowDetail.id
+            const res = await musicGroupPaymentCalenderDetailBatchUpdate(data);
+            this.$listeners.close();
+            this.$listeners.submited(res.data);
           } catch (error) {}
         }
       }