<template>
  <div>
    <el-dialog title="其他设置" :visible.sync="coffeeDiaLog" width="700px" append-to-body >
      <el-tabs v-model="activeName" >
        <el-tab-pane label="咖啡机" name="first" >
          <div>
            <el-row>
              <el-col :span="5">
                <el-input />
              </el-col>
              <el-col :span="5">
                <el-input />
              </el-col>
              <el-col :span="5">
                <el-input />
              </el-col>
              <el-col :span="5">
                <el-input />
              </el-col>
              <el-col :span="4">
                <el-input />
              </el-col>
            </el-row>
            <el-pagination    layout="prev, pager, next"  :total="total" @current-change="handleCurrentChange"> </el-pagination>
          </div>
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer" >
        <el-button type="primary" @click="otherDialogCancel" >确定</el-button>
        <el-button @click="otherDialogCancel">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {getCoffeeList} from "@/api/machine/machineDetails";
export default { 
  data() {
    return {
      // 遮罩层
      loading: true,
      coffeeDiaLog:false,
      coffeeList:[],
      activeName:"first",
      total:0,

  
    };
  },
  created() {
   
  },

  methods: {
    //弹出机器页面
    handleOthDiaLog(row){
      this.machineId=row.id;
      this.coffeeDiaLog=true;
      this.getCoffeeList();
    },
    getCoffeeList(){
      this.loading = true;
      getCoffeeList(this.machineId).then((response) => {
        if(response.code==0){
          for(let i=0;i<response.data.length;i++){
            if(response.data[i].page==1){
              this.coffeeList=response.data[i].data;
              break;
            }
          }
          this.total=response.data.length;
          this.loading = false;
        }       
      });
    },
    otherDialogCancel(){
      this.coffeeDiaLog=false;
    },
    handleCurrentChange(val){
      console.log("val",val)
    }
  }
};
</script>