Browse Source

会员变更子项目增加会员类型修改功能

dev01 1 week ago
parent
commit
da355f8fb4

+ 62 - 3
js/component/common/projectOperation/newEditProject.jsx

@@ -10,6 +10,7 @@ import { getboutique, splitUrl } from "../../tools";
 import moment from "moment";
 import { vipYear, YearList } from "../../dataDic";
 import ImgList from "../imgList";
+import "./project.css";
 
 const FormItem = Form.Item;
 const Option = Select.Option;
@@ -152,7 +153,7 @@ class newEditProject extends Component {
     }
 
     let newCheckType = [];
-    if ([2, 3].indexOf(dataInfor.projectType)) {
+    if ([2, 3].indexOf(dataInfor.projectType) > -1) {
       // 单边会员和简单会员
       newCheckType = [1];
     } else {
@@ -652,6 +653,34 @@ class newEditProject extends Component {
     return [...new Set(newCheckType)]
   }
 
+  // 修改子项目
+  handleUpdateSubProject(item) {
+    let prams = {
+      id: item.id,
+      htMember: item.htMember,
+      additionalDeduction: item.additionalDeduction,
+      rdAwardsubsidy: item.rdAwardsubsidy,
+      taskComment: item.taskComment
+    };
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context  + "/api/admin/orderChange/updateMemberSonProject",
+      data: prams,
+      success: res => {
+        if (!res.error.length) {
+          message.success("保存成功!");
+          // 更新项目的会员类型
+          let checkType = this.getCheckTypeList(this.state.splitList);
+          this.setState({ checkType });
+        } else {
+          message.error("保存失败!");
+        }
+      }
+    });
+  }
+
   render() {
     let children = vipYear.map(its => (
       <Option key={its}>{its}</Option>
@@ -1363,7 +1392,7 @@ class newEditProject extends Component {
               {
                 // 会员项目子集列表
                 !!this.state.splitList && this.state.splitList.length > 0 &&
-                this.state.splitList.map((item) =>
+                this.state.splitList.map((item, splitIdx) =>
                   // 标识为 3=删 不显示
                   item.type != 3 &&
                   <div
@@ -1397,7 +1426,7 @@ class newEditProject extends Component {
                         label="高新会员"
                       >
                         <CheckboxGroup
-                          disabled
+                          disabled={ isMedit == 1 ? false : true }
                           style={{ width: 200 }}
                           options={[
                             { label: '高新会员', value: 1 },
@@ -1405,6 +1434,29 @@ class newEditProject extends Component {
                             { label: '研发奖补', value: 3 }
                           ]}
                           value={this.getNewCheckType(item)}
+                          onChange={e => {
+                            if (e.indexOf(1) > -1) {
+                              this.state.splitList[splitIdx].htMember = 1;
+                            } else {
+                              this.state.splitList[splitIdx].htMember = 0;
+                            }
+
+                            if (e.indexOf(2) > -1) {
+                              this.state.splitList[splitIdx].additionalDeduction = 1;
+                            } else {
+                              this.state.splitList[splitIdx].additionalDeduction = 0;
+                            }
+
+                            if (e.indexOf(3) > -1) {
+                              this.state.splitList[splitIdx].rdAwardsubsidy = 1;
+                            } else {
+                              this.state.splitList[splitIdx].rdAwardsubsidy = 0;
+                            }
+
+                            this.setState({
+                              splitList: this.state.splitList
+                            })
+                          }}
                         />
                       </FormItem>
                     }
@@ -1445,6 +1497,13 @@ class newEditProject extends Component {
                         {item.taskComment}
                       </FormItem>
                     </div>
+
+                    { isMedit == 1 ? (
+                      <div style={{textAlign: "center"}}>
+                        <Button type="primary" onClick={() => this.handleUpdateSubProject(item)}>确认修改</Button>
+                      </div>
+                      ) : null }
+                    
                     {/* {
                       (isMedit == 0 || isMedit == 2) &&
                       <div className="clearfix">

+ 3 - 0
js/component/common/projectOperation/project.css

@@ -0,0 +1,3 @@
+.ant-checkbox-disabled + span {
+  color: rgba(0, 0, 0, 0.65);
+}