vue开启/停止按钮切换
<el-table
:data="tableData"
ref="tableDatas"
class="view_table"
style="width: 100%"
id="tableExcel"
v-loading="loading"
@row-click="rowClick"
>
<el-table-column
prop="addTime"
label="添加时间"
align="center"
min-width="120"
></el-table-column>
---------------
<el-table-column fixed="right"
align="right" label="操作"
width="260"
class="tab_lastbtn">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
v-if="scope.row.state == 2"
@click.stop="editStatus(1, scope.row)"
>开启兑换</el-button
>
<el-button
type="primary"
size="small"
v-if="scope.row.state == 1"
@click.stop="editStatus(2, scope.row)"
>结束兑换</el-button
>
</template>
</el-table-column>
</el-table>
methods:
//停止/开启
editStatus(type, row) {
this.$confirm(`确认${type === 1 ? "开启" : "结束"}兑换吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// put("/sys/integral/updateConvert?id=" + row.id + "&state=" + type).then(
put("/sys/integral/updateConvert/" + row.id + "/" + type).then(
(res) => {
if (res.code === 200) {
console.log(res);
this.getData();
if (type === 1) {
this.$message.success("开启成功");
} else {
this.$message.success("关闭成功");
}
} else {
this.$message.error(res.msg);
}
}
);
})
.catch(() => {});
},