settlement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div>
  3. <div class="headWrap">
  4. <div class="left">
  5. <div class="headItem">
  6. <p>未结算总额:<span>{{ teacherNoPay| moneyFormat}}</span></p>
  7. </div>
  8. </div>
  9. </div>
  10. <save-form :inline="true"
  11. :model="searchForm" @submit="search" @reset="onReSet" save-key='teacherDetail-settlement'>
  12. <el-form-item>
  13. <el-date-picker v-model.trim="searchForm.courseDate"
  14. style="width: 400px;"
  15. type="daterange"
  16. value-format="yyyy-MM-dd"
  17. range-separator="至"
  18. start-placeholder="课程开始日期"
  19. end-placeholder="课程结束日期"
  20. :picker-options="{
  21. firstDayOfWeek: 1
  22. }">
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-select v-model.trim="searchForm.courseScheduleType"
  27. filterable
  28. clearable
  29. placeholder="课程类型">
  30. <el-option v-for="(item, index) in courseType"
  31. :key="index"
  32. :label="item.label"
  33. :value="item.value"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-select v-model.trim="searchForm.signInStatus"
  38. clearable
  39. filterable
  40. placeholder="考勤状态">
  41. <el-option v-for="(item, index) in attendance"
  42. :key="index"
  43. :label="item.label"
  44. :value="item.value"></el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button native-type="submit"
  49. type="danger">搜索</el-button>
  50. <el-button native-type="reset"
  51. type="primary">重置</el-button>
  52. </el-form-item>
  53. </save-form>
  54. <div class="tableWrap">
  55. <el-table :data="tableList"
  56. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  57. <el-table-column label="上课时间"
  58. align="center"
  59. width="200">
  60. <template slot-scope="scope">
  61. {{ scope.row.classDate + ' ' + (scope.row.classTime.substring(0,5)) }}
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="班级名称"
  65. prop="className">
  66. </el-table-column>
  67. <el-table-column label="课程类型">
  68. <template slot-scope="scope">
  69. {{ scope.row.courseScheduleType | coursesType }}
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="上课类型">
  73. <template slot-scope="scope">
  74. {{ scope.row.teacherRole | workType }}
  75. </template>
  76. </el-table-column>
  77. <!-- <el-table-column label="当前课次"
  78. prop="currentClassTimes">
  79. <template slot-scope="scope">
  80. <div>
  81. {{ scope.row.currentClassTimes + '/' +scope.row.totalClassTimes }}
  82. </div>
  83. </template>
  84. </el-table-column> -->
  85. <el-table-column label="签到">
  86. <template slot-scope="scope">
  87. {{ scope.row.signInStatus | attendanceType }}
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="签退">
  91. <template slot-scope="scope">
  92. {{ scope.row.signOutStatus | attendanceOutType }}
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="预计发放"
  96. prop="expectSalary">
  97. <template slot-scope="scope">
  98. <div>
  99. {{scope.row.expectSalary|moneyFormat}}
  100. </div>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="实际发放"
  104. prop="actualSalary">
  105. <template slot-scope="scope">
  106. <div>
  107. {{scope.row.actualSalary|moneyFormat}}
  108. </div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="课时补贴"
  112. prop="subsidy">
  113. <template slot-scope="scope">
  114. <div>
  115. {{scope.row.subsidy|moneyFormat}}
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="结算状态">
  120. <template slot-scope="scope">
  121. {{ scope.row.settlementTime ? '已结算' : '未结算' }}
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="操作">
  125. <template slot-scope="scope"
  126. v-if="scope.row.courseScheduleType != 'VIP' && !scope.row.settlementTime">
  127. <el-button v-if="scope.row.courseScheduleType != 'DEMO'"
  128. v-permission="{child: 'courseSchedule/updateTeacherCoursesSalary', parent: 'settlement/updateTeacherCoursesSalary'}"
  129. @click="onUpdate(scope.row)"
  130. type="text">课酬调整</el-button>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. <pagination
  135. sync
  136. :total.sync="pageInfo.total"
  137. :page.sync="pageInfo.page"
  138. :limit.sync="pageInfo.limit"
  139. :page-sizes="pageInfo.page_size"
  140. @pagination="getList" />
  141. </div>
  142. <el-dialog title="课酬调整"
  143. :visible.sync="settlementStatus"
  144. @close="onFormClose('ruleForm')"
  145. width="500px">
  146. <el-form :model="form"
  147. :rules="rules"
  148. ref="ruleForm">
  149. <el-form-item label="预计发放"
  150. :label-width="formLabelWidth">
  151. <el-input v-model.trim="form.expectSalary"
  152. disabled
  153. @mousewheel.native.prevent
  154. type="number"></el-input>
  155. </el-form-item>
  156. <el-form-item label="补贴"
  157. :label-width="formLabelWidth">
  158. <el-input v-model.trim="form.subsidys"
  159. disabled
  160. @mousewheel.native.prevent
  161. type="number"></el-input>
  162. </el-form-item>
  163. <el-form-item label="课酬调整为"
  164. prop="salary"
  165. :label-width="formLabelWidth">
  166. <el-input v-model.trim="form.salary"
  167. type="number"
  168. @mousewheel.native.prevent
  169. autocomplete="off"></el-input>
  170. </el-form-item>
  171. <el-form-item label="课时补贴调整为"
  172. prop="subsidy"
  173. :label-width="formLabelWidth">
  174. <el-input v-model.trim="form.subsidy"
  175. type="number"
  176. @mousewheel.native.prevent
  177. autocomplete="off"></el-input>
  178. </el-form-item>
  179. <el-form-item label="调整范围"
  180. prop="scope"
  181. :label-width="formLabelWidth">
  182. <el-radio-group v-model.trim="form.scope">
  183. <el-radio label="one">仅限本次</el-radio>
  184. <el-radio label="all">之后剩余课次</el-radio>
  185. </el-radio-group>
  186. </el-form-item>
  187. </el-form>
  188. <span slot="footer"
  189. class="dialog-footer">
  190. <el-button @click="settlementStatus = false">取 消</el-button>
  191. <el-button @click="onSettlementSubmit('ruleForm')"
  192. type="primary">确 定</el-button>
  193. </span>
  194. </el-dialog>
  195. </div>
  196. </template>
  197. <script>
  198. import { teacherQueryCloses, sumTeacherNoPay, updateTeacherCoursesSalary } from '@/api/teacherManager'
  199. import pagination from '@/components/Pagination/index'
  200. import store from '@/store'
  201. import { courseType, attendance } from '@/utils/searchArray'
  202. import { getTimes } from "@/utils";
  203. export default {
  204. name: 'settlement',
  205. components: {
  206. pagination
  207. },
  208. data () {
  209. return {
  210. teacherNoPay: 0,
  211. searchForm: {
  212. courseStartDate: null,
  213. courseEndDate: null,
  214. courseScheduleType: null,
  215. signInStatus: null,
  216. courseDate:[]
  217. },
  218. courseType: courseType,
  219. attendance: attendance,
  220. organId: null,
  221. teacherId: this.$route.query.teacherId,
  222. tableList: [],
  223. pageInfo: {
  224. // 分页规则
  225. limit: 10, // 限制显示条数
  226. page: 1, // 当前页
  227. total: 1, // 总条数
  228. page_size: [10, 20, 40, 50] // 选择限制显示条数
  229. },
  230. formLabelWidth: '120px',
  231. settlementStatus: false,
  232. form: {
  233. courseScheduleId: null,
  234. salary: null,
  235. subsidy: null,
  236. scope: 'one',
  237. expectSalary: null,
  238. subsidys: null
  239. },
  240. rules: {
  241. salary: [{ required: true, message: '请输入课酬', trigger: 'blur' }],
  242. subsidy: [{ required: true, message: '请输入课时补贴', trigger: 'blur' }],
  243. scope: [{ required: true, message: '请选择调整范围', trigger: 'change' }],
  244. }
  245. }
  246. },
  247. activated () {
  248. this.teacherId = this.$route.query.teacherId
  249. this.getList()
  250. sumTeacherNoPay({ teacherId: this.teacherId }).then(res => {
  251. if (res.code == 200) {
  252. this.teacherNoPay = res.data
  253. }
  254. })
  255. },
  256. mounted () {
  257. this.teacherId = this.$route.query.teacherId
  258. this.getList()
  259. sumTeacherNoPay({ teacherId: this.teacherId }).then(res => {
  260. if (res.code == 200) {
  261. this.teacherNoPay = res.data
  262. }
  263. })
  264. },
  265. methods: {
  266. search () {
  267. this.pageInfo.page = 1;
  268. this.getList();
  269. },
  270. onSettlementSubmit (formName) {
  271. this.$refs[formName].validate(valid => {
  272. if (!valid) return
  273. this.form.teacherId = this.teacherId
  274. updateTeacherCoursesSalary(this.form).then(res => {
  275. this.messageTips('修改', res)
  276. })
  277. })
  278. },
  279. messageTips (title, res) {
  280. if (res.code == 200) {
  281. this.$message.success(title + '成功')
  282. this.settlementStatus = false
  283. this.getList()
  284. } else {
  285. this.$message.error(res.msg)
  286. }
  287. },
  288. getList () {
  289. // let params = this.searchForm
  290. // params.rows = this.pageInfo.limit
  291. // params.page = this.pageInfo.page
  292. // params.teacherId = this.teacherId
  293. const { courseDate, ...rest } = this.searchForm;
  294. let params = {
  295. ...rest,
  296. ...getTimes(courseDate, ["courseStartDate", "courseEndDate"]),
  297. page: this.pageInfo.page,
  298. rows: this.pageInfo.limit,
  299. teacherId: this.teacherId,
  300. };
  301. teacherQueryCloses(params).then(res => {
  302. if (res.code == 200) {
  303. this.tableList = res.data.rows
  304. this.pageInfo.total = res.data.total
  305. }
  306. })
  307. },
  308. searchCourseDate (value) {
  309. if (value) {
  310. this.searchForm.courseStartDate = value[0]
  311. this.searchForm.courseEndDate = value[1]
  312. } else {
  313. this.searchForm.courseStartDate = null
  314. this.searchForm.courseEndDate = null
  315. }
  316. },
  317. onFormClose (formName) { // 关闭弹窗重置验证
  318. this.$refs[formName].resetFields()
  319. },
  320. onUpdate (row) {
  321. this.form.courseScheduleId = row.courseScheduleId
  322. this.settlementStatus = true
  323. this.form.expectSalary = row.expectSalary
  324. this.form.subsidys = row.subsidy
  325. },
  326. onReSet () {
  327. this.courseDate = null
  328. this.searchForm = {
  329. courseStartDate: null,
  330. courseEndDate: null,
  331. courseScheduleType: null,
  332. signInStatus: null
  333. }
  334. this.getList();
  335. }
  336. }
  337. }
  338. </script>
  339. <style lang="scss" scope>
  340. </style>