新增分润页面
This commit is contained in:
parent
f623e62811
commit
487496c5bc
25
src/api/modules/profitconfig.js
Normal file
25
src/api/modules/profitconfig.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import instance from '../../utils/axios.js'
|
||||||
|
|
||||||
|
// 过滤设置相关API
|
||||||
|
const profitconfigApi = {
|
||||||
|
|
||||||
|
listProfitconfiglist: (params) => instance.get('/profitconfig/list', { params }),
|
||||||
|
|
||||||
|
// 获取过滤设置详细信息
|
||||||
|
getProfitconfig: (id) => instance.get(`/profitconfig/${id}`),
|
||||||
|
|
||||||
|
//删除
|
||||||
|
delProfitconfig: (ids) => {
|
||||||
|
const idStr = Array.isArray(ids) ? ids.join(',') : ids;
|
||||||
|
instance.delete(`/profitconfig/${idStr}`);
|
||||||
|
},
|
||||||
|
// 添加
|
||||||
|
addProfitconfig: (data) => instance.post('/profitconfig/add', data),
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
updateProfitconfig: (data) => instance.put('/profitconfig', data)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导出模块
|
||||||
|
export { profitconfigApi };
|
||||||
@ -31,7 +31,7 @@ export const getShopGoodsList = async (params = {}) => {
|
|||||||
if (params.isQueryAllGoods) queryParams.append('isQueryAllGoods', params.isQueryAllGoods);
|
if (params.isQueryAllGoods) queryParams.append('isQueryAllGoods', params.isQueryAllGoods);
|
||||||
if (params.isJoinDistribution) queryParams.append('isJoinDistribution', params.isJoinDistribution);
|
if (params.isJoinDistribution) queryParams.append('isJoinDistribution', params.isJoinDistribution);
|
||||||
|
|
||||||
const url = `/zhishu/shopGoods/list?${queryParams.toString()}`;
|
const url = `/shopGoods/list?${queryParams.toString()}`;
|
||||||
return instance.get(url);
|
return instance.get(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -166,6 +166,21 @@ const menuData = shallowRef([
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '分润管理',
|
||||||
|
path: '/profit',
|
||||||
|
icon: Box,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: '分润配置',
|
||||||
|
path: '/profit/config'
|
||||||
|
},{
|
||||||
|
title: '分润订单信息',
|
||||||
|
path: '/profit/orderlist'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '工具管理',
|
title: '工具管理',
|
||||||
path: '/tools',
|
path: '/tools',
|
||||||
|
|||||||
@ -200,6 +200,16 @@ const routes = [{
|
|||||||
path: '/depotOrder/information',
|
path: '/depotOrder/information',
|
||||||
component: () => import('@/views/depotOrder/index.vue'),
|
component: () => import('@/views/depotOrder/index.vue'),
|
||||||
meta: { title: '仓库订单信息', permission: 'warehouse:depot:view' }
|
meta: { title: '仓库订单信息', permission: 'warehouse:depot:view' }
|
||||||
|
},
|
||||||
|
//快递打单账号管理 src/views/fastMail
|
||||||
|
{
|
||||||
|
path: '/profit/config',
|
||||||
|
component: () => import('@/views/profitconfig/index.vue'),
|
||||||
|
meta: { title: '分润配置信息', permission: 'warehouse:depot:view' }
|
||||||
|
}, {
|
||||||
|
path: '/profit/orderlist',
|
||||||
|
component: () => import('@/views/profitorderlist/index.vue'),
|
||||||
|
meta: { title: '分润配置信息', permission: 'warehouse:depot:view' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
|
|||||||
@ -533,6 +533,7 @@ const handleChangeStatus = async (row, newStatus) => {
|
|||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
|
debugger;
|
||||||
formRef.value.validate((valid) => {
|
formRef.value.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.id) {
|
if (form.id) {
|
||||||
@ -547,8 +548,8 @@ const submitForm = () => {
|
|||||||
} else {
|
} else {
|
||||||
// 新增
|
// 新增
|
||||||
addShop(form).then(res => {
|
addShop(form).then(res => {
|
||||||
if (res.data.code === 200) {
|
if (res.code === 200) {
|
||||||
ElMessage.success('新增成功')
|
ElMessage.success(res.message)
|
||||||
dialog.visible = false
|
dialog.visible = false
|
||||||
getShopListData()
|
getShopListData()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1626,7 +1626,7 @@
|
|||||||
const kfzShopList = [];
|
const kfzShopList = [];
|
||||||
const getShopList = async () => {
|
const getShopList = async () => {
|
||||||
const res = await getListShop();
|
const res = await getListShop();
|
||||||
const shopData = res.data || res || [];
|
const shopData = res.data.list || res || [];
|
||||||
if (shopData.length == 0) {
|
if (shopData.length == 0) {
|
||||||
shopList.length = 0;
|
shopList.length = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -48,9 +48,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<template #header >
|
<!-- <template #header >
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" >新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" >新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -58,18 +58,32 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(this)" >删除</el-button>
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(this)" >删除</el-button>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> -->
|
||||||
</el-row>
|
<!-- </el-row> -->
|
||||||
</template>
|
<!-- </template> -->
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="orderservicelist" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="orderservicelist" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
|
||||||
|
|
||||||
|
<el-table-column label="服务类型" align="center" prop="serviceName" width="150px">
|
||||||
|
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.order_item[0].serviceName}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="订单编号" align="center" prop="orderSn" width="500px" />
|
||||||
|
|
||||||
|
|
||||||
|
<el-table-column label="周期" align="center" prop="ServiceLength" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{scope.row.order_item[0].serviceLength}}{{ scope.row.order_item[0].serviceUnit}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="订单编号" align="center" prop="order_sn" width="500px" />
|
|
||||||
|
|
||||||
<el-table-column label="订单状态" align="center" prop="type">
|
<el-table-column label="订单状态" align="center" prop="type">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -83,15 +97,21 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="金额" align="center" prop="pay_amount" width="300px" />
|
<el-table-column label="金额" align="center" prop="payAmount" width="100px" />
|
||||||
<el-table-column label="创建时间" align="center" prop="create_time" width="400px">
|
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="400px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.create_time}}</span>
|
<span>{{ scope.row.createTime}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="用户" align="center" prop="userName" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.userName}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160px" fixed="right">
|
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160px" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +119,7 @@
|
|||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
@ -114,16 +134,18 @@
|
|||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body>
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body>
|
||||||
<el-form ref="shopOrderFormRef" :model="form" :rules="rules" label-width="160px">
|
<el-form ref="shopOrderFormRef" :model="form" :rules="rules" label-width="160px">
|
||||||
<el-row>
|
<el-row>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="服务类型" prop="payAmount">
|
||||||
|
<el-input v-model="form.serviceName" placeholder="" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="订单编号" prop="orderSn">
|
<el-form-item label="订单编号" prop="orderSn">
|
||||||
<el-input v-model="form.orderSn" placeholder="" disabled />
|
<el-input v-model="form.orderSn" placeholder="" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
|
||||||
<el-form-item label="订单金额" prop="payAmount">
|
|
||||||
<el-input v-model="form.payAmount" placeholder="" disabled />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
@ -134,25 +156,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -168,7 +171,7 @@ let orderstatus_type = ref([]);
|
|||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const error = ref(null);
|
const error = ref(null);
|
||||||
const shopOrderFormRef = ref();
|
const shopOrderFormRef = ref();
|
||||||
|
const fo = ref();
|
||||||
const dialog = reactive({
|
const dialog = reactive({
|
||||||
visible: false,
|
visible: false,
|
||||||
title: '',
|
title: '',
|
||||||
@ -190,7 +193,18 @@ const orderEt = [
|
|||||||
{ value: 4, label: '已关闭' },
|
{ value: 4, label: '已关闭' },
|
||||||
{ value: 5, label: '无效订单' },
|
{ value: 5, label: '无效订单' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
const initFormData = {
|
||||||
|
id: null,
|
||||||
|
orderSn:null,
|
||||||
|
serviceName:null,
|
||||||
|
payAmount:null,
|
||||||
|
status:null,
|
||||||
|
};
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
|
form: { ...initFormData },
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -201,10 +215,13 @@ const data = reactive({
|
|||||||
params: {}
|
params: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 解构响应式数据
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
reset();
|
reset();
|
||||||
@ -213,20 +230,14 @@ const cancel = () => {
|
|||||||
dialogShipments.visible = false;
|
dialogShipments.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initFormData = {
|
|
||||||
id: null,
|
|
||||||
orderSn:null,
|
|
||||||
payAmount:null,
|
|
||||||
status:null,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
debugger;
|
debugger;
|
||||||
// form.value = { ...initFormData };
|
form.value = { ...initFormData };
|
||||||
// shopOrderFormRef.value?.resetFields();
|
shopOrderFormRef.value?.resetFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +245,7 @@ const reset = () => {
|
|||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
console.log('click')
|
console.log('click')
|
||||||
}
|
}
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
|
||||||
// 参数表单
|
// 参数表单
|
||||||
|
|
||||||
// 查询记录发布数据列表
|
// 查询记录发布数据列表
|
||||||
@ -247,12 +258,11 @@ const getList = async () => {
|
|||||||
total.value = res.data.total;
|
total.value = res.data.total;
|
||||||
orderservicelist.value= res.data.list
|
orderservicelist.value= res.data.list
|
||||||
|
|
||||||
|
debugger
|
||||||
//循环给数组赋值
|
//循环给数组赋值
|
||||||
for (const item of res.data.list) {
|
for (const item of res.data.list) {
|
||||||
try {
|
try {
|
||||||
|
item.createTime= timestampToYmd(item.createTime)
|
||||||
item.create_time= timestampToYmd(item.create_time)
|
|
||||||
console.log(`插入成功:`+item);
|
console.log(`插入成功:`+item);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`第 条失败,跳过:`, item);
|
console.error(`第 条失败,跳过:`, item);
|
||||||
@ -277,12 +287,13 @@ const getList = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleshow = async (row) => {
|
const handleshow = async (row) => {
|
||||||
debugger;
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
const _id = row?.id || ids.value[0];
|
const _id = row?.id || ids.value[0];
|
||||||
const res = await newshopOrderApi.getOrderServiceDetail(_id);
|
const res = await newshopOrderApi.getOrderServiceDetail(_id);
|
||||||
|
debugger;
|
||||||
|
console.log(res.data)
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "查看订单详情";
|
dialog.title = "查看订单详情";
|
||||||
@ -294,7 +305,7 @@ const handleshow = async (row) => {
|
|||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
debugger
|
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
|
|||||||
596
src/views/profitconfig/index.vue
Normal file
596
src/views/profitconfig/index.vue
Normal file
@ -0,0 +1,596 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="filter-set-container">
|
||||||
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="快递类型" prop="type">
|
||||||
|
<el-form-item label="订单类型" >
|
||||||
|
<el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable width="300px">
|
||||||
|
<el-option label="普通订单" value="NORMAL" />
|
||||||
|
<el-option label="团购订单" value="GROUP" />
|
||||||
|
<el-option label="秒杀订单" value="SECKILL" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="loadData">搜索</el-button>
|
||||||
|
<el-button @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header >
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" >新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate(this)" >修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(this)" >删除</el-button>
|
||||||
|
</el-col> -->
|
||||||
|
|
||||||
|
<!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> -->
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<el-table :data="tableData" v-loading="loading">
|
||||||
|
<el-table-column prop="id" label="ID" width="80" />
|
||||||
|
<el-table-column prop="orderType" label="订单类型" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag :type="getOrderTypeTag(row.orderType)">
|
||||||
|
{{ getOrderTypeText(row.orderType) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="config" label="分润配置">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<div v-for="(config, key) in row.config" :key="key" class="config-item">
|
||||||
|
<span class="config-label">{{ getRoleLabel(key) }}:</span>
|
||||||
|
<el-tag size="small">
|
||||||
|
{{ config.type === 1 ? '百分比' : '固定金额' }}: {{ config.value }}{{ config.type === 1 ? '%' : '元' }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
<div v-if="row.config.upwardProfit" class="upward-info">
|
||||||
|
<el-tag type="info" size="small">向上分润: {{ row.config.upwardProfit.enabled ? '开启' : '关闭' }}</el-tag>
|
||||||
|
<el-tag v-if="row.config.upwardProfit.enabled" type="success" size="small">
|
||||||
|
一级: {{ row.config.upwardProfit.floor1 ? '显示' : '隐藏' }}
|
||||||
|
</el-tag>
|
||||||
|
<el-tag v-if="row.config.upwardProfit.enabled && row.config.upwardProfit.floor1" type="warning" size="small">
|
||||||
|
二级: {{ row.config.upwardProfit.floor2 ? '显示' : '隐藏' }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间" width="180" />
|
||||||
|
<el-table-column label="操作" width="200" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button size="small" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
<el-button size="small" type="danger" @click="handleDelete(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="queryParams.pageNum"
|
||||||
|
v-model:page-size="queryParams.pageSize"
|
||||||
|
:total="total"
|
||||||
|
:page-sizes="[10, 20, 50]"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="loadData"
|
||||||
|
@current-change="loadData"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
<!-- 新增/编辑对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="dialogTitle"
|
||||||
|
v-model="dialogVisible"
|
||||||
|
width="700px"
|
||||||
|
@close="resetForm"
|
||||||
|
>
|
||||||
|
<el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
|
||||||
|
<el-form-item label="订单类型" prop="orderType">
|
||||||
|
<el-select v-model="form.orderType" placeholder="请选择订单类型">
|
||||||
|
<el-option label="普通订单" value="NORMAL" />
|
||||||
|
<el-option label="团购订单" value="GROUP" />
|
||||||
|
<el-option label="秒杀订单" value="SECKILL" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 向上分润控制 -->
|
||||||
|
<el-form-item label="代理分润控制">
|
||||||
|
<div class="upward-control">
|
||||||
|
<el-switch
|
||||||
|
v-model="form.config.upwardProfit.enabled"
|
||||||
|
active-text="启用代理分润"
|
||||||
|
inactive-text="关闭代理分润"
|
||||||
|
@change="handleUpwardProfitChange"
|
||||||
|
/>
|
||||||
|
<div v-if="form.config.upwardProfit.enabled" class="upward-options">
|
||||||
|
<el-checkbox
|
||||||
|
v-model="form.config.upwardProfit.floor1"
|
||||||
|
label="一级代理分润"
|
||||||
|
@change="handleFloor1Change"
|
||||||
|
/>
|
||||||
|
<!-- <el-checkbox
|
||||||
|
v-model="form.config.upwardProfit.floor2"
|
||||||
|
label="显示二级分润"
|
||||||
|
:disabled="!form.config.upwardProfit.floor1"
|
||||||
|
/> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="分润配置" prop="config">
|
||||||
|
<div class="config-form">
|
||||||
|
<!-- 平台自身分润(始终显示) -->
|
||||||
|
<div class="config-row">
|
||||||
|
<span class="role-label">{{ roleOptions.self.label }}:</span>
|
||||||
|
<el-radio-group v-model="form.config.self.type">
|
||||||
|
<el-radio :label="1">百分比</el-radio>
|
||||||
|
<el-radio :label="2">固定金额</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.config.self.value"
|
||||||
|
:min="0"
|
||||||
|
:max="form.config.self.type === 1 ? 100 : 999999"
|
||||||
|
:precision="2"
|
||||||
|
controls-position="right"
|
||||||
|
/>
|
||||||
|
<span class="unit">{{ form.config.self.type === 1 ? '%' : '元' }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 一级分润(根据控制显示) -->
|
||||||
|
<div v-if="form.config.upwardProfit.enabled && form.config.upwardProfit.floor1" class="config-row">
|
||||||
|
<span class="role-label">{{ roleOptions.floor1.label }}:</span>
|
||||||
|
<el-radio-group v-model="form.config.floor1.type">
|
||||||
|
<el-radio :label="1">百分比</el-radio>
|
||||||
|
<el-radio :label="2">固定金额</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.config.floor1.value"
|
||||||
|
:min="0"
|
||||||
|
:max="form.config.floor1.type === 1 ? 100 : 999999"
|
||||||
|
:precision="2"
|
||||||
|
controls-position="right"
|
||||||
|
/>
|
||||||
|
<span class="unit">{{ form.config.floor1.type === 1 ? '%' : '元' }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 二级分润(根据控制显示) -->
|
||||||
|
<!-- <div v-if="form.config.upwardProfit.enabled && form.config.upwardProfit.floor1 && form.config.upwardProfit.floor2" class="config-row">
|
||||||
|
<span class="role-label">{{ roleOptions.floor2.label }}:</span>
|
||||||
|
<el-radio-group v-model="form.config.floor2.type">
|
||||||
|
<el-radio :label="1">百分比</el-radio>
|
||||||
|
<el-radio :label="2">固定金额</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.config.floor2.value"
|
||||||
|
:min="0"
|
||||||
|
:max="form.config.floor2.type === 1 ? 100 : 999999"
|
||||||
|
:precision="2"
|
||||||
|
controls-position="right"
|
||||||
|
/>
|
||||||
|
<span class="unit">{{ form.config.floor2.type === 1 ? '%' : '元' }}</span>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<!-- 分润比例提示 -->
|
||||||
|
<div v-if="showPercentWarning" class="percent-warning">
|
||||||
|
<el-alert
|
||||||
|
title="百分比总和超过100%,请调整分润比例"
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { getCurrentInstance } from 'vue';
|
||||||
|
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
|
import { profitconfigApi } from '@/api/modules/profitconfig';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const loading = ref(false)
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const formRef = ref()
|
||||||
|
const tableData = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const isEdit = ref(false)
|
||||||
|
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
orderType: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const form = reactive({
|
||||||
|
id: null,
|
||||||
|
orderType: '',
|
||||||
|
config: {
|
||||||
|
self: { type: 1, value: 0 },
|
||||||
|
floor1: { type: 1, value: 0 },
|
||||||
|
floor2: { type: 1, value: 0 },
|
||||||
|
upwardProfit: {
|
||||||
|
enabled: false,
|
||||||
|
floor1: false,
|
||||||
|
floor2: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 角色选项
|
||||||
|
const roleOptions = {
|
||||||
|
self: { label: '用户分润' },
|
||||||
|
floor1: { label: '一级代理分润' }
|
||||||
|
// floor2: { label: '二级分润' }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算属性
|
||||||
|
const dialogTitle = computed(() => isEdit.value ? '编辑分润配置' : '新增分润配置')
|
||||||
|
|
||||||
|
const showPercentWarning = computed(() => {
|
||||||
|
let totalPercent = 0
|
||||||
|
|
||||||
|
// 平台自身分润
|
||||||
|
if (form.config.self.type === 1) {
|
||||||
|
totalPercent += form.config.self.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一级分润(如果启用且显示)
|
||||||
|
if (form.config.upwardProfit.enabled && form.config.upwardProfit.floor1 && form.config.floor1.type === 1) {
|
||||||
|
totalPercent += form.config.floor1.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 二级分润(如果启用且显示)
|
||||||
|
if (form.config.upwardProfit.enabled && form.config.upwardProfit.floor1 && form.config.upwardProfit.floor2 && form.config.floor2.type === 1) {
|
||||||
|
totalPercent += form.config.floor2.value
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalPercent > 100
|
||||||
|
})
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = {
|
||||||
|
orderType: [{ required: true, message: '请选择订单类型', trigger: 'change' }],
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
const errors = []
|
||||||
|
|
||||||
|
// 检查百分比总和
|
||||||
|
let totalPercent = 0
|
||||||
|
let percentItems = []
|
||||||
|
|
||||||
|
if (value.self.type === 1) {
|
||||||
|
totalPercent += value.self.value
|
||||||
|
percentItems.push(`用户分润: ${value.self.value}%`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.upwardProfit.enabled && value.upwardProfit.floor1 && value.floor1.type === 1) {
|
||||||
|
totalPercent += value.floor1.value
|
||||||
|
percentItems.push(`一级代理分润: ${value.floor1.value}%`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (totalPercent > 100) {
|
||||||
|
errors.push(new Error(`百分比总和${totalPercent}%超过100%,请调整`))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查一级分润显示时必须有值
|
||||||
|
if (value.upwardProfit.enabled && value.upwardProfit.floor1) {
|
||||||
|
if (value.floor1.value <= 0) {
|
||||||
|
errors.push(new Error('一级分润必须设置大于0的值'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查二级分润显示时必须有值
|
||||||
|
if (value.upwardProfit.enabled && value.upwardProfit.floor1 && value.upwardProfit.floor2) {
|
||||||
|
if (value.floor2.value <= 0) {
|
||||||
|
errors.push(new Error('二级分润必须设置大于0的值'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors.length > 0) {
|
||||||
|
callback(errors)
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听向上分润配置变化
|
||||||
|
watch(() => form.config.upwardProfit, (newVal) => {
|
||||||
|
// 如果关闭向上分润,隐藏所有上级分润
|
||||||
|
if (!newVal.enabled) {
|
||||||
|
form.config.upwardProfit.floor1 = false
|
||||||
|
form.config.upwardProfit.floor2 = false
|
||||||
|
}
|
||||||
|
}, { deep: true })
|
||||||
|
|
||||||
|
// 方法
|
||||||
|
const getOrderTypeTag = (type) => {
|
||||||
|
const map = { NORMAL: '', GROUP: 'success', SECKILL: 'danger' }
|
||||||
|
return map[type] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const getOrderTypeText = (type) => {
|
||||||
|
const map = { NORMAL: '普通订单', GROUP: '团购订单', SECKILL: '秒杀订单' }
|
||||||
|
return map[type] || type
|
||||||
|
}
|
||||||
|
|
||||||
|
const getRoleLabel = (key) => {
|
||||||
|
return roleOptions[key]?.label || key
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleUpwardProfitChange = (enabled) => {
|
||||||
|
if (!enabled) {
|
||||||
|
// 关闭向上分润时,重置一级二级分润的值
|
||||||
|
form.config.floor1.value = 0
|
||||||
|
form.config.floor2.value = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleFloor1Change = (showFloor1) => {
|
||||||
|
if (!showFloor1) {
|
||||||
|
// 隐藏一级分润时,同时隐藏二级分润并重置其值
|
||||||
|
form.config.upwardProfit.floor2 = false
|
||||||
|
form.config.floor2.value = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadData = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
// 调用API
|
||||||
|
const response = await axios.get('/api/profit-sharing/config/list', { params: queryParams })
|
||||||
|
tableData.value = response.data.rows
|
||||||
|
total.value = response.data.total
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('获取数据失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetQuery = () => {
|
||||||
|
Object.assign(queryParams, {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
orderType: ''
|
||||||
|
})
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAdd = () => {
|
||||||
|
isEdit.value = false
|
||||||
|
resetForm()
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
isEdit.value = true
|
||||||
|
// 深拷贝数据,确保编辑不影响原数据
|
||||||
|
const rowData = JSON.parse(JSON.stringify(row))
|
||||||
|
|
||||||
|
// 确保upwardProfit结构完整
|
||||||
|
if (!rowData.config.upwardProfit) {
|
||||||
|
rowData.config.upwardProfit = {
|
||||||
|
enabled: false,
|
||||||
|
floor1: false,
|
||||||
|
floor2: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(form, rowData)
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = async (row) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确定删除该分润配置吗?', '提示', { type: 'warning' })
|
||||||
|
await axios.delete(`/api/profit-sharing/config/${row.id}`)
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
if (error !== 'cancel') {
|
||||||
|
ElMessage.error('删除失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
if (formRef.value) {
|
||||||
|
formRef.value.resetFields()
|
||||||
|
}
|
||||||
|
Object.assign(form, {
|
||||||
|
id: null,
|
||||||
|
orderType: '',
|
||||||
|
config: {
|
||||||
|
self: { type: 1, value: 0 },
|
||||||
|
floor1: { type: 1, value: 0 },
|
||||||
|
floor2: { type: 1, value: 0 },
|
||||||
|
upwardProfit: {
|
||||||
|
enabled: false,
|
||||||
|
floor1: false,
|
||||||
|
floor2: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
if (!formRef.value) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
await formRef.value.validate()
|
||||||
|
|
||||||
|
// 准备提交的数据
|
||||||
|
const submitData = JSON.parse(JSON.stringify(form))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 如果向上分润关闭,清理一级二级分润的值
|
||||||
|
if (!submitData.config.upwardProfit.enabled) {
|
||||||
|
submitData.config.floor1.value = 0
|
||||||
|
submitData.config.floor2.value = 0
|
||||||
|
}
|
||||||
|
// 如果一级分润隐藏,清理二级分润的值
|
||||||
|
else if (!submitData.config.upwardProfit.floor1) {
|
||||||
|
submitData.config.floor2.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加必要的字段或转换格式
|
||||||
|
if (!submitData.createTime) {
|
||||||
|
submitData.createTime = Date.now();
|
||||||
|
}
|
||||||
|
if (!submitData.updateTime) {
|
||||||
|
submitData.updateTime = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保 config 字段是字符串(如果 configObj 存在)
|
||||||
|
if (submitData.configObj && !submitData.config) {
|
||||||
|
submitData.config = JSON.stringify(submitData.configObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const api = isEdit.value
|
||||||
|
? profitconfigApi.updateProfitconfig(submitData)
|
||||||
|
: profitconfigApi.addProfitconfig(submitData)
|
||||||
|
|
||||||
|
await api
|
||||||
|
ElMessage.success(isEdit.value ? '更新成功' : '新增成功')
|
||||||
|
dialogVisible.value = false
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
if (error.errorFields) {
|
||||||
|
ElMessage.error('表单验证失败,请检查输入')
|
||||||
|
} else {
|
||||||
|
ElMessage.error('操作失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生命周期
|
||||||
|
onMounted(() => {
|
||||||
|
// loadData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-item {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-label {
|
||||||
|
display: inline-block;
|
||||||
|
width: 80px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upward-info {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upward-info .el-tag {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-form {
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 8px;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-label {
|
||||||
|
width: 100px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit {
|
||||||
|
margin-left: 8px;
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
margin-top: 16px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upward-control {
|
||||||
|
padding: 12px;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upward-options {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upward-options .el-checkbox {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.percent-warning {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
0
src/views/profitorderlist/index.vue
Normal file
0
src/views/profitorderlist/index.vue
Normal file
@ -1579,6 +1579,7 @@
|
|||||||
|
|
||||||
/** 发布商品 */
|
/** 发布商品 */
|
||||||
const goodsAddBtn = () => {
|
const goodsAddBtn = () => {
|
||||||
|
debugger;
|
||||||
formShops.value = { ...initFormShops.value };
|
formShops.value = { ...initFormShops.value };
|
||||||
dialog.shopChoose = true;
|
dialog.shopChoose = true;
|
||||||
}
|
}
|
||||||
@ -1595,24 +1596,26 @@
|
|||||||
const pddShopList = [];
|
const pddShopList = [];
|
||||||
const kfzShopList = [];
|
const kfzShopList = [];
|
||||||
const getShopList = async () => {
|
const getShopList = async () => {
|
||||||
|
debugger;
|
||||||
const res = await getListShop();
|
const res = await getListShop();
|
||||||
const shopData = res.data || res || [];
|
const shopData = res.data.list || res || [];
|
||||||
if (shopData.length == 0) {
|
if (shopData.length == 0) {
|
||||||
shopList.length = 0;
|
shopList.length = 0;
|
||||||
} else {
|
} else {
|
||||||
|
debugger;
|
||||||
for (var i = 0; i < shopData.length; i++) {
|
for (var i = 0; i < shopData.length; i++) {
|
||||||
if (res[i].shopType === "1") {
|
if (shopData[i].shopType === "1") {
|
||||||
pddShopList.push(
|
pddShopList.push(
|
||||||
{
|
{
|
||||||
value: res[i].id,
|
value: shopData[i].id,
|
||||||
label: res[i].shopName,
|
label: shopData[i].shopName,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else if (res[i].shopType === "2") {
|
} else if (shopData[i].shopType === "2") {
|
||||||
kfzShopList.push(
|
kfzShopList.push(
|
||||||
{
|
{
|
||||||
value: res[i].id,
|
value: shopData[i].id,
|
||||||
label: res[i].shopName,
|
label: shopData[i].shopName,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user