|
@@ -0,0 +1,187 @@
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="goodsType app-container">
|
|
|
+ <div class="search">
|
|
|
+ <el-button class="add-btn" type="primary" size="small" @click="handleAdd"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ tooltip-effect="dark"
|
|
|
+ border
|
|
|
+ v-loading="loading"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ label="模版名称"
|
|
|
+ prop="setMealCode"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="setMealName"
|
|
|
+ align="center"
|
|
|
+ label="商品类型"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ prop="createTime"
|
|
|
+ align="center"
|
|
|
+ label="状态"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span :class="[scope.row.status == 1?'green':'red']">{{ scope.row.status == 1 ? "启用" : "禁用"}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ @click="handle(scope.row)"
|
|
|
+ >{{ scope.row.status == 1 ? "禁用" : "启用" }}</el-button
|
|
|
+ >
|
|
|
+ <el-button type="text" size="small" @click="handleEdit(scope.row.id)"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
+ <el-button type="text" size="small" @click="handleDel(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="page-box">
|
|
|
+ <el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ background
|
|
|
+ :current-page="query.currentPage"
|
|
|
+ :page-sizes="[10, 20, 30, 40]"
|
|
|
+ :page-size="query.pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="total"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+ <script>
|
|
|
+import { debounce } from "@/utils/index";
|
|
|
+import { getList,operate } from "@/api/common";
|
|
|
+export default {
|
|
|
+ name: "goodsType",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "0",
|
|
|
+ label: "全部状态",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "已完成",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "2",
|
|
|
+ label: "进行中",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "3",
|
|
|
+ label: "失败",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ tableData: [],
|
|
|
+ loading: false,
|
|
|
+ query: {
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ title: "",
|
|
|
+ total: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ query: {
|
|
|
+ handler: debounce(function (val) {
|
|
|
+ this.getList()
|
|
|
+
|
|
|
+ }),
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handle(row){
|
|
|
+ this.$confirm(`此操作将${row.status == 1?'禁用':'启用'}该条数据, 是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ operate({setMealId:row.id,status:row.status == 1?2:1}).then(res=>{
|
|
|
+ if (res.state == "Success") {
|
|
|
+ this.$notify({
|
|
|
+ title: '提示',
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ handleEdit(id){
|
|
|
+ this.$router.push({
|
|
|
+ path:"/operationManage/goodsType/addGoodsType",
|
|
|
+ query:{
|
|
|
+ id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.$router.push("/operationManage/goodsType/addGoodsType");
|
|
|
+ },
|
|
|
+ handleDel(row) {},
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.query.currentPage = 1;
|
|
|
+ this.query.pageSize = val;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.query.currentPage = val;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+
|
|
|
+ search() {
|
|
|
+ this.query.currentPage = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.loading = true
|
|
|
+ getList(this.query).then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.state == "Success") {
|
|
|
+ this.tableData = res.content.records;
|
|
|
+ this.total = res.content.total
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" >
|
|
|
+.goodsType {
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|