This commit is contained in:
cun-nan 2024-10-28 18:33:45 +08:00
parent 1d27ad0873
commit 5179ad290f
6 changed files with 791 additions and 799 deletions

View File

@ -1,11 +1,11 @@
<template>
<div class="app-container">
<div class="card-change" >
<div class="card-change">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-tabs v-model="activeName" @tab-click="handleClick">-->
<!-- <el-tab-pane label="商品档案" name="goods"></el-tab-pane>-->
<!-- <el-tab-pane label="商品回收站" name="recovery"></el-tab-pane>-->
<!-- </el-tabs>-->
<!-- <el-tabs v-model="activeName" @tab-click="handleClick">-->
<!-- <el-tab-pane label="商品档案" name="goods"></el-tab-pane>-->
<!-- <el-tab-pane label="商品回收站" name="recovery"></el-tab-pane>-->
<!-- </el-tabs>-->
<el-form-item label="" prop="name">
<el-input
v-model="queryParams.name"
@ -59,94 +59,101 @@
type="primary"
@click="batchGrounding('qy')"
v-hasPermi="['convenienceStore:goodsFile:up']"
>商品上架</el-button>
>商品上架
</el-button>
<el-button
type="primary"
@click="batchGrounding('jy')"
v-hasPermi="['convenienceStore:goodsFile:down']"
>商品下架</el-button>
<el-button type="primary" >新增商品</el-button>
>商品下架
</el-button>
<el-button type="primary" @click="handleAdd">新增商品</el-button>
</el-form-item>
</el-form>
<div>
<div style="font-size: 12px;color: red;margin: 5px 0">库存为0或未设置零售价和会员价的商品不可上架</div>
</div>
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange"
border
tooltip-effect="dark">
<el-table-column type="selection" width="40"/>
<el-table-column type="index" width="60" align="center" label="序号"/>
<el-table-column label="品类名称" prop="cvsGoodName" align="center">
<template slot-scope="scope">
<span>{{scope.row.cvsGoodName || "--"}}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="name" align="center"/>
<el-table-column label="供应商" prop="supplierName" align="center"/>
<el-table-column label="条形码" prop="goodsNo" align="center" width="160"/>
<el-table-column label="拼音码" prop="pinyinCode" align="center"/>
<el-table-column label="货架号" prop="shelfNumber" align="center"/>
<el-table-column label="库存" prop="stock" align="center"/>
<el-table-column label="单位" prop="unit" align="center"/>
<el-table-column label="商品规格" prop="goodsSpecs" align="center"/>
<el-table-column label="成本价" prop="buyingPrice" align="center"/>
<el-table-column label="零售价" prop="retailPrice" align="center"/>
<el-table-column label="会员价" prop="memberPrice" align="center"/>
<el-table-column label="排序" prop="sort" align="center"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag v-if="scope.row.status=='qy'">上架</el-tag>
<el-tag type="info" v-if="scope.row.status=='jy'">下架</el-tag>
</template>
</el-table-column>
<el-table-column label="操作人" prop="sort" align="center"/>
<el-table-column label="操作时间" align="center" width="160" prop="updateTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="190" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-hasPermi="['convenienceStore:goodsFile:weih']"
>商品维护</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
v-hasPermi="['convenienceStore:goodsFile:del']"
>删除</el-button>
</template>
</el-table-column>
<el-table-column label="操作" v-if="activeName=='recovery'" align="center" width="200" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-shopping-cart-full"
@click="isRecoveryBin(scope.row,0)"
v-hasPermi="['convenienceStore:goodsFile:move']"
>移出至商品档案</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="isRecoveryBin(scope.row,1)"
v-hasPermi="['convenienceStore:goodsFile:movedel']"
>移至回收站</el-button>
</template>
</el-table-column>
</el-table>
<div style="height: 68vh;overflow: auto">
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange"
border
tooltip-effect="dark">
<el-table-column type="selection" width="40"/>
<el-table-column type="index" width="60" align="center" label="序号"/>
<el-table-column label="品类名称" prop="cvsGoodName" align="center">
<template slot-scope="scope">
<span>{{ scope.row.cvsGoodName || "--" }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="name" align="center"/>
<el-table-column label="供应商" prop="supplierName" align="center"/>
<el-table-column label="条形码" prop="goodsNo" align="center" width="140"/>
<el-table-column label="拼音码" prop="pinyinCode" align="center"/>
<el-table-column label="货架号" prop="shelfNumber" align="center"/>
<el-table-column label="库存" prop="stock" align="center"/>
<el-table-column label="单位" prop="unit" align="center"/>
<el-table-column label="商品规格" prop="goodsSpecs" align="center"/>
<el-table-column label="成本价" prop="buyingPrice" align="center"/>
<el-table-column label="零售价" prop="retailPrice" align="center"/>
<el-table-column label="会员价" prop="memberPrice" align="center"/>
<el-table-column label="排序" prop="sort" align="center"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div style="color: #0DC291" v-if="scope.row.status=='qy'">已上架</div>
<div style="color: #F44522" v-if="scope.row.status=='jy'">已下架</div>
</template>
</el-table-column>
<el-table-column label="操作人" prop="realName" align="center"/>
<el-table-column label="操作时间" align="center" width="154" prop="updateTime">
<template slot-scope="scope">
<span>
{{ scope.row.updateTime ? parseTime(scope.row.updateTime) : parseTime(scope.row.createTime) }}
</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="130" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-hasPermi="['convenienceStore:goodsFile:weih']"
>商品维护
</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
v-hasPermi="['convenienceStore:goodsFile:del']"
>删除
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" v-if="activeName=='recovery'" align="center" width="200" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-shopping-cart-full"
@click="isRecoveryBin(scope.row,0)"
v-hasPermi="['convenienceStore:goodsFile:move']"
>移出至商品档案
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="isRecoveryBin(scope.row,1)"
v-hasPermi="['convenienceStore:goodsFile:movedel']"
>移至回收站
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total>0"
:total="total"
@ -158,111 +165,78 @@
<!-- 添加或修改对话框 -->
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-row>
<el-col :span="24">
<el-form-item label="商品条码" prop="goodsNo">
<el-input v-model="form.goodsNo"
@keydown.enter.native="getGoods(form)"
:disabled="title == '商品维护'"
v-focus
clearable
placeholder="商品的条码信息">
<!-- <el-button slot="append" @click="getGoods(form)">查询</el-button>-->
</el-input>
<!-- <div style="text-align: right;color: grey;font-size: 12px">-->
<!-- 商品无条码您可以<span style="color: #00afff" @click="createGoodNo">生成条码</span>-->
<!-- </div>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<div style="display: flex;justify-content: space-between">
<div style="width: 50%">
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" @input="pinyin" placeholder="请输入商品名称"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属分类" prop="cvsGoodId">
<el-form-item label="品类名称" prop="cvsGoodId">
<el-select
v-model="form.cvsGoodId"
placeholder="全部"
placeholder="请选择品类名称"
clearable
style="width: 300px"
style="width: 100%"
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
<!-- <el-cascader v-model="cvsGoodId"-->
<!-- :options="cvsGoodOptions"-->
<!-- :props="{ checkStrictly: true }"-->
<!-- clearable></el-cascader>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="进货单价" prop="buyingPrice">
<el-input disabled v-model="form.buyingPrice" maxlength="10" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="零售价" prop="retailPrice">
<el-input v-model="form.retailPrice" maxlength="10" @input="getPrice" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="会员价" prop="memberPrice">
<el-input v-model="form.memberPrice" maxlength="10" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="拼音码" prop="pinyinCode">
<el-input v-model="form.pinyinCode" disabled placeholder="输入商品名称自动回填"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品规格" prop="goodsSpecs">
<el-input v-model="form.goodsSpecs" placeholder="输入商品规格500ml50g"/>
</el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="如:个、瓶、包"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="初始库存" prop="stock" v-if="form.id">
<el-input v-model="form.stock" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
maxlength="10" :disabled="true" placeholder="0"/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number v-model="form.sort" :min="0" label="0" style="width: 100%"></el-input-number>
</el-form-item>
<el-form-item label="状态" prop="status" v-if="form.id">
<el-radio-group v-model="form.status">
<!-- <el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>-->
<el-radio label="qy" value="qy">上架</el-radio>
<el-radio label="jy" value="jy">下架</el-radio>
</el-radio-group>
</el-form-item>
</div>
<div style="width: 50%">
<el-form-item label="商品条形码" prop="goodsNo">
<el-input v-model="form.goodsNo"
@keydown.enter.native="getGoods(form)"
:disabled="form.id"
v-focus
clearable
placeholder="请用扫描枪扫码或输入条形码或自动生成条形码">
<el-button :disabled="form.id" slot="append" @click="createGoodNo" icon="el-icon-refresh"></el-button>
</el-input>
</el-form-item>
<el-form-item label="成本价" prop="buyingPrice" v-if="form.id">
<el-input disabled v-model="form.buyingPrice" maxlength="10"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="零售价" prop="retailPrice" v-if="form.id">
<el-input v-model="form.retailPrice" maxlength="10" @input="getPrice"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="会员价" prop="memberPrice" v-if="form.id">
<el-input v-model="form.memberPrice" maxlength="10"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="货架号" prop="shelfNumber">
<el-input v-model="form.shelfNumber" placeholder="如1-2-2"/>
<el-input v-model="form.shelfNumber" placeholder="请输入货架号,1-2-2"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="是否使用积分抵扣" prop="canUsePoint" label-width="110">
<el-radio-group v-model="form.canUsePoint">
<el-radio v-for="dict in dict.type.yes_or_no" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否使用兑换券兑换" prop="canUsePoint" label-width="110">
<el-radio-group v-model="form.canUseExchange">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="初始库存" prop="stock">
<el-input v-model="form.stock" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" maxlength="10" :disabled="true" placeholder="0"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="form.supplierId"
@ -270,55 +244,38 @@
placeholder="请选择供应商"
@visible-change="changeSupplier"
clearable
style="width: 94%">
style="width: 100%">
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
<!-- <el-autocomplete-->
<!-- popper-class="my-autocomplete"-->
<!-- style="width: 94%"-->
<!-- v-model="supplier"-->
<!-- :fetch-suggestions="querySearch"-->
<!-- placeholder="供应商名称,如果是未添加的供应商,输完名称点回车即可自动添加"-->
<!-- @change="addSupplier"-->
<!-- @select="selectSupplier">-->
<!-- <template slot-scope="{ item }">-->
<!-- <div style="display: flex;justify-content: space-between">-->
<!-- <span class="name">{{ item.name }}</span>-->
<!--&lt;!&ndash; <span class="addr">{{ item.memberPrice }}</span>&ndash;&gt;-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-autocomplete>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="排序" prop="sort">
<el-input-number v-model="form.sort" :min="0" label="0"></el-input-number>
<el-form-item label="商品简介" prop="description">
<el-input v-model="form.description" placeholder="请输入商品简介" type="textarea"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status" :disabled="form.stock==0">
<!-- <el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>-->
<el-radio label="qy" value="qy">上架</el-radio>
<el-radio label="jy" value="jy">下架</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</div>
</div>
<!-- <el-row>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="是否使用积分抵扣" prop="canUsePoint" label-width="110">-->
<!-- <el-radio-group v-model="form.canUsePoint">-->
<!-- <el-radio v-for="dict in dict.type.yes_or_no" :label="dict.value">{{ dict.label }}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="是否使用兑换券兑换" prop="canUsePoint" label-width="110">-->
<!-- <el-radio-group v-model="form.canUseExchange">-->
<!-- <el-radio label="0"></el-radio>-->
<!-- <el-radio label="1"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
<!-- <el-alert-->
<!-- type="error"-->
<!-- style="margin-top: 15px"-->
<!-- :closable="false">-->
<!-- <p v-for="(item,index) in stockType" :id="index">-->
<!-- {{item}}-->
<!-- </p>-->
<!-- </el-alert>-->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<div class="dialog-footer" style="text-align: center">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
@ -347,19 +304,19 @@ Vue.directive('focus', {
},
})
export default {
dicts: ['zhzt','yes_or_no'],
data(){
dicts: ['zhzt', 'yes_or_no'],
data() {
return {
//
supplier:"",
supplier: "",
// id
cvsGoodId:[],
cvsGoodOptions:[],
isAdd:false,
cvsGoodId: [],
cvsGoodOptions: [],
isAdd: false,
activeName: 'goods',
//
stockType:'',
cvsGoodName:'',
stockType: '',
cvsGoodName: '',
//
loading: true,
//
@ -373,9 +330,9 @@ export default {
//
defaultSort: {prop: 'updateTime', order: 'descending'},
//
cvsGoodList:[],
cvsGoodList: [],
//
supplierList:[],
supplierList: [],
//
queryParams: {
page: 1,
@ -388,50 +345,67 @@ export default {
goodsNo: '',
shelfNumber: '',
status: '',
isRecovery:0,
isRecovery: 0,
},
//
form: {
id:'',goodsNo:'',name:'',cvsGoodId:"",buyingPrice:'',retailPrice:"",memberPrice:'',pinyinCode:"",
unit:'',shelfNumber:'',canUsePoint:'no',canUseExchange:'1',stock:0,supplierId:'',sort:0,status:'qy'
id: '',
goodsNo: '',
name: '',
cvsGoodId: "",
buyingPrice: '',
retailPrice: "",
memberPrice: '',
pinyinCode: "",
unit: '',
shelfNumber: '',
canUsePoint: 'no',
canUseExchange: '1',
stock: 0,
supplierId: '',
sort: 0,
status: 'qy'
},
//
showSearch: true,
ids:[],
ids: [],
//
rules: {
goodsNo: [
{ required: true, message: "商品条码不能为空", trigger: "blur" },
{required: true, message: "商品条码不能为空", trigger: "blur"},
],
name: [
{ required: true, message: "商品名称不能为空", trigger: "blur" },
{required: true, message: "商品名称不能为空", trigger: "blur"},
],
cvsGoodId: [
{ required: true, message: "请选择商品分类", trigger: "blur" },
{required: true, message: "请选择商品分类", trigger: "blur"},
],
buyingPrice: [
{ required: true, message: "请输入商品进货单价", trigger: "blur" },
{required: true, message: "请输入商品进货单价", trigger: "blur"},
],
goodsSpecs: [
{required: true, message: "请输入商品规格", trigger: "blur"},
],
retailPrice: [
{ required: true, message: "请输入商品零售价", trigger: "blur" },
{required: true, message: "请输入商品零售价", trigger: "blur"},
],
memberPrice: [
{ required: true, message: "请输入商品会员价", trigger: "blur" },
{required: true, message: "请输入商品会员价", trigger: "blur"},
],
pinyinCode: [
{ required: true, message: "商品拼音码不能为空", trigger: "blur" },
{required: true, message: "商品拼音码不能为空", trigger: "blur"},
],
unit: [
{ required: true, message: "请输入商品单位", trigger: "blur" },
{required: true, message: "请输入商品单位", trigger: "blur"},
],
canUsePoint: [
{ required: true, message: "请选择是否能使用积分抵扣", trigger: "blur" },
{required: true, message: "请选择是否能使用积分抵扣", trigger: "blur"},
],
supplierId: [
{ required: true, message: "请选择供应商", trigger: "blur" },
{required: true, message: "请选择供应商", trigger: "blur"},
],
status: [
{ required: true, message: "请选择商品状态", trigger: "blur" },
{required: true, message: "请选择商品状态", trigger: "blur"},
],
}
}
@ -443,16 +417,15 @@ export default {
this.getType();
this.getTree();
},
computed:{
},
methods:{
computed: {},
methods: {
//
changeSupplier(val){
if (val){
listSuppliers({ifDelete:'0'}).then(response => {
changeSupplier(val) {
if (val) {
listSuppliers({ifDelete: '0'}).then(response => {
this.supplierList = response.data
})
}else {
} else {
this.getSuppilers();
}
},
@ -460,32 +433,32 @@ export default {
querySearch(queryString, cb) {
let _this = this;
let results = _this.supplierList;
if (queryString != ""){
if (queryString != "") {
results = [];
let falg = false;
_this.supplierList.forEach(item => {
if(item.name.includes(queryString)){
if (item.name.includes(queryString)) {
results.push(item)
falg = true
}
})
if (!falg){
if (!falg) {
}
}
cb(results);
},
//
selectSupplier(data){
selectSupplier(data) {
this.supplier = data.name;
this.form.supplierId = data.id
// console.log(data,this.form)
},
addSupplier(val){
addSupplier(val) {
// console.log(val,222)
addSupplier({name:val,remark:"添加商品自动添加",ifDelete:'0'}).then(res => {
addSupplier({name: val, remark: "添加商品自动添加", ifDelete: '0'}).then(res => {
// console.log(res)
if (res.data==1){
if (res.data == 1) {
this.$modal.msgSuccess("已为您自动添加此供应商")
this.supplier = val;
this.getSuppilers(val)
@ -493,18 +466,18 @@ export default {
})
},
//
getTree(){
getTree() {
cvsGoodsTree().then(response => {
this.cvsGoodOptions = response.data
})
},
//
getPrice(){
getPrice() {
this.form.memberPrice = this.form.retailPrice
},
//
handleClick(tab, event) {
if (this.activeName == 'goods'){
if (this.activeName == 'goods') {
this.queryParams = {
page: 1,
pageSize: 10,
@ -516,10 +489,10 @@ export default {
goodsNo: '',
shelfNumber: '',
status: '',
isRecovery:0,
isRecovery: 0,
};
this.getList();
}else {
} else {
this.queryParams = {
page: 1,
pageSize: 10,
@ -531,16 +504,16 @@ export default {
goodsNo: '',
shelfNumber: '',
status: '',
isRecovery:1,
isRecovery: 1,
};
this.getList();
}
},
//
getGoods(form){
if (form.goodsNo!=""){
getGoods(form) {
if (form.goodsNo != "") {
scanCode(form.goodsNo).then(response => {
if (response.data!=null && response.data!=""){
if (response.data != null && response.data != "") {
this.form.goodsNo = response.data.barcode;
this.form.name = response.data.goodsName;
this.form.buyingPrice = response.data.price;
@ -552,39 +525,39 @@ export default {
}
},
// 13
createGoodNo(){
createGoodNo() {
createGoodsNo().then(response => {
this.form.goodsNo = response.data
})
},
//
pinyin(){
pinyin() {
let pinyin = require("js-pinyin");
pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
pinyin.setOptions({checkPolyphone: false, charCase: 1});
this.form.pinyinCode = pinyin.getCamelChars(this.form.name)
},
//
handleChange(value) {
console.log(value,this.form.sort);
console.log(value, this.form.sort);
},
//
getType(){
getType() {
getSysConfig('stock_type').then(response => {
this.stockType = response.data.split(";")
});
},
//
getQueryList(){
getQueryList() {
cvsGoodsAll().then(response => {
this.cvsGoodList = response.data
});
},
getSuppilers(val){
getSuppilers(val) {
listSuppliers().then(response => {
this.supplierList = response.data
if (val){
if (val) {
this.supplierList.forEach(item => {
if (item.name = val){
if (item.name = val) {
this.form.supplierId = item.id
}
})
@ -620,20 +593,34 @@ export default {
//
reset() {
this.resetForm("form");
this.form= {
id:'',goodsNo:'',name:'',cvsGoodId:"",buyingPrice:'',retailPrice:"",memberPrice:'',pinyinCode:"",
unit:'',shelfNumber:'',canUsePoint:'no',canUseExchange:'1',stock:0,supplierId:'',sort:0,status:'qy'
this.form = {
id: '',
goodsNo: '',
name: '',
cvsGoodId: "",
buyingPrice: '',
retailPrice: "",
memberPrice: '',
pinyinCode: "",
unit: '',
shelfNumber: '',
canUsePoint: 'no',
canUseExchange: '1',
stock: 0,
supplierId: '',
sort: 0,
status: 'qy'
}
},
//
isRecoveryBin(form,recovery){
isRecoveryBin(form, recovery) {
let name = ""
let prompt = ''
if (recovery==1){
if (recovery == 1) {
name = "确定要将此商品移至回收站吗?移出后将无法售卖当前商品!"
prompt = "商品已移至回收站,收银台商品信息页面刷新后实时生效!"
form.status = 'jy'
}else {
} else {
name = "确定要将此商品从回收站移至商品档案里吗?移出后将可售卖当前商品!"
prompt = "商品已移至商品档案,收银台商品信息页面刷新后实时生效!"
}
@ -645,17 +632,18 @@ export default {
}).then(() => {
this.getList();
this.$modal.msgSuccess(prompt);
}).catch(() => {});
}).catch(() => {
});
},
//
handleAdd() {
if (this.cvsGoodList.length>0){
if (this.cvsGoodList.length > 0) {
this.reset();
this.open = true;
this.isAdd = false;
this.title = "新增商品";
}else {
} else {
this.$modal.msgError("请先添加商品分类")
}
},
@ -681,7 +669,7 @@ export default {
// })
console.log(this.supplierList)
this.supplierList.forEach(item => {
if (item.id == response.data.supplierId){
if (item.id == response.data.supplierId) {
this.supplier = item.name
}
})
@ -694,21 +682,26 @@ export default {
//
handleDelete(row) {
const name = row.name
this.$modal.confirm('确定删除"' + name + '"的商品信息?').then(function() {
this.$modal.confirm('是否删除本条数据,删除后无法恢复!').then(function () {
return delLJGoods(row.id);
}).then(() => {
this.queryParams.page = 1
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
//
submitForm: function() {
submitForm: function () {
// if (this.cvsGoodId.length==1){
// this.form.cvsGoodId = this.cvsGoodId[0]
// }else {
// this.form.cvsGoodId = this.cvsGoodId[1]
// }
if (this.form.status=='qy' && this.form.stock==0 || this.form.memberPrice==0 ||this.form.retailPrice==0){
this.$message.error("请确保上架的商品库存大于0且为商品设置零售价和会员价")
return;
}
this.$refs["form"].validate(valid => {
if (valid) {
// if (this.form.stock==0){
@ -722,10 +715,10 @@ export default {
this.getList();
});
} else {
queryLJGoods({goodsNo:this.form.goodsNo}).then( response => {
if(response.data!=null){
queryLJGoods({goodsNo: this.form.goodsNo}).then(response => {
if (response.data != null) {
this.$modal.msgError("商品已存在");
}else {
} else {
addLJGoods(this.form).then(response => {
this.$modal.msgSuccess("商品信息新增成功");
this.open = false;
@ -748,29 +741,29 @@ export default {
this.ids = selection.map(item => item.id)
},
//
batchGrounding(val){
batchGrounding(val) {
let name = ""
if (val=='qy'){
if (val == 'qy') {
name = '上架'
}else {
} else {
name = '下架'
}
if (this.ids && this.ids.length>0){
editStatus({ids:this.ids.toString(),status:val}).then(res => {
if (val=='qy') {
if (this.ids && this.ids.length > 0) {
editStatus({ids: this.ids.toString(), status: val}).then(res => {
if (val == 'qy') {
if (res.data > 0) {
this.$message.success(name + "成功")
this.getList();
} else {
this.$message.error("请确保上架的商品库存大于0且为商品设置零售价和会员价")
}
}else {
} else {
this.$message.success(name + "成功")
this.getList();
}
})
}else {
this.$message.error("请选择需要"+name+"的商品")
} else {
this.$message.error("请选择需要" + name + "的商品")
}
},
//
@ -784,11 +777,12 @@ export default {
</script>
<style lang="scss" scoped>
.app-container{
.app-container {
width: 100%;
height: 100%;
background: #f6f8f9;
}
.app-container .el-form--inline .el-form-item {
margin-right: 20px;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<div class="card-change" >
<div class="card-change">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="name">
<el-input
@ -37,60 +37,63 @@
type="primary"
@click="handleAdd"
v-hasPermi="['convenienceStore:supplier:add']"
>新增供应商</el-button>
>新增供应商
</el-button>
</el-form-item>
</el-form>
<el-table ref="tables" v-loading="loading" :data="list" border
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@sort-change="handleSortChange">
<el-table-column type="index" width="80" align="center" label="序号"/>
<el-table-column label="供应商名称" prop="name" align="center"/>
<el-table-column label="联系人" prop="contacts" align="center">
<template slot-scope="scope">
<span>{{ scope.row.contacts ? scope.row.contacts : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="联系电话" align="center" prop="mobile">
<template slot-scope="scope">
<span>{{ scope.row.mobile ? scope.row.mobile : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="联系地址" align="center" prop="address">
<template slot-scope="scope">
<span>{{ scope.row.address ? scope.row.address : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark">
<template slot-scope="scope">
<span>{{ scope.row.remark ? scope.row.remark : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作人" prop="name" align="center"/>
<el-table-column label="操作时间" align="center" width="160" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-hasPermi="['convenienceStore:supplier:update']"
>修改</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
v-hasPermi="['convenienceStore:supplier:del']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="height: 70vh;overflow: auto">
<el-table ref="tables" v-loading="loading" :data="list" border
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@sort-change="handleSortChange">
<el-table-column type="index" width="80" align="center" label="序号"/>
<el-table-column label="供应商名称" prop="name" align="center"/>
<el-table-column label="联系人" prop="contacts" align="center">
<template slot-scope="scope">
<span>{{ scope.row.contacts ? scope.row.contacts : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="联系电话" align="center" prop="mobile">
<template slot-scope="scope">
<span>{{ scope.row.mobile ? scope.row.mobile : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="联系地址" align="center" prop="address">
<template slot-scope="scope">
<span>{{ scope.row.address ? scope.row.address : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark">
<template slot-scope="scope">
<span>{{ scope.row.remark ? scope.row.remark : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作人" prop="name" align="center"/>
<el-table-column label="操作时间" align="center" width="160" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-hasPermi="['convenienceStore:supplier:update']"
>修改
</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
v-hasPermi="['convenienceStore:supplier:del']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total>0"
:total="total"
@ -101,12 +104,13 @@
</div>
<!-- 添加或修改对话框 -->
<el-dialog :close-on-click-modal="false" :title="title" width="600px" style="margin-top: 5%" :visible.sync="open" append-to-body>
<el-dialog :close-on-click-modal="false" :title="title" width="600px" style="margin-top: 5%" :visible.sync="open"
append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="95px">
<el-row>
<el-col :span="24">
<el-form-item label="供应商名称" prop="name" style="width: 100%">
<el-input v-model="form.name" placeholder="请输入供应商名称" maxlength="30" />
<el-input v-model="form.name" placeholder="请输入供应商名称" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
@ -127,7 +131,7 @@
<el-row>
<el-col :span="24">
<el-form-item label="联系地址" prop="address">
<el-input v-model="form.address" placeholder="供应商联系地址" maxlength="30" />
<el-input v-model="form.address" placeholder="供应商联系地址" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
@ -156,8 +160,8 @@ import {
export default {
// dicts: ['zhzt'],
name:'goods-supplier',
data(){
name: 'goods-supplier',
data() {
return {
//
loading: true,
@ -187,16 +191,16 @@ export default {
//
rules: {
name: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
{required: true, message: "供应商名称不能为空", trigger: "blur"},
],
contacts: [
{ required: true, message: "联系人不能为空", trigger: "blur" },
{required: true, message: "联系人不能为空", trigger: "blur"},
],
mobile: [
{ required: true, message: "联系电话不能为空", trigger: "blur" },
{required: true, message: "联系电话不能为空", trigger: "blur"},
],
address: [
{ required: true, message: "联系地址不能为空", trigger: "blur" },
{required: true, message: "联系地址不能为空", trigger: "blur"},
],
}
}
@ -204,7 +208,7 @@ export default {
created() {
this.getList();
},
methods:{
methods: {
//
getList() {
this.loading = true;
@ -228,7 +232,7 @@ export default {
//
reset() {
this.resetForm("form");
this.form= {}
this.form = {}
},
//
handleAdd() {
@ -249,16 +253,17 @@ export default {
//
handleDelete(row) {
const name = row.name
this.$modal.confirm('是否删除本条数据,删除后无法恢复!').then(function() {
this.$modal.confirm('是否删除本条数据,删除后无法恢复!').then(function () {
return delSupplier(row.id);
}).then(() => {
this.queryParams.page = 1
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
//
submitForm: function() {
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id) {
@ -269,11 +274,11 @@ export default {
});
} else {
addSupplier(this.form).then(response => {
if (response.data==1){
if (response.data == 1) {
this.$modal.msgSuccess("供应商新增成功");
this.open = false;
this.getList();
}else {
} else {
this.$modal.msgError("供应商名称已存在");
}
});
@ -302,9 +307,9 @@ export default {
</script>
<style lang="scss" scoped>
.app-container{
width: 100%;
height: 100vh;
background: #f6f8f9;
}
.app-container {
width: 100%;
height: 100vh;
background: #f6f8f9;
}
</style>

View File

@ -50,4 +50,8 @@ public class CvsGoods extends BaseEntity implements Serializable {
@ApiModelProperty("商品状态")
private String status;
//备注
@ApiModelProperty("备注")
private String remark;
}

View File

@ -2,9 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.convenienceSore.mapper.LJGoodsMapper">
<sql id="selectLJGoods">
select mg.*,sup.name supplierName,cg.name cvsGoodName from mt_goods mg
select mg.*,sup.name supplierName,cg.name cvsGoodName,ta.real_name from mt_goods mg
left join supplier sup on mg.supplier_id = sup.id
left join cvs_goods cg on mg.cvs_good_id = cg.id
LEFT JOIN t_account ta on mg.create_by = ta.acct_id
</sql>
<select id="selectLJGoodsList" resultType="com.fuint.business.convenienceSore.vo.LjGoodsVo">

View File

@ -9,4 +9,6 @@ public class LjGoodsVo extends LJGoods {
private String cvsGoodName;
// 供应商名称
private String supplierName;
// 创建人
private String realName;
}