Commit 0779afc2 by lixiaomin

修改商品页面

parent c6e4108b
......@@ -4,67 +4,62 @@
<el-form-item label="分类名称 " prop="name">
<el-input v-model="queryParams.name" placeholder="分类名称 " clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="code">
<el-input v-model="queryParams.code" placeholder="请输入状态" clearable @keyup.enter.native="handleQuery" />
<el-form-item label="状态">
<el-select v-model="queryParams.state" placeholder="请选择" clearable @keyup.enter.native="handleQuery">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:category:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['system:category:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:category:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:category:export']">导出</el-button>
</el-col>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="classList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table v-loading="loading" :data="classList">
<el-table-column label="分类名称" align="center" prop="name" />
<el-table-column label="编码" align="center" prop="code" />
<el-table-column label="备注" align="center" prop="remarks" />
<el-table-column label="商品数量" align="center" prop="goodsCount" />
<el-table-column label="排序"/>
<el-table-column label="状态" align="center" prop="state">
<template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span>
<span v-if="scope.row.state == 2"></span>
<span v-if="scope.row.state == 2"></span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:category:remove']">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:category:edit']">修改</el-button>
<el-button v-show="scope.row.state == 2" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'1')"
v-hasPermi="['system:material:edit']">启用</el-button>
<el-button v-show="scope.row.state == 1" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'2')"
v-hasPermi="['system:material:edit']">停用</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="名称" />
<el-input v-model="form.name" placeholder="名称" minlength="1" maxlength="100"/>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
<el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" maxlength="500"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -123,6 +118,16 @@ export default {
code: [{ required: true, message: "不能为空", trigger: "blur" }],
createTime: [{ required: true, message: "不能为空", trigger: "blur" }],
},
options: [{
value: null,
label: '全部'
}, {
value: '1',
label: '启用'
}, {
value: '2',
label: '停用'
}],
};
},
created() {
......@@ -177,6 +182,29 @@ export default {
this.open = true;
this.title = "添加商品分类";
},
/** 启用、禁用按钮操作 */
handleStatus(row,tag) {
let mess="";
let sta="";
if(tag=='1'){
mess="启用";
sta="1";
}else if(tag=='2'){
mess="停用";
sta="2";
}
this.$modal
.confirm('是否确认' + mess + '该数据项?')
.then(function () {
return updateClass({id:row.id,state:sta});
})
.then(() => {
this.getList();
this.$modal.msgSuccess('' + mess + '成功');
})
.catch(() => { });
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
......
......@@ -27,20 +27,11 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:goods:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:goods:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:goods:export']">导出</el-button>
</el-col>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<PutShopOffShop ref="putShopOffShop" @callback="getList" />
<el-table v-loading="loading" :data="spuList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table v-loading="loading" :data="spuList" >
<el-table-column label="商品名称" align="center" prop="name" width="150" />
<el-table-column label="编码" align="center" prop="code" width="150" />
<el-table-column label="缩略图" align="center" prop="" width="150">
......@@ -69,8 +60,6 @@
</el-table-column>
<el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:goods:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-if="authBtn(['1', '2', '3', '4'], scope.row.state)">删除</el-button>
<el-button size="mini" type="text" v-if="authBtn(['2', '4'], scope.row.state)"
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="原料名称" prop="name">
<el-form-item label="原料名称">
<el-input v-model="queryParams.name" placeholder="请输入原料名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="materialCode">
<el-input v-model="queryParams.materialCode" placeholder="状态" clearable @keyup.enter.native="handleQuery" />
<el-form-item label="状态">
<el-select v-model="queryParams.state" placeholder="请选择" clearable @keyup.enter.native="handleQuery">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<!-- <el-input v-model="queryParams.materialCode" placeholder="状态" clearable @keyup.enter.native="handleQuery" /> -->
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索
......@@ -20,7 +28,7 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:material:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['system:material:edit']">修改</el-button>
</el-col>
......@@ -31,12 +39,13 @@
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:material:export']">导出</el-button>
</el-col>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange"> -->
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table v-loading="loading" :data="materialList" >
<el-table-column label="原料名称" width="150" align="center" prop="name" />
<el-table-column label="编码" width="150" align="center" prop="code" />
<el-table-column label="计量单位" width="150" align="center" prop="unit" />
......@@ -44,15 +53,17 @@
<el-table-column label="状态" width="150" align="center" prop="state">
<template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span>
<span v-if="scope.row.state == 2"></span>
<span v-if="scope.row.state == 2"></span>
</template>
</el-table-column>
<el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:material:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:material:remove']">删除</el-button>
<el-button v-show="scope.row.state == 2" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'1')"
v-hasPermi="['system:material:edit']">启用</el-button>
<el-button v-show="scope.row.state == 1" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'2')"
v-hasPermi="['system:material:edit']">停用</el-button>
</template>
</el-table-column>
</el-table>
......@@ -116,17 +127,30 @@ export default {
pageNum: 1,
pageSize: 10,
name: null,
materialCode: null,
state: null,
remarks: null,
state: null
},
// 表单参数
form: {},
form: {
id: null,
name: null,
unit: null,
remarks: null
},
// 表单校验
rules: {
name: [{ required: true, message: "不能为空", trigger: "blur" }],
createTime: [{ required: true, message: "不能为空", trigger: "blur" }],
unit: [{ required: true, message: "不能为空", trigger: "blur" }],
},
options: [{
value: null,
label: '全部'
}, {
value: '1',
label: '启用'
}, {
value: '2',
label: '停用'
}],
};
},
created() {
......@@ -152,10 +176,8 @@ export default {
this.form = {
id: null,
name: null,
materialCode: null,
state: "0",
unit: null,
remarks: null,
createTime: null,
};
this.resetForm("form");
},
......@@ -181,15 +203,27 @@ export default {
this.open = true;
this.title = "添加原料";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getMaterial(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改";
});
/** 启用、禁用按钮操作 */
handleStatus(row,tag) {
let mess="";
let sta="";
if(tag=='1'){
mess="启用";
sta="1";
}else if(tag=='2'){
mess="停用";
sta="2";
}
this.$modal
.confirm('是否确认' + mess + '该数据项?')
.then(function () {
return updateMaterial({id:row.id,state:sta});
})
.then(() => {
this.getList();
this.$modal.msgSuccess('' + mess + '成功');
})
.catch(() => { });
},
/** 提交按钮 */
submitForm() {
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="规格名称" prop="name">
<el-form-item label="规格名称">
<el-input v-model="queryParams.name" placeholder="请输入规格名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.state" placeholder="请选择" clearable @keyup.enter.native="handleQuery">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:spec:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['system:spec:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:spec:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:spec:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="specsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table v-loading="loading" :data="specsList">
<el-table-column label="规格名称" width="300" align="center" prop="name" />
<el-table-column label="规格编码" width="180" align="center" prop="code" />
<el-table-column label="选项" align="center" prop="specRules">
......@@ -44,15 +39,17 @@
<el-table-column label="状态" width="180" align="center" prop="state">
<template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span>
<span v-else></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:spec:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:spec:remove']">删除</el-button>
<el-button v-show="scope.row.state == 2" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'1')"
v-hasPermi="['system:material:edit']">启用</el-button>
<el-button v-show="scope.row.state == 1" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'2')"
v-hasPermi="['system:material:edit']">停用</el-button>
</template>
</el-table-column>
</el-table>
......@@ -119,9 +116,7 @@ export default {
pageNum: 1,
pageSize: 10,
name: null,
specCode: null,
createDate: null,
status: null,
state: null
},
// 表单参数
form: {},
......@@ -131,6 +126,16 @@ export default {
{ required: true, message: "规格名称不能为空", trigger: "blur" },
],
},
options: [{
value: null,
label: '全部'
}, {
value: '1',
label: '启用'
}, {
value: '2',
label: '停用'
}],
};
},
created() {
......@@ -185,16 +190,40 @@ export default {
this.open = true;
this.title = "添加规格";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getSpecs(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改规格";
});
/** 启用、禁用按钮操作 */
handleStatus(row,tag) {
let mess="";
let sta="";
if(tag=='1'){
mess="启用";
sta="1";
}else if(tag=='2'){
mess="停用";
sta="2";
}
this.$modal
.confirm('是否确认' + mess + '该数据项?')
.then(function () {
return updateSpecs({id:row.id,state:sta});
})
.then(() => {
this.getList();
this.$modal.msgSuccess('' + mess + '成功');
})
.catch(() => { });
},
/** 修改按钮操作 */
// handleUpdate(row) {
// this.reset();
// const id = row.id || this.ids;
// getSpecs(id).then((response) => {
// this.form = response.data;
// this.open = true;
// this.title = "修改规格";
// });
// },
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment