Procházet zdrojové kódy

Merge branch 'paying' into online

wolyshaw před 4 roky
rodič
revize
38fa7b3070

+ 41 - 7
src/api/buildTeam.js

@@ -252,7 +252,7 @@ export function setTeamTeacher (data) {
   })
 }
 
-// // 获取所有的节假日 
+// // 获取所有的节假日
 // export function getHolidays (data) {
 //   return request({
 //     url: '/jiari/',
@@ -723,7 +723,7 @@ export function getEmployeeOrgan (data) {
   })
 }
 
-// 
+//
 export function pushMessage (data) {
   return request({
     url: api + '/musicGroup/pushMessage',
@@ -751,7 +751,7 @@ export function findSubjectPlan (data) {
 }
 
 // 根据部门id获取部门下的员工
-//删除乐团所有未上课时 
+//删除乐团所有未上课时
 export function deteleAllCourse (data) {
   return request({
     url: api + `/courseSchedule/batchDeleteMusicGroupNotStartCourse`,
@@ -786,7 +786,7 @@ export function checkSetSalary (data) {
   })
 }
 
-// 获取节假日 
+// 获取节假日
 export function getHoliday (data) {
   return request({
     url: api + `/classGroupStudent/queryHoliday`,
@@ -1027,7 +1027,7 @@ export function cleanAttendance (data) {
   })
 }
 
-// 批量加网管课  
+// 批量加网管课
 export function batchAddCourses (data) {
   return request({
     url: api + '/courseSchedule/batchAddCourses',
@@ -1089,7 +1089,7 @@ export function getVipGroup (data) {
     params: data
   })
 }
-//  评论详情 
+//  评论详情
 export function getReviewsInfo (data) {
   return request({
     url: api + '/practiceGroupManage/getReviewsInfo',
@@ -1278,4 +1278,38 @@ export function batchPracticeGroupTeacherAdjust (data) {
     method: 'post',
     data: qs.stringify(data)
   })
-}
+}
+
+// 获取报名缴费详情
+export function getStudentOriginal(data) {
+  return request({
+    url: api + '/subjectChange/getStudentOriginal',
+    method: 'get',
+    params: data
+  })
+}
+
+
+export function getSubjectGoodsAndInfo(data) {
+  return request({
+    url:  api + '/subjectChange/getSubjectGoodsAndInfo',
+    method: 'get',
+    params: data
+  })
+}
+
+export function subjectChangeAdd (data) {
+  return request({
+    url: api + '/subjectChange/add',
+    method: 'post',
+    params: data,
+  })
+}
+
+export function subjectChangeCancel (data) {
+  return request({
+    url: api + '/subjectChange/cancel',
+    method: 'post',
+    params: data
+  })
+}

+ 1 - 2
src/utils/utils.js

@@ -10,7 +10,6 @@ export const formatData = (times, keys, format = 'YYYY-MM-DD') => {
   return data
 }
 
-
 export const getNowDateAndMonday=(time)=> {
   let timestamp = new Date(time.replace(/-/g, "/")).getTime();
   let serverDate = new Date(time);
@@ -60,4 +59,4 @@ export const getNowDateAndSunday=(time) =>{
       : SundayData.getDate();
   let str = tomorrowY + "-" + tomorrowM + "-" + tomorrowD;
   return str;
-}
+}

+ 2 - 1
src/utils/vueFilter.js

@@ -604,7 +604,8 @@ Vue.filter('teamPayStatus', value => {
   }
   return tpl[value]
 })
+
 // 金额格式化
 Vue.filter('moneyFormat', value => {
   return numeral(value).format('0,0.00')
-})
+})

+ 2 - 2
src/views/teamBuild/components/teamBaseInfo.vue

@@ -655,7 +655,7 @@ import {
   getEmployeeOrgan,
 } from "@/api/buildTeam";
 import { findTechnician } from "@/api/repairManager";
-import dayjs from "dayjs";
+import dayjs from 'dayjs'
 import {
   queryEmployByOrganId,
   queryByOrganId,
@@ -1459,7 +1459,7 @@ export default {
           margin-right: 10px;
           outline: none;
         }
-        
+
       }
       .inputWrap.rightFirst {
         margin-left: 245px;

+ 138 - 0
src/views/teamBuild/modals/accessories.vue

@@ -0,0 +1,138 @@
+<template>
+  <div>
+    <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
+    <el-checkbox-group class="options" v-if="groupOptions.length" v-model="checkeds" @change="optionChange">
+      <el-checkbox class="option" v-for="item in groupOptions" :label="item.id" :key="item.id">
+        <strong>
+          <span>{{item.name}}</span>
+          <span>{{item.price}}元</span>
+        </strong>
+        <p v-for="sub in item.subs" :key="sub">{{sub}}</p>
+      </el-checkbox>
+    </el-checkbox-group>
+    <el-checkbox-group class="options" v-else v-model="checkeds" @change="optionChange">
+      <el-checkbox class="option" v-for="item in list" :label="item.id" :key="item.id">
+        <strong>
+          <span>{{item.name}}</span>
+          <span>{{item.groupPurchasePrice > 0 ? item.groupPurchasePrice + ' 元' : '免费'}}</span>
+        </strong>
+      </el-checkbox>
+    </el-checkbox-group>
+  </div>
+</template>
+<script>
+  export default {
+    props: ['list', 'groupList'],
+    data() {
+      return {
+        type: 'list',
+        checkAll: false,
+        checkeds: [],
+        accessoriesByid: {},
+        groupListById: {},
+        selectMoney: 0,
+        isIndeterminate: false
+      };
+    },
+    watch: {
+      checkeds(vals) {
+        const optionsById = this.type === 'list' ? this.accessoriesByid : this.groupListById
+        let selectMoney = 0
+        if (this.type === 'list') {
+          for (const item of vals) {
+            const activeItem = this.accessoriesByid[item]
+            if (activeItem) {
+              selectMoney += parseFloat(activeItem.groupPurchasePrice)
+            }
+          }
+        } else {
+          for (const item of vals) {
+            const activeItem = this.groupListById[item]
+            if (activeItem) {
+              selectMoney += parseFloat(activeItem.price)
+            }
+          }
+        }
+        let formatids = []
+        if (this.type !== 'list') {
+          for (const item of vals) {
+            const active = this.groupListById[item]
+            if (active) {
+              const { goodsList } = this.groupListById[item]
+              formatids = formatids.concat((goodsList || []).map(goods => goods.id))
+            }
+          }
+        }
+        this.$listeners.change(formatids, selectMoney)
+      }
+    },
+    mounted() {
+      this.$nextTick(() => {
+        const accessoriesByid = {}
+        for (const item of this.list) {
+          accessoriesByid[item.id] = item
+        }
+        const groupListById = {}
+        for (const item of this.groupList) {
+          groupListById[item.id] = item
+        }
+        this.accessoriesByid = accessoriesByid
+        this.groupListById = groupListById
+      })
+    },
+    computed: {
+      groupOptions() {
+        console.log(this.groupList)
+        const options = this.groupList.map(item => ({
+          name: item.name,
+          price:item.price,
+          id: item.id,
+          subs: item.goodsList ? item.goodsList.map(sub => sub.name) : []
+        }))
+        if (options.length) {
+          this.type = 'group'
+        }
+        return options
+      }
+    },
+    methods: {
+      handleCheckAllChange(val) {
+        const options = this.type === 'list' ? this.list : this.groupOptions
+        const allids = options.map(item => item.id)
+        this.checkeds = val ? allids : [];
+        this.isIndeterminate = false;
+      },
+      optionChange(value) {
+        const options = this.type === 'list' ? this.list : this.groupOptions
+        const checkedCount = value.length;
+        this.checkAll = checkedCount === options.length;
+        this.isIndeterminate = checkedCount > 0 && checkedCount < options.length;
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  .options {
+    display: block;
+    .option{
+      display: flex;
+      width: 100%;
+      margin-top: 10px;
+      /deep/ .el-checkbox__label{
+        flex: 1;
+        >strong{
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+          >span:last-child{
+            color: red;
+          }
+        }
+        >p{
+          line-height: 1.8;
+          color: #606266;
+        }
+      }
+    }
+  }
+</style>

+ 338 - 0
src/views/teamBuild/modals/change-voice.vue

@@ -0,0 +1,338 @@
+<template>
+  <div>
+    <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+      <el-form-item label="原乐器" prop="name">
+        <span>{{originalMusicalGoods}}</span>
+      </el-form-item>
+      <el-form-item label="原教辅" prop="name">
+        <span>{{originalAccessoriesGoods}}</span>
+      </el-form-item>
+      <el-form-item label="更改声部" prop="name">
+        <el-select
+          style="width: 100%!important"
+          v-model="form.subjectId"
+          clearable
+          v-if="!detail.subjectChange"
+          @change="subjectChange"
+          placeholder="请选择声部"
+        >
+          <el-option
+            v-for="item in voiceList"
+            :key="item.subjectId"
+            :label="item.subjectName"
+            :value="item.subjectId">
+          </el-option>
+        </el-select>
+        <span v-else>{{detail.subjectName}}</span>
+      </el-form-item>
+      <el-form-item label="更改乐器" prop="name">
+        <el-select
+          style="width: 100%!important"
+          v-model="form.musicalGoods"
+          clearable
+          v-if="!detail.subjectChange"
+          @change="musicalGoodsChange"
+          placeholder="请选择乐器"
+        >
+          <el-option
+            v-for="item in musicalGoods"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select>
+        <span v-else-if="detail.subjectChange.changeAccessoriesGoods">{{detail.subjectChange.changeAccessoriesGoods.name}}</span>
+      </el-form-item>
+      <el-form-item v-if="(activeAccessories.length || groupList.length) || detail.subjectChange" label="更换教辅" prop="name">
+        <accessories
+          :list.sync="activeAccessories"
+          :groupList.sync="groupList"
+          @change="accessoriesChange"
+          v-if="!detail.subjectChange"
+        />
+        <span v-else-if="detail.subjectChange.changeAccessoriesGoods">{{changeAccessoriesGoods}}</span>
+        <!-- <el-select style="width: 100%" v-model="form.accessories" clearable placeholder="请选择教辅">
+          <el-option
+            v-for="item in accessories"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select> -->
+      </el-form-item>
+      <el-form-item label="支付差价" prop="name">
+        <span style="color: red;" v-if="!detail.subjectChange">{{ spread }}元</span>
+        <span style="color: red;" v-else>{{ editSpread }}元</span>
+      </el-form-item>
+    </el-form>
+    <div
+      slot="footer"
+      class="dialog-footer"
+      style="text-align: right;"
+    >
+      <el-button
+        @click="$listeners.close"
+      >取 消</el-button>
+      <el-button
+        @click="cancel"
+        type="danger"
+        v-if="detail.subjectChange"
+      >取消订单</el-button>
+      <el-button
+        type="primary"
+        v-else
+        @click="submit"
+      >确 定</el-button>
+    </div>
+  </div>
+</template>
+<script>
+import { getStudentOriginal, getSubjectGoodsAndInfo, subjectChangeAdd, subjectChangeCancel } from '@/api/buildTeam'
+import accessories from './accessories'
+
+const formatAllGoods = (data, kitGroupPurchaseType) => {
+
+  const accessories = []
+  const accessoriesById = {}
+  const musicalGoods = []
+  const musicalGoodsById = {}
+  const groupList = []
+  const groupListById = {}
+
+  const accessoriesByGoods = {}
+
+  if (data) {
+    const { musicGroupSubjectGoodsGroupList } = data
+
+    const types = {}
+
+    for (const item of musicGroupSubjectGoodsGroupList) {
+      if (!types[item.type]) {
+        types[item.type] = []
+      }
+      types[item.type].push(item)
+    }
+
+    const typesKeys = Object.keys(types)
+
+    for (const key of typesKeys) {
+      for (const item of types[key]) {
+        if (key === 'INSTRUMENT') {
+          let json = {}
+          try {
+            json = JSON.parse(item.kitGroupPurchaseTypeJson)
+          } catch (error) {}
+          const _item = {
+            ...item,
+            kitGroupPurchaseTypePrice: json[kitGroupPurchaseType]
+          }
+          musicalGoods.push(_item)
+          musicalGoodsById[item.id] = _item
+          if (!types.ACCESSORIES) {
+            if (!accessoriesByGoods[item.id]) {
+              accessoriesByGoods[item.id] = []
+            }
+            const acs = item.goodsList[0].goodsList ? item.goodsList[0].goodsList : []
+            for (const goods of acs) {
+              accessoriesByGoods[item.id].push(goods)
+              accessoriesById[goods.id] = goods
+            }
+          }
+        } else if (item.type === 'ACCESSORIES') {
+          groupList.push(item)
+          groupListById[item.id] = item
+        }
+      }
+    }
+  }
+
+  return {
+    accessories,
+    accessoriesById,
+    musicalGoods,
+    musicalGoodsById,
+    groupList,
+    groupListById,
+    accessoriesByGoods
+  }
+}
+
+export default {
+  props: ['detail', 'musicGroupId', 'voiceList'],
+  components: {
+    accessories
+  },
+  data() {
+    return {
+      oldAllMoney: 0,
+      accessories: [],
+      accessoriesByid: {},
+      musicalGoods: [],
+      musicalGoodsById: {},
+      groupList: [],
+      groupListById: {},
+      accessoriesByGoods: {},
+      selectAccessories: [],
+      selectAccessoriesMoney: 0,
+      kitGroupPurchaseTypePrice: 0,
+      form: {
+        subjectId: '',
+        accessories: '',
+        musicalGoods: '',
+      },
+      rules: {},
+      item: {},
+      originalMusicalGoods: '',
+      originalAccessoriesGoods: '',
+      originalAccessoriesPrice: 0,
+      originalMusicalPrice: 0,
+      originalCourseFee: 0,
+      musicGroupSubjectPlanFee: 0,
+      musicalPrice: 0,
+    }
+  },
+  watch: {
+    detail() {
+      if (this.detail) {
+        console.log(this.detail, this.voiceList)
+        this.fetchDetail()
+      }
+    },
+  },
+  computed: {
+    activeAccessories() {
+      const { musicalGoods } = this.form
+      return musicalGoods ? this.accessoriesByGoods[musicalGoods] || [] : []
+    },
+    changeAccessoriesGoods() {
+      let names = []
+      const { subjectChange } = this.detail
+      if (subjectChange && subjectChange.changeAccessoriesGoods && subjectChange.changeAccessoriesGoods.goodsList) {
+        for (const item of subjectChange.changeAccessoriesGoods.goodsList) {
+          names.push(item.name)
+        }
+      }
+      return names.join(',')
+    },
+    editSpread() {
+      const data = this.item
+      const payed = (data.originalAccessoriesPrice || 0) + (data.originalCourseFee || 0) + (data.originalMusicalPrice || 0)
+      return (data.changeMusicalPrice || 0) + (data.changeAccessoriesPrice || 0) + (data.changeCourseFee || 0) - payed
+    },
+    spread() {
+      return (
+        this.musicalPrice +
+        this.selectAccessoriesMoney +
+        this.musicGroupSubjectPlanFee -
+        this.originalAccessoriesPrice -
+        this.originalMusicalPrice -
+        this.originalCourseFee -
+        this.kitGroupPurchaseTypePrice
+      )
+    }
+  },
+  mounted() {
+    if (this.detail) {
+      this.fetchDetail()
+    }
+  },
+  methods: {
+    fetchDetail() {
+      getStudentOriginal({
+        musicGroupId: this.musicGroupId,
+        studentId: this.detail.studentId,
+      })
+      .then(res => {
+        const { data } = res
+        this.item = data
+        if (data) {
+          this.originalAccessoriesPrice = data.originalAccessoriesPrice
+          this.originalMusicalPrice = data.originalMusicalPrice
+          this.originalCourseFee = data.originalCourseFee
+          this.originalMusicalGoods = data.originalMusicalGoods && data.originalMusicalGoods.name
+          this.originalAccessoriesGoods = (data.originalAccessoriesGoods || []).map(item => item.name).join()
+        }
+      })
+    },
+    subjectChange(id) {
+      this.$set(this.form, 'musicalGoods', '')
+      getSubjectGoodsAndInfo({
+        musicGroupId: this.musicGroupId,
+        subjectId: id,
+      })
+      .then(res => {
+        this.musicGroupSubjectPlanFee = res.data.musicGroupSubjectPlan.fee
+        const items = formatAllGoods(res.data, this.item.kitGroupPurchaseType)
+        for (const key in items) {
+          if (items.hasOwnProperty(key)) {
+            const item = items[key]
+            this[key] = item
+          }
+        }
+      })
+    },
+    musicalGoodsChange(val) {
+      const item = this.musicalGoodsById[val]
+      console.log(item)
+      this.musicalPrice = this.numFormat(item.price)
+      this.kitGroupPurchaseTypePrice = this.numFormat(item.kitGroupPurchaseTypePrice)
+    },
+    accessoriesChange(ids, money) {
+      console.log(ids, money)
+      this.selectAccessories = ids
+      this.selectAccessoriesMoney = money
+    },
+    numFormat(num) {
+      let _num = parseFloat(num)
+      if (isNaN(_num)) {
+        _num = 0
+      }
+      return Math.floor(_num * 100) / 100
+    },
+    submit() {
+      subjectChangeAdd({
+        changeCourseFee: this.numFormat(this.musicGroupSubjectPlanFee),
+        changeAccessories: this.selectAccessories.join(','),
+        changeAccessoriesPrice: this.numFormat(this.selectAccessoriesMoney),
+        changeMusicalPrice: this.numFormat(this.musicalPrice - this.kitGroupPurchaseTypePrice),
+        originalCourseFee: this.originalCourseFee,
+        originalMusicalPrice: this.originalMusicalPrice,
+        originalMusical: this.item.originalMusical,
+        originalAccessories: this.item.originalAccessories,
+        originalAccessoriesPrice: this.originalAccessoriesPrice,
+        cooperationOrganId: this.item.cooperationOrganId,
+        kitGroupPurchaseType: this.item.kitGroupPurchaseType,
+        musicGroupId: this.musicGroupId,
+        studentId: this.detail.studentId,
+        changeMusical: this.form.musicalGoods,
+        originalCost: this.item.originalCost,
+        organId: this.item.organId,
+        originalSubjectId: this.detail.actualSubjectId,
+        changeSubjectId: this.form.subjectId,
+      })
+        .then(res => {
+          this.$listeners.close()
+          this.$message.success('提交成功!')
+        })
+    },
+    cancel() {
+      this.$confirm('是否确认取消订单?', '提示', {
+        onfirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+      .then(() => {
+        subjectChangeCancel({
+          id: this.detail.subjectChange.id
+        })
+        .then(res => {
+          this.$message.success('取消成功!')
+        })
+      })
+    }
+  },
+}
+</script>
+<style lang="less" scoped>
+
+</style>

+ 31 - 3
src/views/teamBuild/signupList.vue

@@ -185,7 +185,7 @@
           </el-table-column>
           <el-table-column label="操作"
                            fixed='right'
-                           width="200"
+                           width="240"
                            align='center'>
             <template slot-scope="scope">
               <div>
@@ -216,6 +216,8 @@
                 <el-button type="text"
                            v-if="permission('visit/add')"
                            @click="addVisit(scope.row)">新增回访</el-button>
+                <el-button type="text"
+                           @click="openChangeVoice(scope.row)">更改声部</el-button>
               </div>
             </template>
           </el-table-column>
@@ -505,6 +507,21 @@
                    @click="submitAddVisit">确 定</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="更改声部"
+      :visible.sync="changeVoiceVisible"
+      @close="closeChangeVoice"
+      :destroy-on-close="true"
+      width="500px"
+    >
+      <changeVoice
+        @close="closeChangeVoice"
+        @submited="closeChangeVoice"
+        :detail.sync="rowDetail"
+        :musicGroupId="id"
+        :voiceList="leftList"
+      />
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -521,15 +538,19 @@ import load from '@/utils/loading'
 import qs from 'qs'
 import { permission } from "@/utils/directivePage";
 import cleanDeep from 'clean-deep'
+import changeVoice from './modals/change-voice'
 export default {
   name: 'signupList',
   components: {
-    pagination
+    pagination,
+    changeVoice,
   },
   data () {
     return {
       multipleSelection: [], //
       isEdit: false,
+      rowDetail: null,
+      changeVoiceVisible: false,
       subjectVisible: false,
       orderVisible: false,
       quitVisible: false,
@@ -1078,12 +1099,19 @@ export default {
       // row.typeVisible = false;
     },
     addVisit (row) {
-      console.log(row)
       this.visitForm.studentName = row.studentName;
       this.visitForm.musicGroupId = this.teamid
       this.visitForm.studentId = row.studentId
       this.visitVisiable = true;
     },
+    openChangeVoice(row) {
+      this.rowDetail = {...row}
+      this.changeVoiceVisible = true
+    },
+    closeChangeVoice() {
+      this.changeVoiceVisible = false
+      // this.rowDetail = null
+    },
     handleChange (val) {
       this.visitForm.type = val[0]
       this.visitForm.purpose = val[1]

+ 2 - 2
vue.config.js

@@ -18,10 +18,10 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // //  https://online.dayaedu.com
 // 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.139:8000' // 箭河
 // let target = 'http://192.168.3.28:8000' //邹璇
 // let target = 'http://192.168.3.8:8000' //勇哥
-let target = 'http://dev.dayaedu.com' // 测试服
+// let target = 'http://dev.dayaedu.com' // 测试服
 // let target = 'http://192.168.3.196:8080' // 乔
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {