
<template>
  <div class="verificationMember usersList">
    <div class="head-title">
        会员等级
        <el-button @click="goUrl" style="float:right;margin-top: -5px;" size="small" type="primary">添加会员等级</el-button>
    </div>
    <div class="content">
        <div>
            <div class="searchInput">
                <el-input style="display:inline-block;width:225px;height:30px"
                placeholder="请输入会员名称搜索"
                v-model="msg.Name"
                size="small"
                clearable>
                </el-input>
                <span @click="getList" class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span>
            </div>
        </div>
        <el-table
            :data="tableData"
            border
            style="width: 100%;margin:20px 0">
            <el-table-column
            prop="Id"
            label="ID">
            </el-table-column>
            <el-table-column
            prop="Name"
            label="会员等级">
            </el-table-column>
            <el-table-column
            prop="name"
            label="会员名称">
            </el-table-column>
            <el-table-column
            prop="Discount"
            label="折扣">
            </el-table-column>
            <el-table-column
            prop="name"
            label="购买价格(元)">
                <template slot-scope="scope">
                    <span class="blue">{{scope.row.MemberBuyMoney}}</span>
                </template>
            </el-table-column>
            <el-table-column
            prop="name"
            label="累计金额升级条件(元)">
                <template slot-scope="scope">
                    <span class="blue">{{scope.row.UpGradeMoney}}</span>
                </template>
            </el-table-column>
            <el-table-column
            prop="name"
            label="启用状态">
                <template slot-scope="scope">
                    <span v-if="scope.row.Enabled==1">是</span>
                    <span v-if="scope.row.Enabled==2">否</span>
                </template>
            </el-table-column>
            <el-table-column
            prop="address"
            width="200"
            label="操作">
            <template slot-scope="scope">
                <img style="width:32px;height:32px" src="../../assets/img/userman/edit.png" alt="">
                <img @click="Delete(scope.row)" style="width:32px;height:32px;margin:0 10px" src="../../assets/img/userman/del.png" alt="">
                <!-- <img style="width:32px;height:32px" src="../../assets/img/userman/balance.png" alt=""> -->
            </template>    
            </el-table-column>
        </el-table>
        <el-pagination style="text-align:right"
        background
        @current-change="handleCurrentChange"
        :page-size="msg.pageSize"
        layout="prev, pager, next"
        :total="total">
        </el-pagination>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        addMsg:{},
        dialogVisible:false,
        value:'',
        options:[],
        tableData:[],
        msg:{
            pageIndex:1,
            pageSize:15,
            Grade:0,
            Name:'',
            Enabled:0,
        },
        total:0,
        rules: {
                name: [
                    { required: true, message: '新手机号', trigger: 'blur' }
                ],
            },

        
      };
    },
    created() {
        this.getList();
    },
    methods: {
        Delete(row){
            let that=this;
            that.Confirm("是否删除?", function () {
            that.apipost(
                "/api/user/DelMemberGradeInfo",
                {GradeId:row.Id},
                res => {
                if (res.data.resultCode == 1) {
                    that.Success(res.data.message);
                    that.getList();
                } else {
                    that.Error(res.data.message);
                }
                },
                null
            );
            });
        },
        getList(){
            this.loading=true;
            this.apipost("/api/user/GetMemberGradePageList", this.msg, res => {
                this.loading=false;
                if(res.data.resultCode==1){
                    this.total=res.data.data.count;
                    let pageData=res.data.data.pageData;
                    this.tableData=pageData;
                }
                
            })
        },
        goUrl(){
            this.$router.push({
                name: 'setMember',
                query: {
                    blank: "y"
                }
            });
        },
        handleCurrentChange(val) {
            this.msg.pageIndex = val;
            this.getList();
        },

    },
    mounted() {
      
    }
  };

</script>
<style>
.usersList .blue{
    color:#409EFF;
    
}
.usersList .content .searchInput{
    border: 1px solid #DCDFE6;
    border-radius: 4px;
}
.usersList .content .searchInput .el-input__inner{
    border:none;outline:none;
    height: 30px;
    line-height: 30px;
}
.usersList .content .searchInput{
    line-height: normal;
    display: inline-table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    width:250px;
    margin-right: 20px;
}
.usersList .content{
    background: #fff;
    margin-top:10px;
    padding: 20px;
    box-sizing: border-box;
}

</style>
