oil-station/fuintCashierWeb/src/views/cashier/orderComponents/order_Goods.vue
2023-11-16 19:00:57 +08:00

446 lines
14 KiB
Vue

<!--商品交易列表-->
<template>
<div>
<el-card class="box-card">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" 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="支付类型" prop="payType">
<el-select
v-model="queryParams.payType"
placeholder="全部"
clearable
style="width: 240px"
>
<el-option
v-for="item in payList"
:key="item.id"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="订单号" prop="orderNo">
<el-input
v-model="queryParams.orderNo"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="payUser">
<el-input
v-model="queryParams.payUser"
placeholder="请输入会员手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</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>
<!-- <div style="display: flex;">-->
<!-- <div class="top-app-sou">-->
<!-- <el-form :label-position="labelPosition" label-width="40px" :model="formLabelAlign">-->
<!-- <el-form-item label="名称">-->
<!-- <el-input v-model="formLabelAlign.name" placeholder="请输入要搜索的内容"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- </div>-->
<!-- <div style="margin-left: 10px">-->
<!-- <el-button type="primary" icon="el-icon-search">搜索</el-button>-->
<!-- </div>-->
<!-- </div>-->
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>商品交易统计</span>
</div>
<div class="box-gang">
<div class="box" v-for="(item,index) in 7" :key="index">
<div class="size-hui">订单总数</div>
<div class="size-bole">55</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">新增会员</el-button>-->
<!-- </div>-->
</div>
<div class="table-box">
<el-table
:data="list"
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>{{ queryStaf(staffList,props.row.staffId) }}</span>
</el-form-item>
<el-form-item label="来源终端">
<span>{{ getVal(terminalList,props.row.terminal) }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column label="订单ID" prop="id" width="80"/>
<el-table-column label="终端" align="center" prop="terminal"/>
<el-table-column label="订单号" align="center" prop="orderNo" width="200"/>
<el-table-column label="订单金额" align="center" prop="amount"/>
<el-table-column label="优惠金额" align="center" prop="discount"/>
<el-table-column label="商品数量" align="center" prop="goodsNum">
<template slot-scope="scope">
<el-tag @click="getGoods(scope.row.id)">{{ scope.row.goodsNum }}</el-tag>
</template>
</el-table-column>
<el-table-column label="实付金额" align="center" prop="payAmount"/>
<el-table-column label="付款用户" align="center" prop="payUser"/>
<el-table-column label="付款类型" align="center" prop="payType">
<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>
</el-table-column>
<!-- <el-table-column label="订单类型" align="center" prop="type"/>-->
<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="150" prop="payTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.payTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- >更多操作</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</div>
<div class="pagination-box">
<el-pagination
background
layout="prev, pager, next"
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@current-change="getList">
</el-pagination>
</div>
<!-- 商品购买详情 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-table ref="tables" v-loading="loading" :data="goodsList" :default-sort="defaultSort">
<el-table-column label="商品名称" align="center" prop="name"/>
<el-table-column label="商品数量" align="center" prop="num"/>
<el-table-column label="商品单价" align="center" prop="retailPrice"/>
<el-table-column label="会员价" align="center" prop="memberPrice"/>
</el-table>
<div style="height: 20px"></div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import {getOrderGoods, listOrder} from "@/api/cashier/goodsorder";
import {queryStaffs} from "@/api/cashier/staff";
import {getDicts} from "@/api/dict/data";
export default {
name: "order_Cashier",
data(){
return{
// 终端列表
terminalList:[],
// 员工列表
staffList:[],
// 日期范围
dateRange: [],
// 遮罩层
loading: true,
// 标题
title: "",
// 选中数组
ids: [],
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
list: [],
goodsList:[],
// 是否显示弹出层
open: false,
// 默认排序
defaultSort: {prop: 'createTime', order: 'descending'},
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
},
// 支付列表
payList:[],
// tableData: [{
// date: '2016-05-03',
// name: '王小狼',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-02',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-04',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-01',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-08',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-06',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-07',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }]
}
},
created() {
this.getList();
this.getStaffList();
this.getPayList();
},
methods:{
// 根据员工id查询员工信息
queryStaf(list,id){
let name = "";
list.forEach(item => {
if (item.id == id){
name = `${item.realName}(${item.mobile})`
}
})
return name;
},
getVal(list,val){
let name = "";
list.forEach(item => {
if (item.dictValue == val){
name = item.dictLabel
}
})
return name;
},
// 获取付款类型列表
getPayList(){
getDicts("payment_type").then( response => {
this.payList = response.data;
})
getDicts("terminal").then( response => {
this.terminalList = response.data;
})
},
// 获取商品详情
getGoods(id){
this.open = true;
this.title = "商品详情"
getOrderGoods(id).then( response => {
this.goodsList = response.data
})
},
// 获取员工姓名
getRealName(list,id){
var name = "";
list.forEach(item => {
if (item.id == id){
name = item.realName;
}
})
return name;
},
// 获取员工列表
getStaffList(){
queryStaffs().then( response => {
this.staffList = response.data;
})
},
// 查询订单
getList(val){
if (val!=undefined){
this.queryParams.page = val
}
this.loading = true;
listOrder(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.list = response.data.records;
this.total = response.data.total;
this.loading = false;
})
// const app = this;
// app.loading = true;
// app.queryParams.storeIds = app.storeIds ? app.storeIds.join(",") : '';
// getOrderList(app.queryParams).then( response => {
// this.list = response.data.paginationResponse.content;
// this.total = response.data.paginationResponse.totalElements;
// this.typeList = response.data.typeList;
// this.statusList = response.data.statusList;
// this.payStatusList = response.data.payStatusList;
// this.orderModeList = response.data.orderModeList;
// this.payTypeList = response.data.payTypeList;
// this.storeList = response.data.storeList;
// this.loading = false;
// }
// );
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.queryParams.status = '';
this.queryParams.mobile = '';
this.queryParams.orderMode = '';
this.queryParams.orderSn = '';
this.queryParams.storeIds = '';
this.storeIds = [];
this.resetForm("queryForm");
this.handleQuery();
},
}
}
</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%;
}
</style>