Browse Source

订单变更发起完成,开发记录

mentoswzq 5 years ago
parent
commit
c3267de83e

+ 222 - 26
js/component/manageCenter/order/orderNew/addService.jsx

@@ -13,7 +13,8 @@ import {
   AutoComplete,
   DatePicker,
   Col,
-  Tabs
+  Tabs,
+  Tag
 } from "antd";
 import $ from "jquery/src/ajax";
 import "../userMangagement.less";
@@ -261,6 +262,33 @@ const NewService = Form.create()(
         ],
         proColumns: [
           {
+            title: "变更状态",
+            dataIndex: "type",
+            key: "type",
+            render: text => {
+              let str = "";
+              let color = "";
+              if (text == 1) {
+                str = "增";
+                color = "#87d068";
+              } else if (text == 2) {
+                str = "改";
+                color = "#108ee9";
+              } else if (text == 3) {
+                str = "删";
+                color = "#f50";
+              }
+              return (
+                <Tag
+                  color={color}
+                  style={{ display: text == 0 ? "none" : "inline-block" }}
+                >
+                  {str}
+                </Tag>
+              );
+            }
+          },
+          {
             title: "业务项目名称",
             dataIndex: "commodityName",
             key: "commodityName"
@@ -782,6 +810,33 @@ const NewService = Form.create()(
         ],
         changeCuiList: [
           {
+            title: "变更状态",
+            dataIndex: "type",
+            key: "type",
+            render: text => {
+              let str = "";
+              let color = "";
+              if (text == 1) {
+                str = "增";
+                color = "#87d068";
+              } else if (text == 2) {
+                str = "改";
+                color = "#108ee9";
+              } else if (text == 3) {
+                str = "删";
+                color = "#f50";
+              }
+              return (
+                <Tag
+                  color={color}
+                  style={{ display: text == 0 ? "none" : "inline-block" }}
+                >
+                  {str}
+                </Tag>
+              );
+            }
+          },
+          {
             title: "项目名称",
             dataIndex: "commodityName",
             key: "commodityName",
@@ -1937,7 +1992,7 @@ const NewService = Form.create()(
                   });
                 } else if (e == 3) {
                   this.setState({
-                    listFlag: true,
+                    listFlag: false,
                     hetongFlag: false,
                     listCuiFlag: false,
                     tuiKuanFlag: false
@@ -1994,10 +2049,10 @@ const NewService = Form.create()(
         },
         success: function(data) {
           if (data.data && data.data.length) {
-            if(id) {
+            if (id) {
               this.setState({
                 listCuiFlag: true
-              })
+              });
             }
             this.setState({
               cuiDataSource: data.data
@@ -2017,10 +2072,10 @@ const NewService = Form.create()(
         },
         success: function(data) {
           if (data.data && data.data.length) {
-            if(id) {
+            if (id) {
               this.setState({
                 listFlag: true
-              })
+              });
             }
             this.setState({
               proDataSource: data.data
@@ -2466,10 +2521,9 @@ const NewService = Form.create()(
         message.warning("当前订单流程不能发起变更!");
         return false;
       }
-      if (this.state.changeAmount == "") {
+      if (this.state.changeAmount === "") {
         message.warning("申请退款金额不能为空!");
         // console.log(this.state.changeAmount);
-
         return false;
       }
       if (this.state.remarksC.trim() == "") {
@@ -2557,12 +2611,15 @@ const NewService = Form.create()(
             });
             if (!data.error.length) {
               message.success("发起变更草稿");
-              this.setState({
-                isCaoGao: true,
-                loading: false,
-              },() => {
-                this.callback("2");
-              });
+              this.setState(
+                {
+                  isCaoGao: true,
+                  loading: false
+                },
+                () => {
+                  this.callback("2");
+                }
+              );
             } else {
               message.warning(data.error[0].message);
             }
@@ -2759,9 +2816,10 @@ const NewService = Form.create()(
         method: "post",
         dataType: "json",
         crossDomain: false,
-        url: globalConfig.context + "/api/admin/orderChange/deleteChangeTask",
+        url: globalConfig.context + "/api/admin/orderChange/updateChangeTask",
         data: {
-          id: record.id
+          id: record.id,
+          type: 3
         },
         success: function(data) {
           let theArr = [];
@@ -2805,10 +2863,11 @@ const NewService = Form.create()(
           boFlag: false
         });
         $.ajax({
-          url: globalConfig.context + "/api/admin/orderChange/deleteChangeDun",
+          url: globalConfig.context + "/api/admin/orderChange/updateChangeDun",
           method: "post",
           data: {
-            id: index.id
+            id: index.id,
+            type: 3,
           }
         }).done(
           function(data) {
@@ -2820,7 +2879,7 @@ const NewService = Form.create()(
               this.setState({
                 cuiFlag: false
               });
-              this.cuiList(this.state.orderNo);
+              this.cuiList();
             } else {
               message.warning(data.error[0].message);
             }
@@ -2902,7 +2961,7 @@ const NewService = Form.create()(
                 boFlag: false,
                 addFlag: false
               });
-              this.cuiList(record.orderNo);
+              this.cuiList();
             } else {
               message.warning(data.error[0].message);
             }
@@ -2934,7 +2993,7 @@ const NewService = Form.create()(
                 boFlag: false,
                 addFlag: false
               });
-              this.cuiList(record.orderNo);
+              this.cuiList();
             } else {
               message.warning(data.error[0].message);
             }
@@ -2947,10 +3006,8 @@ const NewService = Form.create()(
         message.warning("当前订单流程不能发起变更!");
         return false;
       }
-      if (this.state.changeAmount == "") {
+      if (this.state.changeAmount === "") {
         message.warning("申请退款金额不能为空!");
-        // console.log(this.state.changeAmount);
-
         return false;
       }
       if (this.state.remarksC.trim() == "") {
@@ -3010,6 +3067,82 @@ const NewService = Form.create()(
         }.bind(this)
       );
     },
+    editCui(record) {
+      this.setState({
+        editCuiVisible: true,
+        editCuiMoney: record.money,
+        editCuiTid: record.tid,
+        editCuiId: record.id
+      });
+      console.log(record);
+    },
+    editPro(record) {
+      this.setState({
+        editProVisible: true,
+        editProMoney: record.commodityPrice,
+        editProTid: record.tid,
+        editProId: record.id
+      });
+      console.log(record);
+    },
+    submitEditCui() {
+      this.setState({
+        loading: true
+      })
+      $.ajax({
+        url: globalConfig.context + "/api/admin/orderChange/updateChangeDun",
+        method: "post",
+        data: {
+          id: this.state.editCuiId,
+          type: this.state.editCuiTid ? 2 : 1,
+          money: this.state.editCuiMoney
+        }
+      }).done(
+        function(data) {
+          this.setState({
+            loading: false
+          });
+          if (!data.error.length) {
+            message.success("修改成功!");
+            this.cuiList();
+            this.setState({
+              editCuiVisible: false
+            });
+          } else {
+            message.warning(data.error[0].message);
+          }
+        }.bind(this)
+      );
+    },
+    submitEditPro() {
+      this.setState({
+        loading: true
+      })
+      $.ajax({
+        url: globalConfig.context + "/api/admin/orderChange/updateChangeTask",
+        method: "post",
+        data: {
+          id: this.state.editProId,
+          type: this.state.editProTid ? 2 : 1,
+          commodityPrice: this.state.editProMoney
+        }
+      }).done(
+        function(data) {
+          this.setState({
+            loading: false
+          });
+          if (!data.error.length) {
+            message.success("修改成功!");
+            this.proList();
+            this.setState({
+              editProVisible: false
+            });
+          } else {
+            message.warning(data.error[0].message);
+          }
+        }.bind(this)
+      );
+    },
     render() {
       const FormItem = Form.Item;
       const { TabPane } = Tabs;
@@ -4007,7 +4140,7 @@ const NewService = Form.create()(
                                       });
                                     } else if (e == 3) {
                                       this.setState({
-                                        listFlag: true,
+                                        listFlag: false,
                                         hetongFlag: false,
                                         listCuiFlag: false,
                                         tuiKuanFlag: false
@@ -4156,7 +4289,9 @@ const NewService = Form.create()(
                                     columns={this.state.proColumns}
                                     dataSource={this.state.proDataSource}
                                     pagination={this.state.pagination}
-                                    // onRowClick={this.tableRowClick}
+                                    onRowDoubleClick={
+                                      this.listFlag ? "" : this.editPro
+                                    }
                                     bordered
                                     size="small"
                                   />
@@ -4203,6 +4338,9 @@ const NewService = Form.create()(
                                       columns={this.state.changeCuiList}
                                       dataSource={this.state.cuiDataSource}
                                       scroll={{ x: "max-content", y: 0 }}
+                                      onRowDoubleClick={
+                                        this.listCuiFlag ? "" : this.editCui
+                                      }
                                       bordered
                                       size="small"
                                     />
@@ -5065,6 +5203,64 @@ const NewService = Form.create()(
               </Spin>
             </Form>
           </Modal>
+          <Modal
+            title="修改项目金额"
+            visible={this.state.editProVisible}
+            onOk={this.submitEditPro}
+            width={300}
+            okText={"保存"}
+            onCancel={() => {
+              this.setState({
+                editProVisible: false
+              });
+            }}
+          >
+            <div className="clearfix">
+              <FormItem
+                labelCol={{ span: 6 }}
+                wrapperCol={{ span: 14 }}
+                label="项目金额"
+              >
+                <Input
+                  placeholder="请输入金额"
+                  rows={4}
+                  value={this.state.editProMoney}
+                  onChange={e => {
+                    this.setState({ editProMoney: e.target.value });
+                  }}
+                />
+              </FormItem>
+            </div>
+          </Modal>
+          <Modal
+            title="修改催款节点金额"
+            visible={this.state.editCuiVisible}
+            onOk={this.submitEditCui}
+            okText={"保存"}
+            width={300}
+            onCancel={e => {
+              this.setState({
+                editCuiVisible: false
+              });
+            }}
+          >
+            <div className="clearfix">
+              <FormItem
+                labelCol={{ span: 6 }}
+                wrapperCol={{ span: 14 }}
+                label="催款金额"
+              >
+                <Input
+                  placeholder="请输入金额"
+                  rows={4}
+                  value={this.state.editCuiMoney}
+                  onChange={e => {
+                    this.setState({ editCuiMoney: e.target.value });
+                  }}
+                />
+              </FormItem>
+            </div>
+          </Modal>
           <OrderRiZi
             dataSourcerizhi={this.state.dataSourcerizhi}
             closeOrderLog={this.closeOrderLog}

+ 122 - 23
js/component/manageCenter/order/orderNew/contractYxy.js

@@ -122,7 +122,7 @@ const contractChange = Form.create()(
         refundInvoice: [],
         RefundInvoice: [],
         paginations: false,
-        activeKey: "1",
+        activeKey: "a",
         confirmLoading: false,
         aloading: false,
         pagination: {
@@ -341,7 +341,8 @@ const contractChange = Form.create()(
         },
         () => {
           this.xiangqing(record.orderNo);
-          this.ChangeDetail(this.state.id);
+          // this.ChangeDetail(this.state.id);
+          this.createTabs()
         }
       );
     },
@@ -883,26 +884,33 @@ const contractChange = Form.create()(
           activeKey: key
         },
         () => {
-          if (key === "2") {
-            this.ChangeDetail(this.state.id);
-            this.loadDataChange();
+          console.log(key);
+          
+          if (key != "a" && key != "c" && key.length < 10) {
+            this.ChangeDetail(key);
+            this.loadDataChange(key);
+          } else if (key != "a" && key != "c" && key.length > 10) {
+            this.primaryOrder(key);
+            this.xiangmu(key);
+            this.jiedian(key);
+            this.jiedianNew(key);
           }
         }
       );
-      if (key === "1") {
+      if (key === "a") {
         if (this.state.orderData.deleteSign !== 3) {
           this.xiangmu(this.state.orderNo);
           this.jiedian(this.state.orderNo);
           this.jiedianNew(this.state.orderNo);
         }
       }
-      if (key === "3") {
-        this.primaryOrder(this.state.primaryOrderNo);
-        this.xiangmu(this.state.primaryOrderNo);
-        this.jiedian(this.state.primaryOrderNo);
-        this.jiedianNew(this.state.primaryOrderNo);
-      }
-      if (key === "4") {
+      // if (key === "3") {
+      //   this.primaryOrder(this.state.primaryOrderNo);
+      //   this.xiangmu(this.state.primaryOrderNo);
+      //   this.jiedian(this.state.primaryOrderNo);
+      //   this.jiedianNew(this.state.primaryOrderNo);
+      // }
+      if (key === "c") {
         this.additionalOrder(this.state.additionalOrder);
         this.xiangmu(this.state.additionalOrder);
         this.jiedian(this.state.additionalOrder);
@@ -918,7 +926,7 @@ const contractChange = Form.create()(
     },
 
     closeDesc(e, s) {
-      this.state.activeKey = "1";
+      this.state.activeKey = "a";
       this.state.userDetaile = false;
       this.state.signBillVisible = false;
       this.state.visible = e;
@@ -1059,7 +1067,7 @@ const contractChange = Form.create()(
     visitCancel() {
       this.setState(
         {
-          activeKey: "1"
+          activeKey: "a"
         },
         () => {
           this.setState({
@@ -1087,7 +1095,39 @@ const contractChange = Form.create()(
         changeList: newArr
       });
     },
+    // test() {
+    //   $.ajax({
+    //     url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
+    //     method: "get",
+    //     data: {
+    //       orderNo: "423417782475313152"
+    //     },
+    //     success: (data) => {
+    //       console.log("test",data);
+          
+    //     }
+    //   });
+    // },
+    createTabs() {
+       $.ajax({
+        url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
+        method: "get",
+        data: {
+          orderNo: this.state.orderNo
+        },
+        success: (data) => {
+          if(data.error && data.error.length) {
+            message.warning(data.error[0].message)
+          }else {
+            this.setState({
+              tabList: data.data
+            })
+          }
+        }
+      });
+    },
     render() {
+      const tabList = this.state.tabList || []
       const formItemLayout = {
         labelCol: { span: 8 },
         wrapperCol: { span: 14 }
@@ -1135,9 +1175,13 @@ const contractChange = Form.create()(
               onOk={this.visitOk}
               onCancel={this.visitCancel}
             >
-              <Tabs activeKey={this.state.activeKey} onChange={this.callback}>
+              <Tabs
+                activeKey={this.state.activeKey}
+                onChange={this.callback}
+                type="card"
+              >
                 {this.state.orderData.deleteSign === 3 ? (
-                  <TabPane tab="订单详情" key="1">
+                  <TabPane tab="订单详情" key="a">
                     <AddOrders
                       processStatus={0}
                       data={this.state.orderData.orderNo}
@@ -1150,7 +1194,7 @@ const contractChange = Form.create()(
                     />
                   </TabPane>
                 ) : (
-                  <TabPane tab="订单详情" key="1">
+                  <TabPane tab="订单详情" key="a">
                     <Form
                       layout="horizontal"
                       onSubmit={this.handleSubmit}
@@ -1171,7 +1215,7 @@ const contractChange = Form.create()(
                     </Form>
                   </TabPane>
                 )}
-                <TabPane tab="合同变更记录" key="2">
+                {/* <TabPane tab="合同变更记录" key="2">
                   {this.state.contractData.processState === 0 ? (
                     <ChangeApply
                       orderData={this.state.contractData}
@@ -1190,8 +1234,63 @@ const contractChange = Form.create()(
                       contactList={this.state.refundInvoice}
                     />
                   )}
-                </TabPane>
-                {this.state.status === 4 ? (
+                </TabPane> */}
+
+                {tabList.map((item, index) => {
+                  return (
+                    <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
+                      {this.state.contractData.processState === 0 ? (
+                        <ChangeApply
+                          orderData={this.state.contractData}
+                          voucherUrl={this.state.voucherUrl}
+                          onCancel={this.visitCancel}
+                        />
+                      ) : (
+                        <ChangeDetail
+                          data={this.state.contractData}
+                          pictureUrl={this.state.voucherUrl}
+                          processState={this.props.processState}
+                          dataSource={this.state.dataProps}
+                          proceedsData={this.state.proceedsData}
+                          proceedsTotal={this.state.proTotal}
+                          invoiceTotal={this.state.invTotal}
+                          contactList={this.state.refundInvoice}
+                        />
+                      )}
+                    </TabPane>
+                  );
+                })}
+                {tabList.map((item, index) => {
+                  if (item.usedOrder) {
+                    return (
+                      <TabPane tab={"原订单" + (index + 1)} key={item.usedOrder}>
+                        <Form
+                          layout="horizontal"
+                          onSubmit={this.handleSubmit}
+                          id="demand-form"
+                          style={{ paddingBottom: "40px" }}
+                        >
+                          <Spin spinning={this.state.loading}>
+                            <OrderDetail
+                              orderData={this.state.primaryOrderData}
+                              getOrderLog={this.getOrderLog}
+                              dataSourceX={this.state.dataSourceX}
+                              contactList={this.state.contactList}
+                              orderNo={this.state.primaryOrderNo}
+                              totalCui={this.state.totalCui}
+                              contactListNew={this.state.contactListNew}
+                            />
+                          </Spin>
+                        </Form>
+                      </TabPane>
+                    );
+                  }else {
+                    return(
+                      ""
+                    )
+                  }
+                })}
+                {/* {this.state.status === 4 ? (
                   <TabPane tab="原订单" key="3">
                     <Form
                       layout="horizontal"
@@ -1214,10 +1313,10 @@ const contractChange = Form.create()(
                   </TabPane>
                 ) : (
                   ""
-                )}
+                )} */}
                 {this.state.status === 4 ? (
                   this.state.type === 4 || this.state.type === 5 ? (
-                    <TabPane tab="附加订单" key="4">
+                    <TabPane tab="附加订单" key="c">
                       <AddOrders
                         processStatus={0}
                         data={this.state.orderData.additionalOrder}