Commit 144cc365 authored by Bill's avatar Bill

fix: 修改首页,加工以及结算

parent 9201571d
......@@ -21,7 +21,7 @@ const BalancedRoute = {
icon: 'smile',
component: '@/pages/balance/settleRules/corporateAccount',
},
// 结算规则配置 -> 发票管理
// 结算规则配置 -> 发票管理
{
path: '/memberCenter/balance/settleRules/receiptList',
name: 'receiptList',
......@@ -67,6 +67,14 @@ const BalancedRoute = {
hideInMenu: true,
component: '@/pages/balance/settleRules/memberSettle/info'
},
// 结算规则配置 -> 会员支付策略编辑
{
path: '/memberCenter/balance/settleRules/memberSettleList/edit',
name: 'memberSettleDetailEdit',
icon: 'smile',
hideInMenu: true,
component: '@/pages/balance/settleRules/memberSettle/info'
},
]
},
// 平台结算管理
......@@ -177,4 +185,4 @@ const BalancedRoute = {
]
}
export default BalancedRoute
\ No newline at end of file
export default BalancedRoute
......@@ -620,4 +620,5 @@ export default {
'menu.balance.accountsReceivable.logisticsDetail': '物流通知单结算明细',
'menu.balance.accountsReceivable.productNoticeSettlementDetail': '生产通知单结算明细',
'menu.balance.accountsReceivable.invoice': '开票管理',
'menu.balance.settleRules.memberSettleDetailEdit': '编辑会员结算策略'
};
......@@ -31,7 +31,7 @@ const columns = [
{title: '单据总额', dataIndex: 'orderAmount'},
{title: '收货批次', dataIndex: 'batch'},
{title: '收货时间', dataIndex: 'receiveTime'},
{title: '收货数量', dataIndex: 'receiveTime'},
{title: '收货数量', dataIndex: 'receiveCount'},
// {title: '加工单价', dataIndex: 'processPrice'},
{title: '结算金额', dataIndex: 'settlementAmount'},
]
......@@ -45,7 +45,7 @@ interface infoType {
payName: string, // 付款方
orderTypeName: string, // 结算单据类型名称
totalCount: number, // 总单数
amount: number, // 结算金额
amount: number, // 结算金额
statusName: string // 结算状态名称
}
......@@ -86,7 +86,7 @@ const ProductNoticeSettlementDetail: React.FC = () => {
const receiveStartTime = values.receiveStartTime?.format(format);
const receiveEndTime = values.receiveEndTime?.format(format);
ref.current.reload({...values, startTime, endTime, receiveStartTime, receiveEndTime});
}
}
return (
<PageHeaderWrapper
......@@ -96,21 +96,21 @@ const ProductNoticeSettlementDetail: React.FC = () => {
style={{ padding: '0' }}
onBack={() => history.goBack()}
title={
<AvatarWrap
<AvatarWrap
info={{
aloneTxt: '单',
name: "结算单号:"
}}
}}
extra={(
<span style={{ fontSize: 12 }}>{infoDetail?.settlementNo}</span>
)}
/>
}
>
<Descriptions
column={3}
style={{
padding: '0 32px',
<Descriptions
column={3}
style={{
padding: '0 32px',
}}
>
<Descriptions.Item label="结算日期">{infoDetail?.settlementDate}</Descriptions.Item>
......@@ -133,7 +133,7 @@ const ProductNoticeSettlementDetail: React.FC = () => {
currentRef={ref}
fetchTableData={(params: any) => fetchListData(params)}
controlRender={
<NiceForm
<NiceForm
components={{RangePicker}}
actions={formActions}
expressionScope={{
......@@ -161,4 +161,4 @@ const ProductNoticeSettlementDetail: React.FC = () => {
)
}
export default ProductNoticeSettlementDetail
\ No newline at end of file
export default ProductNoticeSettlementDetail
......@@ -16,7 +16,7 @@ const MONTH = 2;
registerValidationRules({
settleMethodRule: value => {
const { active, otherValues } = value;
const isNumber = /^\d+$/; // 数字
const pattern = /[0-9]+\.[0-9]*/;
if(active == MONTH) {
......@@ -33,7 +33,7 @@ const SettleMethod = (props) => {
const handleChange = (e, type) => {
if(active == type) {
return ;
}
}
const previewValue = otherValues
// setActive(type)
props.onChange({
......@@ -44,16 +44,18 @@ 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
})
}
if(!monthVisible && !daysVisible ) {
return null
}
return (
<div>
{
......@@ -69,11 +71,11 @@ const SettleMethod = (props) => {
<div className={styles.days}>
<div style={{margin: '0 20px 0 12px'}}>账期天数</div>
<div>
<Input
addonAfter={"天"}
value={otherValues[DAY - 1]}
onChange={(e) => handleInputChange(e.target.value, DAY)}
disabled={active !== DAY}
<Input
addonAfter={"天"}
value={otherValues[DAY - 1]}
onChange={(e) => handleInputChange(e.target.value, DAY)}
disabled={active !== DAY}
style={{width: '160px'}}
/></div>
</div>
......@@ -93,22 +95,16 @@ const SettleMethod = (props) => {
<div className={styles.days}>
<div style={{marginRight: '20px'}}>每月结算日期:每月</div>
<div><Input addonAfter={"号"} style={{width: '160px'}} value={otherValues[MONTH - 1]} onChange={(e) => handleInputChange(e.target.value, MONTH)} disabled={active !== MONTH}/></div> </div>
</div>
</div>
: null
}
<div>
{
!monthVisible && !daysVisible
? <div>请在pass平台配置结算方式,否则无法创建会员策略</div>
: null
}
</div>
</div>
)
}
const Index = (props) => {
const editable = props.editable;
const value = props.value || {active: 0, otherValues: [30, 1]};
const componentProps = props.props['x-component-props'] || {};
const options = componentProps.options || {};
......@@ -117,7 +113,7 @@ const Index = (props) => {
// const componentProps = props.props['x-component-props'] || {};
const defaultValue = componentProps.default || {};
if(!options.days && !options.month) {
return
return
}
if(typeof props.initialValue == 'undefined') {
props.mutators.change(defaultValue)
......@@ -131,12 +127,16 @@ const Index = (props) => {
props.mutators.change(value);
}
if(!editable) {
return value.active == 1 ? `账期(默认), 账期天数${value.otherValues[0]}天 ` : `月结: 每月${value.otherValues[1]}号`
}
return (
<div>
<SettleMethod
value={value}
daysVisible={options.days}
monthVisible={options.month}
<SettleMethod
value={value}
daysVisible={options.days}
monthVisible={options.month}
onChange={onChange}
/>
</div>
......@@ -144,4 +144,4 @@ const Index = (props) => {
}
Index.isFieldComponent = true;
export default Index;
\ No newline at end of file
export default Index;
......@@ -100,7 +100,7 @@ const PARAM_TO_TYPE = {
const CorporateAccount = () => {
const [configs, setConfigs] = useState<Config[]>([]);
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) => {
let temp = [...configs];
const index = temp.findIndex((row) => row.name === name);
......@@ -139,13 +139,13 @@ const CorporateAccount = () => {
}
useEffect(() => {
const { memberId } = getAuth() || {};
const { memberId, memberRoleId } = getAuth() || {};
// 进行基础赋值, fetchData
///settle/accounts/corporate/account/getDetail
async function fetchData() {
const { data } = await PublicApi.getSettleAccountsCorporateAccountGetDetail({memberId: memberId});
const { data } = await PublicApi.getSettleAccountsCorporateAccountGetDetail();
console.log(data);
setDatas(data);
// setDatas(data);
setConfigs(
[
{
......
......@@ -15,7 +15,7 @@ import StatusSwitch from '@/components/StatusSwitch';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons';
import { ColumnsType } from 'antd/es/table';
import { history } from 'umi';
import { history, Link } from 'umi';
import { indexSchema } from './schema';
const formActions = createFormActions();
......@@ -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 = () => {
......@@ -98,7 +108,7 @@ const MemberSettle: React.FC<{}> = () => {
)
}}
onSubmit={values => ref.current.reload(values)}
schema={indexSchema}
/>
}
......@@ -108,4 +118,4 @@ const MemberSettle: React.FC<{}> = () => {
)
}
export default MemberSettle
\ No newline at end of file
export default MemberSettle
......@@ -55,33 +55,40 @@ const MemberSettleAdd: React.FC = () => {
const [submitLoading, setSubmitLoading ] = useState(false);
const [unsaved, setUnsaved] = useState(true);
const isAdd = !id && !preview;
const isEdit = history.location.pathname.includes("edit");
const tableAddButton = () => {
return (
<div>
<Button
onClick={() => setVisible(true)}
style={{marginBottom: 16}}
block
icon={<PlusOutlined/>}
type='dashed'
>
选择适用会员
</Button>
{
isAdd || isEdit
? <Button
onClick={() => setVisible(true)}
style={{marginBottom: 16}}
block
icon={<PlusOutlined/>}
type='dashed'
>
选择适用会员
</Button>
: null
}
</div>
)
}
const columns = common_columns.concat(
[
{
title: '操作',
render: (text, record) => {
return (
<div onClick={() => handleRemove(record.uniqueId)}>删除</div>
)
isAdd || isEdit
? [
{
title: '操作',
render: (text, record) => {
return (
<div onClick={() => handleRemove(record.uniqueId)}>删除</div>
)
}
}
}
]
]
: []
);
const handleCancelAddMember = () => {
......@@ -210,14 +217,17 @@ const MemberSettleAdd: React.FC = () => {
return (
<PageHeaderWrapper
onBack={() => window.history.back()}
extra={[
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} >
保存
</Button>,
]}
extra={
(
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} style={{display: isAdd || isEdit ? 'block' : 'none'}}>
保存
</Button>
)
}
>
<Card>
<NiceForm
editable={isAdd || isEdit}
actions={formActions}
initialValues={initialValue}
expressionScope={{
......@@ -234,7 +244,6 @@ const MemberSettleAdd: React.FC = () => {
)
}}
/>
<ModalTable
modalTitle='选择适用会员'
confirm={handleOkAddMember}
......
......@@ -143,7 +143,10 @@ const processStock: React.FC<{}> = () => {
}
const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail';
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 (
<EyePreview url={`${url}?id=${id}`} >{record[`${type}No`]}</EyePreview>
)
......
......@@ -29,8 +29,8 @@ const schema = {
message: '请填写加工数量'
},
{
pattern: /^\d+$/,
message: '请填写数字'
pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/,
message: '请填写整数或保留两位小数'
}
]
},
......@@ -41,6 +41,10 @@ const schema = {
{
required: true,
message: '请填写加工单价'
},
{
pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/,
message: '请填写整数或保留两位小数'
}
]
}
......
......@@ -13,7 +13,11 @@ const UploadFile = (props) => {
if (!isSizeLimit) {
message.error(`上传文件不超过${fileMaxSize}K!`);
}
return isSizeLimit;
const isPdf = file.type === 'application/pdf';
if (!isPdf) {
message.error('仅支持上传PDF文件!');
}
return isSizeLimit && isPdf;
}
const uploadProps = {
......@@ -46,7 +50,7 @@ const UploadFile = (props) => {
setLoading(false)
}
},
// beforeUpload: beforeUpload,
beforeUpload: beforeUpload,
// transformFile: () => {}
};
......
......@@ -52,6 +52,12 @@
width: 56px;
margin-right: 12px;
.logo {
height: 56px;
width: 56px;
border-radius: 50%;
}
.randomLogo {
background-color: #255BA3;
height: 100%;
......
import React, { useReducer } from 'react';
import styles from './index.less';
import moment from 'moment';
import { Badge, Upload } from 'antd';
import { Badge, Upload, message, Spin } from 'antd';
import level1 from '@/assets/imgs/level1.png';
import level2 from '@/assets/imgs/level2.png';
import level3 from '@/assets/imgs/level3.png';
......@@ -10,6 +10,8 @@ import { Link } from 'umi';
import { getAuth } from '@/utils/auth';
import StatusTag from '@/components/StatusTag';
import home_user from '@/assets/imgs/home_user.png';
import { UPLOAD_TYPE } from '@/constants'
import { PublicApi } from '@/services/api';
interface Iprops {}
const WEEKDAYS = ["天", "一","二", "三", "四", "五","六"];
......@@ -20,10 +22,10 @@ const STATUS_COLOR: ("default" | "processing" | "error" | "success")[] = ["defau
function reducer(state, action) {
switch (action.type) {
case 'increment':
return {count: state.count + 1};
case 'decrement':
return {count: state.count - 1};
case 'uploading':
return {...state, loading: true};
case 'done':
return {...state, loading: false, logo: action.payload.url}
default:
throw new Error();
}
......@@ -36,11 +38,46 @@ const UserCenter: React.FC<Iprops> = () => {
const hasChangeMemberAuth = userAuth?.urls.includes(EDIT_USER_URL);
const hasCenterAuth = userAuth?.urls.includes(USER_CENTER_URL);
const currentRole = userAuth.roles.filter((item) => item.memberRoleId === userAuth.memberRoleId)
// const [state, dispatch] = useReducer(reducer, { })
const [state, dispatch] = useReducer(reducer, { loading: false, logo: userAuth.logo})
if(!userAuth) {
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 (
<div className={styles.container}>
<div className={styles.header}>
......@@ -58,19 +95,20 @@ const UserCenter: React.FC<Iprops> = () => {
</div>
<div className={styles.content}>
{/* http://10.0.0.25:4000/project/15/interface/api/38926 上传用户头像 */}
<div className={styles.userLogo}>
{/* {
userAuth.logo
? <img src={userAuth.logo || ''} />
: <div className={styles.randomLogo}>H</div>
} */}
<div className={styles.randomLogo}>
<span className={styles.text}>H</span>
<Upload>
<span className={styles.upload}>修改</span>
</Upload>
<Spin spinning={state.loading}>
<div className={styles.userLogo}>
<div className={styles.randomLogo}>
{
state.logo
? <img src={state.logo || ''} className={styles.logo}/>
: <span className={styles.text}>H</span>
}
<Upload {...uploadProps}>
<span className={styles.upload}>修改</span>
</Upload>
</div>
</div>
</div>
</Spin>
<div className={styles.infos}>
<div>
<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