getjyHwList.html 5.47 KB
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('下拉框')"/>
  <th:block th:include="include :: select2-css"/>
  <th:block th:include="include :: bootstrap-select-css"/>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  <form class="form-horizontal m" id="form-menu-add" th:object="${piccErrOrder}">
    <input id="ent_name"   name="ent_name" type="hidden"/>
    <input id="ent_code" name="ent_code" type="hidden"/>
    <input id="id" name="id" type="hidden" th:field="*{id}"/>

    <div class="form-group" id="countryDiv">
      <label class="col-sm-3 control-label"><span style="color: red; ">*</span>国别:</label>
      <div class="col-sm-8">
        <select id="country" class="form-control m-b" required>
          <option th:each="item:${countryList}" th:value="${item.jcCode}" th:text="${item.gj}" th:field="*{country}"></option>
        </select>
      </div>
    </div>

<!--    <div class="form-group" id="countryDiv">-->
<!--      <label class="col-sm-3 control-label"><span style="color: red; ">*</span>国别:</label>-->
<!--      <div class="col-sm-8">-->
<!--        <input id="country" name="country" th:field="*{country}" class="form-control" type="text" >-->
<!--      </div>-->
<!--    </div>-->

    <div class="form-group">
      <label class="col-sm-3 control-label"><span style="color: red; ">*</span>订单名称:</label>
      <div class="col-sm-8">
        <input id="name" type="text" placeholder="请选择订单名称" class="form-control" th:field="*{enterpriseName}" required>
      </div>
    </div>

    <div class="form-group">
      <label class="col-sm-3 control-label"></label>
      <div class="col-sm-8">
        <button type="button" class="btn btn-success" id="select" onclick="search()">查询</button>
      </div>
    </div>

    <div class="col-sm-12 select-table table-striped">
      <table class="table table-bordered" id="table_own">
        <thead>
          <tr>
            <th>企业名称</th>
            <th>企业状态</th>
            <th>国家</th>
            <th>所在城市</th>
            <th>企业地址</th>
            <th>企业注册号</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>

        </tbody>
      </table>
    </div>
  </form>


</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<script th:inline="javascript">

  let searchData = []
  let picc = [[${piccErrOrder}]]
  search();
  function search() {
    var country = $("#country").val();
    var name = $("#name").val();
    $("#table_own tbody").html('正在查询中。。。');
    if (name === '') {
      $.modal.alertError("请输入企业名称")
      return;
    }
    $.ajax({
      url: '/web/monitorCompany/getjyEnterpraseInfo',
      data: {
        countryCode: country,
        name: name
      },
      type: 'get',
      dataType: 'json',
      success: function (res) {
        console.log(res)
        $("#table_own tbody").empty();
        if (res.code == '2000') {
          let itemList = res.data.items;
          searchData = res.data.items;
          let tempList = ``
          itemList.forEach((item, index) => {
            let temp = `<tr>
                    <td>${item.nameEnglish}</td>
                    <td>${item.status}</td>
                    <td>${item.country}</td>
                    <td>${item.city}</td>
                    <td>${item.addressLine}</td>
                    <td>${item.nationalIdNo}</td>
                    <td><button type="button" class="btn btn-warning choiceBtn" onclick="handleChoice('${index}')">下单</button></td>
                  </tr>`
            tempList += temp;
          })
          $("#table_own tbody").append(tempList);
        } else {
          $.modal.alertError(res.msg)
        }
      }
    })
  }

  function handleChoice(index) {
    console.log(index)
    searchData.forEach((item, dataIndex)=> {
      if (dataIndex == index) {
        console.log(item)
       var ename= item.nameEnglish;
       var ewin= item.eid;
       var ecountry=item.country;
        var type=picc.reportType == 0 ? "简易":"标准"
        $.modal.confirm("您确定要下单"+ename+"的"+type+"版企业信用报告吗?",function (){
          this.order(ename, ewin,ecountry)
        })
      }
    })
  }

  function order(ename, ewin,ecountry) {
    console.log(picc)
    $.ajax({
      type: "POST",
      url: "/business/piccErrOrder/addJyOrder",
      dataType: "json",
      data:{name:ename,win:ewin,id:picc.id,country:ecountry},
      success: function (response) {
        if(response.code==2000){
          $.modal.alertSuccess(response.msg)
        }else {
          $.modal.alertError(response.msg)
        }
        // $.modal.closeAll();
      }
    })
  }

  function err(){
    var id = $("#id").val();
    parent.layer.close(parent.layer.getFrameIndex(window.name))
    parent.layer.open({
      type: 2,
      title: '简易版海外异常下单',
      maxmin: true,
      shadeClose: false, // 点击遮罩关闭层
      area: ['800px', '620px'],
      btn: ['确定', '关闭'],
      yes: function (index, layero) {
        var iframeWin = layero.find('iframe')[0];
        iframeWin.contentWindow.submitHandler(index, layero);
      },
      content: "/business/piccErrOrder/searchError/"+id // iframe的url
    });

  }
</script>
</body>
</html>