|
@@ -3,8 +3,10 @@ import { AutoComplete, Button, Form, Input, message, Modal, Select, Spin } from
|
|
|
import $ from "jquery";
|
|
|
import ImgList from "../../common/imgList";
|
|
|
import { splitUrl } from "../../tools";
|
|
|
+import { vipYear } from "../../dataDic";
|
|
|
|
|
|
const FormItem = Form.Item;
|
|
|
+const Option = Select.Option;
|
|
|
|
|
|
const formItemLayout = {
|
|
|
labelCol: { span: 8 },
|
|
@@ -68,7 +70,7 @@ class ProjectOperationVip extends Component {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
commodityName: '',
|
|
|
- commodityQuantity: '',
|
|
|
+ commodityQuantity: 1,
|
|
|
patentType: 0,
|
|
|
officialCost: '',
|
|
|
costReduction: '',
|
|
@@ -83,6 +85,8 @@ class ProjectOperationVip extends Component {
|
|
|
loading: false,
|
|
|
patentTransfer: props.dataInfor ? props.dataInfor.patentTransfer : 0, //收否为专利转让 0 否 1 是
|
|
|
orgCodeUrl: [],
|
|
|
+ serviceLife: [],
|
|
|
+ histYear: [],
|
|
|
}
|
|
|
this.onSubmit = this.onSubmit.bind(this);
|
|
|
this.httpChange = this.httpChange.bind(this);
|
|
@@ -97,16 +101,22 @@ class ProjectOperationVip extends Component {
|
|
|
|
|
|
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, //项目名称
|
|
|
- commodityQuantity: dataInfor.commodityQuantity, // 数量
|
|
|
- memberType: dataInfor.memberType.toString(),// 付款情况
|
|
|
- taskComment: dataInfor.taskComment, // 备注
|
|
|
- orgCodeUrl: dataInfor.pictureUrl ? splitUrl(dataInfor.pictureUrl, ",", globalConfig.avatarHost + "/upload") : [],// 附件
|
|
|
- });
|
|
|
+ if (!(dataInfor && Object.keys(dataInfor).length > 0)) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.setState({
|
|
|
+ fid: dataInfor.id,
|
|
|
+ commodityId: dataInfor.commodityId, //项目ID
|
|
|
+ commodityName: dataInfor.commodityName, //项目名称
|
|
|
+ commodityQuantity: dataInfor.commodityQuantity, // 数量
|
|
|
+ memberType: dataInfor.memberType.toString(),// 付款情况
|
|
|
+ taskComment: dataInfor.taskComment, // 备注
|
|
|
+ orgCodeUrl: dataInfor.pictureUrl ? splitUrl(dataInfor.pictureUrl, ",", globalConfig.avatarHost + "/upload") : [],// 附件
|
|
|
+ yearSum: dataInfor.yearSum,//会员总服务年限
|
|
|
+ serviceLife: JSON.parse(dataInfor.serviceLife) || [],//会员服务年限
|
|
|
+ serviceYear: dataInfor.serviceYear,//本次派单
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
//
|
|
|
getOrgCodeUrl(e) {
|
|
@@ -146,6 +156,22 @@ class ProjectOperationVip extends Component {
|
|
|
message.warning("请选择付款情况!");
|
|
|
return
|
|
|
}
|
|
|
+ if (this.state.yearSum === undefined) {
|
|
|
+ message.warning("请选择会员总服务年限!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.state.serviceLife.length === 0) {
|
|
|
+ message.warning("请添加会员服务年限!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.state.serviceLife.length != this.state.yearSum) {
|
|
|
+ message.warning("会员服务年限与总年限不符合!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.state.serviceYear === undefined) {
|
|
|
+ message.warning("请选择本次派单年份!");
|
|
|
+ return
|
|
|
+ }
|
|
|
if (this.state.memberType == "1" || this.state.memberType == "2") {
|
|
|
if (typeof pictureUrl !== "string") {
|
|
|
message.warning("请上传附件!");
|
|
@@ -163,6 +189,9 @@ class ProjectOperationVip extends Component {
|
|
|
commodityPrice: 0, //签单总价
|
|
|
taskComment: this.state.taskComment, //服务说明
|
|
|
memberType: this.state.memberType,//会员付款状态
|
|
|
+ yearSum: this.state.yearSum,//会员总服务年限
|
|
|
+ serviceLife: JSON.stringify(this.state.serviceLife),//会员服务年限
|
|
|
+ serviceYear: this.state.serviceYear,//本次派单
|
|
|
pictureUrl: pictureUrl.length ? pictureUrl : "",//附件
|
|
|
}
|
|
|
$.ajax({
|
|
@@ -227,6 +256,22 @@ class ProjectOperationVip extends Component {
|
|
|
message.warning("请选择付款情况!");
|
|
|
return
|
|
|
}
|
|
|
+ if (this.state.yearSum === undefined) {
|
|
|
+ message.warning("请选择会员总服务年限!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.state.serviceLife.length === 0) {
|
|
|
+ message.warning("请添加会员服务年限!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.state.serviceLife.length != this.state.yearSum) {
|
|
|
+ message.warning("会员服务年限与总年限不符合!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.state.serviceYear === undefined) {
|
|
|
+ message.warning("请选择本次派单年份!");
|
|
|
+ return
|
|
|
+ }
|
|
|
if (this.state.memberType == "1" || this.state.memberType == "2") {
|
|
|
if (typeof pictureUrl !== "string") {
|
|
|
message.warning("请上传附件!");
|
|
@@ -249,6 +294,9 @@ class ProjectOperationVip extends Component {
|
|
|
commodityQuantity: this.state.commodityQuantity, //数量
|
|
|
taskComment: this.state.taskComment, //备注
|
|
|
memberType: this.state.memberType,//会员付款状态
|
|
|
+ yearSum: this.state.yearSum,//会员总服务年限
|
|
|
+ serviceLife: JSON.stringify(this.state.serviceLife),//会员服务年限
|
|
|
+ serviceYear: this.state.serviceYear,//本次派单
|
|
|
pictureUrl: pictureUrl.length ? pictureUrl : "",//附件
|
|
|
},
|
|
|
}).done(
|
|
@@ -265,7 +313,7 @@ class ProjectOperationVip extends Component {
|
|
|
}.bind(this)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+ //
|
|
|
httpChange(e) {
|
|
|
this.setState({
|
|
|
commodityName: e,
|
|
@@ -308,11 +356,39 @@ class ProjectOperationVip extends Component {
|
|
|
//上级主管输入框失去焦点是判断客户是否存在
|
|
|
selectAuto(value) {
|
|
|
const { customerArr } = this.state;
|
|
|
+ const { newData } = this.props
|
|
|
const newdataSources = JSON.stringify(customerArr) == "{}" ? [] : customerArr;
|
|
|
+ let cid = newdataSources.find((item) => item.bname == value).id
|
|
|
this.setState({
|
|
|
commodityName: value,
|
|
|
- commodityId: newdataSources.find((item) => item.bname == value).id,
|
|
|
+ commodityId: cid,
|
|
|
+ histYear: [],
|
|
|
});
|
|
|
+ if (newData && newData.length > 0) {
|
|
|
+ let llist = []
|
|
|
+ for (var i = 0; i < newData.length; i++) {
|
|
|
+ if (newData[i].commodityId == cid) {
|
|
|
+ llist.push(newData[i].serviceYear)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ histYear: llist
|
|
|
+ })
|
|
|
+ for (var i = newData.length - 1; i >= 0; i--) {
|
|
|
+ if (newData[i].commodityId == cid) {
|
|
|
+ this.setState({
|
|
|
+ yearSum: newData[i].yearSum.toString(), // 会员总服务年限
|
|
|
+ serviceLife: JSON.parse(newData[i].serviceLife) || [], // 会员服务年限
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setState({
|
|
|
+ yearSum: undefined,
|
|
|
+ serviceLife: [],
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
render() {
|
|
@@ -321,7 +397,12 @@ class ProjectOperationVip extends Component {
|
|
|
{group.bname}
|
|
|
</Select.Option>
|
|
|
));
|
|
|
+ let children = vipYear.map(its => (
|
|
|
+ <Option key={its}>{its}</Option>
|
|
|
+ ));
|
|
|
+
|
|
|
const { readOnly } = this.props;
|
|
|
+ const { histYear } = this.state
|
|
|
return (
|
|
|
<Modal
|
|
|
maskClosable={false}
|
|
@@ -358,7 +439,7 @@ class ProjectOperationVip extends Component {
|
|
|
>
|
|
|
<Input />
|
|
|
</AutoComplete>}
|
|
|
- <span className="mandatory">*</span>
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
</FormItem>
|
|
|
<FormItem
|
|
|
className="half-item"
|
|
@@ -370,23 +451,21 @@ class ProjectOperationVip extends Component {
|
|
|
placeholder="请输入服务数量"
|
|
|
value={this.state.commodityQuantity}
|
|
|
style={{ width: "200px" }}
|
|
|
+ disabled={true}
|
|
|
onChange={(e) => {
|
|
|
this.setState({ commodityQuantity: e.target.value });
|
|
|
}}
|
|
|
ref="commodityQuantity"
|
|
|
/>}
|
|
|
- <span className="mandatory">*</span>
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ color: "red",
|
|
|
+ position: "relative",
|
|
|
+ left: "0"
|
|
|
+ }}
|
|
|
+ >注:会员项目单次限制,只能派一年</div>
|
|
|
</FormItem>
|
|
|
- <div
|
|
|
- style={{
|
|
|
- marginTop: "33px",
|
|
|
- color: "red",
|
|
|
- textAlign: "right",
|
|
|
- position: "relative",
|
|
|
- top: "-8",
|
|
|
- left: "0"
|
|
|
- }}
|
|
|
- >如会员项目,服务一年,请填写1,服务二年,请填写2,依次类推</div>
|
|
|
<FormItem
|
|
|
className="half-item"
|
|
|
{...formItemLayout}
|
|
@@ -416,7 +495,96 @@ class ProjectOperationVip extends Component {
|
|
|
);
|
|
|
})}
|
|
|
</Select>}
|
|
|
- <span className="mandatory">*</span>
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="会员总服务年限"
|
|
|
+ >
|
|
|
+ {readOnly ?
|
|
|
+ this.state.yearSum == null ? "" :
|
|
|
+ [
|
|
|
+ { value: "0", key: "" },
|
|
|
+ { value: "1", key: "一年" },
|
|
|
+ { value: "2", key: "二年" },
|
|
|
+ { value: "3", key: "三年" },
|
|
|
+ { value: "4", key: "四年" },
|
|
|
+ { value: "5", key: "五年" },
|
|
|
+ ][this.state.yearSum]["key"] :
|
|
|
+ <Select
|
|
|
+ placeholder="请选择会员总服务年限"
|
|
|
+ style={{ width: "200px" }}
|
|
|
+ value={this.state.yearSum}
|
|
|
+ onChange={(e) => {
|
|
|
+ this.setState({ yearSum: e });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {[
|
|
|
+ { value: "1", key: "一年" },
|
|
|
+ { value: "2", key: "二年" },
|
|
|
+ { value: "3", key: "三年" },
|
|
|
+ { value: "4", key: "四年" },
|
|
|
+ { value: "5", key: "五年" },
|
|
|
+ ].map(function (item) {
|
|
|
+ return (
|
|
|
+ <Select.Option key={item.value}>
|
|
|
+ {item.key}
|
|
|
+ </Select.Option>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </Select>}
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="会员服务年限"
|
|
|
+ >
|
|
|
+ {
|
|
|
+ readOnly ?
|
|
|
+ this.state.serviceLife.toString() :
|
|
|
+ <Select
|
|
|
+ mode="multiple"
|
|
|
+ style={{ width: '200px' }}
|
|
|
+ placeholder="请选择服务年限"
|
|
|
+ value={this.state.serviceLife}
|
|
|
+ onChange={e => {
|
|
|
+ this.setState({
|
|
|
+ serviceLife: e,
|
|
|
+ serviceYear: undefined,
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {children}
|
|
|
+ </Select>
|
|
|
+ }
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="本次派单"
|
|
|
+ >
|
|
|
+ {readOnly ?
|
|
|
+ this.state.serviceYear :
|
|
|
+ <Select
|
|
|
+ placeholder="请选择本次派单年份"
|
|
|
+ style={{ width: "200px" }}
|
|
|
+ value={this.state.serviceYear}
|
|
|
+ onChange={(e) => {
|
|
|
+ this.setState({ serviceYear: e });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {this.state.serviceLife.length > 0 && this.state.serviceLife.map(function (item) {
|
|
|
+ return (
|
|
|
+ <Select.Option key={item} disabled={histYear.includes(item)}>
|
|
|
+ {item}
|
|
|
+ </Select.Option>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </Select>}
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
</FormItem>
|
|
|
{
|
|
|
(this.state.memberType == "1" || this.state.memberType == "2") &&
|
|
@@ -431,7 +599,7 @@ class ProjectOperationVip extends Component {
|
|
|
fileList={this.getOrgCodeUrl}
|
|
|
pictureUrl={this.state.orgCodeUrl}
|
|
|
/>
|
|
|
- <span className="mandatory">*</span>
|
|
|
+ {!readOnly && <span className="mandatory">*</span>}
|
|
|
</FormItem>
|
|
|
<div style={{ color: "red", marginLeft: 144, marginBottom: 15 }}>
|
|
|
特批需上传附件图,请上传客户同意我方继续服务并安排给我司付款的聊天记录截图,
|