fix
This commit is contained in:
@@ -258,11 +258,12 @@
|
||||
</a-card>
|
||||
<a-card title="换电记录" class="order-card">
|
||||
<a-spin :spinning="loading">
|
||||
<ele-pro-table
|
||||
:datasource="datasource3"
|
||||
<a-table
|
||||
:datasource="EquipmentRecordList"
|
||||
:columns="columns3"
|
||||
ref="tableRef3"
|
||||
|
||||
>
|
||||
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'batteryModel'">
|
||||
<div>电池租金:¥{{ record.batteryRent }}</div>
|
||||
@@ -278,7 +279,7 @@
|
||||
</template>
|
||||
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
<a-card title="缴费记录" class="order-card">
|
||||
@@ -446,8 +447,9 @@ const isUpdate = ref(false);
|
||||
const maxAble = ref(true);
|
||||
const EquipmentOrderGoodsList = ref<EquipmentOrderGoods[]>([]);
|
||||
const renewOrderList = ref<Order[]>([]);
|
||||
const equipmentRecordList = ref<EquipmentRecord[]>([]);
|
||||
const EquipmentRecordList = ref<EquipmentRecord[]>([]);
|
||||
const bindEquipmentCode = ref<string>();
|
||||
|
||||
const files = ref<any[]>();
|
||||
|
||||
// 步骤条
|
||||
@@ -732,31 +734,31 @@ const getRenewOrder = () => {
|
||||
|
||||
};
|
||||
|
||||
// const getEquipmentRecordList = () => {
|
||||
// EquipmentRecordApi.pageEquipmentRecord({
|
||||
// orderId: order.orderId,
|
||||
// userId: order.userId
|
||||
// }).then((data) => {
|
||||
|
||||
// });
|
||||
// };
|
||||
const getEquipmentRecordList = () => {
|
||||
EquipmentRecordApi.pageEquipmentRecord({
|
||||
orderId: order.orderId,
|
||||
userId: order.userId
|
||||
}).then((data) => {
|
||||
EquipmentRecordList.value = data.list;
|
||||
});
|
||||
};
|
||||
|
||||
// 表格数据源
|
||||
const datasource3: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders
|
||||
}) => {
|
||||
where.orderId = order.orderId
|
||||
where.userId = order.userId
|
||||
return EquipmentRecordApi.pageEquipmentRecord({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
// const datasource3: DatasourceFunction = ({
|
||||
// page,
|
||||
// limit,
|
||||
// where,
|
||||
// orders
|
||||
// }) => {
|
||||
// where.orderId = order.orderId
|
||||
// where.userId = order.userId
|
||||
// return EquipmentRecordApi.pageEquipmentRecord({
|
||||
// ...where,
|
||||
// ...orders,
|
||||
// page,
|
||||
// limit
|
||||
// });
|
||||
// };
|
||||
|
||||
const expirationDay = (order) => {
|
||||
const setTime = new Date(order.expirationTime);
|
||||
@@ -815,7 +817,7 @@ watch(
|
||||
getEquipmentOrderGoods();
|
||||
getRenewOrder();
|
||||
getEquipment();
|
||||
// getEquipmentRecordList();
|
||||
getEquipmentRecordList();
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
|
||||
@@ -22,11 +22,19 @@
|
||||
@advanced="openAdvanced"
|
||||
/>
|
||||
</template>
|
||||
<a-button class="ele-btn-icon" @click="handleExport">
|
||||
<template #icon>
|
||||
<DownloadOutlined />
|
||||
</template>
|
||||
<span>导出订单</span>
|
||||
</a-button>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'restDay'">
|
||||
<strong v-if="record.restDay < 0" :style="{ color: 'red' }">{{ record.restDay }}</strong>
|
||||
<span v-else-if="record.restDay >= 0">{{ record.restDay }}</span>
|
||||
<span> 天</span>
|
||||
<strong v-if="record.restDay < 0" :style="{ color: 'red' }">{{
|
||||
record.restDay
|
||||
}}</strong>
|
||||
<span v-else-if="record.restDay >= 0">{{ record.restDay }}</span>
|
||||
<span> 天</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'merchantName'">
|
||||
<div style="display: flex; flex-direction: column">
|
||||
@@ -90,14 +98,21 @@
|
||||
<!-- 发货状态:-->
|
||||
<a-tag v-if="record.deliveryStatus === 10">未发货</a-tag>
|
||||
<a-tag v-else-if="record.deliveryStatus === 20" color="success"
|
||||
>已发货</a-tag>
|
||||
>已发货</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
<!-- 收货状态:-->
|
||||
<a-tag v-if="record.receiptStatus === 10">未收货</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 20" color="success">已收货</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 21" color="purple">退租中</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 30" color="error">已退租</a-tag>
|
||||
<a-tag v-else-if="record.receiptStatus === 20" color="success"
|
||||
>已收货</a-tag
|
||||
>
|
||||
<a-tag v-else-if="record.receiptStatus === 21" color="purple"
|
||||
>退租中</a-tag
|
||||
>
|
||||
<a-tag v-else-if="record.receiptStatus === 30" color="error"
|
||||
>已退租</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder" v-if="record.orderSource != 10">
|
||||
<!-- 分期状态:-->
|
||||
@@ -169,23 +184,38 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button class="ele-text-primary" @click="openInfo(record)">详情</a-button>
|
||||
<a-button class="ele-text-primary" @click="openInfo(record)"
|
||||
>详情</a-button
|
||||
>
|
||||
</a-space>
|
||||
<view v-if="record.deliveryStatus == 40">
|
||||
<a-divider type="vertical" />
|
||||
<a-button class="ele-text-danger" @click="openChange(record)">换电</a-button>
|
||||
<a-button class="ele-text-danger" @click="openChange(record)"
|
||||
>换电</a-button
|
||||
>
|
||||
<view v-if="record.receiptStatus === 20">
|
||||
<a-button class="ele-text-danger" @click="openOrderRefund(record)">退租</a-button>
|
||||
<a-button
|
||||
class="ele-text-danger"
|
||||
@click="openOrderRefund(record)"
|
||||
>退租</a-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<battery-change v-model:visible="showChange" :data="current" @done="reload"/>
|
||||
<order-refund v-model:visible="showOrderRefund" :data="current" @done="reload"/>
|
||||
<battery-change
|
||||
v-model:visible="showChange"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
<order-refund
|
||||
v-model:visible="showOrderRefund"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<Delivery v-model:visible="deliveryEdit" :data="current" @done="reload" />
|
||||
@@ -219,7 +249,8 @@
|
||||
// PlusOutlined,
|
||||
// DeleteOutlined,
|
||||
FormOutlined,
|
||||
ExclamationCircleOutlined
|
||||
ExclamationCircleOutlined,
|
||||
DownloadOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
@@ -238,7 +269,8 @@
|
||||
import { alipayQuery } from '@/api/system/payment';
|
||||
import type { Order, OrderParam } from '@/api/order/model';
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
import { Equipment } from "@/api/apps/equipment/model";
|
||||
import { Equipment } from '@/api/apps/equipment/model';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
|
||||
// 当前用户信息
|
||||
// const userStore = useUserStore();
|
||||
@@ -476,6 +508,63 @@
|
||||
limit
|
||||
});
|
||||
};
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
if (!selection.value?.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'订单号',
|
||||
'电池型号',
|
||||
'电池编号',
|
||||
'所属商户',
|
||||
'到期时间',
|
||||
'剩余天数',
|
||||
'买家',
|
||||
'订单金额',
|
||||
'交易状态'
|
||||
]
|
||||
];
|
||||
|
||||
selection.value?.forEach((d: Order) => {
|
||||
var username = d.phone ? d.phone : d.nickname;
|
||||
|
||||
var equipmentCode = d.equipment ? d.equipment.equipmentCode : '';
|
||||
|
||||
array.push([
|
||||
`${d.orderNo}`,
|
||||
`${d.equipmentGoods.batteryModel}`,
|
||||
`${equipmentCode}`,
|
||||
`${d.merchantName}`,
|
||||
`${d.expirationTime}`,
|
||||
`${d.expirationDay}`,
|
||||
`${username}`,
|
||||
`${d.totalPrice}`,
|
||||
|
||||
`${d.orderStatus}`
|
||||
]);
|
||||
});
|
||||
const sheetName = '设备列表';
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 40 },
|
||||
{ wch: 10 }
|
||||
];
|
||||
writeFile(workbook, '导出订单管理表.xlsx');
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: OrderParam) => {
|
||||
|
||||
Reference in New Issue
Block a user