<template>
  <div>
    <el-table border v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @row-dblclick="rowdbClick" max-height="650" :header-cell-style="{background: 'linear-gradient(#6cb3ff, #1873d4)',color:'#eeeeee'}">
      <el-table-column type="index" width="40" align="center"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" min-width="100" prop="courseProjectNum" label="编码"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" min-width="100" prop="courseProjectName" label="名称"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" min-width="80" prop="price" label="单价"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" label="余次">
        <el-table-column show-overflow-tooltip align="center" min-width="80" prop="courseRestCount" label="剩余"></el-table-column>
        <el-table-column show-overflow-tooltip align="center" min-width="80" prop="courseConsumeCount" label="可消费"></el-table-column>
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" label="余额">
        <el-table-column show-overflow-tooltip align="center" min-width="80" prop="courseRestPrice" label="剩余"></el-table-column>
        <el-table-column show-overflow-tooltip align="center" min-width="80" prop="courseConsumePrice" label="可消费"></el-table-column>
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" label="门店">
        <el-table-column show-overflow-tooltip align="center" min-width="100" prop="storeNum" label="编码"></el-table-column>
        <el-table-column show-overflow-tooltip align="center" min-width="120" prop="storeName" label="名称"></el-table-column>
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" min-width="100" prop="endTime" sortable label="到期时间"></el-table-column>
      <!-- <el-table-column align="center" fixed="right" label="操作" width="100" v-role="50011003">
        <template slot-scope="scope">
          <el-button @click="edit(scope.row)" size="mini" type="primary">帐户延期</el-button>
        </template>
      </el-table-column> -->
    </el-table>
    <edit ref="edit" @editData="editData"></edit>
    <detail ref="detail"></detail>
  </div>
</template>

<script>
import { listdeals } from "@/api/eashier.js";
import edit from "./edit";
import detail from "./prodetail";
export default {
  components: { edit, detail },
  data() {
    return {
      form: {}, //主对象
      list: [], //主数组
      total: 0, //分页总条数
      listLoading: false, //list加载提示开启动画
      elementLoadingText: "加载中...", //list加载提示文字
      queryForm: {
        //查询对象
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  methods: {
    //列表数组双击方法
    rowdbClick(row) {
      this.$refs.detail.show(row);
    },
    //组件传值
    show(form) {
      this.form = { ...form };
      this.getData();
    },
    //打开帐户延期弹窗
    edit(row) {
      this.$refs.edit.show(row);
    },
    //帐户延期返回方法
    editData() {
      this.getData();
    },
    //获取数据
    async getData() {
      var ids = {
        memberId: this.form.id,
      };
      listdeals(ids).then((res) => {
        if (res.code == "000000") {
          this.list = res.rows;
        } else {
          this.$alert(res.message, "查询会员疗程", {
            confirmButtonText: "确定",
            confirmButtonClass: "confirmbtnFalses",
            type: "warning",
            center: true,
            callback: (action) => {},
          });
        }
      });
    },
  },
};
</script>

<style>
</style>
