import React, { Component } from "react"; import { AutoComplete, Button, Form, Input, message, Modal, Radio, Select, Spin } from "antd"; import $ from "jquery"; const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 }, }; class ProjectOperationVip extends Component { constructor(props) { super(props); this.state = { commodityName: '', commodityQuantity: '', patentType: 0, officialCost: '', costReduction: '', commodityPrice: '', main: '', taskComment: '', declarationBatch: '', ifCertificationFee: '', displayFees: "none", customerArr: [], patentTypeList: [], loading: false, patentTransfer: props.dataInfor ? props.dataInfor.patentTransfer : 0 //收否为专利转让 0 否 1 是 } this.onSubmit = this.onSubmit.bind(this); this.httpChange = this.httpChange.bind(this); this.selectAuto = this.selectAuto.bind(this); this.setValue = this.setValue.bind(this); } componentDidMount() { this.setValue(); } setValue() { const { dataInfor } = this.props; if (!(dataInfor && Object.keys(dataInfor).length > 0)) { return; } this.setState({ fid: dataInfor.id, commodityId: dataInfor.commodityId, //服务ID commodityName: dataInfor.commodityName, //项目名称 memberType: dataInfor.memberType,// 付款情况 commodityQuantity: dataInfor.commodityQuantity, // 数量 taskComment: dataInfor.taskComment, // 备注 }); } // 新建会员项目 onSubmit() { if (this.state.commodityId === undefined || !this.state.commodityId) { message.warning("服务名称不匹配!"); return } let reg = /^([0]|[1-9][0-9]*)$/; if ( !this.state.commodityQuantity || !reg.test(this.state.commodityQuantity) ) { message.warning("请输入正确商品数量!"); return } if (this.state.memberType === undefined) { message.warning("请选择付款情况!"); return } this.setState({ loading: true, }); let infor = { commodityId: this.state.commodityId, //项目编号 orderNo: this.props.orderNo, //订单编号 commodityName: this.state.commodityName, //项目名称 commodityQuantity: this.state.commodityQuantity, //商品数量 commodityPrice: 0, //签单总价 taskComment: this.state.taskComment, //服务说明 } $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderProject/addMemberProject", data: infor, }).done( function (data) { this.setState({ loading: false, }); if (!data.error.length) { message.success("保存成功!"); this.props.onCancel(); } else { message.warning(data.error[0].message); } }.bind(this) ); } // 修改会员项目 onChange() { if (this.state.commodityId === undefined || !this.state.commodityId) { message.warning("服务名称不匹配!"); return } let reg = /^([0]|[1-9][0-9]*)$/; if ( !this.state.commodityQuantity || !reg.test(this.state.commodityQuantity) ) { message.warning("请输入正确商品数量!"); return false; } if (this.state.memberType === undefined) { message.warning("请选择付款情况!"); return } this.setState({ loading: true, }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderProject/updateMemberProject", data: { id: this.state.fid, //任务ID commodityId: this.state.commodityId, //项目ID orderNo: this.props.orderNo, //订单编号 commodityQuantity: this.state.commodityQuantity, //数量 taskComment: this.state.taskComment, //备注 memberType: this.state.memberType,//会员付款状态 }, }).done( function (data) { this.setState({ loading: false, }); if (!data.error.length) { message.success("保存成功!"); this.props.onCancel(); } else { message.warning(data.error[0].message); } }.bind(this) ); } httpChange(e) { this.setState({ commodityName: e, }); if (e.length >= 1) { this.supervisor(e); } } //加载(自动补全) supervisor(e) { //服务名称自动补全 let api = "/api/admin/order/getBusinessProjectByName"; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + api, data: { businessName: e, cname: "高新会员服务", }, success: function (data) { let thedata = data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); } thedata = {}; } this.setState({ customerArr: thedata, }); }.bind(this), }).always( function () { }.bind(this) ); } //上级主管输入框失去焦点是判断客户是否存在 selectAuto(value) { const { customerArr } = this.state; const newdataSources = JSON.stringify(customerArr) == "{}" ? [] : customerArr; this.setState({ commodityName: value, commodityId: newdataSources.find((item) => item.bname == value).id, }); } render() { let options = this.state.customerArr.map((group, index) => ( {group.bname} )); const { readOnly } = this.props; return ( {readOnly ? this.state.commodityName : } * {readOnly ? this.state.commodityQuantity : { this.setState({ commodityQuantity: e.target.value }); }} ref="commodityQuantity" />} * 如会员项目,服务一年,请填写1,服务二年,请填写2,依次类推 {readOnly ? [ { value: "0", key: "已付会员节点全款" }, { value: "1", key: "已付部分期款,需特批" }, { value: "2", key: "未付款,需特批" }][this.state.memberType] : { this.setState({ memberType: e }); }} > {[ { value: "0", key: "已付会员节点全款" }, { value: "1", key: "已付部分期款,需特批" }, { value: "2", key: "未付款,需特批" }].map(function (item) { return ( {item.key} ); })} } * {readOnly ? this.state.taskComment : { this.setState({ taskComment: e.target.value }); }} />} 请详细说明项目服务时间,总服务时间及付款情况,如:增派2022.6-2023.5,总会员服务为3年,客户未付款,承诺10月份进行补付款 未付款时,需进行特批审核,请详细说明预计付款时间等详细情况 {readOnly ? null : { if (!this.state.fid) { this.onSubmit() } else { this.onChange() } }} > 保存 取消 } ) } } export default ProjectOperationVip;
未付款时,需进行特批审核,请详细说明预计付款时间等详细情况