便利店

This commit is contained in:
cun-nan 2023-10-26 14:53:44 +08:00
parent 2eae3a90aa
commit 9ca2e2e609
7 changed files with 505 additions and 39 deletions

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 查询供应商列表
// 查询列表
export function listLJGoods(query) {
return request({
url: '/business/convenience/goods/list',
@ -9,7 +9,7 @@ export function listLJGoods(query) {
})
}
// 查询供应商详细
// 查询详细
export function getLJGoods(id) {
return request({
url: '/business/convenience/goods/' + id,
@ -17,7 +17,7 @@ export function getLJGoods(id) {
})
}
// 新增供应
// 新增
export function addLJGoods(data) {
return request({
url: '/business/convenience/goods',
@ -26,7 +26,7 @@ export function addLJGoods(data) {
})
}
// 修改供应
// 修改
export function updateLJGoods(data) {
return request({
url: '/business/convenience/goods',
@ -35,7 +35,7 @@ export function updateLJGoods(data) {
})
}
// 删除供应
// 删除
export function delLJGoods(id) {
return request({
url: '/business/convenience/goods/' + id,

View File

@ -0,0 +1,466 @@
<template>
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="商品分类" prop="cvsGoodId">
<el-select
v-model="queryParams.cvsGoodId"
placeholder="全部"
clearable
style="width: 300px"
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="queryParams.supplierId"
placeholder="全部"
clearable
style="width: 300px"
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="商品名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入商品名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="拼音码" prop="pinyinCode">
<el-input
v-model="queryParams.pinyinCode"
placeholder="请输入拼音码"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="条形码" prop="goodsNo">
<el-input
v-model="queryParams.goodsNo"
placeholder="请输入商品条形码"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货架号" prop="shelfNumber">
<el-input
v-model="queryParams.shelfNumber"
placeholder="请输入商品所在货架号"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="等级状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="全部"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['member:add']"
>新增商品</el-button>
<el-table ref="tables" v-loading="loading" :data="list"
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@sort-change="handleSortChange">
<el-table-column label="ID" prop="id" align="center" width="60"/>
<el-table-column label="分类名称" prop="cvsGoodId" align="center">
<template slot-scope="scope">
<span>{{ getName(cvsGoodList, scope.row.cvsGoodId) }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="name" align="center" width="160"/>
<el-table-column label="供应商" prop="supplierId" align="center">
<template slot-scope="scope">
<span>{{ getName(supplierList, scope.row.supplierId) }}</span>
</template>
</el-table-column>
<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="buyingPrice" align="center"/>
<el-table-column label="零售价" prop="retailPrice" align="center"/>
<el-table-column label="会员价" prop="memberPrice" align="center"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
</template>
</el-table-column>
<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="120" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['member:add']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['member:add']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<!-- 添加或修改对话框 -->
<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" placeholder="商品的条码信息">
<el-button slot="append">查询</el-button>
</el-input>
<div style="text-align: right;color: grey;font-size: 12px">
商品无条码您可以<span style="color: #00afff">生成条码</span>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入商品名称"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属分类" prop="cvsGoodId">
<el-select
v-model="form.cvsGoodId"
placeholder="全部"
clearable
style="width: 300px"
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="进货单价" prop="buyingPrice">
<el-input v-model="form.buyingPrice">
<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">
<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">
<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" placeholder="输入商品名称自动回填"/>
</el-form-item>
</el-col>
<el-col :span="8">
<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="shelfNumber">
<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="16">
<el-form-item label="初始库存" prop="stock">
<el-input v-model="form.stock" 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"
placeholder="全部"
clearable
style="width: 300px"
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</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" @change="handleChange" :min="0" label="0"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="mobile">
<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-group>
</el-form-item>
</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>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {selectParentById, selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {addLJGoods, delLJGoods, getLJGoods, listLJGoods, updateLJGoods} from "@/api/convenienceStore/ljgoods";
import {getSysConfig} from "@/api/staff/user/sysconfig";
export default {
dicts: ['zhzt','yes_or_no'],
data(){
return {
//
stockType:'',
cvsGoodName:'',
//
loading: true,
//
title: "",
//
total: 0,
//
list: [],
//
open: false,
//
defaultSort: {prop: 'updateTime', order: 'descending'},
//
cvsGoodList:[],
//
supplierList:[],
//
queryParams: {
page: 1,
pageSize: 10,
id: '',
cvsGoodId: '',
supplierId: '',
name: '',
pinyinCode: '',
goodsNo: '',
shelfNumber: '',
status: '',
isRecovery:0,
},
//
form: {},
//
showSearch: true,
//
rules: {
name: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
}
}
},
created() {
this.getList();
this.getQueryList();
this.getType();
},
computed:{
},
methods:{
//
handleChange(value) {
console.log(value);
},
//
getType(){
getSysConfig('stock_type').then(response => {
this.stockType = response.data.split(";")
});
},
//
getQueryList(){
selectTree().then(response => {
this.cvsGoodList = response.data.records
});
listSupplier().then(response => {
this.supplierList = response.data.records
})
},
//
getList() {
this.loading = true;
listLJGoods(this.queryParams).then(response => {
this.list = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
//
resetQuery() {
this.resetForm("queryForm");
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order);
this.handleQuery();
},
//
reset() {
this.resetForm("form");
this.form= {}
},
//
handleAdd() {
this.reset();
this.open = true;
this.title = "新增商品";
},
//
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getLJGoods(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "编辑商品";
});
},
//
handleDelete(row) {
const name = row.name
this.$modal.confirm('确定删除"' + name + '"的商品信息?').then(function() {
return delLJGoods(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id) {
updateLJGoods(this.form).then(response => {
this.$modal.msgSuccess("商品信息更新成功");
this.open = false;
this.getList();
});
} else {
addLJGoods(this.form).then(response => {
this.$modal.msgSuccess("商品信息新增成功");
this.open = false;
this.getList();
});
}
}
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.multiple = !selection.length
},
//
handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
}
}
</script>
<style lang="scss" scoped>
.app-container{
width: 100%;
height: 100vh;
background: #f6f8f9;
}
</style>

View File

@ -3,8 +3,8 @@
<el-card style="margin-top: 20px;">
<!-- 查询类别 -->
<el-form :inline="true" :model="queryParams">
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="queryParams.categoryName" placeholder="请输入分类名称" clearable @keyup.enter.native="handleQuery"></el-input>
<el-form-item label="分类名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入分类名称" clearable @keyup.enter.native="handleQuery"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.status" placeholder="请选择商品状态" clearable >
@ -42,7 +42,7 @@
@selection-change="handleSelectionChange" :default-sort="defaultSort"
@sort-change="handleSortChange">
<el-table-column label="ID" prop="id" align="center" width="60"/>
<el-table-column label="分类名称" align="center" prop="categoryName"/>
<el-table-column label="分类名称" align="center" prop="name"/>
<el-table-column label="商品编号" align="center" prop="code"/>
<el-table-column label="排序" align="center" prop="sorted" />
<el-table-column label="状态" align="center" prop="status">
@ -125,13 +125,13 @@
<el-select v-model="form.pid" placeholder="请选择上级分类">
<el-option
v-for="item in goodsOptions"
:label="item.categoryName"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="分类名称" prop="categoryName" style="margin-left: -8px;">
<el-input v-model="form.categoryName" style="width: 300px;"></el-input>
<el-form-item label="分类名称" prop="name" style="margin-left: -8px;">
<el-input v-model="form.name" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="排序规则">
<el-input-number v-model="form.sorted" @change="handleChange" :min="0" :max="10" style="width: 300px;"></el-input-number>
@ -215,7 +215,7 @@ export default {
//
editForm:{
pid:'',
categoryName:'',
name:'',
status:'qy',
sorted:0,
},
@ -223,7 +223,7 @@ export default {
goodsOptions:[],
//
goodsQueryForm: {
categoryName: '',
name: '',
status: '',
pid:"",
pageNum:'1',
@ -236,14 +236,14 @@ export default {
//
form:{
pid:'',
categoryName:'',
name:'',
status:'qy',
sorted:0,
},
tableData: [{
id: '',
pid:'',
categoryName: '',
name: '',
sorted: '',
status:'',
createdTime:'',
@ -253,13 +253,13 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 5,
categoryName:'',
name:'',
status: '',
},
aa:[],
//
rules: {
categoryName: [
name: [
{ required: true, message: '请输入分类名称', trigger: 'blur' },
],
},
@ -276,7 +276,7 @@ export default {
reset() {
this.form = {
pid:'',
categoryName:'',
name:'',
status:'qy',
sorted:0,
}
@ -325,7 +325,7 @@ export default {
//
insertGoods(){
this.resetForm('form')
this.form.categoryName = ''
this.form.name = ''
this.form.pid = ''
this.form.status = 'qy'
this.form.sorted = 0
@ -394,7 +394,7 @@ export default {
//
cancelSubmit(){
this.$refs.form.resetFields();//
this.form.categoryName = ''
this.form.name = ''
this.form.pid = ''
this.form.status = ''
this.form.sorted = 0
@ -411,7 +411,7 @@ export default {
},
//
resetForm(){
this.goodsQueryForm.categoryName = ''
this.goodsQueryForm.name = ''
this.goodsQueryForm.status = ''
this.getList()
},
@ -453,7 +453,7 @@ export default {
},
//
handleDelete(row) {
const name = row.categoryName
const name = row.name
this.$modal.confirm('确定删除"' + name + '"的分类信息?').then(function() {
// return deleteMember(row.id);
return deleteBYId(row.id);

View File

@ -40,7 +40,7 @@ public class CvsGoods extends BaseEntity implements Serializable {
//商品分类
@ApiModelProperty("商品分类")
private String categoryName;
private String name;
//商品排序
@ApiModelProperty("商品排序")

View File

@ -3,7 +3,7 @@
<mapper namespace="com.fuint.business.convenienceSore.mapper.CvsGoodsMapper">
<sql id="selectCvsGoods">
select id,pid,category_name,code,sorted, status, create_time, create_by, update_time, update_by from cvs_goods
select id,pid,name,code,sorted, status, create_time, create_by, update_time, update_by from cvs_goods
</sql>
<sql id="selectCvsGood">
@ -17,8 +17,8 @@
<if test="pid != null">
and pid = #{pid}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name = #{categoryName}
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="sorted != null and sorted != ''">
and sorted = #{sorted}
@ -33,7 +33,7 @@
DISTINCT
pTable.id,
pTable.pid,
pTable.category_name,
pTable.name,
pTable.`code`,
pTable.sorted,
pTable.`STATUS`,
@ -50,9 +50,9 @@
<if test="goods.status != null and goods.status != ''">
and pTable.status = #{goods.status}
</if>
<if test="goods.categoryName != null and goods.categoryName!= ''">
and pTable.category_name like concat('%',#{goods.categoryName},'%')
or cTable.category_name like concat('%',#{goods.categoryName},'%')
<if test="goods.name != null and goods.name!= ''">
and pTable.name like concat('%',#{goods.name},'%')
or cTable.name like concat('%',#{goods.name},'%')
</if>
</where>
group by pTable.id
@ -61,8 +61,8 @@
<!-- <include refid="selectCvsGood"></include>-->
<!-- <where>-->
<!-- store_id = #{goods.storeId}-->
<!-- <if test="goods.categoryName != null and goods.categoryName != ''">-->
<!-- and category_name like concat('%', #{goods.categoryName}, '%')-->
<!-- <if test="goods.name != null and goods.name != ''">-->
<!-- and name like concat('%', #{goods.name}, '%')-->
<!-- </if>-->
<!-- <if test="goods.status != null and goods.status != ''">-->
<!-- and status = #{goods.status}-->
@ -76,7 +76,7 @@
SELECT
id,
pid,
category_name,
name,
`CODE`,
sorted,
`STATUS`,
@ -90,8 +90,8 @@
<if test="pid != null ">
and pid = #{pid}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name like CONCAT('%',#{categoryName},'%')
<if test="name != null and name != ''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="status != null and status != ''">
and status = #{status}
@ -104,8 +104,8 @@
<include refid="selectCvsGood"></include>
<where>
store_id = #{goods.storeId} and pid = 0
<if test="goods.categoryName != null and goods.categoryName != ''">
and category_name like concat('%', #{goods.categoryName}, '%')
<if test="goods.name != null and goods.name != ''">
and name like concat('%', #{goods.name}, '%')
</if>
<if test="goods.status != null and goods.status != ''">
and status = #{goods.status}

View File

@ -66,7 +66,7 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
List<CvsGoodsVo> CvsGoodsVoList = resList.stream().map(goods -> {
CvsGoodsVo cvsGoodsVo = new CvsGoodsVo();
cvsGoodsVo.setId(goods.getId());
cvsGoodsVo.setCategoryName(goods.getCategoryName());
cvsGoodsVo.setName(goods.getName());
cvsGoodsVo.setPid(goods.getPid());
cvsGoodsVo.setStatus(goods.getStatus());
cvsGoodsVo.setCode(goods.getCode());

View File

@ -30,7 +30,7 @@ public class CvsGoodsVo extends BaseEntity {
private String code;
//商品分类
private String categoryName;
private String name;
//商品排序
private Integer sorted;