123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- import React,{Component} from 'react';
- import {Button, Form, Input, message, Modal, Spin} from "antd";
- import $ from "jquery/src/ajax";
- const layout = {
- labelCol: {
- span: 8,
- },
- wrapperCol: {
- span: 16,
- },
- };
- const formItemLayout = {
- labelCol: { span: 8 },
- wrapperCol: { span: 14 },
- };
- class PayRecord extends Component{
- constructor(props) {
- super(props);
- this.state={
- loading: false,
- paymentLogs: [],
- paymentDetails: {},
- financialPaymentList: [],
- }
- this.examineOperation = this.examineOperation.bind(this);
- this.noExamineOperation = this.noExamineOperation.bind(this);
- }
- componentDidMount() {
- this.getSelectPaymentLog(); //付款日志
- this.getPaymentDetails(); //支付详情
- this.getSelectfinancialPayment(); //财务付款列表
- }
- //付款日志
- getSelectPaymentLog(){
- this.setState({
- loading: true
- });
- $.ajax({
- type: 'get',
- cache: false,
- url: globalConfig.context + "/api/admin/company/selectPaymentLog",
- dataType: "json",
- data: {
- id: this.props.payId
- },
- success: function (data) {
- this.setState({
- loading: false
- });
- if (!data.data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- this.setState({
- paymentLogs: data.data
- })
- };
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- }
- //支付详情
- getPaymentDetails(){
- this.setState({
- loading: true
- });
- $.ajax({
- type: 'get',
- cache: false,
- url: globalConfig.context + "/api/admin/company/OrderPaymentDetails",
- dataType: "json",
- data: {
- id: this.props.payId
- },
- success: function (data) {
- this.setState({
- loading: false
- });
- if (!data.data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- this.setState({
- paymentDetails: data.data
- })
- };
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- }
- //财务付款列表
- getSelectfinancialPayment(){
- this.setState({
- loading: true
- });
- $.ajax({
- type: 'get',
- cache: false,
- url: globalConfig.context + "/api/admin/company/selectfinancialPayment",
- dataType: "json",
- data: {
- id: this.props.payId
- },
- success: function (data) {
- this.setState({
- loading: false
- });
- if (!data.data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- this.setState({
- financialPaymentList: data.data
- })
- };
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- }
- handleSubmit(e,status = 0){
- e.preventDefault();
- this.props.form.validateFieldsAndScroll((err, values) => {
- if (err) {
- return;
- }
- const { paymentDetails } = this.state;
- this.setState({
- loading: true
- })
- let data = {
- id: this.props.payId,
- paymentAmount: paymentDetails.paymentAmount,
- paymentStatus: paymentDetails.paymentStatus,
- status: status,//0 发起 1通过 2驳回(0重新发起,1通过审核,2驳回)
- }
- Object.assign(data,values)
- $.ajax({
- type: 'post',
- url: globalConfig.context + "/api/admin/company/updateOrderPayment",
- dataType: "json",
- data: data,
- }).done((res) => {
- if (res.error && res.error.length) {
- message.error(res.error[0].message);
- } else {
- message.success("重新申请成功");
- }
- }).always(() => {
- this.setState({
- loading: false
- })
- });
- })
- }
- //新增财务付款
- addfinancialPayment(e) {
- e.preventDefault();
- this.props.form.validateFieldsAndScroll((err, values) => {
- if (err) {
- return;
- }
- const { paymentDetails } = this.state;
- this.setState({
- loading: true
- })
- let data = {
- pid: this.props.payId,
- partyAmount: values.partyAmount,
- paymentTimes: values.paymentTimes
- }
- $.ajax({
- type: 'post',
- url: globalConfig.context + "/api/admin/company/addfinancialPayment",
- dataType: "json",
- data: data,
- }).done((res) => {
- if (res.error && res.error.length) {
- message.error(res.error[0].message);
- } else {
- message.success("新增成功");
- }
- }).always(() => {
- this.setState({
- loading: false
- })
- });
- })
- }
- //0审核 1驳回 2待支付 3已支付 4取消
- noExamineOperation(){
- return (
- this.state.paymentDetails.status === 1 ? <Form.Item>
- <Button type="primary" htmlType="submit">
- 重新发起申请
- </Button>
- </Form.Item> : <div/>
- )
- }
- examineOperation() {
- const { getFieldDecorator } = this.props.form;
- return (
- this.state.paymentDetails.status === 0 ? <Form.Item>
- {getFieldDecorator('remarks', {
- rules: [{ required: true, message: '请输入备注!' }],
- })(
- <Input style={{ width: '200px' }} placeholder="请输入备注" type={'textarea'}/>
- )}
- <Button type="primary" onClick={(e)=>{
- this.handleSubmit(e,2);
- }}>
- 驳回
- </Button>
- <Button type="primary" onClick={(e)=>{
- this.handleSubmit(e,1);
- }}>
- 通过
- </Button>
- </Form.Item> : this.state.paymentDetails.status === 2 ?
- <div>
- <Form.Item label="付款时间:">
- {getFieldDecorator('remarks', {
- rules: [{ required: true, message: '请输入付款时间!' }],
- })(
- <Input style={{ width: '100px' }} placeholder="请输入付款时间" type={'number'}/>
- )}
- </Form.Item>
- <Form.Item label="付款金额(万元):">
- {getFieldDecorator('remarks', {
- rules: [{ required: true, message: '请输入付款金额!' }],
- })(
- <Input style={{ width: '100px' }} placeholder="请输入付款金额" type={'time'}/>
- )}
- </Form.Item>
- <Button type="primary" onClick={(e)=>{
- this.addfinancialPayment(e)
- }}>
- 保存
- </Button>
- </div> : <div/>
- )
- }
- render() {
- const { getFieldDecorator } = this.props.form;
- const { paymentLogs,paymentDetails,financialPaymentList } = this.state;
- return(
- <Modal
- maskClosable={false}
- footer={null}
- visible={this.props.visible}
- onCancel={() => {
- this.props.changeVisible();
- }}
- >
- <Spin spinning={this.state.loading}>
- <div>
- <div>申请支付外包费用</div>
- <Form
- {...layout}
- name="basic"
- initialValues={{
- remember: true,
- }}
- onSubmit={(e)=>{
- this.handleSubmit(e)
- }}
- >
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="付款单位/个人:"
- >
- <div>{paymentDetails.companyName}</div>
- </Form.Item>
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="单价(万元):"
- >
- <div>{paymentDetails.nodeUnitPrice}</div>
- </Form.Item>
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="数量:"
- >
- {getFieldDecorator('quantity', {
- initialValue: parseInt(paymentDetails.quantity),
- rules: [{ required: false, message: '请输入數量!' }],
- })(
- <Input disabled={paymentDetails.quantity <= 1 || this.state.paymentDetails.status > 1} style={{ width: '200px' }} placeholder="请输入數量" type={'number'}/>
- )}
- </Form.Item>
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="总价(万元):"
- >
- <div>{paymentDetails.nodeTotalAmount}</div>
- </Form.Item>
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="已付(万元):"
- >
- <div>{paymentDetails.nodePartyAmount}</div>
- </Form.Item>
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="本次申请支付金额(万元):"
- >
- {getFieldDecorator('applicationAmount', {
- initialValue: paymentDetails.applicationAmount,
- rules: [{ required: true, message: '请输入本次申请支付金额!' }],
- })(
- <Input disabled={this.state.paymentDetails.status > 1} style={{ width: '200px' }} placeholder="请输入本次申请支付金额" type={'number'}/>
- )}
- </Form.Item>
- <Form.Item
- {...formItemLayout}
- style={{
- display:'flex'
- }}
- label="备注:"
- >
- <div>{paymentDetails.remarks}</div>
- </Form.Item>
- <div className='payStateList'>
- <div className='listTitle'>
- 支付状态
- </div>
- <div className='payList'>
- {
- paymentLogs.map((value,key)=>(
- <div key={key} className='payitem' style={{color:key === 0 ? '#f00' : '#000'}}>
- {value.aname+':'}
- {
- value.status === 0 ? '(发起)'+value.remarks :
- value.status === 1 ? '(通过)'+value.remarks : '(驳回)'+value.remarks
- }
- {
- value.createTimes
- }
- </div>
- ))
- }
- </div>
- </div>
- {paymentDetails.status === 2 || paymentDetails.status === 3 || paymentDetails.status === 4 ?<div className='payStateList'>
- <div className='listTitle' style={{display:'block',fontSize:'15px'}}>
- 上传付费凭证-财务
- <span style={{fontSize:'10px',paddingLeft:'10px'}}>实际付款(万元): {paymentDetails.paymentAmount}</span>
- </div>
- <div className='payList'>
- {
- financialPaymentList.map((value,key)=>(
- <div key={key} className='payitem' style={{color:key === 0 ? '#f00' : '#000'}}>
- 付款时间: {value.paymentTimes}
- <span style={{paddingLeft:'25px'}}>付款金额(万元): {value.partyAmount}</span>
- </div>
- ))
- }
- </div>
- </div> : <div/>}
- {
- this.props.isAuditPayment ? this.examineOperation() : this.noExamineOperation()
- }
- </Form>
- </div>
- </Spin>
- </Modal>
- )
- }
- }
- const WrappedNormalLoginForm = Form.create()(PayRecord);
- export default WrappedNormalLoginForm
|