123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- <template>
- <div class="m-container">
- <h2>
- <el-page-header @back="onCancel" :content="title"></el-page-header>
- </h2>
- <div class="m-core">
- <el-button
- type="primary"
- style="margin-bottom: 20px"
- v-permission="'activityUserMapper/add'"
- @click="addStudent"
- >添加学员</el-button
- >
- <save-form
- :inline="true"
- ref="searchForm"
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- >
- <el-form-item prop="search">
- <el-input
- class="search"
- v-model.trim="searchForm.search"
- clearable
- @keyup.enter.native="
- (e) => {
- e.target.blur();
- $refs.searchForm.save();
- search();
- }
- "
- placeholder="学员名称/编号/手机号"
- ></el-input>
- </el-form-item>
- <el-form-item prop="organId">
- <el-select
- class="multiple"
- filterable
- style="width: 180px !important"
- v-model.trim="searchForm.organId"
- clearable
- placeholder="请选择分部"
- >
- <el-option
- v-for="(item, index) in organList"
- :key="index"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </el-form-item>
- </save-form>
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- :data="tableList"
- >
- <el-table-column
- align="center"
- prop="organName"
- label="分部"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="userId"
- label="学员编号"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="username"
- label="学员姓名"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="phone"
- label="手机号"
- ></el-table-column>
- <el-table-column
- v-if="courseType && courseType == 'VIP'"
- align="center"
- prop="studentId"
- label="付费课已使用/剩余资格"
- >
- <template slot-scope="scope">
- <div v-if="scope.row.userId">
- {{ scope.row.useVipNum + "" + "/" + scope.row.freeVipNum + "" }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- v-else
- align="center"
- prop="studentId"
- label="付费课已使用/剩余资格"
- >
- <template slot-scope="scope">
- <div v-if="scope.row.userId">
- {{
- scope.row.usePracticeNum +
- "" +
- "/" +
- scope.row.freePracticeNum +
- ""
- }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- v-if="giveCourseType == 'VIP'"
- align="center"
- prop="studentId"
- label="赠课已使用/剩余资格"
- >
- <template slot-scope="scope">
- <div v-if="scope.row.userId">
- {{
- scope.row.useGiveVipNum +
- "" +
- "/" +
- scope.row.freeGiveVipNum +
- ""
- }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- v-if="giveCourseType == 'PRACTICE'"
- align="center"
- prop="studentId"
- label="赠课已使用/剩余资格"
- >
- <template slot-scope="scope">
- <div v-if="scope.row.userId">
- {{
- scope.row.useGivePracticeNum +
- "" +
- "/" +
- scope.row.freeGivePracticeNum +
- ""
- }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- v-if="giveCourseType != 'PRACTICE' && giveCourseType != 'VIP'"
- align="center"
- prop="studentId"
- label="赠课已使用/剩余资格"
- >
- <template slot-scope="scope">
- <div v-if="scope.row.userId">
- {{ "--" + "/" + "--" }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- prop="studentId"
- label="操作"
- width="260px"
- >
- <template slot-scope="scope">
- <div>
- <el-button
- type="text"
- v-permission="'activityUserMapper/add'"
- @click="addCount(scope.row)"
- >添加资格</el-button
- >
- <el-button
- type="text"
- v-permission="'activityUserMapper/cut'"
- @click="reduceCount(scope.row)"
- >减少资格</el-button
- >
- <el-button
- type="text"
- v-permission="'activityUserMapperAdjustLog/queryPage'"
- @click="lookInfo(scope.row)"
- >调整记录</el-button
- >
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- sync
- :total.sync="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <el-dialog
- title="添加学员"
- :visible.sync="addStudentVisible"
- width="1000px"
- v-if="addStudentVisible"
- >
- <addStudentSenior
- :organList="organList"
- :hasGive="hasGive"
- ref="addStudentSenior"
- @getList="getList"
- @close="addStudentVisible = false"
- />
- <span slot="footer" class="dialog-footer">
- <el-button @click="addStudentVisible = false">取 消</el-button>
- <el-button type="primary" @click="submitStudent">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="添加资格"
- :visible.sync="addSeniorVisible"
- width="800px"
- v-if="addSeniorVisible"
- >
- <addSenior
- :hasGive="hasGive"
- :activeRow="activeRow"
- @getList="getList"
- ref="addSenior"
- @close="addSeniorVisible = false"
- />
- <span slot="footer" class="dialog-footer">
- <el-button @click="addSeniorVisible = false">取 消</el-button>
- <el-button type="primary" @click="addSeniorSubmit">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="减少资格"
- :visible.sync="reduceVisible"
- width="1000px"
- v-if="reduceVisible"
- >
- <reduceSenior
- :activeRow="activeRow"
- :courseType="courseType"
- :giveCourseType="giveCourseType"
- @getList="getList"
- />
- <span slot="footer" class="dialog-footer">
- <!-- <el-button @click="addStudentVisible = false">取 消</el-button> -->
- <el-button type="primary" @click="reduceVisible = false"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- <el-dialog
- title="资格记录"
- :visible.sync="infoVisible"
- width="1000px"
- v-if="infoVisible"
- >
- <seniorInfo :activeRow="activeRow" />
- <!-- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="infoVisible = false">确 定</el-button>
- </span>-->
- </el-dialog>
- </div>
- </template>
- <script>
- import axios from "axios";
- import { getToken } from "@/utils/auth";
- import pagination from "@/components/Pagination/index";
- import load from "@/utils/loading";
- import {
- getVipGroupActivity,
- getActivityUserMapperList,
- } from "@/api/vipSeting";
- import addSenior from "./modals/addSenior.vue";
- import reduceSenior from "./modals/reduceSenior.vue";
- import addStudentSenior from "./modals/addStudentSenior.vue";
- import seniorInfo from "./modals/seniorInfo";
- export default {
- components: {
- pagination,
- addSenior,
- reduceSenior,
- addStudentSenior,
- seniorInfo,
- },
- data() {
- return {
- searchForm: {
- search: null,
- organId: null,
- },
- title: "",
- tableList: [{}],
- organList: [],
- activeRow: null,
- hasGive: false,
- addStudentVisible: false,
- addSeniorVisible: false,
- reduceVisible: false,
- infoVisible: false,
- courseType: "",
- giveCourseType: "",
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- async mounted() {
- // 获取分部
- // 获取分部
- await this.$store.dispatch("setBranchs");
- this.init();
- },
- methods: {
- async init() {
- if (this.$route.query.id) {
- // this.baseForm.id = this.$route.query.id;
- try {
- const rusult = await getVipGroupActivity({
- id: this.$route.query.id,
- });
- this.formatDetail(rusult.data);
- } catch (e) {
- console.log(e);
- }
- }
- this.getList();
- },
- async getList() {
- try {
- const res = await getActivityUserMapperList({
- ...this.searchForm,
- page: this.rules.page,
- rows: this.rules.limit,
- activityId: this.$route.query.id,
- });
- this.tableList = res.data.rows;
- this.rules.total = res.data.total;
- } catch (e) {
- console.log(e);
- }
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- onReSet() {
- this.$refs.searchForm.resetFields();
- this.search();
- },
- onCancel() {
- this.$store.dispatch("delVisitedViews", this.$route);
- this.$router.push({
- path: "/vipActiveManager/vipActiveList",
- query: { rules: this.rules, searchForm: this.searchForm },
- });
- },
- formatDetail(data) {
- this.title = data.name;
- let organIds = data.organId.split(",").map((organ) => {
- return Number(organ);
- });
- this.organList = [];
- this.selects.branchs.forEach((organ) => {
- if (organIds.indexOf(organ.id) != -1) {
- this.organList.push(organ);
- }
- });
- this.hasGive = Boolean(
- data.giveCourseType && data.giveCourseType != "MEMBER"
- );
- this.courseType = data.courseType;
- this.giveCourseType = data.giveCourseType;
- console.log(this.courseType, this.giveCourseType);
- // selects.branchs
- },
- addCount(row) {
- this.activeRow = row;
- this.addSeniorVisible = true;
- },
- reduceCount(row) {
- this.activeRow = row;
- this.reduceVisible = true;
- },
- addStudent() {
- this.addStudentVisible = true;
- },
- submitStudent() {
- this.$refs.addStudentSenior.submit();
- },
- addSeniorSubmit() {
- this.$refs.addSenior.submit();
- },
- lookInfo(row) {
- this.activeRow = row;
- this.infoVisible = true;
- },
- },
- };
- </script>
- <style lang='scss' scoped>
- .m-container {
- .search {
- /deep/.el-input__inner {
- width: 200px !important;
- }
- }
- }
- </style>
|