calenderStudentList.vue 6.6 KB

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