import Request from "~/utils/request";

export async function getCurr() {
  var cur = [];
  var params = {
    current: 0,
    size: 0
  };
  let rst = await Request.post("v1/pm/curs", params);
  if (rst.code == "000000") {
    for (var i = 0; i < rst.data.length; i++) {
      cur.push({
        value: rst.data[i].currCode,
        label: rst.data[i].currSymbol + "-" + rst.data[i].currCnName
      });
    }
  }
  return cur;
}

export async function getInsts() {
  //根据受理中心机构号查询下属营销机构
  var marketInsts = [];
  let instCode = window.sessionStorage.instCode;
  console.log("受理中心机构号： ", instCode);

  let rst = await Request.get("/v1/pm/instManage/queryDownInstById/" + instCode);
  if (rst.code == "000000") {
    marketInsts = rst.data;
  }
  return marketInsts;
}


export async function getCountries() {
  var country = [];
  var info = {
    current: 0,
    size: 0,
    data: {}
  };
  let rst = await Request.post("v1/pm/Cou/cous", info);

  if (rst.code == "000000") {
    for (var i = 0; i < rst.data.length; i++) {
      country.push({
        value: rst.data[i].countryRegionCode,
        label: rst.data[i].countryEnName + "-" + rst.data[i].countryCnName
      });
    }
  }
  return country;
}