wolyshaw 4 år sedan
förälder
incheckning
0e47e2d531

+ 2 - 2
src/utils/index.js

@@ -155,8 +155,8 @@ export const objectToOptions = data => {
 export const getTimes = (times, keys = []) => {
   if (times && times.length) {
     return {
-      [keys[0] || 'start']: dayjs(times[0]).format('YYYY-MM-DD'),
-      [keys[1] || 'start']: dayjs(times[1]).format('YYYY-MM-DD'),
+      [keys[0] || 'start']: dayjs(times[0]).isValid() ? dayjs(times[0]).format('YYYY-MM-DD') : '',
+      [keys[1] || 'end']: dayjs(times[1]).isValid() ? dayjs(times[1]).format('YYYY-MM-DD') : '',
     }
   }
   return {}

+ 53 - 1
src/views/categroyManager/specialSetup/chargesList.vue

@@ -2,6 +2,42 @@
   <div class='m-container'>
     <!-- <h2>收费类型设置</h2> -->
     <div class="m-core">
+      <el-form :inline="true" :model="searchForm">
+        <el-form-item>
+          <el-select
+            placeholder="请选择分部"
+            v-model="searchForm.organId"
+            clearable
+          >
+            <el-option
+              v-for="(item, index) in branchList"
+              :label="item.label"
+              :value="item.value"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-select
+            placeholder="收费类型"
+            v-model="searchForm.chargeTypeId"
+            clearable
+            filterable
+          >
+            <el-option
+              v-for="(item, index) in typesList"
+              :label="item.label"
+              :value="item.value"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
+        <el-form-item>
+          <el-button type="danger" @click="search">搜索</el-button>
+          <el-button @click="onReSet" type="primary">重置</el-button>
+        </el-form-item>
+      </el-form>
       <div @click="onChargeOperation('create')" v-permission="'chargeTypeOrganizationFee/add'"
            class='newBand'>添加</div>
       <div class="tableWrap">
@@ -96,6 +132,10 @@ export default {
         create: '添加乐团收费标准',
         update: '修改乐团收费标准'
       },
+      searchForm: {
+        organId: null,
+        chargeTypeId: null,
+      },
       chargeStatus: false,
       formLabelWidth: '100px',
       form: {
@@ -156,6 +196,17 @@ export default {
     })
   },
   methods: {
+    search() {
+      this.pageInfo.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.searchForm = {
+        organId: null,
+        chargeTypeId: null,
+      };
+      this.search();
+    },
     onTypesSubmit (formName) { // 添加数据
       this.$refs[formName].validate((valid) => {
         if (valid) {
@@ -209,7 +260,8 @@ export default {
     getList () {
       musicGroupOrganizationCourseSettingsQueryPage({
         rows: this.pageInfo.limit,
-        page: this.pageInfo.page
+        page: this.pageInfo.page,
+        ...this.searchForm
       }).then(res => {
         if (res.code == 200) {
           this.dataList = res.data.rows

+ 54 - 3
src/views/categroyManager/specialSetup/discountManage.vue

@@ -2,6 +2,41 @@
   <div class='m-container'>
     <!-- <h2>折扣设置</h2> -->
     <div class="m-core">
+      <el-form :inline="true" :model="searchForm">
+        <el-form-item>
+          <el-select v-model.trim="form.subjectId"
+                     filterable
+                     placeholder="请选择声部组合"
+                     clearable>
+            <el-option-group v-for="group in subjectList"
+                             :key="group.label"
+                             :label="group.label">
+              <el-option v-for="item in group.options"
+                         :key="item.value"
+                         :label="item.label"
+                         :value="item.value">
+              </el-option>
+            </el-option-group>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-select v-model.trim="form.chargeTypeId"
+                     filterable
+                     placeholder="请选择收费类型"
+                     clearable>
+            <el-option v-for="item in typesList"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+
+        <el-form-item>
+          <el-button type="danger" @click="search">搜索</el-button>
+          <el-button @click="onReSet" type="primary">重置</el-button>
+        </el-form-item>
+      </el-form>
       <div class='newBand' v-permission="'chargeType/upSet'"
            @click="createVisible = true">添加</div>
       <!-- 列表 -->
@@ -87,9 +122,9 @@
             placeholder="请输入折扣 1%-100%"
             controls-position="right"
             class="number-input"
-            :min="1"
+            :min="0"
             :max="100"
-            :precision="0"
+            :precision="2"
           ></el-input-number>
         </el-form-item>
       </el-form>
@@ -140,6 +175,10 @@ export default {
         subjectId: null,
         goodsDiscountRate: null,
       },
+      searchForm: {
+        subjectId: null,
+        chargeTypeId: null,
+      },
       rules: {
         chargeTypeId: [{ required: true, message: '请选择收费类型', trigger: 'blur' }],
         subjectId: [{ required: true, message: '请选择声部组合', trigger: 'change' }],
@@ -160,6 +199,17 @@ export default {
     this.getSubjectTree()
   },
   methods: {
+    search() {
+      this.pageInfo.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.searchForm = {
+        subjectId: null,
+        chargeTypeId: null,
+      };
+      this.search();
+    },
     onTypesSubmit (formName) { // 添加数据
       this.$refs[formName].validate((valid) => {
         if (valid) {
@@ -222,7 +272,8 @@ export default {
     getList () {
       chargeTypeSubjectMapper({
         rows: this.pageInfo.limit,
-        page: this.pageInfo.page
+        page: this.pageInfo.page,
+        ...this.searchForm
       }).then(res => {
         let result = res.data
         this.tableList = result.rows

+ 37 - 21
src/views/categroyManager/specialSetup/modals/chargesForm.vue

@@ -62,8 +62,8 @@
                           clearable
                           @change="() => courseItemChange(item, index)"
                           filterable>
-                <el-option  v-for="item in courseTypes"
-                            :key="item.courseType"
+                <el-option  v-for="(item, i) in courseTypes"
+                            :key="i"
                             :label="courseType[item.courseType]"
                             :disabled="isOptionDisabled(item.courseType)"
                             :value="item.courseType">
@@ -182,6 +182,7 @@ import {
   musicGroupOrganizationCourseSettingsUpdate,
   getOrganizationCourseUnitPriceSettings
 } from '@/api/specialSetting'
+import { queryByMusicGroupOrganizationCourseSettingsId } from '../../../resetTeaming/api'
 import { classTimeList } from '@/utils/searchArray'
 import { courseType, boolOptions } from '@/constant'
 import { objectToOptions }  from '@/utils'
@@ -189,9 +190,10 @@ import numeral from 'numeral'
 
 const plusNum = (items = [], key) => {
   let money = 0
-  const _items = items.filter(item => item.isStudentOptional === 'false')
-  for (const item of _items) {
-    money += parseFloat(parseFloat(item[key] || 0).toFixed(2) || 0)
+  for (const item of items) {
+    if (item) {
+      money += parseFloat(parseFloat(item[key] || 0).toFixed(2) || 0)
+    }
   }
   return money
 }
@@ -230,25 +232,34 @@ export default {
     rowDetail() {
       this.updateForm()
     },
+    async 'form.organId'() {
+      this.FetchOrganizationCourseUnitPriceSettings()
+    },
     async 'form.chargeTypeId'() {
-      try {
-        const res = await getOrganizationCourseUnitPriceSettings({
-          chargeTypeId: this.form.chargeTypeId,
-          rows: 9999
-        })
-        const d = {}
-        this.courseTypes = res.data.rows
-        for (const item of this.courseTypes) {
-          d[item.courseType] = item
-        }
-        this.courseTypesByType = d
-      } catch (error) {}
+      this.FetchOrganizationCourseUnitPriceSettings()
     }
   },
   mounted() {
     this.updateForm()
   },
   methods: {
+    async FetchOrganizationCourseUnitPriceSettings() {
+      try {
+        if (this.form.organId && this.form.chargeTypeId) {
+          const res = await getOrganizationCourseUnitPriceSettings({
+            chargeTypeId: this.form.chargeTypeId,
+            organId: this.form.organId,
+            rows: 9999
+          })
+          const d = {}
+          this.courseTypes = res.data.rows
+          for (const item of this.courseTypes) {
+            d[item.courseType] = item
+          }
+          this.courseTypesByType = d
+        }
+      } catch (error) {}
+    },
     courseItemChange(item, index) {
       if (item.courseType) {
         const active = this.courseTypesByType[item.courseType] || {}
@@ -261,7 +272,7 @@ export default {
         this.$set(this.form, `details`, [..._list])
       }
     },
-    updateForm() {
+    async updateForm() {
       if (this.rowDetail) {
         const { organId, classTimeList, chargeTypeId, name, details } = this.rowDetail
         this.form = {
@@ -269,11 +280,16 @@ export default {
           classTimeList,
           chargeTypeId,
           name,
-          details: details.map(item => ({
+        }
+        try {
+          const res = await queryByMusicGroupOrganizationCourseSettingsId({
+            id: this.rowDetail.id
+          })
+          this.$set(this.form, 'details', res.data.map(item => ({
             ...item,
             isStudentOptional: String(item.isStudentOptional)
-          }))
-        }
+          })))
+        } catch (error) {}
       } else {
         this.form = {...initForm}
       }

+ 8 - 1
src/views/resetTeaming/api.js

@@ -38,4 +38,11 @@ export const musicGroupPaymentCalenderDetailBatchUpdate = data => request2({
   url: '/api-web/musicGroupPaymentCalender/update',
   data: data,
   method: 'post',
-})
+})
+
+export const queryByMusicGroupOrganizationCourseSettingsId = data => request2({
+  url: '/api-web/musicGroupOrganizationCourseSettingsDetail/queryByMusicGroupOrganizationCourseSettingsId',
+  data: {},
+  params: data,
+  method: 'get'
+})

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

@@ -79,6 +79,7 @@ import {
 import {
   musicGroupPaymentCalenderAdd,
   musicGroupPaymentCalenderDetailBatchUpdate,
+  queryByMusicGroupOrganizationCourseSettingsId,
 } from "../api";
 import { getTimes } from "@/utils";
 import userBaseinfo from "./user-baseinfo";
@@ -174,8 +175,17 @@ export default {
         this.eclass = [];
       }
     },
-    "form.musicGroupOrganizationCourseSettingId"(val) {
-      this.getCharges();
+    async "form.musicGroupOrganizationCourseSettingId"(val) {
+      try {
+        const res = await queryByMusicGroupOrganizationCourseSettingsId({
+          id: val
+        })
+        this.eclass = res.data.filter(item => {
+          return !item.isStudentOptional || this.paymentType !== undefined
+        }) || [{}];
+
+        this.syncAllMoney();
+      } catch (error) {}
     },
   },
   mounted() {
@@ -242,23 +252,16 @@ export default {
       } catch (error) {}
     },
     async getCharges() {
+      const organId = this.baseInfo?.musicGroup?.organId;
       const chargeTypeId = this.baseInfo?.musicGroup?.chargeTypeId;
       this.chargeTypeName = this.baseInfo?.musicGroup?.chargeTypeName;
       try {
         const res = await musicGroupOrganizationCourseSettingsQueryPage({
           row: 9999,
           chargeTypeId,
+          organId,
         });
         this.charges = res.data.rows;
-        const eclas = this.chargesById[
-          this.form.musicGroupOrganizationCourseSettingId
-        ];
-        this.eclass = eclas?.details.filter(item => {
-          console.log({...item}, this.paymentType)
-          return !item.isStudentOptional || this.paymentType !== undefined
-        }) || [{}];
-
-        this.syncAllMoney();
       } catch (error) {}
     },
     addExtraClass() {

+ 2 - 2
vue.config.js

@@ -19,9 +19,9 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // let target = 'https://online.dayaedu.com' //线上
 // let target = 'http://dyme.utools.club' //test环境
 // let target = 'http://192.168.3.139:8000' // 箭河
-// let target = 'http://192.168.3.248:8000' //邹璇
+let target = 'http://192.168.3.16:8000' //邹璇
 // let target = 'http://192.168.3.204:8000' //勇哥
-let target = 'http://dev.dayaedu.com' // 测试服
+// let target = 'http://dev.dayaedu.com' // 测试服
 // let target = 'http://192.168.3.196' // 乔
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {