import React, { Component } from "react"; import { Form, Upload, Modal, Input, DatePicker, Button, message, Select, Table, Popconfirm, Spin } from "antd"; import AgreeButton from "./agreeButton.js"; import Rizhi from "./rizhi.js"; import PicturesWall from "./picturesWall"; import moment from "moment"; import { getProcessStatusNew, moneyVerify } from "@/tools.js"; import { shenghePeo, changeColor } from "@/tools.js"; import { typeList } from '@/dataDic.js' import $ from "jquery/src/ajax"; import ReactToPrint from "react-to-print"; import tongguo from "../../../../../../image/tongguo.png"; import quxiao from "../../../../../../image/quxiao.png"; import ProAndCuiList from "./proAndCuiList.jsx"; import Refund from "./refund.js" import "./xButton.less" import ImgList from "../../../../common/imgList"; import FlowChart from '../../../../common/flowchart'; // 流程图 import SelectReject from '../../../../common/selectreject'; // 驳回位置选择 const { RangePicker } = DatePicker; const { TextArea } = Input; const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 } }; const formItemLayoutRefund = { labelCol: { span: 5 }, wrapperCol: { span: 11 } }; const getChangeType = function (e) { if (e || e == 0) { let str = e.toString(); let theType = ""; typeList.map(function (item) { if (item.value == str) { theType = item.key; } }); return theType; } }; class Itemlist extends Component { constructor(props) { super(props); } render() { let pageData = this.props.pageData; return (

{pageData.dataA} { pageData.labelA === '当前进度' && }

{pageData.dataB}
); } } class ItemInput extends Component { constructor(props) { super(props); this.state = { valueA: "", valueB: "" }; } componentWillReceiveProps(nextProps) { if (!nextProps.reset) { this.reset(); } } reset() { this.setState({ valueA: "", valueB: "" }); } render() { let pageData = this.props.pageData; return (
{ this.setState({ valueA: e.target.value }); pageData.onChangeA(e.target.value); }} /> {pageData.mark ? ( { this.setState({ valueB: e.target.value }); pageData.onChangeB(e.target.value); }} /> ) : ( "" )}
); } } class ChangeDetail extends Component { constructor(props) { super(props); this.state = { rotateDeg: 0, rotateDeg1: 0, previewVisible: false, uploadVisible: false, buttonStatus: true, changeType: 2, dataSource: [], voucherUrl: [], loading: false, reason: "", // 累计回收退票 refundInvoice: 0, // 退票数组 contactList: [], // 退款数据 refundDataSource: [], rejectState: 0, // 收款信息 proceedsData: [], proceedsTotal: this.props.proceedsTotal, // 开票信息 invoiceData: [], invoiceTotal: this.props.invoiceTotal, cost: 10, refund: 8, // 测试添加退票 contactList: this.props.contactList, // 退款 refundColumn: [ { title: "退款金额(万元)", dataIndex: "refundAmount", key: "refundAmount", }, { title: "退款时间", dataIndex: "refundDate", key: "refundDate" }, { title: "备注", dataIndex: "remarks", key: "remarks" }, { title: "操作", dataIndex: "delete", key: "delete", render: (text, record) => { return ( { this.deleteRefund(record) }} okText="删除" cancelText="不删除" > ) } } ], ContactsLists: [ { title: "金额(万元)", dataIndex: "amount", key: "amount", render: (text, record) => { return (
实际回收退票(万元) { record.amount = e.target.value; this.setState({ contactList: this.state.contactList }); }} style={{ width: "120px" }} />
); } }, { title: "时间", dataIndex: "createTimes", key: "createTimes", render: (text, record) => { return (
{/* { record.time = v._d; this.setState({ contactList: this.state.contactList }); }} onOk={v => { record.time = v._d; this.setState({ contactList: this.state.contactList }); console.log(this.state); }} /> */} {record.createTimes}
); } }, { title: "操作", dataIndex: "dels", key: "dels", render: (text, record, index) => { return (
{ this.confirmDelet(record); }} okText="删除" cancelText="不删除" > {record.load != true ? ( ) : ( "" )}
); } } ] }; this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this); this.changeButtonStatus = this.changeButtonStatus.bind(this); this.reset = this.reset.bind(this); this.addcontact = this.addcontact.bind(this); this.contactSave = this.contactSave.bind(this); this.confirmDelet = this.confirmDelet.bind(this); this.finish = this.finish.bind(this); this.reload = this.reLoad.bind(this); this.downImg = this.downImg.bind(this); this.upImg = this.upImg.bind(this); this.downImg1 = this.downImg1.bind(this); this.upImg1 = this.upImg1.bind(this); this.rotate = this.rotate.bind(this); this.rotate1 = this.rotate1.bind(this); this.moneyOld = this.moneyOld.bind(this); this.addRefund = this.addRefund.bind(this); this.refundCancel = this.refundCancel.bind(this); this.sumitRefund = this.sumitRefund.bind(this); this.getVoucherUrl = this.getVoucherUrl.bind(this); this.refundGetList = this.refundGetList.bind(this); this.deleteRefund = this.deleteRefund.bind(this); this.refundExecute = this.refundExecute.bind(this); } componentWillReceiveProps(nextProps) { this.setState({ paymentTimes: nextProps.data.paymentTimes, paymentAmount: nextProps.data.paymentAmount, invoiceTimes: nextProps.data.invoiceTimes, invoiceAmount: nextProps.data.invoiceAmount, cwCost: nextProps.data.cwCost, refundableAmount: nextProps.data.refundableAmount, cwRemarks: nextProps.data.cwRemarks, contactList: nextProps.contactList, refundInvoice: nextProps.data.refundInvoice }); if (!nextProps.reset) { this.reset(); } } refundExecute() { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderChange/pushRefund", data: { id: this.props.id, refundUrl: this.state.refundUrl }, success: function (data) { let theArr = []; if (data.error && data.error.length) { message.warning(data.error[0].message); } else { message.success("提交退款成功!") this.refundGetList() this.props.onCancel() } }.bind(this) }).always( function () { this.setState({ loading: false }); }.bind(this) ); } deleteRefund(record) { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderChange/deleteRefund", data: { id: record.id }, success: function (data) { let theArr = []; if (data.error && data.error.length) { message.warning(data.error[0].message); } else { message.success("删除成功!") this.refundGetList() } }.bind(this) }).always( function () { this.setState({ loading: false }); }.bind(this) ); } sumitRefund() { if (this.state.refundMoney == "" || this.state.refundMoney == undefined) { message.warning("请填写正确退款金额") return } else if (this.state.refundRemarks == "" || this.state.refundRemarks == undefined) { message.warning("请填写备注") return } else if (this.state.refundDate == "" || this.state.refundDate == undefined) { message.warning("请选择退款时间") return } this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderChange/addRefund", data: { refundAmount: this.state.refundMoney, refundDate: this.state.refundDate, remarks: this.state.refundRemarks, orderNo: this.props.data.orderNo, cid: this.props.id, }, success: function (data) { let theArr = []; if (data.error && data.error.length) { message.warning(data.error[0].message); } else { message.success("添加成功!") this.refundGetList() this.setState({ addRefundVisible: false }) } }.bind(this) }).always( function () { this.setState({ loading: false }); }.bind(this) ); } refundGetList() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderChange/listRefund", data: { id: this.props.id }, success: function (data) { let theArr = []; if (data.error && data.error.length) { message.warning(data.error[0].message); } else { this.setState({ refundDataSource: data.data }) } }.bind(this) }).always( function () { this.setState({ loading: false }); }.bind(this) ); } moneyOld(str, money) { if (money) { return ( {str}(原合同金额{money}万元) ); } else { return ( {str} ); } } componentDidMount() { window.setTimeout(() => { const contactList = this.props.contactList; contactList.forEach(item => { item.load = true; }); this.setState({ contactList }); }, 0); this.refundGetList() } addRefund() { this.setState({ addRefundVisible: true, refundMoney: undefined, refundDate: undefined, refundRemarks: undefined, }) } refundCancel() { this.setState({ addRefundVisible: false, refundMoney: undefined, refundDate: undefined, refundRemarks: undefined, }) } getVoucherUrl(e) { this.setState({ voucherUrl: e }); let url = "" e.forEach((item, index) => { if (item.response && item.response.data) { if (index < e.length - 1) { url += item.response.data + "," } else { url += item.response.data } } }) this.setState({ refundUrl: url }) } downImg() { let num = 0; for (let i = 0; i < this.props.pictureUrl.length; i++) { if (this.props.pictureUrl[i].url == this.state.previewImage) { num = i; } } if (num == this.props.pictureUrl.length - 1) { return message.warning("已经是最后一张了哦"); } this.state.previewImage = this.props.pictureUrl[num + 1].url; this.setState({ previewImage: this.state.previewImage, rotateDeg: 0 }); } downImg1() { let num = 0; for (let i = 0; i < this.props.attachment.length; i++) { if (this.props.attachment[i].url == this.state.previewImage1) { num = i; } } if (num == this.props.attachment.length - 1) { return message.warning("已经是最后一张了哦"); } this.state.previewImage1 = this.props.attachment[num + 1].url; this.setState({ previewImage1: this.state.previewImage1, rotateDeg1: 0 }); } upImg() { let num = 0; for (let i = 0; i < this.props.pictureUrl.length; i++) { if (this.props.pictureUrl[i].url == this.state.previewImage) { num = i; } } if (num == 0) { return message.warning("已经是第一张了哦"); } this.state.previewImage = this.props.pictureUrl[num - 1].url; this.setState({ previewImage: this.state.previewImage, rotateDeg: 0 }); } upImg1() { let num = 0; for (let i = 0; i < this.props.attachment.length; i++) { if (this.props.attachment[i].url == this.state.previewImage1) { num = i; } } if (num == 0) { return message.warning("已经是第一张了哦"); } this.state.previewImage1 = this.props.attachment[num - 1].url; this.setState({ previewImage1: this.state.previewImage1, rotateDeg1: 0 }); } rotate() { let rotateDeg = this.state.rotateDeg + 90; let rotateDeg1 = this.state.rotateDeg + 90; this.setState({ rotateDeg, rotateDeg1 }); } rotate1() { let rotateDeg1 = this.state.rotateDeg + 90; this.setState({ rotateDeg1 }); } reset() { this.setState({ paymentTimes: null, paymentAmount: "", invoiceTimes: null, invoiceAmount: "", cwCost: "", refundableAmount: "", cwRemarks: "" }); } getOrgCodeUrl(e) { this.setState({ orgCodeUrl: e }); } // //查看催款节点 // loaduserss(record) { // this.state.orderList = []; // this.setState({ // orderNoss: record ? record.orderNo : this.props.datauser.orderNo // }); // $.ajax({ // method: "get", // dataType: "json", // crossDomain: false, // url: globalConfig.context + "/api/admin/newOrder/selectOrderDun", // data: { // orderNo: record ? record.orderNo : this.props.datauser.orderNo // }, // success: function(data) { // let theArr = []; // let thisData = []; // if (!thisData) { // if (data.error && data.error.length) { // message.warning(data.error[0].message); // } // thisData = {}; // } else { // for (let i = 0; i < data.data.length; i++) { // thisData = data.data[i]; // theArr.push({ // key: i, // dunSubject: thisData.dunSubject // ? thisData.dunSubject.toString() // : "", //催款科目 // id: thisData.id, //节点Id // money: thisData.money, //催款金额 // dunStatus: thisData.dunStatus, //催款状态 // orderNo: record ? record.orderNo : this.props.datauser.orderNo // }); // } // this.setState({ // contactList: theArr // }); // } // }.bind(this) // }).always( // function() { // this.setState({ // loading: false // }); // }.bind(this) // ); // } timestampToTime(timestamp) { var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + "-"; var M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-"; var D = date.getDate() + " "; var h = date.getHours() + ":"; var m = date.getMinutes() + ":"; var s = date.getSeconds(); return Y + M + D + h + m + s; } reLoad() { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderChange/listOrderRefundInvoice", data: { orderNo: this.props.data.orderNo }, success: data => { if (!data) return; data.data.forEach(item => { item.load = true; }); this.setState({ contactList: data.data }); } }); } // 完成订单 finish() { // this.props.onCancel() this.setState({ loading: true }) $.ajax({ url: globalConfig.context + "/api/admin/orderChange/completeRefund", method: "get", data: { // orderNo: this.props.data.orderNo, // type: this.props.data.type, id: this.props.data.id }, success: data => { if (data.data) { message.success("提交成功!"); // window.location.reload(); this.setState({ loading: false }) this.props.onCancel() } else if (data.error && data.error.length) { message.warning(data.error[0].message) this.setState({ loading: false }); } } }); } contactSave(index) { if (this.state.contactList) { let Data = this.state.contactList; for (var a = 0; a < Data.length; a++) { if (Data[a].amount == "") { message.warning("退票金额不能为空"); // this.refs.signFirstPayment.focus(); return false; } } } // this.setState({ // loading: true // }); $.ajax({ url: globalConfig.context + "/api/admin/orderChange/addOrderRefundInvoice", method: "post", data: { orderNo: this.props.data.orderNo, amount: index.amount } }).done( function (data) { if (!data.error.length) { message.success("保存成功!"); let num = 0; this.state.contactList.forEach(item => { num += +item.amount; // if (item.key == index.key) { // item.load = true; // let time = this.timestampToTime(new Date().getTime()); // item.createTimes = time; // } }); this.setState({ contactList: this.state.contactList, refundInvoice: num }); this.reLoad(); } else { message.warning(data.error[0].message); } }.bind(this) ); } //点击新增催款节点 addcontact() { // let key = this.state.contactList.length // if(key == 0) { // key // } this.state.contactList.push({ key: this.state.contactList.length, amount: "", createTime: undefined // orderNo: this.state.orderNoss, // dunTarget: this.state.kehuId }); this.setState({ contactList: this.state.contactList }); } //删除收款节点 confirmDelet(index) { // if (index.id) { // this.state.contactList.splice(index.key, 1); // this.setState({ // contactList: this.state.contactList // }); // this.contactSave(); // } else { // this.state.contactList.splice(index.key, 1); // this.setState({ // contactList: this.state.contactList // }); // } // if(this.state.contactList.length == 1) { // this.state.contactList = [] // this.setState({ // contactList: this.state.contactList // }); // return // } // let num = index.key // if (this.state.contactList[num + 1].key) { // this.state.contactList[num + 1].key = index.key; // } if (index.key || !index.id) { let num = this.state.contactList.findIndex(item => item.key == index.key); this.state.contactList.splice(num, 1); let total = 0; this.state.contactList.forEach(item => { total += +item.amount; }); this.setState({ contactList: this.state.contactList, refundInvoice: total }); } else { $.ajax({ url: globalConfig.context + "/api/admin/orderChange/deleteOrderRefundInvoice", method: "post", data: { id: index.id } }).done( function (data) { if (!data.error.length) { message.success("删除成功!"); this.reLoad(); } else { message.warning(data.error[0].message); } }.bind(this) ); } // console.log(this.state.contactList[num + 1].key); } // loadData() { // $.ajax({ // method: "get", // dataType: "json", // async: false, // crossDomain: false, // url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList", // data: { // changeId: this.props.data.id // }, // success: function(data) { // if (data.error.length || data.data.list == "") { // if (data.error && data.error.length) { // message.warning(data.error[0].message); // } // } else { // this.setState({ // dataSource: data.data // }); // } // }.bind(this) // }); // } //同意拒绝按钮的有无 changeButtonStatus() { this.setState({ buttonStatus: !this.state.buttonStatus }); } onRef(ref) { this.fun = ref; } render() { const pageData = [ { labelA: "客户名称", formItemLayoutA: formItemLayout, dataA: this.props.data.userName, labelB: "合同编号", formItemLayoutB: formItemLayout, dataB: this.props.data.contractNo }, { labelA: "时间", formItemLayoutA: formItemLayout, dataA: this.props.data.createTimes, labelB: "发起人", formItemLayoutB: formItemLayout, dataB: this.props.data.applicant }, { labelA: "当前进度", formItemLayoutA: formItemLayout, // 当前是咨询师以及咨询师经理时使用shenhePeo函数,其他流程正常显示 dataA: this.props.data.processState == 3 || this.props.data.processState == 4 ? shenghePeo(this.props.data.examineName, this.props.data.processState) : getProcessStatusNew( this.props.data.examineName, this.props.data.processState, this.props.data.status ), labelB: "变更类型", formItemLayoutB: formItemLayout, dataB: getChangeType(this.props.data.type) }, { labelA: this.props.data.type == 0 ? "企业总经理姓名" : "", formItemLayoutA: formItemLayout, dataA: this.props.data.managerContacts, labelB: "企业总经理联系电话", formItemLayoutB: formItemLayout, dataB: this.props.data.managerContactMobile, }, { labelA: this.props.data.type == 0 ? "企业联系人姓名" : "", formItemLayoutA: formItemLayout, dataA: this.props.data.contacts, labelB: "企业联系人联系方式", formItemLayoutB: formItemLayout, dataB: this.props.data.contactMobile, }, { labelA: "合同额(万元)", formItemLayoutA: formItemLayout, dataA: this.moneyOld(this.props.data.totalAmount, this.props.money), labelB: "已收款(万元)", formItemLayoutB: formItemLayout, dataB: changeColor(this.props.data.settlementAmount) }, { labelA: "欠款(万元)", formItemLayoutA: formItemLayout, dataA: changeColor(this.props.data.arrears), labelB: "申请退款(万元)", formItemLayoutB: formItemLayout, dataB: changeColor(this.props.data.changeAmount) }, { labelA: "首付款(万元)", formItemLayoutA: formItemLayout, dataA: changeColor(this.props.data.firstAmount), }, { labelA: "变更原因", formItemLayoutA: formItemLayout, dataA: this.props.data.remarks } ]; const planData = [ { labelA: "项目进度", formItemLayoutA: formItemLayout, dataA: this.props.data.projectState, onChangeA: value => { this.setState({ projectState: value }); }, labelB: "发生成本费用(万元)", formItemLayoutB: formItemLayout, dataB: this.props.data.zxsCost, onChangeB: value => { this.setState({ zxsCost: value }); } }, { labelA: "备注", formItemLayoutA: formItemLayout, dataA: this.props.data.zxsRemarks, onChangeA: value => { this.setState({ zxsRemarks: value }); } } ]; const financeData = [ { labelA: "发生直接成本(万元)", formItemLayoutA: formItemLayout, dataA: this.props.data.cwCost ? this.props.data.cwCost : "0", onChangeA: value => { this.setState({ cwCost: value }); }, labelB: "发生间接成本(万元)", formItemLayoutB: formItemLayout, dataB: this.props.data.cwIndirectCost ? this.props.data.cwIndirectCost : "0", onChangeB: value => { this.setState({ cwIndirectCost: value }); }, }, { labelA: "应退金额(万元)", formItemLayoutA: formItemLayout, dataA: this.props.data.refundableAmount ? this.props.data.refundableAmount : "0", onChangeA: value => { this.setState({ refundableAmount: value }); }, } ]; const buttonData = [ { name: "同意", title: "理由", placeholder: "请输入理由", type: "primary", status: 2, onChange: value => { this.setState({ remarks: value }); } }, { name: "拒绝", title: "理由", placeholder: "请输入理由", type: "danger", status: 3, onChange: value => { this.setState({ remarks: value }); } } ]; const orgCodeUrl = this.props.pictureUrl; const attachment = this.props.attachment // console.log(this.props.attachment); return (
{ this.refs = e; }} >

合同变更记录

{pageData.map((item, index) => { return !!item.labelA && ; })}
{ this.props.contractPictureUrl && this.props.contractPictureUrl.length != 0 &&
}
    {/* 操作人: */} {this.props.dataSource.map((item, index) => { if (item.status == 0) { item.status = "发起"; } else if (item.status == 1) { item.status = "审核中"; } else if (item.status == 2) { item.status = "通过"; } else if (item.status == 3) { item.status = "驳回"; } else if (item.status == 4) { item.status = "完成"; } else if (item.status == 5) { item.status = "撤销"; } return (
  • {item.aname + ":" + "【" + item.status + "】" + item.remarks + "(" + item.createTimes + ")"}
  • ); })}
{/* 收款情况1 */}

收款情况

    {(this.props.proceedsData.bill || []).map((item, index) => (
  • {item.payTime + " " + item.aName + " 收款:" + item.transactionAmount + "万元"}
  • ))}
收款总计:{this.props.proceedsTotal}万元

    {(this.props.proceedsData.invoice || []).map((item, index) => (
  • {item.createTime + " " + " 开票:" + item.amount + "万元"}
  • ))}
开票总计:{this.props.invoiceTotal}万元

系统预估 产生成本(万元): {this.props.data.estimateCost ? this.props.data.estimateCost : "0"}{" "}  应退金额(万元): {this.props.data.estimateRefundable ? this.props.data.estimateRefundable : "0"}

{/* {this.props.data.type === 0 ? (

当前项目进度(咨询师经理填写)

{planData.map((item, index) => { return ; })}
) : ( "" )} */} {/* 当前财务状态2 */} {this.props.data.processState != 6 ? (

当前财务状态(财务填写)

{financeData.map((item, index) => { return ; })}
) : (

当前财务状态(财务填写)

{ this.setState({ cwCost: e.target.value, }); }} /> { this.setState({ cwIndirectCost: e.target.value, }); }} /> { this.setState({ refundableAmount: e.target.value, }); }} />
注} labelCol={{ span: 12 }} wrapperCol={{ span: 12 }} > 除了直接支出的第三方成本及项目奖金提成之外的其他人工成本、系统成本
{ this.setState({ reason: e.target.value, }); }} />
)} {/* 回收退票 3 */}

回收退票

{/* {this.state.processStatus == 0 ? ( */} {/* ) : ( "" )} */} {/* 应收 回收 */}
  • {"本次应收退票(万元):" + (this.props.data.refundableAmount == null ? 0 : this.props.data.refundableAmount)}
  • {"累计已回收退票(万元):" + (this.state.refundInvoice == null ? 0 : this.state.refundInvoice)}
{/* 审核查看附件4 */}

完成审核,上传附件{" "} (注:由营销员上传变更后附件,全变更流程完成。)

{attachment.length > 0 ? : '无附件'}
{ this.setState({ uploadVisible: false, rotateDeg1: 0 }, () => { // this.reset(); }); }} > {/* */}
{/* 退款凭证5 */}

执行退款{" "} (注:执行退款,系统将从已收款金额中直接减款)

上传退款凭证

{this.props.data.processState == 6 ? ( this.state.buttonStatus ? (
{buttonData.map((item, index) => { return ( ); })}
{ this.setState({ rejectState: val }) }} />
{/* { this.props.data.type == 7 ? : } */}
) : ( "" ) ) : ( "" )} ( )} content={() => this.refs} />
{ this.setState({ refundMoney: e.target.value, }); }} /> { this.setState({ refundDate: dateString, }); }} />