vipList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>VIP课列表
  5. </h2>
  6. <div class="newBand"
  7. @click='gotoBuildVip'>新建vip课</div>
  8. <div class='m-core'>
  9. <!-- 搜索类型 -->
  10. <el-form :inline="true"
  11. class="searchForm"
  12. v-model="searchForm">
  13. <!-- 状态 指导老师 活动方案-->
  14. <el-form-item prop='orgin'>
  15. <el-select class='multiple'
  16. v-model="searchForm.orgin"
  17. clearable
  18. placeholder="请选择分部">
  19. <el-option v-for="(item,index) in organList"
  20. :key="index"
  21. :label="item.name"
  22. :value="item.id"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-select v-model="searchForm.teacherId"
  27. clearable
  28. filterable
  29. placeholder="指导老师">
  30. <el-option v-for="(item,index) in teacherList"
  31. :key='index'
  32. :value="item.id"
  33. :label="item.username"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-select v-model="searchForm.activityId"
  38. clearable
  39. placeholder="活动方案">
  40. <el-option v-for="(item,index) in activeList"
  41. :key='index'
  42. :value="item.id"
  43. :label="item.name"></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-input v-model="searchForm.search"
  48. @keyup.enter.native='search'
  49. placeholder="课程名称"></el-input>
  50. </el-form-item>
  51. <el-form-item>
  52. <el-button @click="search"
  53. type="danger">搜索</el-button>
  54. <el-button @click="onReSet"
  55. type="primary">重置</el-button>
  56. </el-form-item>
  57. </el-form>
  58. <!-- 查询列表 -->
  59. <!-- tab -->
  60. <div class="tableWrap">
  61. <el-table style="width: 100%"
  62. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  63. :data='tableData'>
  64. <el-table-column align='center'
  65. prop="id"
  66. label="VIP编号">
  67. </el-table-column>
  68. <el-table-column align='center'
  69. prop="name"
  70. label="课程名称">
  71. </el-table-column>
  72. <el-table-column align='center'
  73. prop="status"
  74. label="课程状态">
  75. <template slot-scope="scope">
  76. <div>
  77. {{ scope.row.status | formatterStatus}}
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column align='center'
  82. prop="userName"
  83. label="指导老师">
  84. </el-table-column>
  85. <el-table-column align='center'
  86. prop="studentNum"
  87. label="班级人数">
  88. </el-table-column>
  89. <el-table-column align='center'
  90. label="课程单价">
  91. <template slot-scope="scope">
  92. <div>
  93. <p>线上:{{scope.row.onlineClassesUnitPrice}}</p>
  94. <p>线下:{{scope.row.offlineClassesUnitPrice}}</p>
  95. </div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align='center'
  99. prop="vipGroupActivityName"
  100. label="活动方案">
  101. </el-table-column>
  102. <el-table-column align='center'
  103. label="当前课次">
  104. <template slot-scope="scope">
  105. <div>
  106. <p>{{scope.row.currentClassTimes + '/' + scope.row.totalClassTimes}}</p>
  107. </div>
  108. </template>
  109. </el-table-column>
  110. <el-table-column align='center'
  111. label="月均消耗">
  112. <template slot-scope="scope">
  113. {{ scope.row.monthConsumeRate }}%
  114. </template>
  115. </el-table-column>
  116. <el-table-column align='center'
  117. prop="paymentExpireDate"
  118. label="开课时间">
  119. <template slot-scope="scope">
  120. <div>
  121. <p>{{scope.row.courseStartDate | formatterTime}}</p>
  122. </div>
  123. </template>
  124. </el-table-column>
  125. <el-table-column align='center'
  126. prop="coursesExpireDate"
  127. label="课程结束时间">
  128. <template slot-scope="scope">
  129. <div>
  130. <p>{{scope.row.coursesExpireDate | formatterTime}}</p>
  131. </div>
  132. </template>
  133. </el-table-column>
  134. <el-table-column align='center'
  135. prop="createTime"
  136. label="申请时间">
  137. <template slot-scope="scope">
  138. <div>
  139. <p>{{scope.row.createTime | formatterTime}}</p>
  140. </div>
  141. </template>
  142. </el-table-column>
  143. <el-table-column align='center'
  144. width="150px"
  145. fixed="right"
  146. label="操作">
  147. <template slot-scope="scope">
  148. <div>
  149. <el-button type="text"
  150. @click="gotoVipDetail(scope.row.id)">查看</el-button>
  151. <!--
  152. <el-button type="text">启动</el-button> -->
  153. <!-- <el-button type="text"
  154. v-if="scope.row.status <3"
  155. @click='closeVip(scope.row.id)'>关闭</el-button> -->
  156. <el-popover placement="top"
  157. width="160"
  158. v-if="scope.row.status <3"
  159. :ref="scope.$index">
  160. <p style='margin-bottom:10px;'>确定停止该vip课?</p>
  161. <el-input v-model="scope.row.stopReason"
  162. placeholder="请输入关闭原因"></el-input>
  163. <div style="text-align: right; margin-top: 20px">
  164. <el-button size="mini"
  165. type="text"
  166. @click="scope._self.$refs[scope.$index].doClose()">取消</el-button>
  167. <el-button type="primary"
  168. size="mini"
  169. @click="closeVip(scope)">确定</el-button>
  170. </div>
  171. <el-button type="text"
  172. slot="reference">停止</el-button>
  173. </el-popover>
  174. <el-button type="text"
  175. @click="resetVip(scope.row.id)">修改</el-button>
  176. </div>
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. <!-- 分页器 -->
  181. <pagination :total="rules.total"
  182. :page.sync="rules.page"
  183. :limit.sync="rules.limit"
  184. :page-sizes="rules.page_size"
  185. @pagination="getList" />
  186. </div>
  187. </div>
  188. </div>
  189. </template>
  190. <script>
  191. import pagination from '@/components/Pagination/index'
  192. import { getVipList, vipGroupActivity, closeVip, getVipGroupDetail } from '@/api/vipSeting'
  193. import { getTeacher, getEmployeeOrgan } from '@/api/buildTeam'
  194. import store from '@/store'
  195. export default {
  196. components: { pagination },
  197. name: 'vipList',
  198. data () {
  199. return {
  200. organId: null,
  201. searchForm: {
  202. teacherId: null,
  203. activityId: null,
  204. search: null,
  205. orgin: null
  206. },
  207. teacherList: [],
  208. activeList: [],
  209. tableData: [],
  210. organList: [],
  211. rules: {
  212. // 分页规则
  213. limit: 10, // 限制显示条数
  214. page: 1, // 当前页
  215. total: 0, // 总条数
  216. page_size: [10, 20, 40, 50] // 选择限制显示条数
  217. },
  218. }
  219. },
  220. created () {
  221. if (this.$route.query.searchForm) {
  222. this.$route.query.searchForm instanceof Object ? this.topForm = this.$route.query.searchForm : this.topForm = JSON.parse(this.$route.query.searchForm);
  223. }
  224. if (this.$route.query.rules) {
  225. this.$route.query.rules instanceof Object ? this.rules = this.$route.query.rules : this.rules = JSON.parse(this.$route.query.rules);
  226. }
  227. },
  228. mounted () {
  229. getEmployeeOrgan().then(res => {
  230. if (res.code == 200) {
  231. this.organList = res.data;
  232. }
  233. })
  234. this.getList();
  235. // <!-- 状态 指导老师 活动方案-->
  236. getTeacher({ organId: this.organId }).then(res => {
  237. if (res.code == 200) {
  238. this.teacherList = res.data;
  239. }
  240. })
  241. // 获取活动方案
  242. vipGroupActivity({ organId: this.organId }).then(res => {
  243. if (res.code == 200) {
  244. this.activeList = res.data.rows;
  245. }
  246. })
  247. },
  248. methods: {
  249. search () {
  250. this.rules.page = 1;
  251. this.getList()
  252. },
  253. onReSet () {
  254. this.searchForm = {
  255. teacherId: null,
  256. activityId: null,
  257. search: null
  258. }
  259. },
  260. getList () {
  261. let params = this.searchForm
  262. params.page = this.rules.page
  263. params.rows = this.rules.limit
  264. params.organId = this.searchForm.orgin
  265. getVipList(params).then(res => {
  266. if (res.code == 200) {
  267. this.tableData = res.data.rows
  268. this.rules.total = res.data.total
  269. }
  270. })
  271. },
  272. // 跳转到vip详情
  273. gotoVipDetail (id) {
  274. let rules = JSON.stringify(this.rules)
  275. let searchForm = JSON.stringify(this.searchForm)
  276. this.$router.push({ path: '/business/vipDetail', query: { id, rules, searchForm } })
  277. },
  278. closeVip (scope) {
  279. let id = scope.row.id;
  280. closeVip({ vipGroupId: id, stopReason: scope.row.stopReason }).then(res => {
  281. if (res.code == 200) {
  282. this.$message.success('停止课程成功')
  283. scope._self.$refs[scope.$index].doClose()
  284. this.getList();
  285. }
  286. })
  287. },
  288. gotoBuildVip () {
  289. let rules = JSON.stringify(this.rules)
  290. let searchForm = JSON.stringify(this.searchForm)
  291. this.$router.push({ path: '/business/buildVip', query: { rules, searchForm } })
  292. },
  293. // 修改vip
  294. resetVip (id) {
  295. let rules = JSON.stringify(this.rules)
  296. let searchForm = JSON.stringify(this.searchForm)
  297. this.$router.push({ path: '/business/vipReset', query: { id, rules, searchForm } })
  298. }
  299. },
  300. filters: {
  301. formatterTime (val) {
  302. let result
  303. if (val) {
  304. result = val.split(' ')[0];
  305. } else {
  306. result = ''
  307. }
  308. return result
  309. },
  310. formatterStatus (val) {
  311. let arr = ["未开始", "报名中", "进行中", '取消', '已结束', '报名结束']
  312. return arr[val];
  313. }
  314. }
  315. }
  316. </script>
  317. <style lang="scss" scope>
  318. .m-container {
  319. box-sizing: border-box;
  320. background-color: #fff;
  321. // padding: 18px 95px 55px 60px;
  322. }
  323. </style>