feat(sdy): 新增分销商订单管理功能
- 添加分销商订单模型定义及API接口- 实现分销商订单导入导出功能- 完善订单编辑页面字段展示和校验逻辑- 调整订单列表页展示字段及操作按钮- 移除三级分销相关字段和功能- 修改订单状态标签文案和样式 - 增加订单删除确认弹窗- 优化导入弹窗组件及上传逻辑 - 调整搜索组件布局并增加导入按钮 - 更新订单详情弹窗标题和结算按钮文案 - 移除订单详情查看功能及相关代码 - 调整表格列配置和数据渲染方式 - 修复未签约订单提示逻辑 - 移除语言参数传递逻辑- 增加新窗口打开链接工具函数引入
This commit is contained in:
@@ -139,11 +139,11 @@ const datasource: DatasourceFunction = ({
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'applyId',
|
||||
key: 'applyId',
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
width: 90,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
@@ -425,7 +425,7 @@ const customRow = (record: ShopDealerApply) => {
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
// openEdit(record);
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -438,67 +438,3 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.sys-org-table {
|
||||
:deep(.ant-table-thead > tr > th) {
|
||||
background-color: #fafafa;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
:deep(.ant-table-tbody > tr:hover > td) {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
p {
|
||||
margin: 4px 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
strong {
|
||||
color: #1890ff;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.ele-text-primary {
|
||||
color: #1890ff;
|
||||
|
||||
&:hover {
|
||||
color: #40a9ff;
|
||||
}
|
||||
}
|
||||
|
||||
.ele-text-info {
|
||||
color: #13c2c2;
|
||||
|
||||
&:hover {
|
||||
color: #36cfc9;
|
||||
}
|
||||
}
|
||||
|
||||
.ele-text-success {
|
||||
color: #52c41a;
|
||||
|
||||
&:hover {
|
||||
color: #73d13d;
|
||||
}
|
||||
}
|
||||
|
||||
.ele-text-warning {
|
||||
color: #faad14;
|
||||
|
||||
&:hover {
|
||||
color: #ffc53d;
|
||||
}
|
||||
}
|
||||
|
||||
.ele-text-danger {
|
||||
color: #ff4d4f;
|
||||
|
||||
&:hover {
|
||||
color: #ff7875;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
79
src/views/sdy/shopDealerOrder/components/Import.vue
Normal file
79
src/views/sdy/shopDealerOrder/components/Import.vue
Normal file
@@ -0,0 +1,79 @@
|
||||
<!-- 经销商订单导入弹窗 -->
|
||||
<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 {importSdyDealerOrder} from "@/api/sdy/sdyDealerOrder";
|
||||
|
||||
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;
|
||||
importSdyDealerOrder(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,6 +1,5 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<div class="search-container">
|
||||
<div class="flex items-center gap-20">
|
||||
<!-- 搜索表单 -->
|
||||
<a-form
|
||||
:model="searchForm"
|
||||
@@ -8,23 +7,6 @@
|
||||
class="search-form"
|
||||
@finish="handleSearch"
|
||||
>
|
||||
<a-form-item label="订单编号">
|
||||
<a-input
|
||||
v-model:value="searchForm.orderId"
|
||||
placeholder="请输入订单编号"
|
||||
allow-clear
|
||||
style="width: 160px"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="商品名称">
|
||||
<a-input
|
||||
v-model:value="searchForm.productName"
|
||||
placeholder="请输入商品名称"
|
||||
allow-clear
|
||||
style="width: 160px"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="订单状态">
|
||||
<a-select
|
||||
@@ -54,7 +36,7 @@
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
<SearchOutlined/>
|
||||
</template>
|
||||
搜索
|
||||
</a-button>
|
||||
@@ -64,89 +46,110 @@
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-buttons">
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="!selection?.length"
|
||||
@click="batchSettle"
|
||||
class="ele-btn-icon"
|
||||
>
|
||||
<template #icon>
|
||||
<DollarOutlined />
|
||||
</template>
|
||||
批量结算
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<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"
|
||||
@click="batchSettle"
|
||||
class="ele-btn-icon"
|
||||
>
|
||||
<template #icon>
|
||||
<DollarOutlined/>
|
||||
</template>
|
||||
批量结算
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
|
||||
<!-- 导入弹窗 -->
|
||||
<Import v-model:visible="showImport" @done="emit('importDone')"/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive } from 'vue';
|
||||
import {
|
||||
SearchOutlined,
|
||||
DollarOutlined,
|
||||
ExportOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { ShopDealerOrderParam } from '@/api/shop/shopDealerOrder/model';
|
||||
import {reactive, ref} from 'vue';
|
||||
import {
|
||||
SearchOutlined,
|
||||
DollarOutlined,
|
||||
UploadOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type {ShopDealerOrderParam} from '@/api/shop/shopDealerOrder/model';
|
||||
import Import from './Import.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的数据
|
||||
selection?: any[];
|
||||
}>(),
|
||||
{
|
||||
selection: () => []
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的数据
|
||||
selection?: any[];
|
||||
}>(),
|
||||
{
|
||||
selection: () => []
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: ShopDealerOrderParam): void;
|
||||
(e: 'batchSettle'): void;
|
||||
(e: 'export'): void;
|
||||
(e: 'importDone'): void;
|
||||
}>();
|
||||
|
||||
// 是否显示导入弹窗
|
||||
const showImport = ref(false);
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive<ShopDealerOrderParam>({
|
||||
orderId: undefined,
|
||||
orderNo: '',
|
||||
productName: '',
|
||||
isInvalid: undefined,
|
||||
isSettled: undefined
|
||||
});
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
const searchParams = {...searchForm};
|
||||
// 清除空值
|
||||
Object.keys(searchParams).forEach(key => {
|
||||
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
||||
delete searchParams[key];
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: ShopDealerOrderParam): void;
|
||||
(e: 'batchSettle'): void;
|
||||
(e: 'export'): void;
|
||||
}>();
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive<ShopDealerOrderParam>({
|
||||
orderId: undefined,
|
||||
orderNo: '',
|
||||
productName: '',
|
||||
isInvalid: undefined,
|
||||
isSettled: undefined
|
||||
});
|
||||
emit('search', searchParams);
|
||||
};
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
const searchParams = { ...searchForm };
|
||||
// 清除空值
|
||||
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 : '';
|
||||
});
|
||||
emit('search', {});
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const resetSearch = () => {
|
||||
Object.keys(searchForm).forEach(key => {
|
||||
searchForm[key] = key === 'orderId' ? undefined : '';
|
||||
});
|
||||
emit('search', {});
|
||||
};
|
||||
// 批量结算
|
||||
const batchSettle = () => {
|
||||
emit('batchSettle');
|
||||
};
|
||||
|
||||
// 批量结算
|
||||
const batchSettle = () => {
|
||||
emit('batchSettle');
|
||||
};
|
||||
// 导出数据
|
||||
const exportData = () => {
|
||||
emit('export');
|
||||
};
|
||||
|
||||
// 导出数据
|
||||
const exportData = () => {
|
||||
emit('export');
|
||||
};
|
||||
// 打开导入弹窗
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑分销订单记录' : '添加分销订单记录'"
|
||||
:title="isUpdate ? '分销订单' : '分销订单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
:okText="`立即结算`"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
@@ -19,53 +20,51 @@
|
||||
>
|
||||
<!-- 订单基本信息 -->
|
||||
<a-divider orientation="left">
|
||||
<span style="color: #1890ff; font-weight: 600;">订单基本信息</span>
|
||||
<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 label="用户ID" name="userId">
|
||||
{{ form.userId }}
|
||||
</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 label="客户名称" name="comments">
|
||||
{{ form.comments }}
|
||||
</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="orderPrice">
|
||||
{{ parseFloat(form.orderPrice || 0).toFixed(2) }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="实发金额" name="payPrice">
|
||||
{{ (form.orderPrice * form.rate * 1000).toFixed(2) }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-form-item label="订单总金额" name="orderPrice">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="请输入订单总金额(不含运费)"
|
||||
v-model:value="form.orderPrice"
|
||||
style="width: 300px"
|
||||
>
|
||||
<template #addonAfter>元</template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
|
||||
|
||||
<!-- 分销商信息 -->
|
||||
<a-divider orientation="left">
|
||||
<span style="color: #1890ff; font-weight: 600;">分销商信息</span>
|
||||
<span style="color: #1890ff; font-weight: 600;">推荐收益</span>
|
||||
</a-divider>
|
||||
|
||||
<!-- 一级分销商 -->
|
||||
<div class="dealer-section">
|
||||
<h4 class="dealer-title">
|
||||
<a-tag color="red">一级分销商</a-tag>
|
||||
<a-tag color="red">推荐收益</a-tag>
|
||||
</h4>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
@@ -97,7 +96,7 @@
|
||||
<!-- 二级分销商 -->
|
||||
<div class="dealer-section">
|
||||
<h4 class="dealer-title">
|
||||
<a-tag color="orange">二级分销商</a-tag>
|
||||
<a-tag color="orange">简推收益</a-tag>
|
||||
</h4>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
@@ -126,62 +125,6 @@
|
||||
</a-row>
|
||||
</div>
|
||||
|
||||
<!-- 三级分销商 -->
|
||||
<div class="dealer-section">
|
||||
<h4 class="dealer-title">
|
||||
<a-tag color="gold">三级分销商</a-tag>
|
||||
</h4>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="用户ID" name="thirdUserId">
|
||||
<a-input-number
|
||||
:min="1"
|
||||
placeholder="请输入三级分销商用户ID"
|
||||
v-model:value="form.thirdUserId"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="分销佣金" name="thirdMoney">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="请输入三级分销佣金"
|
||||
v-model:value="form.thirdMoney"
|
||||
style="width: 100%"
|
||||
>
|
||||
<template #addonAfter>元</template>
|
||||
</a-input-number>
|
||||
</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="isInvalid">
|
||||
<a-radio-group v-model:value="form.isInvalid">
|
||||
<a-radio :value="0">有效</a-radio>
|
||||
<a-radio :value="1">失效</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="结算状态" name="isSettled">
|
||||
<a-radio-group v-model:value="form.isSettled">
|
||||
<a-radio :value="0">未结算</a-radio>
|
||||
<a-radio :value="1">已结算</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-form-item label="结算时间" name="settleTime" v-if="form.isSettled === 1">
|
||||
<a-date-picker
|
||||
v-model:value="form.settleTime"
|
||||
@@ -238,6 +181,7 @@
|
||||
const form = reactive<ShopDealerOrder>({
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
nickname: undefined,
|
||||
orderId: undefined,
|
||||
orderPrice: undefined,
|
||||
firstUserId: undefined,
|
||||
@@ -246,6 +190,11 @@
|
||||
firstMoney: undefined,
|
||||
secondMoney: undefined,
|
||||
thirdMoney: undefined,
|
||||
firstNickname: undefined,
|
||||
secondNickname: undefined,
|
||||
thirdNickname: undefined,
|
||||
rate: undefined,
|
||||
comments: undefined,
|
||||
isInvalid: 0,
|
||||
isSettled: 0,
|
||||
settleTime: undefined,
|
||||
@@ -261,13 +210,6 @@
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
userId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入买家用户ID',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
orderId: [
|
||||
{
|
||||
required: true,
|
||||
@@ -275,13 +217,6 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
orderPrice: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入订单总金额',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
firstUserId: [
|
||||
{
|
||||
validator: (rule: any, value: any) => {
|
||||
@@ -359,6 +294,10 @@
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
if(form.userId == 0){
|
||||
message.error('未签约');
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="shopDealerOrderId"
|
||||
row-key="id"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
@@ -15,7 +15,8 @@
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@batchSettle="batchSettle"
|
||||
@export="exportData"
|
||||
@export="handleExport"
|
||||
@importDone="reload"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
@@ -26,6 +27,26 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'orderPrice'">
|
||||
{{ parseFloat(record.orderPrice).toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'orderPrice1000'">
|
||||
{{ (record.orderPrice * 1000).toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'price'">
|
||||
{{ (record.price || 0).toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'settledPrice'">
|
||||
{{ (record.orderPrice * record.rate * 1000).toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'payPrice'">
|
||||
{{ (record.orderPrice * record.rate).toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'dealerInfo'">
|
||||
<div class="dealer-info">
|
||||
<div v-if="record.firstUserId" class="dealer-level">
|
||||
@@ -44,40 +65,53 @@
|
||||
</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>
|
||||
<a-tag v-if="record.isInvalid === 0" color="success">已签约</a-tag>
|
||||
<a-tag v-if="record.isInvalid === 1" color="error" @click="invalidateOrder(record)">未签约</a-tag>
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'isSettled'">
|
||||
<a-tag v-if="record.isSettled === 0" color="processing">未结算</a-tag>
|
||||
<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'">
|
||||
<a @click="viewDetail(record)" class="ele-text-info">
|
||||
<EyeOutlined/>
|
||||
详情
|
||||
</a>
|
||||
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="settleOrder(record)" class="ele-text-success">
|
||||
<DollarOutlined/>
|
||||
结算
|
||||
</a>
|
||||
</template>
|
||||
<template v-if="record.isInvalid === 0">
|
||||
<a-divider type="vertical"/>
|
||||
<a-popconfirm
|
||||
title="确定要标记此订单为失效吗?"
|
||||
@confirm="invalidateOrder(record)"
|
||||
placement="topRight"
|
||||
>
|
||||
<a class="ele-text-warning">
|
||||
<CloseOutlined/>
|
||||
失效
|
||||
</a>
|
||||
</a-popconfirm>
|
||||
</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
|
||||
title="确定要删除吗?"
|
||||
@confirm="remove(record)"
|
||||
placement="topRight"
|
||||
>
|
||||
<a class="text-red-500">
|
||||
删除
|
||||
</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
@@ -93,12 +127,9 @@ import {createVNode, ref} from 'vue';
|
||||
import {message, Modal} from 'ant-design-vue';
|
||||
import {
|
||||
ExclamationCircleOutlined,
|
||||
EyeOutlined,
|
||||
DollarOutlined,
|
||||
CloseOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type {EleProTable} from 'ele-admin-pro';
|
||||
import {toDateString} from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
@@ -108,6 +139,7 @@ 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 {exportSdyDealerOrder} from "@/api/sdy/sdyDealerOrder";
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -118,11 +150,12 @@ const selection = ref<ShopDealerOrder[]>([]);
|
||||
const current = ref<ShopDealerOrder | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
// 当前搜索条件
|
||||
const currentWhere = ref<ShopDealerOrderParam>({});
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
@@ -134,6 +167,8 @@ const datasource: DatasourceFunction = ({
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
// 保存当前搜索条件用于导出
|
||||
currentWhere.value = {...where};
|
||||
return pageShopDealerOrder({
|
||||
...where,
|
||||
...orders,
|
||||
@@ -145,86 +180,76 @@ const datasource: DatasourceFunction = ({
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '商品信息',
|
||||
key: 'productInfo',
|
||||
align: 'left',
|
||||
width: 200,
|
||||
customRender: ({record}) => {
|
||||
return `商品ID: ${record.productId || '-'}`;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '单价/数量',
|
||||
key: 'priceInfo',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
customRender: ({record}) => {
|
||||
return `¥${parseFloat(record.unitPrice || '0').toFixed(2)} × ${record.quantity || 1}`;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '订单信息',
|
||||
key: 'orderInfo',
|
||||
align: 'left',
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
title: '买家',
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
customRender: ({text}) => `用户${text || '-'}`
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '分销商信息',
|
||||
key: 'dealerInfo',
|
||||
align: 'left',
|
||||
width: 300
|
||||
title: '客户名称',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments'
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
title: '结算电量',
|
||||
dataIndex: 'orderPrice',
|
||||
key: 'orderPrice',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '换算成度',
|
||||
dataIndex: 'orderPrice1000',
|
||||
key: 'orderPrice1000',
|
||||
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,
|
||||
filters: [
|
||||
{text: '有效', value: 0},
|
||||
{text: '失效', value: 1}
|
||||
]
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '结算状态',
|
||||
dataIndex: 'isSettled',
|
||||
key: 'isSettled',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
filters: [
|
||||
{text: '未结算', value: 0},
|
||||
{text: '已结算', value: 1}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '结算时间',
|
||||
dataIndex: 'settleTime',
|
||||
key: 'settleTime',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
customRender: ({text}) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
sorter: true,
|
||||
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd HH:mm')
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 240,
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
@@ -237,64 +262,6 @@ const reload = (where?: ShopDealerOrderParam) => {
|
||||
tableRef?.value?.reload({where: where});
|
||||
};
|
||||
|
||||
/* 查看订单详情 */
|
||||
const viewDetail = (row: ShopDealerOrder) => {
|
||||
Modal.info({
|
||||
title: '分销订单详情',
|
||||
width: 800,
|
||||
content: createVNode('div', {style: 'max-height: 500px; overflow-y: auto;'}, [
|
||||
createVNode('div', {class: 'detail-section'}, [
|
||||
createVNode('h4', null, '订单基本信息'),
|
||||
createVNode('p', null, `订单ID: ${row.orderId || '-'}`),
|
||||
createVNode('p', null, `买家用户ID: ${row.userId || '-'}`),
|
||||
createVNode('p', null, `订单金额: ¥${parseFloat(row.orderPrice || '0').toFixed(2)}`),
|
||||
createVNode('p', null, `创建时间: ${row.createTime ? toDateString(row.createTime, 'yyyy-MM-dd HH:mm:ss') : '-'}`),
|
||||
]),
|
||||
createVNode('div', {class: 'detail-section', style: 'margin-top: 16px;'}, [
|
||||
createVNode('h4', null, '分销商信息'),
|
||||
...(row.firstUserId ? [
|
||||
createVNode('div', {style: 'margin: 8px 0; padding: 8px; background: #fff2f0; border-left: 3px solid #ff4d4f;'}, [
|
||||
createVNode('strong', null, '一级分销商'),
|
||||
createVNode('p', null, `用户ID: ${row.firstUserId}`),
|
||||
createVNode('p', null, `佣金: ¥${parseFloat(row.firstMoney || '0').toFixed(2)}`)
|
||||
])
|
||||
] : []),
|
||||
...(row.secondUserId ? [
|
||||
createVNode('div', {style: 'margin: 8px 0; padding: 8px; background: #fff7e6; border-left: 3px solid #fa8c16;'}, [
|
||||
createVNode('strong', null, '二级分销商'),
|
||||
createVNode('p', null, `用户ID: ${row.secondUserId}`),
|
||||
createVNode('p', null, `佣金: ¥${parseFloat(row.secondMoney || '0').toFixed(2)}`)
|
||||
])
|
||||
] : []),
|
||||
...(row.thirdUserId ? [
|
||||
createVNode('div', {style: 'margin: 8px 0; padding: 8px; background: #fffbe6; border-left: 3px solid #fadb14;'}, [
|
||||
createVNode('strong', null, '三级分销商'),
|
||||
createVNode('p', null, `用户ID: ${row.thirdUserId}`),
|
||||
createVNode('p', null, `佣金: ¥${parseFloat(row.thirdMoney || '0').toFixed(2)}`)
|
||||
])
|
||||
] : [])
|
||||
]),
|
||||
createVNode('div', {class: 'detail-section', style: 'margin-top: 16px;'}, [
|
||||
createVNode('h4', null, '状态信息'),
|
||||
createVNode('p', null, [
|
||||
'订单状态: ',
|
||||
createVNode('span', {
|
||||
style: `color: ${row.isInvalid === 0 ? '#52c41a' : '#ff4d4f'}; font-weight: bold;`
|
||||
}, row.isInvalid === 0 ? '有效' : '失效')
|
||||
]),
|
||||
createVNode('p', null, [
|
||||
'结算状态: ',
|
||||
createVNode('span', {
|
||||
style: `color: ${row.isSettled === 1 ? '#52c41a' : '#1890ff'}; font-weight: bold;`
|
||||
}, row.isSettled === 1 ? '已结算' : '未结算')
|
||||
]),
|
||||
createVNode('p', null, `结算时间: ${row.settleTime ? toDateString(new Date(row.settleTime), 'yyyy-MM-dd HH:mm:ss') : '-'}`),
|
||||
])
|
||||
]),
|
||||
okText: '关闭'
|
||||
});
|
||||
};
|
||||
|
||||
/* 结算单个订单 */
|
||||
const settleOrder = (row: ShopDealerOrder) => {
|
||||
const totalCommission = (parseFloat(row.firstMoney || '0') +
|
||||
@@ -373,13 +340,9 @@ const batchSettle = () => {
|
||||
};
|
||||
|
||||
/* 导出数据 */
|
||||
const exportData = () => {
|
||||
const hide = message.loading('正在导出数据...', 0);
|
||||
// 这里调用导出API
|
||||
setTimeout(() => {
|
||||
hide();
|
||||
message.success('数据导出成功');
|
||||
}, 2000);
|
||||
const handleExport = () => {
|
||||
// 调用导出API,传入当前搜索条件
|
||||
exportSdyDealerOrder(currentWhere.value);
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
|
||||
Reference in New Issue
Block a user