Commit dd99522f by lixiaomin

修改bug

parent 103de35c
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); //this.reset();
}, },
openModal() { openModal() {
this.open = true this.open = true
......
...@@ -116,7 +116,6 @@ export default { ...@@ -116,7 +116,6 @@ export default {
} }
}); });
console.log("subTag",subTag);
if(subTag){ if(subTag){
this.$emit( this.$emit(
"callback", "callback",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:category:add']">新增</el-button> v-hasPermi="['system:category:add']">新增</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
</el-row> </el-row>
<el-table v-loading="loading" :data="classList"> <el-table v-loading="loading" :data="classList">
...@@ -110,8 +110,7 @@ export default { ...@@ -110,8 +110,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: null, name: null,
status: null, state: null
remarks: null,
}, },
// 表单参数 // 表单参数
form: {}, form: {},
...@@ -171,7 +170,8 @@ export default { ...@@ -171,7 +170,8 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.queryParams.name=null;
this.queryParams.state=null;
this.handleQuery(); this.handleQuery();
}, },
// 多选框选中数据 // 多选框选中数据
...@@ -197,10 +197,11 @@ export default { ...@@ -197,10 +197,11 @@ export default {
mess="停用"; mess="停用";
sta="2"; sta="2";
} }
row.state=sta;
this.$modal this.$modal
.confirm('是否确认' + mess + '该数据项?') .confirm('是否确认' + mess + '该数据项?')
.then(function () { .then(function () {
return updateClass({id:row.id,state:sta}); return updateClass(row);
}) })
.then(() => { .then(() => {
this.getList(); this.getList();
...@@ -244,11 +245,12 @@ export default { ...@@ -244,11 +245,12 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除分类编号为"' + ids + '"的数据项?') .confirm('是否确认删除分类编码为' + row.code + '的数据项?')
.then(function () { .then(function () {
return delClass(ids); return delClass(ids);
}) })
.then(() => { .then((response) => {
console.log("response",response);
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}) })
......
...@@ -190,7 +190,7 @@ export default { ...@@ -190,7 +190,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除编号为"' + ids + '"的数据项?') .confirm('是否确认删除编码为' + row.code + '的数据项?')
.then(function () { .then(function () {
return delSpu(ids); return delSpu(ids);
}) })
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:material:export']">导出</el-button> v-hasPermi="['system:material:export']">导出</el-button>
</el-col> --> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
</el-row> </el-row>
<!-- <el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange"> --> <!-- <el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange"> -->
...@@ -78,13 +78,13 @@ ...@@ -78,13 +78,13 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="原料名称" prop="name"> <el-form-item label="原料名称" prop="name">
<el-input v-model="form.name" placeholder="请输入原料名称" /> <el-input v-model="form.name" placeholder="请输入原料名称" maxlength="100" minlength="1"/>
</el-form-item> </el-form-item>
<el-form-item label="计量单位" prop="unit"> <el-form-item label="计量单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入计量单位" /> <el-input v-model="form.unit" placeholder="请输入计量单位" />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remarks"> <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" show-word-limit/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -192,7 +192,8 @@ export default { ...@@ -192,7 +192,8 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.queryParams.name= null;
this.queryParams.state= null;
this.handleQuery(); this.handleQuery();
}, },
// 多选框选中数据 // 多选框选中数据
...@@ -233,9 +234,12 @@ export default { ...@@ -233,9 +234,12 @@ export default {
.then(function () { .then(function () {
return updateMaterial({id:row.id,state:sta}); return updateMaterial({id:row.id,state:sta});
}) })
.then(() => { .then((response) => {
this.getList(); if(response.code=="200"){
this.$modal.msgSuccess('' + mess + '成功'); this.getList();
this.$modal.msgSuccess('' + mess + '成功');
}
}) })
.catch(() => { }); .catch(() => { });
}, },
...@@ -245,16 +249,20 @@ export default { ...@@ -245,16 +249,20 @@ export default {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateMaterial(this.form).then((response) => { updateMaterial(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); if(response.code=="200"){
this.open = false; this.$modal.msgSuccess("修改成功");
this.getList(); this.open = false;
this.getList();
}
}); });
} else { } else {
this.form.state='1'; this.form.state='1';
addMaterial(this.form).then((response) => { addMaterial(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); if(response.code=="200"){
this.open = false; this.$modal.msgSuccess("新增成功");
this.getList(); this.open = false;
this.getList();
}
}); });
} }
} }
...@@ -264,15 +272,16 @@ export default { ...@@ -264,15 +272,16 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除编号为"' + ids + '"的数据项?') .confirm('是否确认删除编码为' + row.code + '的数据项?')
.then(function () { .then(function () {
return delMaterial({id:ids}); return delMaterial({id:ids});
}) }).then((response) => {
.then(() => { if(response.code=='200'){
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}) }
.catch(() => { });
}).catch(() => { });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-table-column label="默认" width="50" align="center" prop="isDefault"> <el-table-column label="默认" width="50" align="center" prop="isDefault">
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox @change="(e) => changeDefault(e, scope.$index)" <el-checkbox @change="(e) => changeDefault(e, scope.$index)"
v-model="scope.row.isDefault" :checked="scope.row.isDefault===1"></el-checkbox> v-model="scope.row.isDefault" :checked="scope.row.isDefault===1" true-label="1" false-label="0"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="推荐" width="50" align="center" prop="isRecommend"> <el-table-column label="推荐" width="50" align="center" prop="isRecommend">
...@@ -78,10 +78,10 @@ export default { ...@@ -78,10 +78,10 @@ export default {
}, },
handleDelete(index) { handleDelete(index) {
this.list.splice(index, 1); this.list.splice(index, 1);
if(this.list.length>1){ if(this.list.length>=1){
for(let i=0;i<this.list.length;i++){ for(let i=0;i<this.list.length;i++){
if(i==0){ if(i==0){
this.list[i].isDefault="1"; this.$set(this.list[i],"isDefault","1")
return; return;
} }
} }
...@@ -97,25 +97,30 @@ export default { ...@@ -97,25 +97,30 @@ export default {
); );
}, },
add() { add() {
this.list.push({ let obj={
name: "", name: "",
amount: "", amount: "",
specRuleMaterials: [], specRuleMaterials: [],
}); isDefault:""
let p=0;
for(let i=0;i<this.list.length;i++){
if(this.list[i].isDefault=="1"){
p=1;
return;
}
} }
//没有选择默认项,默认第一条 if(this.list.length==0){
if(p==0){ obj.isDefault="1";
console.log("p2",p) this.list.push(obj);
this.list[0].isDefault="1" }else{
let p=0;
for(let i=0;i<this.list.length;i++){
if(this.list[i].isDefault=="1"){
p=1;
this.list.push(obj);
return;
}
}
//没有选择默认项,默认第一条
if(p==0){
this.$set(this.list[0],"isDefault","1")
}
} }
},
},
clearMaterial() { clearMaterial() {
this.list = []; this.list = [];
}, },
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:spec:add']">新增</el-button> v-hasPermi="['system:spec:add']">新增</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
</el-row> </el-row>
<el-table v-loading="loading" :data="specsList"> <el-table v-loading="loading" :data="specsList">
<el-table-column label="规格名称" width="300" align="center" prop="name"> <el-table-column label="规格名称" width="300" align="center" prop="name">
...@@ -100,6 +100,8 @@ export default { ...@@ -100,6 +100,8 @@ export default {
let SpecRulesValue=this.form.specRules; let SpecRulesValue=this.form.specRules;
if (SpecRulesValue.length==0) { if (SpecRulesValue.length==0) {
callback(new Error('请添加选项')); callback(new Error('请添加选项'));
}else if(SpecRulesValue.length<2){
callback(new Error('请最少添加2个选项'));
}else { }else {
callback(); callback();
} }
...@@ -176,8 +178,7 @@ export default { ...@@ -176,8 +178,7 @@ export default {
name: null, name: null,
specCode: null, specCode: null,
createDate: null, createDate: null,
specRules: [], specRules: []
status: "0",
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -224,10 +225,11 @@ export default { ...@@ -224,10 +225,11 @@ export default {
mess="停用"; mess="停用";
sta="2"; sta="2";
} }
row.state=sta;
this.$modal this.$modal
.confirm('是否确认' + mess + '该数据项?') .confirm('是否确认' + mess + '该数据项?')
.then(function () { .then(function () {
return updateSpecs({id:row.id,state:sta}); return updateSpecs(row);
}) })
.then(() => { .then(() => {
this.getList(); this.getList();
...@@ -240,34 +242,39 @@ export default { ...@@ -240,34 +242,39 @@ export default {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
let specsSelectList = this.$refs.specsSelect.list; let specsSelectList = this.$refs.specsSelect.list;
const ifHeveSpcs = specsSelectList.filter( for(let i=0;i<specsSelectList.length;i++){
(item) => item.isDefault == "1" let index=i+1;
); if(specsSelectList[i].name==""){
this.$modal.msgSuccess('选项列表中的第' + index + '行名称不能为空');
if (ifHeveSpcs.length == 0 && specsSelectList[0]) { return;
specsSelectList[0].isDefault = "1"; }
} if(specsSelectList[i].amount==""){
const submitSpces = specsSelectList.map((item) => { this.$modal.msgSuccess('选项列表中的第' + index + '行价格不能为空');
if (!item.isRecommend) { return;
item.isRecommend = "0";
} }
if (!item.isDefault) { if(!specsSelectList[i].isRecommend){
item.isDefault = "0"; specsSelectList[i].isRecommend = "0";
} }
return item; if(!specsSelectList[i].isDefault){
}); specsSelectList[i].isDefault = "0";
this.form.specRules = submitSpces; }
}
this.form.specRules = specsSelectList;
if (this.form.id != null) { if (this.form.id != null) {
updateSpecs(this.form).then((response) => { updateSpecs(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); if(response.code=="200"){
this.open = false; this.$modal.msgSuccess("修改成功");
this.getList(); this.open = false;
this.getList();
}
}); });
} else { } else {
addSpecs(this.form).then((response) => { addSpecs(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); if(response.code=="200"){
this.open = false; this.$modal.msgSuccess("新增成功");
this.getList(); this.open = false;
this.getList();
}
}); });
} }
} }
...@@ -277,7 +284,7 @@ export default { ...@@ -277,7 +284,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除规格编号为"' + ids + '"的数据项?') .confirm('是否确认删除规格编码为' + row.code + '的数据项?')
.then(function () { .then(function () {
return delSpecs(ids); return delSpecs(ids);
}) })
......
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
<el-col :span="6"> <el-col :span="6">
<el-button type="primary" @click="openSelectGoos" plain icon="el-icon-plus" size="small">添加商品 <el-button type="primary" @click="openSelectGoos" plain icon="el-icon-plus" size="small">添加商品
</el-button> </el-button>
<el-button type="danger" plain icon="el-icon-minus" size="small">下架商品</el-button> <el-button type="danger" @click="soldOutGoos" plain icon="el-icon-minus" size="small">下架商品</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="商品名称" align="center" prop="name" /> <el-table-column label="商品名称" align="center" prop="name" />
<el-table-column label="编码" align="center" prop="code" /> <el-table-column label="编码" align="center" prop="code" />
<el-table-column label="折扣价" align="center" prop="discount" /> <el-table-column label="折扣价" align="center" prop="discount" />
...@@ -24,10 +25,6 @@ ...@@ -24,10 +25,6 @@
<el-table-column label="销售总量" align="center" prop="salesVolume" /> <el-table-column label="销售总量" align="center" prop="salesVolume" />
<el-table-column label="状态" align="center" prop="status" /> <el-table-column label="状态" align="center" prop="status" />
<el-table-column label="排序" align="center"> <el-table-column label="排序" align="center">
<!-- <template slot-scope="scope">
<i class="el-icon-caret-bottom"></i>
<i class="el-icon-caret-top"></i>
</template> -->
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
...@@ -48,7 +45,8 @@ ...@@ -48,7 +45,8 @@
import { getCategoryGoods, addGoods } from "@/api/system/shop"; import { getCategoryGoods, addGoods } from "@/api/system/shop";
import SelectGoods from '@/components/SelectGoods'; import SelectGoods from '@/components/SelectGoods';
import AddRecommend from './addRecommend.vue' import AddRecommend from './addRecommend.vue'
import Preferential from './preferential.vue' import Preferential from './preferential.vue';
import {offShop } from "@/api/system/goods";
export default { export default {
props: ['shopId'], props: ['shopId'],
...@@ -66,7 +64,8 @@ export default { ...@@ -66,7 +64,8 @@ export default {
loading: false, loading: false,
list: [], list: [],
options: [], options: [],
btnId: '' btnId: '',
outIds: ''
} }
}, },
mounted() { mounted() {
...@@ -95,6 +94,28 @@ export default { ...@@ -95,6 +94,28 @@ export default {
}) })
}, },
// 多选框选中数据
handleSelectionChange(selection) {
this.outIds = selection.map((item) => item.id);
},
soldOutGoos(){
this.$modal
.confirm('是否确认下架所选商品?')
.then(function () {
console.log("999");
offShop({ goodsId: this.outIds.join(','), boo: true }).then(res => {
console.log("res",res);
// this.$modal.msgSuccess("下架成功");
})
})
.then(() => {
//this.getList();
this.$modal.msgSuccess('' + mess + '成功');
})
.catch(() => { });
},
openSelectGoos() { openSelectGoos() {
this.$refs.selectGoods.openModal() this.$refs.selectGoods.openModal()
}, },
......
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除店铺编号为"' + ids + '"的数据项?') .confirm('是否确认删除店铺名称为"' + row.name + '"的数据项?')
.then(function () { .then(function () {
return delShop(ids); return delShop(ids);
}) })
......
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