salarySet.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div class="salarySet">
  3. <!-- <h4>单次课次参考时长:30min</h4> -->
  4. <div class="tableList">
  5. <div class="left">
  6. <el-table :data='teamTable'
  7. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  8. <el-table-column label="乐团课课酬课时结算">
  9. <template slot-scope="scope">
  10. {{ scope.row.courseScheduleType | coursesType }}
  11. </template>
  12. </el-table-column>
  13. <el-table-column label="默认课酬-主教">
  14. <template slot-scope="scope">
  15. <el-input :disabled="scope.row.courseScheduleType == 'HIGH'" v-model="scope.row.mainTeacher30MinSalary" placeholder="请输入课酬">
  16. <template slot="append" v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  17. <template slot="append" v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  18. <template slot="append" v-else>元/30分钟</template>
  19. </el-input>
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="默认课酬-助教">
  23. <template slot-scope="scope">
  24. <el-input :disabled="scope.row.courseScheduleType == 'HIGH'" v-model="scope.row.assistantTeacher30MinSalary" placeholder="请输入课酬">
  25. <template slot="append" v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  26. <template slot="append" v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  27. <template slot="append" v-else>元/30分钟</template>
  28. </el-input>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="3.0课酬-主教">
  32. <template slot-scope="scope">
  33. <el-input :disabled="scope.row.courseScheduleType == 'CLASSROOM'" v-model="scope.row.mainTeacher90MinSalary" placeholder="请输入课酬">
  34. <template slot="append" v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  35. <template slot="append" v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  36. <template slot="append" v-else>元/90分钟</template>
  37. <!-- <template slot="append">元/{{ (scope.row.courseScheduleType == 'HIGH' || scope.row.courseScheduleType == 'CLASSROOM') ? 45 : 90 }}分钟</template> -->
  38. </el-input>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="3.0课酬-助教">
  42. <template slot-scope="scope">
  43. <el-input :disabled="scope.row.courseScheduleType == 'CLASSROOM'" v-model="scope.row.assistantTeacher90MinSalary" placeholder="请输入课酬">
  44. <template slot="append" v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  45. <template slot="append" v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  46. <template slot="append" v-else>元/90分钟</template>
  47. <!-- <template slot="append">元/{{ (scope.row.courseScheduleType == 'HIGH' || scope.row.courseScheduleType == 'CLASSROOM') ? 45 : 90 }}分钟</template> -->
  48. </el-input>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <el-table :data='vipTable' style="width: 70%; margin-top: 15px;"
  53. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  54. <el-table-column label="VIP课课酬参考值" prop="vipGroupCategoryName">
  55. </el-table-column>
  56. <el-table-column label="线上课">
  57. <template slot-scope="scope">
  58. <el-input v-model="scope.row.onlineClassesSalary" placeholder="请输入内容">
  59. <template slot="append">元/30分钟</template>
  60. </el-input>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="线下课">
  64. <template slot-scope="scope">
  65. <el-input v-model="scope.row.offlineClassesSalary" placeholder="请输入内容">
  66. <template slot="append">元/30分钟</template>
  67. </el-input>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <div style="padding-top: 10px;">
  72. <el-button @click="onSave()" type="primary">保存</el-button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import { vipGroupSalaryList, vipGroupSalarySet, teacherSalaryList, teacherSalaryBatchUpset } from '@/api/teacherManager'
  80. import { sysConfigList } from '@/api/generalSettings'
  81. import { vipGroupCategory } from '@/api/vipSeting'
  82. export default {
  83. props: ['teacherId'],
  84. data () {
  85. return {
  86. // teacherId: this.teacherId ? this.teacherId : this.$route.query.teacherId,
  87. teamTable: [{
  88. assistantTeacher30MinSalary: 0,
  89. assistantTeacher90MinSalary: 0,
  90. courseScheduleType: "SINGLE",
  91. mainTeacher30MinSalary: 0,
  92. mainTeacher90MinSalary: 0,
  93. userId: this.teacherId,
  94. },{
  95. assistantTeacher30MinSalary: 0,
  96. assistantTeacher90MinSalary: 0,
  97. courseScheduleType: "MIX",
  98. mainTeacher30MinSalary: 0,
  99. mainTeacher90MinSalary: 0,
  100. userId: this.teacherId
  101. },{
  102. assistantTeacher30MinSalary: 0,
  103. assistantTeacher90MinSalary: 0,
  104. courseScheduleType: "COMPREHENSIVE",
  105. mainTeacher30MinSalary: 0,
  106. mainTeacher90MinSalary: 0,
  107. userId: this.teacherId
  108. },{
  109. assistantTeacher30MinSalary: 0,
  110. assistantTeacher90MinSalary: 0,
  111. courseScheduleType: "TRAINING_SINGLE",
  112. mainTeacher30MinSalary: 0,
  113. mainTeacher90MinSalary: 0,
  114. userId: this.teacherId
  115. },{
  116. assistantTeacher30MinSalary: 0,
  117. assistantTeacher90MinSalary: 0,
  118. courseScheduleType: "TRAINING_MIX",
  119. mainTeacher30MinSalary: 0,
  120. mainTeacher90MinSalary: 0,
  121. userId: this.teacherId
  122. },{
  123. assistantTeacher30MinSalary: 0,
  124. assistantTeacher90MinSalary: 0,
  125. courseScheduleType: "HIGH",
  126. mainTeacher30MinSalary: 0,
  127. mainTeacher90MinSalary: 0,
  128. userId: this.teacherId
  129. }, {
  130. assistantTeacher30MinSalary: 0,
  131. assistantTeacher90MinSalary: 0,
  132. courseScheduleType: "CLASSROOM",
  133. mainTeacher30MinSalary: 0,
  134. mainTeacher90MinSalary: 0,
  135. userId: this.teacherId
  136. }],
  137. vipTable: [],
  138. musicGroupTable: [],
  139. ruleList: [],
  140. vipList: []
  141. }
  142. },
  143. mounted() {
  144. this.__init()
  145. },
  146. methods: {
  147. __init() {
  148. // 获取课程形态 设置vip课酬
  149. vipGroupCategory({ organId: this.$store.getters.organ }).then(res => {
  150. if (res.code == 200 && res.data.length > 0) {
  151. let vipData = []
  152. res.data.forEach(item => {
  153. vipData.push({
  154. offlineClassesSalary: null,
  155. onlineClassesSalary: null,
  156. vipGroupCategoryId: item.id,
  157. vipGroupCategoryName: item.name,
  158. userId: this.teacherId
  159. })
  160. })
  161. // VIP课列表
  162. vipGroupSalaryList({
  163. rows: 9999,
  164. page: 1,
  165. search: this.teacherId
  166. }).then(res => {
  167. if(res.code == 200) {
  168. let rows = res.data.rows
  169. this.vipListCompare(vipData, rows)
  170. }
  171. })
  172. }
  173. })
  174. // 乐团
  175. teacherSalaryList({
  176. rows: 9999,
  177. page: 1,
  178. teacherId: this.teacherId,
  179. // settlementType: 'FIXED_SALARY'
  180. }).then(res => {
  181. if(res.code == 200) {
  182. // this.teamTable = res.data.rows
  183. let rows = res.data.rows
  184. this.teacherSalaryMoney(rows)
  185. }
  186. })
  187. },
  188. vipListCompare(vipData, rows) { // vip 做对比
  189. if(!rows) { // 判断是否有数据
  190. this.vipTable = vipData
  191. return
  192. }
  193. let result = []
  194. vipData.forEach(item => {
  195. rows.forEach(c => {
  196. if(item.vipGroupCategoryId == c.vipGroupCategoryId) {
  197. item.checked = true
  198. result.push({
  199. vipGroupCategoryId: c.vipGroupCategoryId,
  200. offlineClassesSalary: c.offlineClassesSalary,
  201. onlineClassesSalary: c.onlineClassesSalary,
  202. vipGroupCategoryName: c.vipGroupCategoryName,
  203. userId: c.userId
  204. })
  205. }
  206. })
  207. })
  208. if(result.length > 0) {
  209. vipData.forEach(item => {
  210. if(!item.checked) {
  211. result.push(item)
  212. }
  213. })
  214. } else {
  215. result = vipData
  216. }
  217. this.vipTable = result
  218. },
  219. teacherSalaryMoney(rows) {
  220. // 判断是否有数据
  221. if(!rows || rows.length <= 0) return
  222. let teamTable = this.teamTable
  223. let result = []
  224. teamTable.forEach(item => {
  225. rows.forEach(c => {
  226. if(item.courseScheduleType == c.courseScheduleType) {
  227. item.checked = true
  228. result.push({
  229. mainTeacher30MinSalary: c.mainTeacher30MinSalary,
  230. mainTeacher90MinSalary: c.mainTeacher90MinSalary,
  231. assistantTeacher30MinSalary: c.assistantTeacher30MinSalary,
  232. assistantTeacher90MinSalary: c.assistantTeacher90MinSalary,
  233. courseScheduleType: c.courseScheduleType,
  234. userId: this.teacherId,
  235. })
  236. }
  237. })
  238. })
  239. if(result.length > 0) {
  240. teamTable.forEach(item => {
  241. if(!item.checked) {
  242. result.push(item)
  243. }
  244. })
  245. } else {
  246. result = teamTable
  247. }
  248. this.teamTable = result
  249. },
  250. onSave() {
  251. let teamTable = this.teamTable
  252. let checkStatus = true
  253. teamTable.forEach(item => {
  254. if(item.assistantTeacher30MinSalary < 0 || item.assistantTeacher90MinSalary < 0
  255. || item.mainTeacher30MinSalary < 0 || item.mainTeacher90MinSalary < 0) {
  256. this.$message('输入课酬不能为负数')
  257. checkStatus = false
  258. }
  259. })
  260. this.vipTable.forEach(item => {
  261. if(item.offlineClassesSalary < 0 && item.onlineClassesSalary < 0) {
  262. this.$message('输入课酬不能为负数')
  263. checkStatus = false
  264. }
  265. })
  266. // 判断输入的值是否正确
  267. if(!checkStatus) return false
  268. teacherSalaryBatchUpset(teamTable).then(res => {
  269. if(res.code == 200) {
  270. // 判断输入的值是否正确
  271. // if(!checkStatus) return false
  272. vipGroupSalarySet(this.vipTable).then(res => {
  273. if(res.code == 200) {
  274. this.$message({
  275. message: '保存成功',
  276. type: 'success'
  277. })
  278. // if(this.$route.query.type == 'create') {
  279. this.$router.push('/business/teacherList')
  280. // }
  281. }
  282. })
  283. }
  284. })
  285. }
  286. }
  287. }
  288. </script>
  289. <style lang="scss" scoped>
  290. .salarySet {
  291. h3 {
  292. margin-top: 10px;
  293. margin-bottom: 10px;
  294. font-size: 14px;
  295. color: #444;
  296. font-weight: normal;
  297. }
  298. .tableList {
  299. .left, .right {
  300. float: left;
  301. }
  302. .left {
  303. width: 70%;
  304. margin-right: 2%;
  305. }
  306. .right {
  307. width: 56%;
  308. margin-left: 2%;
  309. }
  310. }
  311. }
  312. /deep/.el-table__body {
  313. tr {
  314. td:nth-child(3) {
  315. border-right: 1px solid #EBEEF5;
  316. }
  317. }
  318. }
  319. /deep/.el-input-group__append {
  320. background-color: #F5F7FA;
  321. color: #909399;
  322. vertical-align: middle;
  323. display: table-cell;
  324. position: relative;
  325. border: 1px solid #DCDFE6;
  326. border-left: 0;
  327. }
  328. </style>