Browse Source

催款节点1.0

mentoswzq 5 years ago
parent
commit
e0c0209abe

+ 1 - 1
js/component/dataDic.js

@@ -3460,6 +3460,6 @@ module.exports = {
           key: "知识产权-下证"
         }
       ]
-    },
+    }
   ]
 };

+ 3 - 3
js/component/manageCenter/financialManage/distribute/approvedOutsourcing.jsx

@@ -549,9 +549,9 @@ const approvedOutsourcing = React.createClass({
           title: "催收科目",
           dataIndex: "dunSubject",
           key: "dunSubject",
-          render: text => {
-            return getjiedian(text);
-          }
+          // render: text => {
+          //   return getjiedian(text);
+          // }
         },
         {
           title: "催收启动时间",

+ 3 - 3
js/component/manageCenter/financialManage/distribute/approvedOutsourcingAll.jsx

@@ -548,9 +548,9 @@ const approvedOutsourcing = React.createClass({
           title: "催收科目",
           dataIndex: "dunSubject",
           key: "dunSubject",
-          render: text => {
-            return getjiedian(text);
-          }
+          // render: text => {
+          //   return getjiedian(text);
+          // }
         },
         {
           title: "催收启动时间",

+ 3 - 3
js/component/manageCenter/financialManage/distribute/shouKuanAll.jsx

@@ -354,9 +354,9 @@ const ShouKuang = React.createClass({
           title: "催收科目",
           dataIndex: "dunSubject",
           key: "dunSubject",
-          render: text => {
-            return getjiedian(text);
-          }
+          // render: text => {
+          //   return getjiedian(text);
+          // }
         },
         {
           title: "催收启动时间",

+ 3 - 3
js/component/manageCenter/financialManage/distribute/shouKuang.jsx

@@ -367,9 +367,9 @@ const ShouKuang = React.createClass({
           title: "催收科目",
           dataIndex: "dunSubject",
           key: "dunSubject",
-          render: text => {
-            return getjiedian(text);
-          }
+          // render: text => {
+          //   return getjiedian(text);
+          // }
         },
         {
           title: "催收启动时间",

+ 230 - 141
js/component/manageCenter/order/orderNew/addService.jsx

@@ -26,7 +26,7 @@ import {
   customerType,
   jiedian,
   tepi,
-  boutique
+  boutique,
 } from "../../../dataDic.js";
 import {
   splitUrl,
@@ -281,29 +281,44 @@ const NewService = Form.create()(
         ContactsLists: [
           {
             title: "项目名称",
-            dataIndex: "mingcheng",
-            key: "mingcheng",
-            render: (text, record) => {
+            dataIndex: "commodityName",
+            key: "commodityName",
+            render: (text, record, index) => {
+              let dataArr = this.state.dataSource || [];
+              if (text) {
+                return <span>{text}</span>;
+              }
               return (
                 <Select
                   placeholder="请选择名称"
                   style={{ width: "150px" }}
-                  // value={record.sortName}
-                  onChange={(e) => {
-                    record.sortName = e
-                    // console.log(record);
-                    this.state.dataSource.forEach(item => {
-                      if(item.commodityName == record.sortName) {
-                        record.cname = item.cname
-                        record.id = item.id
-                        record.sort = item.sort
+                  onChange={e => {
+                    record.sortName = e;
+                    dataArr.forEach(item => {
+                      if (item.commodityName == record.sortName) {
+                        record.cname = item.cname;
+                        record.tid = item.id;
+                        record.isSave = true;
+                        record.sort = item.sort;
+                        cuiJieDian.forEach(item => {
+                          if (item.value == record.sort) {
+                            record.arr = item.children;
+                            let yearFlag = true;
+                            if (record.sort == 6) {
+                              yearFlag = false;
+                            }
+                            this.setState({
+                              getLoad: true,
+                              yearFlag
+                            });
+                          }
+                        });
                       }
-                    })
+                    });
                     console.log(e);
-                    
                   }}
                 >
-                  {this.state.dataSource.map(item => {
+                  {dataArr.map(item => {
                     return (
                       <Select.Option key={item.id} value={item.commodityName}>
                         {item.commodityName}
@@ -316,108 +331,93 @@ const NewService = Form.create()(
           },
           {
             title: "项目分类",
-            dataIndex: "fenlei",
-            key: "fenlei",
+            dataIndex: "projectType",
+            key: "projectType",
             render: (text, record) => {
-              console.log(this.state.dataSource);
-              console.log(record);
-              // const arr = this.state.dataSource.filter(item => {
-              //   return item.commodityName == record.sortName;
-              // })
-              // console.log("arr",arr);
-              
-              return (
-                <Select
-                  placeholder="请选择分类"
-                  style={{ width: "150px" }}
-                  // value={record.sortName}
-                  onChange={e => {
-                    record.cname = e;
-                    console.log(record);
-                  }}
-                >
-                  {this.state.dataSource.map(item => {
-                    return (
-                      <Select.Option key={item.id} value={item.cname}>
-                        {item.cname}
-                      </Select.Option>
-                    );
-                  })}
-                </Select>
-              );
+              if (text) {
+                let arr = this.state.dataSource || [];
+                let str = "";
+                for (let i = 0; i < arr.length; i++) {
+                  if (this.state.dataSource[i].sort == text) {
+                    str = this.state.dataSource[i].cname;
+                    return <span>{str}</span>;
+                  }
+                }
+              }
+              if (this.state.getLoad) {
+                return (
+                  <Select
+                    style={{ width: "150px" }}
+                    placeholder="请选择分类"
+                    value={record.cname}
+                  >
+                    <Select.Option key={record.sort} value={record.cname}>
+                      {record.cname}
+                    </Select.Option>
+                  </Select>
+                );
+              } else {
+                return (
+                  <Select style={{ width: "150px" }} placeholder="请选择分类">
+                    <Select.Option key={record.sort} value={record.cname}>
+                      {record.cname}
+                    </Select.Option>
+                  </Select>
+                );
+              }
             }
           },
-          // {
-          //   title: "项目名称",
-          //   dataIndex: "mingcheng",
-          //   key: "mingcheng",
-          //   render: (text, record) => {
-          //     const dataSources = this.state.customerCuiArr || [];
-          //     const optionsCui = dataSources.map(group => (
-          //       <Select.Option key={group.id} value={group.bname}>
-          //         {group.bname}
-          //       </Select.Option>
-          //     ));
-          //     return (
-          //       <div>
-          //         <AutoComplete
-          //           className="certain-category-search"
-          //           dropdownClassName="certain-category-search-dropdown"
-          //           dropdownMatchSelectWidth={false}
-          //           dropdownStyle={{ width: 200 }}
-          //           style={{ width: "200px" }}
-          //           dataSource={optionsCui}
-          //           placeholder="输入服务名称"
-          //           value={this.state.commodityNameCui}
-          //           onChange={this.httpChangeCui}
-          //           filterOption={true}
-          //           onSelect={this.selectAutoCui}
-          //         >
-          //                                   
-          //           <Input />
-          //                                 
-          //         </AutoComplete>
-          //       </div>
-          //     );
-          //   }
-          // },
           {
             title: "催款科目",
-            dataIndex: "dunSubject",
-            key: "dunSubject",
+            dataIndex: "dunTypeName",
+            key: "dunTypeName",
             render: (text, record) => {
-              return (
-                <div>
-                  {this.state.processStatus == 0 ? (
-                    <Select
-                      placeholder="请选择催款科目"
-                      value={record.dunSubject}
-                      style={{ width: "150px" }}
-                      onChange={e => {
-                        record.dunSubject = e;
-                        this.setState({ contactList: this.state.contactList });
-                      }}
-                    >
-                      {jiedian.map(function(item) {
-                        return (
-                          <Select.Option key={item.value}>
-                            {item.key}
-                          </Select.Option>
-                        );
-                      })}
-                    </Select>
-                  ) : (
-                    getjiedian(text)
-                  )}
-                </div>
-              );
+              if (text) {
+                return <span>{text}</span>;
+              }
+              if (this.state.getLoad) {
+                let arr = record.arr || [];
+                console.log("arrrr", arr);
+
+                return (
+                  <Select
+                    style={{ width: "150px" }}
+                    placeholder="请选择分类"
+                    onChange={e => {
+                      record.dunType = e;
+                      console.log(e);
+                    }}
+                  >
+                    {arr.map(item => {
+                      record;
+                      return (
+                        <Select.Option key={item.value} value={item.value}>
+                          {item.key}
+                        </Select.Option>
+                      );
+                    })}
+                  </Select>
+                );
+              } else {
+                return (
+                  <Select style={{ width: "150px" }} placeholder="请选择分类">
+                    <Select.Option
+                      key={0}
+                      value={"请选择上一项"}
+                    ></Select.Option>
+                  </Select>
+                );
+              }
             }
           },
           {
             title: "时间",
-            dataIndex: "time",
-            key: "time",
+            dataIndex: "waitDay",
+            key: "waitDay",
             render: (text, record) => {
+              if (record.dunTypeName) {
+                return <span>{text}</span>;
+              }
               return (
                 <Select
                   placeholder="请选择时间"
@@ -426,8 +426,7 @@ const NewService = Form.create()(
                   onChange={e => {
                     console.log("ee", e);
                     record.waitDay = e;
-                    console.log("time",record);
-                    
+                    console.log("time", record);
                   }}
                 >
                   <Select.Option key={3}>3天</Select.Option>
@@ -443,6 +442,9 @@ const NewService = Form.create()(
             dataIndex: "money",
             key: "money",
             render: (text, record) => {
+              if (record.dunTypeName) {
+                return <span>{text}</span>;
+              }
               return (
                 <div>
                   {this.state.processStatus == 0 ? (
@@ -465,11 +467,40 @@ const NewService = Form.create()(
             }
           },
           {
+            title: "服务年限",
+            dataIndex: "startDate",
+            key: "startDate",
+            render: (text, record) => {
+              if (record.dunTypeName) {
+                return <span>{text}</span>;
+              }
+              return (
+                <Select
+                  placeholder="请选择时间"
+                  style={{ width: "150px" }}
+                  disabled={this.state.yearFlag ? true : false}
+                  onChange={e => {
+                    console.log("ee", e);
+                    record.effectiveCount = e;
+                    console.log("year", record);
+                  }}
+                >
+                  {/* <Select.Option key={null}>无</Select.Option> */}
+                  <Select.Option key={1}>一年</Select.Option>
+                  <Select.Option key={3}>两年</Select.Option>
+                  <Select.Option key={5}>三年</Select.Option>
+                  <Select.Option key={7}>四年</Select.Option>
+                  <Select.Option key={9}>五年</Select.Option>
+                </Select>
+              );
+            }
+          },
+          {
             title: "催款状态",
-            dataIndex: "dunStatus",
-            key: "dunStatus",
+            dataIndex: "status",
+            key: "status",
             render: text => {
-              return getCuikuan(text);
+              return <span>{text == 1 ? "已启动" : "未启动"}</span>;
             }
           },
           {
@@ -502,8 +533,13 @@ const NewService = Form.create()(
                   ) : (
                     ""
                   )}
-                  {!record.id && index == this.state.contactList.length - 1 ? (
-                    <Button type="primary" onClick={this.contactSave}>
+                  {record.isSave ? (
+                    <Button
+                      type="primary"
+                      onClick={e => {
+                        this.contactSave(record);
+                      }}
+                    >
                       保存
                     </Button>
                   ) : (
@@ -787,7 +823,7 @@ const NewService = Form.create()(
         method: "get",
         dataType: "json",
         crossDomain: false,
-        url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
+        url: globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
         data: {
           orderNo: record ? record.orderNo : this.props.datauser.orderNo
         },
@@ -809,8 +845,13 @@ const NewService = Form.create()(
                   : "", //催款科目
                 id: thisData.id, //节点Id
                 money: thisData.money, //催款金额
-                dunStatus: thisData.dunStatus, //催款状态
-                orderNo: record ? record.orderNo : this.props.datauser.orderNo
+                orderNo: record ? record.orderNo : this.props.datauser.orderNo,
+                commodityName: thisData.commodityName,
+                projectType: thisData.projectType,
+                dunTypeName: thisData.dunTypeName,
+                status: thisData.status,
+                waitDay: thisData.waitDay,
+                effectiveCount: thisData.effectiveCount
               });
             }
             this.setState({
@@ -827,33 +868,56 @@ const NewService = Form.create()(
       );
     },
     //催款节点保存
-    contactSave() {
-      if (this.state.contactList) {
-        let cuiData = this.state.contactList;
-        for (var a = 0; a < cuiData.length; a++) {
-          if (cuiData[a].money == "") {
-            message.warning("催款金额不能为空");
-            this.refs.signFirstPayment.focus();
-            return false;
-          } else if (!cuiData[a].dunSubject) {
-            message.warning("催款科目不能为空");
-            this.refs.signFirstPayment.focus();
-            return false;
-          }
-          if (moneyVerify(cuiData[a].money)) {
-            return;
-          }
+    contactSave(record) {
+      if(!this.state.yearFlag) {
+        if(!record.effectiveCount) {
+          message.warning("请选择服务年限")
+          return
         }
+      }else {
+        record.effectiveCount = ""	
+      }
+      if(record.money == "" ) {
+        message.warning("请填写金额")
+        return
       }
+      if(!record.dunType) {
+        message.warning("请选择对应科目")
+        return
+      }
+      console.log("保存",record);
+      
+      // if (this.state.contactList) {
+      //   let cuiData = this.state.contactList;
+      //   for (var a = 0; a < cuiData.length; a++) {
+      //     if (cuiData[a].money == "") {
+      //       message.warning("催款金额不能为空");
+      //       this.refs.signFirstPayment.focus();
+      //       return false;
+      //     } else if (!cuiData[a].dunSubject) {
+      //       message.warning("催款科目不能为空");
+      //       this.refs.signFirstPayment.focus();
+      //       return false;
+      //     }
+      //     if (moneyVerify(cuiData[a].money)) {
+      //       return;
+      //     }
+      //   }
+      // }
       this.setState({
         loading: true
       });
       $.ajax({
-        url: globalConfig.context + "/api/admin/newOrder/createOrderDun",
+        url: globalConfig.context + "/api/admin/newOrderDun/createDun",
         method: "post",
         data: {
-          orderNo: this.state.orderNoss,
-          orderDun: JSON.stringify(this.state.contactList)
+          orderNo: record.orderNo,
+          tid: record.tid,
+          projectType: record.sort,
+          dunType: record.dunType,
+          money: record.money,
+          waitDay: record.waitDay,
+          effectiveCount: record.effectiveCount
         }
       }).done(
         function(data) {
@@ -892,13 +956,36 @@ const NewService = Form.create()(
       if (index.id) {
         this.state.contactList.splice(index.key, 1);
         this.setState({
-          contactList: this.state.contactList
+          contactList: this.state.contactList,
+          cuiFlag: false
         });
-        this.contactSave();
+        $.ajax({
+          url: globalConfig.context + "/api/admin/newOrderDun/deleteDun",
+          method: "post",
+          data: {
+            id: index.id,
+          }
+        }).done(
+          function(data) {
+            this.setState({
+              loading: false
+            });
+            if (!data.error.length) {
+              message.success("删除成功!");
+              this.setState({
+                cuiFlag: false
+              });
+              this.loaduserss();
+            } else {
+              message.warning(data.error[0].message);
+            }
+          }.bind(this)
+        );
       } else {
         this.state.contactList.splice(index.key, 1);
         this.setState({
-          contactList: this.state.contactList
+          contactList: this.state.contactList,
+          cuiFlag: false
         });
       }
     },
@@ -926,7 +1013,8 @@ const NewService = Form.create()(
       this.setState(
         {
           visible: false,
-          mark: false
+          mark: false,
+          cuiFlag: false
         },
         () => {
           this.setState({
@@ -969,7 +1057,8 @@ const NewService = Form.create()(
             this.setState({
               loading: false
             });
-            //this.loaduser()
+            this.loaduserss()
+            this.loaduser()
             this.loadData();
           } else {
             message.warning(data.error[0].message);

+ 3 - 3
js/component/manageCenter/order/orderNew/press.jsx

@@ -220,9 +220,9 @@ const IntentionCustomer = Form.create()(React.createClass({
           title: "催收科目",
           dataIndex: "dunSubject",
           key: "dunSubject",
-          render: text => {
-            return getjiedian(text);
-          }
+        //   render: text => {
+        //     return getjiedian(text);
+        //   }
         },
         {
           title: "催款启动日期",

+ 3 - 3
js/component/manageCenter/order/orderNew/pressList.jsx

@@ -222,9 +222,9 @@ const IntentionCustomer = Form.create()(React.createClass({
           title: "催收科目",
           dataIndex: "dunSubject",
           key: "dunSubject",
-          render: text => {
-            return getjiedian(text);
-          }
+          // render: text => {
+          //   return getjiedian(text);
+          // }
         },
         {
           title: "催款启动日期",