新增桌台管理

This commit is contained in:
gyq
2024-02-01 12:11:10 +08:00
parent 640e3bb941
commit 259aec07cd
16 changed files with 1233 additions and 68 deletions

View File

@@ -192,7 +192,7 @@
import { tbShopUnit, tbShopCategoryGet, tbProductPost, tbProductSpecGet, tbProductGetDetail, tbProductPut } from "@/api/shop";
import addUnit from './components/addUnit'
import addClassify from './components/addClassify'
import shopList from './components/shopList'
import shopList from '@/components/shopList'
import uploadImg from '@/components/uploadImg'
import settings from '@/settings'
export default {
@@ -556,63 +556,6 @@ export default {
</script>
<style scoped lang="scss">
.shop_type_box {
display: flex;
.item {
$borderColor: #1890FF;
margin-right: 14px;
border: 1px solid #ececec;
border-radius: 4px;
padding: 6px 24px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
position: relative;
&:hover {
cursor: pointer;
border-color: $borderColor;
}
&.active {
border-color: $borderColor;
.active_dot {
display: flex;
}
}
.active_dot {
$size: 26px;
background-color: $borderColor;
color: #fff;
position: absolute;
top: 0;
right: 0;
width: $size;
height: $size;
clip-path: polygon(100% 0, 0 0, 100% 100%);
display: none;
justify-content: flex-end;
padding-right: 2px;
}
.s_title {
font-weight: bold;
color: #555;
}
.intro {
color: #999;
font-size: 12px;
margin-top: -10px;
}
}
}
.shop_list {
.item {
display: flex;

View File

@@ -39,7 +39,7 @@
<script>
import { tbProductGroupPost, tbProductGroupPut, productListGet } from '@/api/shop'
import shopList from './shopList'
import shopList from '@/components/shopList'
export default {
components: {
shopList

View File

@@ -1,163 +0,0 @@
<template>
<el-dialog title="选择商品" :visible.sync="dialogVisible" @open="resetHandle()">
<el-form :model="searhForm" inline>
<el-form-item>
<el-input v-model="searhForm.name" placeholder="商品名称"></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="searhForm.category" placeholder="商品分类">
<el-option :label="item.name" :value="item.id" v-for="item in categoryList" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary">查询</el-button>
<el-button>重置</el-button>
</el-form-item>
</el-form>
<div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="商品信息">
<template v-slot="scope">
<div class="shop_info">
<el-image :sr="scope.row.coverImg" style="width: 30px;height: 30px;"></el-image>
<span>{{ scope.row.name }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="售价">
<template v-slot="scope">
{{ scope.row.lowPrice }}
</template>
</el-table-column>
<el-table-column label="销量/库存">
<template v-slot="scope">
0/0
</template>
</el-table-column>
<el-table-column label="分类" prop="categoryId"></el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="confirmHandle"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { tbShopCategoryGet, tbProduct } from "@/api/shop";
export default {
data() {
return {
dialogVisible: false,
searhForm: {
name: '',
category: ''
},
categoryList: [],
tableData: {
page: 0,
size: 10,
total: 0,
loading: false,
list: []
},
goods: []
}
},
methods: {
// 确定选商品
confirmHandle() {
let res = this.$refs.table.selection
this.$emit('success', res)
this.close()
},
// 重置查询
resetHandle() {
this.searhForm.name = ''
this.searhForm.category = ''
this.tableData.page = 0
this.tableData.list = []
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e
this.getTableData()
},
// 商品列表
async getTableData() {
this.tableData.loading = true
try {
const res = await tbProduct({
page: this.tableData.page,
size: this.tableData.size,
sort: 'id',
})
this.tableData.loading = false
this.tableData.list = res.content
this.tableData.total = res.totalElements
if (this.goods.length) {
this.$nextTick(() => {
this.selection()
})
}
} catch (error) {
console.log(error)
}
},
// 商品分类
async tbShopCategoryGet() {
try {
const res = await tbShopCategoryGet({
page: 0,
size: 100,
sort: 'id',
shopId: localStorage.getItem('shopId')
})
this.categoryList = res.content
} catch (error) {
console.log(error)
}
},
show(goods) {
console.log('show-goods===', goods)
this.dialogVisible = true
if (goods && goods.length) {
this.goods = goods
} else {
this.goods = []
}
this.resetHandle()
this.getTableData()
},
close() {
this.dialogVisible = false
},
selection() {
this.goods.forEach(row => {
this.tableData.list.forEach((item, index) => {
if (row.id == item.id) {
this.$refs.table.toggleRowSelection(this.tableData.list[index]);
}
})
});
}
}
}
</script>
<style scoped lang="scss">
.shop_info {
display: flex;
align-items: center;
span {
margin-left: 10px;
}
}
</style>