addSenior.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div>
  3. <el-form :inline="true" :model="topForm" label-width="110px" ref='form'>
  4. <el-row>
  5. <el-col :span="12">
  6. <el-form-item label="学生姓名:">
  7. {{ topForm.userName }}
  8. </el-form-item>
  9. </el-col>
  10. <el-col :span="12">
  11. <el-form-item label="手机号:">
  12. {{ topForm.phone }}
  13. </el-form-item>
  14. </el-col>
  15. </el-row>
  16. <el-row>
  17. <el-col :span="12">
  18. <el-form-item
  19. label="付费课资格:"
  20. prop="paySeniorNum"
  21. style="width: 100%"
  22. :rules="[
  23. {
  24. required: true,
  25. message: '请输入付费课资格数',
  26. trigger: 'blur',
  27. },
  28. {
  29. pattern: /^(0|\+?[1-9][0-9]*)$/,
  30. message: '请输入正确的付费课资格数',
  31. trigger: 'blur',
  32. },
  33. ]"
  34. >
  35. <el-input
  36. v-model="topForm.paySeniorNum"
  37. style="width: 270px"
  38. ></el-input>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="12">
  42. <el-form-item
  43. prop="giveSeniorNum"
  44. label="赠课资格:"
  45. v-if="hasGive"
  46. style="width: 100%"
  47. :rules="[
  48. { required: true, message: '请输入赠课资格数', trigger: 'blur' },
  49. {
  50. pattern: /^(0|\+?[1-9][0-9]*)$/,
  51. message: '请输入正确的赠课资格数',
  52. trigger: 'blur',
  53. },
  54. ]"
  55. >
  56. <el-input
  57. v-model="topForm.giveSeniorNum"
  58. style="width: 270px"
  59. ></el-input>
  60. </el-form-item>
  61. </el-col>
  62. </el-row>
  63. <el-row>
  64. <el-form-item label="调整原因:" prop="memo" :rules="[
  65. { required: true, message: '请输入调整原因', trigger: 'blur' },
  66. ]">
  67. <el-input
  68. style="width: 650px"
  69. type="textarea"
  70. v-model="topForm.memo"
  71. maxlength="50"
  72. show-word-limit
  73. :rows="3"
  74. ></el-input>
  75. </el-form-item>
  76. </el-row>
  77. <!-- <p style="color: red">资格调整不影响该活动学员购买次数</p> -->
  78. </el-form>
  79. </div>
  80. </template>
  81. <script>
  82. import { addActivityUserMapperStudents } from "@/api/vipSeting";
  83. export default {
  84. props: ["hasGive", "activeRow"],
  85. data() {
  86. return {
  87. topForm: {
  88. userName: "",
  89. phone: "",
  90. paySeniorNum: "",
  91. giveSeniorNum: "",
  92. },
  93. };
  94. },
  95. mounted() {
  96. this.topForm.userName = this.activeRow?.username || "";
  97. this.topForm.phone = this.activeRow?.phone || "";
  98. },
  99. methods: {
  100. submit() {
  101. this.$refs.form.validate(async (flag) => {
  102. if (flag) {
  103. let obj = {
  104. activityId: this.$route.query.id,
  105. memo: this.topForm.memo,
  106. activityStudentAdjustDtos: [
  107. {
  108. courseNum: this.topForm.paySeniorNum,
  109. giveCourseNum: this.topForm.giveSeniorNum,
  110. userId: this.activeRow.userId,
  111. },
  112. ],
  113. };
  114. try {
  115. const res = await addActivityUserMapperStudents(obj);
  116. this.$message.success("添加成功");
  117. this.$emit("getList");
  118. this.$emit("close");
  119. } catch (e) {
  120. console.log(e);
  121. }
  122. }
  123. });
  124. },
  125. },
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. ::v-deep .el-form--inline .el-form-item {
  130. margin-right: 0;
  131. }
  132. </style>