oil-station/fuintCashierWeb/src/views/cashier/orderComponents/order_Cashier.vue

515 lines
18 KiB
Vue
Raw Normal View History

2023-10-27 16:31:27 +08:00
<!-- 收银台订单-->
<template>
<div>
<el-card class="box-card">
2023-11-11 13:54:24 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="交易员工" prop="staffId">
<el-select
v-model="queryParams.staffId"
clearable
placeholder="全部"
>
<el-option v-for="item in staffList" :key="item.id" :label="item.realName" :value="item.id">
<span style="float: left">{{ item.realName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.mobile }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单号">
2024-01-15 16:10:11 +08:00
<el-input v-model="queryParams.orderNo" clearable placeholder="订单号检索"></el-input>
2023-11-11 13:54:24 +08:00
</el-form-item>
<el-form-item label="交易时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
size="medium"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</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>
2023-10-27 16:31:27 +08:00
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>收银台订单统计</span>
</div>
<div class="box-gang">
2024-01-06 15:06:58 +08:00
<div class="box">
<div class="size-hui">笔数</div>
<div class="size-bole">{{ orderStatistics.numberOfStrokes?orderStatistics.numberOfStrokes:0 }}</div>
</div>
<div class="box">
<div class="size-hui">订单总金额</div>
<div class="size-bole">{{ orderStatistics.theTotalAmountOfTheOrder?orderStatistics.theTotalAmountOfTheOrder:0 }}</div>
</div>
<div class="box">
<div class="size-hui">实付总金额</div>
<div class="size-bole">{{ orderStatistics.theTotalAmountPaid?orderStatistics.theTotalAmountPaid:0 }}</div>
</div>
<div class="box">
<div class="size-hui">油品优惠</div>
<div class="size-bole">{{ orderStatistics.oilDiscounts?orderStatistics.oilDiscounts:0 }}</div>
</div>
<div class="box">
<div class="size-hui">油品总金额</div>
<div class="size-bole">{{ orderStatistics.theTotalAmountOfOil?orderStatistics.theTotalAmountOfOil:0 }}</div>
</div>
<div class="box">
<div class="size-hui">商品总金额</div>
<div class="size-bole">{{ orderStatistics.theTotalAmountOfTheItem?orderStatistics.theTotalAmountOfTheItem:0 }}</div>
2023-10-27 16:31:27 +08:00
</div>
</div>
</el-card>
<el-card class="box-card">
<div class="wgang">
<div>收银台订单列表</div>
2024-01-13 13:22:10 +08:00
<div style="display: flex ">
<el-button type="primary" size="mini" icon="el-icon-plus" @click = "exportExcelCashier()">导出订单</el-button>
</div>
2023-10-27 16:31:27 +08:00
</div>
<div class="table-box">
<el-table
2023-11-11 13:54:24 +08:00
:data="orderList"
2023-10-27 16:31:27 +08:00
style="width: 100%">
<el-table-column type="expand">
<template slot-scope="props">
2023-11-15 18:48:07 +08:00
<el-form label-position="left" class="demo-table-expand" style="margin-left: 20px">
2023-11-11 13:54:24 +08:00
<el-form-item label="收银员">
2023-11-15 18:48:07 +08:00
<span>{{ getRealName(staffList,props.row.staffId) }}</span>
</el-form-item>
2023-11-16 19:00:57 +08:00
<el-form-item label="收银员手机号">
2023-11-15 18:48:07 +08:00
<span>{{ getMobile(staffList,props.row.staffId) }}</span>
2023-10-27 16:31:27 +08:00
</el-form-item>
</el-form>
</template>
</el-table-column>
2024-01-12 15:29:24 +08:00
<el-table-column prop="orderNo" label="订单号" width="220"> </el-table-column>
2023-11-16 19:00:57 +08:00
<el-table-column prop="amount" label="订单金额"> </el-table-column>
2024-01-12 17:03:22 +08:00
<el-table-column prop="payAmount" label="实付金额"> </el-table-column>
2023-11-11 13:54:24 +08:00
<el-table-column label="订单金额组成">
2024-01-12 17:03:22 +08:00
<el-table-column prop="oilOrderAmount" label="油品金额">
<template slot-scope="scope">
<span>{{scope.row.oilOrderAmount ? scope.row.oilOrderAmount : '0'}}</span>
</template>
2023-10-27 16:31:27 +08:00
</el-table-column>
2024-01-12 17:03:22 +08:00
<el-table-column prop="goodsOrderAmount" label="商品金额">
<template slot-scope="scope">
<span>{{scope.row.goodsOrderAmount ? scope.row.goodsOrderAmount : '0'}}</span>
</template>
2023-10-27 16:31:27 +08:00
</el-table-column>
</el-table-column>
2024-01-12 17:03:22 +08:00
<el-table-column prop="payUser" label="付款用户"> </el-table-column>
<el-table-column prop="status" label="状态">
2023-11-11 13:54:24 +08:00
<template slot-scope="scope">
<el-tag v-if="scope.row.status == 'unpaid'">未支付</el-tag>
<el-tag type="success" v-else-if="scope.row.status == 'paid'">已支付</el-tag>
<el-tag type="danger" v-else>支付失败</el-tag>
</template>
2023-10-27 16:31:27 +08:00
</el-table-column>
2023-11-11 18:04:49 +08:00
<el-table-column label="交易时间" align="center" width="160" prop="payTime">
2023-10-27 16:31:27 +08:00
<template slot-scope="scope">
2023-11-11 18:04:49 +08:00
<span>{{ scope.row.payTime ? parseTime(scope.row.payTime):"--" }}</span>
2023-11-11 13:54:24 +08:00
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope">
2023-11-11 18:04:49 +08:00
<el-button style="width: 60px" size="mini"
@click="getOrdersInfo(scope.row.id)"
type="success" plain round>详情</el-button>
<el-button style="width: 60px" size="mini"
@click="patchwork(scope.row)"
type="primary" plain round>补打</el-button>
<el-button style="width: 60px" size="mini"
@click="handleRefund(scope.row.id)"
type="danger" plain round>退款</el-button>
2023-10-27 16:31:27 +08:00
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-box">
<el-pagination
background
2023-11-11 18:04:49 +08:00
v-show="total>0"
2023-10-27 16:31:27 +08:00
layout="prev, pager, next"
2023-11-11 18:04:49 +08:00
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@current-change="getList">
2023-10-27 16:31:27 +08:00
</el-pagination>
</div>
</el-card>
2023-11-11 18:04:49 +08:00
<!-- 订单详情-->
<el-dialog
title="订单详情"
:visible.sync="dialogVisible">
<div>
<el-descriptions>
<el-descriptions-item label="收银员姓名">{{ cashierOrder.realName }}</el-descriptions-item>
<el-descriptions-item label="收银员账号">{{ cashierOrder.mobile }}</el-descriptions-item>
<el-descriptions-item label="订单编号">{{ cashierOrder.orderNo }}</el-descriptions-item>
<el-descriptions-item label="订单金额">{{ cashierOrder.amount }}</el-descriptions-item>
<el-descriptions-item label="油品金额">{{ cashierOrder.oilOrderAmount }}</el-descriptions-item>
<el-descriptions-item label="商品金额">{{ cashierOrder.goodsOrderAmount }}</el-descriptions-item>
<el-descriptions-item label="油品优惠总额">{{ cashierOrder.oilDiscountAmount }}</el-descriptions-item>
<el-descriptions-item label="商品优惠总额">{{ cashierOrder.goodsDiscountAmount }}</el-descriptions-item>
<el-descriptions-item label="实付金额">{{ cashierOrder.payAmount }}</el-descriptions-item>
<el-descriptions-item label="付款方式">
<el-tag v-if="cashierOrder.status == 'unpaid'">未支付</el-tag>
<el-tag type="success" v-else-if="cashierOrder.status == 'paid'">已支付</el-tag>
<el-tag type="danger" v-else>支付失败</el-tag>
</el-descriptions-item>
<el-descriptions-item label="交易时间">
{{ cashierOrder.payTime ? parseTime(cashierOrder.payTime):"--" }}
</el-descriptions-item>
</el-descriptions>
</div>
<div>
<el-descriptions :column="1" direction="vertical">
<el-descriptions-item label="油品详情">
<el-table
:data="oilInfo"
style="width: 100%">
<el-table-column label="油品金额" prop="orderAmount">
<template slot-scope="scope">
<span>{{ scope.row.orderAmount }}</span>
</template>
</el-table-column>
<el-table-column label="油号油枪" align="center" prop="terminal">
<template slot-scope="scope">
2024-01-12 15:29:24 +08:00
<span>{{ getName(oilNameList,scope.row.oils) }}/{{ scope.row.oilGunNum }}</span>
2023-11-11 18:04:49 +08:00
</template>
</el-table-column>
<el-table-column label="加油升数" align="center" prop="oilNum" >
<template slot-scope="scope">
<span>{{ scope.row.oilNum }}L</span>
</template>
</el-table-column>
<el-table-column label="油品单价" align="center" prop="amount">
<template slot-scope="scope">
<span>{{ scope.row.oilPrice }}/L</span>
</template>
</el-table-column>
</el-table>
</el-descriptions-item>
<el-descriptions-item label="商品详情">
<el-table
:data="goodsInfo"
style="width: 100%">
<el-table-column label="商品名称" prop="name"/>
<el-table-column label="单价" align="center" prop="retailPrice">
<template slot-scope="scope">
<span v-if="cashierOrder.payUser == '散客'">{{ scope.row.retailPrice }}</span>
<span v-else>{{ scope.row.memberPrice }}</span>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="num"/>
<el-table-column label="合计" align="center" prop="num">
<template slot-scope="scope">
<span v-if="cashierOrder.payUser == '散客'">{{ scope.row.retailPrice * scope.row.num }}</span>
<span v-else>{{ scope.row.memberPrice * scope.row.num }}</span>
</template>
</el-table-column>
</el-table>
</el-descriptions-item>
</el-descriptions>
</div>
</el-dialog>
<!-- 订单退款-->
<el-dialog
title="订单退款"
width="25%"
:visible.sync="dialogRefund">
<div style="text-align: center;font-weight: bold">
2024-01-15 16:10:11 +08:00
<span style="font-size: 35px">{{ cashierOrder.payAmount }}</span>
2023-11-11 18:04:49 +08:00
</div>
<div class="tk">退款金额</div>
<div class="tk">退款单号{{ cashierOrder.orderNo }}</div>
<div style="margin: 10px 0">
退款原因<br/>
<el-radio-group v-model="radio1" style="margin: 10px 0">
<el-radio-button label="油号选错"></el-radio-button>
<el-radio-button label="金额错误"></el-radio-button>
<el-radio-button label="其他原因"></el-radio-button>
</el-radio-group>
</div>
<div>
2024-01-15 16:10:11 +08:00
<el-input placeholder="请输入退款原因" v-model="refundRemark" show-password></el-input>
2023-11-11 18:04:49 +08:00
<br/>
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回优惠券储值卡等原路退回处理</span>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogRefund = false"> </el-button>
2024-01-15 13:41:32 +08:00
<el-button type="primary" @click="refundConfirmed()"> </el-button>
2023-11-11 18:04:49 +08:00
</span>
</el-dialog>
2023-10-27 16:31:27 +08:00
</div>
</template>
<script>
2024-01-06 15:06:58 +08:00
import {cashierOrder, listCashierOrder,orderStatisticsApi} from "@/api/cashier/cashierorder";
2024-01-13 13:22:10 +08:00
import {queryStaffs} from "@/api/cashier/staff";
2023-11-11 18:04:49 +08:00
import {oilOrderList, oilOrders} from "@/api/cashier/oilorder";
import {getOilNameList} from "@/api/cashier/oilnumgun";
import {getOrderGoods} from "@/api/cashier/goodsorder";
2024-01-13 13:22:10 +08:00
import {exportExcelCashierApi} from "@/api/order/exportExcel";
2024-01-15 13:41:32 +08:00
import {refundApi} from "@/api/cashier/refund";
2023-11-11 13:54:24 +08:00
2023-10-27 16:31:27 +08:00
export default {
name: "order_Cashier",
data(){
return{
2024-01-15 16:10:11 +08:00
// 退款备注
refundRemark:"",
2023-11-11 18:04:49 +08:00
radio1:"油号选错",
// 油号列表
oilNameList:[],
// 油品订单详情列表
oilInfo:[],
// 商品订单详情列表
goodsInfo:[],
// 收银员订单详情
cashierOrder:{},
dialogVisible:false,
dialogRefund:false,
2023-11-11 13:54:24 +08:00
// 员工列表
staffList:[],
// 日期范围
dateRange: [],
// 收银台订单列表
orderList:[],
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
},
2024-01-06 15:06:58 +08:00
orderStatistics:{
numberOfStrokes:'0',
theTotalAmountOfTheOrder:'0',
theTotalAmountPaid:'0',
oilDiscounts:'0',
theTotalAmountOfOil:'0',
theTotalAmountOfTheItem:'0',
},
2023-11-11 13:54:24 +08:00
total:0,
2023-10-27 16:31:27 +08:00
}
2023-11-11 13:54:24 +08:00
},
created() {
this.getList();
2024-01-06 15:06:58 +08:00
this.getOrderStatistics();
2023-11-11 13:54:24 +08:00
this.getStaffList();
},
methods:{
2024-01-13 13:22:10 +08:00
exportExcelCashier() {
exportExcelCashierApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
this.$download.saveAs(blob,'收银台订单统计.xLsx')
})
},
2024-01-06 15:06:58 +08:00
// 获取订单统计信息
getOrderStatistics() {
orderStatisticsApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
this.orderStatistics = res.data
})
},
2023-11-15 18:48:07 +08:00
// 获取员工姓名
getRealName(list,val){
let name = "";
list.forEach(item => {
if (item.id == val){
name = item.realName
}
})
return name;
},
// 获取员工手机号
getMobile(list,val){
let name = "";
list.forEach(item => {
if (item.id == val){
name = item.mobile
}
})
return name;
},
2023-11-11 18:04:49 +08:00
// 补打
patchwork(data){
const orderNo = data.orderNo
this.$modal.confirm('确定您要补打当前订单吗?当前订单号[' + orderNo + '],请确保云打印机正在运行中').then(function() {
// return delUser(row.id);
}).then(() => {
this.$modal.msgSuccess("打印指令已发送打印机,请查看打印结果");
}).catch(() => {});
},
// 退款
handleRefund(id){
this.dialogRefund = true;
cashierOrder(id).then( response => {
this.cashierOrder = response.data
2023-11-11 13:54:24 +08:00
})
},
2024-01-15 13:41:32 +08:00
refundConfirmed() {
this.dialogRefund = false;
// 退款确定
// cashierOrder
console.log("cashierOrder",this.cashierOrder)
let map={
orderNo: this.cashierOrder.orderNo,
storeId: this.cashierOrder.storeId,
type: "cashierOrder"
}
refundApi(map).then(res=>{
})
},
2023-11-11 18:04:49 +08:00
// 获取油号名称
getName(oilNameList,id){
let name = ""
let _this = this;
if(oilNameList!=null && oilNameList!=""){
oilNameList.forEach(item => {
if (item.id == id){
name = item.oilName;
_this.oilType = item.oilType;
}
})
}
return name;
},
// 获取订单详情
getOrdersInfo(id){
this.dialogVisible = true;
cashierOrder(id).then( response => {
this.cashierOrder = response.data
this.getOilList(this.cashierOrder.orderNo)
this.getGoodsLists(this.cashierOrder.goodsOrderId)
})
},
getOilList(orderNo){
oilOrderList({orderNo:orderNo}).then( response => {
this.oilInfo = response.data
})
},
getGoodsLists(id){
getOrderGoods({orderId:id}).then( response => {
this.goodsInfo = response.data;
})
2023-11-11 13:54:24 +08:00
},
// 获取列表信息
getList(val){
if (val!=undefined){
this.queryParams.page = val
}
listCashierOrder(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.orderList = response.data.records;
this.total = response.data.total;
})
},
// 获取员工列表信息
getStaffList(){
queryStaffs().then( response => {
this.staffList = response.data;
})
2023-11-11 18:04:49 +08:00
getOilNameList().then( response => {
this.oilNameList = response.data;
})
2023-11-11 13:54:24 +08:00
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.queryParams = {
page: 1,
pageSize: 10,
}
// this.resetForm("queryForm");
this.handleQuery();
},
2023-10-27 16:31:27 +08:00
}
}
</script>
<style scoped>
.app-top{
width: 100%;
height: 60px;
box-sizing: border-box;
padding: 10px;
}
.clearfix{
width: 100%;
}
.box-card{
width: 100%;
margin-bottom: 15px;
}
.box-gang{
width: 100%;
display: flex;
align-items: center;
}
.box{
width: 200px;
box-sizing: border-box;
padding: 10px;
background: #f9f9f9;
height: 86px;
margin-right: 10px;
}
.size-hui{
font-size: 14px;
margin-bottom: 10px;
margin-top: 10px;
}
.size-bole{
font-weight: bold;
}
.wgang{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.table-box{
width: 100%;
}
.pagination-box{
width: 100%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
.top-app-sou{
width: 20%;
}
2023-11-11 18:04:49 +08:00
.tk{
text-align: center;
color: grey;
margin: 10px 0;
}
2023-10-27 16:31:27 +08:00
</style>