Files
jsowell-charger-web/jsowell-ui/src/views/pile/station/stationOrderList.vue

427 lines
11 KiB
Vue
Raw Normal View History

2023-03-04 16:29:55 +08:00
<template>
<div class="app-container">
2023-08-30 15:02:00 +08:00
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="168px"
@submit.native.prevent
>
2023-03-04 16:29:55 +08:00
<el-form-item label="订单编号" prop="orderCode">
<el-input
v-model="queryParams.orderCode"
placeholder="请输入订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单状态" prop="orderStatus">
<el-select
v-model="queryParams.orderStatus"
placeholder="请选择订单状态"
clearable
style="width: 140px"
>
<el-option
v-for="dict in dict.type.order_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号码" prop="mobileNumber">
<el-input
v-model="queryParams.mobileNumber"
placeholder="请输入手机号码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="结算时间">
2023-03-04 16:29:55 +08:00
<el-date-picker
v-model="settleTimeRange"
2023-03-04 16:29:55 +08:00
style="width: 240px"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
2023-08-30 15:02:00 +08:00
:clearable="false"
2023-03-04 16:29:55 +08:00
></el-date-picker>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
2023-08-30 15:02:00 +08:00
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
2023-03-04 16:29:55 +08:00
</el-col>
<el-col :span="1.5">
2023-08-30 15:02:00 +08:00
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
2023-03-04 16:29:55 +08:00
</el-col>
2023-04-12 14:48:33 +08:00
<el-col :span="1.5">
2023-08-30 15:02:00 +08:00
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['order:order:export']"
>导出</el-button
>
2023-04-12 14:48:33 +08:00
</el-col>
2023-03-04 16:29:55 +08:00
<div>
2023-08-30 15:02:00 +08:00
{{ dateDescription }}期间总用电量{{
sumUsedElectricity
}}总消费金额{{ sumOrderAmount }}
2023-03-04 16:29:55 +08:00
</div>
</el-row>
2023-08-30 15:02:00 +08:00
<el-table
v-loading="loading"
:data="orderList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
2023-03-04 16:29:55 +08:00
<!--<el-table-column label="主键" align="center" prop="id"/>-->
2023-08-30 15:02:00 +08:00
<el-table-column
label="订单编号"
align="center"
prop="orderCode"
width="180px"
>
2023-03-04 16:29:55 +08:00
<template slot-scope="scope">
<router-link
2023-08-30 15:02:00 +08:00
:to="'/order/index/orderDetail/' + scope.row.orderCode"
2023-03-04 16:29:55 +08:00
class="link-type"
>
<span>{{ scope.row.orderCode }}</span>
</router-link>
</template>
</el-table-column>
<!--<el-table-column label="订单状态" align="center" prop="orderStatus">
<template slot-scope="scope">
<dict-tag
:options="dict.type.order_status"
:value="scope.row.orderStatus"
/>
</template>
</el-table-column>-->
2023-08-30 15:02:00 +08:00
<el-table-column
label="订单状态描述"
align="center"
prop="orderStatusDescribe"
/>
<el-table-column
label="会员昵称"
align="center"
prop="nickName"
width="120px"
/>
2023-03-04 16:29:55 +08:00
2023-08-30 15:02:00 +08:00
<el-table-column
label="电话号码"
align="center"
prop="mobileNumber"
width="120px"
/>
2023-03-04 16:29:55 +08:00
2023-08-30 15:02:00 +08:00
<el-table-column label="站点" align="center" prop="stationName" />
<el-table-column
label="充电桩枪口号"
align="center"
prop="pileConnectorCode"
width="200px"
/>
<el-table-column
label="微信商户订单号"
align="center"
prop="outTradeNo"
width="165px"
/>
<el-table-column
label="启动方式"
align="center"
prop="startMode"
width="100px"
>
2023-03-04 16:29:55 +08:00
<template slot-scope="scope">
<dict-tag
:options="dict.type.start_mode"
:value="scope.row.startMode"
/>
</template>
</el-table-column>
<el-table-column label="支付方式" align="center" prop="payMode">
<template slot-scope="scope">
2023-08-30 15:02:00 +08:00
<dict-tag :options="dict.type.pay_mode" :value="scope.row.payMode" />
2023-03-04 16:29:55 +08:00
</template>
</el-table-column>
<el-table-column label="支付状态" align="center" prop="payStatus">
<template slot-scope="scope">
<dict-tag
:options="dict.type.pay_status"
:value="scope.row.payStatus"
/>
</template>
</el-table-column>
2023-08-30 15:02:00 +08:00
<el-table-column label="支付金额" align="center" prop="payAmount" />
<el-table-column
label="充电度数"
align="center"
prop="chargingDegree"
width="100px"
/>
2023-03-16 16:47:54 +08:00
<el-table-column label="起始soc" align="center" prop="startSoc" />
<el-table-column label="终止soc" align="center" prop="endSoc" />
2023-03-04 16:29:55 +08:00
<!--<el-table-column label="订单生成日期" align="center" prop="createTime" width="180"/>-->
2023-08-30 15:02:00 +08:00
<el-table-column
label="开始充电时间"
align="center"
prop="chargeStartTime"
width="180"
/>
<el-table-column
label="结束充电时间"
align="center"
prop="chargeEndTime"
width="180"
/>
<el-table-column
label="订单总金额"
align="center"
prop="orderAmount"
width="100px"
/>
2023-03-04 16:29:55 +08:00
</el-table>
<pagination
2023-08-30 15:02:00 +08:00
v-show="total > 0"
2023-03-04 16:29:55 +08:00
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
2023-08-30 15:02:00 +08:00
import { listOrder, totalData } from "@/api/order/order";
2023-03-04 16:29:55 +08:00
import Template from "@/views/billing/template";
2023-08-30 15:02:00 +08:00
import { listStation } from "@/api/pile/station";
import { getDay } from "@/utils/common";
2023-03-04 16:29:55 +08:00
export default {
name: "stationOrderList",
2023-08-30 15:02:00 +08:00
components: { Template },
2023-03-04 16:29:55 +08:00
props: {
stationId: "",
},
2023-08-30 15:02:00 +08:00
dicts: ["order_status", "start_mode", "pay_mode", "pay_status"],
2023-03-04 16:29:55 +08:00
data() {
return {
dateDescription: "",
2023-08-30 15:02:00 +08:00
sumOrderAmount: "",
sumUsedElectricity: "",
2023-03-04 16:29:55 +08:00
// 遮罩
loading: true,
// 选中数组
ids: [],
// 子表选中数据
checkedOrderDetail: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 订单表格数据
orderList: [],
// 订单详情表格数据
orderDetailList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
2023-08-30 15:02:00 +08:00
startTime: null,
endTime: null,
2023-03-04 16:29:55 +08:00
pageNum: 1,
pageSize: 10,
orderCode: null,
mobileNumber: null,
orderStatus: null,
stationId: this.stationId,
startSettleTime: null,
endSettleTime: null,
2023-03-04 16:29:55 +08:00
},
// 表单参数
form: {},
// 表单校验
rules: {},
// 站点列表
stationList: [],
// 订单结算时间范围
settleTimeRange: [],
2023-03-04 16:29:55 +08:00
};
},
created() {
// console.log('stationOrderList 站点id', this.stationId);
// this.dataLoading();
},
methods: {
async dataLoading() {
2023-08-30 15:02:00 +08:00
console.log("加载站点订单数据...");
2023-03-04 16:29:55 +08:00
// 设置默认日期
await this.defaultDate();
// 查询订单列表
this.getList();
// 获取订单总金额
2023-08-11 16:18:19 +08:00
this.getOrderTotalData();
2023-03-04 16:29:55 +08:00
},
/** 查询订单列表 */
getList() {
this.loading = true;
2023-08-30 15:02:00 +08:00
console.log("查询订单列表 this.queryParams", this.queryParams);
listOrder(this.queryParams).then((response) => {
2023-03-04 16:29:55 +08:00
this.orderList = response.rows;
2023-08-30 15:02:00 +08:00
console.log("this.queryParams", this.queryParams);
console.log("response", response);
2023-03-04 16:29:55 +08:00
this.total = response.total;
this.loading = false;
});
},
// 获取订单总金额数据
getOrderTotalData() {
2023-08-30 15:02:00 +08:00
totalData(this.queryParams).then((response) => {
console.log("getOrderTotalData", response);
2023-03-04 16:29:55 +08:00
this.dateDescription = response.data.dateDescription;
this.sumOrderAmount = response.data.sumOrderAmount;
this.sumUsedElectricity = response.data.sumUsedElectricity;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
orderCode: null,
orderStatus: "0",
memberId: null,
nickName: null,
mobileNumber: null,
stationId: null,
connectorCode: null,
startMode: null,
payMode: null,
payStatus: null,
payAmount: null,
payTime: null,
orderAmount: null,
startSoc: null,
endSoc: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
2023-08-30 15:02:00 +08:00
delFlag: null,
2023-03-04 16:29:55 +08:00
};
this.orderDetailList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
// 获取订单列表
this.getList();
// 获取订单总金额
this.getOrderTotalData();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
2023-08-30 15:02:00 +08:00
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
2023-03-04 16:29:55 +08:00
},
/** 订单详情序号 */
2023-08-30 15:02:00 +08:00
rowOrderDetailIndex({ row, rowIndex }) {
2023-03-04 16:29:55 +08:00
row.index = rowIndex + 1;
},
/** 复选框选中数据 */
handleOrderDetailSelectionChange(selection) {
2023-08-30 15:02:00 +08:00
this.checkedOrderDetail = selection.map((item) => item.index);
2023-03-04 16:29:55 +08:00
},
/** 导出按钮操作 */
handleExport() {
2023-08-30 15:02:00 +08:00
this.download(
"order/order/export",
{
...this.queryParams,
},
`order_${new Date().getTime()}.xlsx`
);
2023-03-04 16:29:55 +08:00
},
/** 查询充电站信息列表 */
getStationList() {
const queryStationParams = {
pageNum: 1,
2023-08-30 15:02:00 +08:00
pageSize: 999,
2023-03-04 16:29:55 +08:00
};
listStation(queryStationParams).then((response) => {
2023-08-30 15:02:00 +08:00
console.log("订单列表页-查询站点列表", response);
2023-03-04 16:29:55 +08:00
this.stationList = response.rows;
});
},
//设置默认日期
2023-08-30 15:02:00 +08:00
defaultDate() {
2023-03-04 16:29:55 +08:00
console.log(getDay(-7));
//字符串拼接,开始时间,结束时间
2023-08-30 15:02:00 +08:00
let beg = getDay(-7) + " 00:00:00"; //当月第一天
2023-03-04 16:29:55 +08:00
let end = getDay(0) + " 23:59:59"; //当天
2023-08-30 15:02:00 +08:00
this.settleTimeRange = [beg, end]; //将值设置给插件绑定的数据
// console.log("defaultDate", this.settleTimeRange);
2023-03-04 16:29:55 +08:00
},
},
watch: {
settleTimeRange(newValue, oldValue) {
2023-03-04 16:29:55 +08:00
if (newValue != null && newValue.length > 0) {
2023-08-30 15:02:00 +08:00
this.queryParams.startTime = newValue[0];
this.queryParams.endTime = newValue[1];
2023-03-04 16:29:55 +08:00
}
},
2023-08-30 15:02:00 +08:00
},
2023-03-04 16:29:55 +08:00
};
</script>