Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq

This commit is contained in:
gyq 2024-07-30 16:00:13 +08:00
commit 4818e2e927
3 changed files with 360 additions and 0 deletions

14
src/api/homes/record.js Normal file
View File

@ -0,0 +1,14 @@
import request from '@/utils/request'
/**
* 查询交班记录
* @returns
*/
export function tbHandoverGet(leng) {
return request({
url: leng,
method: 'get'
})
}

View File

@ -58,6 +58,12 @@ export const constantRouterMap = [
component: (resolve) => require(['@/views/home/data_tables'], resolve), component: (resolve) => require(['@/views/home/data_tables'], resolve),
name: 'data_tables', name: 'data_tables',
meta: { title: '桌台统计' } meta: { title: '桌台统计' }
},
{
path: 'data_record',
component: (resolve) => require(['@/views/home/data_record'], resolve),
name: 'data_record',
meta: { title: '交班记录' }
} }
] ]
}, },

View File

@ -0,0 +1,340 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form :model="query" inline label-position="left">
<el-radio-group v-model="timeValue" @change="timeChange">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button label="0">今天</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-button label="week">本周</el-radio-button>
<el-radio-button label="month">本月</el-radio-button>
<el-radio-button label="custom">自定义</el-radio-button>
</el-radio-group>
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" value-format="yyyyMMdd">
</el-date-picker>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading" v-if="orderType == 1">
<el-table-column type="index" width="50">
</el-table-column>
<el-table-column label="商户名称" prop="merchantName"> </el-table-column>
<el-table-column label="打印机编号" prop="printNo"></el-table-column>
<el-table-column label="职员名称" prop="staffName"></el-table-column>
<el-table-column label="订单数量" prop="orderNum"></el-table-column>
<el-table-column label="应交金额" prop="payable"></el-table-column>
<el-table-column label="上交金额" prop="handIn"></el-table-column>
<el-table-column label="快捷收款金额" prop="quickAmount"></el-table-column>
<el-table-column label="退款金额" prop="returnAmount"></el-table-column>
<el-table-column label="总收入" prop="totalAmount"></el-table-column>
<el-table-column label="备用金" prop="imprest"></el-table-column>
<el-table-column label="开始时间" prop="createTime">
<template v-slot="scope">
<div>
{{ scope.row.createTime }}
</div>
</template>
</el-table-column>
<el-table-column label="交班时间" prop="endTime">
<template v-slot="scope">
<div>
{{ scope.row.createTime }}
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</div>
</template>
<script>
import { tbHandoverGet } from '@/api/homes/record.js'
import dayjs from "dayjs";
export default {
data() {
return {
timeValue: "",
resetQuery: null,
orderType: "1",
categorys: [],
query: {
createdAt: [],
proName: '',
cateId: ''
},
tableData: {
data: [],
page: 0,
size: 10,
loading: false,
total: 0
},
payCountList: "",
payCountTotal: 0
};
},
filters: {
timeFilter(s) {
return dayjs(s).format("YYYY-MM-DD");
}
},
mounted() {
this.resetQuery = { ...this.query };
this.getTableData();
},
methods: {
//table id
toTableOrderList(data) {
console.log(data)
this.$router.push({
path: '/order_manage/order_list',
query: {
tableName: data.tableName
}
})
},
//
resetHandle() {
this.timeValue = "";
this.query = { ...this.resetQuery };
this.page = 0;
this.getTableData();
},
//
sizeChange(e) {
this.tableData.size = e;
this.getTableData();
},
//
paginationChange(e) {
this.tableData.page = e - 1;
this.getTableData();
},
async getTableData() {
this.tableData.loading = true;
try {
let urlData = null
if (this.query.createdAt.length == 0) { // key -- 2024.7.30 15:50
urlData = `/api/tbHandover?page=${this.tableData.page + 1}&size=${this.tableData.size}&shopId=${localStorage.getItem("shopId")}`
} else {
urlData = `/api/tbHandover?page=${this.tableData.page + 1}&size=${this.tableData.size}&shopId=${localStorage.getItem("shopId")}&tradeDay=${this.query.createdAt[0] ? this.query.createdAt[0] : ''}&tradeDay=${this.query.createdAt[1] ? this.query.createdAt[1] : ''}`
}
const res = await tbHandoverGet(urlData);
this.tableData.loading = false;
this.tableData.data = res.content;
this.tableData.total = res.totalElements;
} catch (error) {
console.log(error);
}
},
//
timeChange(e) {
// const format = ["YYYY-MM-DD 00:00:00", "YYYY-MM-DD 23:59:59"];
const format = ["YYYYMMDD", "YYYYMMDD"];
switch (e) {
case "":
//
this.query.createdAt = [];
break;
case "0":
//
this.query.createdAt = [
dayjs().format(format[0]),
dayjs().format(format[1])
];
break;
case "-1":
//
this.query.createdAt = [
dayjs()
.add(-1, "d")
.format(format[0]),
dayjs()
.add(-1, "d")
.format(format[1])
];
break;
case "-7":
// 7
this.query.createdAt = [
dayjs()
.add(-7, "d")
.format(format[0]),
dayjs().format(format[1])
];
break;
case "-30":
// 7
this.query.createdAt = [
dayjs()
.add(-30, "d")
.format(format[0]),
dayjs().format(format[1])
];
break;
case "week":
//
this.query.createdAt = [
dayjs()
.startOf("week")
.format(format[0]),
dayjs()
.endOf("week")
.format(format[1])
];
break;
case "month":
//
this.query.createdAt = [
dayjs()
.startOf("month")
.format(format[0]),
dayjs()
.endOf("month")
.format(format[1])
];
break;
case "custom":
//
this.query.createdAt = [];
break;
default:
break;
}
}
}
};
</script>
<style scoped lang="scss">
.cursor-pointer {
cursor: pointer;
color: #1890ff;
transition: all 0.3s;
}
.cursor-pointer:hover {
opacity: .7;
}
.collect_wrap {
display: flex;
gap: 14px;
.item {
flex: 1;
display: flex;
align-items: center;
background-color: #f5f5f5;
padding: 20px;
.icon_wrap {
$size: 34px;
$border: 6px;
width: $size;
height: $size;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--bg-color);
border-radius: 50%;
position: relative;
&::after {
content: "";
width: $size + $border;
height: $size + $border;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: var(--bg-color);
opacity: 0.3;
}
.icon {
font-size: 16px;
color: #fff;
}
.img {
width: 20px;
height: 20px;
}
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 10px;
.m {
font-weight: bold;
}
.t {
font-size: 12px;
color: #999;
padding-top: 4px;
}
}
}
}
.refund {
color: #ff9731;
font-weight: bold;
}
.table_order_info {
.order_no {
color: #999;
}
.type {
color: #e6a23c;
}
}
.goods_info {
.row {
display: flex;
&:not(:first-child) {
margin-top: 10px;
}
.cover {
width: 40px;
height: 40px;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 10px;
.sku {
color: #999;
}
}
}
}
</style>