Commit 89a7ece2 authored by Bill's avatar Bill

Merge branch 'dev' into test

parents 5cf1a6b3 de76546c
......@@ -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'
},
]
},
// 平台结算管理
......
......@@ -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'},
]
......
......@@ -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>
{
......@@ -96,19 +98,13 @@ const SettleMethod = (props) => {
</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 || {};
......@@ -131,6 +127,10 @@ const Index = (props) => {
props.mutators.change(value);
}
if(!editable) {
return value.active == 1 ? `账期(默认), 账期天数${value.otherValues[0]}天 ` : `月结: 每月${value.otherValues[1]}号`
}
return (
<div>
<SettleMethod
......
......@@ -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 = () => {
......
......@@ -55,10 +55,13 @@ 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
{
isAdd || isEdit
? <Button
onClick={() => setVisible(true)}
style={{marginBottom: 16}}
block
......@@ -67,12 +70,15 @@ const MemberSettleAdd: React.FC = () => {
>
选择适用会员
</Button>
: null
}
</div>
)
}
const columns = common_columns.concat(
[
isAdd || isEdit
? [
{
title: '操作',
render: (text, record) => {
......@@ -82,6 +88,7 @@ const MemberSettleAdd: React.FC = () => {
}
}
]
: []
);
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} >
extra={
(
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} style={{display: isAdd || isEdit ? 'block' : 'none'}}>
保存
</Button>,
]}
</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,15 +52,37 @@
width: 56px;
margin-right: 12px;
.logo {
height: 56px;
width: 56px;
border-radius: 50%;
}
.randomLogo {
background-color: #255BA3;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 100%;
border-radius: 50%;
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 moment from 'moment';
import { Row, Col, Badge } 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 = ["天", "一","二", "三", "四", "五","六"];
......@@ -18,16 +20,64 @@ const EDIT_USER_URL = '/memberCenter/memberAbility/query';
const USER_CENTER_URL = '/memberCenter/memberAbility/manage/maintain'
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 [uploadLoading, setUpload]
const today = moment();
const userAuth = getAuth();
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, { 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}>
......@@ -45,13 +95,20 @@ const UserCenter: React.FC<Iprops> = () => {
</div>
<div className={styles.content}>
{/* http://10.0.0.25:4000/project/15/interface/api/38926 上传用户头像 */}
<Spin spinning={state.loading}>
<div className={styles.userLogo}>
<div className={styles.randomLogo}>
{
userAuth.logo
? <img src={userAuth.logo || ''} />
: <div className={styles.randomLogo}>H</div>
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>
</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