| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700 | import React, { Component } from "react";import {  Button,  Form,  Input,  message,  Spin,  Select,  Tabs,  Table,  Modal,  Tooltip,} from "antd";import $ from "jquery/src/ajax";import { ChooseList } from "../../../manageCenter/order/orderNew/chooseList";import OrderDetail from "../orderNew/changeComponent/orderDetail";import OrderRiZi from "@/orderRiZi.jsx";import { salesList } from "@/dataDic.js";import {  getProcessStatus,  getLiquidationStatus,  getNewOrderStatus,  ShowModal,} from "@/tools.js";const { TabPane } = Tabs;const FormItem = Form.Item;const Option = Select.Option;class OrderList extends Component {  constructor(props) {    super(props);    this.state = {      onelist: [        {          value: "0",          label: "首付待付请",        },        {          value: "1",          label: "尾款待付清",        },        {          value: "2",          label: "已付请",        },      ],      twolist: [        {          value: "0",          label: "非特批",        },        {          value: "1",          label: "特批",        },      ],      threelist: [        {          value: "0",          label: "10万元以下",        },        {          value: "1",          label: "10万~20万",        },        {          value: "2",          label: "20万~30万",        },        {          value: "3",          label: "30万~40万",        },        {          value: "4",          label: "40万以上",        },      ],      columns: [        {          title: "销售类型",          dataIndex: "salesType",          key: "salesType",          render: (text, record) => {            return (              <Tooltip                title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}              >                <span>                  {salesList[text]}                </span>              </Tooltip>            );          },        },        {          title: "合同编号",          dataIndex: "contractNo",          key: "contractNo",        },        {          title: "订单编号",          dataIndex: "orderNo",          key: "orderNo",        },        {          title: "客户名称",          dataIndex: "userName",          key: "userName",        },        {          title: "订单部门",          dataIndex: "depName",          key: "depName",        },        {          title: "下单时间",          dataIndex: "createDate",          key: "createDate",        },        {          title: "合同签订时间",          dataIndex: "signDate",          key: "signDate",        },        {          title: "流程状态",          dataIndex: "processStatus",          key: "processStatus",          render: (text, record) =>            <span >              {getProcessStatus(text)}            </span>        },        {          title: "签单金额(万元)",          dataIndex: "totalAmount",          key: "totalAmount",          render: (text, record) =>            <span >              {text}            </span>        },        {          title: "开单金额(万元)",          dataIndex: "invoiceAmount",          key: "invoiceAmount",          render: (text, record) =>            <span >              {text}            </span>        },        {          title: "已收款(万元)",          dataIndex: "settlementAmount",          key: "settlementAmount",          render: (text, record) =>            <span >              {text}            </span>        },        {          title: "结算状态",          dataIndex: "liquidationStatus",          key: "liquidationStatus",          render: (text, record) =>            <span >              {getLiquidationStatus(text)}            </span>        },        {          title: "是否特批",          dataIndex: "approval",          key: "approval",          render: (text, record) =>            <span >              {["非特批", "特批", "特批通过"][text]}            </span>        },        {          title: "订单状态",          dataIndex: "orderStatus",          key: "orderStatus",          render: (text, record) =>            <span >              {getNewOrderStatus(text)}            </span>        },      ],      pagination: {        defaultCurrent: 1,        defaultPageSize: 10,        showQuickJumper: true,        pageSize: 10,        onChange: function (page) {          this.loadData(page);        }.bind(this),        showTotal: function (total) {          return "共" + total + "条数据";        },      },      loading: false,      changeList: undefined,      searchValues: {},      dataSource: [],      details: false,      orderData: {},    };  }  changeList(arr) {    const newArr = [];    this.state.columns.forEach((item) => {      arr.forEach((val) => {        if (val === item.title) {          newArr.push(item);        }      });    });    this.setState({      changeList: newArr,    });  }  // 重置  resetAll() {    this.setState(      {        searchValues: JSON.parse(JSON.stringify({})),        selectedRowKeys: [],      },      () => {        this.loadData();      }    );  }  // 列表接口  loadData(pageNo) {    const { searchValues, pagination } = this.state;    this.setState({      loading: true,    });    let prs = this.props.data;    prs.pageNo = pageNo || 1;    prs.pageSize = pagination.pageSize;    let datas = Object.assign(searchValues, prs);    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/newOrder/statistics/orderList",      data: datas,      success: function (data) {        ShowModal(this);        this.setState({          loading: false,        });        if (data.error && data.error.length === 0) {          if (data.data.list) {            pagination.current = data.data.pageNo;            pagination.total = data.data.totalCount;            if (data.data && data.data.list && !data.data.list.length) {              pagination.current = 0;              pagination.total = 0;            }            this.setState({              dataSource: data.data.list,              pagination: this.state.pagination,              pageNo: data.data.pageNo,            });          } else {            this.setState({              dataSource: data.data,              pagination: false,            });          }        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  }  // 订单详情  xiangqing(orderNos) {    this.setState({      loading: true    })    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",      data: {        orderNo: orderNos      },      success: function (data) {        this.setState({          loading: false        })        if (data.error.length || data.data.list == "") {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }        } else {          let thisdata = data.data;          this.setState(            {              orderUid: thisdata.uid,              userName: thisdata.userName,              primaryOrderNo: thisdata.primaryOrder,              additionalOrder: thisdata.additionalOrder,              contractNo: thisdata.contractNo,              // arrears: thisdata.arrears,              orderData: thisdata,              isAddition: thisdata.additionalOrder ? true : false,            },            () => {              if (this.state.orderData.deleteSign !== 3) {                this.jiedianNew(this.state.orderNo);              }            }          );        }      }.bind(this)    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  }  //   createTabs(orderNos) {    $.ajax({      url: globalConfig.context + "/api/admin/orderChange/getOrderChange",      method: "get",      data: {        orderNo: orderNos      },      success: (data) => {        if (data.error && data.error.length) {          message.warning(data.error[0].message)        } else {          this.setState({            tabList: data.data          })        }      }    });  }  // 整行点击  tableRowClick(record) {    this.setState(      {        details: true,        orderNo: record.orderNo      },      () => {        this.xiangqing(record.orderNo)        this.createTabs(record.orderNo)      }    );  }  //  jiedianNew(orderNos) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url:        globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",      data: {        orderNo: orderNos      },      success: function (data) {        if (data.error && data.error.length) {          message.warning(data.error[0].message);        } else {          let theArr = [];          let thisData = [];          let arr = data.data || [];          let totalCui = 0;          for (let i = 0; i < arr.length; i++) {            thisData = arr[i];            totalCui += +thisData.money;            theArr.push({              key: i,              dunSubject: thisData.dunSubject                ? thisData.dunSubject.toString()                : "", //催款科目              id: thisData.id, //节点Id              money: thisData.money, //催款金额              commodityName: thisData.commodityName,              projectType: thisData.projectType,              dunTypeName: thisData.dunTypeName,              status: thisData.status,              waitDay: thisData.waitDay,              effectiveCount: thisData.effectiveCount,              startDate: thisData.startDate,              dunType: thisData.dunType,              appropriationRatio: thisData.appropriationRatio,              customizeName: thisData.customizeName,              customizeTimes: thisData.customizeTimes,              tid: thisData.tid,            });          }          if (!totalCui) {            totalCui = 0;          }          totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);          this.setState({            contactListNew: theArr,            totalCui          });        }      }.bind(this)    }).always(      function () {        this.setState({          loading: false        });      }.bind(this)    );  }  //   closeDesc() {    this.setState({      details: false    })    this.loadData(this.state.pageNo);  }  //查看订单日志  getOrderLog() {    this.setState({      rizhivisible: true,    });    this.rizhi();  }  //   closeOrderLog() {    this.setState({      rizhivisible: false    });  }  // 日志  rizhi() {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: "/api/admin/newOrder/selectOrderLog",      data: {        orderNo: this.state.orderNo,      },      success: function (data) {        let theArr = [];        let thisData = data.data;        if (!thisData.length) {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }          thisData = {};        } else {          for (let i = 0; i < data.data.length; i++) {            let thisdata = data.data[i];            theArr.push({              processName: thisdata.processName,              adminName: thisdata.adminName,              createDate: thisdata.createDate,              remarks: thisdata.remarks            });          }        }        this.setState({          dataSourcerizhi: theArr        });      }.bind(this)    });  }  // 项目列表  xiangmu(orderNos) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/newOrder/getOrderTask",      data: {        orderNo: orderNos      },      success: function (data) {        let theArr = [];        if (data.error.length || data.data.list == "") {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }        } else {          for (let i = 0; i < data.data.length; i++) {            let thisdata = data.data[i];            thisdata.key = i;            thisdata.sort = thisdata.cSort;            theArr.push(thisdata);          }        }        this.setState({          dataSourceX: theArr        });      }.bind(this)    });  }  componentWillMount() {    this.loadData();  }  render() {    const { searchValues, onelist, twolist, threelist, columns, changeList, details } = this.state;    return (      <div className="user-content signatureStatistics">        <Tabs defaultActiveKey="1">          <TabPane tab="搜索" key="1">            <div style={{ paddingTop: 10 }}>              <Form layout="inline">                <FormItem>                  <Input                    placeholder="请输入订单编号"                    value={searchValues["orderNo"]}                    onChange={(e) => {                      searchValues["orderNo"] = e.target.value                      this.setState({                        searchValues: searchValues,                      });                    }}                  />                </FormItem>                <FormItem>                  <Input                    placeholder="请输入客户姓名"                    value={searchValues["name"]}                    onChange={(e) => {                      searchValues["name"] = e.target.value                      this.setState({                        searchValues: searchValues,                      });                    }}                  />                </FormItem>                <FormItem>                  <Input                    placeholder="请输入合同编号"                    value={searchValues["contractNo"]}                    onChange={(e) => {                      searchValues["contractNo"] = e.target.value                      this.setState({                        searchValues: searchValues,                      });                    }}                  />                </FormItem>                <FormItem>                  <Select                    placeholder={"请选择结算状态"}                    style={{ width: 150 }}                    value={searchValues["liquidationStatus"]                      ? searchValues["liquidationStatus"]                      : undefined}                    onChange={(e) => {                      searchValues["liquidationStatus"] = e                      this.setState({                        searchValues: searchValues,                      });                    }}                  >                    {onelist.map((it, ins) => (                      <Option key={it.value}>{it.label}</Option>                    ))}                  </Select>                </FormItem>                <FormItem>                  <Select                    placeholder={"请选择特批状态"}                    style={{ width: 150 }}                    value={searchValues["approval"]                      ? searchValues["approval"]                      : undefined}                    onChange={(e) => {                      searchValues["approval"] = e                      this.setState({                        searchValues: searchValues,                      });                    }}                  >                    {twolist.map((it, ins) => (                      <Option key={it.value}>{it.label}</Option>                    ))}                  </Select>                </FormItem>                <FormItem>                  <Select                    placeholder={"请选择签单金额"}                    style={{ width: 150 }}                    value={searchValues["amountStatus"]                      ? searchValues["amountStatus"]                      : undefined}                    onChange={(e) => {                      searchValues["amountStatus"] = e                      this.setState({                        searchValues: searchValues,                      });                    }}                  >                    {threelist.map((it, ins) => (                      <Option key={it.value}>{it.label}</Option>                    ))}                  </Select>                </FormItem>                <Button                  type="primary"                  onClick={() => { this.loadData() }}                  style={{ marginRight: "10px" }}                >                  搜索                </Button>                <Button                  onClick={() => { this.resetAll() }}                  style={{ marginRight: "10px" }}                >                  重置                </Button>              </Form>            </div>          </TabPane>          <TabPane tab="更改表格显示数据" key="2">            <div style={{ marginLeft: 10 }}>              <ChooseList                columns={columns}                changeFn={this.changeList.bind(this)}                changeList={changeList}                top={55}                margin={11}              />            </div>          </TabPane>        </Tabs>        <div className="patent-table">          <Spin spinning={this.state.loading}>            <Table              bordered              size="middle"              columns={changeList ? changeList : columns}              dataSource={this.state.dataSource}              pagination={this.state.pagination}              onRowClick={this.tableRowClick.bind(this)}            />          </Spin>        </div>        {          details &&          <Modal            footer={null}            width="900px"            title="订单详情"            visible={details}            onCancel={this.closeDesc.bind(this)}          >            <Spin spinning={this.state.loading}>              <OrderDetail                domId='dindanxiangqing'                orderUid={this.state.orderUid}                orderData={this.state.orderData}                getOrderLog={this.getOrderLog.bind(this)}                totalCui={parseFloat(this.state.totalCui)}                dataSourceX={this.state.dataSourceX}                contactList={this.state.contactList}                contactListNew={this.state.contactListNew}                orderNo={this.state.orderNo}              />            </Spin>          </Modal>        }        <OrderRiZi          dataSourcerizhi={this.state.dataSourcerizhi}          closeOrderLog={this.closeOrderLog.bind(this)}          visible={this.state.rizhivisible}          loading={this.state.loading}        />      </div>    );  }}export default OrderList;
 |