feat(shop): 添加订单月份字段并优化搜索功能
- 在订单模型中新增 month 字段用于记录订单月份- 搜索组件中引入批量删除功能并优化按钮交互逻辑 - 替换搜索输入框为带搜索功能的 InputSearch 组件 - 更新结算金额和实发金额计算方式,使用 settledPrice 和 payPrice 字段 - 表格列中增加月份显示列并调整部分列宽度- 修改收益比率相关标签文案,如“税率”、“占比”等 - 调整编辑页数据绑定逻辑以支持新增字段展示 - 开发环境 API 地址默认启用本地地址配置
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ export interface ShopDealerOrder {
|
||||
rate?: number;
|
||||
// 商品单价
|
||||
price?: string;
|
||||
// 订单月份
|
||||
month?: string;
|
||||
// 订单是否失效(0未失效 1已失效)
|
||||
isInvalid?: number;
|
||||
// 佣金结算(0未结算 1已结算)
|
||||
|
||||
@@ -2,15 +2,31 @@
|
||||
<div class="flex items-center gap-20">
|
||||
<!-- 搜索表单 -->
|
||||
<a-form
|
||||
:model="searchForm"
|
||||
: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="searchForm.isInvalid"
|
||||
v-model:value="where.isInvalid"
|
||||
placeholder="全部"
|
||||
allow-clear
|
||||
style="width: 120px"
|
||||
@@ -22,7 +38,7 @@
|
||||
|
||||
<a-form-item label="结算状态">
|
||||
<a-select
|
||||
v-model:value="searchForm.isSettled"
|
||||
v-model:value="where.isSettled"
|
||||
placeholder="全部"
|
||||
allow-clear
|
||||
style="width: 120px"
|
||||
@@ -34,12 +50,19 @@
|
||||
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
||||
<template #icon>
|
||||
<SearchOutlined/>
|
||||
</template>
|
||||
搜索
|
||||
</a-button>
|
||||
<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>
|
||||
@@ -64,7 +87,7 @@
|
||||
type="primary"
|
||||
danger
|
||||
@click="batchSettle"
|
||||
class="ele-btn-icon"
|
||||
:disabled="selection?.length === 0"
|
||||
>
|
||||
<template #icon>
|
||||
<DollarOutlined/>
|
||||
@@ -83,10 +106,12 @@ import {reactive, ref} from 'vue';
|
||||
import {
|
||||
SearchOutlined,
|
||||
DollarOutlined,
|
||||
UploadOutlined
|
||||
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";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -109,7 +134,7 @@ const emit = defineEmits<{
|
||||
const showImport = ref(false);
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive<ShopDealerOrderParam>({
|
||||
const {where, resetFields} = useSearch<ShopDealerOrderParam>({
|
||||
orderId: undefined,
|
||||
orderNo: '',
|
||||
productName: '',
|
||||
@@ -119,7 +144,7 @@ const searchForm = reactive<ShopDealerOrderParam>({
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
const searchParams = {...searchForm};
|
||||
const searchParams = {...where};
|
||||
// 清除空值
|
||||
Object.keys(searchParams).forEach(key => {
|
||||
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
||||
@@ -131,12 +156,18 @@ const handleSearch = () => {
|
||||
|
||||
// 重置搜索
|
||||
const resetSearch = () => {
|
||||
Object.keys(searchForm).forEach(key => {
|
||||
searchForm[key] = key === 'orderId' ? undefined : '';
|
||||
});
|
||||
// Object.keys(searchForm).forEach(key => {
|
||||
// searchForm[key] = key === 'orderId' ? undefined : '';
|
||||
// });
|
||||
resetFields();
|
||||
emit('search', {});
|
||||
};
|
||||
|
||||
// 批量删除
|
||||
const removeBatch = () => {
|
||||
emit('remove');
|
||||
};
|
||||
|
||||
// 批量结算
|
||||
const batchSettle = () => {
|
||||
emit('batchSettle');
|
||||
|
||||
@@ -43,20 +43,20 @@
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="收益比率" name="rate">
|
||||
<a-form-item label="税率" name="rate">
|
||||
{{ form.rate }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item label="结算金额" name="payPrice">
|
||||
{{ (form.orderPrice * form.rate * 1000).toFixed(2) }}
|
||||
{{ parseFloat(form.settledPrice || 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) }}
|
||||
{{ parseFloat(form.payPrice || 0).toFixed(2) }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -83,7 +83,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="收益比率" name="rate">
|
||||
<a-form-item label="占比" name="rate">
|
||||
{{ '70%' }}
|
||||
</a-form-item>
|
||||
<a-form-item label="获取收益" name="firstMoney">
|
||||
@@ -116,7 +116,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="收益比率" name="rate">
|
||||
<a-form-item label="占比" name="rate">
|
||||
{{ '30%' }}
|
||||
</a-form-item>
|
||||
<a-form-item label="获取收益" name="secondMoney">
|
||||
@@ -179,6 +179,10 @@
|
||||
nickname: undefined,
|
||||
orderId: undefined,
|
||||
orderPrice: undefined,
|
||||
settledPrice: undefined,
|
||||
price: undefined,
|
||||
month: undefined,
|
||||
payPrice: undefined,
|
||||
firstUserId: undefined,
|
||||
secondUserId: undefined,
|
||||
thirdUserId: undefined,
|
||||
@@ -261,7 +265,7 @@
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.orderPrice && props.data.rate){
|
||||
form.firstMoney = (Number(props.data.orderPrice) * props.data.rate * 1000 * 0.5).toFixed(2)
|
||||
form.firstMoney = (Number(props.data.payPrice) * 0.7).toFixed(2)
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
v-model:selection="selection"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
@@ -16,6 +17,7 @@
|
||||
:selection="selection"
|
||||
@batchSettle="batchSettle"
|
||||
@export="handleExport"
|
||||
@remove="removeBatch"
|
||||
@importDone="reload"
|
||||
/>
|
||||
</template>
|
||||
@@ -40,11 +42,11 @@
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'settledPrice'">
|
||||
{{ (record.orderPrice * record.rate * 1000).toFixed(2) }}
|
||||
{{ record.settledPrice.toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'payPrice'">
|
||||
{{ (record.orderPrice * record.rate).toFixed(2) }}
|
||||
{{ record.payPrice.toFixed(2) }}
|
||||
</template>
|
||||
|
||||
<template v-if="column.key === 'dealerInfo'">
|
||||
@@ -189,7 +191,8 @@ const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '客户名称',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments'
|
||||
key: 'comments',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '结算电量',
|
||||
@@ -234,6 +237,13 @@ const columns = ref<ColumnItem[]>([
|
||||
align: 'center',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '月份',
|
||||
dataIndex: 'month',
|
||||
key: 'month',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '结算状态',
|
||||
dataIndex: 'isSettled',
|
||||
|
||||
Reference in New Issue
Block a user