Commit b875a9d0 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 63f94004 7c60ea56
......@@ -81,7 +81,16 @@ const router = {
path: '/ruleSettingManager/platformSettlementStrategy/add',
name: 'addplatformSettlementStrategy',
component: '@/pages/ruleSettingManage/platformSettlementStrategy/info',
hidePageHeader: true
hidePageHeader: true,
hideInMenu: true
},
// 平台结算策略配置, 平台策略配置详情页
{
path: '/ruleSettingManager/platformSettlementStrategy/detail',
name: 'platformSettlementStrategyDetail',
component: '@/pages/ruleSettingManage/platformSettlementStrategy/info',
hidePageHeader: true,
hideInMenu: true
}
]
}
......
......@@ -70,6 +70,8 @@ export function render(oldRender:Function) {
}
console.log('render')
oldRender()
}).catch(() => {
oldRender()
})
} else {
oldRender()
......
......@@ -109,6 +109,7 @@ export default {
'menu.ruleSettingManager.memberAuthManageDetail': '会员角色权限设置',
'menu.ruleSettingManager.platformSettlementStrategy': '平台结算策略配置',
'menu.ruleSettingManager.addplatformSettlementStrategy': '新增平台结算策略',
'menu.ruleSettingManager.platformSettlementStrategyDetail': '平台结算策略详情',
// 品类和属性
'menu.classAndProperty': '平台品类及属性',
......
......@@ -44,10 +44,8 @@ const SettleMethod = (props) => {
const handleInputChange = (value, type) => {
const target = type - 1;
console.log(target);
const temp = [...otherValues];
temp[target] = value;
console.log(temp[target]);
props.onChange({
active: type,
otherValues: temp
......@@ -129,7 +127,6 @@ const Index = (props) => {
}, [props.initialValue, options])
const onChange = (value) => {
console.log(value);
props.mutators.change(value);
}
......
......@@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import NiceForm from '@/components/NiceForm';
import { Card, Button, message } from 'antd';
import { createFormActions } from '@formily/antd';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons'
import ModalTable from '@/components/ModalTable';
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
......@@ -23,6 +23,8 @@ import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt } from 'umi'
import { useLinkageUtils } from '@/utils/formEffectUtils'
const { onFormInit$, onFieldValueChange$ } = FormEffectHooks
export const fetchOptions = (service) => {
return async function() {
......@@ -35,7 +37,6 @@ export const fetchOptions = (service) => {
}
const formActions = createFormActions();
const { getSettleAccountsPlatformConfigGetMemberSettlementStrategyDetail } = PublicApi
const common_columns: any = [
{ title: 'ID', dataIndex: 'memberId' },
......@@ -60,6 +61,7 @@ const MemberSettleAdd: React.FC = () => {
const [visible, setVisible] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId' });
const [initialValue, setInitialValue] = useState({});
const [cacheMember, setCacheMember] = useState([]);
const { id, preview } = usePageStatus();
const [submitLoading, setSubmitLoading ] = useState(false);
const [unsaved, setUnsaved] = useState(true);
......@@ -97,33 +99,33 @@ const MemberSettleAdd: React.FC = () => {
setVisible(false);
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
const fetchBalancedMethods = async () => {
const { data } = await PublicApi.getManageRuleConfigurationList({platformType: '5'});
const length = data.length
return {
days: length > 0 && data[0].check,
month: length > 1 && data[1].check
};
}
// 获取适用会员
const fetchMemberData = async (params: any) => {
const { data } = await PublicApi.getMemberManageLowerPageBynamerole(params);
return data
}
// 获取适用会员下拉搜索框
const fetchMemberSearchFilter = async () => {
// /member/manage/role/sub/list
const { data, code } = await PublicApi.postMemberManageRoleSubList({}, {method: 'GET',ctlType: "none"});
// console.log(data);
///member/manage/all/provider/page
const { data, code } = await PublicApi.getMemberManageAllProviderPage(params);
if(code === 1000) {
return data
}
return [];
}
// 获取适用会员下拉搜索框
const fetchMemberSearchFilter = () => {
const linkage = useLinkageUtils();
onFormInit$().subscribe(() => {
PublicApi.getMemberManagePageitems({roleTypeEnum: '1'}).then(res => {
if(res.code === 1000) {
const { levels, memberTypes, roles } = res.data;
linkage.enum('level', levels.map((item) => ({label: item.levelTag, value: item.level})))
linkage.enum('memberTypeId', memberTypes.map((item) => ({label: item.memberTypeName, value: item.memberTypeId})))
linkage.enum('roleId', roles.map((item) => ({label: item.roleName, value: item.roleId})))
}
});
})
}
// 使用会员弹框确认
const handleOkAddMember = () => {
formActions.setFieldValue('Tabs.memberTab.someLists', memberRowCtl.selectRow);
......@@ -132,29 +134,34 @@ const MemberSettleAdd: React.FC = () => {
// 提交
const handleSubmit = (value) => {
console.log(value);
return ;
const memberList = value.someLists.map((item) => ({ memberId: item.memberId, roleId: item.roleId }));
const memberList = value.someLists.map((item) => (
{
memberId: item.memberId,
roleId: item.roleId,
}
)
);
const tempData = {
name: value.name,
settlementOrderType: value.settlementOrderType,
memberList: memberList,
memberList: value.isDefault ? [] : memberList,
settlementWay: value.settlementWay.active,
settlementDays: value.settlementWay.otherValues[0],
settlementDate: value.settlementWay.otherValues[1],
isDefault: value.isDefault
}
const serviceActions = isAdd
? PublicApi.postSettleAccountsPlatformConfigAddMemberSettlementStrategy
: PublicApi.postSettleAccountsPlatformConfigUpdateMemberSettlementStrategy
? PublicApi.postSettleAccountsPlatformConfigAddPlatformSettlementStrategy
: PublicApi.postSettleAccountsPlatformConfigUpdatePlatformSettlementStrategy
const postData = {...tempData, id: id || 0 }
console.log(postData)
setSubmitLoading(true);
setUnsaved(false);
serviceActions(postData).then((data) => {
setSubmitLoading(false);
if(data.code === 1000) {
history.push('/memberCenter/balance/settleRules/memberSettleList')
history.push('/ruleSettingManager/platformSettlementStrategy')
}
})
......@@ -175,6 +182,16 @@ const MemberSettleAdd: React.FC = () => {
memberRowCtl.setSelectedRowKeys(res.map((item) => item.memberId))
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
const fetchBalancedMethods = async () => {
const { data } = await PublicApi.getManageRuleConfigurationList({platformType: '5'});
const length = data.length
return {
days: length > 0 && data[0].check,
month: length > 1 && data[1].check
};
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
useEffect(() => {
fetchBalancedMethods().then(data => {
......@@ -191,7 +208,7 @@ const MemberSettleAdd: React.FC = () => {
useEffect(() => {
if(id) {
async function getInfo() {
const res = await getSettleAccountsPlatformConfigGetMemberSettlementStrategyDetail({id})
const res = await PublicApi.getSettleAccountsPlatformConfigGetPlatformSettlementStrategyDetail({id})
if(res.code === 1000) {
setInitialValue({
name: res.data.name,
......@@ -200,8 +217,10 @@ const MemberSettleAdd: React.FC = () => {
settlementWay: {
active: res.data.settlementWay,
otherValues: [res.data.settlementDays, res.data.settlementDate],
}
},
})
formActions.setFieldValue('Tabs.memberTab.layout.isDefault', res.data.isDefault)
formActions.setFieldValue('Tabs.memberTab.someLists', res.data.memberList);
// 必须设置key
memberRowCtl.setSelectRow(res.data.memberList);
......@@ -236,9 +255,10 @@ const MemberSettleAdd: React.FC = () => {
onSubmit={values => handleSubmit(values)}
schema={addSchema}
effects={() => {
// 获取单据类型
useAsyncSelect(
"settlementOrderType",
fetchOptions(PublicApi.getSettleAccountsCommonGetStrategySettlementOrderType)
fetchOptions(PublicApi.getSettleAccountsCommonGetPlatformStrategySettlementOrderType )
)
}}
/>
......@@ -254,6 +274,7 @@ const MemberSettleAdd: React.FC = () => {
tableProps={{
rowKey: 'memberId',
}}
width={1000}
formilyProps={
{
ctx: {
......@@ -267,11 +288,7 @@ const MemberSettleAdd: React.FC = () => {
'name',
FORM_FILTER_PATH,
)
// useAsyncSelect(
// 'roleId',
// fetchMemberSearchFilter,
// ['roleName', 'roleId']
// )
fetchMemberSearchFilter()
}
}
}
......
......@@ -61,14 +61,14 @@ export const addSchema: ISchema = {
}
}
},
// settlementOrderType: {
// type: 'string',
// enum: [],
// title: '结算单据',
// 'x-rules': [
// {required: true, message: '请填写策略名称'},
// ]
// }
settlementOrderType: {
type: 'string',
enum: [],
title: '结算单据',
'x-rules': [
{required: true, message: '请填写策略名称'},
]
}
},
}
}
......@@ -89,11 +89,11 @@ export const addSchema: ISchema = {
labelAlign: 'left'
},
properties: {
isAllMember: {
isDefault: {
type: 'radio',
enum: [
{label: '所有会员(默认)', value: 1},
{label: '指定会员', value: 2},
{label: '指定会员', value: 0},
],
default: 1,
title: '适用会员',
......@@ -101,7 +101,7 @@ export const addSchema: ISchema = {
{
type: 'value:visible',
target: '*(someLists)',
condition: '{{$value === 2}}'
condition: '{{$value === 0}}'
}
]
}
......@@ -158,10 +158,28 @@ export const memberSchema: ISchema = {
enum: [],
"x-component-props": {
placeholder: '选择会员角色',
style: {width: '200px'}
style: {width: '200px'},
allowClear: true,
}
},
memberTypeId: {
type: 'string',
enum: [],
"x-component-props": {
placeholder: '选择会员角色',
style: {width: '200px'},
allowClear: true,
}
},
level: {
type: 'string',
enum: [],
"x-component-props": {
placeholder: '选择会员角色',
style: {width: '200px'},
allowClear: true,
}
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
......
......@@ -25,12 +25,12 @@ const MemberSettle: React.FC<{}> = () => {
console.log(params);
const { current, pageSize, name } = params
const postData = {current, pageSize, name: name || ''}
const { data } = await PublicApi.getSettleAccountsPlatformConfigPageMemberSettlementStrategy(postData);
const { data } = await PublicApi.getSettleAccountsPlatformConfigPagePlatformSettlementStrategy(postData);
return data;
};
const handleModify = async (record) => {
const { code } = await PublicApi.postSettleAccountsPlatformConfigSetMemberSettlementStrategyStatus({id: record.id, status: record.status ? 0 : 1})
const { code } = await PublicApi.postSettleAccountsPlatformConfigSetPlatformSettlementStrategyStatus({id: record.id, status: record.status ? 0 : 1})
if(code == 1000) {
formActions.submit();
}
......@@ -45,7 +45,7 @@ const MemberSettle: React.FC<{}> = () => {
return (
<div>
<EyePreview
url={`/memberCenter/balance/settleRules/memberSettleList/detail?id=${record.id}&preview=1`}
url={`/ruleSettingManager/platformSettlementStrategy/detail?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
......@@ -53,8 +53,8 @@ const MemberSettle: React.FC<{}> = () => {
)
}
},
{ title: '结算方式', dataIndex: 'settlementOrderTypeName'},
{ title: '结算单据',dataIndex: 'settlementWayName'},
{ title: '结算方式', dataIndex: 'settlementWayName'},
{ title: '结算单据',dataIndex: 'settlementOrderTypeName'},
{
title: '状态',
dataIndex: 'status',
......@@ -71,7 +71,7 @@ const MemberSettle: React.FC<{}> = () => {
]
const goToCreate = () => {
history.push('/memberCenter/balance/settleRules/memberSettleList/add');
history.push('/ruleSettingManager/platformSettlementStrategy/add');
}
return (
<Card>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment