<!-- 收银台订单--> <template> <div> <el-card class="box-card"> <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="订单号"> <el-input v-model="queryParams.orderNo" clearable placeholder="订单号检索"></el-input> </el-form-item> <el-form-item label="交易时间"> <!-- <el-date-picker--> <!-- v-model="dateRange"--> <!-- style="width: 400px"--> <!-- size="medium"--> <!-- value-format="yyyy-MM-dd"--> <!-- type="datetimerange"--> <!-- range-separator="至"--> <!-- start-placeholder="开始日期"--> <!-- end-placeholder="结束日期"--> <!-- ></el-date-picker>--> <el-date-picker v-model="beginTime" style="width: 140px" type="date" placeholder="开始日期"> </el-date-picker> 至 <el-date-picker v-model="endTime" style="width: 140px" type="date" 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> </el-card> <el-card class="box-card"> <div slot="header" class="clearfix"> <span>收银台订单统计</span> </div> <div class="box-gang"> <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> </div> <div class="box"> <div class="size-hui">找零总金额</div> <div class="size-bole">{{ seekZeroAmount }}</div> </div> </div> </el-card> <el-card class="box-card"> <div class="wgang"> <div>收银台订单列表</div> <div style="display: flex "> <el-button type="primary" size="mini" icon="el-icon-plus" @click = "exportExcelCashier()">导出订单</el-button> </div> </div> <div class="table-box"> <el-table :data="orderList" style="width: 100%"> <!-- <el-table-column type="expand">--> <!-- <template slot-scope="props">--> <!-- <el-form label-position="left" class="demo-table-expand" style="margin-left: 20px">--> <!-- <el-form-item label="收银员">--> <!-- <span>{{ getRealName(staffList,props.row.staffId) }}</span>--> <!-- </el-form-item>--> <!-- <el-form-item label="收银员手机号">--> <!-- <span>{{ getMobile(staffList,props.row.staffId) }}</span>--> <!-- </el-form-item>--> <!-- </el-form>--> <!-- </template>--> <!-- </el-table-column>--> <el-table-column type="index" width="50" align="center" label="序号"/> <el-table-column prop="orderNo" align="center" label="订单号" width="220"> </el-table-column> <el-table-column prop="amount" align="center" label="订单金额"> </el-table-column> <el-table-column prop="payAmount" align="center" label="实付金额"> </el-table-column> <el-table-column prop="seekZero" align="center" label="找零金额"> </el-table-column> <el-table-column label="订单金额组成" align="center"> <el-table-column prop="oilOrderAmount" align="center" label="油品金额"> <template slot-scope="scope"> <span>{{scope.row.oilOrderAmount ? scope.row.oilOrderAmount : '0'}}</span> </template> </el-table-column> <el-table-column prop="goodsOrderAmount" align="center" label="商品金额"> <template slot-scope="scope"> <span>{{scope.row.goodsOrderAmount ? scope.row.goodsOrderAmount : '0'}}</span> </template> </el-table-column> </el-table-column> <el-table-column align="center" label="实付订单金额组成"> <el-table-column prop="oilOrderAmount" align="center" label="油品实付金额" width="100"> <template slot-scope="scope"> <span>{{scope.row.oilPayAmount ? scope.row.oilPayAmount : '0'}}</span> </template> </el-table-column> <el-table-column prop="goodsOrderAmount" align="center" label="商品实付金额" width="110"> <template slot-scope="scope"> <span>{{scope.row.goodsPayAmount ? scope.row.goodsPayAmount : '0'}}</span> </template> </el-table-column> </el-table-column> <el-table-column prop="payUser" align="center" label="付款用户" width="110"> </el-table-column> <el-table-column prop="status" align="center" label="状态"> <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-if="scope.row.status === 'refund'">已退款</el-tag> <el-tag type="danger" v-else>支付失败</el-tag> </template> </el-table-column> <el-table-column label="交易时间" align="center" width="160" prop="payTime"> <template slot-scope="scope"> <span>{{ scope.row.payTime ? parseTime(scope.row.payTime):"--" }}</span> </template> </el-table-column> <el-table-column label="操作人" align="center" prop="staffId"> <template slot-scope="scope"> <span>{{ getRealName(staffList,scope.row.staffId) || "--" }}</span> </template> </el-table-column> <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width"> <template slot-scope="scope"> <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"--> <!-- v-if = "scope.row.status === 'paid'"--> <!-- @click="handleRefund(scope.row.id)"--> <!-- type="danger" plain round>退款</el-button>--> </template> </el-table-column> </el-table> </div> <div class="pagination-box"> <el-pagination background v-show="total>0" layout="prev, pager, next" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.pageSize" @current-change="getList"> </el-pagination> </div> </el-card> <!-- 订单详情--> <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="油品优惠券优惠"> <span v-if="oilInfo.length>0">{{ oilInfo[0].couponAmount || 0 }}</span> </el-descriptions-item> <el-descriptions-item label="油品满减/折扣活动优惠"> <span v-if="oilInfo.length>0">{{ oilInfo[0].deductionAmount || 0 }}</span> </el-descriptions-item> <el-descriptions-item label="油品会员等级优惠"> <span v-if="oilInfo.length>0">{{ cashierOrder.oilDiscountAmount - oilInfo[0].deductionAmount - oilInfo[0].couponAmount || 0 }}</span> </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.oilPayAmount }}</el-descriptions-item> <el-descriptions-item label="商品实付总额">{{ cashierOrder.goodsPayAmount }}</el-descriptions-item> <el-descriptions-item label="实付金额">{{ cashierOrder.payAmount }}</el-descriptions-item> <el-descriptions-item label="储值卡消费金额"> <span v-if="oilInfo.length>0">{{ oilInfo[0].balanceAmount }}</span> <span v-else>0</span> </el-descriptions-item> <!-- <el-descriptions-item label="囤油卡消费升数">--> <!-- <span v-if="oilInfo.length>0">{{ oilInfo[0].oilCardAmount }}</span>--> <!-- <span v-else>0</span>--> <!-- </el-descriptions-item>--> <el-descriptions-item label="找零金额">{{ cashierOrder.seekZero }}</el-descriptions-item> <el-descriptions-item label="付款方式"> <span v-if="cashierOrder.payType == 'CASH'">现金</span> <span v-else-if="cashierOrder.payType == 'WECHAT'">微信</span> <span v-else-if="cashierOrder.payType == 'ALIPAY'">支付宝</span> <span v-else-if="cashierOrder.payType == 'UNIONPAY'">银联二维码</span> <span v-else-if="cashierOrder.payType == 'oilCard'">囤油卡</span> <span v-else-if="cashierOrder.payType == 'balance'">储值卡</span> <span v-else-if="cashierOrder.payType == 'credit'">挂账</span> <span v-else>小程序码</span> </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="warning" v-else-if="cashierOrder.status == 'payFail'">支付失败</el-tag> <el-tag type="danger" v-else-if="cashierOrder.status == 'refund'">已退款</el-tag> <el-tag type="info" v-else>退款中</el-tag> </el-descriptions-item> <el-descriptions-item label="交易时间"> {{ cashierOrder.payTime ? parseTime(cashierOrder.payTime):"--" }} </el-descriptions-item> </el-descriptions> </div> <div style="margin-top: 30px"> <el-descriptions :column="1" direction="vertical"> <!-- <el-descriptions-item label="油品详情">--> <!-- <el-table--> <!-- v-loading="loading"--> <!-- :data="oilInfo"--> <!-- style="width: 100%">--> <!-- <el-table-column label="油号油枪" prop="terminal">--> <!-- <template slot-scope="scope">--> <!-- <span>{{ getName(oilNameList,scope.row.oils) }}/{{ scope.row.oilGunNum }}</span>--> <!-- </template>--> <!-- </el-table-column>--> <!-- <el-table-column label="油品金额" align="center" prop="orderAmount">--> <!-- <template slot-scope="scope">--> <!-- <span>{{ scope.row.orderAmount }}</span>--> <!-- </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-column label="满减活动优惠" align="center" prop="activeId">--> <!-- <template slot-scope="scope">--> <!-- <span v-if="scope.row.activeType==1">{{ scope.row.deductionAmount }}</span>--> <!-- <span v-else>0</span>--> <!-- </template>--> <!-- </el-table-column>--> <!-- <el-table-column label="折扣活动优惠" align="center" prop="activeId">--> <!-- <template slot-scope="scope">--> <!-- <span v-if="scope.row.activeType==2">{{ scope.row.deductionAmount }}</span>--> <!-- <span v-else>0</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>{{ scope.row.retailPrice }}</span> </template> </el-table-column> <el-table-column v-if="cashierOrder.payUser != '散客'" label="会员价" align="center" prop="retailPrice"> <template slot-scope="scope"> <span>{{ 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>{{ (scope.row.retailPrice * scope.row.num).toFixed(2) }}</span> </template> </el-table-column> <el-table-column label="实付金额" align="center" prop="num"> <template slot-scope="scope"> <span v-if="cashierOrder.payUser == '散客'">{{ (scope.row.retailPrice * scope.row.num).toFixed(2) }}</span> <span v-else>{{ (scope.row.memberPrice * scope.row.num).toFixed(2) }}</span> </template> </el-table-column> </el-table> </el-descriptions-item> </el-descriptions> </div> </el-dialog> <!-- 订单退款--> <el-dialog :close-on-click-modal="false" title="订单退款" width="25%" :visible.sync="dialogRefund"> <div style="text-align: center;font-weight: bold"> ¥<span style="font-size: 35px">{{ cashierOrder.payAmount }}</span> </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> <el-input placeholder="请输入退款原因" v-model="refundRemark" ></el-input> <br/> <span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span> </div> <span slot="footer" class="dialog-footer"> <el-button @click="dialogRefund = false">取 消</el-button> <el-button type="primary" @click="refundConfirmed()">确 定</el-button> </span> </el-dialog> </div> </template> <script> import {cashierOrder, cashierOrderSeekZeroAmount, listCashierOrder, orderStatisticsApi} from "@/api/order/cashierorder"; import {queryStaffs} from "@/api/order/staff"; import {oilOrderList, oilOrders} from "@/api/order/oilorder"; import {getOilNameList} from "@/api/order/oilnumgun"; import {getOrderGoods} from "@/api/order/goodsorder"; import {exportExcelCashierApi} from "@/api/order/exportExcel"; import {refundApi} from "@/api/order/refund"; export default { name: "order_Cashier", data(){ return{ // 退款备注 refundRemark:"", radio1:"油号选错", // 油号列表 oilNameList:[], // 油品订单详情列表 oilInfo:[], // 商品订单详情列表 goodsInfo:[], // 收银员订单详情 cashierOrder:{}, loading:false, dialogVisible:false, dialogRefund:false, // 是否为当天时间 isSysDate:false, // 员工列表 staffList:[], // 日期范围 dateRange: [], beginTime:"", endTime:"", // 收银台订单列表 orderList:[], // 查询参数 queryParams: { page: 1, pageSize: 10, }, orderStatistics:{ numberOfStrokes:'0', theTotalAmountOfTheOrder:'0', theTotalAmountPaid:'0', oilDiscounts:'0', theTotalAmountOfOil:'0', theTotalAmountOfTheItem:'0', }, total:0, seekZeroAmount:0, } }, created() { let start = new Date(); start.setHours(0) start.setMinutes(0) start.setSeconds(0) start.setMilliseconds(0) this.dateRange = [start,new Date()]; this.beginTime = start this.endTime = new Date() this.isSysDate = true this.getList(); this.getOrderStatistics(); this.getStaffList(); }, methods:{ exportExcelCashier() { let dateRange = [] if (this.beginTime && this.endTime) { dateRange.push(this.beginTime.toLocaleDateString()) dateRange.push(this.endTime.toLocaleDateString()) } exportExcelCashierApi(this.addDateRange(this.queryParams, dateRange)).then(res=>{ const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); this.$download.saveAs(blob,'收银台订单统计.xLsx') }) }, // 获取订单统计信息 getOrderStatistics() { let dateRange = [] if (this.beginTime && this.endTime) { dateRange.push(this.beginTime.toLocaleDateString()) dateRange.push(this.endTime.toLocaleDateString()) } orderStatisticsApi(this.addDateRange(this.queryParams, dateRange)).then(res=>{ this.orderStatistics = res.data }) }, // 获取员工姓名 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; }, // 补打 patchwork(data){ const orderNo = data.orderNo this.$modal.confirm('确定您要补打当前订单吗?当前订单号[' + orderNo + '],请确保云打印机正在运行中').then(function() { // return delUser(row.id); }).then(() => { this.$modal.msgSuccess("打印指令已发送打印机,请查看打印结果"); }).catch(() => {}); }, // 退款 handleRefund(id){ //退款确定 this.$confirm('是否将该收银台下的订单全部退款, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.dialogRefund = true; cashierOrder(id).then( response => { this.cashierOrder = response.data if (response.data.status === "refund") { this.$message({ type: 'info', message: '该订单已经退款' }); this.dialogRefund = false; } }) }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }); }); }, async refundConfirmed() { this.dialogRefund = false; this.loading = true; console.log("cashierOrder",this.cashierOrder) let map={ orderNo: this.cashierOrder.orderNo, storeId: this.cashierOrder.storeId, refundRemark:this.radio1 +"-"+ this.refundRemark, type: "canRefund" } await refundApi(map).then(res=>{ this.$message({ type: 'info', message: '退款成功' }); }) this.loading = false; this.getList(); this.getOrderStatistics(); this.getStaffList(); }, // 获取油号名称 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){ cashierOrder(id).then( response => { this.cashierOrder = response.data this.getOilList(this.cashierOrder.orderNo) this.getGoodsLists(this.cashierOrder.goodsOrderId) this.dialogVisible = true; }) }, getOilList(orderNo){ oilOrderList({orderNo:orderNo}).then( response => { this.oilInfo = response.data }) }, getGoodsLists(id){ getOrderGoods({orderId:id}).then( response => { this.goodsInfo = response.data; }) }, // 获取列表信息 getList(val){ if (val!=undefined){ this.queryParams.page = val } let dateRange1 = this.dateRange // let dateRange = [] // if (this.isSysDate){ // dateRange.push(dateRange1[0].toLocaleDateString()) // dateRange.push(dateRange1[1].toLocaleDateString()) // }else { // dateRange = this.dateRange // } let dateRange = [] if (this.beginTime && this.endTime) { dateRange.push(this.beginTime.toLocaleDateString()) dateRange.push(this.endTime.toLocaleDateString()) } listCashierOrder(this.addDateRange(this.queryParams, dateRange)).then( response => { this.orderList = response.data.records; this.total = response.data.total; this.isSysDate = false }) this.getSeekZero(val) }, getSeekZero(val){ if (val!=undefined){ this.queryParams.page = val } let dateRange = [] if (this.beginTime && this.endTime) { dateRange.push(this.beginTime.toLocaleDateString()) dateRange.push(this.endTime.toLocaleDateString()) } cashierOrderSeekZeroAmount(this.addDateRange(this.queryParams, dateRange)).then( response => { if (response.data) { this.seekZeroAmount = response.data } }) }, // 获取员工列表信息 getStaffList(){ queryStaffs().then( response => { this.staffList = response.data; }) getOilNameList().then( response => { this.oilNameList = response.data; }) }, // 搜索按钮操作 handleQuery() { this.queryParams.page = 1; this.getList(); this.getOrderStatistics(); }, // 重置按钮操作 resetQuery() { this.dateRange = []; this.queryParams = { page: 1, pageSize: 10, } this.beginTime = "" this.endTime = "" // this.resetForm("queryForm"); this.handleQuery(); }, } } </script> <style scoped> .app-container{ width: 100%; height: 100%; background: #f6f8f9; } .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%; } .tk{ text-align: center; color: grey; margin: 10px 0; } </style>