calenderStudentList.vue 5.5 KB

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