resetPayList.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <!-- -->
  2. <template>
  3. <div class="m-core">
  4. <div class="topWrap">
  5. <div class="newBand"
  6. @click="newPay"
  7. v-permission="'musicGroupPaymentCalender/add'">新建缴费</div>
  8. <div class="newBand"
  9. v-permission="'/studentPayBase'"
  10. @click="setStudentPay">学员缴费设置</div>
  11. </div>
  12. <div class="tableWrap">
  13. <el-table style="width: 100%"
  14. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  15. :data="tableList">
  16. <el-table-column align="center"
  17. prop="startPaymentDate"
  18. label="缴费开始日期">
  19. <template slot-scope="scope">
  20. <div>
  21. {{scope.row.startPaymentDate | formatTimer}}
  22. </div>
  23. </template>
  24. </el-table-column>
  25. <el-table-column align="center"
  26. prop="deadlinePaymentDate"
  27. label="缴费结束日期">
  28. <template slot-scope="scope">
  29. <div>
  30. {{scope.row.deadlinePaymentDate | formatTimer}}
  31. </div>
  32. </template>
  33. </el-table-column>
  34. <el-table-column align="center"
  35. prop="expectNum"
  36. label="预计缴费人数"></el-table-column>
  37. <el-table-column align="center"
  38. prop="actualNum"
  39. label="实际缴费人数"></el-table-column>
  40. <el-table-column align="center"
  41. prop="type"
  42. label="状态">
  43. <template slot-scope="scope">
  44. <div>
  45. {{scope.row.type | paymentType}}
  46. </div>
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center"
  50. prop="type"
  51. label="缴费状态">
  52. <template slot-scope="scope">
  53. <div>
  54. {{scope.row.paymentStatus | paymentListStatus}}
  55. </div>
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center"
  59. prop="memo"
  60. label="备注"></el-table-column>
  61. <el-table-column label="操作">
  62. <template slot-scope="scope">
  63. <div>
  64. <el-button type="text"
  65. v-if="scope.row.paymentStatus != 0"
  66. @click="lookDetail(scope.row)"
  67. v-permission="'/strudentPayInfo'">查看</el-button>
  68. <el-button type="text"
  69. v-if="scope.row.paymentStatus == 0"
  70. v-permission="'musicGroupPaymentCalender/updateStartTime'"
  71. @click="resetPay(scope.row)">修改</el-button>
  72. <el-button type="text"
  73. v-permission="'musicGroupPaymentCalender/del'"
  74. v-if="scope.row.paymentStatus == 0"
  75. @click="detelePay(scope.row)">删除</el-button>
  76. </div>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <pagination :total="rules.total"
  81. :page.sync="rules.page"
  82. :limit.sync="rules.limit"
  83. :page-sizes="rules.page_size"
  84. @pagination="getList" />
  85. </div>
  86. <el-dialog :visible.sync="payVisible"
  87. :close-on-click-modal="false"
  88. width="500px"
  89. :title="diTitle">
  90. <el-form :model="payForm"
  91. :inline="true"
  92. label-width="120px"
  93. label-position="right"
  94. ref='payForm'>
  95. <el-form-item label="缴费开始日期"
  96. :rules="[{ required: true, message: '请设置缴费开始日期',trigger: 'blur'}]"
  97. prop="startPaymentDate">
  98. <el-date-picker v-model.trim="payForm.startPaymentDate"
  99. type="date"
  100. :picker-options="pickerOptions"
  101. value-format="yyyy-MM-dd"
  102. placeholder="开始日期"></el-date-picker>
  103. </el-form-item>
  104. <el-form-item label="收费类型"
  105. v-if='isNew'
  106. :rules="[{ required: true, message: '请选择收费类型',trigger: 'blur'}]"
  107. prop="type">
  108. <el-select v-model.trim="payForm.type"
  109. style="width:220px!important;"
  110. placeholder="课程类型">
  111. <el-option label="线上"
  112. value="ONLINE"></el-option>
  113. <el-option label="线下"
  114. value="OFFLINE"></el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="备注"
  118. v-if='isNew'
  119. :rules="[{ required: true, message: '请填写备注',trigger: 'blur'}]"
  120. prop="memo">
  121. <el-input type="textarea"
  122. style="width:220px!important;"
  123. :rows="4"
  124. placeholder="请填写备注"
  125. v-model="payForm.memo"></el-input>
  126. </el-form-item>
  127. </el-form>
  128. <div slot="footer"
  129. class="dialog-footer">
  130. <el-button @click="payVisible = false">取 消</el-button>
  131. <el-button type="primary"
  132. v-if="isNew"
  133. @click="newPayInfo">确 定</el-button>
  134. <el-button type="primary"
  135. v-else
  136. @click="resetPayDate">确 定</el-button>
  137. </div>
  138. </el-dialog>
  139. </div>
  140. </template>
  141. <script>
  142. import axios from "axios";
  143. import { getToken } from "@/utils/auth";
  144. import pagination from "@/components/Pagination/index";
  145. import load from "@/utils/loading";
  146. import { addMusicGroupPaymentCalender, getMusicGroupPaymentCalender, resetMusicGroupPaymentCalender, delMusicGroupPaymentCalender } from "@/api/buildTeam";
  147. export default {
  148. components: { pagination },
  149. data () {
  150. return {
  151. searchForm: {
  152. search: null
  153. },
  154. tableList: [{}],
  155. rules: {
  156. // 分页规则
  157. limit: 10, // 限制显示条数
  158. page: 1, // 当前页
  159. total: 0, // 总条数
  160. page_size: [10, 20, 40, 50] // 选择限制显示条数
  161. },
  162. isInit: false,
  163. diTitle: '新增缴费',
  164. payVisible: false,
  165. payForm: {
  166. startPaymentDate: null,
  167. type: null,
  168. memo: null
  169. },
  170. isNew: false,
  171. activeRow: null,
  172. pickerOptions: {
  173. disabledDate (time) {
  174. return time.getTime() + 86400000 <= new Date().getTime();
  175. }
  176. },
  177. };
  178. },
  179. //生命周期 - 创建完成(可以访问当前this实例)
  180. created () { },
  181. //生命周期 - 挂载完成(可以访问DOM元素)
  182. mounted () {
  183. // 获取分部
  184. this.init();
  185. },
  186. activated () {
  187. this.init();
  188. },
  189. methods: {
  190. init () {
  191. this.getList()
  192. },
  193. getList () {
  194. getMusicGroupPaymentCalender({ page: this.rules.page, rows: this.rules.limit, musicGroupId: this.$route.query.id }).then(res => {
  195. if (res.code == 200) {
  196. this.rules.total = res.data.total
  197. this.tableList = res.data.rows;
  198. }
  199. })
  200. },
  201. newPay () {
  202. this.diTitle = '新增缴费'
  203. this.isNew = true
  204. this.payVisible = true;
  205. },
  206. resetPay (row) {
  207. this.diTitle = '修改缴费'
  208. this.isNew = false
  209. this.activeRow = row
  210. this.payVisible = true;
  211. },
  212. detelePay (row) {
  213. let id = row.id;
  214. this.$confirm(`确定删除该缴费周期?`, '提示', {
  215. confirmButtonText: '确定',
  216. cancelButtonText: '取消',
  217. type: 'warning'
  218. }).then(() => {
  219. delMusicGroupPaymentCalender({ id }).then(res => {
  220. if (res.code == 200) {
  221. this.$message.success('删除成功')
  222. this.getList();
  223. }
  224. })
  225. }).catch(() => { })
  226. },
  227. lookDetail (row) {
  228. let query = this.$route.query
  229. this.$route.query.paymentId = row.id;
  230. this.$router.push({ path: '/business/strudentPayInfo', query })
  231. },
  232. setStudentPay () {
  233. let query = this.$route.query
  234. this.$router.push({ path: '/business/studentPayBase', query })
  235. },
  236. newPayInfo () {
  237. this.$refs['payForm'].validate(res => {
  238. if (res) {
  239. this.payForm.musicGroupId = this.$route.query.id
  240. addMusicGroupPaymentCalender(this.payForm).then(res => {
  241. if (res.code == 200) {
  242. this.$message.success('恭喜你创建成功')
  243. this.payVisible = false;
  244. this.getList()
  245. }
  246. })
  247. }
  248. })
  249. },
  250. resetPayDate () {
  251. resetMusicGroupPaymentCalender({ id: this.activeRow.id, startTime: this.payForm.startPaymentDate }).then(res => {
  252. if (res.code == 200) {
  253. this.$message.success('修改成功')
  254. this.payVisible = false;
  255. this.getList()
  256. }
  257. })
  258. }
  259. },
  260. watch: {
  261. payVisible (val) {
  262. if (!val) {
  263. this.payForm = {
  264. startPaymentDate: null,
  265. type: null,
  266. memo: null
  267. }
  268. this.$refs['payForm'].resetFields()
  269. }
  270. }
  271. }
  272. };
  273. </script>
  274. <style lang='scss' scoped>
  275. .topWrap {
  276. display: flex;
  277. flex-direction: row;
  278. justify-content: flex-start;
  279. div {
  280. margin-right: 10px;
  281. }
  282. }
  283. </style>