优化问题、更换接口
This commit is contained in:
parent
dc758120c4
commit
f0bca6e0d1
|
|
@ -38,16 +38,16 @@ export function puttbConsType(data) {
|
|||
* 查询耗材信息
|
||||
* @returns
|
||||
*/
|
||||
export function gettbConsInfo(params) {
|
||||
export function gettbConsInfo(data) {
|
||||
// return request({
|
||||
// url: '/api/tbConsInfo',
|
||||
// method: "get",
|
||||
// params
|
||||
// });
|
||||
return request({
|
||||
url: "/api/viewConInfoFlow",
|
||||
method: "get",
|
||||
params
|
||||
url: "/api/viewConInfoFlow/get",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ export function dateAmount(day) {
|
|||
*/
|
||||
export function dateProduct(day, page, size) {
|
||||
return request({
|
||||
url: "/api/summary/dateProduct",
|
||||
// url: "/api/summary/dateProduct",
|
||||
url: "/api/summary/productSaleDate",
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
|
|
|
|||
|
|
@ -573,7 +573,6 @@ export function tbPlussShopStaff(data) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
export function tbShopPermissionlist(params) {
|
||||
return request({
|
||||
url: `/api/tbShopPermission/list`,
|
||||
|
|
@ -582,8 +581,6 @@ export function tbShopPermissionlist(params) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过id获取员工信息
|
||||
* @returns
|
||||
|
|
@ -617,7 +614,7 @@ export function callRecord(params) {
|
|||
export function callTablecall(data) {
|
||||
return request({
|
||||
url: `/callTable/call`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
|
@ -755,3 +752,21 @@ export function updateProductData(data) {
|
|||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 商品库存统计列表 统计
|
||||
export function tbProductStockDetailStockCount(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStockDetail/stock/count`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 商品库存记录列表
|
||||
export function tbProductStockDetailStock(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStockDetail/stock`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ import { mapState, mapGetters } from 'vuex'
|
|||
import Theme from '@/components/ThemePicker'
|
||||
import Cookies from 'js-cookie'
|
||||
import Avatar from '@/assets/images/avatar.png'
|
||||
import { updatePass } from '@/api/login.js'
|
||||
import { encrypt } from '@/utils/rsaEncrypt'
|
||||
export default {
|
||||
name: 'Layout',
|
||||
components: {
|
||||
|
|
@ -213,6 +215,14 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 修改密码框类型
|
||||
changeInputType(key) {
|
||||
if (this[key] == 'text') {
|
||||
this[key] = 'password'
|
||||
} else {
|
||||
this[key] = 'text'
|
||||
}
|
||||
},
|
||||
handleClickOutside() {
|
||||
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -72,7 +72,20 @@
|
|||
<div class="item earnings">
|
||||
<div class="num_wrap">
|
||||
<div class="num">{{ formatDecimal(tradeSale.incomeAmountAll || 0) }}</div>
|
||||
<div class="tips">营业实收(元)<el-icon class="el-icon-question" /></div>
|
||||
<div class="tips">营业实收(元)
|
||||
<el-tooltip popper-class="popper" effect="light" placement="bottom">
|
||||
<div class="tips_row" slot="content">
|
||||
<div class="item" v-for="(item, index) in tradeSale.payCount" :key="index">
|
||||
<div class="left">
|
||||
<img class="icon" :src="item.icon">
|
||||
<span>{{ item.payType }}</span>
|
||||
</div>
|
||||
<span class="num">{{ item.payAmount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-icon class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line_wrap">
|
||||
<div class="line_item">
|
||||
|
|
@ -82,9 +95,11 @@
|
|||
</div>
|
||||
<div class="line_gropress">
|
||||
<div class="gropress l"
|
||||
:style="{ width: `${tradeSale.incomeAmount / tradeSale.totalSaleAmount * 100}%` }"></div>
|
||||
:style="{ width: `${tradeSale.incomeAmount ? (tradeSale.incomeAmount / tradeSale.totalSaleAmount * 100) : 0}%` }">
|
||||
</div>
|
||||
<div class="gropress r"
|
||||
:style="{ width: `${tradeSale.refundAmount / tradeSale.totalSaleAmount * 100}%` }"></div>
|
||||
:style="{ width: `${tradeSale.refundAmount ? (tradeSale.refundAmount / tradeSale.totalSaleAmount * 100) : 0}%` }">
|
||||
</div>
|
||||
</div>
|
||||
<div class="line_btm">
|
||||
<el-icon class="icon el-icon-caret-right" />
|
||||
|
|
@ -100,10 +115,12 @@
|
|||
<div class="t">{{ formatDecimal(tradeSale.totalVipAmount || 0) }}</div>
|
||||
</div>
|
||||
<div class="line_gropress">
|
||||
<div class="gropress l" :style="{ width: `${tradeSale.inAmount / tradeSale.totalVipAmount * 100}%` }">
|
||||
<div class="gropress l"
|
||||
:style="{ width: `${tradeSale.inAmount ? (tradeSale.inAmount / tradeSale.totalVipAmount * 100) : 0}%` }">
|
||||
</div>
|
||||
<div class="gropress r"
|
||||
:style="{ width: `${tradeSale.outAmount / tradeSale.totalVipAmount * 100}%` }"></div>
|
||||
:style="{ width: `${tradeSale.inAmount ? (tradeSale.outAmount / tradeSale.totalVipAmount * 100) : 0}%` }">
|
||||
</div>
|
||||
</div>
|
||||
<div class="line_btm">
|
||||
<el-icon class="icon el-icon-caret-right" />
|
||||
|
|
@ -119,7 +136,7 @@
|
|||
<div class="data_item">
|
||||
<div class="num_wrap">
|
||||
<div class="num">{{ formatDecimal(tradeVip.useAmount || 0) }}</div>
|
||||
<div class="tips">会员消费(元)<el-icon class="el-icon-question" /></div>
|
||||
<div class="tips">会员消费(元)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data_item_right">
|
||||
|
|
@ -137,7 +154,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="item item2">
|
||||
<div class="title">翻台率 <el-icon class="icon el-icon-question" /> </div>
|
||||
<div class="title">翻台率
|
||||
<el-tooltip effect="dark" content="翻台率=(客单数-桌台数)/桌台数*100%" placement="top">
|
||||
<el-icon class="icon el-icon-question" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class="icon_wrap">
|
||||
<img class="img" src="@/assets/images/data_home_item2_icon.png" />
|
||||
<div class="t">{{ tradeCount.turnoverRate }}</div>
|
||||
|
|
@ -186,7 +207,7 @@
|
|||
<div class="item active">商品销售排行</div>
|
||||
</div>
|
||||
<el-radio-group v-model="saleTableActive" @change="rankChange">
|
||||
<el-radio-button label="1">今天</el-radio-button>
|
||||
<!-- <el-radio-button label="1">今天</el-radio-button> -->
|
||||
<el-radio-button label="7">近7天</el-radio-button>
|
||||
<el-radio-button label="30">30天</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
@ -209,10 +230,10 @@
|
|||
</div>
|
||||
<div class="table">
|
||||
<el-table :data="saleTable" v-loading="saleTableLoading">
|
||||
<el-table-column label="排名" prop="productId"></el-table-column>
|
||||
<!-- <el-table-column label="排名" prop="productId"></el-table-column> -->
|
||||
<el-table-column label="商品名称" prop="productName"></el-table-column>
|
||||
<el-table-column label="数量" prop="productNum"></el-table-column>
|
||||
<el-table-column label="金额" prop="amount"></el-table-column>
|
||||
<el-table-column label="数量" prop="salesNum"></el-table-column>
|
||||
<el-table-column label="金额" prop="salesAmount"></el-table-column>
|
||||
</el-table>
|
||||
<div class="head-container" style="padding-top: 20px;display: flex;justify-content: flex-end;">
|
||||
<el-pagination :total="saleTableTotal" :page-size="saleTableSize" :current-page="saleTablePage"
|
||||
|
|
@ -270,10 +291,10 @@ export default {
|
|||
chartType: 1,
|
||||
productCount: 0,
|
||||
productSum: 0,
|
||||
saleTableActive: "1",
|
||||
saleTableActive: "7",
|
||||
saleTable: [],
|
||||
saleTableLoading: false,
|
||||
saleTablePage: 1,
|
||||
saleTablePage: 0,
|
||||
saleTableTotal: 0,
|
||||
saleTableSize: 5,
|
||||
__resizeHandler: null,
|
||||
|
|
@ -285,7 +306,9 @@ export default {
|
|||
createdAt: '',
|
||||
},
|
||||
tradeLoading: false,
|
||||
tradeSale: '',
|
||||
tradeSale: {
|
||||
payCount: []
|
||||
},
|
||||
tradeVip: '',
|
||||
tradeCount: '',
|
||||
};
|
||||
|
|
@ -294,7 +317,7 @@ export default {
|
|||
// this.summaryGet();
|
||||
this.dateAmount();
|
||||
this.dateProduct();
|
||||
this.summaryDateGet();
|
||||
// this.summaryDateGet();
|
||||
this.timeChange('0')
|
||||
|
||||
this.__resizeHandler = debounce(() => {
|
||||
|
|
@ -666,7 +689,10 @@ export default {
|
|||
this.payChart = echarts.init(this.$refs.payChart);
|
||||
this.payChart.setOption({
|
||||
tooltip: {
|
||||
trigger: "item"
|
||||
trigger: "item",
|
||||
formatter: params => {
|
||||
return `${params.name}:${params.value}笔`
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
top: "5%",
|
||||
|
|
@ -734,10 +760,12 @@ export default {
|
|||
this.saleTablePage,
|
||||
this.saleTableSize
|
||||
);
|
||||
this.saleTable = res.totalProduct;
|
||||
this.saleTableTotal = res.total;
|
||||
this.productCount = res.productCount;
|
||||
this.productSum = res.productSum;
|
||||
this.saleTable = res.productList.content;
|
||||
this.saleTableTotal = res.productList.totalElements;
|
||||
this.productCount = res.productCount.payAmount;
|
||||
this.productSum = res.productSum.payAmount;
|
||||
|
||||
this.summaryDateGet(res.countList)
|
||||
setTimeout(() => {
|
||||
this.saleTableLoading = false;
|
||||
}, 300);
|
||||
|
|
@ -788,7 +816,7 @@ export default {
|
|||
},
|
||||
rankChange() {
|
||||
this.dateProduct();
|
||||
this.summaryDateGet();
|
||||
// this.summaryDateGet();
|
||||
},
|
||||
// 初始化销售图标
|
||||
initProduceChart(p1, p2) {
|
||||
|
|
@ -938,17 +966,23 @@ export default {
|
|||
});
|
||||
},
|
||||
// 日期汇总数据
|
||||
async summaryDateGet() {
|
||||
async summaryDateGet(res) {
|
||||
try {
|
||||
const res = await summaryDateGet(this.saleTableActive);
|
||||
console.log(res);
|
||||
|
||||
// const res = await summaryDateGet(this.saleTableActive);
|
||||
let p1 = [
|
||||
res.numList.map(item => item.tradeDay),
|
||||
res.numList.map(item => item.count)
|
||||
res.map(item => item.tradeDay),
|
||||
res.map(item => item.saleNum)
|
||||
];
|
||||
let p2 = [
|
||||
res.amountList.map(item => item.tradeDay),
|
||||
res.amountList.map(item => item.count)
|
||||
res.map(item => item.tradeDay),
|
||||
res.map(item => item.saleAmount)
|
||||
];
|
||||
|
||||
console.log(p1);
|
||||
console.log(p2);
|
||||
|
||||
this.initProduceChart(p1, p2);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
@ -958,7 +992,43 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.popper {
|
||||
border: 1px solid #D9D9D9 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.tips_row {
|
||||
width: 300px;
|
||||
padding: 0 10px;
|
||||
|
||||
.item {
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #666;
|
||||
justify-content: space-between;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid #D9D9D9;
|
||||
}
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
font-size: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.num {
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
background-color: #f5f5f5;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<el-button type="primary" plain icon="el-icon-plus" @click="$refs.addClassifyRef.show()">添加分类</el-button>
|
||||
<addClassify ref="addClassifyRef" @success="tbShopCategoryGet" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片">
|
||||
<el-form-item label="商品图片" prop="coverImg">
|
||||
<div style="display: flex; flex-wrap: wrap">
|
||||
<div v-for="(item, index) in imgList" :key="index" style="position: relative" class="showStyle">
|
||||
<i class="el-icon-error buttonstyle" @click="deleteEvent(item)"></i>
|
||||
|
|
@ -440,6 +440,13 @@ export default {
|
|||
callback();
|
||||
}
|
||||
};
|
||||
const validateCoverImg = (rule, value, callback) => {
|
||||
if (!this.form.images.length) {
|
||||
callback(new Error("请上传商品图片"));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
shopTypesActive: 0,
|
||||
shopTypes: settings.typeEnum,
|
||||
|
|
@ -520,6 +527,14 @@ export default {
|
|||
message: "请输入商品名称",
|
||||
},
|
||||
],
|
||||
coverImg: [
|
||||
{
|
||||
required: true,
|
||||
trigger: "change",
|
||||
validator: validateCoverImg,
|
||||
message: "请上传商品图片",
|
||||
}
|
||||
],
|
||||
unitId: [
|
||||
{
|
||||
required: true,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
<div class="btn_wrap">
|
||||
<div class="refund_stock">
|
||||
<span>退款退回库存</span>
|
||||
<el-switch v-model="isRefundStock"></el-switch>
|
||||
<el-switch :active-value="1" :inactive-value="0" v-model="goodsDetail.isRefundStock"></el-switch>
|
||||
</div>
|
||||
<el-radio-group v-model="type">
|
||||
<el-radio-group v-model="type" @change="typeChange">
|
||||
<el-radio-button label="1">添加至商品</el-radio-button>
|
||||
<el-radio-button label="2" v-if="goodsDetail.typeEnum == '多规格'">添加至规格</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
</div>
|
||||
<el-table :data="tableData.cons">
|
||||
<el-table-column label="序号" type="index" width="50"></el-table-column>
|
||||
<el-table-column label="规格名称" prop="specSnap" v-if="type == 2"></el-table-column>
|
||||
<el-table-column label="耗材名称">
|
||||
<template v-slot="scope">
|
||||
<el-select v-model="scope.row.conInfoId" filterable remote reserve-keyword placeholder="请输入关键词"
|
||||
|
|
@ -46,7 +47,7 @@
|
|||
<div class="btn sub" @click="tableData.cons.splice(scope.$index, 1)">
|
||||
<i class="el-icon-remove-outline"></i>
|
||||
</div>
|
||||
<div class="btn add" @click="createItem">
|
||||
<div class="btn add" @click="createItem(scope.row)">
|
||||
<i class="el-icon-circle-plus-outline"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -85,11 +86,24 @@ export default {
|
|||
// 提交
|
||||
async onSubmitHandle() {
|
||||
try {
|
||||
// let flag = true
|
||||
|
||||
// this.tableData.cons.map(item => {
|
||||
// if (!item.conInfoId) {
|
||||
// flag = false
|
||||
// }
|
||||
// })
|
||||
|
||||
// if (!flag) {
|
||||
// this.$message.error('请完善信息')
|
||||
// return
|
||||
// }
|
||||
this.formLoading = true
|
||||
const res = await tbProskuConV2(this.tableData)
|
||||
this.formLoading = false
|
||||
this.$message.success('编辑成功')
|
||||
this.dialogVisible = false
|
||||
this.$emit('refundChange', this.goodsDetail)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
this.formLoading = false
|
||||
|
|
@ -128,14 +142,20 @@ export default {
|
|||
this.dialogVisible = true
|
||||
this.goodsDetail = { ...obj }
|
||||
this.tableData.productId = this.goodsDetail.id
|
||||
if (obj.conInfos.length) {
|
||||
this.tableData.cons = [...obj.conInfos]
|
||||
} else {
|
||||
this.createItem()
|
||||
}
|
||||
this.type = this.goodsDetail.isSaveSku
|
||||
|
||||
this.initItem()
|
||||
},
|
||||
// 生成新关系项
|
||||
createItem() {
|
||||
// 切换类型
|
||||
typeChange() {
|
||||
this.initItem(true)
|
||||
},
|
||||
// 初始化绑定耗材项
|
||||
initItem(radio = false) {
|
||||
this.tableData.cons = []
|
||||
if (this.type == 1) {
|
||||
// 添加至商品
|
||||
if (radio) {
|
||||
let item = {}
|
||||
item.id = ''
|
||||
item.shopId = localStorage.getItem('shopId')
|
||||
|
|
@ -147,6 +167,95 @@ export default {
|
|||
item.surplusStock = 0
|
||||
item.status = 1
|
||||
this.tableData.cons.push(item)
|
||||
} else {
|
||||
if (this.goodsDetail.conInfos.length) {
|
||||
|
||||
this.goodsDetail.conInfos.map(val => {
|
||||
let item = {}
|
||||
|
||||
item.id = val.id
|
||||
item.shopId = val.shopId
|
||||
item.productId = val.productId
|
||||
item.productSkuId = 0
|
||||
item.conInfoId = val.conInfoId
|
||||
item.name = ''
|
||||
item.conUnit = val.conUnit
|
||||
item.surplusStock = val.surplusStock
|
||||
item.status = 1
|
||||
item.specSnap = ''
|
||||
|
||||
this.tableData.cons.push(item)
|
||||
})
|
||||
} else {
|
||||
let item = {}
|
||||
item.id = ''
|
||||
item.shopId = localStorage.getItem('shopId')
|
||||
item.productId = this.goodsDetail.id
|
||||
item.productSkuId = 0
|
||||
item.conInfoId = ''
|
||||
item.name = ''
|
||||
item.conUnit = ''
|
||||
item.surplusStock = 0
|
||||
item.status = 1
|
||||
this.tableData.cons.push(item)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 添加至规格
|
||||
if (this.goodsDetail.conInfos.length) {
|
||||
this.tableData.cons = [...this.goodsDetail.conInfos]
|
||||
}
|
||||
this.goodsDetail.skuList.map(val => {
|
||||
let item = {}
|
||||
|
||||
item.id = ''
|
||||
item.shopId = localStorage.getItem('shopId')
|
||||
item.productId = this.goodsDetail.id
|
||||
item.productSkuId = val.id
|
||||
item.conInfoId = ''
|
||||
item.name = ''
|
||||
item.conUnit = ''
|
||||
item.surplusStock = 0
|
||||
item.status = 1
|
||||
item.specSnap = val.name
|
||||
|
||||
this.tableData.cons.push(item)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 生成新关系项
|
||||
createItem(val) {
|
||||
if (this.type == 1) {
|
||||
|
||||
let item = {}
|
||||
|
||||
item.id = ''
|
||||
item.shopId = localStorage.getItem('shopId')
|
||||
item.productId = this.goodsDetail.id
|
||||
item.productSkuId = 0
|
||||
item.conInfoId = ''
|
||||
item.name = ''
|
||||
item.conUnit = ''
|
||||
item.surplusStock = 0
|
||||
item.status = 1
|
||||
|
||||
this.tableData.cons.push(item)
|
||||
} else {
|
||||
let item = {}
|
||||
|
||||
item.id = ''
|
||||
item.shopId = localStorage.getItem('shopId')
|
||||
item.productId = this.goodsDetail.id
|
||||
item.productSkuId = val.productSkuId
|
||||
item.conInfoId = ''
|
||||
item.name = ''
|
||||
item.conUnit = ''
|
||||
item.surplusStock = 0
|
||||
item.status = 1
|
||||
item.specSnap = val.specSnap
|
||||
|
||||
this.tableData.cons.push(item)
|
||||
}
|
||||
},
|
||||
reset() {
|
||||
this.goodsDetail = ''
|
||||
|
|
|
|||
|
|
@ -0,0 +1,113 @@
|
|||
<!-- 商品库存记录 -->
|
||||
<template>
|
||||
<el-dialog width="80%" :title="`${keysList[key]}统计`" :visible.sync="dialogVisible" @close="reset">
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" height="400px">
|
||||
<el-table-column label="商品名称/规格名称" prop="productName"></el-table-column>
|
||||
<el-table-column label="变动后库存">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.leftNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原有库存" prop="">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.leftNumber + scope.row.stockNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作描述" prop="type"></el-table-column>
|
||||
<el-table-column :label="`${keysList[key]}`" prop="">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.stockNumber }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="报损" prop=""></el-table-column> -->
|
||||
<el-table-column label="操作人" prop="operator"></el-table-column>
|
||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||
<el-table-column label="操作时间" prop="updatedAt">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.updatedAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination :total="tableData.total" @size-change="handleSizeChange" :current-page="tableData.page + 1"
|
||||
:page-size="tableData.size" @current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { tbProductStockDetailStock } from '@/api/shop.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dayjs,
|
||||
dialogVisible: false,
|
||||
key: 'stockNumber',
|
||||
keysList: {
|
||||
stockNumber: '现有数量',
|
||||
addCountNumber: '增加数量',
|
||||
addNumber: '手动增加',
|
||||
refundNumber: '退货',
|
||||
subCountNumber: '减少数量',
|
||||
subNumber: '手动减少',
|
||||
saleNumber: '销售量',
|
||||
lossNumber: '报损',
|
||||
},
|
||||
productId: '',
|
||||
tableData: {
|
||||
sort: 1,
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
loading: false,
|
||||
total: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 库存记录列表
|
||||
async tbProductStockDetailStock() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await tbProductStockDetailStock({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
column: this.key
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.tbProductStockDetailStock()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableData.size = val
|
||||
this.tbProductStockDetailStock()
|
||||
},
|
||||
// 显示
|
||||
show(key) {
|
||||
this.dialogVisible = true
|
||||
this.key = key
|
||||
this.tbProductStockDetailStock()
|
||||
},
|
||||
// 初始化dialog
|
||||
reset() {
|
||||
this.tableData.page = 0
|
||||
this.tableData.data = []
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
|
@ -23,13 +23,72 @@
|
|||
</el-row>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<div class="header_wrap">
|
||||
<router-link :to="{ name: 'add_shop' }">
|
||||
<el-button type="primary" icon="el-icon-plus">添加商品</el-button>
|
||||
</router-link>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-select v-model="tableData.sort" placeholder="排序" @change="getTableData">
|
||||
<el-option value="createdAt,desc" label="创建时间"></el-option>
|
||||
<el-option value="stockNumber,asc" label="数量由低到高"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<div class="data_wrap">
|
||||
<div class="item">
|
||||
<div class="icon">
|
||||
<i class="el-icon-pie-chart"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="row">
|
||||
<span>现有数量</span>
|
||||
<span @click="showStockHistory('stockNumber')">{{ countInfo.stockNumber || 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="icon">
|
||||
<i class="el-icon-sort-up"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="row">
|
||||
<span>增加数量</span>
|
||||
<span class="link" @click="showStockHistory('addCountNumber')">{{ countInfo.addCountNumber || 0 }}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span>手动增加:</span>
|
||||
<span class="link" @click="showStockHistory('addNumber')">{{ countInfo.addNumber || 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="icon">
|
||||
<i class="el-icon-sort-down"></i>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="row">
|
||||
<span>减少数量</span>
|
||||
<span class="link" @click="showStockHistory('subCountNumber')">{{ countInfo.subCountNumber || 0 }}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<span>手动减少:</span>
|
||||
<span class="link" @click="showStockHistory('subNumber')">{{ countInfo.subNumber || 0 }}</span>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="row">
|
||||
<span>销售量:</span>
|
||||
<span class="link" @click="showStockHistory('saleNumber')">{{ countInfo.saleNumber || 0 }}</span>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="row">
|
||||
<span>报损:</span>
|
||||
<span class="link" @click="showStockHistory('lossNumber')">{{ countInfo.lossNumber || 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container" id="table_drag">
|
||||
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id"
|
||||
|
|
@ -73,7 +132,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="耗材信息" width="200">
|
||||
<template v-slot="scope">
|
||||
<div class="cons_wrap">
|
||||
<div class="cons_wrap" v-if="scope.row.typeEnum">
|
||||
<div v-if="scope.row.conInfos && scope.row.conInfos.length">
|
||||
<span v-for="item in scope.row.conInfos" :key="item.id">{{ item.conName }}、</span>
|
||||
</div>
|
||||
|
|
@ -91,15 +150,25 @@
|
|||
<el-button type="text" icon="el-icon-edit"
|
||||
v-if="!scope.row.isShowCash && !scope.row.isShowMall">未上架</el-button> -->
|
||||
<el-switch v-model="scope.row.isGrounding" :active-value="1" :inactive-value="0"
|
||||
@change="changeGrounding($event, scope.row)"></el-switch>
|
||||
@change="changeGrounding($event, scope.row, 'grounding')"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="sort" sortable />
|
||||
<el-table-column label="售罄">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button type="text" icon="el-icon-edit" v-if="scope.row.isShowCash">收银端</el-button>
|
||||
<el-button type="text" icon="el-icon-edit" v-if="scope.row.isShowMall">小程序</el-button>
|
||||
<el-button type="text" icon="el-icon-edit"
|
||||
v-if="!scope.row.isShowCash && !scope.row.isShowMall">未上架</el-button> -->
|
||||
<el-switch v-model="scope.row.isPauseSale" :active-value="1" :inactive-value="0"
|
||||
@change="changeGrounding($event, scope.row, 'pauseSale')"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="排序" prop="sort" sortable />
|
||||
<el-table-column label="更新时间" prop="createdAt" width="150">
|
||||
<template v-slot="scope">
|
||||
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column label="设为热门" prop="createdAt">
|
||||
<template v-slot="scope">
|
||||
<el-switch v-model="scope.row.isHot" :active-value="1" :inactive-value="0"
|
||||
|
|
@ -130,7 +199,9 @@
|
|||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<!-- 绑定耗材 -->
|
||||
<BindCons ref="bindCons" />
|
||||
<BindCons ref="bindCons" @refundChange="refundChange" />
|
||||
<!-- 商品库存记录 -->
|
||||
<StockHistory ref="stockHistory" />
|
||||
<!-- 编辑售价、库存 -->
|
||||
<el-dialog :title="editorEumn[editorForm.key]" :visible.sync="editorVisable" :show-close="false" width="300px">
|
||||
<el-form :model="editorForm">
|
||||
|
|
@ -151,10 +222,12 @@ import Sortable from 'sortablejs'
|
|||
import dayjs from 'dayjs'
|
||||
import settings from '@/settings'
|
||||
import BindCons from './components/bindCons.vue'
|
||||
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData } from '@/api/shop'
|
||||
import StockHistory from './components/stockHistory.vue'
|
||||
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData, tbProductStockDetailStockCount } from '@/api/shop'
|
||||
export default {
|
||||
components: {
|
||||
BindCons
|
||||
BindCons,
|
||||
StockHistory
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -168,6 +241,7 @@ export default {
|
|||
categorys: [],
|
||||
typeEnums: settings.typeEnum,
|
||||
tableData: {
|
||||
sort: 'createdAt,desc',
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 30,
|
||||
|
|
@ -188,7 +262,8 @@ export default {
|
|||
id: '',
|
||||
key: '',
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
countInfo: {}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
|
|
@ -205,10 +280,40 @@ export default {
|
|||
this.tableDrag()
|
||||
})
|
||||
}
|
||||
|
||||
this.tbProductStockDetailStockCount()
|
||||
},
|
||||
methods: {
|
||||
changeGrounding(event, row) {
|
||||
this.editorForm.key = 'grounding'
|
||||
// 显示库存记录
|
||||
showStockHistory(key) {
|
||||
this.$refs.stockHistory.show(key)
|
||||
},
|
||||
// 库存统计列表 统计
|
||||
async tbProductStockDetailStockCount() {
|
||||
try {
|
||||
const res = await tbProductStockDetailStockCount({
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.countInfo = res
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
// 编辑退款是否退回库存
|
||||
refundChange(e) {
|
||||
let row = this.tableData.data.find(item => item.id == e.id)
|
||||
|
||||
if (row.isRefundStock != e.isRefundStock) {
|
||||
this.editorForm.key = 'refundStock'
|
||||
this.editorForm.id = e.id
|
||||
this.editorForm.isSku = !e.typeEnum
|
||||
this.editorForm.value = e.isRefundStock
|
||||
|
||||
this.editorConfirmChange()
|
||||
}
|
||||
},
|
||||
changeGrounding(event, row, key) {
|
||||
this.editorForm.key = key
|
||||
this.editorForm.id = row.id
|
||||
this.editorForm.isSku = !row.typeEnum
|
||||
this.editorForm.value = event
|
||||
|
|
@ -221,7 +326,7 @@ export default {
|
|||
this.editorFormLoading = true
|
||||
const res = await updateProductData([this.editorForm])
|
||||
this.editorFormLoading = false
|
||||
this.$message.success('修改成功')
|
||||
// this.$message.success('修改成功')
|
||||
this.editorVisable = false
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
|
|
@ -320,7 +425,7 @@ export default {
|
|||
}
|
||||
|
||||
this.tableData.loading = true
|
||||
console.log(this.query, '调试2')
|
||||
// console.log(this.query, '调试2')
|
||||
const res = await tbProductListV2({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
|
|
@ -328,7 +433,8 @@ export default {
|
|||
categoryId: this.query.categoryId,
|
||||
id: this.query.productId,
|
||||
type: this.query.typeEnum,
|
||||
shopId: localStorage.getItem('shopId')
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
sort: this.tableData.sort
|
||||
})
|
||||
this.tableData.loading = false
|
||||
this.tableData.data = res.content
|
||||
|
|
@ -369,6 +475,73 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header_wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.data_wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #F4F9FF;
|
||||
height: 80px;
|
||||
padding: 20px;
|
||||
|
||||
.icon {
|
||||
width: 37px;
|
||||
height: 37px;
|
||||
border-radius: 50%;
|
||||
background-color: #D4E9FE;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #3F9EFF;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
flex-direction: column;
|
||||
padding-left: 14px;
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-size: 14px;
|
||||
|
||||
.line {
|
||||
margin: 0 14px;
|
||||
height: 20px;
|
||||
border-left: 1px solid #DDDFE6;
|
||||
}
|
||||
|
||||
span {
|
||||
&.link {
|
||||
color: #3F9EFF;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cons_wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-radio-group v-model="tableActive" @change="selectItemChange">
|
||||
<!-- <el-radio-group v-model="tableActive" @change="selectItemChange">
|
||||
<el-radio-button :label="item.autokey" v-for="item in tableData" :key="item.autokey">
|
||||
{{ item.title }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-radio-group> -->
|
||||
<div class="btn_wraps">
|
||||
<div class="btn" :class="{ active: tableActive == item.autokey }" v-for="item in tableData"
|
||||
:key="item.autokey" @click="tableActive = item.autokey">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form">
|
||||
<div class="preview_wrap">
|
||||
<div class="phone_wrap">
|
||||
|
|
@ -162,7 +168,7 @@
|
|||
</div>
|
||||
<div class="form_item">
|
||||
<el-upload :headers="headers" class="avatar-uploader" :action="qiNiuUploadApi"
|
||||
:show-file-list="false" :on-success="handleSuccess">
|
||||
:show-file-list="false" :on-success="handleSuccess" style="width: 200px;height: 200px;">
|
||||
<img v-if="selectItem.value" :src="selectItem.value" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
|
|
@ -237,6 +243,30 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.btn_wraps {
|
||||
display: flex;
|
||||
$color: #40A9FF;
|
||||
gap: 30px;
|
||||
|
||||
.btn {
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
border: 1px solid $color;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 0 0 4px #40a9ff29;
|
||||
color: $color;
|
||||
cursor: pointer;
|
||||
|
||||
&.active {
|
||||
background-color: $color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form {
|
||||
display: flex;
|
||||
padding-top: 30px;
|
||||
|
|
@ -608,6 +638,13 @@ export default {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.avatar {
|
||||
display: block;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.title {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
<div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" label-position="left">
|
||||
<el-form-item label="门店名称" prop="shopName">
|
||||
<el-input v-model="form.shopName" placeholder="请输入门店名称" style="width: 500px;"></el-input>
|
||||
<el-input v-model.trim="form.shopName" placeholder="请输入门店名称" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="连锁店扩展店名">
|
||||
<el-input v-model="form.chainName" placeholder="请输入连锁店扩展店名" style="width: 500px;"></el-input>
|
||||
<el-input v-model.trim="form.chainName" placeholder="请输入连锁店扩展店名" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店logo">
|
||||
<el-image :src="form.logo || require('@/assets/images/upload.png')" fit="contain"
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
style="width: 80px;height: 80px;" @click="downloadImgHandle(form.smallQrcode)"></el-image>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="外卖起送金额">
|
||||
<el-input-number v-model="form.takeaway_money" placeholder="0.00" controls-position="right"
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
<div style="color: #999;">注:准确的定位便于用户导航到店铺</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="门店详细地址">
|
||||
<el-input type="textarea" v-model="form.address" placeholder="请输入门店详细地址" style="width: 500px;"></el-input>
|
||||
<el-input type="textarea" v-model.trim="form.address" placeholder="请输入门店详细地址" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="营业时间">
|
||||
<el-select v-model="form.businessStartDay" placeholder="周几开始">
|
||||
|
|
@ -80,15 +80,15 @@
|
|||
<el-form-item label="桌位费/位/元">
|
||||
<el-input-number v-model="form.tableFee" :min="0" />
|
||||
<!-- <el-checkbox v-model="form.isTableFee" :label="1">免餐位费</el-checkbox> -->
|
||||
<el-switch v-model="form.isTableFee" :active-value="1" :inactive-value="0" active-text="免餐位费">
|
||||
<el-switch v-model.trim="form.isTableFee" :active-value="1" :inactive-value="0" active-text="免餐位费">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启8折活动">
|
||||
<el-switch v-model="form.isOpenYhq" active-value="true" inactive-value="false"></el-switch>
|
||||
<el-switch v-model.trim="form.isOpenYhq" active-value="true" inactive-value="false"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启会员支付">
|
||||
<el-switch v-model="form.isUseVip" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<el-switch v-model.trim="form.isUseVip" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<!-- <div style="color: #999;">是否允许用户在小程序端支付订单</div> -->
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="结算类型">
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
</el-time-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="店铺简介">
|
||||
<el-input type="textarea" v-model="form.detail" placeholder="请输入店铺简介" style="width: 500px;"></el-input>
|
||||
<el-input type="textarea" v-model.trim="form.detail" placeholder="请输入店铺简介" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
|
|
@ -156,7 +156,8 @@
|
|||
<el-dialog :visible.sync="showUpload" :close-on-click-modal="false" append-to-body width="500px"
|
||||
@close="showUpload = false">
|
||||
<el-upload :before-remove="handleBeforeRemove" :on-success="handleSuccess" :on-error="handleError"
|
||||
:file-list="fileList" :headers="headers" :action="qiNiuUploadApi" class="upload-demo" multiple>
|
||||
:file-list="fileList" :headers="headers" :action="qiNiuUploadApi" :limit="1" list-type="picture"
|
||||
class="upload-demo">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" style="display: block;" class="el-upload__tip">
|
||||
请勿上传违法文件,且文件不超过15M
|
||||
|
|
@ -314,6 +315,12 @@ export default {
|
|||
message: "提交成功",
|
||||
type: "success"
|
||||
});
|
||||
|
||||
localStorage.setItem('shopName', this.form.shopName)
|
||||
localStorage.setItem('logo', this.form.logo)
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 1000);
|
||||
} catch (error) { }
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<el-table-column label="店铺信息" width="200">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg"
|
||||
<el-image :src="scope.row.logo"
|
||||
style="width: 50px;height: 50px;border-radius: 4px;background-color: #efefef;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
|
|
|
|||
Loading…
Reference in New Issue