添加收益和提现页面

This commit is contained in:
geng.tang@qq.com
2024-01-11 14:38:35 +08:00
parent 12004b1107
commit c3413fd1a0
17 changed files with 1157 additions and 4948 deletions

View File

@@ -0,0 +1,235 @@
<template>
<div class="page">
<div class="ele-body">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="profitId"
:columns="columns"
:datasource="datasource"
v-model:selection="selection"
tool-class="ele-toolbar-form"
:scroll="{ x: 1200 }"
class="sys-org-table"
:striped="true"
>
<template #toolbar>
<search
@search="reload"
:selection="selection"
@advanced="openAdvanced"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'profitId'">
{{ record.profitId}}
</template>
<template v-if="column.key === 'orderUserName'">
{{ record.orderUserName}}
</template>
<template v-if="column.key === 'merchantName'">
<div style="display: flex; flex-direction: column">
<span>{{ record.merchantName }}</span>
<span class="ele-text-placeholder">
{{ record.merchantCode }}
</span>
</div>
</template>
<template v-if="column.key === 'sceneDis'">
{{ record.sceneDis }}
</template>
<template v-if="column.key === 'orderNo'">
{{ record.orderNo }}
</template>
<template v-if="column.key === 'money'">
<p>
<span class="ele-text-warning price-edit">
{{ record.money }}
</span></p>
</template>
<template v-if="column.key === 'comments'">
{{ record.comments }}
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === '0'" color="green">正常</a-tag>
<a-tag v-if="record.status === '1'" color="red">冻结</a-tag>
</template>
<template v-if="column.key === 'createTime'">
{{ record.createTime }}
</template>
<!-- <template v-if="column.key === 'updateTime'">
{{ record.updateTime }}
</template> -->
<template v-if="column.key === 'action'">
<!-- <a-space>
<a-button @click="openInfo(record)">详情</a-button>
</a-space> -->
</template>
</template>
</ele-pro-table>
</a-card>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from '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 './search.vue';
import type { Profit, ProfitParam } from '@/api/profit/model';
import { profitPage } from '@/api/profit';
// 当前用户信息
// const userStore = useUserStore();
// const loginUser = computed(() => userStore.info ?? {});
// const orderType = localStorage.getItem('orderType');
defineProps<{
activeKey?: boolean;
data?: any;
}>();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
/* 获取字典数据 */
// const orderSource = getDictionaryOptions('equipmentCategory');
// 表格列配置
const columns = ref<ColumnItem[]>([
{
key: 'index',
width: 20,
align: 'center',
fixed: 'left',
hideInSetting: true,
hideInTable: true,
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
},
/* {
title: '操作',
key: 'action',
width: 100,
align: 'center',
fixed: 'left',
hideInSetting: true
}, */
{
title: '编号',
dataIndex: 'profitId',
key: 'profitId',
sorter: true
},
{
title: '下单用户',
dataIndex: 'orderUserName',
key: 'orderUserName'
},
{
title: '门店',
dataIndex: 'merchantName',
key: 'merchantName'
},
{
title: '收益类别',
dataIndex: 'sceneDis',
key: 'sceneDis'
},
{
title: '订单号',
dataIndex: 'orderNo',
key: 'orderNo'
},
{
title: '金额',
key: 'money',
dataIndex: 'money',
ellipsis: true
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments'
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
sorter: true/* ,
customRender: ({ text }) => toDateString(text) */
}
]);
// 表格选中数据
const selection = ref<Profit[]>([]);
// 是否显示高级搜索
const showAdvancedSearch = ref(false);
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
// 搜索条件
if (filters.scene) {
where.scene = filters.scene;
}
where.tenantId = localStorage.getItem('tenantId');
return profitPage({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: ProfitParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开高级搜索 */
const openAdvanced = () => {
showAdvancedSearch.value = !showAdvancedSearch.value;
};
</script>
<script lang="ts">
export default {
name: 'ProfitIndex'
};
</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;
}
.price-edit {
padding-right: 5px;
}
.comments {
max-width: 200px;
}
</style>

View File

@@ -0,0 +1,106 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-radio-group v-model:value="sceneType" @change="handleTabs">
<a-radio-button :value="0">全部</a-radio-button>
<a-radio-button :value="1">资产收益</a-radio-button>
<a-radio-button :value="2">服务费收益</a-radio-button>
<a-radio-button :value="3">推广收益</a-radio-button>
<a-radio-button :value="4">门店业绩提成</a-radio-button>
<a-radio-button :value="5">站点业绩提成</a-radio-button>
</a-radio-group>
<a-range-picker
v-model:value="dateRange"
value-format="YYYY-MM-DD"
class="ele-fluid"
/>
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="searchText"
@pressEnter="search"
@search="search"
>
<template #addonBefore>
<a-select v-model:value="type" style="width: 100px; margin: -5px -12px">
<a-select-option value="keywords">模糊搜索</a-select-option>
<a-select-option value="orderNo">订单号</a-select-option>
<a-select-option value="merchantName">门店名称</a-select-option>
<a-select-option value="orderUserName">用户名</a-select-option>
</a-select>
</template>
</a-input-search>
</a-space>
</template>
<script lang="ts" setup>
import useSearch from '@/utils/use-search';
import { ref, watch } from 'vue';
import type { ProfitParam } from '@/api/profit/model';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
}>(),
{}
);
const emit = defineEmits<{
(e: 'search', where?: ProfitParam): void;
(e: 'add'): void;
(e: 'advanced'): void;
}>();
// 表单数据
const { where, resetFields } = useSearch<ProfitParam>({
scene: 0
});
// 下来选项
const type = ref('keywords');
// 搜索内容
const searchText = ref('');
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
const sceneType = ref<number>(0);
/* 搜索 */
const search = () => {
const [d1, d2] = dateRange.value ?? [];
if (type.value == 'orderNo') {
where.orderNo = searchText.value;
}
if (type.value == 'orderUserName') {
where.orderUserName = searchText.value;
}
if (type.value == 'merchantName') {
where.merchantName = searchText.value;
}
if (type.value == 'keywords') {
where.keywords = searchText.value;
}
emit('search', {
...where,
beginDate: d1,
endDate: d2
});
};
const handleTabs = (e) => {
resetFields();
const sceneType = Number(e.target.value);
if(sceneType > 0){
where.scene = sceneType;
}
emit('search', {
...where
});
};
watch(
() => props.selection,
() => {}
);
</script>