Commit 196d77b5 authored by Bill's avatar Bill

fix: 加工与结算bug

parent 82ccea90
...@@ -209,11 +209,12 @@ const MemberSettleAdd: React.FC = () => { ...@@ -209,11 +209,12 @@ const MemberSettleAdd: React.FC = () => {
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
extra={[ onBack={() => window.history.back()}
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} > extra={[
保存 <Button loading={submitLoading} key="1" type="primary" onClick={handleClick} >
</Button>, 保存
]} </Button>,
]}
> >
<Card> <Card>
<NiceForm <NiceForm
......
import React, { useEffect, useState, } from 'react'; import React, { useEffect, useState, } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined } from '@ant-design/icons'; import { SaveOutlined } from '@ant-design/icons';
import { Button, Card, Select, DatePicker, Radio, Table, Space, message } from 'antd'; import { Button, Card, Select, DatePicker, Radio, Table, Space, message, Modal } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import { createFormActions, FormEffectHooks } from '@formily/antd'; import { createFormActions, FormEffectHooks } from '@formily/antd';
...@@ -404,7 +404,7 @@ const Add: React.FC<{}> = () => { ...@@ -404,7 +404,7 @@ const Add: React.FC<{}> = () => {
}) })
} }
const handleChangeSomeList = (values: any) => { const handleChangeSomeList = (values: any, onOk, onCancel) => {
const isProcessProduct = formActions.getFieldValue('source') === 2; const isProcessProduct = formActions.getFieldValue('source') === 2;
const keyName = isProcessProduct ? 'Tabs.tab-2.layout.productList' : 'Tabs.tab-2.layout.orderList' const keyName = isProcessProduct ? 'Tabs.tab-2.layout.productList' : 'Tabs.tab-2.layout.orderList'
let someList = formActions.getFieldValue(keyName); let someList = formActions.getFieldValue(keyName);
...@@ -419,9 +419,21 @@ const Add: React.FC<{}> = () => { ...@@ -419,9 +419,21 @@ const Add: React.FC<{}> = () => {
productProps: values.productProps, productProps: values.productProps,
files: values.files files: values.files
} }
console.log(someList) if(!isProcessProduct && values.process.quantity > someList[index].restTotal) {
formActions.setFieldValue(keyName, [...someList]) Modal.confirm({
title: '当前编辑的商品加工数量大于剩余加工数量,是否继续?',
onOk: () => {
formActions.setFieldValue(keyName, [...someList])
!!onOk && onOk();
}
})
} else {
formActions.setFieldValue(keyName, [...someList])
!!onOk && onOk();
}
} }
} }
/** /**
......
...@@ -97,6 +97,19 @@ const Detail: React.FC<{}> = () => { ...@@ -97,6 +97,19 @@ const Detail: React.FC<{}> = () => {
} }
return res; return res;
}, [info]) }, [info])
const hasProductNoReply = useMemo(() => {
let res = false
if(pathname === `${PENDING_RECEIPT_PATH}/detail`) {
if(!info || !info.pnoReceiveDeliverDetailDOList) {
return false
}
res = info.pnoReceiveDeliverDetailDOList.some((item) => {
return item.receiptStatus === 1
});
return res
}
return res;
}, [info])
const getInfo = () => { const getInfo = () => {
const service = SERVICE_MAP[pathname]; const service = SERVICE_MAP[pathname];
...@@ -230,12 +243,16 @@ const Detail: React.FC<{}> = () => { ...@@ -230,12 +243,16 @@ const Detail: React.FC<{}> = () => {
const NextBtn = <Button loading={loading} icon={<SaveOutlined />} onClick={toNext} type="primary">提交</Button> const NextBtn = <Button loading={loading} icon={<SaveOutlined />} onClick={toNext} type="primary">提交</Button>
const AllReceiptReceive = ( const AllReceiptReceive = (
<Space direction={"vertical"}> <Space direction={"vertical"}>
<Popconfirm {
title={hasProductNoDelievery ? '您还有未发货的商品,是否确认全部发货已完成' : '确认本单全部发货单是否已全部收到回单'} hasProductNoReply
onConfirm={() => handleAllReceiptReceive(true)} ? <Popconfirm
> title={'确认本单全部发货单是否已全部收到回单'}
<Button loading={loading} type="primary" style={{width: '100%'}}>确认本单全部发货单已收到回单</Button> onConfirm={() => handleAllReceiptReceive(true)}
</Popconfirm> >
<Button loading={loading} type="primary" style={{width: '100%'}}>确认本单全部发货单已收到回单</Button>
</Popconfirm>
: null
}
<div style={{display: 'flex', justifyContent: 'flex-end'}}> <div style={{display: 'flex', justifyContent: 'flex-end'}}>
<Popconfirm <Popconfirm
title={hasProductNoDelievery ? '是否继续发货' : '您商品都已发货,是否确认还需要继续发货'} title={hasProductNoDelievery ? '是否继续发货' : '您商品都已发货,是否确认还需要继续发货'}
...@@ -339,7 +356,7 @@ const Detail: React.FC<{}> = () => { ...@@ -339,7 +356,7 @@ const Detail: React.FC<{}> = () => {
style={{padding: '0 32px', fontWeight: 400}} style={{padding: '0 32px', fontWeight: 400}}
colon={false} colon={false}
> >
<Descriptions.Item span={3} label="通知单摘要:" style={{overflow: 'hidden'}}>{info?.summary}我额时代峻峰卡德加弗兰克敬爱的封了就枯鲁杜鹃发大数据觉得封了就艾迪康类父节点拉屎发送到咖啡机的律师费</Descriptions.Item> <Descriptions.Item span={3} label="通知单摘要:" style={{overflow: 'hidden'}}>{info?.summary}</Descriptions.Item>
<Descriptions.Item label="加工企业:">{info?.processName}</Descriptions.Item> <Descriptions.Item label="加工企业:">{info?.processName}</Descriptions.Item>
<Descriptions.Item label="单据时间:">{info && info.createTime && moment(info.createTime).format('YYYY-MM-DD') || null }</Descriptions.Item> <Descriptions.Item label="单据时间:">{info && info.createTime && moment(info.createTime).format('YYYY-MM-DD') || null }</Descriptions.Item>
<Descriptions.Item label="通知单来源:">{info?.source == '1' ? '订单加工': '商品加工'}</Descriptions.Item> <Descriptions.Item label="通知单来源:">{info?.source == '1' ? '订单加工': '商品加工'}</Descriptions.Item>
...@@ -460,12 +477,6 @@ const Detail: React.FC<{}> = () => { ...@@ -460,12 +477,6 @@ const Detail: React.FC<{}> = () => {
<Appendix files={info.otherAsk?.annex}/> <Appendix files={info.otherAsk?.annex}/>
</div> </div>
</div> </div>
{/* <Row justify="space-between">
<Col flex={8}>
</Col>
<Col flex={2} style={{marginLeft: '20px'}} >
</Col>
</Row> */}
</div> </div>
<div style={{marginTop: '20px'}} > <div style={{marginTop: '20px'}} >
<Card bodyStyle={{padding: '10px 24px 24px 24px'}}> <Card bodyStyle={{padding: '10px 24px 24px 24px'}}>
......
...@@ -135,16 +135,17 @@ const processStock: React.FC<{}> = () => { ...@@ -135,16 +135,17 @@ const processStock: React.FC<{}> = () => {
} }
}, },
{ {
title: () => pathname == PENDING_ADD_PROCESS_PATH ? '入库单号' : '发货单号', title: () => [PENDING_ADD_PROCESS_PATH,ASSIGN_PENDING_RECEIVE].includes(pathname) ? '入库单号' : '发货单号',
dataIndex: 'deliveryNo', dataIndex: 'deliveryNo',
render: (text, record: any) => { render: (text, record: any) => {
if(!text) { if(!text) {
return null return null
} }
const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail'; const url = '/memberCenter/tranactionAbility/stockSellStorage/bills/detail';
const type = pathname == PENDING_ADD_PROCESS_PATH ? DOC_TYPE_PROCESS_RECEIPT : DOC_TYPE_PROCESS_INVOICE const type = [PENDING_ADD_PROCESS_PATH,ASSIGN_PENDING_RECEIVE].includes(pathname) ? 'storage' : 'delivery'
const id = type === 'storage' ? record.storageId : record.deliveryId
return ( return (
<EyePreview url={`${url}?id=${record.id}`} >{text}</EyePreview> <EyePreview url={`${url}?id=${id}`} >{record[`${type}No`]}</EyePreview>
) )
} }
}, },
......
...@@ -180,8 +180,9 @@ export const SUPPLIER_INNER_STATUS_COLOR = { ...@@ -180,8 +180,9 @@ export const SUPPLIER_INNER_STATUS_COLOR = {
"3": "processing", "3": "processing",
'4': 'processing', '4': 'processing',
"5": "success", "5": "success",
"7": "processing",
"9": "error", "9": "error",
"10": "success" "10": "success",
} }
......
...@@ -24,7 +24,6 @@ const styles = { ...@@ -24,7 +24,6 @@ const styles = {
const AppendixItem = (props) => { const AppendixItem = (props) => {
const handleDownload = (name:string, url: string) => { const handleDownload = (name:string, url: string) => {
console.log(url, name);
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
......
...@@ -27,6 +27,10 @@ const schema = { ...@@ -27,6 +27,10 @@ const schema = {
{ {
required: true, required: true,
message: '请填写加工数量' message: '请填写加工数量'
},
{
pattern: /^\d+$/,
message: '请填写数字'
} }
] ]
}, },
......
...@@ -5,7 +5,7 @@ import { PublicApi } from '@/services/api' ...@@ -5,7 +5,7 @@ import { PublicApi } from '@/services/api'
interface Iprops { interface Iprops {
type: "view" | "edit", // veiw | edit, type: "view" | "edit", // veiw | edit,
submit?: (params: any) => void, submit?: (params: any, onOk, onCancel) => void,
// id: string, // id: string,
// primaryKey: string // primaryKey: string
quantity?: string, quantity?: string,
...@@ -73,16 +73,31 @@ const ProcessDetail: React.FC<Iprops> = (props) => { ...@@ -73,16 +73,31 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
setFiles(props.files); setFiles(props.files);
}, [props.files]) }, [props.files])
const formSubmit = (values) => { useEffect(() => {
!!props.submit && props.submit({ setInfo((prevState) => {
files: files, return {
uniqueID: props.uniqueID, ...prevState,
process: values, quantity: props.quantity,
productProps: info?.attributes processUnitPrice: props.processUnitPrice
}
}) })
setVisible(false); }, [props.quantity, props.processUnitPrice])
console.log("fuck"); const formSubmit = (values) => {
!!props.submit && props.submit(
{
files: files,
uniqueID: props.uniqueID,
process: values,
productProps: info?.attributes
},
() => {
setVisible(false);
},
() => {
console.log("error")
}
)
} }
const fileOnChange = (values) => { const fileOnChange = (values) => {
...@@ -109,7 +124,7 @@ const ProcessDetail: React.FC<Iprops> = (props) => { ...@@ -109,7 +124,7 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
取消 取消
</Button> </Button>
<Button onClick={handleSubmit} type="primary"> <Button onClick={handleSubmit} type="primary">
确认{visible} 确认
</Button> </Button>
</div> </div>
} }
......
...@@ -26,17 +26,30 @@ interface Iprops { ...@@ -26,17 +26,30 @@ interface Iprops {
const FileList: React.FC<Iprops> = (props) => { const FileList: React.FC<Iprops> = (props) => {
const { name, url} = props; const { name, url} = props;
const handleDownload = (name:string, url: string) => {
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", name);
document.body.appendChild(link) //a标签插至页面中
link.click();
document.body.removeChild(link);
}
return ( return (
<div className={styles.item} > <div className={styles.item} >
<div className={styles.icon}> <div className={styles.icon}>
<img src={pdf_icon} className={styles.img} /> <img src={pdf_icon} className={styles.img} />
</div> </div>
<a className={styles.fileName} download={name} href={url} target={"_blank"}>{name}</a> <div className={styles.fileName} onClick={() => handleDownload(name, url)}>{name}</div>
<div className={styles.remove} onClick={() => !!props.removeFile && props.removeFile(name)}> {
<DeleteOutlined /> !!props.removeFile &&
</div> <div className={styles.remove} onClick={() => props.removeFile(name)}>
<DeleteOutlined />
</div>
}
</div> </div>
) )
} }
export default FileList export default FileList
\ No newline at end of file
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