Commit 55d3de72 by lixiaomin

修改bug

parent 791f22fb
......@@ -60,3 +60,5 @@ export function offShop(params) {
params,
});
}
......@@ -112,3 +112,12 @@ export function removeRecommend(params) {
params,
});
}
// 多选框下架
export function offGoods(data) {
return request({
url: "/system/shop/offGoods",
method: "post",
data: data
});
}
<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-item label="原料名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入原料名称" clearable @keyup.enter.native="handleQuery" />
......@@ -15,7 +15,7 @@
<el-table-column label="原料数量" align="center" prop="quantity">
<template slot-scope="scope">
<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">
<span> {{scope.row.unit}}</span>
</div>
......@@ -99,21 +99,19 @@ export default {
/** 提交按钮 */
submitForm() {
let subTag=true;
this.ids.map((item) => {
if(!item.quantity){
this.ids.map((item) => {
if(item.quantity==="" || item.quantity==undefined){
let name=item.name;
this.$modal.msgSuccess(''+name+"原料名称的原料数量为空");
return;
}else{
// const regular = /^[+]{0,1}(\d+)$/ //正数 (不包括小数)
const regular = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/ //正数(包括小数)
if (!regular.test(item.quantity)) {
this.$modal.msgSuccess(''+item.name+"原料名称的原料数量不是大于0的数字!")
this.$message.error(''+name+"原料名称的原料数量不能为空!");
subTag=false;
return;
}
}else{
const regular = /^[+]{0,1}([1-9]+)$|^[+]{0,1}(\d+\.\d+)$/ //正数(包括小数)
if (!regular.test(item.quantity)) {
this.$message.error(''+item.name+"原料名称的原料数量不是大于0的数字!")
subTag=false;
return;
}
}
});
if(subTag){
......
......@@ -3,7 +3,7 @@
<el-input readonly="readonly" v-model="specNames" placeholder="请选择">
<el-button @click="selectSpecs" slot="append" icon="el-icon-search"></el-button>
</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-item label="规格名称 " prop="name">
<el-input v-model="queryParams.name" placeholder="规格名称 " clearable @keyup.enter.native="handleQuery" />
......@@ -19,8 +19,15 @@
<el-checkbox @change="x => handleSelectionChange(x, scope.row)" v-model="scope.row.selected"></el-checkbox>
</template>
</el-table-column>
<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>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
......@@ -49,7 +56,7 @@ export default {
pageNum: 1,
pageSize: 10,
name: null,
status: 0,
state: 1,
},
open: false,
specNames: "",
......
......@@ -197,15 +197,16 @@ export default {
mess="停用";
sta="2";
}
row.state=sta;
this.$modal
.confirm('是否确认' + mess + '该数据项?')
.then(function () {
return updateClass(row);
return updateClass({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(() => { });
},
......
......@@ -159,7 +159,40 @@ export default {
}else {
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 {
title: "",
specNames: "",
......@@ -175,8 +208,8 @@ export default {
category: [{required: true, message: "不能为空", trigger: "blur" }],
spec: [{required: true, message: "不能为空", trigger: "blur" }],
takeTime: [{required: true, message: "不能为空", trigger: "blur" }],
discount: [{required: true, message: "不能为空", trigger: "blur" }],
price: [{required: true, message: "不能为空", trigger: "blur" }],
discount: [{required: true,validator: validateDiscount, trigger: "blur" }],
price: [{required: true, validator: validatePrice, trigger: "blur" }],
thumbnail:[{ required: true, validator: validateThumbnail, trigger: 'blur' }],
introImages:[{required: true, validator: validateIntroImages,trigger: "blur" }],
detailImages:[{required: true, validator: validateDetailImages, trigger: "blur" }],
......
......@@ -47,7 +47,7 @@
</div>
</template>
</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="price" />
<el-table-column label="总销量" align="center" prop="salesVolume" width="150" />
......
......@@ -224,16 +224,19 @@ export default {
}else if(tag=='2'){
mess="停用";
sta="2";
}
row.state=sta;
}
//let obj = JSON.parse(JSON.stringify(row));
//obj.state=sta;
this.$modal
.confirm('是否确认' + mess + '该数据项?')
.then(function () {
return updateSpecs(row);
return updateSpecs({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(() => { });
},
......@@ -247,9 +250,9 @@ export default {
if(specsSelectList[i].name==""){
this.$modal.msgSuccess('选项列表中的第' + index + '行名称不能为空');
return;
}
if(specsSelectList[i].amount==""){
this.$modal.msgSuccess('选项列表中的第' + index + '行价格不能为空');
}
if(specsSelectList[i].amount=="" || specsSelectList[i].amount==0){
this.$modal.msgSuccess('选项列表中的第' + index + '行价格不能为空或0');
return;
}
if(!specsSelectList[i].isRecommend){
......
......@@ -17,8 +17,22 @@
</el-col>
</el-row>
<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 type="selection" width="55" align="center" />
<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="discount" />
<el-table-column label="原价" align="center" prop="price" />
......@@ -26,7 +40,6 @@
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="排序" align="center">
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" @click="addRecommend(scope.row)" type="text">
......@@ -42,11 +55,10 @@
</template>
<script>
import { getCategoryGoods, addGoods } from "@/api/system/shop";
import { getCategoryGoods, addGoods ,offGoods} from "@/api/system/shop";
import SelectGoods from '@/components/SelectGoods';
import AddRecommend from './addRecommend.vue'
import Preferential from './preferential.vue';
import {offShop } from "@/api/system/goods";
export default {
props: ['shopId'],
......@@ -90,8 +102,6 @@ export default {
this.list = data[0].goodsList;
this.btnId = data[0].id
}
})
},
// 多选框选中数据
......@@ -99,22 +109,28 @@ export default {
this.outIds = selection.map((item) => item.id);
},
soldOutGoos(){
// offGoods({"shopId":this.shopId,"goodsIds":this.outIds}).then(({ response }) => {
// console.log("response",response);
// })
this.$modal
.confirm('是否确认下架所选商品?')
.then(function () {
console.log("999");
offShop({ goodsId: this.outIds.join(','), boo: true }).then(res => {
console.log("res",res);
// this.$modal.msgSuccess("下架成功");
})
return offGoods({"shopId":this.shopId,"goodsIds":this.outIds});
})
.then(() => {
//this.getList();
this.$modal.msgSuccess('' + mess + '成功');
.then((response) => {
// console.log("response",response);
// if(response.code=="200"){
// this.getList();
//this.$modal.msgSuccess('' + mess + '成功');
// }
})
.catch(() => { });
},
openSelectGoos() {
this.$refs.selectGoods.openModal()
......
......@@ -6,10 +6,10 @@
<AddShop :shopId="shopId" @setShopId="setShopId" @closeDialog="closeHandle"/>
</el-tab-pane>
<el-tab-pane :disabled="!shopId" label="机器信息" name="second">
<Machine :shopId="shopId" />
<Machine ref="Machine" :shopId="shopId" />
</el-tab-pane>
<el-tab-pane :disabled="!shopId" label="商品信息" name="third">
<Commodity :shopId="shopId" />
<Commodity ref="Commodity" :shopId="shopId" />
</el-tab-pane>
<el-tab-pane :disabled="!shopId" label="点单屏推荐" name="fourth">
<Recommend ref="Recommend" :shopId="shopId" />
......@@ -39,6 +39,12 @@ export default {
},
watch: {
activeName(value) {
if (value == 'second') {
this.$refs.Machine.getList()
}
if (value == 'third') {
this.$refs.Commodity.getList()
}
if (value == 'fourth') {
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