Browse Source

新增待合并库

dev01 2 years ago
parent
commit
eff4a3a62a
2 changed files with 250 additions and 31 deletions
  1. 249 30
      js/component/manageCenter/financialManage/distribute/huiKuan.jsx
  2. 1 1
      package.json

+ 249 - 30
js/component/manageCenter/financialManage/distribute/huiKuan.jsx

@@ -16,7 +16,8 @@ import {
   Icon,
   Tabs,
   Popconfirm,
-  Tag, Tooltip
+  Tag,
+  Tooltip,
 } from "antd";
 import {
   getProvinceA,
@@ -38,8 +39,8 @@ const { TextArea } = Input;
 const { TabPane } = Tabs;
 
 const formItemLayout = {
-  labelCol: { span: 10 },
-  wrapperCol: { span: 14 }
+  labelCol: { span: 5 },
+  wrapperCol: { span: 19 }
 };
 
 const HuiKuan = React.createClass({
@@ -56,6 +57,8 @@ const HuiKuan = React.createClass({
       data: {
         pageNo: pageNo || 1,
         pageSize: pageSize || this.state.pagination.pageSize,
+        // 0 正常 1 待合并库
+        mergeStatus: this.state.mergeStatus,
         // 订单状态 判断是否重复
         status: this.state.statusSearch,
         // 订单编号
@@ -173,6 +176,9 @@ const HuiKuan = React.createClass({
 
   getInitialState() {
     return {
+      matching: "",
+      matchList: [],
+      mergeStatus: 0,
       mergeModal: false,
       visible: false,
       selectedRowKeys: [], // Check here to configure the default column
@@ -239,12 +245,12 @@ const HuiKuan = React.createClass({
             return (
               <Tooltip title={text}>
                 <div
-                  // style={{
-                  //   maxWidth: '150px',
-                  //   overflow: 'hidden',
-                  //   textOverflow: "ellipsis",
-                  //   whiteSpace: 'nowrap',
-                  // }}
+                // style={{
+                //   maxWidth: '150px',
+                //   overflow: 'hidden',
+                //   textOverflow: "ellipsis",
+                //   whiteSpace: 'nowrap',
+                // }}
                 >{text}</div>
               </Tooltip>
             )
@@ -420,6 +426,7 @@ const HuiKuan = React.createClass({
     //   console.log(123);
     // });
   },
+
   reset() {
     this.state.nameSearch = "";
     this.state.releaseDate = [];
@@ -450,10 +457,12 @@ const HuiKuan = React.createClass({
       changeList: newArr
     });
   },
+
   onSelectChange(selectedRowKeys) {
     // console.log("selectedRowKeys changed: ", selectedRowKeys);
     this.setState({ selectedRowKeys });
   },
+
   showModal() {
     this.setState({
       visible: true,
@@ -468,6 +477,7 @@ const HuiKuan = React.createClass({
       }
     })
   },
+
   tableRowClick(record) {
     this.setState({
       visible: true,
@@ -568,9 +578,11 @@ const HuiKuan = React.createClass({
     // this.loadData()
     this.setState({ visible: false });
   },
+
   callback(key) {
     // console.log(key);
   },
+
   delChecked() {
     // console.log("被删除列表",this.state.selectedRowKeys);
     let ids = this.state.selectedRowKeys.join(",")
@@ -601,6 +613,7 @@ const HuiKuan = React.createClass({
     // this.loadData()
 
   },
+
   delAllChecked() {
     // console.log("删除全部");
     $.ajax({
@@ -631,6 +644,7 @@ const HuiKuan = React.createClass({
 
 
   },
+
   mergeAll() {
     // console.log("合并全部");
     this.setState({
@@ -641,7 +655,9 @@ const HuiKuan = React.createClass({
       dataType: "json",
       crossDomain: false,
       url: globalConfig.context + "/api/admin/receivables/batchImport",
-      data: {},
+      data: {
+        mergeStatus: this.state.mergeStatus,
+      },
       success: function (data) {
         if (data.error && data.error.length) {
           message.warning(data.error[0].message);
@@ -668,6 +684,7 @@ const HuiKuan = React.createClass({
     );
     // message.success("合并成功!请在收款列表中,查看已收款情况。");
   },
+
   addModal() {
     this.state.modalData = {}
     this.setState({
@@ -689,6 +706,112 @@ const HuiKuan = React.createClass({
   //     "/api/admin/receivables/exportReceivables"
   // },
 
+  // 添加至待合并库
+  waitingMerge() {
+    this.setState({
+      confirmLoading: true
+    })
+    let ids = this.state.selectedRowKeys.join(",")
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/receivables/waitingMerge",
+      data: {
+        ids,
+      },
+      success: function (data) {
+        if (data.error && data.error.length) {
+          message.warning(data.error[0].message);
+        } else {
+          message.success("添加成功!");
+          this.setState({
+            mergeModal: false
+          });
+        }
+      }.bind(this)
+    }).always(
+      function () {
+        this.loadData();
+        this.state.selectedRowKeys = []
+        this.setState({
+          selectedRowKeys: this.state.selectedRowKeys,
+          confirmLoading: false,
+        })
+      }.bind(this)
+    );
+  },
+  // 匹配客户
+  matchingUser(user) {
+    this.setState({
+      loading: true
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/receivables/matchingUser",
+      data: {
+        value: user
+      },
+      success: function (data) {
+        if (data.error && data.error.length) {
+          message.warning(data.error[0].message);
+        } else {
+
+          this.setState({
+            matching: "orderno",
+            matchList: data.data,
+          })
+        }
+
+      }.bind(this)
+    }).always(
+      function () {
+        this.setState({
+          loading: false
+        });
+      }.bind(this)
+    );
+  },
+  // 匹配订单
+  matchingOrderNo(orderno) {
+    this.setState({
+      loading: true
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/receivables/matchingOrderNo",
+      data: {
+        value: orderno
+      },
+      success: function (data) {
+        if (data.error && data.error.length) {
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            matching: "name",
+            matchList: data.data,
+          })
+        }
+
+      }.bind(this)
+    }).always(
+      function () {
+        this.setState({
+          loading: false
+        });
+      }.bind(this)
+    );
+  },
+  selCancel() {
+    this.setState({
+      matching: "",
+    })
+  },
+
   render() {
     var departmentArr = this.state.departmentArr || [];
     const { loading, selectedRowKeys, visible } = this.state;
@@ -697,11 +820,24 @@ const HuiKuan = React.createClass({
       onChange: this.onSelectChange,
       hideDefaultSelections: true
     };
+    const radioStyle = {
+      display: "flex",
+      flexDirection: "row",
+      alignItems: "center",
+      justifyContent: "space-between",
+      padding: "5px",
+      height: '30px',
+      lineHeight: '30px',
+      fontSize: "14px",
+      borderBottom: "1px solid #e9e9e9",
+    };
     var departmentArr = this.state.departmentArr || [];
     return (
       <div className="user-content" style={{ position: "relative" }}>
         <div className="content-title" style={{ marginBottom: 10 }}>
-          <span style={{ fontWeight: 900, fontSize: 16 }}>批量回款</span>
+          <span style={{ fontWeight: 900, fontSize: 16 }}>
+            批量回款
+          </span>
         </div>
 
         <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
@@ -856,7 +992,7 @@ const HuiKuan = React.createClass({
               <Upload {...this.state.upLoad}>
                 <Button
                   type="primary"
-                  disabled={this.state.dataSource.length != 0 || this.props.look}
+                  disabled={this.state.mergeStatus == 1 || this.state.dataSource.length != 0 || this.props.look}
                 >
                   <Icon type="upload" />
                   导入回款列表
@@ -892,6 +1028,7 @@ const HuiKuan = React.createClass({
             <Button
               type="primary"
               style={{ marginBottom: 11, marginLeft: 15 }}
+              disabled={this.state.mergeStatus == 1}
               onClick={this.addModal}
             >
               添加单条数据
@@ -929,6 +1066,7 @@ const HuiKuan = React.createClass({
                 删除全部
               </Button>
             </Popconfirm>
+
             <Button
               type="danger"
               style={{ marginBottom: 11, marginLeft: 15 }}
@@ -942,6 +1080,7 @@ const HuiKuan = React.createClass({
             >
               确认合并回款
             </Button>
+
             <Button
               type="danger"
               style={{ marginBottom: 11, marginLeft: 15 }}
@@ -954,9 +1093,35 @@ const HuiKuan = React.createClass({
             >
               重置选项
             </Button>
+
+            <Button
+              type="primary"
+              style={{ marginBottom: 11, marginLeft: 15 }}
+              disabled={(this.state.mergeStatus == 1) || (this.state.selectedRowKeys.length > 0 ? false : true)}
+              onClick={this.waitingMerge}
+            >
+              添加至待合并库
+            </Button>
+
+            <Button
+              type="primary"
+              style={{ marginBottom: 11, marginLeft: 15 }}
+              onClick={() => {
+                this.setState({
+                  mergeStatus: this.state.mergeStatus == 0 ? 1 : 0
+                }, () => {
+                  this.loadData()
+                })
+              }}
+            >
+              {this.state.mergeStatus == 0 ? "切换至待合并库列表" : "切换至正常库列表"}
+            </Button>
+
           </TabPane>
         </Tabs>
-
+        <div
+          style={{ marginBottom: 10, fontSize: 16 }}
+        >{this.state.mergeStatus == 0 ? "正常库列表" : "待合并列表"}</div>
         <div className="patent-table" style={{ position: "relative" }}>
           <Spin spinning={this.state.loading}>
             <Table
@@ -984,8 +1149,7 @@ const HuiKuan = React.createClass({
             }
             {
               <span>
-                {`合同额总计(万元):${this.state.totalHui ? this.state.totalHui : "0"
-                  }`}
+                {`合同额总计(万元):${this.state.totalHui ? this.state.totalHui : "0"}`}
               </span>
             }
           </p>
@@ -1019,7 +1183,7 @@ const HuiKuan = React.createClass({
             }}
           >
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="合同编号"
             >
@@ -1037,7 +1201,7 @@ const HuiKuan = React.createClass({
           </p>
           <p style={{ marginBottom: 10 }}>
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="订单编号"
             >
@@ -1050,11 +1214,21 @@ const HuiKuan = React.createClass({
                   this.setState({ modalData: this.state.modalData });
                 }}
               />
+              {
+                this.state.modalData.corporateName != undefined &&
+                <Button
+                  type="primary"
+                  style={{ marginLeft: 15 }}
+                  onClick={() => { this.matchingUser(this.state.modalData.corporateName) }}
+                >
+                  智能匹配
+                </Button>
+              }
             </FormItem>
           </p>
           <p style={{ marginBottom: 10 }}>
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="流水编号"
             >
@@ -1071,7 +1245,7 @@ const HuiKuan = React.createClass({
           </p>
           <p style={{ marginBottom: 10 }}>
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="付款方"
             >
@@ -1084,6 +1258,16 @@ const HuiKuan = React.createClass({
                   this.setState({ modalData: this.state.modalData });
                 }}
               />
+              {
+                this.state.modalData.orderNo != undefined &&
+                <Button
+                  type="primary"
+                  style={{ marginLeft: 15 }}
+                  onClick={() => { this.matchingOrderNo(this.state.modalData.orderNo) }}
+                >
+                  智能匹配
+                </Button>
+              }
             </FormItem>
           </p>
           <p
@@ -1093,7 +1277,7 @@ const HuiKuan = React.createClass({
             }}
           >
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="客户名称"
             >
@@ -1116,7 +1300,7 @@ const HuiKuan = React.createClass({
             }}
           >
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="合同额(万元)"
             >
@@ -1137,7 +1321,7 @@ const HuiKuan = React.createClass({
           </p>
           <p style={{ marginBottom: 10 }}>
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="本次回款(万元)"
             >
@@ -1154,7 +1338,7 @@ const HuiKuan = React.createClass({
           </p>
           <p style={{ marginBottom: 10 }}>
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="回款时间"
             >
@@ -1182,7 +1366,7 @@ const HuiKuan = React.createClass({
             }}
           >
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="批量导入时间"
             >
@@ -1200,12 +1384,12 @@ const HuiKuan = React.createClass({
           </p>
           <p style={{ marginBottom: 10 }}>
             <FormItem
-              className="half-item"
+              // className="half-item"
               {...formItemLayout}
               label="备注"
             >
               <TextArea
-                style={{ width: 180, maxWidth: 180 }}
+                // style={{ width: 180, maxWidth: 180 }}
                 value={this.state.modalData.remarks}
                 onChange={e => {
                   this.state.modalData.remarks = e.target.value;
@@ -1249,19 +1433,54 @@ const HuiKuan = React.createClass({
             >
               {
                 <span style={{ marginRight: 10 }}>
-                  {`回款金额总计(万元):${this.state.hui ? this.state.hui : "0"
-                    }`}
+                  {`回款金额总计(万元):${this.state.hui ? this.state.hui : "0"}`}
                 </span>
               }
               {
                 <span>
-                  {`合同额总计(万元):${this.state.totalHui ? this.state.totalHui : "0"
-                    }`}
+                  {`合同额总计(万元):${this.state.totalHui ? this.state.totalHui : "0"}`}
                 </span>
               }
             </p>
           </div>
         </Modal>
+
+        {
+          this.state.matching != "" &&
+          <Modal
+            title="请选择"
+            width={400}
+            visible={this.state.matching != ""}
+            onCancel={this.selCancel}
+            footer=""
+          >
+            <div>
+              {
+                this.state.matchList.map(item =>
+                  <div
+                    style={radioStyle}
+                    key={this.state.matching == "name" ? item.uid : item.orderNo}
+                  >
+                    {this.state.matching == "name" ? item.userName : item.orderNo}
+                    <Button
+                      type="primary"
+                      size="small"
+                      onClick={() => {
+                        this.state.modalData.corporateName = item.userName;
+                        this.state.modalData.nickname = item.userName;
+                        this.state.modalData.orderNo = item.orderNo;
+                        this.setState({
+                          matching: "",
+                          modalData: this.state.modalData,
+                        })
+                      }}
+                    >确定</Button>
+                  </div>
+                )
+              }
+            </div>
+          </Modal>
+        }
       </div>
     );
   }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.2.63",
+  "version": "1.2.64",
   "description": "",
   "main": "index.js",
   "scripts": {