chore(env): 启用开发环境API地址并清理冗余文件
- 启用 .env.development 中的 VITE_API_URL 配置 - 删除 src/views/glt/shopDealerOrder/components/Import.vue 文件 - 删除 src/views/glt/shopDealerOrder2/components/Import.vue 文件 - 删除 src/views/glt/shopDealerWithdraw/components/Import.vue 文件 - 删除 src/views/glt/shopDealerApply/index.vue 文件 - 删除 src/views/glt/shopDealerCapital/index.vue 文件 - 删除 src/views/glt/shopDealerOrder/index.vue 文件 - 从 shopDealerOrder 组件中移除导入模板说明信息
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
VITE_APP_NAME=后台管理(开发环境)
|
VITE_APP_NAME=后台管理(开发环境)
|
||||||
#VITE_API_URL=http://127.0.0.1:9200/api
|
VITE_API_URL=http://127.0.0.1:9200/api
|
||||||
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,158 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<div class="search-container">
|
|
||||||
<!-- 搜索表单 -->
|
|
||||||
<a-form
|
|
||||||
:model="searchForm"
|
|
||||||
layout="inline"
|
|
||||||
class="search-form"
|
|
||||||
@finish="handleSearch"
|
|
||||||
>
|
|
||||||
<a-form-item label="客户名称">
|
|
||||||
<a-input
|
|
||||||
v-model:value="searchForm.dealerName"
|
|
||||||
placeholder="请输入客户名称"
|
|
||||||
allow-clear
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="联系电话">
|
|
||||||
<a-input
|
|
||||||
v-model:value="searchForm.mobile"
|
|
||||||
placeholder="客户联系电话"
|
|
||||||
allow-clear
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="审核状态">
|
|
||||||
<a-select
|
|
||||||
v-model:value="searchForm.applyStatus"
|
|
||||||
placeholder="全部状态"
|
|
||||||
allow-clear
|
|
||||||
style="width: 120px"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">跟进中</a-select-option>
|
|
||||||
<a-select-option :value="20">已签约</a-select-option>
|
|
||||||
<a-select-option :value="30">已取消</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="添加时间">
|
|
||||||
<a-range-picker
|
|
||||||
v-model:value="searchForm.dateRange"
|
|
||||||
style="width: 240px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
|
||||||
<template #icon>
|
|
||||||
<SearchOutlined />
|
|
||||||
</template>
|
|
||||||
搜索
|
|
||||||
</a-button>
|
|
||||||
<a-button @click="resetSearch"> 重置 </a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { reactive } from 'vue';
|
|
||||||
import { SearchOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { ShopDealerApplyParam } from '@/api/shop/shopDealerApply/model';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的数据
|
|
||||||
selection?: any[];
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
selection: () => []
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: ShopDealerApplyParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'batchApprove'): void;
|
|
||||||
(e: 'export'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 搜索表单
|
|
||||||
const searchForm = reactive<any>({
|
|
||||||
realName: '',
|
|
||||||
mobile: '',
|
|
||||||
applyType: undefined,
|
|
||||||
applyStatus: undefined,
|
|
||||||
dateRange: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const handleSearch = () => {
|
|
||||||
const searchParams: ShopDealerApplyParam = {};
|
|
||||||
|
|
||||||
if (searchForm.realName) {
|
|
||||||
searchParams.realName = searchForm.realName;
|
|
||||||
}
|
|
||||||
if (searchForm.mobile) {
|
|
||||||
searchParams.mobile = searchForm.mobile;
|
|
||||||
}
|
|
||||||
if (searchForm.applyType) {
|
|
||||||
searchParams.applyType = searchForm.applyType;
|
|
||||||
}
|
|
||||||
if (searchForm.applyStatus) {
|
|
||||||
searchParams.applyStatus = searchForm.applyStatus;
|
|
||||||
}
|
|
||||||
if (searchForm.dateRange && searchForm.dateRange.length === 2) {
|
|
||||||
searchParams.startTime = dayjs(searchForm.dateRange[0]).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
);
|
|
||||||
searchParams.endTime = dayjs(searchForm.dateRange[1]).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (searchForm.dealerName) {
|
|
||||||
searchParams.dealerName = searchForm.dealerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('search', searchParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重置搜索
|
|
||||||
const resetSearch = () => {
|
|
||||||
searchForm.realName = '';
|
|
||||||
searchForm.mobile = '';
|
|
||||||
searchForm.applyType = undefined;
|
|
||||||
searchForm.applyStatus = undefined;
|
|
||||||
searchForm.dateRange = undefined;
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.search-container {
|
|
||||||
background: #fff;
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
.search-form {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons {
|
|
||||||
border-top: 1px solid #f0f0f0;
|
|
||||||
padding-top: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,645 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="900"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑客户' : '新增客户'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="{ span: 6 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
>
|
|
||||||
<!-- 客户信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">客户信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="客户名称" name="dealerName">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入客户名称"
|
|
||||||
v-model:value="form.dealerName"
|
|
||||||
:disabled="form.applyStatus == 20"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="联系人" name="realName">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入联系人"
|
|
||||||
v-model:value="form.realName"
|
|
||||||
:disabled="form.applyStatus == 20"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="手机号码" name="mobile">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入手机号码"
|
|
||||||
:disabled="form.applyStatus == 20"
|
|
||||||
v-model:value="form.mobile"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="收益基数" name="rate">
|
|
||||||
<a-input-number
|
|
||||||
placeholder="0.007"
|
|
||||||
:min="0"
|
|
||||||
:max="1"
|
|
||||||
step="0.01"
|
|
||||||
:disabled="!hasRole('superAdmin')"
|
|
||||||
v-model:value="form.rate"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 报备人信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">报备人信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="报备人ID" name="userId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入报备人ID"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="报备人" name="nickName">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入报备人名称"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.nickName"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="推荐人ID" name="refereeId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入推荐人用户ID"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.refereeId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="推荐人名称" name="refereeName">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入推荐人名称"
|
|
||||||
:disabled="isUpdate"
|
|
||||||
v-model:value="form.refereeName"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 审核信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">审核状态</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="审核状态" name="applyStatus">
|
|
||||||
<a-select
|
|
||||||
v-model:value="form.applyStatus"
|
|
||||||
placeholder="请选择审核状态"
|
|
||||||
@change="handleStatusChange"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">
|
|
||||||
<a-tag color="orange">跟进中</a-tag>
|
|
||||||
<span style="margin-left: 8px">正在跟进中</span>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="20">
|
|
||||||
<a-tag color="success">已签约</a-tag>
|
|
||||||
<span style="margin-left: 8px">客户已签约</span>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="30">
|
|
||||||
<a-tag color="error">已取消</a-tag>
|
|
||||||
<span style="margin-left: 8px">客户已取消</span>
|
|
||||||
</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12" v-if="form.applyStatus === 30">
|
|
||||||
<a-form-item label="取消原因" name="rejectReason">
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="form.rejectReason"
|
|
||||||
placeholder="请输入取消原因"
|
|
||||||
style="width: 100%"
|
|
||||||
:rows="3"
|
|
||||||
:maxlength="200"
|
|
||||||
show-count
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 跟进情况 -->
|
|
||||||
<a-divider orientation="left" v-if="form.applyStatus == 10">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">跟进情况</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<!-- 历史跟进记录 -->
|
|
||||||
<div v-if="form.applyStatus == 10 && historyRecords.length > 0">
|
|
||||||
<a-divider orientation="left" style="font-size: 14px; color: #666">
|
|
||||||
历史跟进记录
|
|
||||||
</a-divider>
|
|
||||||
<div
|
|
||||||
v-for="(record, index) in historyRecords"
|
|
||||||
:key="record.id"
|
|
||||||
style="
|
|
||||||
margin-bottom: 16px;
|
|
||||||
padding: 12px;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
border-radius: 4px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="flex justify-between"
|
|
||||||
style="font-weight: 500; margin-bottom: 8px"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
>跟进 #{{ historyRecords.length - index }}
|
|
||||||
<span class="text-gray-400 px-4">{{
|
|
||||||
record.createTime
|
|
||||||
}}</span></div
|
|
||||||
>
|
|
||||||
<a-tag color="#f50" class="cursor-pointer" @click="remove(record)"
|
|
||||||
>删除</a-tag
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div style="white-space: pre-wrap">
|
|
||||||
{{ record.content }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 新增跟进记录 -->
|
|
||||||
<div v-if="form.applyStatus == 10">
|
|
||||||
<a-divider orientation="left" style="font-size: 14px; color: #666">
|
|
||||||
新增跟进记录
|
|
||||||
</a-divider>
|
|
||||||
<a-form-item :wrapper-col="{ span: 24 }">
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="newFollowUpContent"
|
|
||||||
placeholder="请输入本次跟进内容"
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="500"
|
|
||||||
style="width: 80%"
|
|
||||||
show-count
|
|
||||||
/>
|
|
||||||
<div class="btn">
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
@click="saveFollowUpRecord"
|
|
||||||
:loading="followUpLoading"
|
|
||||||
:disabled="!newFollowUpContent.trim()"
|
|
||||||
>
|
|
||||||
保存跟进记录
|
|
||||||
</a-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
|
||||||
</div>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import { assignObject } from 'ele-admin-pro';
|
|
||||||
import {
|
|
||||||
addShopDealerApply,
|
|
||||||
updateShopDealerApply
|
|
||||||
} from '@/api/shop/shopDealerApply';
|
|
||||||
import {
|
|
||||||
listShopDealerRecord,
|
|
||||||
addShopDealerRecord,
|
|
||||||
removeShopDealerRecord
|
|
||||||
} from '@/api/shop/shopDealerRecord';
|
|
||||||
import { ShopDealerApply } from '@/api/shop/shopDealerApply/model';
|
|
||||||
import { ShopDealerRecord } from '@/api/shop/shopDealerRecord/model';
|
|
||||||
import { FormInstance, RuleObject } from 'ant-design-vue/es/form';
|
|
||||||
import { messageLoading } from 'ele-admin-pro';
|
|
||||||
import { hasRole } from '@/utils/permission';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerApply | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 跟进记录保存状态
|
|
||||||
const followUpLoading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
|
|
||||||
// 历史跟进记录
|
|
||||||
const historyRecords = ref<ShopDealerRecord[]>([]);
|
|
||||||
|
|
||||||
// 新的跟进内容
|
|
||||||
const newFollowUpContent = ref('');
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const form = reactive<ShopDealerApply>({
|
|
||||||
applyId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
nickName: undefined,
|
|
||||||
realName: '',
|
|
||||||
mobile: '',
|
|
||||||
dealerName: '',
|
|
||||||
rate: 0.007,
|
|
||||||
refereeId: undefined,
|
|
||||||
refereeName: undefined,
|
|
||||||
applyType: 10,
|
|
||||||
applyTime: undefined,
|
|
||||||
applyStatus: 10,
|
|
||||||
auditTime: undefined,
|
|
||||||
rejectReason: '',
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
realName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入客户名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject,
|
|
||||||
{
|
|
||||||
min: 2,
|
|
||||||
max: 20,
|
|
||||||
message: '姓名长度应在2-20个字符之间',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
rate: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入收益基数',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
mobile: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入手机号码',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject,
|
|
||||||
{
|
|
||||||
pattern: /^1[3-9]\d{9}$/,
|
|
||||||
message: '请输入正确的手机号码',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
applyType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择申请方式',
|
|
||||||
trigger: 'change'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
applyStatus: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择审核状态',
|
|
||||||
trigger: 'change'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
rejectReason: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '驳回时必须填写驳回原因',
|
|
||||||
trigger: 'blur'
|
|
||||||
} as RuleObject
|
|
||||||
],
|
|
||||||
auditTime: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '审核时请选择审核时间',
|
|
||||||
trigger: 'change'
|
|
||||||
} as RuleObject
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 获取历史跟进记录 */
|
|
||||||
const fetchHistoryRecords = async (dealerId: number) => {
|
|
||||||
try {
|
|
||||||
// 先通过list接口获取所有记录,然后过滤
|
|
||||||
const allRecords = await listShopDealerRecord({});
|
|
||||||
const records = allRecords.filter(
|
|
||||||
(record) => record.dealerId === dealerId
|
|
||||||
);
|
|
||||||
|
|
||||||
// 按创建时间倒序排列(最新的在前面)
|
|
||||||
historyRecords.value = records.sort((a, b) => {
|
|
||||||
if (a.createTime && b.createTime) {
|
|
||||||
return (
|
|
||||||
new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取历史跟进记录失败:', error);
|
|
||||||
message.error('获取历史跟进记录失败');
|
|
||||||
historyRecords.value = [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 保存新的跟进记录 */
|
|
||||||
const saveFollowUpRecord = async () => {
|
|
||||||
// 检查是否有客户ID
|
|
||||||
if (!form.applyId) {
|
|
||||||
message.warning('请先保存客户信息');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否有跟进内容
|
|
||||||
if (!newFollowUpContent.value.trim()) {
|
|
||||||
message.warning('请输入跟进内容');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
followUpLoading.value = true;
|
|
||||||
const recordData: any = {
|
|
||||||
content: newFollowUpContent.value.trim(),
|
|
||||||
dealerId: form.applyId,
|
|
||||||
userId: form.userId,
|
|
||||||
status: 1, // 默认设置为已完成
|
|
||||||
sortNumber: 100
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增逻辑
|
|
||||||
await addShopDealerRecord(recordData);
|
|
||||||
message.success('跟进记录保存成功');
|
|
||||||
// 保存最后跟进内容到主表
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...form,
|
|
||||||
comments: newFollowUpContent.value.trim()
|
|
||||||
});
|
|
||||||
|
|
||||||
// 清空输入框
|
|
||||||
newFollowUpContent.value = '';
|
|
||||||
|
|
||||||
// 重新加载历史记录
|
|
||||||
await fetchHistoryRecords(form.applyId);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('保存跟进记录失败:', error);
|
|
||||||
message.error('保存跟进记录失败');
|
|
||||||
} finally {
|
|
||||||
followUpLoading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 处理审核状态变化 */
|
|
||||||
const handleStatusChange = (value: number) => {
|
|
||||||
// 当状态改为审核通过或驳回时,自动设置审核时间为当前时间
|
|
||||||
if ((value === 20 || value === 30) && !form.auditTime) {
|
|
||||||
form.auditTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
||||||
}
|
|
||||||
// 当状态改为待审核时,清空审核时间和驳回原因
|
|
||||||
if (value === 10) {
|
|
||||||
form.auditTime = undefined;
|
|
||||||
form.rejectReason = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerRecord) => {
|
|
||||||
const hide = messageLoading('请求中..', 0);
|
|
||||||
removeShopDealerRecord(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
// 重新加载历史记录
|
|
||||||
if (props.data?.applyId) {
|
|
||||||
fetchHistoryRecords(props.data?.applyId);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 动态验证规则
|
|
||||||
const validateFields: string[] = [
|
|
||||||
'userId',
|
|
||||||
'realName',
|
|
||||||
'mobile',
|
|
||||||
'applyStatus'
|
|
||||||
];
|
|
||||||
|
|
||||||
// 如果是驳回状态,需要验证驳回原因
|
|
||||||
if (form.applyStatus === 30) {
|
|
||||||
validateFields.push('rejectReason');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是审核通过或驳回状态,需要验证审核时间
|
|
||||||
if (form.applyStatus === 20 || form.applyStatus === 30) {
|
|
||||||
validateFields.push('auditTime');
|
|
||||||
}
|
|
||||||
|
|
||||||
formRef.value
|
|
||||||
.validate(validateFields)
|
|
||||||
.then(async () => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
|
|
||||||
// 处理时间字段转换 - 转换为ISO字符串格式
|
|
||||||
if (formData.applyTime) {
|
|
||||||
if (dayjs.isDayjs(formData.applyTime)) {
|
|
||||||
formData.applyTime = formData.applyTime.format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
} else if (typeof formData.applyTime === 'number') {
|
|
||||||
formData.applyTime = dayjs(formData.applyTime).format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (formData.auditTime) {
|
|
||||||
if (dayjs.isDayjs(formData.auditTime)) {
|
|
||||||
formData.auditTime = formData.auditTime.format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
} else if (typeof formData.auditTime === 'number') {
|
|
||||||
formData.auditTime = dayjs(formData.auditTime).format(
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当审核状态为通过或驳回时,确保有审核时间
|
|
||||||
if (
|
|
||||||
(formData.applyStatus === 20 || formData.applyStatus === 30) &&
|
|
||||||
!formData.auditTime
|
|
||||||
) {
|
|
||||||
formData.auditTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当状态为待审核时,清空审核时间
|
|
||||||
if (formData.applyStatus === 10) {
|
|
||||||
formData.auditTime = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const saveOrUpdate = isUpdate.value
|
|
||||||
? updateShopDealerApply
|
|
||||||
: addShopDealerApply;
|
|
||||||
try {
|
|
||||||
const msg = await saveOrUpdate(formData);
|
|
||||||
message.success(msg);
|
|
||||||
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
} catch (e: any) {
|
|
||||||
message.error(e.message);
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
async (visible) => {
|
|
||||||
if (visible) {
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
isUpdate.value = true;
|
|
||||||
|
|
||||||
// 如果是修改且状态为跟进中,获取历史跟进记录
|
|
||||||
if (props.data.applyId && props.data.applyStatus === 10) {
|
|
||||||
await fetchHistoryRecords(props.data.applyId);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 重置为默认值
|
|
||||||
Object.assign(form, {
|
|
||||||
applyId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
realName: '',
|
|
||||||
mobile: '',
|
|
||||||
refereeId: undefined,
|
|
||||||
applyType: 10,
|
|
||||||
applyTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
||||||
applyStatus: 10,
|
|
||||||
auditTime: undefined,
|
|
||||||
rejectReason: '',
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
isUpdate.value = false;
|
|
||||||
|
|
||||||
// 重置历史记录和新内容
|
|
||||||
historyRecords.value = [];
|
|
||||||
newFollowUpContent.value = '';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
|
||||||
margin: 24px 0 16px 0;
|
|
||||||
|
|
||||||
.ant-divider-inner-text {
|
|
||||||
padding: 0 16px 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-radio) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
|
|
||||||
.ant-radio-inner {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-select-selection-item) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,458 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="applyId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@batchApprove="batchApprove"
|
|
||||||
@export="exportData"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'applyStatus'">
|
|
||||||
<a-tag v-if="record.applyStatus === 10" color="orange"
|
|
||||||
>跟进中</a-tag
|
|
||||||
>
|
|
||||||
<a-tag v-if="record.applyStatus === 20" color="green">已签约</a-tag>
|
|
||||||
<a-tag v-if="record.applyStatus === 30" color="red">已取消</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'customer'">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<span class="font-medium">{{ record.dealerName }}</span>
|
|
||||||
<span class="text-gray-400">联系人:{{ record.realName }}</span>
|
|
||||||
<span class="text-gray-400">联系电话:{{ record.mobile }}</span>
|
|
||||||
<span class="text-gray-400">户号:{{ record.dealerCode }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'applicantInfo'">
|
|
||||||
<div class="text-gray-600">{{ record.nickName }}</div>
|
|
||||||
<div class="text-gray-400">{{ record.phone }}</div>
|
|
||||||
<div class="text-gray-400">{{ record.rate }}</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'comments'">
|
|
||||||
<div class="text-gray-400">{{ record.comments }}</div>
|
|
||||||
<div class="text-gray-400" v-if="record.comments">{{
|
|
||||||
record.updateTime
|
|
||||||
}}</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'createTime'">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<span>{{ record.createTime }}</span>
|
|
||||||
<span>保护期:7天</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a @click="openEdit(record)" class="ele-text-primary">
|
|
||||||
<EditOutlined />
|
|
||||||
编辑
|
|
||||||
</a>
|
|
||||||
<template v-if="record.applyStatus !== 20">
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a @click="approveApply(record)" class="ele-text-success">
|
|
||||||
<CheckOutlined />
|
|
||||||
已签约
|
|
||||||
</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a @click="rejectApply(record)" class="ele-text-warning">
|
|
||||||
<CloseOutlined />
|
|
||||||
驳回
|
|
||||||
</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
v-if="record.applyStatus != 20"
|
|
||||||
title="确定要删除此申请记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
placement="topRight"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">
|
|
||||||
<DeleteOutlined />
|
|
||||||
删除
|
|
||||||
</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<ShopDealerApplyEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import {
|
|
||||||
ExclamationCircleOutlined,
|
|
||||||
CheckOutlined,
|
|
||||||
CloseOutlined,
|
|
||||||
EditOutlined,
|
|
||||||
DeleteOutlined
|
|
||||||
} 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 Search from './components/search.vue';
|
|
||||||
import { getPageTitle } from '@/utils/common';
|
|
||||||
import ShopDealerApplyEdit from './components/shopDealerApplyEdit.vue';
|
|
||||||
import {
|
|
||||||
pageShopDealerApply,
|
|
||||||
removeShopDealerApply,
|
|
||||||
removeBatchShopDealerApply,
|
|
||||||
batchApproveShopDealerApply,
|
|
||||||
updateShopDealerApply
|
|
||||||
} from '@/api/shop/shopDealerApply';
|
|
||||||
import type {
|
|
||||||
ShopDealerApply,
|
|
||||||
ShopDealerApplyParam
|
|
||||||
} from '@/api/shop/shopDealerApply/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ShopDealerApply[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ShopDealerApply | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
where.type = 4;
|
|
||||||
return pageShopDealerApply({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '客户名称',
|
|
||||||
dataIndex: 'customer',
|
|
||||||
key: 'customer'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '最后跟进情况',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments',
|
|
||||||
align: 'left'
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '收益基数',
|
|
||||||
// dataIndex: 'rate',
|
|
||||||
// key: 'rate',
|
|
||||||
// align: 'left'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '报备人信息',
|
|
||||||
dataIndex: 'applicantInfo',
|
|
||||||
key: 'applicantInfo',
|
|
||||||
align: 'left',
|
|
||||||
fixed: 'left',
|
|
||||||
customRender: ({ record }) => {
|
|
||||||
return `${record.nickName || '-'} (${record.phone || '-'})`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'applyStatus',
|
|
||||||
key: 'applyStatus',
|
|
||||||
align: 'center',
|
|
||||||
width: 120
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '申请时间',
|
|
||||||
// dataIndex: 'applyTime',
|
|
||||||
// key: 'applyTime',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 120,
|
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '审核时间',
|
|
||||||
// dataIndex: 'auditTime',
|
|
||||||
// key: 'auditTime',
|
|
||||||
// align: 'center',
|
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '添加时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
// title: '操作',
|
|
||||||
// key: 'action',
|
|
||||||
// fixed: 'right',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 380,
|
|
||||||
// hideInSetting: true
|
|
||||||
// }
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerApplyParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核通过 */
|
|
||||||
const approveApply = (row: ShopDealerApply) => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核通过确认',
|
|
||||||
content: `确定要通过 ${row.realName} 的经销商申请吗?`,
|
|
||||||
icon: createVNode(CheckOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
try {
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...row,
|
|
||||||
applyId: row.applyId,
|
|
||||||
applyStatus: 20
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('审核通过成功');
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核驳回 */
|
|
||||||
const rejectApply = (row: ShopDealerApply) => {
|
|
||||||
let rejectReason = '';
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核驳回',
|
|
||||||
content: createVNode('div', null, [
|
|
||||||
createVNode('p', null, `申请人: ${row.realName} (${row.mobile})`),
|
|
||||||
createVNode('p', { style: 'margin-top: 12px;' }, '请输入驳回原因:'),
|
|
||||||
createVNode('textarea', {
|
|
||||||
placeholder: '请输入驳回原因...',
|
|
||||||
style:
|
|
||||||
'width: 100%; height: 80px; margin-top: 8px; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
|
|
||||||
onInput: (e: any) => {
|
|
||||||
rejectReason = e.target.value;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
icon: createVNode(CloseOutlined),
|
|
||||||
okText: '确认驳回',
|
|
||||||
okType: 'danger',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
if (!rejectReason.trim()) {
|
|
||||||
message.error('请输入驳回原因');
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
try {
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...row,
|
|
||||||
applyStatus: 30,
|
|
||||||
rejectReason: rejectReason.trim()
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('审核驳回成功');
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerApply) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerApply) => {
|
|
||||||
if (!row.applyId) {
|
|
||||||
message.error('删除失败:缺少必要参数');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hide = message.loading('正在删除申请记录...', 0);
|
|
||||||
removeShopDealerApply(row.applyId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg || '删除成功');
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message || '删除失败');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const validIds = selection.value
|
|
||||||
.filter((d) => d.applyId)
|
|
||||||
.map((d) => d.applyId);
|
|
||||||
if (!validIds.length) {
|
|
||||||
message.error('选中的数据中没有有效的ID');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '批量删除确认',
|
|
||||||
content: `确定要删除选中的 ${validIds.length} 条申请记录吗?此操作不可恢复。`,
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
okText: '确认删除',
|
|
||||||
okType: 'danger',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading(
|
|
||||||
`正在删除 ${validIds.length} 条记录...`,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
removeBatchShopDealerApply(validIds)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg || `成功删除 ${validIds.length} 条记录`);
|
|
||||||
selection.value = [];
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message || '批量删除失败');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量通过 */
|
|
||||||
const batchApprove = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pendingApplies = selection.value.filter(
|
|
||||||
(item) => item.applyStatus === 10
|
|
||||||
);
|
|
||||||
if (!pendingApplies.length) {
|
|
||||||
message.error('所选申请中没有待审核的记录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '批量通过确认',
|
|
||||||
content: `确定要通过选中的 ${pendingApplies.length} 个申请吗?`,
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const hide = message.loading('正在批量通过...', 0);
|
|
||||||
try {
|
|
||||||
const ids = pendingApplies.map((item) => item.applyId);
|
|
||||||
await batchApproveShopDealerApply(ids);
|
|
||||||
hide();
|
|
||||||
message.success(`成功通过 ${pendingApplies.length} 个申请`);
|
|
||||||
selection.value = [];
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '批量审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const exportData = () => {
|
|
||||||
const hide = message.loading('正在导出申请数据...', 0);
|
|
||||||
// 这里调用导出API
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('申请数据导出成功');
|
|
||||||
}, 2000);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerApply) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ShopDealerApply'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
|
||||||
<a-input-search
|
|
||||||
allow-clear
|
|
||||||
placeholder="用户ID|订单编号"
|
|
||||||
style="width: 240px"
|
|
||||||
v-model:value="where.keywords"
|
|
||||||
@search="reload"
|
|
||||||
/>
|
|
||||||
<a-button type="dashed" @click="handleExport">导出xls</a-button>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
import { utils, writeFile } from 'xlsx';
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
import { pageShopDealerCapital } from '@/api/shop/shopDealerCapital';
|
|
||||||
import {
|
|
||||||
ShopDealerCapital,
|
|
||||||
ShopDealerCapitalParam
|
|
||||||
} from '@/api/shop/shopDealerCapital/model';
|
|
||||||
import { getTenantId } from '@/utils/domain';
|
|
||||||
import useSearch from '@/utils/use-search';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的角色
|
|
||||||
selection?: [];
|
|
||||||
}>(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: ShopDealerCapitalParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const reload = () => {
|
|
||||||
emit('search', where);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const { where } = useSearch<ShopDealerCapitalParam>({
|
|
||||||
keywords: '',
|
|
||||||
userId: undefined,
|
|
||||||
toUserId: undefined,
|
|
||||||
limit: 5000
|
|
||||||
});
|
|
||||||
|
|
||||||
const list = ref<ShopDealerCapital[]>([]);
|
|
||||||
|
|
||||||
// 导出
|
|
||||||
const handleExport = async () => {
|
|
||||||
const array: (string | number)[][] = [
|
|
||||||
[
|
|
||||||
'用户ID',
|
|
||||||
'流动类型',
|
|
||||||
'金额',
|
|
||||||
'订单编号',
|
|
||||||
'对方用户ID',
|
|
||||||
`创建时间`,
|
|
||||||
'租户ID'
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// 按搜索结果导出
|
|
||||||
await pageShopDealerCapital(where)
|
|
||||||
.then((data) => {
|
|
||||||
list.value = data?.list || [];
|
|
||||||
list.value?.forEach((d: ShopDealerCapital) => {
|
|
||||||
array.push([
|
|
||||||
`${d.userId}`,
|
|
||||||
`${d.flowType == 10 ? '佣金收入' : ''}`,
|
|
||||||
`${d.money}`,
|
|
||||||
`${d.orderNo}`,
|
|
||||||
`${d.toUserId}`,
|
|
||||||
`${d.createTime}`,
|
|
||||||
`${d.tenantId}`
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
const sheetName = `bak_shop_dealer_capital_${getTenantId()}`;
|
|
||||||
const workbook = {
|
|
||||||
SheetNames: [sheetName],
|
|
||||||
Sheets: {}
|
|
||||||
};
|
|
||||||
const sheet = utils.aoa_to_sheet(array);
|
|
||||||
workbook.Sheets[sheetName] = sheet;
|
|
||||||
// 设置列宽
|
|
||||||
sheet['!cols'] = [
|
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 20 },
|
|
||||||
{ wch: 20 },
|
|
||||||
{ wch: 15 },
|
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 20 }
|
|
||||||
];
|
|
||||||
message.loading('正在导出...');
|
|
||||||
setTimeout(() => {
|
|
||||||
writeFile(workbook, `${sheetName}.xlsx`);
|
|
||||||
}, 1000);
|
|
||||||
})
|
|
||||||
.catch((msg) => {
|
|
||||||
message.error(msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,406 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="900"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑资金流动记录' : '新增资金流动记录'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="{ span: 6 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
>
|
|
||||||
<!-- 基本信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">基本信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="分销商用户ID" name="userId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入分销商用户ID"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="订单ID" name="orderId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入订单ID(可选)"
|
|
||||||
v-model:value="form.orderId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 资金流动信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">资金流动信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="流动类型" name="flowType">
|
|
||||||
<a-select
|
|
||||||
v-model:value="form.flowType"
|
|
||||||
placeholder="请选择资金流动类型"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">
|
|
||||||
<div class="flow-type-option">
|
|
||||||
<a-tag color="success">佣金收入</a-tag>
|
|
||||||
<span>获得分销佣金</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="20">
|
|
||||||
<div class="flow-type-option">
|
|
||||||
<a-tag color="warning">提现支出</a-tag>
|
|
||||||
<span>申请提现</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="30">
|
|
||||||
<div class="flow-type-option">
|
|
||||||
<a-tag color="error">转账支出</a-tag>
|
|
||||||
<span>转账给他人</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="40">
|
|
||||||
<div class="flow-type-option">
|
|
||||||
<a-tag color="processing">转账收入</a-tag>
|
|
||||||
<span>收到转账</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="金额" name="money">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:precision="2"
|
|
||||||
placeholder="请输入金额"
|
|
||||||
v-model:value="form.money"
|
|
||||||
style="width: 100%"
|
|
||||||
>
|
|
||||||
<template #addonAfter>元</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<a-form-item label="流动描述" name="comments">
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="form.comments"
|
|
||||||
placeholder="请输入资金流动描述"
|
|
||||||
:rows="3"
|
|
||||||
:maxlength="200"
|
|
||||||
show-count
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<!-- 关联信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">关联信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-form-item
|
|
||||||
label="对方用户ID"
|
|
||||||
name="toUserId"
|
|
||||||
v-if="form.flowType === 30 || form.flowType === 40"
|
|
||||||
>
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入对方用户ID"
|
|
||||||
v-model:value="form.toUserId"
|
|
||||||
style="width: 300px"
|
|
||||||
/>
|
|
||||||
<span style="margin-left: 12px; color: #999; font-size: 12px">
|
|
||||||
转账相关操作需要填写对方用户ID
|
|
||||||
</span>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<!-- 金额预览 -->
|
|
||||||
<div class="amount-preview" v-if="form.money && form.flowType">
|
|
||||||
<a-alert
|
|
||||||
:type="getAmountAlertType()"
|
|
||||||
:message="getAmountPreviewText()"
|
|
||||||
show-icon
|
|
||||||
style="margin-top: 16px"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import {
|
|
||||||
addShopDealerCapital,
|
|
||||||
updateShopDealerCapital
|
|
||||||
} from '@/api/shop/shopDealerCapital';
|
|
||||||
import { ShopDealerCapital } from '@/api/shop/shopDealerCapital/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerCapital | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const form = reactive<ShopDealerCapital>({
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
orderId: undefined,
|
|
||||||
flowType: undefined,
|
|
||||||
money: undefined,
|
|
||||||
comments: '',
|
|
||||||
toUserId: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入分销商用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
flowType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择资金流动类型',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
money: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入金额',
|
|
||||||
trigger: 'blur'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (value && value <= 0) {
|
|
||||||
return Promise.reject('金额必须大于0');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
comments: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入流动描述',
|
|
||||||
trigger: 'blur'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
min: 2,
|
|
||||||
max: 200,
|
|
||||||
message: '描述长度应在2-200个字符之间',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
toUserId: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if ((form.flowType === 30 || form.flowType === 40) && !value) {
|
|
||||||
return Promise.reject('转账操作必须填写对方用户ID');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 获取金额预览提示类型 */
|
|
||||||
const getAmountAlertType = () => {
|
|
||||||
if (!form.flowType) return 'info';
|
|
||||||
|
|
||||||
switch (form.flowType) {
|
|
||||||
case 10: // 佣金收入
|
|
||||||
case 40: // 转账收入
|
|
||||||
return 'success';
|
|
||||||
case 20: // 提现支出
|
|
||||||
case 30: // 转账支出
|
|
||||||
return 'warning';
|
|
||||||
default:
|
|
||||||
return 'info';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 获取金额预览文本 */
|
|
||||||
const getAmountPreviewText = () => {
|
|
||||||
if (!form.money || !form.flowType) return '';
|
|
||||||
|
|
||||||
const amount = parseFloat(form.money.toString()).toFixed(2);
|
|
||||||
const flowTypeMap = {
|
|
||||||
10: '佣金收入',
|
|
||||||
20: '提现支出',
|
|
||||||
30: '转账支出',
|
|
||||||
40: '转账收入'
|
|
||||||
};
|
|
||||||
|
|
||||||
const flowTypeName = flowTypeMap[form.flowType] || '未知类型';
|
|
||||||
const symbol = form.flowType === 10 || form.flowType === 40 ? '+' : '-';
|
|
||||||
|
|
||||||
return `${flowTypeName}:${symbol}¥${amount}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
const saveOrUpdate = isUpdate.value
|
|
||||||
? updateShopDealerCapital
|
|
||||||
: addShopDealerCapital;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
// 重置为默认值
|
|
||||||
Object.assign(form, {
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
orderId: undefined,
|
|
||||||
flowType: undefined,
|
|
||||||
money: undefined,
|
|
||||||
comments: '',
|
|
||||||
toUserId: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.flow-type-option {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.ant-tag {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.amount-preview {
|
|
||||||
:deep(.ant-alert) {
|
|
||||||
.ant-alert-message {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
|
||||||
margin: 24px 0 16px 0;
|
|
||||||
|
|
||||||
.ant-divider-inner-text {
|
|
||||||
padding: 0 16px 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-select-selection-item) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,295 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="id"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'image'">
|
|
||||||
<a-image :src="record.image" :width="50" />
|
|
||||||
</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 === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)">修改</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<ShopDealerCapitalEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
|
||||||
</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 Search from './components/search.vue';
|
|
||||||
import { getPageTitle } from '@/utils/common';
|
|
||||||
import ShopDealerCapitalEdit from './components/shopDealerCapitalEdit.vue';
|
|
||||||
import {
|
|
||||||
pageShopDealerCapital,
|
|
||||||
removeShopDealerCapital,
|
|
||||||
removeBatchShopDealerCapital
|
|
||||||
} from '@/api/shop/shopDealerCapital';
|
|
||||||
import type {
|
|
||||||
ShopDealerCapital,
|
|
||||||
ShopDealerCapitalParam
|
|
||||||
} from '@/api/shop/shopDealerCapital/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ShopDealerCapital[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ShopDealerCapital | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageShopDealerCapital({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: 'ID',
|
|
||||||
dataIndex: 'id',
|
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
|
||||||
width: 80,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '流动类型',
|
|
||||||
dataIndex: 'flowType',
|
|
||||||
key: 'flowType',
|
|
||||||
align: 'center',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
const typeMap = {
|
|
||||||
10: { text: '佣金收入', color: 'success' },
|
|
||||||
20: { text: '提现支出', color: 'warning' },
|
|
||||||
30: { text: '转账支出', color: 'error' },
|
|
||||||
40: { text: '转账收入', color: 'processing' },
|
|
||||||
50: { text: '新人注册奖', color: 'processing' }
|
|
||||||
};
|
|
||||||
const type = typeMap[text] || { text: '未知', color: 'default' };
|
|
||||||
return {
|
|
||||||
type: 'tag',
|
|
||||||
props: { color: type.color },
|
|
||||||
children: type.text
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '金额',
|
|
||||||
dataIndex: 'money',
|
|
||||||
key: 'money',
|
|
||||||
align: 'center',
|
|
||||||
customRender: ({ text, record }) => {
|
|
||||||
const amount = parseFloat(text || '0').toFixed(2);
|
|
||||||
const isIncome =
|
|
||||||
record.flowType === 10 ||
|
|
||||||
record.flowType === 40 ||
|
|
||||||
record.flowType === 50;
|
|
||||||
return {
|
|
||||||
type: 'span',
|
|
||||||
props: {
|
|
||||||
style: {
|
|
||||||
color: isIncome ? '#424242' : '#ff4d4f'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
children: `${isIncome ? '' : '-'} ${amount}`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联订单',
|
|
||||||
dataIndex: 'orderNo',
|
|
||||||
key: 'orderNo',
|
|
||||||
align: 'center',
|
|
||||||
customRender: ({ text }) => text || '-'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '对方用户',
|
|
||||||
dataIndex: 'toUserId',
|
|
||||||
key: 'toUserId',
|
|
||||||
align: 'center',
|
|
||||||
customRender: ({ text }) => (text ? `ID: ${text}` : '-')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '描述',
|
|
||||||
dataIndex: 'describe',
|
|
||||||
key: 'describe',
|
|
||||||
align: 'left',
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => text || '-'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
// title: '操作',
|
|
||||||
// key: 'action',
|
|
||||||
// width: 180,
|
|
||||||
// fixed: 'right',
|
|
||||||
// align: 'center',
|
|
||||||
// hideInSetting: true
|
|
||||||
// }
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerCapitalParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerCapital) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerCapital) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeShopDealerCapital(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchShopDealerCapital(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerCapital) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ShopDealerCapital'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
<!-- 经销商订单导入弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="520"
|
|
||||||
:footer="null"
|
|
||||||
title="导入分销订单"
|
|
||||||
:visible="visible"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
>
|
|
||||||
<a-spin :spinning="loading">
|
|
||||||
<a-upload-dragger
|
|
||||||
accept=".xls,.xlsx"
|
|
||||||
:show-upload-list="false"
|
|
||||||
:customRequest="doUpload"
|
|
||||||
style="padding: 24px 0; margin-bottom: 16px"
|
|
||||||
>
|
|
||||||
<p class="ant-upload-drag-icon">
|
|
||||||
<cloud-upload-outlined />
|
|
||||||
</p>
|
|
||||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
|
||||||
</a-upload-dragger>
|
|
||||||
<div class="ant-upload-text text-gray-400">
|
|
||||||
<div
|
|
||||||
>1、必须按<a
|
|
||||||
href="https://oss.wsdns.cn/20251018/408b805ec3cd4084a4dc686e130af578.xlsx"
|
|
||||||
target="_blank"
|
|
||||||
>导入模版</a
|
|
||||||
>的格式上传</div
|
|
||||||
>
|
|
||||||
<div>2、导入成功确认结算完成佣金的发放</div>
|
|
||||||
</div>
|
|
||||||
</a-spin>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { message } from 'ant-design-vue/es';
|
|
||||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
|
||||||
import { importShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
// 是否打开弹窗
|
|
||||||
visible: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 导入请求状态
|
|
||||||
const loading = ref(false);
|
|
||||||
|
|
||||||
/* 上传 */
|
|
||||||
const doUpload = ({ file }) => {
|
|
||||||
if (
|
|
||||||
![
|
|
||||||
'application/vnd.ms-excel',
|
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
||||||
].includes(file.type)
|
|
||||||
) {
|
|
||||||
message.error('只能选择 excel 文件');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (file.size / 1024 / 1024 > 10) {
|
|
||||||
message.error('大小不能超过 10MB');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
importShopDealerOrder(file)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 更新 visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,182 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex items-center gap-20">
|
|
||||||
<!-- 搜索表单 -->
|
|
||||||
<a-form
|
|
||||||
:model="where"
|
|
||||||
layout="inline"
|
|
||||||
class="search-form"
|
|
||||||
@finish="handleSearch"
|
|
||||||
>
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-button
|
|
||||||
danger
|
|
||||||
class="ele-btn-icon"
|
|
||||||
v-if="selection.length > 0"
|
|
||||||
:disabled="selection?.length === 0"
|
|
||||||
@click="removeBatch"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<DeleteOutlined />
|
|
||||||
</template>
|
|
||||||
<span>批量删除</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<!-- <a-form-item label="订单状态">-->
|
|
||||||
<!-- <a-select-->
|
|
||||||
<!-- v-model:value="where.isInvalid"-->
|
|
||||||
<!-- placeholder="全部"-->
|
|
||||||
<!-- allow-clear-->
|
|
||||||
<!-- style="width: 120px"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <a-select-option :value="0">有效</a-select-option>-->
|
|
||||||
<!-- <a-select-option :value="1">失效</a-select-option>-->
|
|
||||||
<!-- </a-select>-->
|
|
||||||
<!-- </a-form-item>-->
|
|
||||||
|
|
||||||
<!-- <a-form-item label="结算状态">-->
|
|
||||||
<!-- <a-select-->
|
|
||||||
<!-- v-model:value="where.isSettled"-->
|
|
||||||
<!-- placeholder="全部"-->
|
|
||||||
<!-- allow-clear-->
|
|
||||||
<!-- style="width: 120px"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <a-select-option :value="0">未结算</a-select-option>-->
|
|
||||||
<!-- <a-select-option :value="1">已结算</a-select-option>-->
|
|
||||||
<!-- </a-select>-->
|
|
||||||
<!-- </a-form-item>-->
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-input-search
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入关键词"
|
|
||||||
style="width: 240px"
|
|
||||||
v-model:value="where.keywords"
|
|
||||||
@search="handleSearch"
|
|
||||||
/>
|
|
||||||
<!-- <a-button type="primary" html-type="submit" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <SearchOutlined/>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 搜索-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<a-button @click="resetSearch"> 重置 </a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-space>
|
|
||||||
<!-- <a-button @click="exportData" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <ExportOutlined />-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 导出数据-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<a-button @click="openImport" class="ele-btn-icon">
|
|
||||||
<template #icon>
|
|
||||||
<UploadOutlined />
|
|
||||||
</template>
|
|
||||||
导入数据
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
danger
|
|
||||||
@click="batchSettle"
|
|
||||||
:disabled="selection?.length === 0"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<DollarOutlined />
|
|
||||||
</template>
|
|
||||||
批量结算
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 导入弹窗 -->
|
|
||||||
<Import v-model:visible="showImport" @done="emit('importDone')" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import {
|
|
||||||
DollarOutlined,
|
|
||||||
UploadOutlined,
|
|
||||||
DeleteOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { ShopDealerOrderParam } from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import Import from './Import.vue';
|
|
||||||
import useSearch from '@/utils/use-search';
|
|
||||||
|
|
||||||
withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的数据
|
|
||||||
selection?: any[];
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
selection: () => []
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: ShopDealerOrderParam): void;
|
|
||||||
(e: 'batchSettle'): void;
|
|
||||||
(e: 'export'): void;
|
|
||||||
(e: 'importDone'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 是否显示导入弹窗
|
|
||||||
const showImport = ref(false);
|
|
||||||
|
|
||||||
// 搜索表单
|
|
||||||
const { where, resetFields } = useSearch<ShopDealerOrderParam>({
|
|
||||||
orderNo: '',
|
|
||||||
productName: '',
|
|
||||||
isInvalid: undefined,
|
|
||||||
isSettled: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const handleSearch = () => {
|
|
||||||
const searchParams = { ...where };
|
|
||||||
// 清除空值
|
|
||||||
Object.keys(searchParams).forEach((key) => {
|
|
||||||
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
|
||||||
delete searchParams[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
emit('search', searchParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重置搜索
|
|
||||||
const resetSearch = () => {
|
|
||||||
// Object.keys(searchForm).forEach(key => {
|
|
||||||
// searchForm[key] = key === 'orderId' ? undefined : '';
|
|
||||||
// });
|
|
||||||
resetFields();
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
const removeBatch = () => {
|
|
||||||
emit('remove');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 批量结算
|
|
||||||
const batchSettle = () => {
|
|
||||||
emit('batchSettle');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 导出数据
|
|
||||||
const exportData = () => {
|
|
||||||
emit('export');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开导入弹窗
|
|
||||||
const openImport = () => {
|
|
||||||
showImport.value = true;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,363 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="900"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '分销订单' : '分销订单'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
:okText="`立即结算`"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="{ span: 6 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
>
|
|
||||||
<!-- 订单基本信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">基本信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="客户名称" name="title">
|
|
||||||
{{ form.title }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="订单编号" name="orderNo">
|
|
||||||
{{ form.orderNo }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="结算电量" name="orderPrice">
|
|
||||||
{{ parseFloat(form.orderPrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="换算成度" name="dealerPrice">
|
|
||||||
{{ parseFloat(form.degreePrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="税率" name="rate">
|
|
||||||
{{ form.rate }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="单价" name="price">
|
|
||||||
{{ form.price }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="结算金额" name="payPrice">
|
|
||||||
{{ parseFloat(form.settledPrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="实发金额" name="payPrice">
|
|
||||||
{{ parseFloat(form.payPrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
<div class="font-bold text-gray-400 bg-gray-50">开发调试</div>
|
|
||||||
<div class="text-gray-400 bg-gray-50">
|
|
||||||
<div>业务员({{ form.userId }}):{{ form.nickname }}</div>
|
|
||||||
<div
|
|
||||||
>一级分销商({{ form.firstUserId }}):{{
|
|
||||||
form.firstNickname
|
|
||||||
}},一级佣金30%:{{ form.firstMoney }}</div
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
>二级分销商({{ form.secondUserId }}):{{
|
|
||||||
form.secondNickname
|
|
||||||
}},二级佣金10%:{{ form.secondMoney }}</div
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
>三级分销商({{ form.thirdUserId }}):{{
|
|
||||||
form.thirdNickname
|
|
||||||
}},三级佣金60%:{{ form.thirdMoney }}</div
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<!-- 分销商信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">收益计算</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<!-- 一级分销商 -->
|
|
||||||
<div class="dealer-section">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="orange">一级佣金30%</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="firstUserId">
|
|
||||||
{{ form.firstUserId }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称" name="firstNickname">
|
|
||||||
{{ form.firstNickname }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="占比" name="rate">
|
|
||||||
{{ '30%' }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="获取收益" name="firstMoney">
|
|
||||||
{{ form.firstMoney }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 二级分销商 -->
|
|
||||||
<div class="dealer-section">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="orange">二级佣金10%</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="secondUserId">
|
|
||||||
{{ form.secondUserId }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称" name="nickname">
|
|
||||||
{{ form.secondNickname }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="占比" name="rate"> 10% </a-form-item>
|
|
||||||
<a-form-item label="获取收益" name="firstMoney">
|
|
||||||
{{ form.secondMoney }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 三级分销商 -->
|
|
||||||
<div class="dealer-section" v-if="form.thirdUserId > 0">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="orange">三级佣金60%</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="thirdUserId">
|
|
||||||
{{ form.thirdUserId }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称" name="thirdNickname">
|
|
||||||
{{ form.thirdNickname }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="占比" name="rate">
|
|
||||||
{{ '60%' }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="获取收益" name="thirdMoney">
|
|
||||||
{{ form.thirdMoney }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a-form-item
|
|
||||||
label="结算时间"
|
|
||||||
name="settleTime"
|
|
||||||
v-if="form.isSettled === 1"
|
|
||||||
>
|
|
||||||
{{ form.settleTime }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject } from 'ele-admin-pro';
|
|
||||||
import { ShopDealerOrder } from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { updateShopDealerOrder} from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerOrder | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const form = reactive<ShopDealerOrder>({
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
nickname: undefined,
|
|
||||||
orderNo: undefined,
|
|
||||||
title: undefined,
|
|
||||||
orderPrice: undefined,
|
|
||||||
settledPrice: undefined,
|
|
||||||
degreePrice: undefined,
|
|
||||||
price: undefined,
|
|
||||||
month: undefined,
|
|
||||||
payPrice: undefined,
|
|
||||||
firstUserId: undefined,
|
|
||||||
secondUserId: undefined,
|
|
||||||
thirdUserId: undefined,
|
|
||||||
firstMoney: undefined,
|
|
||||||
secondMoney: undefined,
|
|
||||||
thirdMoney: undefined,
|
|
||||||
firstNickname: undefined,
|
|
||||||
secondNickname: undefined,
|
|
||||||
thirdNickname: undefined,
|
|
||||||
rate: undefined,
|
|
||||||
comments: undefined,
|
|
||||||
isInvalid: 0,
|
|
||||||
isSettled: 0,
|
|
||||||
settleTime: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (form.isSettled == 1) {
|
|
||||||
message.error('请勿重复结算');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (form.userId == 0) {
|
|
||||||
message.error('未签约');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form,
|
|
||||||
isSettled: 1
|
|
||||||
};
|
|
||||||
updateShopDealerOrder(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log(localStorage.getItem(''));
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
// 重置为默认值
|
|
||||||
Object.assign(form, {
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
orderNo: undefined,
|
|
||||||
orderPrice: undefined,
|
|
||||||
firstUserId: undefined,
|
|
||||||
secondUserId: undefined,
|
|
||||||
thirdUserId: undefined,
|
|
||||||
firstMoney: undefined,
|
|
||||||
secondMoney: undefined,
|
|
||||||
thirdMoney: undefined,
|
|
||||||
isInvalid: 0,
|
|
||||||
isSettled: 0,
|
|
||||||
settleTime: undefined
|
|
||||||
});
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.dealer-section {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
padding: 16px;
|
|
||||||
background: #fafafa;
|
|
||||||
border-radius: 6px;
|
|
||||||
border-left: 3px solid #1890ff;
|
|
||||||
|
|
||||||
.dealer-title {
|
|
||||||
margin: 0 0 16px 0;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
|
|
||||||
.ant-tag {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
|
||||||
margin: 24px 0 16px 0;
|
|
||||||
|
|
||||||
.ant-divider-inner-text {
|
|
||||||
padding: 0 16px 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,448 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="id"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
v-model:selection="selection"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@batchSettle="batchSettle"
|
|
||||||
@export="handleExport"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@importDone="reload"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'title'">
|
|
||||||
<div>{{ record.title }}</div>
|
|
||||||
<div class="text-gray-400">用户ID:{{ record.userId }}</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'orderPrice'">
|
|
||||||
{{ record.orderPrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'degreePrice'">
|
|
||||||
{{ record.degreePrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'price'">
|
|
||||||
{{ record.price }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'settledPrice'">
|
|
||||||
{{ record.settledPrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'payPrice'">
|
|
||||||
{{ record.payPrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'dealerInfo'">
|
|
||||||
<div class="dealer-info">
|
|
||||||
<div v-if="record.firstUserId" class="dealer-level">
|
|
||||||
<a-tag color="red">一级</a-tag>
|
|
||||||
用户{{ record.firstUserId }} - ¥{{
|
|
||||||
parseFloat(record.firstMoney || '0').toFixed(2)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div v-if="record.secondUserId" class="dealer-level">
|
|
||||||
<a-tag color="orange">二级</a-tag>
|
|
||||||
用户{{ record.secondUserId }} - ¥{{
|
|
||||||
parseFloat(record.secondMoney || '0').toFixed(2)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div v-if="record.thirdUserId" class="dealer-level">
|
|
||||||
<a-tag color="gold">三级</a-tag>
|
|
||||||
用户{{ record.thirdUserId }} - ¥{{
|
|
||||||
parseFloat(record.thirdMoney || '0').toFixed(2)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'isInvalid'">
|
|
||||||
<a-tag v-if="record.isInvalid === 0" color="success">已签约</a-tag>
|
|
||||||
<a-tag v-if="record.isInvalid === 1" color="error">未签约</a-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'isSettled'">
|
|
||||||
<a-tag v-if="record.isSettled === 0" color="orange">未结算</a-tag>
|
|
||||||
<a-tag v-if="record.isSettled === 1" color="success">已结算</a-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'createTime'">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<a-tooltip title="创建时间">
|
|
||||||
<span class="text-gray-500">{{ record.createTime }}</span>
|
|
||||||
</a-tooltip>
|
|
||||||
<a-tooltip title="结算时间">
|
|
||||||
<span class="text-purple-500">{{ record.settleTime }}</span>
|
|
||||||
</a-tooltip>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
|
||||||
<a @click="openEdit(record)" class="ele-text-success"> 结算 </a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
</template>
|
|
||||||
<a-popconfirm
|
|
||||||
v-if="record.isSettled === 0"
|
|
||||||
title="确定要删除吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
placement="topRight"
|
|
||||||
>
|
|
||||||
<a class="text-red-500"> 删除 </a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<ShopDealerOrderEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
|
||||||
</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 Search from './components/search.vue';
|
|
||||||
import { getPageTitle } from '@/utils/common';
|
|
||||||
import ShopDealerOrderEdit from './components/shopDealerOrderEdit.vue';
|
|
||||||
import {
|
|
||||||
pageShopDealerOrder,
|
|
||||||
removeShopDealerOrder,
|
|
||||||
removeBatchShopDealerOrder
|
|
||||||
} from '@/api/shop/shopDealerOrder';
|
|
||||||
import type {
|
|
||||||
ShopDealerOrder,
|
|
||||||
ShopDealerOrderParam
|
|
||||||
} from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import { exportShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ShopDealerOrder[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ShopDealerOrder | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 当前搜索条件
|
|
||||||
const currentWhere = ref<ShopDealerOrderParam>({});
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
// 保存当前搜索条件用于导出
|
|
||||||
currentWhere.value = { ...where };
|
|
||||||
// 未结算订单
|
|
||||||
where.isSettled = 0;
|
|
||||||
where.myOrder = 1;
|
|
||||||
return pageShopDealerOrder({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '订单编号',
|
|
||||||
dataIndex: 'orderNo',
|
|
||||||
key: 'orderNo'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '客户名称',
|
|
||||||
dataIndex: 'title',
|
|
||||||
key: 'title',
|
|
||||||
width: 220
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '结算电量',
|
|
||||||
dataIndex: 'orderPrice',
|
|
||||||
key: 'orderPrice',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '换算成度',
|
|
||||||
dataIndex: 'degreePrice',
|
|
||||||
key: 'degreePrice',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '结算单价',
|
|
||||||
dataIndex: 'price',
|
|
||||||
key: 'price',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '结算金额',
|
|
||||||
dataIndex: 'settledPrice',
|
|
||||||
key: 'settledPrice',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '税费',
|
|
||||||
dataIndex: 'rate',
|
|
||||||
key: 'rate',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '实发金额',
|
|
||||||
dataIndex: 'payPrice',
|
|
||||||
key: 'payPrice',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '签约状态',
|
|
||||||
dataIndex: 'isInvalid',
|
|
||||||
key: 'isInvalid',
|
|
||||||
align: 'center',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '月份',
|
|
||||||
dataIndex: 'month',
|
|
||||||
key: 'month',
|
|
||||||
align: 'center',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '结算状态',
|
|
||||||
dataIndex: 'isSettled',
|
|
||||||
key: 'isSettled',
|
|
||||||
align: 'center',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerOrderParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量结算 */
|
|
||||||
const batchSettle = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const validOrders = selection.value.filter(
|
|
||||||
(order) => order.isSettled === 0 && order.isInvalid === 0
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!validOrders.length) {
|
|
||||||
message.error('所选订单中没有可结算的订单');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const totalCommission = validOrders
|
|
||||||
.reduce((sum, order) => {
|
|
||||||
return (
|
|
||||||
sum +
|
|
||||||
parseFloat(order.firstMoney || '0') +
|
|
||||||
parseFloat(order.secondMoney || '0') +
|
|
||||||
parseFloat(order.thirdMoney || '0')
|
|
||||||
);
|
|
||||||
}, 0)
|
|
||||||
.toFixed(2);
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '批量结算确认',
|
|
||||||
content: `确定要结算选中的 ${validOrders.length} 个订单吗?总佣金金额:¥${totalCommission}`,
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
okText: '确认结算',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('正在批量结算...', 0);
|
|
||||||
// 这里调用批量结算API
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success(`成功结算 ${validOrders.length} 个订单`);
|
|
||||||
reload();
|
|
||||||
}, 1500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const handleExport = () => {
|
|
||||||
// 调用导出API,传入当前搜索条件
|
|
||||||
exportShopDealerOrder(currentWhere.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerOrder) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerOrder) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeShopDealerOrder(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchShopDealerOrder(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerOrder) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ShopDealerOrder'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.order-info {
|
|
||||||
.order-id {
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-price {
|
|
||||||
color: #ff4d4f;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dealer-info {
|
|
||||||
.dealer-level {
|
|
||||||
margin-bottom: 6px;
|
|
||||||
font-size: 12px;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.detail-section) {
|
|
||||||
h4 {
|
|
||||||
color: #1890ff;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
border-bottom: 1px solid #f0f0f0;
|
|
||||||
padding-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 4px 0;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-table-tbody > tr > td) {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-tag) {
|
|
||||||
margin: 2px 4px 2px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
<!-- 经销商订单导入弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="520"
|
|
||||||
:footer="null"
|
|
||||||
title="导入分销订单"
|
|
||||||
:visible="visible"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
>
|
|
||||||
<a-spin :spinning="loading">
|
|
||||||
<a-upload-dragger
|
|
||||||
accept=".xls,.xlsx"
|
|
||||||
:show-upload-list="false"
|
|
||||||
:customRequest="doUpload"
|
|
||||||
style="padding: 24px 0; margin-bottom: 16px"
|
|
||||||
>
|
|
||||||
<p class="ant-upload-drag-icon">
|
|
||||||
<cloud-upload-outlined />
|
|
||||||
</p>
|
|
||||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
|
||||||
</a-upload-dragger>
|
|
||||||
</a-spin>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { message } from 'ant-design-vue/es';
|
|
||||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
|
||||||
import { importShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
// 是否打开弹窗
|
|
||||||
visible: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 导入请求状态
|
|
||||||
const loading = ref(false);
|
|
||||||
|
|
||||||
/* 上传 */
|
|
||||||
const doUpload = ({ file }) => {
|
|
||||||
if (
|
|
||||||
![
|
|
||||||
'application/vnd.ms-excel',
|
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
||||||
].includes(file.type)
|
|
||||||
) {
|
|
||||||
message.error('只能选择 excel 文件');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (file.size / 1024 / 1024 > 10) {
|
|
||||||
message.error('大小不能超过 10MB');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
importShopDealerOrder(file)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 更新 visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
|
||||||
<a-input-search
|
|
||||||
allow-clear
|
|
||||||
placeholder="客户名称|订单编号"
|
|
||||||
style="width: 240px"
|
|
||||||
v-model:value="where.keywords"
|
|
||||||
@search="reload"
|
|
||||||
/>
|
|
||||||
<a-button type="dashed" @click="handleExport">导出xls</a-button>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
import { utils, writeFile } from 'xlsx';
|
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
import { ShopDealerCapital } from '@/api/shop/shopDealerCapital/model';
|
|
||||||
import { getTenantId } from '@/utils/domain';
|
|
||||||
import useSearch from '@/utils/use-search';
|
|
||||||
import {
|
|
||||||
ShopDealerOrder,
|
|
||||||
ShopDealerOrderParam
|
|
||||||
} from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import { pageShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的角色
|
|
||||||
selection?: [];
|
|
||||||
}>(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: GradeParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const reload = () => {
|
|
||||||
emit('search', where);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const { where } = useSearch<ShopDealerOrderParam>({
|
|
||||||
keywords: '',
|
|
||||||
userId: undefined,
|
|
||||||
orderNo: undefined,
|
|
||||||
limit: 5000
|
|
||||||
});
|
|
||||||
|
|
||||||
const list = ref<ShopDealerCapital[]>([]);
|
|
||||||
|
|
||||||
// 导出
|
|
||||||
const handleExport = async () => {
|
|
||||||
const array: (string | number)[][] = [
|
|
||||||
[
|
|
||||||
'客户名称',
|
|
||||||
'业务员',
|
|
||||||
'订单编号',
|
|
||||||
'结算电量',
|
|
||||||
'换算成度',
|
|
||||||
'结算单价',
|
|
||||||
'结算金额',
|
|
||||||
'税费',
|
|
||||||
'实发金额',
|
|
||||||
'一级佣金30%',
|
|
||||||
'一级佣金收益',
|
|
||||||
'二级佣金10%',
|
|
||||||
'二级佣金收益',
|
|
||||||
'三级佣金60%',
|
|
||||||
'三级佣金收益',
|
|
||||||
'月份',
|
|
||||||
'创建时间',
|
|
||||||
'结算时间',
|
|
||||||
'租户ID'
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// 按搜索结果导出
|
|
||||||
await pageShopDealerOrder(where)
|
|
||||||
.then((data) => {
|
|
||||||
list.value = data?.list || [];
|
|
||||||
list.value?.forEach((d: ShopDealerOrder) => {
|
|
||||||
array.push([
|
|
||||||
`${d.title}`,
|
|
||||||
`${d.nickname}(${d.userId})`,
|
|
||||||
`${d.orderNo}`,
|
|
||||||
`${d.orderPrice}`,
|
|
||||||
`${d.degreePrice}`,
|
|
||||||
`${d.price}`,
|
|
||||||
`${d.settledPrice}`,
|
|
||||||
`${d.rate}`,
|
|
||||||
`${d.payPrice}`,
|
|
||||||
`${d.firstNickname}(${d.firstUserId})`,
|
|
||||||
`${d.firstMoney}`,
|
|
||||||
`${d.secondNickname}(${d.secondUserId})`,
|
|
||||||
`${d.secondMoney}`,
|
|
||||||
`${d.thirdNickname}(${d.thirdUserId})`,
|
|
||||||
`${d.thirdMoney}`,
|
|
||||||
`${d.month}`,
|
|
||||||
`${d.createTime}`,
|
|
||||||
`${d.settleTime}`,
|
|
||||||
`${d.tenantId}`
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
const sheetName = `bak_shop_dealer_order_${getTenantId()}`;
|
|
||||||
const workbook = {
|
|
||||||
SheetNames: [sheetName],
|
|
||||||
Sheets: {}
|
|
||||||
};
|
|
||||||
const sheet = utils.aoa_to_sheet(array);
|
|
||||||
workbook.Sheets[sheetName] = sheet;
|
|
||||||
// 设置列宽
|
|
||||||
sheet['!cols'] = [
|
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 20 },
|
|
||||||
{ wch: 20 },
|
|
||||||
{ wch: 15 },
|
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 10 },
|
|
||||||
{ wch: 20 }
|
|
||||||
];
|
|
||||||
message.loading('正在导出...');
|
|
||||||
setTimeout(() => {
|
|
||||||
writeFile(workbook, `${sheetName}.xlsx`);
|
|
||||||
}, 1000);
|
|
||||||
})
|
|
||||||
.catch((msg) => {
|
|
||||||
message.error(msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,333 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="900"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '分销订单' : '分销订单'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
:okText="`立即结算`"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="{ span: 6 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
>
|
|
||||||
<!-- 订单基本信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">基本信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="订单编号" name="orderNo">
|
|
||||||
{{ form.orderNo }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="订单金额" name="payPrice">
|
|
||||||
{{ parseFloat(form.payPrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
<!-- <div class="font-bold text-gray-400 bg-gray-50">开发调试</div>-->
|
|
||||||
<!-- <div class="text-gray-400 bg-gray-50">-->
|
|
||||||
<!-- <div>业务员({{ form.userId }}):{{ form.nickname }}</div>-->
|
|
||||||
<!-- <div-->
|
|
||||||
<!-- >一级分销商({{ form.firstUserId }}):{{-->
|
|
||||||
<!-- form.firstNickname-->
|
|
||||||
<!-- }},一级佣金30%:{{ form.firstMoney }}</div-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <div-->
|
|
||||||
<!-- >二级分销商({{ form.secondUserId }}):{{-->
|
|
||||||
<!-- form.secondNickname-->
|
|
||||||
<!-- }},二级佣金10%:{{ form.secondMoney }}</div-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <div-->
|
|
||||||
<!-- >三级分销商({{ form.thirdUserId }}):{{-->
|
|
||||||
<!-- form.thirdNickname-->
|
|
||||||
<!-- }},三级佣金60%:{{ form.thirdMoney }}</div-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- 分销商信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">收益计算</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<!-- 一级分销商 -->
|
|
||||||
<div class="dealer-section">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="orange">一级佣金10%</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="firstUserId">
|
|
||||||
{{ form.firstUserId }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称" name="firstNickname">
|
|
||||||
{{ form.firstNickname }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="占比" name="rate">
|
|
||||||
{{ '10%' }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="获取收益" name="firstMoney">
|
|
||||||
{{ form.firstMoney }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 二级分销商 -->
|
|
||||||
<div class="dealer-section">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="orange">二级佣金10%</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="secondUserId">
|
|
||||||
{{ form.secondUserId }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称" name="nickname">
|
|
||||||
{{ form.secondNickname }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="占比" name="rate"> 10% </a-form-item>
|
|
||||||
<a-form-item label="获取收益" name="firstMoney">
|
|
||||||
{{ form.secondMoney }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 三级分销商 -->
|
|
||||||
<div class="dealer-section" v-if="form.thirdUserId > 0">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="orange">三级佣金60%</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="thirdUserId">
|
|
||||||
{{ form.thirdUserId }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称" name="thirdNickname">
|
|
||||||
{{ form.thirdNickname }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="占比" name="rate">
|
|
||||||
{{ '60%' }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="获取收益" name="thirdMoney">
|
|
||||||
{{ form.thirdMoney }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a-form-item
|
|
||||||
label="结算时间"
|
|
||||||
name="settleTime"
|
|
||||||
v-if="form.isSettled === 1"
|
|
||||||
>
|
|
||||||
{{ form.settleTime }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject } from 'ele-admin-pro';
|
|
||||||
import { ShopDealerOrder } from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { updateShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerOrder | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const form = reactive<ShopDealerOrder>({
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
nickname: undefined,
|
|
||||||
orderNo: undefined,
|
|
||||||
title: undefined,
|
|
||||||
orderPrice: undefined,
|
|
||||||
settledPrice: undefined,
|
|
||||||
degreePrice: undefined,
|
|
||||||
price: undefined,
|
|
||||||
month: undefined,
|
|
||||||
payPrice: undefined,
|
|
||||||
firstUserId: undefined,
|
|
||||||
secondUserId: undefined,
|
|
||||||
thirdUserId: undefined,
|
|
||||||
firstMoney: undefined,
|
|
||||||
secondMoney: undefined,
|
|
||||||
thirdMoney: undefined,
|
|
||||||
firstNickname: undefined,
|
|
||||||
secondNickname: undefined,
|
|
||||||
thirdNickname: undefined,
|
|
||||||
rate: undefined,
|
|
||||||
comments: undefined,
|
|
||||||
isInvalid: 0,
|
|
||||||
isSettled: 0,
|
|
||||||
settleTime: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (form.isSettled == 1) {
|
|
||||||
message.error('请勿重复结算');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (form.userId == 0) {
|
|
||||||
message.error('未签约');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form,
|
|
||||||
isSettled: 1
|
|
||||||
};
|
|
||||||
updateShopDealerOrder(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log(localStorage.getItem(''));
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
// 重置为默认值
|
|
||||||
Object.assign(form, {
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
orderNo: undefined,
|
|
||||||
orderPrice: undefined,
|
|
||||||
firstUserId: undefined,
|
|
||||||
secondUserId: undefined,
|
|
||||||
thirdUserId: undefined,
|
|
||||||
firstMoney: undefined,
|
|
||||||
secondMoney: undefined,
|
|
||||||
thirdMoney: undefined,
|
|
||||||
isInvalid: 0,
|
|
||||||
isSettled: 0,
|
|
||||||
settleTime: undefined
|
|
||||||
});
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.dealer-section {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
padding: 16px;
|
|
||||||
background: #fafafa;
|
|
||||||
border-radius: 6px;
|
|
||||||
border-left: 3px solid #1890ff;
|
|
||||||
|
|
||||||
.dealer-title {
|
|
||||||
margin: 0 0 16px 0;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
|
|
||||||
.ant-tag {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
|
||||||
margin: 24px 0 16px 0;
|
|
||||||
|
|
||||||
.ant-divider-inner-text {
|
|
||||||
padding: 0 16px 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,500 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="id"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@batchSettle="batchSettle"
|
|
||||||
@export="handleExport"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@importDone="reload"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'title'">
|
|
||||||
<div>{{ record.title }}</div>
|
|
||||||
<div class="text-gray-400"
|
|
||||||
>{{ record.nickname }}({{ record.userId }})</div
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'orderPrice'">
|
|
||||||
{{ parseFloat(record.orderPrice).toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'degreePrice'">
|
|
||||||
{{ record.degreePrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'price'">
|
|
||||||
{{ record.price || 0 }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'settledPrice'">
|
|
||||||
{{ record.settledPrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'payPrice'">
|
|
||||||
{{ record.payPrice.toFixed(2) }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'firstNickname'">
|
|
||||||
<div>{{ record.firstMoney }}</div>
|
|
||||||
<div class="text-gray-400">{{ record.firstNickname || '-' }}</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'secondNickname'">
|
|
||||||
<div>{{ record.secondMoney }}</div>
|
|
||||||
<div class="text-gray-400">{{ record.secondNickname || '-' }}</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'thirdNickname'">
|
|
||||||
<div class="text-gray-400"
|
|
||||||
>{{ record.thirdNickname || '-' }} {{ record.thirdMoney }}</div
|
|
||||||
>
|
|
||||||
<!-- <div class="text-gray-400" v-if="record.thirdNickname"-->
|
|
||||||
<!-- >{{ record.thirdNickname }} {{ record.thirdMoney }}</div-->
|
|
||||||
<!-- >-->
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'dealerInfo'">
|
|
||||||
<div class="dealer-info">
|
|
||||||
<div v-if="record.firstUserId" class="dealer-level">
|
|
||||||
<a-tag color="red">一级</a-tag>
|
|
||||||
用户{{ record.firstUserId }} - ¥{{
|
|
||||||
parseFloat(record.firstMoney || '0').toFixed(2)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div v-if="record.secondUserId" class="dealer-level">
|
|
||||||
<a-tag color="orange">二级</a-tag>
|
|
||||||
用户{{ record.secondUserId }} - ¥{{
|
|
||||||
parseFloat(record.secondMoney || '0').toFixed(2)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div v-if="record.thirdUserId" class="dealer-level">
|
|
||||||
<a-tag color="gold">三级</a-tag>
|
|
||||||
用户{{ record.thirdUserId }} - ¥{{
|
|
||||||
parseFloat(record.thirdMoney || '0').toFixed(2)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'isInvalid'">
|
|
||||||
<a-tag v-if="record.isInvalid === 0" color="success">已签约</a-tag>
|
|
||||||
<a-tag v-if="record.isInvalid === 1" color="error">未签约</a-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'isSettled'">
|
|
||||||
<a-tag v-if="record.isSettled === 0" color="orange">未结算</a-tag>
|
|
||||||
<a-tag v-if="record.isSettled === 1" color="success">已结算</a-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'createTime'">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<a-tooltip title="创建时间">
|
|
||||||
<span class="text-gray-500">{{ record.createTime }}</span>
|
|
||||||
</a-tooltip>
|
|
||||||
<a-tooltip title="结算时间">
|
|
||||||
<span class="text-purple-500">{{ record.settleTime }}</span>
|
|
||||||
</a-tooltip>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
|
||||||
<a @click="settleOrder(record)" class="ele-text-success">
|
|
||||||
结算
|
|
||||||
</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
</template>
|
|
||||||
<!-- <template v-if="record.isInvalid === 0">-->
|
|
||||||
<!-- <a-popconfirm-->
|
|
||||||
<!-- title="确定要标记此订单为失效吗?"-->
|
|
||||||
<!-- @confirm="invalidateOrder(record)"-->
|
|
||||||
<!-- placement="topRight"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <a class="text-purple-500">-->
|
|
||||||
<!-- 验证-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- </a-popconfirm>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<a-popconfirm
|
|
||||||
v-if="record.isSettled === 0"
|
|
||||||
title="确定要删除吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
placement="topRight"
|
|
||||||
>
|
|
||||||
<a class="text-red-500"> 删除 </a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<ShopDealerOrderEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import {
|
|
||||||
ExclamationCircleOutlined,
|
|
||||||
DollarOutlined
|
|
||||||
} 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 Search from './components/search.vue';
|
|
||||||
import { getPageTitle } from '@/utils/common';
|
|
||||||
import ShopDealerOrderEdit from './components/shopDealerOrderEdit.vue';
|
|
||||||
import {
|
|
||||||
pageShopDealerOrder,
|
|
||||||
removeShopDealerOrder,
|
|
||||||
removeBatchShopDealerOrder
|
|
||||||
} from '@/api/shop/shopDealerOrder';
|
|
||||||
import type {
|
|
||||||
ShopDealerOrder,
|
|
||||||
ShopDealerOrderParam
|
|
||||||
} from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import {
|
|
||||||
exportShopDealerOrder,
|
|
||||||
updateShopDealerOrder
|
|
||||||
} from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ShopDealerOrder[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ShopDealerOrder | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 当前搜索条件
|
|
||||||
const currentWhere = ref<ShopDealerOrderParam>({});
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
// 保存当前搜索条件用于导出
|
|
||||||
currentWhere.value = { ...where };
|
|
||||||
// 已结算订单
|
|
||||||
where.isSettled = 1;
|
|
||||||
return pageShopDealerOrder({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
key: 'index',
|
|
||||||
width: 48,
|
|
||||||
align: 'center',
|
|
||||||
fixed: 'left',
|
|
||||||
hideInSetting: true,
|
|
||||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '订单编号',
|
|
||||||
dataIndex: 'orderNo',
|
|
||||||
key: 'orderNo',
|
|
||||||
align: 'center',
|
|
||||||
width: 200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '买家',
|
|
||||||
dataIndex: 'title',
|
|
||||||
key: 'title'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '订单金额',
|
|
||||||
dataIndex: 'orderPrice',
|
|
||||||
key: 'orderPrice',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '一级佣金',
|
|
||||||
dataIndex: 'firstNickname',
|
|
||||||
key: 'firstNickname',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '二级佣金',
|
|
||||||
dataIndex: 'secondNickname',
|
|
||||||
key: 'secondNickname',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '门店分红',
|
|
||||||
dataIndex: 'thirdNickname',
|
|
||||||
key: 'thirdNickname',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '结算状态',
|
|
||||||
dataIndex: 'isSettled',
|
|
||||||
key: 'isSettled',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
width: 180
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
// title: '操作',
|
|
||||||
// key: 'action',
|
|
||||||
// width: 180,
|
|
||||||
// fixed: 'right',
|
|
||||||
// align: 'center',
|
|
||||||
// hideInSetting: true
|
|
||||||
// }
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerOrderParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 结算单个订单 */
|
|
||||||
const settleOrder = (row: ShopDealerOrder) => {
|
|
||||||
const totalCommission = (
|
|
||||||
parseFloat(row.firstMoney || '0') +
|
|
||||||
parseFloat(row.secondMoney || '0') +
|
|
||||||
parseFloat(row.thirdMoney || '0')
|
|
||||||
).toFixed(2);
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '确认结算',
|
|
||||||
content: `确定要结算此订单吗?总佣金金额:¥${totalCommission}`,
|
|
||||||
icon: createVNode(DollarOutlined),
|
|
||||||
okText: '确认结算',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('正在结算...', 0);
|
|
||||||
// 这里调用结算API
|
|
||||||
updateShopDealerOrder({
|
|
||||||
...row,
|
|
||||||
isSettled: 1
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('结算成功');
|
|
||||||
reload();
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量结算 */
|
|
||||||
const batchSettle = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const validOrders = selection.value.filter(
|
|
||||||
(order) => order.isSettled === 0 && order.isInvalid === 0
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!validOrders.length) {
|
|
||||||
message.error('所选订单中没有可结算的订单');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const totalCommission = validOrders
|
|
||||||
.reduce((sum, order) => {
|
|
||||||
return (
|
|
||||||
sum +
|
|
||||||
parseFloat(order.firstMoney || '0') +
|
|
||||||
parseFloat(order.secondMoney || '0') +
|
|
||||||
parseFloat(order.thirdMoney || '0')
|
|
||||||
);
|
|
||||||
}, 0)
|
|
||||||
.toFixed(2);
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '批量结算确认',
|
|
||||||
content: `确定要结算选中的 ${validOrders.length} 个订单吗?总佣金金额:¥${totalCommission}`,
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
okText: '确认结算',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('正在批量结算...', 0);
|
|
||||||
// 这里调用批量结算API
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success(`成功结算 ${validOrders.length} 个订单`);
|
|
||||||
reload();
|
|
||||||
}, 1500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const handleExport = () => {
|
|
||||||
// 调用导出API,传入当前搜索条件
|
|
||||||
exportShopDealerOrder(currentWhere.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerOrder) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerOrder) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeShopDealerOrder(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchShopDealerOrder(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerOrder) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ShopDealerOrder'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.order-info {
|
|
||||||
.order-id {
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-price {
|
|
||||||
color: #ff4d4f;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dealer-info {
|
|
||||||
.dealer-level {
|
|
||||||
margin-bottom: 6px;
|
|
||||||
font-size: 12px;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.detail-section) {
|
|
||||||
h4 {
|
|
||||||
color: #1890ff;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
border-bottom: 1px solid #f0f0f0;
|
|
||||||
padding-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 4px 0;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-table-tbody > tr > td) {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-tag) {
|
|
||||||
margin: 2px 4px 2px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-modal
|
|
||||||
:visible="visible"
|
|
||||||
:title="title"
|
|
||||||
:width="1000"
|
|
||||||
:footer="null"
|
|
||||||
@cancel="handleCancel"
|
|
||||||
>
|
|
||||||
<div class="tree-container">
|
|
||||||
<v-chart
|
|
||||||
ref="chartRef"
|
|
||||||
class="chart"
|
|
||||||
:option="chartOption"
|
|
||||||
:loading="loading"
|
|
||||||
autoresize
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</a-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, watch, computed } from 'vue';
|
|
||||||
import { use } from 'echarts/core';
|
|
||||||
import { CanvasRenderer } from 'echarts/renderers';
|
|
||||||
import { TreeChart } from 'echarts/charts';
|
|
||||||
import { TooltipComponent, TitleComponent } from 'echarts/components';
|
|
||||||
import VChart from 'vue-echarts';
|
|
||||||
import type { ShopDealerReferee } from '@/api/shop/shopDealerReferee/model';
|
|
||||||
|
|
||||||
// 注册 echarts 组件
|
|
||||||
use([CanvasRenderer, TreeChart, TooltipComponent, TitleComponent]);
|
|
||||||
|
|
||||||
// 定义组件属性
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
visible: boolean;
|
|
||||||
data?: ShopDealerReferee[];
|
|
||||||
title?: string;
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
visible: false,
|
|
||||||
data: () => [],
|
|
||||||
title: '推荐关系树'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// 定义事件
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'update:visible', value: boolean): void;
|
|
||||||
(e: 'cancel'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 图表引用
|
|
||||||
const chartRef = ref<InstanceType<typeof VChart> | null>(null);
|
|
||||||
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(false);
|
|
||||||
|
|
||||||
// 处理取消事件
|
|
||||||
const handleCancel = () => {
|
|
||||||
emit('update:visible', false);
|
|
||||||
emit('cancel');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 转换数据为树形结构
|
|
||||||
const transformToTreeData = (data: ShopDealerReferee[]) => {
|
|
||||||
if (!data || data.length === 0) {
|
|
||||||
return { name: '暂无数据', children: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建节点映射
|
|
||||||
const nodeMap = new Map<number, any>();
|
|
||||||
const rootNodes: any[] = [];
|
|
||||||
|
|
||||||
// 创建所有节点
|
|
||||||
data.forEach((item) => {
|
|
||||||
// 推荐人节点
|
|
||||||
if (item.dealerId && !nodeMap.has(item.dealerId)) {
|
|
||||||
nodeMap.set(item.dealerId, {
|
|
||||||
id: item.dealerId,
|
|
||||||
name: `推荐人\nID:${item.dealerId}\n${item.dealerName || ''}`,
|
|
||||||
level: 'dealer',
|
|
||||||
children: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 被推荐人节点
|
|
||||||
if (item.userId && !nodeMap.has(item.userId)) {
|
|
||||||
nodeMap.set(item.userId, {
|
|
||||||
id: item.userId,
|
|
||||||
name: `被推荐人\nID:${item.userId}\n${item.nickname || ''}`,
|
|
||||||
level: 'user',
|
|
||||||
children: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 构建关系树
|
|
||||||
data.forEach((item) => {
|
|
||||||
if (!item.dealerId || !item.userId) return;
|
|
||||||
|
|
||||||
const dealerNode = nodeMap.get(item.dealerId);
|
|
||||||
const userNode = nodeMap.get(item.userId);
|
|
||||||
|
|
||||||
if (dealerNode && userNode) {
|
|
||||||
// 添加层级标签
|
|
||||||
const levelText =
|
|
||||||
{ 1: '一级', 2: '二级', 3: '三级' }[item.level || 0] ||
|
|
||||||
`${item.level || 0}级`;
|
|
||||||
userNode.name += `\n${levelText}推荐`;
|
|
||||||
dealerNode.children.push(userNode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 查找根节点(没有被推荐关系的节点)
|
|
||||||
const referencedIds = new Set(
|
|
||||||
data.map((item) => item.userId).filter((id) => id)
|
|
||||||
);
|
|
||||||
data.forEach((item) => {
|
|
||||||
if (item.dealerId && !referencedIds.has(item.dealerId)) {
|
|
||||||
const rootNode = nodeMap.get(item.dealerId);
|
|
||||||
if (rootNode) {
|
|
||||||
rootNodes.push(rootNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 如果没有明确的根节点,使用第一个节点作为根
|
|
||||||
if (rootNodes.length === 0 && data.length > 0 && data[0].dealerId) {
|
|
||||||
const firstNode = nodeMap.get(data[0].dealerId);
|
|
||||||
if (firstNode) {
|
|
||||||
rootNodes.push(firstNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果还是没有根节点,返回默认节点
|
|
||||||
if (rootNodes.length === 0) {
|
|
||||||
return { name: '暂无数据', children: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
return rootNodes[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
// 图表配置
|
|
||||||
const chartOption = computed(() => {
|
|
||||||
const treeData = transformToTreeData(props.data || []);
|
|
||||||
|
|
||||||
return {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'item',
|
|
||||||
triggerOn: 'mousemove'
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
type: 'tree',
|
|
||||||
data: [treeData],
|
|
||||||
top: '1%',
|
|
||||||
left: '7%',
|
|
||||||
bottom: '1%',
|
|
||||||
right: '20%',
|
|
||||||
symbolSize: 12,
|
|
||||||
symbol: 'circle',
|
|
||||||
orient: 'LR', // 从左到右
|
|
||||||
expandAndCollapse: true,
|
|
||||||
label: {
|
|
||||||
position: 'left',
|
|
||||||
verticalAlign: 'middle',
|
|
||||||
align: 'right',
|
|
||||||
fontSize: 12,
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
padding: [2, 4],
|
|
||||||
borderRadius: 4,
|
|
||||||
borderWidth: 1,
|
|
||||||
borderColor: '#ccc'
|
|
||||||
},
|
|
||||||
leaves: {
|
|
||||||
label: {
|
|
||||||
position: 'right',
|
|
||||||
verticalAlign: 'middle',
|
|
||||||
align: 'left'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
focus: 'descendant'
|
|
||||||
},
|
|
||||||
animationDuration: 500,
|
|
||||||
animationDurationUpdate: 750
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.tree-container {
|
|
||||||
height: 600px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<!-- 搜索表单 -->
|
|
||||||
<a-form
|
|
||||||
:model="searchForm"
|
|
||||||
layout="inline"
|
|
||||||
class="search-form"
|
|
||||||
@finish="handleSearch"
|
|
||||||
>
|
|
||||||
<a-form-item label="推荐人ID">
|
|
||||||
<a-input-number
|
|
||||||
v-model:value="searchForm.dealerId"
|
|
||||||
placeholder="请输入推荐人ID"
|
|
||||||
:min="1"
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="被推荐人ID">
|
|
||||||
<a-input-number
|
|
||||||
v-model:value="searchForm.userId"
|
|
||||||
placeholder="请输入被推荐人ID"
|
|
||||||
:min="1"
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="建立时间">
|
|
||||||
<a-range-picker
|
|
||||||
v-model:value="searchForm.dateRange"
|
|
||||||
style="width: 240px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
|
||||||
<template #icon>
|
|
||||||
<SearchOutlined />
|
|
||||||
</template>
|
|
||||||
搜索
|
|
||||||
</a-button>
|
|
||||||
<a-button @click="resetSearch"> 重置 </a-button>
|
|
||||||
<a-button @click="exportData" class="ele-btn-icon">
|
|
||||||
<template #icon>
|
|
||||||
<ExportOutlined />
|
|
||||||
</template>
|
|
||||||
导出
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
|
||||||
<!-- <div class="action-buttons">-->
|
|
||||||
<!-- <a-space>-->
|
|
||||||
<!-- <a-button type="primary" @click="add" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <PlusOutlined/>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 建立推荐关系-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<!-- <a-button @click="viewTree" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <ApartmentOutlined/>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 推荐关系树-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<!-- <a-button @click="exportData" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <ExportOutlined/>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 导出数据-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<!-- </a-space>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { reactive } from 'vue';
|
|
||||||
import {
|
|
||||||
PlusOutlined,
|
|
||||||
SearchOutlined,
|
|
||||||
ApartmentOutlined,
|
|
||||||
ExportOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { ShopDealerRefereeParam } from '@/api/shop/shopDealerReferee/model';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的数据
|
|
||||||
selection?: any[];
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
selection: () => []
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: ShopDealerRefereeParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'viewTree'): void;
|
|
||||||
(e: 'export'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 搜索表单
|
|
||||||
const searchForm = reactive<any>({
|
|
||||||
dealerId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
level: undefined,
|
|
||||||
dateRange: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const handleSearch = () => {
|
|
||||||
const searchParams: ShopDealerRefereeParam = {};
|
|
||||||
|
|
||||||
if (searchForm.dealerId) {
|
|
||||||
searchParams.dealerId = searchForm.dealerId;
|
|
||||||
}
|
|
||||||
if (searchForm.userId) {
|
|
||||||
searchParams.userId = searchForm.userId;
|
|
||||||
}
|
|
||||||
if (searchForm.level) {
|
|
||||||
searchParams.level = searchForm.level;
|
|
||||||
}
|
|
||||||
if (searchForm.dateRange && searchForm.dateRange.length === 2) {
|
|
||||||
searchParams.startTime = dayjs(searchForm.dateRange[0]).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
);
|
|
||||||
searchParams.endTime = dayjs(searchForm.dateRange[1]).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('search', searchParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重置搜索
|
|
||||||
const resetSearch = () => {
|
|
||||||
searchForm.dealerId = undefined;
|
|
||||||
searchForm.userId = undefined;
|
|
||||||
searchForm.level = undefined;
|
|
||||||
searchForm.dateRange = undefined;
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增
|
|
||||||
const add = () => {
|
|
||||||
emit('add');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 查看推荐树
|
|
||||||
const viewTree = () => {
|
|
||||||
emit('viewTree');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 导出数据
|
|
||||||
const exportData = () => {
|
|
||||||
emit('export');
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.search-container {
|
|
||||||
background: #fff;
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
.search-form {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons {
|
|
||||||
border-top: 1px solid #f0f0f0;
|
|
||||||
padding-top: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="800"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑推荐' : '添加推荐关系'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
|
||||||
:wrapper-col="
|
|
||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a-form-item label="推荐人信息" name="dealerId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入分销商用户ID"
|
|
||||||
v-model:value="form.dealerId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="被推荐人信息" name="userId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入用户id(被推荐人)"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject } from 'ele-admin-pro';
|
|
||||||
import {
|
|
||||||
addShopDealerReferee,
|
|
||||||
updateShopDealerReferee
|
|
||||||
} from '@/api/shop/shopDealerReferee';
|
|
||||||
import { ShopDealerReferee } from '@/api/shop/shopDealerReferee/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerReferee | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 用户信息
|
|
||||||
const form = reactive<ShopDealerReferee>({
|
|
||||||
id: undefined,
|
|
||||||
dealerId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
level: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
shopDealerRefereeName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
message: '请填写分销商推荐关系表名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
const saveOrUpdate = isUpdate.value
|
|
||||||
? updateShopDealerReferee
|
|
||||||
: addShopDealerReferee;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
images.value = [];
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,563 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="id"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@viewTree="viewRefereeTree"
|
|
||||||
@export="exportData"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'dealerInfo'">
|
|
||||||
<div class="user-info">
|
|
||||||
<div class="user-id"
|
|
||||||
>{{ record.dealerName }}({{ record.dealerId }})</div
|
|
||||||
>
|
|
||||||
<div class="user-id"></div>
|
|
||||||
<div class="user-role">
|
|
||||||
<a-tag color="blue">推荐人</a-tag>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'relationship'">
|
|
||||||
<ArrowRightOutlined />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'userInfo'">
|
|
||||||
<div class="user-info">
|
|
||||||
<div class="user-id"
|
|
||||||
>{{ record.nickname }}({{ record.userId }})</div
|
|
||||||
>
|
|
||||||
<div class="user-role">
|
|
||||||
<a-tag color="green">被推荐人</a-tag>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'level'">
|
|
||||||
<a-tag :color="getLevelColor(record.level || 0)" class="level-tag">
|
|
||||||
{{ getLevelText(record.level || 0) }}
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'relationChain'">
|
|
||||||
<a-button
|
|
||||||
type="link"
|
|
||||||
size="small"
|
|
||||||
@click="viewRelationChain(record)"
|
|
||||||
class="chain-btn"
|
|
||||||
>
|
|
||||||
<TeamOutlined /> 查看关系链
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)" class="ele-text-primary">
|
|
||||||
<EditOutlined /> 编辑
|
|
||||||
</a>
|
|
||||||
<!-- <a-divider type="vertical" />-->
|
|
||||||
<!-- <a-popconfirm-->
|
|
||||||
<!-- title="确定要解除此推荐关系吗?"-->
|
|
||||||
<!-- @confirm="remove(record)"-->
|
|
||||||
<!-- placement="topRight"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <a class="ele-text-danger">-->
|
|
||||||
<!-- <DisconnectOutlined /> 解除-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- </a-popconfirm>-->
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<ShopDealerRefereeEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 树状图弹窗 -->
|
|
||||||
<RefereeTree
|
|
||||||
v-model:visible="showTree"
|
|
||||||
:data="treeData"
|
|
||||||
:title="'推荐关系树'"
|
|
||||||
@cancel="showTree = false"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import {
|
|
||||||
ExclamationCircleOutlined,
|
|
||||||
TeamOutlined,
|
|
||||||
EditOutlined,
|
|
||||||
ArrowRightOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import { getPageTitle } from '@/utils/common';
|
|
||||||
import ShopDealerRefereeEdit from './components/shopDealerRefereeEdit.vue';
|
|
||||||
import RefereeTree from './components/RefereeTree.vue';
|
|
||||||
import { utils, writeFile } from 'xlsx';
|
|
||||||
import {
|
|
||||||
pageShopDealerReferee,
|
|
||||||
removeShopDealerReferee,
|
|
||||||
removeBatchShopDealerReferee,
|
|
||||||
listShopDealerReferee
|
|
||||||
} from '@/api/shop/shopDealerReferee';
|
|
||||||
import type {
|
|
||||||
ShopDealerReferee,
|
|
||||||
ShopDealerRefereeParam
|
|
||||||
} from '@/api/shop/shopDealerReferee/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ShopDealerReferee[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ShopDealerReferee | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示树状图弹窗
|
|
||||||
const showTree = ref(false);
|
|
||||||
// 树状图数据
|
|
||||||
const treeData = ref<ShopDealerReferee[]>([]);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageShopDealerReferee({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '推荐人信息',
|
|
||||||
key: 'dealerInfo',
|
|
||||||
align: 'left',
|
|
||||||
width: 150
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
key: 'relationship',
|
|
||||||
align: 'center',
|
|
||||||
width: 50
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '被推荐人信息',
|
|
||||||
key: 'userInfo',
|
|
||||||
align: 'left',
|
|
||||||
width: 150
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '推荐层级',
|
|
||||||
// key: 'level',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 120,
|
|
||||||
// filters: [
|
|
||||||
// { text: '一级推荐', value: 1 },
|
|
||||||
// { text: '二级推荐', value: 2 },
|
|
||||||
// { text: '三级推荐', value: 3 }
|
|
||||||
// ]
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '建立时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
width: 120,
|
|
||||||
sorter: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 200,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 获取层级颜色 */
|
|
||||||
const getLevelColor = (level: number) => {
|
|
||||||
const colors = {
|
|
||||||
1: 'red',
|
|
||||||
2: 'orange',
|
|
||||||
3: 'gold'
|
|
||||||
};
|
|
||||||
return colors[level] || 'default';
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 获取层级文本 */
|
|
||||||
const getLevelText = (level: number) => {
|
|
||||||
const texts = {
|
|
||||||
1: '一级推荐',
|
|
||||||
2: '二级推荐',
|
|
||||||
3: '三级推荐'
|
|
||||||
};
|
|
||||||
return texts[level] || `${level}级推荐`;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查看关系链 */
|
|
||||||
const viewRelationChain = (record: ShopDealerReferee) => {
|
|
||||||
// 这里可以调用API获取完整的推荐关系链
|
|
||||||
Modal.info({
|
|
||||||
title: '推荐关系链',
|
|
||||||
width: 800,
|
|
||||||
content: createVNode('div', { class: 'relation-chain' }, [
|
|
||||||
createVNode('div', { class: 'chain-item' }, [
|
|
||||||
createVNode('div', { class: 'chain-node dealer' }, [
|
|
||||||
createVNode('div', { class: 'node-title' }, '推荐人'),
|
|
||||||
createVNode(
|
|
||||||
'div',
|
|
||||||
{ class: 'node-id' },
|
|
||||||
`用户ID: ${record.dealerId}`
|
|
||||||
),
|
|
||||||
createVNode('div', { class: 'node-level' }, '分销商')
|
|
||||||
]),
|
|
||||||
createVNode('div', { class: 'chain-arrow' }, '→'),
|
|
||||||
createVNode('div', { class: 'chain-node user' }, [
|
|
||||||
createVNode('div', { class: 'node-title' }, '被推荐人'),
|
|
||||||
createVNode(
|
|
||||||
'div',
|
|
||||||
{ class: 'node-id' },
|
|
||||||
`用户ID: ${record.userId}`
|
|
||||||
),
|
|
||||||
createVNode(
|
|
||||||
'div',
|
|
||||||
{ class: 'node-level' },
|
|
||||||
getLevelText(record.level || 0)
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
createVNode('div', { class: 'chain-info' }, [
|
|
||||||
createVNode(
|
|
||||||
'p',
|
|
||||||
null,
|
|
||||||
`推荐关系建立于: ${toDateString(
|
|
||||||
record.createTime,
|
|
||||||
'yyyy-MM-dd HH:mm:ss'
|
|
||||||
)}`
|
|
||||||
),
|
|
||||||
createVNode('p', null, '点击可查看更多上下级关系')
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
okText: '关闭'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查看推荐树 */
|
|
||||||
const viewRefereeTree = () => {
|
|
||||||
// 加载所有数据用于树状图展示
|
|
||||||
loading.value = true;
|
|
||||||
pageShopDealerReferee({ page: 1, limit: 10000 }) // 获取所有数据
|
|
||||||
.then((result) => {
|
|
||||||
treeData.value = result?.list || [];
|
|
||||||
showTree.value = true;
|
|
||||||
loading.value = false;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error('加载数据失败: ' + e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const exportData = async () => {
|
|
||||||
try {
|
|
||||||
// 定义表头
|
|
||||||
const array: (string | number)[][] = [
|
|
||||||
[
|
|
||||||
'推荐人',
|
|
||||||
'推荐人ID',
|
|
||||||
'推荐人电话',
|
|
||||||
'被推荐人',
|
|
||||||
'被推荐人ID',
|
|
||||||
'被推荐人电话',
|
|
||||||
'创建时间'
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// 获取用户列表数据
|
|
||||||
const list = await listShopDealerReferee({});
|
|
||||||
|
|
||||||
if (!list || list.length === 0) {
|
|
||||||
message.warning('没有数据可以导出');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将数据转换为Excel行
|
|
||||||
list.forEach((user: ShopDealerReferee) => {
|
|
||||||
array.push([
|
|
||||||
`${user.dealerName}`,
|
|
||||||
`${user.dealerId}`,
|
|
||||||
`${user.dealerPhone}`,
|
|
||||||
`${user.nickname}`,
|
|
||||||
`${user.userId}`,
|
|
||||||
`${user.phone}`,
|
|
||||||
`${user.createTime}`
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 生成Excel文件
|
|
||||||
const sheetName = `shop_dealer_referee`;
|
|
||||||
const workbook = {
|
|
||||||
SheetNames: [sheetName],
|
|
||||||
Sheets: {}
|
|
||||||
};
|
|
||||||
const sheet = utils.aoa_to_sheet(array);
|
|
||||||
workbook.Sheets[sheetName] = sheet;
|
|
||||||
|
|
||||||
// 设置列宽
|
|
||||||
sheet['!cols'] = [
|
|
||||||
{ wch: 10 }, // 用户ID
|
|
||||||
{ wch: 15 } // 账号
|
|
||||||
];
|
|
||||||
|
|
||||||
message.loading('正在生成Excel文件...', 0);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
writeFile(workbook, `${sheetName}.xlsx`);
|
|
||||||
message.destroy();
|
|
||||||
message.success(`成功导出 ${list.length} 条记录`);
|
|
||||||
}, 1000);
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message || '导出失败');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerRefereeParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerReferee) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerReferee) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeShopDealerReferee(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchShopDealerReferee(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerReferee) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ShopDealerReferee'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.user-info {
|
|
||||||
.user-id {
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-role {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.level-tag {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chain-btn {
|
|
||||||
padding: 0;
|
|
||||||
height: auto;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.referee-detail) {
|
|
||||||
.detail-section {
|
|
||||||
h4 {
|
|
||||||
color: #1890ff;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
border-bottom: 1px solid #f0f0f0;
|
|
||||||
padding-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 8px 0;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.level-badge {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.relation-chain) {
|
|
||||||
.chain-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chain-node {
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 8px;
|
|
||||||
text-align: center;
|
|
||||||
min-width: 120px;
|
|
||||||
|
|
||||||
&.dealer {
|
|
||||||
background: #e6f7ff;
|
|
||||||
border: 2px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.user {
|
|
||||||
background: #f6ffed;
|
|
||||||
border: 2px solid #52c41a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.node-title {
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.node-id {
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.node-level {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.chain-arrow {
|
|
||||||
font-size: 24px;
|
|
||||||
color: #1890ff;
|
|
||||||
margin: 0 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chain-info {
|
|
||||||
background: #fafafa;
|
|
||||||
padding: 12px;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin-top: 16px;
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 4px 0;
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-table-tbody > tr > td) {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-tag) {
|
|
||||||
margin: 2px 4px 2px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
<!-- 经销商订单导入弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="520"
|
|
||||||
:footer="null"
|
|
||||||
title="导入分销订单"
|
|
||||||
:visible="visible"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
>
|
|
||||||
<a-spin :spinning="loading">
|
|
||||||
<a-upload-dragger
|
|
||||||
accept=".xls,.xlsx"
|
|
||||||
:show-upload-list="false"
|
|
||||||
:customRequest="doUpload"
|
|
||||||
style="padding: 24px 0; margin-bottom: 16px"
|
|
||||||
>
|
|
||||||
<p class="ant-upload-drag-icon">
|
|
||||||
<cloud-upload-outlined />
|
|
||||||
</p>
|
|
||||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
|
||||||
</a-upload-dragger>
|
|
||||||
<div class="ant-upload-text text-gray-400">
|
|
||||||
<div
|
|
||||||
>1、必须按<a
|
|
||||||
href="https://oss.wsdns.cn/20251018/408b805ec3cd4084a4dc686e130af578.xlsx"
|
|
||||||
target="_blank"
|
|
||||||
>导入模版</a
|
|
||||||
>的格式上传</div
|
|
||||||
>
|
|
||||||
<div>2、导入成功确认结算完成佣金的发放</div>
|
|
||||||
</div>
|
|
||||||
</a-spin>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { message } from 'ant-design-vue/es';
|
|
||||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
|
||||||
import { importShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
// 是否打开弹窗
|
|
||||||
visible: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 导入请求状态
|
|
||||||
const loading = ref(false);
|
|
||||||
|
|
||||||
/* 上传 */
|
|
||||||
const doUpload = ({ file }) => {
|
|
||||||
if (
|
|
||||||
![
|
|
||||||
'application/vnd.ms-excel',
|
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
||||||
].includes(file.type)
|
|
||||||
) {
|
|
||||||
message.error('只能选择 excel 文件');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (file.size / 1024 / 1024 > 10) {
|
|
||||||
message.error('大小不能超过 10MB');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
importShopDealerOrder(file)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 更新 visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex items-center gap-20">
|
|
||||||
<!-- 搜索表单 -->
|
|
||||||
<a-form
|
|
||||||
:model="where"
|
|
||||||
layout="inline"
|
|
||||||
class="search-form"
|
|
||||||
@finish="handleSearch"
|
|
||||||
>
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-button
|
|
||||||
danger
|
|
||||||
class="ele-btn-icon"
|
|
||||||
v-if="selection.length > 0"
|
|
||||||
:disabled="selection?.length === 0"
|
|
||||||
@click="removeBatch"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<DeleteOutlined />
|
|
||||||
</template>
|
|
||||||
<span>批量删除</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-input-search
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入用户ID"
|
|
||||||
style="width: 240px"
|
|
||||||
v-model:value="where.keywords"
|
|
||||||
@search="handleSearch"
|
|
||||||
/>
|
|
||||||
<a-button @click="resetSearch"> 重置 </a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 导入弹窗 -->
|
|
||||||
<Import v-model:visible="showImport" @done="emit('importDone')" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { DeleteOutlined } from '@ant-design/icons-vue';
|
|
||||||
import Import from './Import.vue';
|
|
||||||
import useSearch from '@/utils/use-search';
|
|
||||||
import { ShopDealerWithdrawParam } from '@/api/shop/shopDealerWithdraw/model';
|
|
||||||
|
|
||||||
withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的数据
|
|
||||||
selection?: any[];
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
selection: () => []
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: ShopDealerWithdrawParam): void;
|
|
||||||
(e: 'batchSettle'): void;
|
|
||||||
(e: 'export'): void;
|
|
||||||
(e: 'importDone'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 是否显示导入弹窗
|
|
||||||
const showImport = ref(false);
|
|
||||||
|
|
||||||
// 搜索表单
|
|
||||||
const { where, resetFields } = useSearch<ShopDealerWithdrawParam>({
|
|
||||||
keywords: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const handleSearch = () => {
|
|
||||||
const searchParams = { ...where };
|
|
||||||
// 清除空值
|
|
||||||
Object.keys(searchParams).forEach((key) => {
|
|
||||||
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
|
||||||
delete searchParams[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
emit('search', searchParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重置搜索
|
|
||||||
const resetSearch = () => {
|
|
||||||
resetFields();
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
const removeBatch = () => {
|
|
||||||
emit('remove');
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,697 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="1000"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑提现申请' : '新增提现申请'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="{ span: 6 }"
|
|
||||||
:wrapper-col="{ span: 18 }"
|
|
||||||
>
|
|
||||||
<!-- 基本信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">基本信息</span>
|
|
||||||
</a-divider>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="备注" name="comments">
|
|
||||||
<div class="text-red-500">{{ form.comments }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 收款信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">收款信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<!-- 微信收款信息 -->
|
|
||||||
<div v-if="form.payType === 10" class="payment-info wechat-info">
|
|
||||||
<a-alert
|
|
||||||
message="微信收款信息"
|
|
||||||
description="请确保微信账号信息准确,以免影响到账"
|
|
||||||
type="success"
|
|
||||||
show-icon
|
|
||||||
style="margin-bottom: 16px"
|
|
||||||
/>
|
|
||||||
<a-form-item label="微信号" name="wechatAccount">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入微信号"
|
|
||||||
v-model:value="form.wechatAccount"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="微信昵称" name="wechatName">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入微信昵称"
|
|
||||||
v-model:value="form.wechatName"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 支付宝收款信息 -->
|
|
||||||
<div v-if="form.payType === 20" class="payment-info alipay-info">
|
|
||||||
<a-alert
|
|
||||||
message="支付宝收款信息"
|
|
||||||
description="请确保支付宝账号信息准确,姓名需与实名认证一致"
|
|
||||||
type="info"
|
|
||||||
show-icon
|
|
||||||
style="margin-bottom: 16px"
|
|
||||||
/>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="支付宝姓名" name="alipayName">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入支付宝实名姓名"
|
|
||||||
disabled
|
|
||||||
v-model:value="form.alipayName"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="支付宝账号" name="alipayAccount">
|
|
||||||
<a-input
|
|
||||||
placeholder="请输入支付宝账号"
|
|
||||||
disabled
|
|
||||||
v-model:value="form.alipayAccount"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 银行卡收款信息 -->
|
|
||||||
<div v-if="form.payType === 30" class="payment-info bank-info">
|
|
||||||
<a-alert
|
|
||||||
message="银行卡收款信息"
|
|
||||||
description="请确保银行卡信息准确,开户名需与身份证姓名一致"
|
|
||||||
type="warning"
|
|
||||||
show-icon
|
|
||||||
style="margin-bottom: 16px"
|
|
||||||
/>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="开户行名称" name="bankName">
|
|
||||||
{{ form.bankName }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="银行开户名" name="bankAccount">
|
|
||||||
{{ form.bankAccount }}
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="银行卡号" name="bankCard">
|
|
||||||
{{ form.bankCard }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 审核信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600">审核信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="申请状态" name="applyStatus">
|
|
||||||
<a-select
|
|
||||||
v-model:value="form.applyStatus"
|
|
||||||
:disabled="form.applyStatus == 40 || form.applyStatus == 30"
|
|
||||||
placeholder="请选择申请状态"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">
|
|
||||||
<div class="status-option">
|
|
||||||
<a-tag color="orange">待审核</a-tag>
|
|
||||||
<span>等待审核</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="20">
|
|
||||||
<div class="status-option">
|
|
||||||
<a-tag color="success">审核通过</a-tag>
|
|
||||||
<span>审核通过</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="30">
|
|
||||||
<div class="status-option">
|
|
||||||
<a-tag color="error">审核驳回</a-tag>
|
|
||||||
<span>审核驳回</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
<a-select-option :value="40">
|
|
||||||
<div class="status-option">
|
|
||||||
<a-tag>已打款</a-tag>
|
|
||||||
<span>已完成打款</span>
|
|
||||||
</div>
|
|
||||||
</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item
|
|
||||||
label="驳回原因"
|
|
||||||
name="rejectReason"
|
|
||||||
v-if="form.applyStatus === 30"
|
|
||||||
>
|
|
||||||
<a-textarea
|
|
||||||
v-model:value="form.rejectReason"
|
|
||||||
placeholder="请输入驳回原因"
|
|
||||||
:rows="3"
|
|
||||||
:maxlength="200"
|
|
||||||
show-count
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item
|
|
||||||
label="上传支付凭证"
|
|
||||||
name="image"
|
|
||||||
v-if="form.applyStatus === 40"
|
|
||||||
>
|
|
||||||
<SelectFile
|
|
||||||
:placeholder="`请选择图片`"
|
|
||||||
:limit="2"
|
|
||||||
:data="files"
|
|
||||||
@done="chooseFile"
|
|
||||||
@del="onDeleteFile"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- 提现预览 -->
|
|
||||||
<div class="withdraw-preview" v-if="form.money && form.payType">
|
|
||||||
<a-alert
|
|
||||||
:type="getPreviewAlertType()"
|
|
||||||
:message="getPreviewText()"
|
|
||||||
show-icon
|
|
||||||
style="margin-top: 16px"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import {
|
|
||||||
addShopDealerWithdraw,
|
|
||||||
updateShopDealerWithdraw
|
|
||||||
} from '@/api/shop/shopDealerWithdraw';
|
|
||||||
import { ShopDealerWithdraw } from '@/api/shop/shopDealerWithdraw/model';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopDealerWithdraw | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref<boolean>(false);
|
|
||||||
const isSuccess = ref<boolean>(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
const files = ref<ItemType[]>([]);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const form = reactive<ShopDealerWithdraw>({
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
realName: undefined,
|
|
||||||
nickname: undefined,
|
|
||||||
phone: undefined,
|
|
||||||
avatar: undefined,
|
|
||||||
money: undefined,
|
|
||||||
payType: undefined,
|
|
||||||
// 微信相关
|
|
||||||
wechatAccount: '',
|
|
||||||
wechatName: '',
|
|
||||||
// 支付宝相关
|
|
||||||
alipayName: '',
|
|
||||||
alipayAccount: '',
|
|
||||||
// 银行卡相关
|
|
||||||
bankName: '',
|
|
||||||
bankAccount: '',
|
|
||||||
bankCard: '',
|
|
||||||
// 审核相关
|
|
||||||
applyStatus: 10,
|
|
||||||
auditTime: undefined,
|
|
||||||
rejectReason: '',
|
|
||||||
platform: '',
|
|
||||||
comments: '',
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入分销商用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
money: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入提现金额',
|
|
||||||
trigger: 'blur'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (value && value <= 0) {
|
|
||||||
return Promise.reject('提现金额必须大于0');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
payType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择打款方式',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
platform: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择来源平台',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// 微信验证
|
|
||||||
wechatAccount: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 10 && !value) {
|
|
||||||
return Promise.reject('请输入微信号');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
wechatName: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 10 && !value) {
|
|
||||||
return Promise.reject('请输入微信昵称');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// 支付宝验证
|
|
||||||
alipayName: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 20 && !value) {
|
|
||||||
return Promise.reject('请输入支付宝姓名');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
alipayAccount: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 20 && !value) {
|
|
||||||
return Promise.reject('请输入支付宝账号');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// 银行卡验证
|
|
||||||
bankName: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 30 && !value) {
|
|
||||||
return Promise.reject('请输入开户行名称');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
bankAccount: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 30 && !value) {
|
|
||||||
return Promise.reject('请输入银行开户名');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
bankCard: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.payType === 30 && !value) {
|
|
||||||
return Promise.reject('请输入银行卡号');
|
|
||||||
}
|
|
||||||
if (form.payType === 30 && value && !/^\d{16,19}$/.test(value)) {
|
|
||||||
return Promise.reject('银行卡号格式不正确');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
applyStatus: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择申请状态',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
rejectReason: [
|
|
||||||
{
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.applyStatus === 30 && !value) {
|
|
||||||
return Promise.reject('驳回时必须填写驳回原因');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
image: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请上传打款凭证',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 打款方式改变时的处理 */
|
|
||||||
const onPayTypeChange = (e: any) => {
|
|
||||||
const payType = e.target.value;
|
|
||||||
|
|
||||||
// 清空其他支付方式的信息
|
|
||||||
if (payType !== 10) {
|
|
||||||
form.alipayAccount = '';
|
|
||||||
form.alipayName = '';
|
|
||||||
}
|
|
||||||
if (payType !== 20) {
|
|
||||||
form.alipayName = '';
|
|
||||||
form.alipayAccount = '';
|
|
||||||
}
|
|
||||||
if (payType !== 30) {
|
|
||||||
form.bankName = '';
|
|
||||||
form.bankAccount = '';
|
|
||||||
form.bankCard = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const chooseFile = (data: FileRecord) => {
|
|
||||||
files.value.push({
|
|
||||||
uid: data.id,
|
|
||||||
url: data.url,
|
|
||||||
status: 'done'
|
|
||||||
});
|
|
||||||
form.image = JSON.stringify(files.value.map((d) => d.url));
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDeleteFile = (index: number) => {
|
|
||||||
files.value.splice(index, 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 获取预览提示类型 */
|
|
||||||
const getPreviewAlertType = () => {
|
|
||||||
if (!form.applyStatus) return 'info';
|
|
||||||
|
|
||||||
switch (form.applyStatus) {
|
|
||||||
case 10:
|
|
||||||
return 'processing';
|
|
||||||
case 20:
|
|
||||||
return 'success';
|
|
||||||
case 30:
|
|
||||||
return 'error';
|
|
||||||
case 40:
|
|
||||||
return 'success';
|
|
||||||
default:
|
|
||||||
return 'info';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 获取预览文本 */
|
|
||||||
const getPreviewText = () => {
|
|
||||||
if (!form.money || !form.payType) return '';
|
|
||||||
|
|
||||||
const amount = parseFloat(form.money.toString()).toFixed(2);
|
|
||||||
const payTypeMap = {
|
|
||||||
10: '微信',
|
|
||||||
20: '支付宝',
|
|
||||||
30: '银行卡'
|
|
||||||
};
|
|
||||||
const statusMap = {
|
|
||||||
10: '待审核',
|
|
||||||
20: '审核通过',
|
|
||||||
30: '审核驳回',
|
|
||||||
40: '已打款'
|
|
||||||
};
|
|
||||||
|
|
||||||
const payTypeName = payTypeMap[form.payType] || '未知方式';
|
|
||||||
const statusName = statusMap[form.applyStatus] || '未知状态';
|
|
||||||
|
|
||||||
return `提现金额:¥${amount},打款方式:${payTypeName},当前状态:${statusName}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isSuccess.value) {
|
|
||||||
console.log('isSuccess');
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (form.realName == '' || form.realName == null) {
|
|
||||||
message.error('该用户未完成实名认证!');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
|
|
||||||
// 处理时间字段转换
|
|
||||||
if (formData.auditTime && dayjs.isDayjs(formData.auditTime)) {
|
|
||||||
formData.auditTime = formData.auditTime.valueOf();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据支付方式清理不相关字段
|
|
||||||
if (formData.payType !== 10) {
|
|
||||||
delete formData.wechatAccount;
|
|
||||||
delete formData.wechatName;
|
|
||||||
}
|
|
||||||
if (formData.payType !== 20) {
|
|
||||||
delete formData.alipayName;
|
|
||||||
delete formData.alipayAccount;
|
|
||||||
}
|
|
||||||
if (formData.payType !== 30) {
|
|
||||||
delete formData.bankName;
|
|
||||||
delete formData.bankAccount;
|
|
||||||
delete formData.bankCard;
|
|
||||||
}
|
|
||||||
|
|
||||||
const saveOrUpdate = isUpdate.value
|
|
||||||
? updateShopDealerWithdraw
|
|
||||||
: addShopDealerWithdraw;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
files.value = [];
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
// 处理时间字段
|
|
||||||
if (props.data.auditTime) {
|
|
||||||
form.auditTime = dayjs(props.data.auditTime);
|
|
||||||
}
|
|
||||||
if (props.data.image) {
|
|
||||||
const arr = JSON.parse(props.data.image);
|
|
||||||
arr.map((url: string) => {
|
|
||||||
files.value.push({
|
|
||||||
uid: uuid(),
|
|
||||||
url: url,
|
|
||||||
status: 'done'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
isSuccess.value = true;
|
|
||||||
}
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
// 重置为默认值
|
|
||||||
Object.assign(form, {
|
|
||||||
id: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
money: undefined,
|
|
||||||
payType: undefined,
|
|
||||||
wechatAccount: '',
|
|
||||||
wechatName: '',
|
|
||||||
alipayName: '',
|
|
||||||
alipayAccount: '',
|
|
||||||
bankName: '',
|
|
||||||
bankAccount: '',
|
|
||||||
bankCard: '',
|
|
||||||
applyStatus: 10,
|
|
||||||
auditTime: undefined,
|
|
||||||
rejectReason: '',
|
|
||||||
platform: '',
|
|
||||||
image: '',
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
});
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.platform-option,
|
|
||||||
.status-option {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.ant-tag {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-info {
|
|
||||||
background: #fafafa;
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
|
|
||||||
&.wechat-info {
|
|
||||||
border-left: 3px solid #52c41a;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.alipay-info {
|
|
||||||
border-left: 3px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.bank-info {
|
|
||||||
border-left: 3px solid #faad14;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.withdraw-preview {
|
|
||||||
:deep(.ant-alert) {
|
|
||||||
.ant-alert-message {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
|
||||||
margin: 24px 0 16px 0;
|
|
||||||
|
|
||||||
.ant-divider-inner-text {
|
|
||||||
padding: 0 16px 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-form-item) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-radio) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
|
|
||||||
.ant-radio-inner {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-select-selection-item) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-alert) {
|
|
||||||
.ant-alert-message {
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,464 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="shopDealerWithdrawId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'applyStatus'">
|
|
||||||
<a-tag v-if="record.applyStatus === 10" color="orange"
|
|
||||||
>待审核</a-tag
|
|
||||||
>
|
|
||||||
<a-tag v-if="record.applyStatus === 20" color="success"
|
|
||||||
>审核通过</a-tag
|
|
||||||
>
|
|
||||||
<a-tag v-if="record.applyStatus === 30" color="error">已驳回</a-tag>
|
|
||||||
<a-tag v-if="record.applyStatus === 40">已打款</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'userInfo'">
|
|
||||||
<a-space>
|
|
||||||
<a-avatar :src="record.avatar" />
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<span>{{ record.realName || '未实名认证' }}</span>
|
|
||||||
<span class="text-gray-400">{{ record.phone }}</span>
|
|
||||||
</div>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'paymentInfo'">
|
|
||||||
<template v-if="record.payType === 10">
|
|
||||||
<a-space direction="vertical">
|
|
||||||
<a-tag color="blue">微信</a-tag>
|
|
||||||
<span>{{ record.wechatName }}</span>
|
|
||||||
<span>{{ record.wechatName }}</span>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
<template v-if="record.payType === 20">
|
|
||||||
<a-space direction="vertical">
|
|
||||||
<a-tag color="blue">支付宝</a-tag>
|
|
||||||
<span>{{ record.alipayName }}</span>
|
|
||||||
<span>{{ record.alipayAccount }}</span>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
<template v-if="record.payType === 30">
|
|
||||||
<a-space direction="vertical">
|
|
||||||
<a-tag color="blue">银行卡</a-tag>
|
|
||||||
<span>{{ record.bankName }}</span>
|
|
||||||
<span>{{ record.bankAccount }}</span>
|
|
||||||
<span>{{ record.bankCard }}</span>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'comments'">
|
|
||||||
<template v-if="record.applyStatus === 30">
|
|
||||||
<div class="text-red-500"
|
|
||||||
>驳回原因:{{ record.rejectReason }}</div
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
<template v-if="record.applyStatus === 40 && record.image">
|
|
||||||
<a-image
|
|
||||||
v-for="(item, index) in JSON.parse(record.image)"
|
|
||||||
:key="index"
|
|
||||||
:src="item"
|
|
||||||
:width="50"
|
|
||||||
:height="50"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'createTime'">
|
|
||||||
<a-space direction="vertical">
|
|
||||||
<a-tooltip title="创建时间">{{ record.createTime }}</a-tooltip>
|
|
||||||
<a-tooltip title="审核/打款时间" class="text-green-500">{{
|
|
||||||
record.auditTime
|
|
||||||
}}</a-tooltip>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<template v-if="record.applyStatus !== 40">
|
|
||||||
<a @click="openEdit(record)" class="ele-text-primary">
|
|
||||||
<EditOutlined />
|
|
||||||
编辑
|
|
||||||
</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此提现记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
placement="topRight"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">
|
|
||||||
<DeleteOutlined />
|
|
||||||
删除
|
|
||||||
</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<ShopDealerWithdrawEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import {
|
|
||||||
ExclamationCircleOutlined,
|
|
||||||
CheckOutlined,
|
|
||||||
CloseOutlined,
|
|
||||||
DollarOutlined,
|
|
||||||
EditOutlined,
|
|
||||||
DeleteOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import { getPageTitle } from '@/utils/common';
|
|
||||||
import ShopDealerWithdrawEdit from './components/shopDealerWithdrawEdit.vue';
|
|
||||||
import {
|
|
||||||
pageShopDealerWithdraw,
|
|
||||||
removeShopDealerWithdraw,
|
|
||||||
removeBatchShopDealerWithdraw,
|
|
||||||
updateShopDealerWithdraw
|
|
||||||
} from '@/api/shop/shopDealerWithdraw';
|
|
||||||
import type {
|
|
||||||
ShopDealerWithdraw,
|
|
||||||
ShopDealerWithdrawParam
|
|
||||||
} from '@/api/shop/shopDealerWithdraw/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<ShopDealerWithdraw[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<ShopDealerWithdraw | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageShopDealerWithdraw({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '提现金额',
|
|
||||||
dataIndex: 'money',
|
|
||||||
key: 'money',
|
|
||||||
align: 'center',
|
|
||||||
width: 150,
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
const amount = parseFloat(text || '0').toFixed(2);
|
|
||||||
return {
|
|
||||||
type: 'span',
|
|
||||||
children: `¥${amount}`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户信息',
|
|
||||||
dataIndex: 'userInfo',
|
|
||||||
key: 'userInfo'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '收款信息',
|
|
||||||
dataIndex: 'paymentInfo',
|
|
||||||
key: 'paymentInfo'
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '审核时间',
|
|
||||||
// dataIndex: 'auditTime',
|
|
||||||
// key: 'auditTime',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 120,
|
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '驳回原因',
|
|
||||||
// dataIndex: 'rejectReason',
|
|
||||||
// key: 'rejectReason',
|
|
||||||
// align: 'left',
|
|
||||||
// ellipsis: true,
|
|
||||||
// customRender: ({ text }) => text || '-'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '来源平台',
|
|
||||||
// dataIndex: 'platform',
|
|
||||||
// key: 'platform',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 100,
|
|
||||||
// customRender: ({ text }) => text || '-'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '申请状态',
|
|
||||||
dataIndex: 'applyStatus',
|
|
||||||
key: 'applyStatus',
|
|
||||||
align: 'center',
|
|
||||||
width: 150
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '驳回原因',
|
|
||||||
// dataIndex: 'rejectReason',
|
|
||||||
// key: 'rejectReason',
|
|
||||||
// align: 'center',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '来源客户端',
|
|
||||||
// dataIndex: 'platform',
|
|
||||||
// key: 'platform',
|
|
||||||
// align: 'center',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
width: 180,
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
// title: '操作',
|
|
||||||
// key: 'action',
|
|
||||||
// width: 180,
|
|
||||||
// fixed: 'right',
|
|
||||||
// align: 'center',
|
|
||||||
// hideInSetting: true
|
|
||||||
// }
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerWithdrawParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核通过 */
|
|
||||||
const approveWithdraw = (row: ShopDealerWithdraw) => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核通过确认',
|
|
||||||
content: `已核对信息进行核对,正确无误!`,
|
|
||||||
icon: createVNode(CheckOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
// 这里需要调用审核通过的API
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
updateShopDealerWithdraw({
|
|
||||||
id: row.id,
|
|
||||||
applyStatus: 20
|
|
||||||
});
|
|
||||||
message.success('审核通过成功');
|
|
||||||
reload();
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核驳回 */
|
|
||||||
const rejectWithdraw = (row: ShopDealerWithdraw) => {
|
|
||||||
let rejectReason = '';
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核驳回',
|
|
||||||
content: createVNode('div', null, [
|
|
||||||
createVNode('p', null, `用户ID: ${row.userId}`),
|
|
||||||
createVNode(
|
|
||||||
'p',
|
|
||||||
null,
|
|
||||||
`提现金额: ¥${parseFloat(row.money || '0').toFixed(2)}`
|
|
||||||
),
|
|
||||||
createVNode('p', { style: 'margin-top: 12px;' }, '请输入驳回原因:'),
|
|
||||||
createVNode('textarea', {
|
|
||||||
placeholder: '请输入驳回原因...',
|
|
||||||
style:
|
|
||||||
'width: 100%; height: 80px; margin-top: 8px; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
|
|
||||||
onInput: (e: any) => {
|
|
||||||
rejectReason = e.target.value;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
icon: createVNode(CloseOutlined),
|
|
||||||
okText: '确认驳回',
|
|
||||||
okType: 'danger',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
if (!rejectReason.trim()) {
|
|
||||||
message.error('请输入驳回原因');
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('审核驳回成功');
|
|
||||||
reload();
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 确认打款 */
|
|
||||||
const confirmPayment = (row: ShopDealerWithdraw) => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '确认打款',
|
|
||||||
content: `确定已向用户${row.bankAccount}完成打款?此操作不可撤销`,
|
|
||||||
icon: createVNode(DollarOutlined),
|
|
||||||
okText: '确认打款',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('正在确认打款...', 0);
|
|
||||||
setTimeout(() => {
|
|
||||||
updateShopDealerWithdraw({
|
|
||||||
id: row.id,
|
|
||||||
applyStatus: 40
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('打款确认成功');
|
|
||||||
reload();
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerWithdraw) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerWithdraw) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeShopDealerWithdraw(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchShopDealerWithdraw(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerWithdraw) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'ShopDealerWithdraw'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -1,19 +1,28 @@
|
|||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<template>
|
<template>
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
<a-input-search
|
||||||
<template #icon>
|
allow-clear
|
||||||
<PlusOutlined />
|
placeholder="用户ID|订单编号"
|
||||||
</template>
|
style="width: 240px"
|
||||||
<span>添加</span>
|
v-model:value="where.keywords"
|
||||||
</a-button>
|
@search="reload"
|
||||||
|
/>
|
||||||
|
<a-button type="dashed" @click="handleExport">导出xls</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
import { ref, watch } from 'vue';
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
import { utils, writeFile } from 'xlsx';
|
||||||
import { watch } from 'vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
import { pageShopDealerCapital } from '@/api/shop/shopDealerCapital';
|
||||||
|
import {
|
||||||
|
ShopDealerCapital,
|
||||||
|
ShopDealerCapitalParam
|
||||||
|
} from '@/api/shop/shopDealerCapital/model';
|
||||||
|
import { getTenantId } from '@/utils/domain';
|
||||||
|
import useSearch from '@/utils/use-search';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -24,15 +33,81 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'search', where?: GradeParam): void;
|
(e: 'search', where?: ShopDealerCapitalParam): void;
|
||||||
(e: 'add'): void;
|
(e: 'add'): void;
|
||||||
(e: 'remove'): void;
|
(e: 'remove'): void;
|
||||||
(e: 'batchMove'): void;
|
(e: 'batchMove'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// 新增
|
const reload = () => {
|
||||||
const add = () => {
|
emit('search', where);
|
||||||
emit('add');
|
};
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const { where } = useSearch<ShopDealerCapitalParam>({
|
||||||
|
keywords: '',
|
||||||
|
userId: undefined,
|
||||||
|
toUserId: undefined,
|
||||||
|
limit: 5000
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = ref<ShopDealerCapital[]>([]);
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
const handleExport = async () => {
|
||||||
|
const array: (string | number)[][] = [
|
||||||
|
[
|
||||||
|
'用户ID',
|
||||||
|
'流动类型',
|
||||||
|
'金额',
|
||||||
|
'订单编号',
|
||||||
|
'对方用户ID',
|
||||||
|
`创建时间`,
|
||||||
|
'租户ID'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
// 按搜索结果导出
|
||||||
|
await pageShopDealerCapital(where)
|
||||||
|
.then((data) => {
|
||||||
|
list.value = data?.list || [];
|
||||||
|
list.value?.forEach((d: ShopDealerCapital) => {
|
||||||
|
array.push([
|
||||||
|
`${d.userId}`,
|
||||||
|
`${d.flowType == 10 ? '佣金收入' : ''}`,
|
||||||
|
`${d.money}`,
|
||||||
|
`${d.orderNo}`,
|
||||||
|
`${d.toUserId}`,
|
||||||
|
`${d.createTime}`,
|
||||||
|
`${d.tenantId}`
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
const sheetName = `bak_shop_dealer_capital_${getTenantId()}`;
|
||||||
|
const workbook = {
|
||||||
|
SheetNames: [sheetName],
|
||||||
|
Sheets: {}
|
||||||
|
};
|
||||||
|
const sheet = utils.aoa_to_sheet(array);
|
||||||
|
workbook.Sheets[sheetName] = sheet;
|
||||||
|
// 设置列宽
|
||||||
|
sheet['!cols'] = [
|
||||||
|
{ wch: 10 },
|
||||||
|
{ wch: 20 },
|
||||||
|
{ wch: 20 },
|
||||||
|
{ wch: 15 },
|
||||||
|
{ wch: 10 },
|
||||||
|
{ wch: 10 },
|
||||||
|
{ wch: 20 }
|
||||||
|
];
|
||||||
|
message.loading('正在导出...');
|
||||||
|
setTimeout(() => {
|
||||||
|
writeFile(workbook, `${sheetName}.xlsx`);
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
|
.catch((msg) => {
|
||||||
|
message.error(msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
import { message, Modal } from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
@@ -123,7 +122,6 @@
|
|||||||
dataIndex: 'userId',
|
dataIndex: 'userId',
|
||||||
key: 'userId',
|
key: 'userId',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
|
||||||
fixed: 'left'
|
fixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -131,13 +129,13 @@
|
|||||||
dataIndex: 'flowType',
|
dataIndex: 'flowType',
|
||||||
key: 'flowType',
|
key: 'flowType',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 120,
|
|
||||||
customRender: ({ text }) => {
|
customRender: ({ text }) => {
|
||||||
const typeMap = {
|
const typeMap = {
|
||||||
10: { text: '佣金收入', color: 'success' },
|
10: { text: '佣金收入', color: 'success' },
|
||||||
20: { text: '提现支出', color: 'warning' },
|
20: { text: '提现支出', color: 'warning' },
|
||||||
30: { text: '转账支出', color: 'error' },
|
30: { text: '转账支出', color: 'error' },
|
||||||
40: { text: '转账收入', color: 'processing' }
|
40: { text: '转账收入', color: 'processing' },
|
||||||
|
50: { text: '新人注册奖', color: 'processing' }
|
||||||
};
|
};
|
||||||
const type = typeMap[text] || { text: '未知', color: 'default' };
|
const type = typeMap[text] || { text: '未知', color: 'default' };
|
||||||
return {
|
return {
|
||||||
@@ -152,19 +150,20 @@
|
|||||||
dataIndex: 'money',
|
dataIndex: 'money',
|
||||||
key: 'money',
|
key: 'money',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 120,
|
|
||||||
customRender: ({ text, record }) => {
|
customRender: ({ text, record }) => {
|
||||||
const amount = parseFloat(text || '0').toFixed(2);
|
const amount = parseFloat(text || '0').toFixed(2);
|
||||||
const isIncome = record.flowType === 10 || record.flowType === 40;
|
const isIncome =
|
||||||
|
record.flowType === 10 ||
|
||||||
|
record.flowType === 40 ||
|
||||||
|
record.flowType === 50;
|
||||||
return {
|
return {
|
||||||
type: 'span',
|
type: 'span',
|
||||||
props: {
|
props: {
|
||||||
style: {
|
style: {
|
||||||
color: isIncome ? '#52c41a' : '#ff4d4f',
|
color: isIncome ? '#424242' : '#ff4d4f'
|
||||||
fontWeight: 'bold'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
children: `${isIncome ? '+' : '-'}¥${amount}`
|
children: `${isIncome ? '' : '-'} ${amount}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -180,7 +179,6 @@
|
|||||||
dataIndex: 'toUserId',
|
dataIndex: 'toUserId',
|
||||||
key: 'toUserId',
|
key: 'toUserId',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
|
||||||
customRender: ({ text }) => (text ? `ID: ${text}` : '-')
|
customRender: ({ text }) => (text ? `ID: ${text}` : '-')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -188,7 +186,6 @@
|
|||||||
dataIndex: 'describe',
|
dataIndex: 'describe',
|
||||||
key: 'describe',
|
key: 'describe',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
width: 200,
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
customRender: ({ text }) => text || '-'
|
customRender: ({ text }) => text || '-'
|
||||||
},
|
},
|
||||||
@@ -197,24 +194,16 @@
|
|||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
sorter: true,
|
sorter: true
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '修改时间',
|
|
||||||
dataIndex: 'updateTime',
|
|
||||||
key: 'updateTime',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
}
|
||||||
|
// {
|
||||||
|
// title: '操作',
|
||||||
|
// key: 'action',
|
||||||
|
// width: 180,
|
||||||
|
// fixed: 'right',
|
||||||
|
// align: 'center',
|
||||||
|
// hideInSetting: true
|
||||||
|
// }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
|
|||||||
@@ -19,16 +19,6 @@
|
|||||||
</p>
|
</p>
|
||||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||||
</a-upload-dragger>
|
</a-upload-dragger>
|
||||||
<div class="ant-upload-text text-gray-400">
|
|
||||||
<div
|
|
||||||
>1、必须按<a
|
|
||||||
href="https://oss.wsdns.cn/20251018/408b805ec3cd4084a4dc686e130af578.xlsx"
|
|
||||||
target="_blank"
|
|
||||||
>导入模版</a
|
|
||||||
>的格式上传</div
|
|
||||||
>
|
|
||||||
<div>2、导入成功确认结算完成佣金的发放</div>
|
|
||||||
</div>
|
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</ele-modal>
|
</ele-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,182 +1,143 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="flex items-center gap-20">
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
<!-- 搜索表单 -->
|
|
||||||
<a-form
|
|
||||||
:model="where"
|
|
||||||
layout="inline"
|
|
||||||
class="search-form"
|
|
||||||
@finish="handleSearch"
|
|
||||||
>
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-button
|
|
||||||
danger
|
|
||||||
class="ele-btn-icon"
|
|
||||||
v-if="selection.length > 0"
|
|
||||||
:disabled="selection?.length === 0"
|
|
||||||
@click="removeBatch"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<DeleteOutlined />
|
|
||||||
</template>
|
|
||||||
<span>批量删除</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<!-- <a-form-item label="订单状态">-->
|
|
||||||
<!-- <a-select-->
|
|
||||||
<!-- v-model:value="where.isInvalid"-->
|
|
||||||
<!-- placeholder="全部"-->
|
|
||||||
<!-- allow-clear-->
|
|
||||||
<!-- style="width: 120px"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <a-select-option :value="0">有效</a-select-option>-->
|
|
||||||
<!-- <a-select-option :value="1">失效</a-select-option>-->
|
|
||||||
<!-- </a-select>-->
|
|
||||||
<!-- </a-form-item>-->
|
|
||||||
|
|
||||||
<!-- <a-form-item label="结算状态">-->
|
|
||||||
<!-- <a-select-->
|
|
||||||
<!-- v-model:value="where.isSettled"-->
|
|
||||||
<!-- placeholder="全部"-->
|
|
||||||
<!-- allow-clear-->
|
|
||||||
<!-- style="width: 120px"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <a-select-option :value="0">未结算</a-select-option>-->
|
|
||||||
<!-- <a-select-option :value="1">已结算</a-select-option>-->
|
|
||||||
<!-- </a-select>-->
|
|
||||||
<!-- </a-form-item>-->
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-input-search
|
<a-input-search
|
||||||
allow-clear
|
allow-clear
|
||||||
placeholder="请输入关键词"
|
placeholder="客户名称|订单编号"
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
v-model:value="where.keywords"
|
v-model:value="where.keywords"
|
||||||
@search="handleSearch"
|
@search="reload"
|
||||||
/>
|
/>
|
||||||
<!-- <a-button type="primary" html-type="submit" class="ele-btn-icon">-->
|
<a-button type="dashed" @click="handleExport">导出xls</a-button>
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <SearchOutlined/>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 搜索-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<a-button @click="resetSearch"> 重置 </a-button>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-space>
|
|
||||||
<!-- <a-button @click="exportData" class="ele-btn-icon">-->
|
|
||||||
<!-- <template #icon>-->
|
|
||||||
<!-- <ExportOutlined />-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- 导出数据-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<a-button @click="openImport" class="ele-btn-icon">
|
|
||||||
<template #icon>
|
|
||||||
<UploadOutlined />
|
|
||||||
</template>
|
|
||||||
导入数据
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
danger
|
|
||||||
@click="batchSettle"
|
|
||||||
:disabled="selection?.length === 0"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<DollarOutlined />
|
|
||||||
</template>
|
|
||||||
批量结算
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 导入弹窗 -->
|
|
||||||
<Import v-model:visible="showImport" @done="emit('importDone')" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
import {
|
import { ref, watch } from 'vue';
|
||||||
DollarOutlined,
|
import { utils, writeFile } from 'xlsx';
|
||||||
UploadOutlined,
|
import { message } from 'ant-design-vue';
|
||||||
DeleteOutlined
|
import { ShopDealerCapital } from '@/api/shop/shopDealerCapital/model';
|
||||||
} from '@ant-design/icons-vue';
|
import { getTenantId } from '@/utils/domain';
|
||||||
import type { ShopDealerOrderParam } from '@/api/shop/shopDealerOrder/model';
|
|
||||||
import Import from './Import.vue';
|
|
||||||
import useSearch from '@/utils/use-search';
|
import useSearch from '@/utils/use-search';
|
||||||
|
import {
|
||||||
|
ShopDealerOrder,
|
||||||
|
ShopDealerOrderParam
|
||||||
|
} from '@/api/shop/shopDealerOrder/model';
|
||||||
|
import { pageShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
||||||
|
|
||||||
withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
// 选中的数据
|
// 选中的角色
|
||||||
selection?: any[];
|
selection?: [];
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{}
|
||||||
selection: () => []
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'search', where?: ShopDealerOrderParam): void;
|
(e: 'search', where?: GradeParam): void;
|
||||||
(e: 'batchSettle'): void;
|
(e: 'add'): void;
|
||||||
(e: 'export'): void;
|
|
||||||
(e: 'importDone'): void;
|
|
||||||
(e: 'remove'): void;
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// 是否显示导入弹窗
|
const reload = () => {
|
||||||
const showImport = ref(false);
|
emit('search', where);
|
||||||
|
};
|
||||||
|
|
||||||
// 搜索表单
|
// 表单数据
|
||||||
const { where, resetFields } = useSearch<ShopDealerOrderParam>({
|
const { where } = useSearch<ShopDealerOrderParam>({
|
||||||
orderNo: '',
|
keywords: '',
|
||||||
productName: '',
|
userId: undefined,
|
||||||
isInvalid: undefined,
|
orderNo: undefined,
|
||||||
isSettled: undefined
|
limit: 5000
|
||||||
});
|
});
|
||||||
|
|
||||||
// 搜索
|
const list = ref<ShopDealerCapital[]>([]);
|
||||||
const handleSearch = () => {
|
|
||||||
const searchParams = { ...where };
|
// 导出
|
||||||
// 清除空值
|
const handleExport = async () => {
|
||||||
Object.keys(searchParams).forEach((key) => {
|
const array: (string | number)[][] = [
|
||||||
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
[
|
||||||
delete searchParams[key];
|
'客户名称',
|
||||||
}
|
'业务员',
|
||||||
|
'订单编号',
|
||||||
|
'结算电量',
|
||||||
|
'换算成度',
|
||||||
|
'结算单价',
|
||||||
|
'结算金额',
|
||||||
|
'税费',
|
||||||
|
'实发金额',
|
||||||
|
'一级佣金30%',
|
||||||
|
'一级佣金收益',
|
||||||
|
'二级佣金10%',
|
||||||
|
'二级佣金收益',
|
||||||
|
'三级佣金60%',
|
||||||
|
'三级佣金收益',
|
||||||
|
'月份',
|
||||||
|
'创建时间',
|
||||||
|
'结算时间',
|
||||||
|
'租户ID'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
// 按搜索结果导出
|
||||||
|
await pageShopDealerOrder(where)
|
||||||
|
.then((data) => {
|
||||||
|
list.value = data?.list || [];
|
||||||
|
list.value?.forEach((d: ShopDealerOrder) => {
|
||||||
|
array.push([
|
||||||
|
`${d.title}`,
|
||||||
|
`${d.nickname}(${d.userId})`,
|
||||||
|
`${d.orderNo}`,
|
||||||
|
`${d.orderPrice}`,
|
||||||
|
`${d.degreePrice}`,
|
||||||
|
`${d.price}`,
|
||||||
|
`${d.settledPrice}`,
|
||||||
|
`${d.rate}`,
|
||||||
|
`${d.payPrice}`,
|
||||||
|
`${d.firstNickname}(${d.firstUserId})`,
|
||||||
|
`${d.firstMoney}`,
|
||||||
|
`${d.secondNickname}(${d.secondUserId})`,
|
||||||
|
`${d.secondMoney}`,
|
||||||
|
`${d.thirdNickname}(${d.thirdUserId})`,
|
||||||
|
`${d.thirdMoney}`,
|
||||||
|
`${d.month}`,
|
||||||
|
`${d.createTime}`,
|
||||||
|
`${d.settleTime}`,
|
||||||
|
`${d.tenantId}`
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
emit('search', searchParams);
|
const sheetName = `bak_shop_dealer_order_${getTenantId()}`;
|
||||||
|
const workbook = {
|
||||||
|
SheetNames: [sheetName],
|
||||||
|
Sheets: {}
|
||||||
|
};
|
||||||
|
const sheet = utils.aoa_to_sheet(array);
|
||||||
|
workbook.Sheets[sheetName] = sheet;
|
||||||
|
// 设置列宽
|
||||||
|
sheet['!cols'] = [
|
||||||
|
{ wch: 10 },
|
||||||
|
{ wch: 20 },
|
||||||
|
{ wch: 20 },
|
||||||
|
{ wch: 15 },
|
||||||
|
{ wch: 10 },
|
||||||
|
{ wch: 10 },
|
||||||
|
{ wch: 20 }
|
||||||
|
];
|
||||||
|
message.loading('正在导出...');
|
||||||
|
setTimeout(() => {
|
||||||
|
writeFile(workbook, `${sheetName}.xlsx`);
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
|
.catch((msg) => {
|
||||||
|
message.error(msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 重置搜索
|
watch(
|
||||||
const resetSearch = () => {
|
() => props.selection,
|
||||||
// Object.keys(searchForm).forEach(key => {
|
() => {}
|
||||||
// searchForm[key] = key === 'orderId' ? undefined : '';
|
);
|
||||||
// });
|
|
||||||
resetFields();
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
const removeBatch = () => {
|
|
||||||
emit('remove');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 批量结算
|
|
||||||
const batchSettle = () => {
|
|
||||||
emit('batchSettle');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 导出数据
|
|
||||||
const exportData = () => {
|
|
||||||
emit('export');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开导入弹窗
|
|
||||||
const openImport = () => {
|
|
||||||
showImport.value = true;
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -24,66 +24,36 @@
|
|||||||
</a-divider>
|
</a-divider>
|
||||||
|
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="客户名称" name="title">
|
|
||||||
{{ form.title }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="订单编号" name="orderNo">
|
<a-form-item label="订单编号" name="orderNo">
|
||||||
{{ form.orderNo }}
|
{{ form.orderNo }}
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="结算电量" name="orderPrice">
|
<a-form-item label="订单金额" name="payPrice">
|
||||||
{{ parseFloat(form.orderPrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="换算成度" name="dealerPrice">
|
|
||||||
{{ parseFloat(form.degreePrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="税率" name="rate">
|
|
||||||
{{ form.rate }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="单价" name="price">
|
|
||||||
{{ form.price }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="结算金额" name="payPrice">
|
|
||||||
{{ parseFloat(form.settledPrice || 0).toFixed(2) }}
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="实发金额" name="payPrice">
|
|
||||||
{{ parseFloat(form.payPrice || 0).toFixed(2) }}
|
{{ parseFloat(form.payPrice || 0).toFixed(2) }}
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<div class="font-bold text-gray-400 bg-gray-50">开发调试</div>
|
<!-- <div class="font-bold text-gray-400 bg-gray-50">开发调试</div>-->
|
||||||
<div class="text-gray-400 bg-gray-50">
|
<!-- <div class="text-gray-400 bg-gray-50">-->
|
||||||
<div>业务员({{ form.userId }}):{{ form.nickname }}</div>
|
<!-- <div>业务员({{ form.userId }}):{{ form.nickname }}</div>-->
|
||||||
<div
|
<!-- <div-->
|
||||||
>一级分销商({{ form.firstUserId }}):{{
|
<!-- >一级分销商({{ form.firstUserId }}):{{-->
|
||||||
form.firstNickname
|
<!-- form.firstNickname-->
|
||||||
}},一级佣金30%:{{ form.firstMoney }}</div
|
<!-- }},一级佣金30%:{{ form.firstMoney }}</div-->
|
||||||
>
|
<!-- >-->
|
||||||
<div
|
<!-- <div-->
|
||||||
>二级分销商({{ form.secondUserId }}):{{
|
<!-- >二级分销商({{ form.secondUserId }}):{{-->
|
||||||
form.secondNickname
|
<!-- form.secondNickname-->
|
||||||
}},二级佣金10%:{{ form.secondMoney }}</div
|
<!-- }},二级佣金10%:{{ form.secondMoney }}</div-->
|
||||||
>
|
<!-- >-->
|
||||||
<div
|
<!-- <div-->
|
||||||
>三级分销商({{ form.thirdUserId }}):{{
|
<!-- >三级分销商({{ form.thirdUserId }}):{{-->
|
||||||
form.thirdNickname
|
<!-- form.thirdNickname-->
|
||||||
}},三级佣金60%:{{ form.thirdMoney }}</div
|
<!-- }},三级佣金60%:{{ form.thirdMoney }}</div-->
|
||||||
>
|
<!-- >-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<!-- 分销商信息 -->
|
<!-- 分销商信息 -->
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
<span style="color: #1890ff; font-weight: 600">收益计算</span>
|
<span style="color: #1890ff; font-weight: 600">收益计算</span>
|
||||||
@@ -92,7 +62,7 @@
|
|||||||
<!-- 一级分销商 -->
|
<!-- 一级分销商 -->
|
||||||
<div class="dealer-section">
|
<div class="dealer-section">
|
||||||
<h4 class="dealer-title">
|
<h4 class="dealer-title">
|
||||||
<a-tag color="orange">一级佣金30%</a-tag>
|
<a-tag color="orange">一级佣金10%</a-tag>
|
||||||
</h4>
|
</h4>
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@@ -105,7 +75,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="占比" name="rate">
|
<a-form-item label="占比" name="rate">
|
||||||
{{ '30%' }}
|
{{ '10%' }}
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="获取收益" name="firstMoney">
|
<a-form-item label="获取收益" name="firstMoney">
|
||||||
{{ form.firstMoney }}
|
{{ form.firstMoney }}
|
||||||
@@ -179,7 +149,7 @@
|
|||||||
import { assignObject } from 'ele-admin-pro';
|
import { assignObject } from 'ele-admin-pro';
|
||||||
import { ShopDealerOrder } from '@/api/shop/shopDealerOrder/model';
|
import { ShopDealerOrder } from '@/api/shop/shopDealerOrder/model';
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
import { updateShopDealerOrder} from '@/api/shop/shopDealerOrder';
|
import { updateShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
:customRow="customRow"
|
||||||
v-model:selection="selection"
|
|
||||||
tool-class="ele-toolbar-form"
|
tool-class="ele-toolbar-form"
|
||||||
class="sys-org-table"
|
class="sys-org-table"
|
||||||
>
|
>
|
||||||
@@ -24,11 +23,13 @@
|
|||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'title'">
|
<template v-if="column.key === 'title'">
|
||||||
<div>{{ record.title }}</div>
|
<div>{{ record.title }}</div>
|
||||||
<div class="text-gray-400">用户ID:{{ record.userId }}</div>
|
<div class="text-gray-400"
|
||||||
|
>{{ record.nickname }}({{ record.userId }})</div
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'orderPrice'">
|
<template v-if="column.key === 'orderPrice'">
|
||||||
{{ record.orderPrice.toFixed(2) }}
|
{{ parseFloat(record.orderPrice).toFixed(2) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'degreePrice'">
|
<template v-if="column.key === 'degreePrice'">
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'price'">
|
<template v-if="column.key === 'price'">
|
||||||
{{ record.price }}
|
{{ record.price || 0 }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'settledPrice'">
|
<template v-if="column.key === 'settledPrice'">
|
||||||
@@ -47,6 +48,30 @@
|
|||||||
{{ record.payPrice.toFixed(2) }}
|
{{ record.payPrice.toFixed(2) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'firstNickname'">
|
||||||
|
<div>{{ record.firstMoney }}</div>
|
||||||
|
<div class="text-gray-400">{{ record.firstNickname || '-' }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'secondNickname'">
|
||||||
|
<div>{{ record.secondMoney }}</div>
|
||||||
|
<div class="text-gray-400">{{ record.secondNickname || '-' }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'firstDividendUserName'">
|
||||||
|
<div>{{ record.firstDividend }}</div>
|
||||||
|
<div class="text-gray-400"
|
||||||
|
>{{ record.firstDividendUserName || '-' }}</div
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'secondDividendUserName'">
|
||||||
|
<div>{{ record.secondDividend }}</div>
|
||||||
|
<div class="text-gray-400"
|
||||||
|
>{{ record.secondDividendUserName || '-' }}</div
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'dealerInfo'">
|
<template v-if="column.key === 'dealerInfo'">
|
||||||
<div class="dealer-info">
|
<div class="dealer-info">
|
||||||
<div v-if="record.firstUserId" class="dealer-level">
|
<div v-if="record.firstUserId" class="dealer-level">
|
||||||
@@ -93,9 +118,22 @@
|
|||||||
|
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
||||||
<a @click="openEdit(record)" class="ele-text-success"> 结算 </a>
|
<a @click="settleOrder(record)" class="ele-text-success">
|
||||||
|
结算
|
||||||
|
</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
</template>
|
</template>
|
||||||
|
<!-- <template v-if="record.isInvalid === 0">-->
|
||||||
|
<!-- <a-popconfirm-->
|
||||||
|
<!-- title="确定要标记此订单为失效吗?"-->
|
||||||
|
<!-- @confirm="invalidateOrder(record)"-->
|
||||||
|
<!-- placement="topRight"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <a class="text-purple-500">-->
|
||||||
|
<!-- 验证-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </a-popconfirm>-->
|
||||||
|
<!-- </template>-->
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
v-if="record.isSettled === 0"
|
v-if="record.isSettled === 0"
|
||||||
title="确定要删除吗?"
|
title="确定要删除吗?"
|
||||||
@@ -121,7 +159,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, ref } from 'vue';
|
import { createVNode, ref } from 'vue';
|
||||||
import { message, Modal } from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import {
|
||||||
|
ExclamationCircleOutlined,
|
||||||
|
DollarOutlined
|
||||||
|
} from '@ant-design/icons-vue';
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
@@ -139,7 +180,10 @@
|
|||||||
ShopDealerOrder,
|
ShopDealerOrder,
|
||||||
ShopDealerOrderParam
|
ShopDealerOrderParam
|
||||||
} from '@/api/shop/shopDealerOrder/model';
|
} from '@/api/shop/shopDealerOrder/model';
|
||||||
import { exportShopDealerOrder } from '@/api/shop/shopDealerOrder';
|
import {
|
||||||
|
exportShopDealerOrder,
|
||||||
|
updateShopDealerOrder
|
||||||
|
} from '@/api/shop/shopDealerOrder';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
@@ -169,9 +213,8 @@
|
|||||||
}
|
}
|
||||||
// 保存当前搜索条件用于导出
|
// 保存当前搜索条件用于导出
|
||||||
currentWhere.value = { ...where };
|
currentWhere.value = { ...where };
|
||||||
// 未结算订单
|
// 已结算订单
|
||||||
where.isSettled = 0;
|
where.isSettled = 1;
|
||||||
where.myOrder = 1;
|
|
||||||
return pageShopDealerOrder({
|
return pageShopDealerOrder({
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
@@ -182,88 +225,77 @@
|
|||||||
|
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
width: 48,
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left',
|
||||||
|
hideInSetting: true,
|
||||||
|
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '订单编号',
|
title: '订单编号',
|
||||||
dataIndex: 'orderNo',
|
dataIndex: 'orderNo',
|
||||||
key: 'orderNo'
|
key: 'orderNo',
|
||||||
|
align: 'center',
|
||||||
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '客户名称',
|
title: '买家',
|
||||||
dataIndex: 'title',
|
dataIndex: 'title',
|
||||||
key: 'title',
|
key: 'title'
|
||||||
width: 220
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '结算电量',
|
title: '订单金额',
|
||||||
dataIndex: 'orderPrice',
|
dataIndex: 'orderPrice',
|
||||||
key: 'orderPrice',
|
key: 'orderPrice',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '换算成度',
|
title: '一级佣金(10%)',
|
||||||
dataIndex: 'degreePrice',
|
dataIndex: 'firstNickname',
|
||||||
key: 'degreePrice',
|
key: 'firstNickname',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '结算单价',
|
title: '二级佣金(5%)',
|
||||||
dataIndex: 'price',
|
dataIndex: 'secondNickname',
|
||||||
key: 'price',
|
key: 'secondNickname',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '结算金额',
|
title: '一级门店分红(2%/3%)',
|
||||||
dataIndex: 'settledPrice',
|
dataIndex: 'firstDividendUserName',
|
||||||
key: 'settledPrice',
|
key: 'firstDividendUserName',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '税费',
|
title: '二级门店分红(1%)',
|
||||||
dataIndex: 'rate',
|
dataIndex: 'secondDividendUserName',
|
||||||
key: 'rate',
|
key: 'secondDividendUserName',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '实发金额',
|
|
||||||
dataIndex: 'payPrice',
|
|
||||||
key: 'payPrice',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '签约状态',
|
|
||||||
dataIndex: 'isInvalid',
|
|
||||||
key: 'isInvalid',
|
|
||||||
align: 'center',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '月份',
|
|
||||||
dataIndex: 'month',
|
|
||||||
key: 'month',
|
|
||||||
align: 'center',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '结算状态',
|
title: '结算状态',
|
||||||
dataIndex: 'isSettled',
|
dataIndex: 'isSettled',
|
||||||
key: 'isSettled',
|
key: 'isSettled',
|
||||||
align: 'center',
|
align: 'center'
|
||||||
width: 100
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSetting: true
|
width: 180
|
||||||
}
|
}
|
||||||
|
// {
|
||||||
|
// title: '操作',
|
||||||
|
// key: 'action',
|
||||||
|
// width: 180,
|
||||||
|
// fixed: 'right',
|
||||||
|
// align: 'center',
|
||||||
|
// hideInSetting: true
|
||||||
|
// }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
@@ -272,6 +304,37 @@
|
|||||||
tableRef?.value?.reload({ where: where });
|
tableRef?.value?.reload({ where: where });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 结算单个订单 */
|
||||||
|
const settleOrder = (row: ShopDealerOrder) => {
|
||||||
|
const totalCommission = (
|
||||||
|
parseFloat(row.firstMoney || '0') +
|
||||||
|
parseFloat(row.secondMoney || '0') +
|
||||||
|
parseFloat(row.thirdMoney || '0')
|
||||||
|
).toFixed(2);
|
||||||
|
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确认结算',
|
||||||
|
content: `确定要结算此订单吗?总佣金金额:¥${totalCommission}`,
|
||||||
|
icon: createVNode(DollarOutlined),
|
||||||
|
okText: '确认结算',
|
||||||
|
okType: 'primary',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('正在结算...', 0);
|
||||||
|
// 这里调用结算API
|
||||||
|
updateShopDealerOrder({
|
||||||
|
...row,
|
||||||
|
isSettled: 1
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
hide();
|
||||||
|
message.success('结算成功');
|
||||||
|
reload();
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/* 批量结算 */
|
/* 批量结算 */
|
||||||
const batchSettle = () => {
|
const batchSettle = () => {
|
||||||
if (!selection.value.length) {
|
if (!selection.value.length) {
|
||||||
@@ -327,7 +390,7 @@
|
|||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: ShopDealerOrder) => {
|
const openEdit = (row?: ShopDealerOrder) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showEdit.value = true;
|
// showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 删除单个 */
|
/* 删除单个 */
|
||||||
|
|||||||
Reference in New Issue
Block a user