Commit dd99522f by lixiaomin

修改bug

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