//计费稽核
<template>
  <div id="endMaintenance">
    <page-title>计费稽核</page-title>
	<div style="margin:1.25rem">
		<el-button type="success" @click="agree">通过</el-button>
		<el-button type="danger" @click="refuse">不通过</el-button>
	</div>
	
    <dilTable v-bind.sync="option" ref="table">
      <el-table-column fixed="right" label="操作" width="60">
        <template slot-scope="scope">
          <el-button type="text" size="mini" @click="getclick(scope)">
            查看
          </el-button>
        </template>
      </el-table-column>
    </dilTable>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
  data() {
    return {
      option: {
        // 表格请求数据的地址
        requestUrl:
          "/api/v1/bms/getSaleTruckStatementDetailsOrderList?apiId=176&statementId=" +
          this.$route.params.statementId,
      },
    };
  },
  methods: {
	agree(){
		console.log("同意")
		this.$confirm("是否通过", "提示", {
		  confirmButtonText: "确定",
		  cancelButtonText: "取消",
		  type: "warning",
		  center: true,
		})
		  .then(() => {
		    this.axios
		      .post("/api/v1/bms/updateBmstruckCheck?statementId="+this.$route.params.statementId+"&status="+"1"+"&person="+"2"
					)
		      .then((res) => {
		        if (res.data.code == 0) {
		          this.$message({
		            type: "success",
		            message: "通过成功!",
		          });     
		          this.$router.go(-1);
		        } else {
		          this.$message({
		            message: "通过失败",
		            type: "warning",
		          });
		        }
		      });
		  })
		  .catch(() => {
		    this.$message({
		      type: "info",
		      message: "取消通过!",
		    });
		  });	
	},
	refuse(){
		this.$confirm("是否不通过", "警告", {
		  confirmButtonText: "确定",
		  cancelButtonText: "取消",
		  type: "warning",
		  center: true,		  
		})
		  .then(() => {
		    this.axios
		      .post("/api/v1/bms/updateBmstruckCheck?statementId="+this.$route.params.statementId+"&status="+"0"+"&person="+"2"
					)
		      .then((res) => {
		        if (res.data.code == 0) {
		          this.$message({
		            type: "success",
		            message: "不通过成功!",
		          });     
		          this.$router.go(-1);
		        } else {
		          this.$message({
		            message: "不通过失败",
		            type: "warning",
		          });
		        }
		      });
		  })
		  .catch(() => {
		    this.$message({
		      type: "info",
		      message: "取消不通过!",
		    });
		  });
	},	
    getclick(scope){
		console.log(scope.row.orderId)
		this.$router.push("/getTransportResult/"+scope.row.orderId)
	},
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="scss" scoped>

</style>
