accompanyList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <div class>
  3. <!-- <h2>
  4. <div class="squrt"></div>网管课列表
  5. </h2>-->
  6. <div
  7. class="newBand"
  8. v-permission="'export/practiceGroup'"
  9. @click="onStudentExport"
  10. style="width: 120px;"
  11. >网管课续费提醒</div>
  12. <div class="m-core">
  13. <el-form :inline="true" class="searchForm" v-model.trim="searchForm">
  14. <!-- 状态 指导老师 活动方案-->
  15. <el-form-item>
  16. <el-input
  17. v-model.trim="searchForm.search"
  18. @keyup.enter.native="search"
  19. placeholder="课程组名称"
  20. ></el-input>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-select
  24. class="multiple"
  25. v-model.trim="searchForm.organIdList"
  26. filterable
  27. clearable
  28. placeholder="请选择分部"
  29. >
  30. <el-option
  31. v-for="(item,index) in organList"
  32. :key="index"
  33. :label="item.name"
  34. :value="item.id"
  35. ></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-select
  40. v-model.trim="searchForm.practiceGroupType"
  41. clearable
  42. filterable
  43. placeholder="课程组类型"
  44. >
  45. <el-option
  46. v-for="(item,index) in practiceGroupType"
  47. :key="index"
  48. :value="item.value"
  49. :label="item.label"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item prop="status">
  54. <el-select
  55. class="multiple"
  56. v-model.trim="searchForm.hasEducationalTeacherId"
  57. filterable
  58. clearable
  59. placeholder="是否有教务老师"
  60. >
  61. <el-option label="是" value="true"></el-option>
  62. <el-option label="否" value="false"></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item>
  66. <el-select v-model.trim="searchForm.teacherId" clearable filterable placeholder="指导老师">
  67. <el-option
  68. v-for="(item,index) in teacherList"
  69. :key="index"
  70. :value="item.id"
  71. :label="item.realName"
  72. ></el-option>
  73. </el-select>
  74. </el-form-item>
  75. <el-form-item>
  76. <el-select v-model.trim="searchForm.groupStatus" clearable filterable placeholder="课程组状态">
  77. <el-option
  78. v-for="(item,index) in commGroupStatus"
  79. :key="index"
  80. :value="item.value"
  81. :label="item.label"
  82. ></el-option>
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item>
  86. <el-select v-model.trim="searchForm.firstOrRenew" clearable filterable placeholder="是否续费">
  87. <el-option label="首充" value="1"></el-option>
  88. <el-option label="续费" value="0"></el-option>
  89. <el-option label="免费" value="2"></el-option>
  90. </el-select>
  91. </el-form-item>
  92. <el-form-item>
  93. <el-button @click="search" type="danger">搜索</el-button>
  94. <el-button @click="onReSet" type="primary">重置</el-button>
  95. </el-form-item>
  96. </el-form>
  97. <!-- tab -->
  98. <div class="tableWrap">
  99. <el-table
  100. style="width: 100%"
  101. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  102. :data="tableData"
  103. >
  104. <el-table-column align="center" prop="id" label="课程组编号" width="100"></el-table-column>
  105. <el-table-column align="center" prop="name" label="课程组名称" width="100"></el-table-column>
  106. <el-table-column align="center" prop="type" label="课程组类型" width="100">
  107. <template slot-scope="scope">
  108. <div>
  109. <p>{{scope.row.type | comType}}</p>
  110. </div>
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" prop="organName" label="所属分部"></el-table-column>
  114. <!-- educationalTeacherId -->
  115. <el-table-column align="center" prop="educationalTeacherName" label="教务老师"></el-table-column>
  116. <el-table-column align="center" prop="teacherName" label="指导老师"></el-table-column>
  117. <el-table-column align="center" prop="studentNum" label="班级人数"></el-table-column>
  118. <!-- <el-table-column align="center" label="课程单价">
  119. <template slot-scope="scope">
  120. <div>
  121. <p>线上:{{scope.row.onlineClassesUnitPrice}}</p>
  122. <p>线下:{{scope.row.offlineClassesUnitPrice}}</p>
  123. </div>
  124. </template>
  125. </el-table-column>-->
  126. <el-table-column align="center" label="当前课次">
  127. <template slot-scope="scope">
  128. <div>
  129. <p>{{scope.row.currentClassTimes + '/' + scope.row.totalClassTimes}}</p>
  130. </div>
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="center" prop="coursesStartDate" label="开课时间" width="120">
  134. <template slot-scope="scope">
  135. <div>
  136. <p>{{scope.row.coursesStartDate | formatTimer}}</p>
  137. </div>
  138. </template>
  139. </el-table-column>
  140. <el-table-column align="center" prop="coursesExpireDate" label="结束时间" width="120">
  141. <template slot-scope="scope">
  142. <div>
  143. <p>{{scope.row.coursesExpireDate | formatTimer}}</p>
  144. </div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column align="center" prop="groupStatus" label="课程组状态" width="100">
  148. <template slot-scope="scope">
  149. <div>
  150. <p>{{scope.row.groupStatus | comCourseGroup}}</p>
  151. </div>
  152. </template>
  153. </el-table-column>
  154. <el-table-column align="center" label="是否续费" fixed="right">
  155. <template slot-scope="scope">
  156. <div>
  157. <p v-if="scope.row.buyMonths == 0">免费</p>
  158. <p v-if="scope.row.buyMonths > 0">{{scope.row.beRenewGroupId>0?'续费':'首充'}}</p>
  159. </div>
  160. </template>
  161. </el-table-column>
  162. <el-table-column align="center" width="150" prop="memo" label="备注" fixed="right"></el-table-column>
  163. <el-table-column align="center" width="200" fixed="right" label="操作">
  164. <template slot-scope="scope">
  165. <div>
  166. <!-- v-permission="'courseSchedule/classStartDateAdjust'" v-if="!scope.row.isSettlement" -->
  167. <el-button type="text" @click="lookCrouse(scope.row)">查看</el-button>
  168. <el-button
  169. type="text"
  170. v-if="scope.row.groupStatus == 'NORMAL' && permission('practiceGroupManage/cancelGroup')"
  171. @click="closeCrouse(scope.row)"
  172. >关闭</el-button>
  173. <el-button
  174. type="text"
  175. v-if="permission('practiceGroupManage/updateMemo')"
  176. @click="resetMemo(scope.row)"
  177. >修改备注</el-button>
  178. </div>
  179. </template>
  180. </el-table-column>
  181. </el-table>
  182. <pagination
  183. :total="rules.total"
  184. :page.sync="rules.page"
  185. :limit.sync="rules.limit"
  186. :page-sizes="rules.page_size"
  187. @pagination="getList"
  188. />
  189. </div>
  190. </div>
  191. <el-dialog title="关闭课程组" width="400px" :visible.sync="closeVisible">
  192. <el-form
  193. :model="closeForm"
  194. ref="closeForm"
  195. label-position="right"
  196. label-width="80px;"
  197. :inline="true"
  198. >
  199. <el-form-item label="是否退费" prop="isBasck">
  200. <el-radio v-model="closeForm.isBack" :label="true">是</el-radio>
  201. <el-radio v-model="closeForm.isBack" :label="false">否</el-radio>
  202. </el-form-item>
  203. <el-form-item label="退费金额" v-if="closeForm.isBack" prop="money">
  204. <el-input type="number" @mousewheel.native.prevent v-model.trim="closeForm.money"></el-input>
  205. </el-form-item>
  206. </el-form>
  207. <div slot="footer" class="dialog-footer">
  208. <el-button @click="closeVisible = false">取 消</el-button>
  209. <el-button type="primary" @click="submieCloseCrouse">确 定</el-button>
  210. </div>
  211. </el-dialog>
  212. <el-dialog title="备注" width="400px" :visible.sync="memoVisible">
  213. <el-input type="textarea" v-model.trim="memoForm.memo" :rows="7" :maxlength="255" show-word-limit></el-input>
  214. <div slot="footer" class="dialog-footer">
  215. <el-button @click="memoVisible = false">取 消</el-button>
  216. <el-button type="primary" @click="subMemo">确 定</el-button>
  217. </div>
  218. </el-dialog>
  219. </div>
  220. </template>
  221. <script>
  222. import pagination from "@/components/Pagination/index";
  223. import { permission } from "@/utils/directivePage";
  224. import { commGroupStatus, practiceGroupType } from "@/utils/searchArray";
  225. import {
  226. getTeacher,
  227. getEmployeeOrgan,
  228. practiceGroupManage,
  229. cancelGroup,
  230. practiceUpdateMemo
  231. } from "@/api/buildTeam";
  232. import axios from "axios";
  233. import { getToken } from "@/utils/auth";
  234. import load from "@/utils/loading";
  235. export default {
  236. components: { pagination },
  237. data() {
  238. return {
  239. searchForm: {
  240. search: null,
  241. status: null,
  242. teacherId: null,
  243. organIdList: null,
  244. firstOrRenew: null,
  245. practiceGroupType: null,
  246. groupStatus: null
  247. },
  248. closeForm: {
  249. isBack: false,
  250. money: null
  251. },
  252. memoForm: {
  253. memo: "",
  254. groupId: ""
  255. },
  256. memoVisible: false,
  257. closeVisible: false,
  258. activeRow: null,
  259. organList: [],
  260. statusList: [],
  261. teacherList: [],
  262. tableData: [],
  263. practiceGroupType: practiceGroupType,
  264. commGroupStatus: commGroupStatus,
  265. rules: {
  266. // 分页规则
  267. limit: 10, // 限制显示条数
  268. page: 1, // 当前页
  269. total: 0, // 总条数
  270. page_size: [10, 20, 40, 50] // 选择限制显示条数
  271. }
  272. };
  273. },
  274. created() {
  275. if (this.$route.query.searchForm) {
  276. this.$route.query.searchForm instanceof Object
  277. ? (this.searchForm = this.$route.query.searchForm)
  278. : (this.searchForm = JSON.parse(this.$route.query.searchForm));
  279. }
  280. if (this.$route.query.rules) {
  281. this.$route.query.rules instanceof Object
  282. ? (this.rules = this.$route.query.rules)
  283. : (this.rules = JSON.parse(this.$route.query.rules));
  284. }
  285. this.init();
  286. },
  287. mounted() {},
  288. activated() {
  289. this.init();
  290. },
  291. methods: {
  292. init() {
  293. getEmployeeOrgan().then(res => {
  294. if (res.code == 200) {
  295. this.organList = res.data;
  296. }
  297. });
  298. // <!-- 状态 指导老师 活动方案-->
  299. getTeacher().then(res => {
  300. if (res.code == 200) {
  301. this.teacherList = res.data;
  302. }
  303. });
  304. this.getList();
  305. },
  306. permission(str, parent) {
  307. return permission(str, parent);
  308. },
  309. search() {
  310. this.rules.page = 1;
  311. this.getList();
  312. },
  313. onReSet() {
  314. this.searchForm = {
  315. search: null,
  316. status: null,
  317. teacherId: null,
  318. organIdList: null,
  319. firstOrRenew: null,
  320. practiceGroupType: null,
  321. groupStatus: null
  322. };
  323. this.search();
  324. },
  325. onStudentExport() {
  326. // 导出VIP课
  327. // let searchForm = this.searchForm;
  328. let data = {
  329. // teacherId: searchForm.teacherId || null,
  330. // activityId: searchForm.activityId || null,
  331. // organId: searchForm.orgin || null,
  332. // status: searchForm.status || null,
  333. // search: searchForm.search || null
  334. };
  335. let url = "/api-web/export/practiceGroup";
  336. const options = {
  337. method: "get",
  338. headers: {
  339. Authorization: getToken()
  340. },
  341. params: data,
  342. url,
  343. responseType: "blob"
  344. };
  345. this.$confirm("网管课续费提醒导出?", "提示", {
  346. confirmButtonText: "确定",
  347. cancelButtonText: "取消",
  348. type: "warning"
  349. })
  350. .then(() => {
  351. load.startLoading();
  352. axios(options)
  353. .then(res => {
  354. let blob = new Blob([res.data], {
  355. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  356. type: "application/vnd.ms-excel;charset=utf-8"
  357. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  358. });
  359. let text = new Response(blob).text();
  360. text.then(res => {
  361. // 判断是否报错
  362. if (res.indexOf("code") != -1) {
  363. let json = JSON.parse(res);
  364. this.$message.error(json.msg);
  365. } else {
  366. let objectUrl = URL.createObjectURL(blob);
  367. let link = document.createElement("a");
  368. let fname = "网管课续费提醒" + new Date().getTime(); //下载文件的名字
  369. link.href = objectUrl;
  370. link.setAttribute("download", fname);
  371. document.body.appendChild(link);
  372. link.click();
  373. }
  374. });
  375. load.endLoading();
  376. })
  377. .catch(error => {
  378. this.$message.error("导出数据失败,请连接管理员");
  379. load.endLoading();
  380. });
  381. })
  382. .catch(() => {});
  383. },
  384. getList() {
  385. let obj = {
  386. search: this.searchForm.search || null,
  387. teacherId: this.searchForm.teacherId || null,
  388. organId: this.searchForm.organIdList || null,
  389. page: this.rules.page,
  390. rows: this.rules.limit,
  391. hasEducationalTeacherId:
  392. this.searchForm.hasEducationalTeacherId || null,
  393. type: this.searchForm.firstOrRenew || null,
  394. practiceGroupType: this.searchForm.practiceGroupType || null,
  395. groupStatus: this.searchForm.groupStatus || null
  396. };
  397. practiceGroupManage(obj).then(res => {
  398. if (res.code == 200) {
  399. this.tableData = res.data.rows;
  400. this.rules.total = res.data.total;
  401. }
  402. });
  403. },
  404. lookCrouse(row) {
  405. let rules = JSON.stringify(this.rules);
  406. let searchForm = JSON.stringify(this.searchForm);
  407. this.$router.push({
  408. path: "/business/accompanys",
  409. query: { id: row.id, rules, searchForm, type: row.type }
  410. });
  411. },
  412. closeCrouse(row) {
  413. this.activeRow = row;
  414. this.closeVisible = true;
  415. },
  416. courseVisibleClose() {
  417. // 关闭弹窗前
  418. },
  419. submieCloseCrouse() {
  420. // 提交关闭课程组
  421. if (this.closeForm.isBack) {
  422. if (!this.closeForm.money) {
  423. this.$message.error("请输入退费金额");
  424. return;
  425. }
  426. } else {
  427. this.closeForm.money = null;
  428. }
  429. // 请求数据
  430. cancelGroup({
  431. groupId: this.activeRow.id,
  432. groupType: "PRACTICE",
  433. refundAmount: this.closeForm.money
  434. }).then(res => {
  435. if (res.code == 200) {
  436. this.$message.success("关闭成功");
  437. this.getList();
  438. this.closeVisible = false;
  439. }
  440. });
  441. },
  442. resetMemo(row) {
  443. this.$set(this.memoForm, "memo", row.memo);
  444. this.$set(this.memoForm, "groupId", row.id);
  445. this.memoVisible = true;
  446. },
  447. subMemo() {
  448. practiceUpdateMemo(this.memoForm).then(res => {
  449. if (res.code == 200) {
  450. this.$message.success("修改成功");
  451. this.memoVisible = false;
  452. this.getList();
  453. }
  454. });
  455. }
  456. },
  457. watch: {
  458. closeVisible(val) {
  459. if (!val) {
  460. this.activeRow = null;
  461. (this.closeForm = {
  462. isBack: false,
  463. money: null
  464. }),
  465. this.$refs.closeForm.resetFields();
  466. this.closeVisible = false;
  467. }
  468. }
  469. }
  470. };
  471. </script>
  472. <style lang="sass">
  473. </style>