|  | @@ -0,0 +1,212 @@
 | 
	
		
			
				|  |  | +<!--  -->
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <div>
 | 
	
		
			
				|  |  | +    <div class="m-core">
 | 
	
		
			
				|  |  | +      <el-form
 | 
	
		
			
				|  |  | +        :inline="true"
 | 
	
		
			
				|  |  | +        :model="searchForm"
 | 
	
		
			
				|  |  | +        @submit="search"
 | 
	
		
			
				|  |  | +        @reset="onReSet"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +        <el-form-item prop="search">
 | 
	
		
			
				|  |  | +          <el-input
 | 
	
		
			
				|  |  | +            v-model.trim="searchForm.search"
 | 
	
		
			
				|  |  | +            clearable
 | 
	
		
			
				|  |  | +            @keyup.enter.native="search"
 | 
	
		
			
				|  |  | +            placeholder="姓名、编号、手机号"
 | 
	
		
			
				|  |  | +          ></el-input>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +        <el-form-item prop="organId">
 | 
	
		
			
				|  |  | +          <el-select
 | 
	
		
			
				|  |  | +            class="multiple"
 | 
	
		
			
				|  |  | +            v-model.trim="searchForm.organId"
 | 
	
		
			
				|  |  | +            filterable
 | 
	
		
			
				|  |  | +            clearable
 | 
	
		
			
				|  |  | +            placeholder="请选择分部"
 | 
	
		
			
				|  |  | +          >
 | 
	
		
			
				|  |  | +            <el-option
 | 
	
		
			
				|  |  | +              v-for="(item, index) in selects.branchs"
 | 
	
		
			
				|  |  | +              :key="index"
 | 
	
		
			
				|  |  | +              :label="item.name"
 | 
	
		
			
				|  |  | +              :value="item.id"
 | 
	
		
			
				|  |  | +            ></el-option>
 | 
	
		
			
				|  |  | +          </el-select>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +        <el-form-item prop="usageStatus">
 | 
	
		
			
				|  |  | +          <el-select
 | 
	
		
			
				|  |  | +            placeholder="优惠券状态"
 | 
	
		
			
				|  |  | +            v-model.trim="searchForm.usageStatus"
 | 
	
		
			
				|  |  | +            filterable
 | 
	
		
			
				|  |  | +            clearable
 | 
	
		
			
				|  |  | +          >
 | 
	
		
			
				|  |  | +            <el-option label="未使用" value="0"></el-option>
 | 
	
		
			
				|  |  | +            <el-option label="已使用" value="1"></el-option>
 | 
	
		
			
				|  |  | +            <el-option label="已过期" value="2"></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>
 | 
	
		
			
				|  |  | +      </el-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="organName"
 | 
	
		
			
				|  |  | +            label="学生姓名(编号)"
 | 
	
		
			
				|  |  | +          >
 | 
	
		
			
				|  |  | +            <template slot-scope="scope">
 | 
	
		
			
				|  |  | +              <div>{{ scope.row.userName }}({{ scope.row.userId }})</div>
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            prop="phone"
 | 
	
		
			
				|  |  | +            label="手机号"
 | 
	
		
			
				|  |  | +          ></el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            prop="couponId"
 | 
	
		
			
				|  |  | +            label="优惠券编号"
 | 
	
		
			
				|  |  | +          ></el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column align="center" prop="couponId" label="状态">
 | 
	
		
			
				|  |  | +            <template slot-scope="scope">
 | 
	
		
			
				|  |  | +              <div>
 | 
	
		
			
				|  |  | +                <p>{{ scope.row.usageStatus | usageStatus }}</p>
 | 
	
		
			
				|  |  | +              </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="couponDetailVisible"
 | 
	
		
			
				|  |  | +      width="1000px"
 | 
	
		
			
				|  |  | +      append-to-body
 | 
	
		
			
				|  |  | +    >
 | 
	
		
			
				|  |  | +      <div class="chioseWrap">
 | 
	
		
			
				|  |  | +        <p>您将为以下 <span>{{tableList.length}}</span>位学员激活团练宝,激活金额<span></span>元</p>
 | 
	
		
			
				|  |  | +        <couponGiveChiose :tableList="tableList" />
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      <span slot="footer" class="dialog-footer">
 | 
	
		
			
				|  |  | +        <el-button @click="couponDetailVisible = false">取 消</el-button>
 | 
	
		
			
				|  |  | +        <el-button @click="couponDetailVisible = false" type="primary"
 | 
	
		
			
				|  |  | +          >确 定</el-button
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +      </span>
 | 
	
		
			
				|  |  | +    </el-dialog>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +import axios from "axios";
 | 
	
		
			
				|  |  | +import { getToken } from "@/utils/auth";
 | 
	
		
			
				|  |  | +import pagination from "@/components/Pagination/index";
 | 
	
		
			
				|  |  | +import { getSysCouponCode } from "./api";
 | 
	
		
			
				|  |  | +import Tooltip from "@/components/Tooltip/index";
 | 
	
		
			
				|  |  | +import load from "@/utils/loading";
 | 
	
		
			
				|  |  | +import couponGiveChiose from "./couponGiveChiose";
 | 
	
		
			
				|  |  | +export default {
 | 
	
		
			
				|  |  | +  components: { pagination, Tooltip, couponGiveChiose },
 | 
	
		
			
				|  |  | +  data() {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      searchForm: {
 | 
	
		
			
				|  |  | +        search: null,
 | 
	
		
			
				|  |  | +        couponName: null,
 | 
	
		
			
				|  |  | +        paymentOrderId: null,
 | 
	
		
			
				|  |  | +        usageStatus: null,
 | 
	
		
			
				|  |  | +        organId: null,
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      tableList: [],
 | 
	
		
			
				|  |  | +      organList: [],
 | 
	
		
			
				|  |  | +      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: {
 | 
	
		
			
				|  |  | +    init() {
 | 
	
		
			
				|  |  | +      this.getList();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    async getList() {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        const res = await getSysCouponCode({
 | 
	
		
			
				|  |  | +          ...this.searchForm,
 | 
	
		
			
				|  |  | +          page: this.rules.page,
 | 
	
		
			
				|  |  | +          rows: this.rules.limit,
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        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.$nextTick(() => {
 | 
	
		
			
				|  |  | +        this.search();
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    gotoOrder(id) {
 | 
	
		
			
				|  |  | +      this.$router.push({
 | 
	
		
			
				|  |  | +        name: "income",
 | 
	
		
			
				|  |  | +        params: { orderNo: id },
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  filters: {
 | 
	
		
			
				|  |  | +    usageStatus(val) {
 | 
	
		
			
				|  |  | +      let obj = {
 | 
	
		
			
				|  |  | +        0: "未使用",
 | 
	
		
			
				|  |  | +        1: "已使用",
 | 
	
		
			
				|  |  | +        2: "已过期",
 | 
	
		
			
				|  |  | +      };
 | 
	
		
			
				|  |  | +      return obj[val];
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +<style lang='scss' scoped>
 | 
	
		
			
				|  |  | +.chioseWrap {
 | 
	
		
			
				|  |  | +  height: 500px;
 | 
	
		
			
				|  |  | +  overflow-y: scroll;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 |