Browse Source

store 添加

wolyshaw 4 years ago
parent
commit
c71523bd30

+ 3 - 2
src/views/resetTeaming/api.js

@@ -55,8 +55,9 @@ export const makesureSchoolePaid = data => request2({
 })
 
 export const queryByOrganIdAndCourseType = data => request2({
-  url: '/organizationCourseDurationSettings/queryByOrganIdAndCourseType',
-  data,
+  url: '/api-web/organizationCourseDurationSettings/queryByOrganIdAndCourseType',
+  data: {},
+  params: data,
   method: 'get',
   requestType: 'form'
 })

+ 13 - 0
src/views/resetTeaming/modals/extra-class.vue

@@ -173,6 +173,8 @@ import { courseType, boolOptions } from '@/constant'
 import { objectToOptions } from '@/utils'
 import { classTimeList, array2object } from '@/utils/searchArray'
 import numeral from 'numeral'
+import MusicStore from '@/views/resetTeaming/store'
+import { queryByOrganIdAndCourseType } from '../api'
 export default {
   props: ['form', 'isCommon', 'isDisabled', 'isUserType', 'courseUnitPriceSettingsByType', 'clearable'],
   data() {
@@ -184,12 +186,23 @@ export default {
   },
   computed: {
     list() {
+      console.log(this.prices)
       return {
         form: this.form
       }
     },
     classTimeList() {
       return array2object(classTimeList)
+    },
+    async prices() {
+      let list = []
+      try {
+        const res = await queryByOrganIdAndCourseType({
+          organId: MusicStore.state.musicGroup.organId
+        })
+        list = res.data
+      } catch (error) {}
+      return list
     }
   },
   methods: {

+ 12 - 11
src/views/resetTeaming/modals/user-pay-form.vue

@@ -148,6 +148,7 @@ import classrooms from "./classrooms";
 import otherform from "./other";
 import baseInfoVue from '../../teamDetail/components/baseInfo.vue';
 import merge from 'webpack-merge'
+import MusicStore from '@/views/resetTeaming/store'
 
 const paymentTypeFormat = {
   0: "MUSIC_APPLY",
@@ -192,6 +193,9 @@ export default {
     };
   },
   computed: {
+    musicGroup() {
+      return MusicStore.state.musicGroup
+    },
     isCommon () {
       return this.form.leixing === "1";
     },
@@ -211,12 +215,6 @@ export default {
       }
       return data;
     },
-    organId() {
-      if (this.baseInfo && this.baseInfo.musicGroup) {
-        return this.baseInfo.musicGroup.organId
-      }
-      return ''
-    },
     paymentAmountDisabled() {
       return (this.isUserType || (this.isCommon && this.isUserType)) && this.isDisabled
     },
@@ -282,6 +280,9 @@ export default {
   },
   mounted () {
     this.formatCourse()
+    MusicStore.dispatch('getBaseInfo', {
+      data: { musicGroupId: this.musicGroupId }
+    })
     this.init();
   },
   activated () {
@@ -337,8 +338,8 @@ export default {
       }
     },
     formatCourse() {
-      const organId = this.baseInfo?.musicGroup?.organId
-      const chargeTypeId = this.baseInfo?.musicGroup?.chargeTypeId
+      const organId = this.musicGroup?.organId
+      const chargeTypeId = this.musicGroup?.chargeTypeId
       const _ = {}
       const list = (this.organizationCourseUnitPriceSettings || [])
         .filter(item => organId && organId == item.organId && chargeTypeId && chargeTypeId == item.chargeTypeId)
@@ -409,9 +410,9 @@ export default {
       } catch (error) { }
     },
     async getCharges () {
-      const organId = this.baseInfo?.musicGroup?.organId;
-      const chargeTypeId = this.baseInfo?.musicGroup?.chargeTypeId;
-      this.chargeTypeName = this.baseInfo?.musicGroup?.chargeTypeName;
+      const organId = this.musicGroup?.organId;
+      const chargeTypeId = this.musicGroup?.chargeTypeId;
+      this.chargeTypeName = this.musicGroup?.chargeTypeName;
       try {
         const res = await musicGroupOrganizationCourseSettingsQueryPage({
           row: 9999,