calenderStudentList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div>
  3. <paymentCycle
  4. ref="cycle"
  5. :form="cycle"
  6. :isUserType="true"
  7. :isCommon="true"
  8. :isDisabled="true"
  9. :hideMoney="true"
  10. />
  11. <otherform :form="other" ref="other" />
  12. <el-table
  13. :data="mergeInfoList"
  14. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  15. max-height="300px"
  16. >
  17. <el-table-column
  18. prop="userId"
  19. align="center"
  20. width="120"
  21. label="学员编号"
  22. ></el-table-column>
  23. <el-table-column
  24. prop="username"
  25. align="center"
  26. width="120"
  27. label="学员姓名"
  28. ></el-table-column>
  29. <el-table-column prop="phone" align="center" width="120" label="课程类型">
  30. <template slot-scope="scope">
  31. <div>
  32. {{ scope.row.courseType | coursesType }}
  33. </div>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="subjectNames" align="center" label="原价">
  37. <template slot-scope="scope">
  38. <div>
  39. <el-input v-model="scope.row.courseOriginalPrice"></el-input>
  40. </div>
  41. </template>
  42. </el-table-column>
  43. <el-table-column align="center" label="现价">
  44. <template slot-scope="scope">
  45. <div>
  46. <el-input v-model="scope.row.courseCurrentPrice"></el-input>
  47. </div>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. </div>
  52. </template>
  53. <script>
  54. import paymentCycle from "@/views/resetTeaming/modals/payment-cycle";
  55. import otherform from "@/views/resetTeaming/modals/other";
  56. import { getTimes } from "@/utils";
  57. import { spanGroupMergeClassSplitClassAffirm } from "@/api/buildTeam";
  58. export default {
  59. props: [
  60. "studentIds",
  61. "masterClassGroupId",
  62. "classGroupStudents",
  63. "classList",
  64. "mergeInfo",
  65. ],
  66. components: {
  67. paymentCycle,
  68. otherform,
  69. },
  70. data() {
  71. return {
  72. activeNames: [],
  73. mergeInfoList: [],
  74. cycle: {
  75. paymentAmount: null,
  76. paymentPattern: null,
  77. },
  78. other: {},
  79. };
  80. },
  81. mounted() {
  82. // console.log(this.studentIds, this.masterClassGroupId, this.classGroupStudents)
  83. // for (let item in this.mergeInfo) {
  84. // this.activeNames.push(item);
  85. // }
  86. this.mergeInfoList = [];
  87. for (let merge in this.mergeInfo) {
  88. this.mergeInfoList = this.mergeInfoList.concat(this.mergeInfo[merge]);
  89. }
  90. },
  91. methods: {
  92. getCLassName(key) {
  93. let str = "";
  94. this.classList.forEach((classes) => {
  95. if (classes.id == key) {
  96. str = classes.name;
  97. }
  98. });
  99. return str;
  100. },
  101. async submit() {
  102. let obj = {};
  103. let some = this.getData()
  104. if(some){
  105. obj.musicGroupPaymentCalenderDtos = [some];
  106. }else{
  107. return
  108. }
  109. obj.classGroupIds = this.classList.map((classes) => {
  110. return classes.id;
  111. });
  112. obj.masterClassGroupId = this.masterClassGroupId;
  113. obj.classGroupStudents = this.classGroupStudents;
  114. obj.studentIds = this.studentIds
  115. // console.log(obj);
  116. try {
  117. const reset = await spanGroupMergeClassSplitClassAffirm(obj);
  118. this.$message.success("合并成功");
  119. // 1.关闭弹窗
  120. // 2.清空合并班
  121. // 3.刷新列表
  122. this.$emit('refresh')
  123. console.log(reset);
  124. } catch (e) {
  125. console.log(e);
  126. }
  127. },
  128. getForms() {
  129. const { $refs: refs } = this;
  130. // [refs.base, refs.eclass, refs.cycle, ...(refs.cycles || []), refs.other, refs.payment]
  131. return [refs.cycle, refs.other]
  132. .filter((item) => !!item)
  133. .map((item) => item.$refs.form || item);
  134. },
  135. getData() {
  136. const forms = this.getForms();
  137. const valided = [];
  138. for (const form of forms) {
  139. form.validate((valid) => {
  140. if (valid) {
  141. valided.push(form);
  142. }
  143. });
  144. }
  145. if (valided.length === forms.length) {
  146. const { leixing, ...rest } = {
  147. ...this.form,
  148. ...this.other,
  149. };
  150. if (this.$refs.cycle) {
  151. const {
  152. paymentDate,
  153. paymentValid,
  154. paymentPattern,
  155. ...other
  156. } = this.cycle;
  157. rest.paymentPattern = paymentPattern;
  158. rest.payUserType = "STUDENT";
  159. rest.paymentType = "SPAN_GROUP_CLASS_ADJUST";
  160. rest.musicGroupPaymentCalenderStudentDetails = this.mergeInfoList;
  161. rest.musicGroupPaymentDateRangeList = [
  162. {
  163. ...other,
  164. ...getTimes(paymentDate, [
  165. "startPaymentDate",
  166. "deadlinePaymentDate",
  167. ]),
  168. ...getTimes(paymentValid, [
  169. "paymentValidStartDate",
  170. "paymentValidEndDate",
  171. ]),
  172. },
  173. ];
  174. }
  175. const data = {
  176. ...rest,
  177. };
  178. return data;
  179. // 说明验证通过
  180. } else {
  181. this.$message.error("请填写必要信息");
  182. return "error";
  183. }
  184. },
  185. },
  186. };
  187. </script>
  188. <style lang="scss" scoped>
  189. /deep/ .header {
  190. display: flex;
  191. align-items: center;
  192. width: 100%;
  193. justify-content: space-between;
  194. // margin-bottom: 10px;
  195. > span:first-child {
  196. display: flex;
  197. &::before {
  198. content: "";
  199. display: block;
  200. width: 5px;
  201. background-color: #14928a;
  202. margin-right: 10px;
  203. border-radius: 2px;
  204. height: 48px;
  205. }
  206. }
  207. .icon {
  208. font-size: 18px;
  209. font-weight: normal;
  210. margin-right: 20px;
  211. }
  212. /deep/.el-collapse-item__wrap {
  213. border-bottom: none !important;
  214. }
  215. }
  216. </style>