Commit 89a7ece2 authored by Bill's avatar Bill

Merge branch 'dev' into test

parents 5cf1a6b3 de76546c
...@@ -67,6 +67,14 @@ const BalancedRoute = { ...@@ -67,6 +67,14 @@ const BalancedRoute = {
hideInMenu: true, hideInMenu: true,
component: '@/pages/balance/settleRules/memberSettle/info' component: '@/pages/balance/settleRules/memberSettle/info'
}, },
// 结算规则配置 -> 会员支付策略编辑
{
path: '/memberCenter/balance/settleRules/memberSettleList/edit',
name: 'memberSettleDetailEdit',
icon: 'smile',
hideInMenu: true,
component: '@/pages/balance/settleRules/memberSettle/info'
},
] ]
}, },
// 平台结算管理 // 平台结算管理
......
...@@ -620,4 +620,5 @@ export default { ...@@ -620,4 +620,5 @@ export default {
'menu.balance.accountsReceivable.logisticsDetail': '物流通知单结算明细', 'menu.balance.accountsReceivable.logisticsDetail': '物流通知单结算明细',
'menu.balance.accountsReceivable.productNoticeSettlementDetail': '生产通知单结算明细', 'menu.balance.accountsReceivable.productNoticeSettlementDetail': '生产通知单结算明细',
'menu.balance.accountsReceivable.invoice': '开票管理', 'menu.balance.accountsReceivable.invoice': '开票管理',
'menu.balance.settleRules.memberSettleDetailEdit': '编辑会员结算策略'
}; };
...@@ -31,7 +31,7 @@ const columns = [ ...@@ -31,7 +31,7 @@ const columns = [
{title: '单据总额', dataIndex: 'orderAmount'}, {title: '单据总额', dataIndex: 'orderAmount'},
{title: '收货批次', dataIndex: 'batch'}, {title: '收货批次', dataIndex: 'batch'},
{title: '收货时间', dataIndex: 'receiveTime'}, {title: '收货时间', dataIndex: 'receiveTime'},
{title: '收货数量', dataIndex: 'receiveTime'}, {title: '收货数量', dataIndex: 'receiveCount'},
// {title: '加工单价', dataIndex: 'processPrice'}, // {title: '加工单价', dataIndex: 'processPrice'},
{title: '结算金额', dataIndex: 'settlementAmount'}, {title: '结算金额', dataIndex: 'settlementAmount'},
] ]
......
...@@ -44,16 +44,18 @@ const SettleMethod = (props) => { ...@@ -44,16 +44,18 @@ const SettleMethod = (props) => {
const handleInputChange = (value, type) => { const handleInputChange = (value, type) => {
const target = type - 1; const target = type - 1;
console.log(target);
const temp = [...otherValues]; const temp = [...otherValues];
temp[target] = value; temp[target] = value;
console.log(temp[target]);
props.onChange({ props.onChange({
active: type, active: type,
otherValues: temp otherValues: temp
}) })
} }
if(!monthVisible && !daysVisible ) {
return null
}
return ( return (
<div> <div>
{ {
...@@ -96,19 +98,13 @@ const SettleMethod = (props) => { ...@@ -96,19 +98,13 @@ const SettleMethod = (props) => {
</div> </div>
: null : null
} }
<div>
{
!monthVisible && !daysVisible
? <div>请在pass平台配置结算方式,否则无法创建会员策略</div>
: null
}
</div>
</div> </div>
) )
} }
const Index = (props) => { const Index = (props) => {
const editable = props.editable;
const value = props.value || {active: 0, otherValues: [30, 1]}; const value = props.value || {active: 0, otherValues: [30, 1]};
const componentProps = props.props['x-component-props'] || {}; const componentProps = props.props['x-component-props'] || {};
const options = componentProps.options || {}; const options = componentProps.options || {};
...@@ -131,6 +127,10 @@ const Index = (props) => { ...@@ -131,6 +127,10 @@ const Index = (props) => {
props.mutators.change(value); props.mutators.change(value);
} }
if(!editable) {
return value.active == 1 ? `账期(默认), 账期天数${value.otherValues[0]}天 ` : `月结: 每月${value.otherValues[1]}号`
}
return ( return (
<div> <div>
<SettleMethod <SettleMethod
......
...@@ -100,7 +100,7 @@ const PARAM_TO_TYPE = { ...@@ -100,7 +100,7 @@ const PARAM_TO_TYPE = {
const CorporateAccount = () => { const CorporateAccount = () => {
const [configs, setConfigs] = useState<Config[]>([]); const [configs, setConfigs] = useState<Config[]>([]);
const [unsaved, setUnsaved] = useState<boolean>(false) const [unsaved, setUnsaved] = useState<boolean>(false)
const [datas, setDatas] = useState<AccountDetal>(null); // const [datas, setDatas] = useState<AccountDetal>(null);
const changeEdit = (name: string, res: any, type: string) => { const changeEdit = (name: string, res: any, type: string) => {
let temp = [...configs]; let temp = [...configs];
const index = temp.findIndex((row) => row.name === name); const index = temp.findIndex((row) => row.name === name);
...@@ -139,13 +139,13 @@ const CorporateAccount = () => { ...@@ -139,13 +139,13 @@ const CorporateAccount = () => {
} }
useEffect(() => { useEffect(() => {
const { memberId } = getAuth() || {}; const { memberId, memberRoleId } = getAuth() || {};
// 进行基础赋值, fetchData // 进行基础赋值, fetchData
///settle/accounts/corporate/account/getDetail ///settle/accounts/corporate/account/getDetail
async function fetchData() { async function fetchData() {
const { data } = await PublicApi.getSettleAccountsCorporateAccountGetDetail({memberId: memberId}); const { data } = await PublicApi.getSettleAccountsCorporateAccountGetDetail();
console.log(data); console.log(data);
setDatas(data); // setDatas(data);
setConfigs( setConfigs(
[ [
{ {
......
...@@ -15,7 +15,7 @@ import StatusSwitch from '@/components/StatusSwitch'; ...@@ -15,7 +15,7 @@ import StatusSwitch from '@/components/StatusSwitch';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd'; import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table'; import { ColumnsType } from 'antd/es/table';
import { history } from 'umi'; import { history, Link } from 'umi';
import { indexSchema } from './schema'; import { indexSchema } from './schema';
const formActions = createFormActions(); const formActions = createFormActions();
...@@ -70,6 +70,16 @@ const MemberSettle: React.FC<{}> = () => { ...@@ -70,6 +70,16 @@ const MemberSettle: React.FC<{}> = () => {
) )
} }
}, },
{
title: '操作',
render: (text, record) => {
return (
<Space>
<Link to={`/memberCenter/balance/settleRules/memberSettleList/edit?id=${record.id}`}>修改</Link>
</Space>
)
}
}
] ]
const goToCreate = () => { const goToCreate = () => {
......
...@@ -55,10 +55,13 @@ const MemberSettleAdd: React.FC = () => { ...@@ -55,10 +55,13 @@ const MemberSettleAdd: React.FC = () => {
const [submitLoading, setSubmitLoading ] = useState(false); const [submitLoading, setSubmitLoading ] = useState(false);
const [unsaved, setUnsaved] = useState(true); const [unsaved, setUnsaved] = useState(true);
const isAdd = !id && !preview; const isAdd = !id && !preview;
const isEdit = history.location.pathname.includes("edit");
const tableAddButton = () => { const tableAddButton = () => {
return ( return (
<div> <div>
<Button {
isAdd || isEdit
? <Button
onClick={() => setVisible(true)} onClick={() => setVisible(true)}
style={{marginBottom: 16}} style={{marginBottom: 16}}
block block
...@@ -67,12 +70,15 @@ const MemberSettleAdd: React.FC = () => { ...@@ -67,12 +70,15 @@ const MemberSettleAdd: React.FC = () => {
> >
选择适用会员 选择适用会员
</Button> </Button>
: null
}
</div> </div>
) )
} }
const columns = common_columns.concat( const columns = common_columns.concat(
[ isAdd || isEdit
? [
{ {
title: '操作', title: '操作',
render: (text, record) => { render: (text, record) => {
...@@ -82,6 +88,7 @@ const MemberSettleAdd: React.FC = () => { ...@@ -82,6 +88,7 @@ const MemberSettleAdd: React.FC = () => {
} }
} }
] ]
: []
); );
const handleCancelAddMember = () => { const handleCancelAddMember = () => {
...@@ -210,14 +217,17 @@ const MemberSettleAdd: React.FC = () => { ...@@ -210,14 +217,17 @@ const MemberSettleAdd: React.FC = () => {
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => window.history.back()} onBack={() => window.history.back()}
extra={[ extra={
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} > (
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} style={{display: isAdd || isEdit ? 'block' : 'none'}}>
保存 保存
</Button>, </Button>
]} )
}
> >
<Card> <Card>
<NiceForm <NiceForm
editable={isAdd || isEdit}
actions={formActions} actions={formActions}
initialValues={initialValue} initialValues={initialValue}
expressionScope={{ expressionScope={{
...@@ -234,7 +244,6 @@ const MemberSettleAdd: React.FC = () => { ...@@ -234,7 +244,6 @@ const MemberSettleAdd: React.FC = () => {
) )
}} }}
/> />
<ModalTable <ModalTable
modalTitle='选择适用会员' modalTitle='选择适用会员'
confirm={handleOkAddMember} confirm={handleOkAddMember}
......
...@@ -143,7 +143,10 @@ const processStock: React.FC<{}> = () => { ...@@ -143,7 +143,10 @@ const processStock: React.FC<{}> = () => {
} }
const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail'; const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail';
const type = [PENDING_ADD_PROCESS_PATH,ASSIGN_PENDING_RECEIVE].includes(pathname) ? 'storage' : 'delivery' const type = [PENDING_ADD_PROCESS_PATH,ASSIGN_PENDING_RECEIVE].includes(pathname) ? 'storage' : 'delivery'
const id = type === 'storage' ? record.storageId : record.deliveryId const id = type === 'storage' ? record.storageId : record.deliveryId;
if(!id) {
return null
}
return ( return (
<EyePreview url={`${url}?id=${id}`} >{record[`${type}No`]}</EyePreview> <EyePreview url={`${url}?id=${id}`} >{record[`${type}No`]}</EyePreview>
) )
......
...@@ -29,8 +29,8 @@ const schema = { ...@@ -29,8 +29,8 @@ const schema = {
message: '请填写加工数量' message: '请填写加工数量'
}, },
{ {
pattern: /^\d+$/, pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/,
message: '请填写数字' message: '请填写整数或保留两位小数'
} }
] ]
}, },
...@@ -41,6 +41,10 @@ const schema = { ...@@ -41,6 +41,10 @@ const schema = {
{ {
required: true, required: true,
message: '请填写加工单价' message: '请填写加工单价'
},
{
pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/,
message: '请填写整数或保留两位小数'
} }
] ]
} }
......
...@@ -13,7 +13,11 @@ const UploadFile = (props) => { ...@@ -13,7 +13,11 @@ const UploadFile = (props) => {
if (!isSizeLimit) { if (!isSizeLimit) {
message.error(`上传文件不超过${fileMaxSize}K!`); message.error(`上传文件不超过${fileMaxSize}K!`);
} }
return isSizeLimit; const isPdf = file.type === 'application/pdf';
if (!isPdf) {
message.error('仅支持上传PDF文件!');
}
return isSizeLimit && isPdf;
} }
const uploadProps = { const uploadProps = {
...@@ -46,7 +50,7 @@ const UploadFile = (props) => { ...@@ -46,7 +50,7 @@ const UploadFile = (props) => {
setLoading(false) setLoading(false)
} }
}, },
// beforeUpload: beforeUpload, beforeUpload: beforeUpload,
// transformFile: () => {} // transformFile: () => {}
}; };
......
...@@ -52,15 +52,37 @@ ...@@ -52,15 +52,37 @@
width: 56px; width: 56px;
margin-right: 12px; margin-right: 12px;
.logo {
height: 56px;
width: 56px;
border-radius: 50%;
}
.randomLogo { .randomLogo {
background-color: #255BA3; background-color: #255BA3;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
color: #fff; color: #fff;
position: relative;
overflow: hidden;
.text {
position: absolute;
top: 50%;
left: 50%;
margin-top: -12px;
margin-left: -4px;
}
.upload {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,0.3);
text-align: center;
color: #fff;
height: 20px;
cursor: pointer;
}
} }
} }
......
import React from 'react'; import React, { useReducer } from 'react';
import styles from './index.less'; import styles from './index.less';
import moment from 'moment'; import moment from 'moment';
import { Row, Col, Badge } from 'antd'; import { Badge, Upload, message, Spin } from 'antd';
import level1 from '@/assets/imgs/level1.png'; import level1 from '@/assets/imgs/level1.png';
import level2 from '@/assets/imgs/level2.png'; import level2 from '@/assets/imgs/level2.png';
import level3 from '@/assets/imgs/level3.png'; import level3 from '@/assets/imgs/level3.png';
...@@ -10,6 +10,8 @@ import { Link } from 'umi'; ...@@ -10,6 +10,8 @@ import { Link } from 'umi';
import { getAuth } from '@/utils/auth'; import { getAuth } from '@/utils/auth';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
import home_user from '@/assets/imgs/home_user.png'; import home_user from '@/assets/imgs/home_user.png';
import { UPLOAD_TYPE } from '@/constants'
import { PublicApi } from '@/services/api';
interface Iprops {} interface Iprops {}
const WEEKDAYS = ["天", "一","二", "三", "四", "五","六"]; const WEEKDAYS = ["天", "一","二", "三", "四", "五","六"];
...@@ -18,16 +20,64 @@ const EDIT_USER_URL = '/memberCenter/memberAbility/query'; ...@@ -18,16 +20,64 @@ const EDIT_USER_URL = '/memberCenter/memberAbility/query';
const USER_CENTER_URL = '/memberCenter/memberAbility/manage/maintain' const USER_CENTER_URL = '/memberCenter/memberAbility/manage/maintain'
const STATUS_COLOR: ("default" | "processing" | "error" | "success")[] = ["default", "processing", "error", "success"] const STATUS_COLOR: ("default" | "processing" | "error" | "success")[] = ["default", "processing", "error", "success"]
function reducer(state, action) {
switch (action.type) {
case 'uploading':
return {...state, loading: true};
case 'done':
return {...state, loading: false, logo: action.payload.url}
default:
throw new Error();
}
}
const UserCenter: React.FC<Iprops> = () => { const UserCenter: React.FC<Iprops> = () => {
// const [uploadLoading, setUpload]
const today = moment(); const today = moment();
const userAuth = getAuth(); const userAuth = getAuth();
const hasChangeMemberAuth = userAuth?.urls.includes(EDIT_USER_URL); const hasChangeMemberAuth = userAuth?.urls.includes(EDIT_USER_URL);
const hasCenterAuth = userAuth?.urls.includes(USER_CENTER_URL); const hasCenterAuth = userAuth?.urls.includes(USER_CENTER_URL);
const currentRole = userAuth.roles.filter((item) => item.memberRoleId === userAuth.memberRoleId) const currentRole = userAuth.roles.filter((item) => item.memberRoleId === userAuth.memberRoleId)
const [state, dispatch] = useReducer(reducer, { loading: false, logo: userAuth.logo})
if(!userAuth) { if(!userAuth) {
return null return null
} }
const uploadProps = {
name: 'file',
action: '/api/file/file/upload',
headers: {},
data: {
fileType: UPLOAD_TYPE
},
disabled: state.loading,
showUploadList: false,
onChange(info) {
if (info.file.status === 'uploading') {
dispatch({type: 'uploading'})
return;
}
if (info.file.status === 'done') {
const { code, data } = info.file.response
if(code === 1000) {
console.log('upload success')
PublicApi.postMemberBusinessLogoAdd({logo: data})
.then((res) => {
if(res.code === 1000) {
dispatch({type: 'done', payload: {url: data}})
}
})
}
}
},
beforeUpload(file){
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
return isJpgOrPng;
}
}
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.header}> <div className={styles.header}>
...@@ -45,13 +95,20 @@ const UserCenter: React.FC<Iprops> = () => { ...@@ -45,13 +95,20 @@ const UserCenter: React.FC<Iprops> = () => {
</div> </div>
<div className={styles.content}> <div className={styles.content}>
{/* http://10.0.0.25:4000/project/15/interface/api/38926 上传用户头像 */} {/* http://10.0.0.25:4000/project/15/interface/api/38926 上传用户头像 */}
<Spin spinning={state.loading}>
<div className={styles.userLogo}> <div className={styles.userLogo}>
<div className={styles.randomLogo}>
{ {
userAuth.logo state.logo
? <img src={userAuth.logo || ''} /> ? <img src={state.logo || ''} className={styles.logo}/>
: <div className={styles.randomLogo}>H</div> : <span className={styles.text}>H</span>
} }
<Upload {...uploadProps}>
<span className={styles.upload}>修改</span>
</Upload>
</div>
</div> </div>
</Spin>
<div className={styles.infos}> <div className={styles.infos}>
<div> <div>
<div className={styles.companyName}> <div className={styles.companyName}>
......
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