fix
This commit is contained in:
305
src/views/yunxinwei/xufei/index.vue
Normal file
305
src/views/yunxinwei/xufei/index.vue
Normal file
@@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="orderRefundId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
:striped="true"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@advanced="openAdvanced"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'goods'">
|
||||
<template v-if="record.equipment">
|
||||
<p class="ele-text">{{ record.equipment.equipmentName }}</p>
|
||||
<p class="ele-text">{{ record.equipment.batteryModel }}</p>
|
||||
<p class="ele-text">{{ record.equipment.equipmentCode }}</p>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'deliveryType'">
|
||||
<span v-if="record.deliveryType === 10">快递配送</span>
|
||||
<span v-if="record.deliveryType === 20">门店自提</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<User :record="record" />
|
||||
</template>
|
||||
<template v-if="column.key === 'expirationDay'">
|
||||
{{ record.expirationDay }}天
|
||||
</template>
|
||||
<template v-if="column.key === 'batteryModel'">
|
||||
{{ record.equipmentGoods?.batteryModel }}
|
||||
</template>
|
||||
<template v-if="column.key === 'equipmentCode'">
|
||||
{{ record.equipment?.equipmentCode }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'orderSource'">
|
||||
<span v-if="record.orderSource === 10" color="green"
|
||||
>普通订单</span
|
||||
>
|
||||
<span v-if="record.orderSource === 20" color="red">禁用</span>
|
||||
<span v-if="record.orderSource === 30" color="red">禁用</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<a-tooltip :title="`用户ID:${record.userId}`">
|
||||
<a-avatar :src="record.avatar" size="small" />
|
||||
<span style="padding-left: 4px">{{ record.nickname }}</span>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'createTime'">
|
||||
{{ record.createTime }}
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button v-if="record.auditStatus == 10" @click="openEdit(record)">审核</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'updateTime'">
|
||||
<span v-if="record.auditStatus ===10">-</span>
|
||||
<span v-else>{{ record.updateTime }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import Search from './components/search.vue';
|
||||
import Edit from './components/edit.vue';
|
||||
import {
|
||||
pageOrderRefund,
|
||||
removeOrderRefund,
|
||||
removeBatchOrderRefund
|
||||
} from '@/api/order/refund';
|
||||
import { listOrderPay } from '@/api/order';
|
||||
import type { OrderRefund, OrderRefundParam } from '@/api/order/refund/model';
|
||||
|
||||
const props = defineProps<{
|
||||
activeKey?: boolean;
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
/* 获取字典数据 */
|
||||
// const payMethodDict = getDictionaryOptions('payMethod');
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
|
||||
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'orderNo',
|
||||
key: 'orderNo'
|
||||
},
|
||||
{
|
||||
title: '电池型号',
|
||||
dataIndex: 'batteryModel',
|
||||
key: 'batteryModel'
|
||||
},
|
||||
{
|
||||
title: '电池编号',
|
||||
dataIndex: 'equipmentCode',
|
||||
key: 'equipmentCode'
|
||||
},
|
||||
{
|
||||
title: '所属商户',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
sorter: true
|
||||
},
|
||||
{
|
||||
title: '到期时间',
|
||||
dataIndex: 'expirationTime',
|
||||
key: 'expirationTime'
|
||||
},
|
||||
{
|
||||
title: '剩余时间',
|
||||
key: 'expirationDay',
|
||||
dataIndex: 'expirationDay'
|
||||
},
|
||||
{
|
||||
title: '客户实名',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
customRender: ({ text }) => toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '订单金额',
|
||||
dataIndex: 'payPrice',
|
||||
key: 'payPrice'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
customRender: ({ text }) => toDateString(text)
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<OrderRefund[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<OrderRefund | null>(null);
|
||||
// 是否显示资产详情
|
||||
const showInfo = ref(false);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
const deliveryEdit = ref(false);
|
||||
// 是否显示高级搜索
|
||||
const showAdvancedSearch = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
// 搜索条件
|
||||
if (filters.payMethod) {
|
||||
where.payMethod = filters.payMethod;
|
||||
}
|
||||
if (filters.deliveryType) {
|
||||
where.deliveryType = filters.deliveryType;
|
||||
}
|
||||
if (filters.payStatus) {
|
||||
where.payStatus = filters.payStatus;
|
||||
}
|
||||
if (filters.orderSource) {
|
||||
where.orderSource = filters.orderSource;
|
||||
}
|
||||
where.tenantId = localStorage.getItem('tenantId');
|
||||
where.isRenew = 0;
|
||||
console.log('isRenew');
|
||||
return listOrderPay({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: OrderRefundParam) => {
|
||||
console.log(where, '....>>>>111');
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
const openDelivery = (row?: OrderRefund) => {
|
||||
current.value = row ?? null;
|
||||
deliveryEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: OrderRefund) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开用户详情弹窗 */
|
||||
const openInfo = (row?: OrderRefund) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 打开高级搜索 */
|
||||
const openAdvanced = () => {
|
||||
showAdvancedSearch.value = !showAdvancedSearch.value;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: OrderRefund) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeOrderRefund(row.orderRefundId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
console.log(selection.value);
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchOrderRefund(selection.value.map((d) => d.orderRefundId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ShopOrderRefundIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
p {
|
||||
line-height: 0.8;
|
||||
}
|
||||
.sys-org-table :deep(.ant-table-body) {
|
||||
overflow: auto !important;
|
||||
overflow: overlay !important;
|
||||
}
|
||||
|
||||
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
|
||||
padding: 0 4px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user