vipChargeSeting.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>VIP/乐理课程收费设置
  5. </h2>
  6. <div class="m-core">
  7. <save-form :inline="true"
  8. ref="searchForm"
  9. class="searchForm"
  10. @submit="search"
  11. :model.sync="searchForm">
  12. <el-form-item prop='organId'>
  13. <el-select class='multiple'
  14. style="width:180px!important"
  15. v-model.trim="searchForm.organId"
  16. filterable
  17. placeholder="请选择分部">
  18. <el-option v-for="(item,index) in selects.branchs"
  19. :key="index"
  20. :label="item.name"
  21. :value="item.id"></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button native-type="submit"
  26. type="primary">搜索</el-button>
  27. </el-form-item>
  28. </save-form>
  29. <div class="tableWrap">
  30. <el-table :data="dataList"
  31. style="width:100% !important;"
  32. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  33. <el-table-column prop="name"
  34. label="课程形式">
  35. </el-table-column>
  36. <el-table-column prop="onlineClassesUnitPrice"
  37. label="线上课单价">
  38. <template slot-scope="scope">
  39. <div>
  40. <el-input v-model.trim="scope.row.onlineClassesUnitPrice"></el-input>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="offlineClassesUnitPrice"
  45. label="线下课单价">
  46. <template slot-scope="scope">
  47. <div>
  48. <el-input v-model.trim="scope.row.offlineClassesUnitPrice"></el-input>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="操作">
  53. <template slot-scope="scope">
  54. <div>
  55. <el-button type="text" v-if="$helpers.permission('vipGroupDefaultClassesUnitPrice/add')"
  56. @click="saveSeting(scope.row)">保存</el-button>
  57. </div>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import { vipGroupCategory, defaultClassesUnitPrice } from '@/api/vipSeting'
  67. import { getEmployeeOrgan } from '@/api/buildTeam'
  68. import { Searchs } from '@/helpers'
  69. export default {
  70. name: 'vipChargeSeting',
  71. data () {
  72. return {
  73. dataList: [],
  74. organList: [],
  75. searchForm: {
  76. organId: null
  77. }
  78. }
  79. },
  80. async mounted () {
  81. // 获取课程形态 设置vip课酬
  82. // 获取分部
  83. await this.$store.dispatch('setBranchs')
  84. // 获取缓存的分部编号
  85. const searchs = new Searchs(this.$route.fullPath)
  86. const branchId = searchs.searchs[searchs.key]?.form.organId
  87. this.searchForm.organId = branchId ? branchId : this.selects?.branchs[0]['id']
  88. this.search()
  89. },
  90. methods: {
  91. search () {
  92. this.$refs.searchForm.validate(valid => {
  93. this.getList()
  94. })
  95. },
  96. getList () {
  97. vipGroupCategory({ organId: this.searchForm.organId }).then(res => {
  98. if (res.code == 200) {
  99. this.dataList = res.data;
  100. }
  101. })
  102. },
  103. saveSeting (row) {
  104. defaultClassesUnitPrice({
  105. offlineClassesUnitPrice: row.offlineClassesUnitPrice,
  106. onlineClassesUnitPrice: row.onlineClassesUnitPrice,
  107. organId: this.searchForm.organId,
  108. vipGroupCategoryId: row.id
  109. }).then(res => {
  110. if (res.code == 200) {
  111. // 保存成功提示=> 刷新列表
  112. this.$message.success('保存成功')
  113. } else {
  114. // 保存失败
  115. this.$message.error('保存失败,请重试');
  116. }
  117. })
  118. }
  119. },
  120. }
  121. </script>
  122. <style lang="scss">
  123. </style>