Commit 55d3de72 by lixiaomin

修改bug

parent 791f22fb
...@@ -60,3 +60,5 @@ export function offShop(params) { ...@@ -60,3 +60,5 @@ export function offShop(params) {
params, params,
}); });
} }
...@@ -112,3 +112,12 @@ export function removeRecommend(params) { ...@@ -112,3 +112,12 @@ export function removeRecommend(params) {
params, params,
}); });
} }
// 多选框下架
export function offGoods(data) {
return request({
url: "/system/shop/offGoods",
method: "post",
data: data
});
}
<template> <template>
<el-dialog title="选择原料" :visible.sync="open" width="500px" append-to-body> <el-dialog title="选择原料" :visible.sync="open" width="700px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <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="原料名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入原料名称" clearable @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.name" placeholder="请输入原料名称" clearable @keyup.enter.native="handleQuery" />
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<el-table-column label="原料数量" align="center" prop="quantity"> <el-table-column label="原料数量" align="center" prop="quantity">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-input v-model.number="scope.row.quantity" placeholder="请输入原料数量" /> <el-input v-model="scope.row.quantity" placeholder="请输入原料数量" />
<div style="margin-left: 5px"> <div style="margin-left: 5px">
<span> {{scope.row.unit}}</span> <span> {{scope.row.unit}}</span>
</div> </div>
...@@ -100,20 +100,18 @@ export default { ...@@ -100,20 +100,18 @@ export default {
submitForm() { submitForm() {
let subTag=true; let subTag=true;
this.ids.map((item) => { this.ids.map((item) => {
if(!item.quantity){ if(item.quantity==="" || item.quantity==undefined){
let name=item.name; let name=item.name;
this.$modal.msgSuccess(''+name+"原料名称的原料数量为空"); this.$message.error(''+name+"原料名称的原料数量不能为空!");
subTag=false;
return; return;
}else{ }else{
// const regular = /^[+]{0,1}(\d+)$/ //正数 (不包括小数) const regular = /^[+]{0,1}([1-9]+)$|^[+]{0,1}(\d+\.\d+)$/ //正数(包括小数)
const regular = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/ //正数(包括小数)
if (!regular.test(item.quantity)) { if (!regular.test(item.quantity)) {
this.$modal.msgSuccess(''+item.name+"原料名称的原料数量不是大于0的数字!") this.$message.error(''+item.name+"原料名称的原料数量不是大于0的数字!")
subTag=false; subTag=false;
return; return;
} }
} }
}); });
if(subTag){ if(subTag){
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-input readonly="readonly" v-model="specNames" placeholder="请选择"> <el-input readonly="readonly" v-model="specNames" placeholder="请选择">
<el-button @click="selectSpecs" slot="append" icon="el-icon-search"></el-button> <el-button @click="selectSpecs" slot="append" icon="el-icon-search"></el-button>
</el-input> </el-input>
<el-dialog title="请选择分类" :visible.sync="open" width="500px" append-to-body> <el-dialog title="请选择规格" :visible.sync="open" width="700px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <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="规格名称 " prop="name">
<el-input v-model="queryParams.name" placeholder="规格名称 " clearable @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.name" placeholder="规格名称 " clearable @keyup.enter.native="handleQuery" />
...@@ -19,8 +19,15 @@ ...@@ -19,8 +19,15 @@
<el-checkbox @change="x => handleSelectionChange(x, scope.row)" v-model="scope.row.selected"></el-checkbox> <el-checkbox @change="x => handleSelectionChange(x, scope.row)" v-model="scope.row.selected"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<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="specRules">
<template slot-scope="scope">
<el-tag style="margin-right:10px;" v-for="item in scope.row.specRules" :key="item.id">
{{ item.name }}
</el-tag>
</template>
</el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
...@@ -49,7 +56,7 @@ export default { ...@@ -49,7 +56,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: null, name: null,
status: 0, state: 1,
}, },
open: false, open: false,
specNames: "", specNames: "",
......
...@@ -197,15 +197,16 @@ export default { ...@@ -197,15 +197,16 @@ 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(row); return updateClass({id:row.id,state:sta});
}) })
.then(() => { .then((response) => {
if(response.code="200"){
this.getList(); this.getList();
this.$modal.msgSuccess('' + mess + '成功'); this.$modal.msgSuccess('' + mess + '成功');
}
}) })
.catch(() => { }); .catch(() => { });
}, },
......
...@@ -160,6 +160,39 @@ export default { ...@@ -160,6 +160,39 @@ export default {
callback(); callback();
} }
}; };
var validateDiscount = (rule, value, callback) => {
let discountValue=this.form.discount;
if (discountValue == undefined || discountValue === '') {
callback(new Error('不能为空'));
}else if(!Number.isInteger(discountValue)){
callback(new Error('请输入数字值'));
}else if(this.form.price){
if(discountValue >= this.form.price){
callback(new Error('折扣价不能大于等于原价'));
}else {
callback();
}
}else {
callback();
}
};
var validatePrice = (rule, value, callback) => {
let priceValue=this.form.price;
if (priceValue == undefined || priceValue === '') {
callback(new Error('不能为空'));
}else if(!Number.isInteger(priceValue)){
callback(new Error('请输入数字值'));
}else if(this.form.discount){
if(priceValue<=this.form.discount){
callback(new Error('原价不能小于等于折扣价'));
}else {
callback();
}
}else {
callback();
}
};
return { return {
title: "", title: "",
specNames: "", specNames: "",
...@@ -175,8 +208,8 @@ export default { ...@@ -175,8 +208,8 @@ export default {
category: [{required: true, message: "不能为空", trigger: "blur" }], category: [{required: true, message: "不能为空", trigger: "blur" }],
spec: [{required: true, message: "不能为空", trigger: "blur" }], spec: [{required: true, message: "不能为空", trigger: "blur" }],
takeTime: [{required: true, message: "不能为空", trigger: "blur" }], takeTime: [{required: true, message: "不能为空", trigger: "blur" }],
discount: [{required: true, message: "不能为空", trigger: "blur" }], discount: [{required: true,validator: validateDiscount, trigger: "blur" }],
price: [{required: true, message: "不能为空", trigger: "blur" }], price: [{required: true, validator: validatePrice, trigger: "blur" }],
thumbnail:[{ required: true, validator: validateThumbnail, trigger: 'blur' }], thumbnail:[{ required: true, validator: validateThumbnail, trigger: 'blur' }],
introImages:[{required: true, validator: validateIntroImages,trigger: "blur" }], introImages:[{required: true, validator: validateIntroImages,trigger: "blur" }],
detailImages:[{required: true, validator: validateDetailImages, trigger: "blur" }], detailImages:[{required: true, validator: validateDetailImages, trigger: "blur" }],
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品分类" align="center" prop="category" width="100" /> <el-table-column label="商品分类" align="center" prop="categoryName" width="100" />
<el-table-column label="简介" align="center" prop="desc" width="150" /> <el-table-column label="简介" align="center" prop="desc" width="150" />
<el-table-column label="售价" align="center" prop="price" /> <el-table-column label="售价" align="center" prop="price" />
<el-table-column label="总销量" align="center" prop="salesVolume" width="150" /> <el-table-column label="总销量" align="center" prop="salesVolume" width="150" />
......
...@@ -225,15 +225,18 @@ export default { ...@@ -225,15 +225,18 @@ export default {
mess="停用"; mess="停用";
sta="2"; sta="2";
} }
row.state=sta; //let obj = JSON.parse(JSON.stringify(row));
//obj.state=sta;
this.$modal this.$modal
.confirm('是否确认' + mess + '该数据项?') .confirm('是否确认' + mess + '该数据项?')
.then(function () { .then(function () {
return updateSpecs(row); return updateSpecs({id:row.id,state:sta});
}) })
.then(() => { .then((response) => {
if(response.code="200"){
this.getList(); this.getList();
this.$modal.msgSuccess('' + mess + '成功'); this.$modal.msgSuccess('' + mess + '成功');
}
}) })
.catch(() => { }); .catch(() => { });
}, },
...@@ -248,8 +251,8 @@ export default { ...@@ -248,8 +251,8 @@ export default {
this.$modal.msgSuccess('选项列表中的第' + index + '行名称不能为空'); this.$modal.msgSuccess('选项列表中的第' + index + '行名称不能为空');
return; return;
} }
if(specsSelectList[i].amount==""){ if(specsSelectList[i].amount=="" || specsSelectList[i].amount==0){
this.$modal.msgSuccess('选项列表中的第' + index + '行价格不能为空'); this.$modal.msgSuccess('选项列表中的第' + index + '行价格不能为空或0');
return; return;
} }
if(!specsSelectList[i].isRecommend){ if(!specsSelectList[i].isRecommend){
......
...@@ -18,7 +18,21 @@ ...@@ -18,7 +18,21 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <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" width="200">
<template slot-scope="scope">
<div style="display: flex;align-items: center">
<div>
<span>{{scope.row.name}}</span>
</div>
<div style="margin-left: 8px;margin-right: 8px">
<el-button v-show="scope.row.recommend=='0'" type="text"></el-button>
</div>
<div>
<el-button style="color:red" v-show="scope.row.preferential=='0'" type="text"></el-button>
</div>
</div>
</template>
</el-table-column>
<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" />
<el-table-column label="原价" align="center" prop="price" /> <el-table-column label="原价" align="center" prop="price" />
...@@ -26,7 +40,6 @@ ...@@ -26,7 +40,6 @@
<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">
</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">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" @click="addRecommend(scope.row)" type="text"> <el-button size="mini" @click="addRecommend(scope.row)" type="text">
...@@ -42,11 +55,10 @@ ...@@ -42,11 +55,10 @@
</template> </template>
<script> <script>
import { getCategoryGoods, addGoods } from "@/api/system/shop"; import { getCategoryGoods, addGoods ,offGoods} 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'],
...@@ -90,8 +102,6 @@ export default { ...@@ -90,8 +102,6 @@ export default {
this.list = data[0].goodsList; this.list = data[0].goodsList;
this.btnId = data[0].id this.btnId = data[0].id
} }
}) })
}, },
// 多选框选中数据 // 多选框选中数据
...@@ -99,22 +109,28 @@ export default { ...@@ -99,22 +109,28 @@ export default {
this.outIds = selection.map((item) => item.id); this.outIds = selection.map((item) => item.id);
}, },
soldOutGoos(){ soldOutGoos(){
// offGoods({"shopId":this.shopId,"goodsIds":this.outIds}).then(({ response }) => {
// console.log("response",response);
// })
this.$modal this.$modal
.confirm('是否确认下架所选商品?') .confirm('是否确认下架所选商品?')
.then(function () { .then(function () {
console.log("999"); return offGoods({"shopId":this.shopId,"goodsIds":this.outIds});
offShop({ goodsId: this.outIds.join(','), boo: true }).then(res => {
console.log("res",res);
// this.$modal.msgSuccess("下架成功");
})
}) })
.then(() => { .then((response) => {
//this.getList(); // console.log("response",response);
this.$modal.msgSuccess('' + mess + '成功'); // if(response.code=="200"){
// this.getList();
//this.$modal.msgSuccess('' + mess + '成功');
// }
}) })
.catch(() => { }); .catch(() => { });
}, },
openSelectGoos() { openSelectGoos() {
this.$refs.selectGoods.openModal() this.$refs.selectGoods.openModal()
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<AddShop :shopId="shopId" @setShopId="setShopId" @closeDialog="closeHandle"/> <AddShop :shopId="shopId" @setShopId="setShopId" @closeDialog="closeHandle"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :disabled="!shopId" label="机器信息" name="second"> <el-tab-pane :disabled="!shopId" label="机器信息" name="second">
<Machine :shopId="shopId" /> <Machine ref="Machine" :shopId="shopId" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :disabled="!shopId" label="商品信息" name="third"> <el-tab-pane :disabled="!shopId" label="商品信息" name="third">
<Commodity :shopId="shopId" /> <Commodity ref="Commodity" :shopId="shopId" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :disabled="!shopId" label="点单屏推荐" name="fourth"> <el-tab-pane :disabled="!shopId" label="点单屏推荐" name="fourth">
<Recommend ref="Recommend" :shopId="shopId" /> <Recommend ref="Recommend" :shopId="shopId" />
...@@ -39,6 +39,12 @@ export default { ...@@ -39,6 +39,12 @@ export default {
}, },
watch: { watch: {
activeName(value) { activeName(value) {
if (value == 'second') {
this.$refs.Machine.getList()
}
if (value == 'third') {
this.$refs.Commodity.getList()
}
if (value == 'fourth') { if (value == 'fourth') {
this.$refs.Recommend.getList() this.$refs.Recommend.getList()
} }
......
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