<el-table-column label="操作" width="130px">
<template slot-scope="scope">
<el-button type="danger" size="mini" icon="el-icon-delete" @click="removeById(scope.row.goods_id)"></el-button>
</template>
</el-table-column>
async removeById(id){
const confirmResult =await this.$confirm('此操作将永久删除该商品, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).catch(err=>err)
if(confirmResult!=='confirm'){
return this.$message.info('已取消删除')
}
const {data:res} = await this.$http.delete(`goods/${id}`)
if(res.meta.status !== 200){
return this.$message.error('删除失败')
}
this.$message.success('删除成功')
this.getGoodsList()//重新获取列表
}