vipList.vue 11 KB

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