139 行
5.0 KiB
HTML
可执行文件
139 行
5.0 KiB
HTML
可执行文件
<!--[1.8.38]-->
|
|
<style>
|
|
.el-table__row > td:last-child > .cell {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
</style>
|
|
<div id="agentMeal">
|
|
<if condition="$authArr['addmeal'] eq true">
|
|
<el-button type="primary" @click="editMeal('')" size="small"
|
|
style="margin-bottom:10px;">添加套餐
|
|
</el-button>
|
|
</if>
|
|
<!-- 查询数据-->
|
|
<div style="max-width: calc(100vw - 208px);">
|
|
<el-table :data="mealshow" border style="width: calc(100vw - 208px);box-sizing: border-box;">
|
|
<el-table-column type="index" label="序号"></el-table-column>
|
|
<el-table-column prop="name" label="套餐名称"></el-table-column>
|
|
<el-table-column prop="addtime" label="添加时间"></el-table-column>
|
|
<el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<if condition="$authArr['addmeal'] eq true">
|
|
<el-button type="primary" @click="editMeal(scope.row.id)" size="mini">编辑</el-button>
|
|
</if>
|
|
<if condition="$authArr['delmeal'] eq true">
|
|
<el-button @click="delMeal(scope.row.id)" size="mini">删除</el-button>
|
|
</if>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<el-pagination
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page="currentPage"
|
|
:page-sizes="[10, 20, 30, 40]"
|
|
:page-size="100"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="len">
|
|
</el-pagination>
|
|
</div>
|
|
<script>
|
|
var agentMeal = new Vue({
|
|
el: '#agentMeal',
|
|
data: function () {
|
|
return {
|
|
mealshow: [],
|
|
currentPage: 1,
|
|
limit: 10,
|
|
len: 0,
|
|
loading: false,
|
|
}
|
|
},
|
|
methods: {
|
|
handleSizeChange: function (val) {
|
|
this.limit = val;
|
|
this.getMeal();
|
|
},
|
|
handleCurrentChange: function (val) {
|
|
this.currentPage = val;
|
|
this.getMeal();
|
|
},
|
|
getMeal: function () {
|
|
var that = this;
|
|
$.ajax({
|
|
url: "{:U('mealshow')}",
|
|
type: "post",
|
|
data: {
|
|
page: this.currentPage,
|
|
limit: this.limit
|
|
},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.mealshow = res.data;
|
|
that.len = parseInt(res.count);
|
|
} else {
|
|
that.mealshow = res.data;
|
|
that.len = parseInt(res.count);
|
|
that.$message({
|
|
type: 'error',
|
|
message: '获取套餐失败',
|
|
duration: 1000
|
|
});
|
|
}
|
|
}
|
|
})
|
|
},
|
|
//添加代理商
|
|
editMeal: function (id, title, url) {
|
|
MenuApp.pathData.push({
|
|
name: id ? '编辑套餐' : '添加套餐',
|
|
path: "{:U('addmeal')}?id=" + id,
|
|
onClose: () => {
|
|
id ? this.getMeal() : this.handleCurrentChange(1)
|
|
}
|
|
})
|
|
},
|
|
//删除
|
|
delMeal: function (id) {
|
|
var that = this;
|
|
this.$confirm('此操作将永久删除该套餐, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
$.ajax({
|
|
url: "{:U('delmeal')}",
|
|
type: 'post',
|
|
data: {
|
|
id: id
|
|
},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.$message({
|
|
type: 'success',
|
|
message: res.msg
|
|
});
|
|
that.getMeal();
|
|
} else {
|
|
that.$message({
|
|
type: 'success',
|
|
message: res.msg
|
|
});
|
|
}
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
},
|
|
created: function () {
|
|
this.getMeal();
|
|
}
|
|
})
|
|
|
|
</script> |