You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3978 lines
164 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//********************************
//投资规划------
//********************************
var ProposalId = 0; //建议书Id
var DelObjs = new Array();
var indexFlag = 0;
var ShowPupTagId = "";//记录弹出层标记
var ShowRadioTag = "";//记录选择对象
var param = "";
var TagNavi = false;
var selecVal = "";//记录你选择完的对象 ---为了给搜索用的。
//判断是否非法字符
function CheckNum(num) {
var pattern6 = /^[-]?\d+(\.\d{1,6})?$/;//只能输入两位小数
if (!pattern6.test(num)) {
num = 0;
return num;
}
return num;
}
//计算百分百比。输入值不为百分之百
function CalcPerCent(HoldRate, IncreaseRate, SpeculationRate) {
var HoldRate1 = CheckNum(HoldRate);
var IncreaseRate1 = CheckNum(IncreaseRate);
var SpeculationRate1 = CheckNum(SpeculationRate);
var sum = 0;
if (HoldRate1 == HoldRate && IncreaseRate1 == IncreaseRate && SpeculationRate1 == SpeculationRate) {
sum = HoldRate * 1 + IncreaseRate * 1 + SpeculationRate * 1;
} else {
sum = 0;
}
return sum;
}
//("意外险", "重疾险", "寿险", "教育年金", "养老年金", "看护险");
var InsureArry = ["意外险", "重疾险", "寿险", "教育年金", "养老年金", "看护险"];
//赋值事件
var SetPercentVal = (function () {
//百分比事件
var setPercentValue = function (obj) {
var selVal = $(obj).val();
if (selVal == "1") {//单身期
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[1]);
//同时还要改变 保 -增 -投的值
$("#HoldRate").val(10);
$("#IncreaseRate").val(10);
$("#SpeculationRate").val(80);
ShowPieInfo(10, 10, 80);
} else if (selVal == "2") {//家庭形成期(筑巢期)
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[1] + "、" + InsureArry[2]);
//同时还要改变 保 -增 -投的值
$("#HoldRate").val(20);
$("#IncreaseRate").val(10);
$("#SpeculationRate").val(70);
ShowPieInfo(20, 10, 70);
} else if (selVal == "3") {//家庭成长期(满巢期)
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[1] + "、" + InsureArry[2] + "、" + InsureArry[3]);
//同时还要改变 保 -增 -投的值
$("#HoldRate").val(10);
$("#IncreaseRate").val(30);
$("#SpeculationRate").val(60);
ShowPieInfo(10, 30, 60);
} else if (selVal == "4") {//家庭成熟期(离巢期)
$("#InsureShow").val("意外险" + "、" + "重疾险" + "、" + "养老年金");
//同时还要改变 保 -增 -投的值
$("#HoldRate").val(10);
$("#IncreaseRate").val(40);
$("#SpeculationRate").val(50);
ShowPieInfo(10, 40, 50);
} else if (selVal == "5") {//家庭衰老期(空巢期)
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[5]);
//同时还要改变 保 -增 -投的值
$("#HoldRate").val(20);
$("#IncreaseRate").val(60);
$("#SpeculationRate").val(20);
ShowPieInfo(20, 60, 20);
} else if (selVal == "0") {//当为选择的时候全部要清空
$("#InsureShow").val("");
$("#HoldRate").val(0);
$("#IncreaseRate").val(0);
$("#SpeculationRate").val(0);
ShowPieInfo(0, 0, 0);
}
////HedgeDiv 保值层 AddStar 增值层 SpeculateDiv 投机层
if (selVal != "0") {
AddStarSpan("HedgeDiv", "保值层");
AddStarSpan("AddStar", "增值层");
AddStarSpan("SpeculateDiv", "投机层");
} else {
ClearStarSpan("HedgeDiv", "保值层");
ClearStarSpan("AddStar", "增值层");
ClearStarSpan("SpeculateDiv", "投机层");
}
};
//加载给值方法
var setPercentValueTwo = function (selVal) {
if (selVal == "1") {//单身期
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[1]);
} else if (selVal == "2") {//家庭形成期(筑巢期)
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[1] + "、" + InsureArry[2]);
} else if (selVal == "3") {//家庭成长期(满巢期)
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[1] + "、" + InsureArry[2] + "、" + InsureArry[3]);
} else if (selVal == "4") {//家庭成熟期(离巢期)
$("#InsureShow").val("意外险" + "、" + "重疾险" + "、" + "养老年金");
} else if (selVal == "5") {//家庭衰老期(空巢期)
$("#InsureShow").val(InsureArry[0] + "、" + InsureArry[5]);
}
}
//已完成规划事件的方案所需投资收益率
var setInsetmentVal = function (PlanId, InsetmentType, ProposalId) {
var ProductSelectDiv = $(PlanId).parent().parent().parent().parent().attr("id");
$.ajax({
url: "/Student/InvestmentPlan/RequestInsetmentVal",
type: "POST",
async: false,
dataType: "json",
data: {
PlanType: InsetmentType,
ProposalId: ProposalId
},
success: function (data) {
if (data != null) {
$("#" + ProductSelectDiv).find("input[eacflag='PlanRate']").val(data.TargetAmount);
} else {
$("#" + ProductSelectDiv).find("input[eacflag='PlanRate']").val("0");
}
}
});
};
//已完成保险规划的预算金额和欠缺额度
var SetInsurancePlanVal = function (PlanId, InsetmentType, ProposalId) {
var ProductSelectDiv = $(PlanId).parent().parent().parent().parent().attr("id");
$.ajax({
url: "/Student/InvestmentPlan/RequestInsetmentVal",
type: "POST",
async: false,
dataType: "json",
data: {
PlanType: InsetmentType,
ProposalId: ProposalId
},
success: function (data) {
if (data != null) {
$("#" + ProductSelectDiv).find("input[eacflag='planLimit']").val(data.planLimit.toMyFixed(2));
$("#" + ProductSelectDiv).find("input[eacflag='planBudget']").val(data.planBudget.toMyFixed(2));
} else {
$("#" + ProductSelectDiv).find("input[eacflag='planLimit']").val("0");
$("#" + ProductSelectDiv).find("input[eacflag='planBudget']").val("0");
}
}
});
}
return {
setPercentValue: setPercentValue,
setPercentValueTwo: setPercentValueTwo,
setInsetmentVal: setInsetmentVal,
SetInsurancePlanVal: SetInsurancePlanVal
}
})();
var FundList2 = new arrayHelper("Id");//基金数据集合
var FundList1 = new arrayHelper("Id");//基金数据临时集合
var P2PList = new arrayHelper("Id");//P2P数据临时集合
var P2PList2 = new arrayHelper("Id");//P2P数据临时集合
var BankList = new arrayHelper("Id");//银行数据集合
var InsuranceList = new arrayHelper("Id");//保险数据集合
var GoldList = new arrayHelper("Id");//黄金数据集合
var OldFundList = new arrayHelper("Id");//基金数据临时集合
var OldP2PList = new arrayHelper("Id");//P2P数据临时集合
var OldBankList = new arrayHelper("Id");//银行数据集合
var OldInsuranceList = new arrayHelper("Id");//保险数据集合
var OldGoldList = new arrayHelper("Id");//黄金数据集合
$(function () {
IsProposalSave()//客户验证
param = $("#hdParam").val();
var sum = 0;
//获取URL参数
ProposalId = $.getUrlParam("ProposalId");
//投资规划信息加载
if (ProposalId != null && ProposalId != "" && ProposalId != undefined) {
//加载
LoadInvestmentPlan(ProposalId);
//进行计算
productIncomeRateVal();
} else {
return false
}
//绑定下拉选择事件(当前客户所处家庭生命周期)
$("#LifeCycleId").unbind("change").change(function () {
var obj = new Object(this);
SetPercentVal.setPercentValue(obj);
//同时要联动有边动态图
productIncomeRateVal();
});
//弹出层OK事件基金产品
$("#popFundTypes .btn-ok").unbind("click").bind("click", function () {
//把临时集合的数据加入到正式集合中
var List = FundList2.GetList();
var Id = 0;
if (List.length >= 1) {
var l = List.length;
var model = List[l - 1];
Id = model.Id + 1;
} else {
Id = 1;
}
var list = FundList1.GetList();
var FundDetail = new Object();
var mon = 0;
$(list).each(function (i, n) {
FundDetail["Id"] = Id;
FundDetail["ProposalId"] = ProposalId;
FundDetail["FundId"] = n.FundId;
FundDetail["FundCode"] = n.FundCode;
FundDetail["FundName"] = n.FundName;
FundDetail["FundType"] = n.FundType;
FundDetail["YearlyEarningsRate"] = n.YearlyEarningsRate;
FundDetail["NAV"] = n.NAV;
FundDetail["InvestmentType"] = n.InvestmentType;
FundDetail["ProductSelectType"] = n.ProductSelectType;
FundDetail["index"] = n.index;
FundDetail["InvestmentPlanProductId"] = $("#guihua_" + $("#FundHidden").val() + "").val();//已选规划
FundDetail["HostingFees"] = n.HostingFees;
FundDetail["InvestmentType"] = $("#InvestmentType").find("option:selected").text();//购买方式
if ($("#InvestmentType").find("option:selected").text() == "一次性购买") {
FundDetail["FundInvestMoney"] = $("#FundgoumaiMoney").val();//购买金额
FundDetail["FundInvestmentAllMoney"] = $("#FundgoumaiMoney").val();//投资总额
var myDate = new Date();
FundDetail["FundDeductMoneyTime"] = myDate.toLocaleDateString();//扣款日期
FundDetail["strFundDeductMoneyTime"] = myDate.toLocaleDateString();
} else {
FundDetail["FundInvestTime"] = $("#FundInvestTime").find("option:selected").text();//定投期间
FundDetail["FundDeductMoneyTime"] = $("#FundDeductMoneyTime").val();//扣款日期
FundDetail["strFundDeductMoneyTime"] = $("#FundDeductMoneyTime").val();//扣款日期
FundDetail["FundInvestMoney"] = Number($("#FundInvestMoney").val());//投资金额
FundDetail["FundInvestDate"] = Number($("#FundInvestDate").val());//投资年限
var money = Number($("#FundInvestMoney").val()) * (Number($("#FundInvestDate").val()) * 12);
FundDetail["FundInvestmentAllMoney"] = money;//投资总额
}
mon = Number(n.FundInvestmentAllMoney * n.NAV).toMyFixed(2);
});
if ($("#InvestmentType").find("option:selected").text() == "一次性购买") {
$("#FundgoumaiMoney").attr("strNumber", mon);
$("#FundgoumaiMoney").addClass("CompareNumber2");
$("#FundgoumaiMoney").attr("minfloat", mon);
$("#FundgoumaiMoney").attr("msgreg", "请输入" + mon + "到999999999.99的数字");
}
//判断文本是否符合要求
if (!VerificationHelper.checkFrom("FundHtml")) {
return;
}
//加入集合
FundList2.Add(FundDetail);
OkClick();
//计算
productIncomeRateVal();
});
//单选框选择事件(基金产品)
$("#popFundTypes").on("click", "input[name=Fund]", function () {
//清除临时集合
FundList1.RemoveAll();
var Fund = new Object();
Fund["Id"] = 0;
Fund["FundId"] = $(this).val();
Fund["FundCode"] = $(this).parents("tr").find("td").eq(1).find("span").html();
Fund["FundName"] = $(this).parents("tr").find("td").eq(2).find("span").html();
Fund["FundType"] = $(this).parents("tr").find("td").eq(3).find("span").html();
Fund["YearlyEarningsRate"] = $(this).parents("tr").find("td").eq(4).find("span").html();
Fund["NAV"] = $(this).parents("tr").find("td").eq(5).find("span").html();
Fund["InvestmentType"] = "一次性购买";
Fund["FundInvestmentAllMoney"] = $(this).parents("tr").find("td").eq(6).find("span").html();
Fund["ProductSelectType"] = $(this).attr("tit");
Fund["index"] = $(this).attr("val");
Fund["HostingFees"] = $(this).attr("fes");
FundList1.Add(Fund);
});
//弹出层取消事件(基金产品)
$("#popFundTypes .btn-cancel").unbind("click").bind("click", function () {
$("#popFundTypes input[type='radio']").each(function () {
$(this).attr("checked", false);
});
//清除临时集合
FundList1.RemoveAll();
dialogHelper.Close("popFundTypes");
});
//搜索按钮(基金产品)
$("#popFundTypes .btnSearch").bind("click", function () {
var keywords = $.trim($("#FundSearch").val());
var type = $.trim($("#FundSelectType").val());
var index = $("#FundHidden").val();
GetList(type, keywords, index);
});
//基金下一步事件
$("#Last").bind("click", function () {
var list = FundList1.GetList();
if (list.length == 0) {
dialogHelper.Error({ content: "至少选择一样产品!" })
return false;
}
$(this).hide();
$("#Next").show();
$("#OK").show();
$("#fund1").hide();
$("#fund2").show();
//居中显示
dialogHelper.Reset("popFundTypes");
});
//基金上一步事件
$("#Next").bind("click", function () {
$(this).hide();
$("#Next").hide();
$("#OK").hide();
$("#Last").show();
$("#fund1").show();
$("#fund2").hide();
//居中显示
dialogHelper.Reset("popFundTypes");
});
//配置产品下拉框选择事件
$("#InvestmentType").change(function () {
dajianhtml2($("#InvestmentType").val());
//居中显示
dialogHelper.Reset("popFundTypes");
});
//弹出层OK事件P2p产品
$("#popPTPType .btn-ok").unbind("click").bind("click", function () {
var mod = $("#popPTPType input[type='radio']:checked");
var ListLength = P2PList2.GetList();
if (ListLength.length > 0) {
var DivId = $(mod).parents("tr").find("td").eq(6).find("div").attr("Id")
if (DivId == undefined && ListLength[0].P2PInvestmentMoney == "") {
if (ListLength[0].P2PInvestmentMoney == null || ListLength[0].P2PInvestmentMoney == "") {
dialogHelper.Error({ content: "请输入符合要求的投资金额!" })
return false;
}
} else if (DivId == undefined && ListLength[0].P2PInvestmentMoney != "") {
if (ListLength[0].qitouMoney < ListLength[0].P2PInvestmentMoney) {
dialogHelper.Error({ content: "输入金额不能小于投资金额!" })
return false;
}
}
else if (DivId != undefined) {
//判断文本是否符合要求
if (!VerificationHelper.checkFrom(DivId)) {
return;
}
}
var bj = $("#popPTPType input[type='radio']:checked");
var money = $(mod).parents("tr").find("td").eq(6).find("input").val();
var List = P2PList.GetList();
var Id = 0;
if (List.length >= 1) {
var l = List.length;
var model = List[l - 1];
Id = model.Id + 1;
} else {
Id = 1;
}
//首先清理一下集合缓存
var obj = new Object();
obj["Id"] = Id;
obj["P2PId"] = $(bj).val();
obj["ProposalId"] = ProposalId;
obj["P2PName"] = $(bj).parents("tr").find("td").eq(1).find("div").html();
obj["InvestmentField"] = $(bj).parents("tr").find("td").eq(2).find("div").html();
obj["InvestmentCycle"] = $(bj).parents("tr").find("td").eq(3).find("div").html();//投资周期
obj["EarningsRate"] = $(bj).parents("tr").find("td").eq(5).find("div").html();
obj["BeginInvestmentMoney"] = $(bj).parents("tr").find("td").eq(4).find("div").html();
obj["P2PInvestmentMoney"] = money;//投资金额
obj["ProductSelectType"] = $("#P2PSelectType").val();;//产品选择类型(基础层/保值层..)
obj["index"] = $("#P2PHidden").val();
obj["InvestmentPlanProductId"] = $("#guihua_" + $("#P2PHidden").val() + "").val();//已选规划
P2PList.Add(obj);
PTPOnclick();
} else {
dialogHelper.Error({ content: "至少选择一样产品!" })
return false;
}
//计算
productIncomeRateVal();
});
//弹出层取消事件P2p产品
$("#popPTPType .btn-cancel").unbind("click").bind("click", function () {
$("#popPTPType input[type='radio']").each(function () {
$(this).attr("checked", false);
});
dialogHelper.Close("popPTPType");
});
//搜索按钮P2p产品
$("#popPTPType .btnSearch").bind("click", function () {
var keywords = $.trim($("#PTPSearch").val());
var type = $("#P2PSelectType").val();
var index = $("#P2PHidden").val();
pTwoProduct("", keywords, type, index);
});
//P2P选中单选事件P2p产品
$("#popPTPType #mianBodyPTP tbody").on("click", ".P2P", function () {
var index = $(this).attr("na");
$("#popPTPType #mianBodyPTP tbody").find("input[name=P2PMoney]").attr("disabled", "disabled").val("");
$("#P2PMoney" + index + "").attr("disabled", false);
//清理掉错误提示
$("#popPTPType #mianBodyPTP tbody").find("input[name=P2PMoney]").siblings("div").remove();
});
//单选框选择事件P2p产品
$("#popPTPType").on("click", "input[name=cz]", function () {
//清除临时集合
P2PList2.RemoveAll();
var obj = new Object();
obj["Id"] = 0;
obj["P2PName"] = $(this).parents("tr").find("td").eq(1).find("div").html();
obj["InvestmentField"] = $(this).parents("tr").find("td").eq(2).find("div").html();
obj["P2PInvestmentMoney"] = $(this).parents("tr").find("td").eq(6).find("input").val();//投资金额
obj["qitouMoney"] = $(this).parents("tr").find("td").eq(4).find("input").html();//投资金额
P2PList2.Add(obj);
});
//弹出层OK事件银行产品
$("#popBank .btn-ok").unbind("click").bind("click", function () {
//判断文本是否符合要求
if (!VerificationHelper.checkFrom("popBank")) {
return;
}
var List = BankList.GetList();
var Id = 0;
if (List.length >= 1) {
var l = List.length;
var model = List[l - 1];
Id = model.Id + 1;
} else {
Id = 1;
}
//获取值
var obj = new Object();
obj["Id"] = Id;
obj["ProposalId"] = ProposalId;
obj["BankName"] = $("#BankName2").find("option:selected").text();
obj["Currency"] = $("#Currency2").find("option:selected").text();
var mod = $("#popBank input[type='radio']:checked");
obj["DepositType"] = $(mod).val();
obj["DepositTime"] = $("#DepositTime1").find("option:selected").text();
obj["YearRate"] = Number($("#BankRate2").html()).toMyFixed(4);
obj["DepositMoney"] = $("#DepositMoney1").val();
obj["ProductSelectType"] = $("#BankSelectType").val(); //产品选择类型(基础层/保值层..)
obj["InvestmentPlanProductId"] = $("#guihua_" + $("#BankHidden").val() + "").val();//已选规划
obj["index"] = $("#BankHidden").val();
obj["Curcd"] = GetCurrency($("#Currency2").find("option:selected").text());
var rate = GetRate($("#Currency2").find("option:selected").text());
obj["NewRate"] = rate;
BankList.Add(obj);
BankOKClick();
//计算
productIncomeRateVal();
});
//银行单选框事件(银行产品)
$("#popBank input[name=radType1]").on("click", function () {
var radType = $(this).val();
if (radType == "活期") {
$("#DepositTime1").attr("disabled", true);
$("#DepositTime1").addClass("disabled");
$("#DepositTime1").html("<option value=\"0\">请选择期限</option>");
$("#DepositTime1").removeClass("IsRequired");
var BankName = $("#BankName2").find("option:selected").text()
var Currency = $("#Currency2").find("option:selected").text();
var DepositType = $("#DepositTime1").val();
JiSuanBankRate(BankName, Currency, DepositType, radType)
} else {
$("#DepositTime1").attr("disabled", false);
//银行存款类型HTML拼接
DepositTypeHTML();
$("#DepositTime1").addClass("IsRequired");
$("#DepositTime1").removeClass("disabled");
$("#BankRate2").html("--");
}
});
//存款币种选择事件(银行产品)
$("#Currency2").change(function () {
//银行存款类型HTML拼接
DepositTypeHTML();
var BankName = $("#BankName2").find("option:selected").text()
var Currency = $("#Currency2").find("option:selected").text();
var DepositType = $("#DepositTime1").val();
var radType = $("#popBank input[type='radio']:checked").val();//定期、活期
JiSuanBankRate(BankName, Currency, DepositType, radType)
});
//银行下拉框事件(银行产品)
$("#BankName2").change(function () {
var valu = $("#BankName2").val();
var html = '<option value="0">请选择</option>';
if (valu != 0) {
var model = CurrencyList[valu - 1];
var list = model.Profession;
$(list).each(function (i, n) {
html += '<option value="' + n.Id + '">' + n.Name + '</option>';
});
$("#Currency2").html(html);
} else {
$("#Currency2").html(html);
$("#DepositTime1").html(html);
}
$("#BankRate2").html("--");
});
//存款类型下拉框事件(银行产品)
$("#DepositTime1").change(function () {
var BankName = $("#BankName2").find("option:selected").text()
var Currency = $("#Currency2").find("option:selected").text();
var DepositType = $("#DepositTime1").val();
var radType = $("#popBank input[type='radio']:checked").val();//定期、活期
JiSuanBankRate(BankName, Currency, DepositType, radType)
});
//保险产品类别选择事件(保险产品)
$("#InsuranceType2").change(function () {
var valu = $("#InsuranceType2").val();
if (valu != 0) {
var model = InsuranceTypeList[valu - 1];
var typeList = model.Profession;
var html = '<option value="0">请选择</option>';
$(typeList).each(function (i, n) {
html += '<option value="' + n.Id + '">' + n.Name + '</option>';
});
$("#InsuranceType").html(html);//产品类型
$("#ProductName,#InsuranceMoney,#ContinueTime,#PayType").html('<option value="0">请选择</option>');//产品类型
} else {
$("#InsuranceType,#ProductName,#InsuranceMoney,#ContinueTime,#PayType").html('<option value="0">请选择</option>');//产品类型
}
});
$("#InsuranceType").change(function () {
var valu = $("#InsuranceType2").val();
var valu2 = $("#InsuranceType").val();
if (valu != 0) {
var model = InsuranceTypeList[valu - 1];
var typeList = model.Profession[valu2 - 1].Value;
var html = '<option value="0">请选择</option>';
$(typeList).each(function (i, n) {
html += '<option value="' + n.Id + '">' + n.Name + '</option>';
});
$("#ProductName").html(html);//产品名称
$("#InsuranceMoney,#ContinueTime,#PayType").html('<option value="0">请选择</option>');//产品名称
} else {
$("#ProductName,#InsuranceMoney,#ContinueTime,#PayType").html('<option value="0">请选择</option>');//产品名称
}
});
//产品名称选择事件(保险产品)
$("#ProductName").change(function () {
var ParentId = $("#ProductName").val();
if (ParentId != 0) {
//处理两个特殊产品
if (ParentId == 37 || ParentId == 38) {
var strr = '';
if (ParentId == 37) {
//友诚优裕投资连结计划
strr += ' <input class="ipt-text IsRequired IsNumber IsMaxNumber IsMinNumber" MaxNumber="10000000" MinNumber="24000" msgname="保险费" placeholder="请输入保险费 (元)" type="text" style="width:49%;" id="baofeiId" oldvalue="">';
} else {
strr += ' <input class="ipt-text IsRequired IsNumber IsMaxNumber IsMinNumber IsNumberby100" MaxNumber="10000000" MinNumber="1000" msgname="保险费" placeholder="请输入保险费 (元)" type="text" style="width:49%;" id="baofeiId" oldvalue="">';
}
$("#addHtml").html(strr);
strr2 = '<i class="c-red">*</i>年缴保费:';
$("#addHtml2").html(strr2);
}
else {
var strr = ' ';
strr += ' <select id="InsuranceMoney" class="IsRequired" msgname="保险金额" oldvalue="">';
strr += ' <option value="0">请选择</option>';
strr += ' </select>';
$("#addHtml").html(strr);
strr2 = '<i class="c-red">*</i>保险金额:';
$("#addHtml2").html(strr2);
//保险金额
var list = CostList;
var html = '<option value="0">请选择</option>';
$(list).each(function (i, n) {
if (n.Id == ParentId) {
$(n.Profession).each(function (a, b) {
html += '<option name="' + b.Id + '" value="' + b.Value + '">' + b.Name + '</option>';
});
return;
}
});
$("#InsuranceMoney").html("");
$("#InsuranceMoney").append(html);
}
//保险期间
var list2 = PeriodList;
var html2 = '<option value="0">请选择</option>';
$(list2).each(function (i, n2) {
if (n2.Id == ParentId) {
$(n2.Profession).each(function (a, b2) {
html2 += '<option name="' + b2.Id + '" value="' + b2.Value + '">' + b2.Name + '</option>';
});
return;
}
});
//保险金额
$("#InsuranceMoney").html("");
$("#InsuranceMoney").append(html);
//保险期间
$("#ContinueTime").html("");
$("#ContinueTime").append(html2);
//缴费方式清空
$("#PayType").html('<option value="0">请选择</option>');
} else {
$("#InsuranceMoney,#ContinueTime,#PayType").html('<option value="0">请选择</option>');
}
});
//保险期间选择事件(保险产品)
$("#ContinueTime").change(function () {
var ParentId = $("#ContinueTime").find("option:selected").attr("name");
if (ParentId != 0) {
var list = ChargeWayList;
var html = '<option value="0">请选择</option>';
$(list).each(function (i, n) {
if (n.Id == Number(ParentId)) {
$(n.Profession).each(function (a, b) {
html += '<option name="' + b.Name + '" value="' + b.Id + '" vals="' + b.Value + '">' + b.Name + '</option>';
});
}
});
//缴费方式
$("#PayType").html(html);
} else {
$("#PayType").html('<option value="0">请选择</option>');
}
});
//弹出层OK事件保险产品
$("#InsuranceCheck .btn-ok").unbind("click").bind("click", function () {
//页面字段检测
if (!VerificationHelper.checkFrom("InsuranceCheck")) {
return;
}
//var ProductName = $("#ProductName").find("option:selected").text()
var InsuranceMoney = 0;
//var BaoFei = 0;
//if (ProductName != "友诚优裕投资连结计划" && ProductName != "聚财宝两全保险(万能型)") {
//InsuranceMoney = $("#InsuranceMoney").find("option:selected").val();//保险金额
var ProductId = $("#ProductName").val();
if (ProductId == 37 || ProductId == 38) {
InsuranceMoney = $("#baofeiId").val();
} else {
InsuranceMoney = $("#InsuranceMoney").val();
}
var PayType = $("#PayType").val();
var Sex = $("#Sex").val()
var Age = $("#Age").val()
var fee = InquiryRate(ProductId, InsuranceMoney, PayType, Sex, Age);
if (fee == 0) {
//dialogHelper.Error({ content: "您选择的产品不符合要求,请重新选择!" })
return;
}
if (ProductId == 37 || ProductId == 38) {
var _temp = InsuranceMoney;
InsuranceMoney = fee;
fee = _temp;
}
//var InsuranceMoney2 = $("#InsuranceMoney").find("option:selected").val();//保险金额
//var times = Scale(InsuranceMoney2, ProductName)
//BaoFei = fee;
//} else {
// BaoFei = $("#baofeiId").val();
// var ProductId = $("#ProductName").val();//产品Id
// if (ProductName == "友诚优裕投资连结计划") {
// if ($("#Age").val() >= 18 && $("#Age").val() <= 69) {
// var Continue = $("#ContinueTime").val();//保险期间
// InsuranceMoney = CountBaoEr(Continue, BaoFei, ProductId);
// } else {
// dialogHelper.Error({ content: "您选择的产品不符合要求,请重新选择!" })
// return;
// }
// } else if (ProductName == "聚财宝两全保险(万能型)") {
// if ($("#Age").val() >= 0 && $("#Age").val() <= 80) {
// var Continue = $("#ContinueTime").val();//保险期间
// var Pay = $("#PayType").find("option:selected").attr("vals");
// if (Pay == "趸交") {
// Pay = 1;
// }
// InsuranceMoney = CountBaoEr(Pay, BaoFei, ProductId);
// } else {
// dialogHelper.Error({ content: "您选择的产品不符合要求,请重新选择!" })
// return;
// }
// }
//}
var List = InsuranceList.GetList();
var Id = 0;
if (List.length >= 1) {
var l = List.length;
var model = List[l - 1];
Id = model.Id + 1;
} else {
Id = 1;
}
var obj = new Object();
obj["Id"] = Id;
obj["ProposalId"] = ProposalId;
obj["InsuranceType1"] = $("#InsuranceType2").find("option:selected").text();
obj["InsuranceType2"] = $("#InsuranceType").find("option:selected").text();
obj["InsuranceName"] = $("#ProductName").find("option:selected").text();
obj["InsuranceMoney"] = InsuranceMoney;
obj["InsuranceTime"] = $("#ContinueTime").find("option:selected").text();
obj["ChargeType"] = $("#PayType").find("option:selected").text();
obj["Theinsured"] = $("#Theinsured").val();
obj["Sex"] = $("#Sex").val();
obj["Age"] = $("#Age").val();
obj["AnnualPremium"] = (fee);
obj["ProductSelectType"] = $("#InsuranceSelectType").val();
obj["index"] = $("#InsuranceHidden").val();
obj["InvestmentPlanProductId"] = $("#guihua_" + $("#InsuranceHidden").val() + "").val();//已选规划
InsuranceList.Add(obj);
InsuranceOKClick();
//计算
productIncomeRateVal();
})
//弹出层取消事件(保险产品)
$("#InsuranceCheck .btn-cancel").unbind("click").bind("click", function () {
dialogHelper.Close("InsuranceCheck");
});
//下一步事件
$("#Nextbtns").unbind("click").bind("click", function () {
//页面字段检测
if (!VerificationHelper.checkFrom("Insurance_1")) {
return;
}
//显示隐藏
$("#Insurance_1").hide();
$("#Insurance_2").show();
$("#Lastbtns").show();
$("#btns").show();
$("#Nextbtns").hide();
//居中显示
dialogHelper.Reset("InsuranceCheck");
})
//上一步事件
$("#Lastbtns").unbind("click").bind("click", function () {
//显示隐藏
$("#Insurance_1").show();
$("#Insurance_2").hide();
$("#Lastbtns").hide();
$("#btns").hide();
$("#Nextbtns").show();
//居中显示
dialogHelper.Reset("InsuranceCheck");
})
//弹出层OK事件黄金产品
$("#popGold .btn-ok").unbind("click").bind("click", function () {
//判断文本是否符合要求
if (!VerificationHelper.checkFrom("popGold")) {
return;
}
var List = GoldList.GetList();
var Id = 0;
if (List.length >= 1) {
var l = List.length;
var model = List[l - 1];
Id = model.Id + 1;
} else {
Id = 1;
}
//获取值
var obj = new Object();
obj["Id"] = Id;
obj["ProposalId"] = ProposalId;
obj["GoldBuyType"] = $("#GoldBuyType").find("option:selected").text();//黄金购买方式
if ($("#GoldBuyType").find("option:selected").text() == "单笔购买") {
obj["GoldInvestMoney"] = $("#goumaiMoney").val();//购买金额
var myDate = new Date();
obj["GoldDeductMoneyTime"] = myDate.toLocaleDateString();//黄金扣款日期
obj["strGoldDeductMoneyTime"] = myDate.toLocaleDateString();//黄金扣款日期
} else {
obj["GoldInvestTime"] = $("#GoldInvestTime").find("option:selected").text();//黄金定投期间
obj["GoldDeductMoneyTime"] = $("#GoldDeductMoneyTime").val();//黄金扣款日期
obj["strGoldDeductMoneyTime"] = $("#GoldDeductMoneyTime").val();//黄金扣款日期
obj["GoldInvestMoney"] = $("#GoldInvestMoney").val();//黄金投资金额
obj["GoldInvestDate"] = $("#GoldInvestDate").val();//黄金投资年限
}
obj["ProductSelectType"] = $("#GoldSelectType").val(); //产品选择类型(基础层/保值层..)
obj["InvestmentPlanProductId"] = $("#guihua_" + $("#GoldHidden").val() + "").val();//已选规划
obj["index"] = $("#GoldHidden").val();
obj["NearAnnualYield"] = GetGoldRate();
GoldList.Add(obj);
GoldOnclick();
//计算
productIncomeRateVal();
});
//弹出层取消事件(黄金产品)
$("#popGold .btn-cancel").unbind("click").bind("click", function () {
dialogHelper.Close("popGold");
});
//下拉框选择事件
$("#GoldBuyType").change(function () {
dajianhtml($("#GoldBuyType").val());
//居中显示
dialogHelper.Reset("popGold");
});
//点击新增产品选择区域
$("#Add").unbind("click").bind("click", function () {
var num = $("div[eacflag='ProductSelect']").size();
if (num == 0) {
AddList(num);
} else {
var mo = $("div[eacflag='ProductSelect']")[num - 1];
var DivId = $(mo).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
if (num < 8) {
AddList(ind);
} else {
dialogHelper.Error({ content: "产品组合最多添加8个" });
}
}
});
//规划目标选择事件
$("body").on("change", ".guihua", function () {
var type = $(this).val();
var id = $(this).attr("id");
var Num = id.split('_');
PlanTarget(type, Num[1]);
var InsetmentType = $(this).val();//获得值
var obj = new Object(this);
if (InsetmentType == 5) {
SetPercentVal.SetInsurancePlanVal(obj, InsetmentType, ProposalId);
} else {
SetPercentVal.setInsetmentVal(obj, InsetmentType, ProposalId);
}
var mysel = $(this);
var oldvalue = mysel.data("last");//这次改变之前的值
mysel.data("last", mysel.val()); //每次改变都附加上去,以便下次变化时获取
var newvalue = mysel.val(); //当前选中值
//改变规划目标修改集合数据
UpdateGuiHua(oldvalue, newvalue, Num[1]);
//计算
productIncomeRateVal();
});
//定投配置弹框OK事件
$("#popMonthCast .btn-ok").unbind("click").bind("click", function () {
//后关闭
dialogHelper.Close("popMonthCast");
});
//保存
$("#btnSave").bind("click", function () {
SaveProductPlan();
});
//下一步事件
$("#btnNext").unbind("click").bind("click", function () {
SaveProductPlan(0);
if (TagNavi) {
window.location.href = "/Student/TaxPlan/index" + param;
}
});
//移出事件
$("#HoldRate,#IncreaseRate,#SpeculationRate").unbind("blur").blur(function () {
var HoldRate = $.trim($("#HoldRate").val());
var IncreaseRate = $.trim($("#IncreaseRate").val());
var SpeculationRate = $.trim($("#SpeculationRate").val());
var ckinputId = $(this).attr("id");
if (HoldRate != "" && IncreaseRate != "" && SpeculationRate != "") {
//页面字段检测
if (!VerificationHelper.checkFrom("headInvestment",
function () {
sum = CalcPerCent(HoldRate, IncreaseRate, SpeculationRate);
if (sum * 1 != 100) {
showValidateMsg(ckinputId, "保值层,增值层,投机层之和必须为百分之百");
};
})) {
return;
}
//同时还要加个*号 ////HedgeDiv 保值层 AddStar 增值层 SpeculateDiv 投机层
if (HoldRate > 0) {
AddStarSpan("HedgeDiv", "保值层");
} else {
//去除星号
ClearStarSpan("HedgeDiv", "保值层");
}
if (IncreaseRate > 0) {
AddStarSpan("AddStar", "增值层");
} else {
//去除星号
ClearStarSpan("AddStar", "增值层");
}
if (SpeculationRate > 0) {
AddStarSpan("SpeculateDiv", "投机层");
} else {
//去除星号
ClearStarSpan("SpeculateDiv", "投机层");
}
//运算结果正常的话就执行
ShowPieInfo(HoldRate * 1, IncreaseRate * 1, SpeculationRate * 1);
//然后开始计算
productIncomeRateVal();
}
});
//保存原值
SaveDefaultValueCommon("FinanceInvestmentPlanDiv");
});
//投资规划信息加载
function LoadInvestmentPlan(ProposalId) {
$.ajax({
url: "/Student/InvestmentPlan/LoadInvestmentPlan",
type: "POST",
async: false,
dataType: "json",
data: {
ProposalId: ProposalId
},
success: function (data) {
if (data != null) {
var obj = new Object(data);
analysisData(obj);
} else {
AddList(0);
}
},
error: function (data) {
alert("异常错误!");
}
});
};
//分解data数据
function analysisData(data) {
$(data).each(function (a, b) {
var InvestmentPlanProductList = b.InvestmentPlanProductList;
var Id = b.Id;
var LifeCycleId = b.LifeCycleId;
var HoldRate = b.HoldRate * 1;
var IncreaseRate = b.IncreaseRate * 1;
var SpeculationRate = b.SpeculationRate * 1;
var Analysis = b.Analysis;
$("#InvestmentPlanId").val(Id);
$("#LifeCycleId").val(LifeCycleId);
$("#HoldRate").val(HoldRate);
$("#IncreaseRate").val(IncreaseRate);
$("#SpeculationRate").val(SpeculationRate);
$("#Analysis").val(Analysis);
//赋值饼状图
ShowPieInfo(HoldRate, IncreaseRate, SpeculationRate)
if (data.InsureShow == null || data.InsureShow == "") {
//同时还要给隔壁的对象赋值
SetPercentVal.setPercentValueTwo(LifeCycleId);
} else {
$("#InsureShow").val(data.InsureShow);
}
if (InvestmentPlanProductList != null && InvestmentPlanProductList.length > 0) {
$(InvestmentPlanProductList).each(function (index, dom) {
$(dom.FundList).each(function (c, d) {
if (d.FundDeductMoneyTime.indexOf("Date")) {
d.FundDeductMoneyTime = d.strFundDeductMoneyTime;
}
FundList2.Add(d);
OldFundList.Add(d);
});
$(dom.P2PList).each(function (a, b) {
P2PList.Add(b);
OldP2PList.Add(b);
});
$(dom.BankList).each(function (e, f) {
BankList.Add(f);
OldBankList.Add(f);
});
$(dom.InsuranceList).each(function (g, h) {
InsuranceList.Add(h);
OldInsuranceList.Add(h);
});
$(dom.GoldList).each(function (i, j) {
if (j.GoldDeductMoneyTime.indexOf("Date")) {
var ticks = j.GoldDeductMoneyTime.replace("/Date(", "").replace(")/", "");
var date = new Date(parseInt(ticks));
j.GoldDeductMoneyTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
}
GoldList.Add(j);
OldGoldList.Add(j);
});
AddList2(dom.index, dom);
$("#guihua_" + (dom.index) + "").val(dom.PlanId);
if (dom.PlanId == 5) {
$("#planLimit_" + (dom.index) + "").val(dom.PlanLimit);
$("#planBudget_" + (dom.index) + "").val(dom.PlanBudget);
$("#productInsured_" + (dom.index) + "").val(dom.ProductInsured);
$("#productPremium_" + (dom.index) + "").val(dom.ProductPremium);
} else {
$("#investRate_" + (dom.index) + "").val(dom.PlanRate);
$("#productRate_" + (dom.index) + "").val(dom.ProductRate);
$("#productMoney_" + (dom.index) + "").val(dom.ProductMoney);
}
});
CreateHtml1();
CreateHtml2();
CreateHtml3();
CreateHtml4();
CreateHtml5();
}
});
}
//弹出基金列表
function PupCashFund(str, index) {
//隐藏按钮
$("#Last").show();
$("#Next").hide();
$("#OK").hide();
$("#fund1").show();
$("#fund2").hide();
//清空文本框
$("#popFundTypes").find("select").val("0");
$("#popFundTypes").find("input[type=text]").val("");
//清除临时集合
FundList1.RemoveAll();
//先可以获得对对象的值
GetList(str, "", index);
dialogHelper.Show("popFundTypes", 800);
dajianhtml2(0);
}
//获得基金产品
function GetList(Type, keyword, index) {
var code = "";
var pageindex = 0;
var pageSize = 10;
if (typeof keyword == "undefined") {
keyword = "";
}
var url = "/Student/FundProduct/GetFundProductList";
keyword = keyword.replace(/[<>&"]/g, function (c) { return { '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;', '"': '&quot;', "'": '&prime;', "'": '&prime;' }[c]; }),//搜索关键字
$("#FundHidden").val(index);
$("#FundSelectType").val(Type);
pageHelper.Init({
url: url,
type: "POST",
pageDiv: "#pageDiv",
data:
{
keywords: keyword,
pageindex: 1,
pageSize: 10
},
bind: function (data) {
var html = "";
if (data.Data.length > 0) {
$(data.Data).each(function (i, dom) {
//每行html
var trHtml = "";
trHtml += "<tr value=\"{0}\">";
var code = "";
var li = FundList1.GetList();
$(li).each(function (a, b) {
if (b.FundCode == dom.FundCode) {
code = dom.FundCode;
}
});
if (code == dom.FundCode) {
trHtml += "<td name=\"dataNo\"><input name=\"Fund\" checked='checked' type=\"radio\" value=\"{0}\" tit=\"" + Type + "\" val=\"" + index + "\" fes=\"" + dom.HostingFees + "\"></td>";
} else {
trHtml += "<td name=\"dataNo\"><input name=\"Fund\" type=\"radio\" value=\"{0}\" tit=\"" + Type + "\" val=\"" + index + "\" fes=\"" + dom.HostingFees + "\"></td>";
}
trHtml += "<td><span title=\"{1}\">{1}</span></td>";
trHtml += "<td class=\"ellipsis\"><span title=\"{2}\">{2}</span></td>";
trHtml += "<td><span title=\"{3}\">{3}</span></td>";
trHtml += "<td><span title=\"{4}\">{4}</span>%</td>";
trHtml += "<td><span title=\"{5}\">{5}</span></td>";
trHtml += "<td><span title=\"{6}\">{6}</span></td>";
trHtml += "</tr>";
//拼接tbody
html += StringHelper.FormatStr(trHtml,
dom.FundId, //0 基金id
dom.FundCode, //1 代码编号
dom.FundName, //2 基金名称
dom.FundType, //3 基金类型
//4 年收益率
dom.FundType.indexOf("货币") > -1 ? dom.YearlyEarningsRate.toMyFixed(2) : (dom.YearlyEarningsRate * 100).toMyFixed(2),
dom.NewNetValue == null ? "--" : dom.NewNetValue,
dom.PurchaseShares
);
});
} else {
html = "<tr><td colspan='7'>未找到相关记录!</td>";
}
$("#popFundTypes #mianBody tbody").html(html);
dialogHelper.Reset("popFundTypes");
}
});
};
//基金产品选择点击OK时
function OkClick() {
var html = ' <h4>基金产品</h4>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="6%" scope="col">代码</th>';
html += '<th width="11%" scope="col">产品名称</th>';
html += '<th width="10%" scope="col">基金类型</th>';
html += '<th width="11%" scope="col">近一年收益率</th>';
html += '<th width="13%" scope="col">最新净值(元)</th>';
html += '<th width="9%" scope="col">投资方式</th>';
html += '<th width="13%" scope="col">投资总额(元)</th>';
html += '<th width="5%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
var list = FundList2.GetList();
var index = $("#FundHidden").val();//这个表示属于第几个产品选择
var SelectType = $("#FundSelectType").val();//这个是选择的哪个层
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td>' + n.FundCode + '</td>';
html += '<td><div class="ellipsis" title="' + n.FundName + '">' + n.FundName + '</div></td>';
html += '<td>' + n.FundType + '</td>';
html += '<td>' + n.YearlyEarningsRate + '%</td>';
html += '<td>' + Number(n.NAV).toMyFixed(4) + '</td>';
if (n.InvestmentType == "定期定额投资") {
html += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',1)" >按月定投</a></div></td>';
} else {
html += '<td><div class="ellipsis" >一次性购买</div></td>';
}
html += ' <td>' + Number(n.FundInvestmentAllMoney).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="FundDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
if (SelectType == 1) {
$("#jichujijin_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhijijin_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhijijin_" + index + "").html(html);
} else {
$("#toujijijin_" + index + "").html(html);
}
//先清空收索框
$("#popFundTypes #FundSearch").val("");
//后关闭
dialogHelper.Close("popFundTypes");
}
//基金删除操作
function FundDelete(Id, SelectType, index, th) {
FundList2.Remove(Id);
var list = FundList2.GetList();
var html = '';
var len = $(th).parent().parent().siblings();
if (len.length != 0) {
html += ' <h4>基金产品</h4>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="6%" scope="col">代码</th>';
html += '<th width="11%" scope="col">产品名称</th>';
html += '<th width="10%" scope="col">基金类型</th>';
html += '<th width="11%" scope="col">近一年收益率</th>';
html += '<th width="13%" scope="col">最新净值(元)</th>';
html += '<th width="9%" scope="col">投资方式</th>';
html += '<th width="13%" scope="col">投资总额(元)</th>';
html += '<th width="5%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td>' + n.FundCode + '</td>';
html += '<td><div class="ellipsis" title="' + n.FundName + '">' + n.FundName + '</div></td>';
html += '<td>' + n.FundType + '</td>';
html += '<td>' + n.YearlyEarningsRate + '%</td>';
html += '<td>' + Number(n.NAV).toMyFixed(4) + '</td>';
if (n.InvestmentType == "定期定额投资") {
html += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',1)" >按月定投</a></div></td>';
} else {
html += '<td><div class="ellipsis" >一次性购买</div></td>';
}
html += ' <td>' + Number(n.FundInvestmentAllMoney).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="FundDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (SelectType == 1) {
$("#jichujijin_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhijijin_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhijijin_" + index + "").html(html);
} else {
$("#toujijijin_" + index + "").html(html);
}
//计算
productIncomeRateVal();
}
//搭建HTML
function dajianhtml2(strType) {
//界面拼装
var html = '';
if (strType == "1") {
html += ' <div class="fif-box w100">';
html += ' <label class="fif-text"><i class="c-red">*</i>定期间隔:</label>';
html += ' <div class="input">';
html += '<select id="FundInvestTime" style=" width: 20%;" class="" msgname="定期间隔">';
html += ' <option value="0">每月</option>';
html += ' </select>';
html += '</div>';
html += ' </div>';
html += ' <div class="fif-box w100">';
html += '<label class="fif-text"><i class="c-red">*</i>初次扣款日:</label>';
html += '<div class="input">';
html += ' <input class="ipt-text Wdate IsRequired" msgname="初次扣款日" style="width:60%" id="FundDeductMoneyTime" type="text" onfocus="WdatePicker({ dateFmt: \'yyyy/MM/dd \', readOnly: true })">';
html += ' </div>';
html += ' </div>';
html += '<div class="fif-box w100">';
html += '<label class="fif-text"><i class="c-red">*</i>每期金额:</label>';
html += '<div class="input"><input class="ipt-text IsRequired IsMaxFloat IsMinFloat IsReg" minfloat="0.00" msgname="每期金额" msgreg="请输入0.00到999999999.99的数字" reg="\\d{0,9}\\.*\\d{0,2}" maxfloat="999999999.99" type="text" id="FundInvestMoney" style="width:50%"> 元</div>';
html += ' </div>';
html += ' <div class="fif-box w100">';
html += ' <label class="fif-text"><i class="c-red">*</i>投资年限:</label>';
html += '<div class="input"> ';
html += '<input class="ipt-text IsRequired IsNumber IsMaxNumber IsMinNumber" msgname="投资年限" maxnumber="100" minnumber="1" type="text" id="FundInvestDate" style="width: 50%"> 年';
html += ' </div>';
html += '</div>';
} else {
html += '<div class="fif-box w100">';
html += ' <label class="fif-text"><i class="c-red">*</i>申购金额:</label>';
html += ' <div class="input">';
html += " <input class=\"ipt-text IsRequired IsMaxFloat IsMinFloat IsReg\" minfloat=\"0.00\" msgname=\"申购金额\" msgreg=\"请输入0.00到999999999.99的数字\" reg='\\d{0,9}\\.*\\d{0,2}' maxfloat=\"999999999.99\" type=\"text\" id=\"FundgoumaiMoney\" style=\"width:60%\"> 元";
html += ' </div>';
html += ' </div>';
}
$("#FundHtml").html(html);
}
//弹出银行产品
function PupBank(str, index) {
//清空文本内容
$("#popBank").find("input[type=text]").val("");
$("#popBank").find("select").val("0");
$("#DepositType1").html("<option value=\"0\">请选择</option>");
$("#BankRate2").html("--");
$("#Currency2").html("<option value=\"0\">请选择</option>");
$("#DepositTime1").attr("disabled", true);
$("#DepositTime1").addClass("disabled");
$("#DepositTime1").html("<option value=\"0\">请选择期限</option>");
$("#DepositTime1").removeClass("IsRequired");
$("#radio1").attr("checked", true);
$("#radio2").attr("checked", false);
$("#BankHidden").val(index);
$("#BankSelectType").val(str);
//获取各银行下拉框
var typeList = CurrencyList;
var html = '<option value="0">请选择</option>';
$(typeList).each(function (i, n) {
html += '<option value="' + n.Id + '">' + n.Name + '</option>';
});
$("#BankName2").html(html);//
dialogHelper.Show("popBank", 500);
}
//银行存款类型HTML拼接
function DepositTypeHTML() {
var str = $("#Currency2").find("option:selected").text();
var str2 = $("#BankName2").find("option:selected").text();
var html = "";
if (str == "人民币") {
html += '<option value="0">请选择期限</option>';
html += '<option value="1">三个月</option>';
html += '<option value="2">半年</option>';
html += '<option value="3">一年</option>';
html += '<option value="4">二年</option>';
html += '<option value="5">三年</option>';
html += '<option value="6">五年</option>';
} else if (str == "请选择") {
html += '<option value="0">请选择期限</option>';
} else {
html += '<option value="0">请选择期限</option>';
html += '<option value="1">三个月</option>';
html += '<option value="2">半年</option>';
html += '<option value="3">一年</option>';
html += '<option value="4">二年</option>';
}
if (str2 == "渤海银行" && str != "人民币") {
html = "";
html += '<option value="0">请选择期限</option>';
html += '<option value="7">一个月</option>';
html += '<option value="1">三个月</option>';
html += '<option value="2">半年</option>';
html += '<option value="3">一年</option>';
}
$("#DepositTime1").html(html);
}
//银行利率计算
function JiSuanBankRate(BankName, Currency, DepositType, radType) {
//确保所有参数都有的情况下获取数据
$.ajax({
url: "/Student/InvestmentPlan/GetBankDeposits",
type: "POST",
async: false,
dataType: "json",
data: {
BankName: BankName,
Currency: Currency,
DepositType: DepositType,
radType: radType
},
success: function (data) {
//获得整个银行 活期定期的汇率
if (data != null) {
if (data == 0) {
$("#BankRate2").html("--");
} else {
$("#BankRate2").html(data.toMyFixed(4));
}
}
}
});
}
//银行产品点击OK时
function BankOKClick() {
var html = ' <h4>银行产品</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="14%" scope="col">银行名称</th>';
html += '<th width="9%" scope="col">存款币种</th>';
html += '<th width="9%" scope="col">存款类型</th>';
html += '<th width="9%" scope="col">存期</th>';
html += ' <th width="15%" scope="col">年利率(%</th>';
html += ' <th width="13%" scope="col">存款金额</th>';
html += '<th width="6%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
var list = BankList.GetList();
var index = $("#BankHidden").val();//这个表示属于第几个产品选择
var SelectType = $("#BankSelectType").val();//这个是选择的哪个层
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td><div class="ellipsis" title="' + n.BankName + '">' + n.BankName + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.Currency + '">' + n.Currency + '</div></td>';
html += '<td>' + n.DepositType + '</td>';
if (n.DepositType == "活期") {
html += '<td>--</td>';
} else {
html += '<td>' + n.DepositTime + '</td>';
}
html += '<td>' + Number(n.YearRate).toMyFixed(4) + '</td>';
html += '<td>' + Number(n.DepositMoney).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="BankDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
if (SelectType == 1) {
$("#jichubank_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhibank_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhibank_" + index + "").html(html);
} else {
$("#toujibank_" + index + "").html(html);
}
//后关闭
dialogHelper.Close("popBank");
//然后开始计算
//productIncomeRateVal();
}
//银行删除操作
function BankDelete(Id, SelectType, index, th) {
BankList.Remove(Id);
var list = BankList.GetList();
var html = '';
var len = $(th).parent().parent().siblings();
if (len.length != 0) {
html += ' <h4>银行产品</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="14%" scope="col">银行名称</th>';
html += '<th width="9%" scope="col">存款币种</th>';
html += '<th width="9%" scope="col">存款类型</th>';
html += '<th width="9%" scope="col">存期</th>';
html += ' <th width="15%" scope="col">年利率(%</th>';
html += ' <th width="13%" scope="col">存款金额</th>';
html += '<th width="6%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td><div class="ellipsis" title="' + n.BankName + '">' + n.BankName + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.Currency + '">' + n.Currency + '</div></td>';
html += '<td>' + n.DepositType + '</td>';
if (n.DepositType == "活期") {
html += '<td>--</td>';
} else {
html += '<td>' + n.DepositTime + '</td>';
}
html += '<td>' + Number(n.YearRate).toMyFixed(4) + '</td>';
html += '<td>' + Number(n.DepositMoney).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="BankDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (SelectType == 1) {
$("#jichubank_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhibank_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhibank_" + index + "").html(html);
} else {
$("#toujibank_" + index + "").html(html);
}
//计算
productIncomeRateVal();
}
//弹出p2p产品
function PupPTwoProduct(str, index) {
//清除临时集合
P2PList2.RemoveAll();
pTwoProduct("", "", str, index);
dialogHelper.Show("popPTPType", 870);
}
//获得P2P产品
function pTwoProduct(TypeId, keyword, Type, index) {
var code = "";
var pageindex = 0;
var pageSize = 10;
if (typeof keyword == "undefined") {
keyword = "";
}
$("#P2PHidden").val(index);
$("#P2PSelectType").val(Type);
pageHelper.Init({
url: "/Student/P2PProducet/GetP2PProduceList",
type: "POST",
pageDiv: "#pageDivPTP",
data:
{
FundType: TypeId,
keywords: keyword,
pageindex: 1,
pageSize: 10
},
bind: function (data) {
var html = "";
if (data.Data.length > 0) {
$(data.Data).each(function (i, dom) {
//每行html
var trHtml = "";
trHtml += "<tr value=\"{0}\">";
var code = "";
var li = P2PList2.GetList();
$(li).each(function (a, b) {
if (b.P2PName == dom.P2PName) {
code = dom.P2PName;
}
});
if (code == dom.P2PName) {
trHtml += "<td name=\"dataNo\"><input name=\"cz\"checked='checked' class=\"P2P\" tit=\"" + Type + "\" na=\"" + (i + 1) + "\" val=\"" + index + "\" type=\"radio\" value=\"{0}\"></td>";
} else {
trHtml += "<td name=\"dataNo\"><input name=\"cz\" class=\"P2P\" tit=\"" + Type + "\" na=\"" + (i + 1) + "\" val=\"" + index + "\" type=\"radio\" value=\"{0}\"></td>";
}
trHtml += "<td><div class=\"ellipsis\" title=\"{1}\">{1}</div></td>";
trHtml += "<td><div class=\"ellipsis\" title=\"{2}\">{2}</div></td>";
trHtml += "<td><div class=\"ellipsis\" title=\"{3}\">{3}</div></td>";
trHtml += "<td><div class=\"ellipsis\" title=\"{4}\">{4}</div></td>";
trHtml += "<td><div class=\"ellipsis\" title=\"{5}\">{5}</div></td>";
if (code == dom.P2PName) {
trHtml += "<td><div class=\"input\" id=\"P2P_" + (i + 1) + "\"><input class=\"ipt-text IsRequired IsMaxFloat IsMinFloat IsReg \" onblur=\"OnFucsP2P(this)\" minfloat=\"{4}\" msgreg=\"请输入{4}到999999999.99的数字\" reg=\"\\d{0,9}\\.*\\d{0,2}\" maxfloat=\"999999999.99\" strNumber=\"{4}\" msgname=\"投资金额\" name=\"P2PMoney\" type=\"text\" style='width:100px;' id=\"P2PMoney" + (i + 1) + "\"></div></td>";
} else {
trHtml += "<td><div class=\"input\" id=\"P2P_" + (i + 1) + "\"><input class=\"ipt-text IsRequired IsMaxFloat IsMinFloat IsReg \" onblur=\"OnFucsP2P(this)\" minfloat=\"{4}\" msgreg=\"请输入{4}到999999999.99的数字\" reg=\"\\d{0,9}\\.*\\d{0,2}\" maxfloat=\"999999999.99\" strNumber=\"{4}\" msgname=\"投资金额\" name=\"P2PMoney\" disabled=\"disabled\" type=\"text\" style='width:100px;' id=\"P2PMoney" + (i + 1) + "\"></div></td>";
}
trHtml += "</tr>";
//拼接tbody
html += StringHelper.FormatStr(trHtml,
dom.Id,
dom.P2PName, //产品名称
dom.InvestmentField, //投资领域
dom.InvestmentCycle, //投资周期
dom.StartAmount, //起投金额
dom.EarningsRate //预期收益率
);
});
} else {
html = "<tr><td colspan='7'>未找到相关记录!</td>";
}
$("#popPTPType #mianBodyPTP tbody").html(html);
dialogHelper.Reset("popPTPType");
}
});
}
//p2p产品点击OK时
function PTPOnclick() {
var html = ' <h4>P2P产品</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="14%" scope="col">产品名称</th>';
html += '<th width="10%" scope="col">所属平台</th>';
html += '<th width="13%" scope="col">投资周期(月)</th>';
html += '<th width="13%" scope="col">预期收益率(%</th>';
html += '<th width="13%" scope="col">投资金额(元)</th>';
html += '<th width="5%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
var list = P2PList.GetList();
var index = $("#P2PHidden").val();//这个表示属于第几个产品选择
var SelectType = $("#P2PSelectType").val();//这个是选择的哪个层
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td><div class="ellipsis" title="' + n.P2PName + '">' + n.P2PName + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.InvestmentField + '">' + n.InvestmentField + '</div></td>';
html += '<td>' + n.InvestmentCycle + '</td>';
html += '<td>' + n.EarningsRate + '</td>';
html += ' <td>' + Number(n.P2PInvestmentMoney).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="P2PDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
if (SelectType == 1) {
$("#jichuP2P_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhiP2P_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhiP2P_" + index + "").html(html);
} else {
$("#toujiP2P_" + index + "").html(html);
}
//先清空收索框
$("#popPTPType #PTPSearch").val("");
//后关闭
//关闭层还要计算
dialogHelper.Close("popPTPType");
//然后开始计算
//productIncomeRateVal();
}
//P2p删除操作
function P2PDelete(Id, SelectType, index, th) {
P2PList.Remove(Id);
var list = P2PList.GetList();
var html = '';
var len = $(th).parent().parent().siblings();
if (len.length != 0) {
html += ' <h4>P2P产品</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="14%" scope="col">产品名称</th>';
html += '<th width="10%" scope="col">所属平台</th>';
html += '<th width="13%" scope="col">投资周期(月)</th>';
html += '<th width="13%" scope="col">预期收益率(%</th>';
html += '<th width="13%" scope="col">投资金额(元)</th>';
html += '<th width="5%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td><div class="ellipsis" title="' + n.P2PName + '">' + n.P2PName + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.InvestmentField + '">' + n.InvestmentField + '</div></td>';
html += '<td>' + n.InvestmentCycle + '</td>';
html += '<td>' + n.EarningsRate + '</td>';
html += ' <td>' + Number(n.P2PInvestmentMoney).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="P2PDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (SelectType == 1) {
$("#jichuP2P_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhiP2P_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhiP2P_" + index + "").html(html);
} else {
$("#toujiP2P_" + index + "").html(html);
}
//计算
productIncomeRateVal();
}
//P2P文本框失去焦点事件
function OnFucsP2P(th) {
var mod = $("#popPTPType input[type='radio']:checked");
var DivId = $(mod).parents("tr").find("td").eq(6).find("div").attr("Id")
//判断文本是否符合要求
if (!VerificationHelper.checkFrom(DivId)) {
return;
}
var text = $(th).val();
var model = P2PList2.GetList();
model[0].P2PInvestmentMoney = text;
}
//弹出保险产品
function PupInsurance(str, index) {
//隐藏
$("#Insurance_1").show();
$("#Nextbtns").show();
$("#Insurance_2").hide();
$("#Lastbtns").hide();
$("#btns").hide();
//取消清空所有下拉框
$("#InsuranceType2").val(0);
$("#InsuranceType, #ProductName, #InsuranceMoney, #ContinueTime, #PayType").html('<option value="0">请选择</option>');
$("#Insurance_1").find("input").val("");
$("#Insurance_2").find("input").val("");
$("#Sex").val("0");
$("#InsuranceHidden").val(index);
$("#InsuranceSelectType").val(str);
dialogHelper.Show("InsuranceCheck", 550);
}
//根据条件查询费率
function InquiryRate(ProductId, InsuranceMoney, PayType, Sex, Age) {
var money = 0;
var Cost = CostList.find((item) => item.Id === parseInt(ProductId))
var BasePeriod = 1
if (ProductId == 38) {
if (InsuranceMoney < 1000) {
dialogHelper.Error({ content: "。最低年缴保费不能少于1000元" });
return 0;
}
BasePeriod = 1;
}
else if (ProductId == 37) {
//保险期限倍数
if (InsuranceMoney < 24000) {
dialogHelper.Error({ content: "。最低年缴保费不能少于24000元" });
return 0;
}
var Period = PeriodList.find((item) => item.Id === parseInt(ProductId))
BasePeriod = $("#ContinueTime").val();
}
else {
//保险金额倍数
BasePeriod = Math.min.apply(Math, $.map(Cost.Profession, function (n, i) {
return parseInt(n.Value);
}))
}
var data = {
ProductId: ProductId,
InsuranceMoney: InsuranceMoney,
PayType: PayType,
Sex: Sex,
Age: Age,
BasePeriod: BasePeriod
}
_ajax_backup({
url: "/Student/InvestmentPlan/InquiryRate",
type: "POST",
async: false,
dataType: "json",
data: data,
success: function (data) {
if (data != null || data.IsSuccess) {
if (data.ErrorCode.trim() != "") {
dialogHelper.Error({ content: data.ErrorCode });
} else {
money = data.Data;
}
}
}, error: function (msg) {
}
});
return money;
}
//保险产品点击OK时
function InsuranceOKClick() {
var html = ' <h4>保险产品</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += ' <th width="8%" scope="col">被保险人</th>';
html += ' <th width="11%" scope="col">险种类别</th>';
html += '<th width="10%" scope="col">产品名称</th>';
html += '<th width="15%" scope="col">保险金额(万元)</th>';
html += '<th width="8%" scope="col">保险期间</th>';
html += ' <th width="8%" scope="col">缴费方式</th>';
html += ' <th width="13%" scope="col">年缴保费(元)</th>';
html += '<th width="5%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
var list = InsuranceList.GetList();
var index = $("#InsuranceHidden").val();//这个表示属于第几个产品选择
var SelectType = $("#InsuranceSelectType").val();//这个是选择的哪个层
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td><div class="ellipsis" title="' + n.Theinsured + '">' + n.Theinsured + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.InsuranceType2 + '">' + n.InsuranceType2 + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.InsuranceName + '">' + n.InsuranceName + '</div></td>';
html += '<td>' + n.InsuranceMoney + '</td>';
html += '<td>' + n.InsuranceTime + '</td>';
html += ' <td>' + n.ChargeType + '</td>';
html += ' <td>' + Number(n.AnnualPremium).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="InsuranceDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
if (SelectType == 1) {
$("#jichuInsurance_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhiInsurance_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhiInsurance_" + index + "").html(html);
} else {
$("#toujiInsurance_" + index + "").html(html);
}
//后关闭
//关闭层还要计算
dialogHelper.Close("InsuranceCheck");
}
//保险删除操作
function InsuranceDelete(Id, SelectType, index, th) {
InsuranceList.Remove(Id);
var list = InsuranceList.GetList();
var html = '';
var len = $(th).parent().parent().siblings();
if (len.length != 0) {
html += ' <h4>保险产品</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += ' <th width="8%" scope="col">被保险人</th>';
html += ' <th width="11%" scope="col">险种类别</th>';
html += '<th width="10%" scope="col">产品名称</th>';
html += '<th width="15%" scope="col">保险金额(万元)</th>';
html += '<th width="8%" scope="col">保险期间</th>';
html += ' <th width="8%" scope="col">缴费方式</th>';
html += ' <th width="13%" scope="col">年缴保费(元)</th>';
html += '<th width="5%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
html += '<td><div class="ellipsis" title="' + n.Theinsured + '">' + n.Theinsured + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.InsuranceType2 + '">' + n.InsuranceType2 + '</div></td>';
html += '<td><div class="ellipsis" title="' + n.InsuranceName + '">' + n.InsuranceName + '</div></td>';
html += '<td>' + n.InsuranceMoney + '</td>';
html += '<td>' + n.InsuranceTime + '</td>';
html += ' <td>' + n.ChargeType + '</td>';
html += ' <td>' + Number(n.AnnualPremium).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="InsuranceDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (SelectType == 1) {
$("#jichuInsurance_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhiInsurance_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhiInsurance_" + index + "").html(html);
} else {
$("#toujiInsurance_" + index + "").html(html);
}
//计算
productIncomeRateVal();
}
//获取保额
function CountBaoEr(parameter1, BaoFei, ProductId) {
var result = 0;
$.ajax({
url: "/Student/InvestmentPlan/CountBaoEr",
type: "POST",
async: false,
dataType: "json",
data: {
parameter1: parameter1,
BaoFei: BaoFei,
ProductId: ProductId
},
success: function (data) {
result = (data);
}, error: function (msg) {
}
});
if (result < 10000) {
result = (result / 10000).toMyFixed(1);
} else {
result = (result / 10000).toMyFixed(0);
}
return result;
}
//弹出黄金产品
function popGold(str, index) {
//清空文本框
$("#popGold").find("input[type=text]").val("");
$("#popGold select").val("0");
$("#GoldHidden").val(index);
$("#GoldSelectType").val(str);
dialogHelper.Show("popGold", 500);
dajianhtml($("#GoldBuyType").val())
}
//搭建HTML
function dajianhtml(strType) {
//界面拼装
var html = '';
if (strType == "1") {
html += ' <div class="fif-box grid-11">';
html += ' <label class="fif-text"><i class="c-red">*</i>定期间隔:</label>';
html += ' <div class="input">';
html += '<select id="GoldInvestTime" style=" width: 30%;" class="" msgname="定期间隔">';
html += ' <option value="0">每月</option>';
html += ' </select>';
html += '</div>';
html += ' </div>';
html += ' <div class="fif-box grid-11">';
html += '<label class="fif-text"><i class="c-red">*</i>初次扣款日:</label>';
html += '<div class="input">';
html += ' <input class="ipt-text Wdate IsRequired" msgname="初次扣款日" style="width:45%" id="GoldDeductMoneyTime" type="text" onfocus="WdatePicker({ dateFmt: \'yyyy/MM/dd \', readOnly: true })">';
html += ' </div>';
html += ' </div>';
html += '<div class="fif-box grid-11">';
html += '<label class="fif-text"><i class="c-red">*</i>每期金额:</label>';
html += '<div class="input"><input class="ipt-text IsRequired IsMaxFloat IsMinFloat IsReg" msgname="每期金额" msgreg="请输入0.00到999999999.99的数字" reg="\\d{0,9}\\.*\\d{0,2}" maxfloat="999999999.99" type="text" id="GoldInvestMoney" style="width:30%"> 元</div>';
html += ' </div>';
html += ' <div class="fif-box grid-11">';
html += ' <label class="fif-text"><i class="c-red">*</i>投资年限:</label>';
html += '<div class="input"> ';
html += '<input class="ipt-text IsRequired IsNumber IsMaxNumber IsMinNumber" msgname="投资年限" maxnumber="100" minnumber="1" type="text" id="GoldInvestDate" style="width:30%"> 年';
html += ' </div>';
html += '</div>';
} else {
html += '<div class="fif-box grid-11">';
html += ' <label class="fif-text"><i class="c-red">*</i>购买金额:</label>';
html += ' <div class="input">';
html += ' <input class="ipt-text IsRequired IsMaxFloat IsMinFloat IsReg" msgname="购买金额" msgreg="请输入0.00到999999999.99的数字" reg="\\d{0,9}\\.*\\d{0,2}" maxfloat="999999999.99" type="text" id="goumaiMoney" style="width:60%"> 元';
html += ' </div>';
html += ' </div>';
}
$("#goldHtml").html(html);
}
//黄金产品点击OK时
function GoldOnclick() {
var html = '<h4>实物黄金</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="16%" scope="col">投资总额(元)</th>';
html += '<th width="14%" scope="col">购买方式</th>';
html += '<th width="15%" scope="col">近一年收益率(%</th>';
html += '<th width="11%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
var list = GoldList.GetList();
var index = $("#GoldHidden").val();//这个表示属于第几个产品选择
var SelectType = $("#GoldSelectType").val();//这个是选择的哪个层
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
//定投金额=每期金额*总期数; 其中,总期数 = 投资年限 * 12
var money = 0;
if (n.GoldBuyType == "单笔购买") {
money = (n.GoldInvestMoney);
money = Number(money).toMyFixed(2);
html += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html += '<td><div class="ellipsis" >单笔购买</div></td>';
} else {
money = n.GoldInvestMoney * n.GoldInvestDate * 12;
html += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',2)">按月定投</a></div></td>';
}
//近一年收益率(%
html += '<td>' + Number(n.NearAnnualYield).toMyFixed(2) + '</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="GoldDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
if (SelectType == 1) {
$("#jichuGold_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhiGold_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhiGold_" + index + "").html(html);
} else {
$("#toujiGold_" + index + "").html(html);
}
//后关闭
dialogHelper.Close("popGold");
}
//黄金删除操作
function GoldDelete(Id, SelectType, index, th) {
GoldList.Remove(Id);
var list = GoldList.GetList();
var html = '';
var len = $(th).parent().parent().siblings();
if (len.length != 0) {
html += '<h4>实物黄金</h3>';
html += '<div class="table textc" style="margin-bottom:10px;">';
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html += ' <thead>';
html += ' <tr>';
html += '<th width="16%" scope="col">投资总额(元)</th>';
html += '<th width="14%" scope="col">购买方式</th>';
html += '<th width="15%" scope="col">近一年收益率(%</th>';
html += '<th width="11%" scope="col">操作</th>';
html += '</tr>';
html += '</thead>';
html += ' <tbody>';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == SelectType && n.index == index) {
html += '<tr>';
//定投金额=每期金额*总期数; 其中,总期数 = 投资年限 * 12
var money = 0;
if (n.GoldBuyType == "单笔购买") {
money = (n.GoldInvestMoney);
money = Number(money).toMyFixed(2);
html += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html += '<td><div class="ellipsis" >单笔购买</div></td>';
} else {
money = n.GoldInvestMoney * n.GoldInvestDate * 12;
html += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',2)">按月定投</a></div></td>';
}
html += '<td>0.02</td>';
html += ' <td><a style="color:#0e8ae5;" onclick="GoldDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html += '</tr>';
}
});
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (SelectType == 1) {
$("#jichuGold_" + index + "").html(html);
} else if (SelectType == 2) {
$("#baozhiGold_" + index + "").html(html);
} else if (SelectType == 3) {
$("#zengzhiGold_" + index + "").html(html);
} else {
$("#toujiGold_" + index + "").html(html);
}
//计算
productIncomeRateVal();
}
//获取黄金收益率
function GetGoldRate() {
$.ajax({
url: "/Student/InvestmentPlan/GetGoldRate",
type: "POST",
async: false,
dataType: "json",
data: {
},
success: function (data) {
if (data != null) {
money = data;
}
}, error: function (msg) {
}
});
return money;
}
//加号添加产品选择
function AddList(index, dom) {
index = Number(index) + 1;
var trHtml = "";
trHtml += '<div class="item b-grayish Tageach" id="ProductSelect_' + index + '" eacflag="ProductSelect">';
trHtml += '<div class="fif-con mb10">';
trHtml += ' <div class="fif-box grid-4" style="float:left;width:25%">';
trHtml += '<label class="fif-text"><i class="c-red">*</i>规划目标:</label>';
trHtml += ' <div class="input" >';
trHtml += '<select id="guihua_' + index + '" class="guihua IsRequired" msgname="规划目标">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">教育规划</option>';
trHtml += '<option value="2">消费规划</option>';
trHtml += '<option value="3">创业规划</option>';
trHtml += ' <option value="4">退休规划</option>';
trHtml += '<option value="5">保险规划</option>';
trHtml += '</select>';
trHtml += ' </div>';
trHtml += ' </div>';
trHtml += '<div class="fif-box" style="float:left;width:72%" id="tabT_' + index + '">';
trHtml += ' <div class="fif-box" style="width:75%">';
trHtml += ' <label class="fif-text">方案所需投资收益率(年化):</label>';
trHtml += ' <div class="input"><input type="text" disabled="" id="investRate_' + index + '" class="ipt-text grid-12 disabled" value="" style="width:50%;">&nbsp;%</div>';
trHtml += '</div>';
trHtml += ' </div> ';
trHtml += ' <a class="spr spr-del js_remove fr" style="margin-top:5px;" onclick="javascript: DelcloseProduct(this,' + index + ')" href="javascript:void(0)"></a>';
trHtml += '</div>';
trHtml += ' <div class="table">';
//基础层
trHtml += '<table class="mb10" width="100%" id="jichu_' + index + '" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += ' <tr>';
trHtml += '<td width="83" rowspan="2" align="center" style="background-color: #92ccfb" class="c-white">基础层</td>';
trHtml += ' </tr>';
trHtml += ' <tr>';
trHtml += ' <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += ' <select id="jichuceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += ' </div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('1','jichuceng_" + index + "')\" id=\"jichucengId" + index + "\" value=\"添 加\">";
trHtml += '</div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="jichujijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="jichubank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="jichuP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="jichuInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="jichuGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//保值层
trHtml += '<table class="mb10" id="baozhi_' + index + '" width="100%" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += '<tr> <td width="83" rowspan="2" align="center" style="background-color: #62b3f5" class="c-white">保值层</td></tr>';
trHtml += ' <tr> <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += '<select id="baozhiceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += '</div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('2','baozhiceng_" + index + "')\" id=\"baozhicengId" + index + "\" value=\"添 加\">";
trHtml += ' </div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="baozhijijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="baozhibank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="baozhiP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="baozhiInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="baozhiGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//增值层
trHtml += '<table class="mb10" width="100%" id="zengzhi_' + index + '" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += '<tr> <td width="83" rowspan="2" align="center" style="background-color: #2a91e7" class="c-white">增值层</td></tr>';
trHtml += ' <tr> <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += '<select id="zengzhiceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += '</div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('3','zengzhiceng_" + index + "')\" id=\"zengzhicengId" + index + "\" value=\"添 加\">";
trHtml += ' </div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="zengzhijijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="zengzhibank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="zengzhiP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="zengzhiInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="zengzhiGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//投机层
trHtml += '<table class="mb10" width="100%" id="touji_' + index + '" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += '<tr> <td width="83" rowspan="2" align="center" style="background-color: #076cc1" class="c-white">投机层</td></tr>';
trHtml += ' <tr> <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += '<select id="toujiceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += '</div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('4','toujiceng_" + index + "')\" id=\"toujicengId" + index + "\" value=\"添 加\">";
trHtml += ' </div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="toujijijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="toujibank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="toujiP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="toujiInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="toujiGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//
trHtml += '</div>';
trHtml += '<div class="fif-con" id="tabW_' + (index) + '">';
trHtml += '<div class="fif-box grid-5">';
trHtml += '<label class="fif-text">产品组合预期年化收益率:</label>';
trHtml += ' <div class="input"><input type="text" id="productRate_' + (index) + '" disabled="" class="ipt-text grid-12 disabled" value="">&nbsp;%</div>';
trHtml += ' </div>';
trHtml += ' <div class="fif-box grid-5">';
trHtml += '<label class="fif-text">产品组合总投资金额:</label>';
trHtml += '<div class="input"><input type="text" id="productMoney_' + (index) + '" disabled="" class="ipt-text grid-12 disabled" value="">&nbsp;元</div>';
trHtml += '</div>';
trHtml += '</div>';
trHtml += '</div>';
trHtml += '';
trHtml += '';
$("#Add").prev().after(trHtml);
}
//产品选择搜索按钮事件
function LookForProduct(str, typeId) {
var listId = typeId.split('_');
var index = listId[1];
//判断该规划目标下的产品数量
var len1 = $("#jichujijin_" + index + "").find("tbody").find("tr");
var len2 = $("#jichubank_" + index + "").find("tbody").find("tr");
var len3 = $("#jichuP2P_" + index + "").find("tbody").find("tr");
var len4 = $("#jichuInsurance_" + index + "").find("tbody").find("tr");
var len5 = $("#jichuGold_" + index + "").find("tbody").find("tr");
var len6 = $("#baozhijijin_" + index + "").find("tbody").find("tr");
var len7 = $("#baozhibank_" + index + "").find("tbody").find("tr");
var len8 = $("#baozhiP2P_" + index + "").find("tbody").find("tr");
var len9 = $("#baozhiInsurance_" + index + "").find("tbody").find("tr");
var len10 = $("#baozhiGold_" + index + "").find("tbody").find("tr");
var len11 = $("#zengzhijijin_" + index + "").find("tbody").find("tr");
var len12 = $("#zengzhibank_" + index + "").find("tbody").find("tr");
var len13 = $("#zengzhiP2P_" + index + "").find("tbody").find("tr");
var len14 = $("#zengzhiInsurance_" + index + "").find("tbody").find("tr");
var len15 = $("#zengzhiGold_").find("tbody").find("tr");
var len16 = $("#toujijijin_" + index + "").find("tbody").find("tr");
var len17 = $("#toujibank_" + index + "").find("tbody").find("tr");
var len18 = $("#toujiP2P_" + index + "").find("tbody").find("tr");
var len19 = $("#toujiInsurance_" + index + "").find("tbody").find("tr");
var len20 = $("#toujiGold_" + index + "").find("tbody").find("tr");
if ((len1.length + len2.length + len3.length + len4.length + len5.length + len6.length + len7.length + len8.length + len9.length + len10.length + len11.length + len12.length + len13.length + len14.length + len15.length + len16.length + len17.length + len18.length + len19.length + len20.length) < 10) {
//获取下拉框的值
var SelectValue = $("#" + typeId + "").val();
var txt = $("#guihua_" + index + "").val();
if (SelectValue != "0") {
if (SelectValue == 1) {
//弹出基金列表
PupCashFund(str, index);
} else if (SelectValue == 2) {
//弹出银行弹框
PupBank(str, index);
} else if (SelectValue == 3) {
//P2P产品
PupPTwoProduct(str, index);
} else if (SelectValue == 4) {
//保险产品
PupInsurance(str, index);
} else if (SelectValue == 5) {
//黄金产品
popGold(str, index);
} else {
}
} else {
dialogHelper.Error({ content: "请先选择产品类型!" })
}
} else {
dialogHelper.Error({ content: "当前规划目标最多添加10个产品!" })
}
}
//规划目标选择生成HTML
function PlanTarget(type, Num) {
var html1 = '';
var html2 = '';
if (type == "5") {
html1 += '<div class="fif-box" style="width:49%">';
html1 += '<label class="fif-text">方案保险需求额度:</label>';
html1 += '<div class="input"><input type="text" id="planLimit_' + Num + '" style="width:75%" eacflag="planLimit" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
html1 += ' </div>';
html1 += ' <div class="fif-box" style="width:49%">';
html1 += '<label class="fif-text">方案保险费用预算:</label>';
html1 += ' <div class="input"><input type="text" id="planBudget_' + Num + '" style="width:75%" eacflag="planBudget" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
html1 += ' </div>';
html2 += '<div class="fif-box grid-5">';
html2 += '<label class="fif-text">产品组合总保额:</label>';
html2 += ' <div class="input"><input type="text" id="productInsured_' + Num + '" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
html2 += ' </div>';
html2 += ' <div class="fif-box grid-5">';
html2 += '<label class="fif-text">产品组合总保费:</label>';
html2 += '<div class="input"><input type="text" id="productPremium_' + Num + '" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
html2 += ' </div>';
} else {
html1 += ' <div class="fif-box" style="width:75%">';
html1 += ' <label class="fif-text">方案所需投资收益率(年化):</label>';
html1 += ' <div class="input"><input type="text" disabled="" id="investRate_' + Num + '" eacflag="PlanRate" class="ipt-text grid-12 disabled" value="0" style="width:50%;">&nbsp;%</div>';
html1 += '</div>';
html2 += '<div class="fif-box grid-5">';
html2 += '<label class="fif-text">产品组合预期年化收益率:</label>';
html2 += '<div class="input"><input type="text" id="productRate_' + (Num) + '" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;%</div>';
html2 += '</div>';
html2 += ' <div class="fif-box grid-5">';
html2 += '<label class="fif-text">产品组合总投资金额:</label>';
html2 += '<div class="input"><input type="text" id="productMoney_' + (Num) + '" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
html2 += ' </div>';
}
$("#tabT_" + Num + "").html(html1);
$("#tabW_" + Num + "").html(html2);
}
//修改规划目标
function UpdateGuiHua(oldvalue, newvalue, index) {
if (oldvalue == undefined) {
oldvalue = "0";
}
var FundListList = FundList2.GetList(); //基金数据集合
var P2PListList = P2PList.GetList(); //P2P数据临时集合
var BankListList = BankList.GetList(); //银行数据集合
var InsuranceLists = InsuranceList.GetList(); //保险数据集合
var GoldListList = GoldList.GetList(); //黄金数据集合
//基金数据集合
$(FundListList).each(function (i, n) {
if (n.InvestmentPlanProductId == oldvalue && n.index == index) {
var model = FundList2.FindRecord(n.Id);
model.InvestmentPlanProductId = newvalue;
}
});
//P2P数据临时集合
$(P2PListList).each(function (i, n) {
if (n.InvestmentPlanProductId == oldvalue && n.index == index) {
var model = P2PList.FindRecord(n.Id);
model.InvestmentPlanProductId = newvalue;
}
});
//银行数据集合
$(BankListList).each(function (i, n) {
if (n.InvestmentPlanProductId == oldvalue && n.index == index) {
var model = BankList.FindRecord(n.Id);
model.InvestmentPlanProductId = newvalue;
}
});
//保险数据集合
$(InsuranceLists).each(function (i, n) {
if (n.InvestmentPlanProductId == oldvalue && n.index == index) {
var model = InsuranceList.FindRecord(n.Id);
model.InvestmentPlanProductId = newvalue;
}
});
//黄金数据集合
$(GoldListList).each(function (i, n) {
if (n.InvestmentPlanProductId == oldvalue && n.index == index) {
var model = GoldList.FindRecord(n.Id);
model.InvestmentPlanProductId = newvalue;
}
});
}
//按月定投弹框
function popMonthCast(Id, type) {
dialogHelper.Show("popMonthCast", 400);
//基金产品
if (type == 1) {
var model = FundList2.FindRecord(Id);
$("#FundInvestTime2").html(model.FundInvestTime);
$("#FundDeductMoneyTime2").html(model.strFundDeductMoneyTime);
$("#FundInvestMoney2").html(model.FundInvestMoney + " 元");
$("#FundInvestDate2").html(model.FundInvestDate + " 年");
} else {
var model = GoldList.FindRecord(Id);
$("#FundInvestTime2").html(model.GoldInvestTime);
$("#FundDeductMoneyTime2").html(model.strGoldDeductMoneyTime);
$("#FundInvestMoney2").html(model.GoldInvestMoney + " 元");
$("#FundInvestDate2").html(model.GoldInvestDate + " 年");
}
}
//计算每层产品收益
function productIncomeRateVal() {
var Fund = FundList2.GetList();//基金数据集合
var P2P = P2PList.GetList();//P2P数据临时集合
var Bank = BankList.GetList();//银行数据集合
var Insurance = InsuranceList.GetList();//保险数据集合
var Gold = GoldList.GetList();//黄金数据集合
if ($("div[eacflag='ProductSelect']").length > 0) {
$("div[eacflag='ProductSelect']").each(function (index, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
if (guihuaText != 5) {
//产品组合预期收益率=(产品组合预期收益/产品组合总投资金额)*100%
//1,产品组合预期收益=∑(基金投资总额*近一年收益率)+∑各银行各币种储蓄预期收益+∑各P2P产品预期收益+黄金投资总额*近一年收益率
//2,某银行某币种储蓄预期收益=存款金额*年利率*所选币种当前汇率
//3,P2P产品预期收益=(预期收益率/12*投资周期*投资金额
//开始计算
var FundMoney = 0;//∑(基金投资总额*近一年收益率)
var FundAllMoney = 0;//基金产品投资总额
$(Fund).each(function (c, d) {
if (d.index == ind) {
FundMoney = FundMoney + Number(d.FundInvestmentAllMoney * (d.YearlyEarningsRate / 100));
FundAllMoney = FundAllMoney + Number(d.FundInvestmentAllMoney);
}
});
var BankMoney = 0; //2某银行某币种储蓄预期收益=存款金额*年利率*所选币种当前汇率
var BankAllMoney = 0;//(银行存款金额*币种当前汇率)
$(Bank).each(function (a, b) {
if (b.index == ind) {
var rate = GetRate(b.Currency);
if (b.YearRate == "-") {
} else {
BankMoney = BankMoney + Number(b.DepositMoney * (b.YearRate / 100) * rate);
BankAllMoney = BankAllMoney + Number(b.DepositMoney * rate);
}
}
});
var P2PMoney = 0;//P2P产品预期收益=(预期收益率/12*投资周期*投资金额
var P2PAllMoney = 0;//∑P2P产品投资金额
$(P2P).each(function (e, f) {
if (f.index == ind) {
if (f.EarningsRate!=null){
P2PMoney = P2PMoney + Number(((f.EarningsRate.substring(0, f.EarningsRate.length - 1) / 100) / 12) * f.InvestmentCycle * f.P2PInvestmentMoney);
P2PAllMoney = P2PAllMoney + Number(f.P2PInvestmentMoney);
}
}
});
var GoldMoney = 0;//黄金投资总额*近一年收益率
var GoldAllMoney = 0;//黄金投资总额
$(Gold).each(function (g, h) {
if (h.index == ind) {
GoldMoney = GoldMoney + Number(h.GoldInvestMoney * h.NearAnnualYield / 100);
GoldAllMoney = GoldAllMoney + Number(h.GoldInvestMoney);
}
});
var InsuranceMoney = 0;//保险产品保费之和
$(Insurance).each(function (i, j) {
if (j.index == ind) {
InsuranceMoney = InsuranceMoney + Number(j.AnnualPremium);
}
});
//产品组合总投资金额==∑基金产品投资总额+∑(银行存款金额*币种当前汇率)+∑P2P产品投资金额+黄金投资总额+保险产品保费之和
var touziAllMoney = FundAllMoney + BankAllMoney + P2PAllMoney + GoldAllMoney + InsuranceMoney;
$("#productMoney_" + ind + "").val((touziAllMoney).toMyFixed(2));
//产品组合预期收益
var zhmoney = FundMoney + BankMoney + P2PMoney + GoldMoney;
//产品组合预期收益率=(产品组合预期收益/产品组合总投资金额)*100%
if (touziAllMoney == 0) {
$("#productRate_" + ind + "").val("0.00");
} else {
var MMoney = (zhmoney / touziAllMoney) * 100;
$("#productRate_" + ind + "").val(MMoney.toMyFixed(2));
}
} else {
//产品组合总保额=产品组合中所选保险产品的保额之
//产品组合总保费=产品组合中所选保险产品的保费之和
var AnnualPremium = 0;//保险产品保费之和
var InsuranceMoney = 0;//保险金额
$(Insurance).each(function (i, j) {
if (j.index == ind) {
AnnualPremium += Number(j.AnnualPremium);
InsuranceMoney += Number(j.InsuranceMoney);
}
});
$("#productInsured_" + ind + "").val((InsuranceMoney * 10000).toMyFixed(2));
$("#productPremium_" + ind + "").val(AnnualPremium.toMyFixed(2));
}
})
}
};
//查询币种最新的汇率
function GetRate(Curcd) {
//确保所有参数都有的情况下获取数据
if (Curcd == "人民币") {
return 1;
} else {
var txt = GetCurrency(Curcd);
var rate = 0;
$.ajax({
url: "/Student/InvestmentPlan/GetFE_Exrated",
type: "POST",
async: false,
dataType: "json",
data: {
Curcd: txt
},
success: function (data) {
//获得整个银行 活期定期的汇率
if (data != null) {
rate = data / 100;
}
}
});
return rate;
}
}
//获取币种类型
function GetCurrency(str) {
var txt = '';
switch (str) {
case '美元':
txt = 'USD';
break;
case '港币':
txt = 'HKD';
break;
case '英镑':
txt = 'GBP';
break;
case '欧元':
txt = 'EUR';
break;
case '日元':
txt = 'JPY';
break;
case '加拿大元':
txt = 'CAD';
break;
case '澳大利亚元':
txt = 'AUD';
break;
}
return txt;
}
//新增和修改
function SaveProductPlan(saveFalg) {
TagNavi = true;
//页面字段检测
if (!VerificationHelper.checkFrom("FinanceInvestmentPlanDiv")) {
TagNavi = false;
return;
}
//同时还要检验三个数加起来是否为百分之百
var HoldRate = $.trim($("#FinanceInvestmentPlanDiv #HoldRate").val()) * 1;
var IncreaseRate = $.trim($("#FinanceInvestmentPlanDiv #IncreaseRate").val()) * 1;
var SpeculationRate = $.trim($("#FinanceInvestmentPlanDiv #SpeculationRate").val()) * 1;
var RateSum = HoldRate + IncreaseRate + SpeculationRate;
if (RateSum != 100) {
dialogHelper.Error({ content: "保值层、增值层、投机层的比率加起来不为100" });
TagNavi = false;
return false;
}
//判断至少有一个层有产品
var result = CheckSelectVal();
if (!result) {
dialogHelper.Error({ content: "请至少选择一项理财产品!" });
TagNavi = false;
return false;
}
//此处参数必须跟VM一致
var InvestmentPlan = new Object();//主表
if (ProposalId != null && ProposalId != "" && ProposalId != undefined) {
InvestmentPlan["ProposalId"] = ProposalId;
} else {
ProposalId = $("#FinanceInvestmentPlanDiv #ProposalId").val();
InvestmentPlan["ProposalId"] = ProposalId
}
InvestmentPlan["Id"] = $("#FinanceInvestmentPlanDiv #InvestmentPlanId").val();//主键Id
InvestmentPlan["LifeCycleId"] = $("#FinanceInvestmentPlanDiv #LifeCycleId").val();//家庭生命周期
InvestmentPlan["HoldRate"] = HoldRate;
InvestmentPlan["IncreaseRate"] = IncreaseRate;
InvestmentPlan["SpeculationRate"] = SpeculationRate;
InvestmentPlan["InsureShow"] = $("#InsureShow").val();
//获得所有的产品列表
var InvestmentPlanProductList =[];
$("div[eacflag='ProductSelect']").each(function (index, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
var obj = new Object();
//obj["Id"] = ind;
obj["index"] = ind;
obj["ProposalId"] = ProposalId;
obj["PlanId"] = guihuaText;
if (guihuaText != 5) {
obj["PlanRate"] = $("#investRate_" + ind + "").val();
obj["ProductRate"] = $("#productRate_" + ind + "").val();
obj["ProductMoney"] = $("#productMoney_" + ind + "").val();
} else {
obj["PlanLimit"] = $("#planLimit_" + ind + "").val();
obj["PlanBudget"] = $("#planBudget_" + ind + "").val();
obj["ProductInsured"] = $("#productInsured_" + ind + "").val();
obj["ProductPremium"] = $("#productPremium_" + ind + "").val();
}
var Fund = new arrayHelper("Id");//基金数据集合
var P2P = new arrayHelper("Id");//P2P数据临时集合
var Bank = new arrayHelper("Id");//银行数据集合
var Insurance = new arrayHelper("Id");//保险数据集合
var Gold = new arrayHelper("Id");//黄金数据集合
var FundL = FundList2.GetList();//基金数据集合
var P2PL = P2PList.GetList();//P2P数据临时集合
var BankL = BankList.GetList();//银行数据集合
var InsuranceL = InsuranceList.GetList();//保险数据集合
var GoldL = GoldList.GetList();//黄金数据集合
$(FundL).each(function (c, d) {
if (d.index == ind) {
Fund.Add(d);
}
});
$(BankL).each(function (a, b) {
if (b.index == ind) {
Bank.Add(b);
}
});
$(P2PL).each(function (e, f) {
if (f.index == ind) {
P2P.Add(f);
}
});
$(GoldL).each(function (g, h) {
if (h.index == ind) {
Gold.Add(h);
}
});
$(InsuranceL).each(function (i, j) {
if (j.index == ind) {
Insurance.Add(j);
}
});
obj["P2PList"] = P2P.GetList();
obj["InsuranceList"] = Insurance.GetList();
obj["GoldList"] = Gold.GetList();
obj["FundList"] = Fund.GetList();
obj["BankList"] = Bank.GetList();
InvestmentPlanProductList.push(obj);
});
//产品选择列表添加
InvestmentPlan["InvestmentPlanProductList"] = InvestmentPlanProductList;
InvestmentPlan["Analysis"] = $("#Analysis").val();//获得投资规划分析
$.ajax({
url: "/Student/InvestmentPlan/SaveInvestmentPlan",
type: "POST",
async: false,
data: JSON.stringify(InvestmentPlan),
contentType: "application/json",
success: function (data) {
if (data != null) {
//保存原值
//SaveDefaultValueCommon("FinanceInvestmentPlanDiv");
//先要赋值
$("#FinanceInvestmentPlanDiv #InvestmentPlanId").val(data.Id);
if (typeof saveFalg == "undefined") {
dialogHelper.Success({
content: "保存成功!",
success: function () {
//window.location.reload();
}
});
}
}
}
});
}
//判断四个必须选中一个
function CheckSelectVal() {
var Fund = FundList2.GetList();//基金数据集合
var P2P = P2PList.GetList();//P2P数据临时集合
var Bank = BankList.GetList();//银行数据集合
var Insurance = InsuranceList.GetList();//保险数据集合
var Gold = GoldList.GetList();//黄金数据集合
var result = true;
if ($("div[eacflag='ProductSelect']").length > 0) {
$("div[eacflag='ProductSelect']").each(function (index, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var num1 = 0
$(Fund).each(function (c, d) {
if (d.index == ind) {
num1++;
}
});
var num2 = 0
$(Bank).each(function (a, b) {
if (b.index == ind) {
num2++;
}
});
var num3 = 0
$(P2P).each(function (e, f) {
if (f.index == ind) {
num3++;
}
});
var num4 = 0
$(Gold).each(function (g, h) {
if (h.index == ind) {
num4++;
}
});
var num5 = 0
$(Insurance).each(function (i, j) {
if (j.index == ind) {
num5++;
}
});
var num = num1 + num2 + num3 + num4 + num5;
if (num == 0) {
result = false;
return result;
}
})
}
return result;
};
//画饼
function ShowPieInfo(Currency, Bond, Stock) {
var chart;
$('.showPie').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: '投资分配比例',
//align: 'left'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
colors: ['#63b2f4', '#2a91e6', '#086cc1'], //'#46adb7', '#f2a83e', '#e16556'
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: '投资比例分配',
data: [
['保值层', Currency],
{
name: '增值层',
y: Bond,
sliced: false,
selected: false
},
['投机层', Stock],
]
}]
});
}
//基金数据加载
function CreateHtml1() {
var html1 = '';
var list = FundList2.GetList();
if (list.length > 0) {
html1 += ' <h4>基金产品</h4>';
html1 += '<div class="table textc" style="margin-bottom:10px;">';
html1 += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html1 += ' <thead>';
html1 += ' <tr>';
html1 += '<th width="6%" scope="col">代码</th>';
html1 += '<th width="11%" scope="col">产品名称</th>';
html1 += '<th width="9%" scope="col">基金类型</th>';
html1 += '<th width="11%" scope="col">近一年收益率</th>';
html1 += '<th width="13%" scope="col">最新净值(元)</th>';
html1 += '<th width="9%" scope="col">投资方式</th>';
html1 += '<th width="13%" scope="col">投资总额(元)</th>';
html1 += '<th width="5%" scope="col">操作</th>';
html1 += '</tr>';
html1 += '</thead>';
html1 += ' <tbody>';
}
$("div[eacflag='ProductSelect']").each(function (a, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
var html1_1 = '';
var html1_2 = '';
var html1_3 = '';
var html1_4 = '';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == 1 && n.index == ind) {
html1_1 += '<tr>';
html1_1 += '<td>' + n.FundCode + '</td>';
html1_1 += '<td><div class="ellipsis" title="' + n.FundName + '">' + n.FundName + '</div></td>';
html1_1 += '<td>' + n.FundType + '</td>';
html1_1 += '<td>' + n.YearlyEarningsRate + '%</td>';
if (n.NAV == 0) {
html1_1 += '<td>--</td>';
} else {
html1_1 += '<td>' + n.NAV.toMyFixed(4) + '</td>';
}
if (n.InvestmentType == "定期定额投资") {
html1_1 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',1)" >按月定投</a></div></td>';
} else {
html1_1 += '<td><div class="ellipsis" >一次性购买</div></td>';
}
html1_1 += ' <td>' + n.FundInvestmentAllMoney.toMyFixed(2) + '</td>';
html1_1 += ' <td><a style="color:#0e8ae5;" onclick="FundDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_1 += '</tr>';
}
if (n.ProductSelectType == 2 && n.index == ind) {
html1_2 += '<tr>';
html1_2 += '<td>' + n.FundCode + '</td>';
html1_2 += '<td><div class="ellipsis" title="' + n.FundName + '">' + n.FundName + '</div></td>';
html1_2 += '<td>' + n.FundType + '</td>';
html1_2 += '<td>' + n.YearlyEarningsRate + '%</td>';
if (n.NAV == 0) {
html1_2 += '<td>--</td>';
} else {
html1_2 += '<td>' + n.NAV.toMyFixed(4) + '</td>';
}
if (n.InvestmentType == "定期定额投资") {
html1_2 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',1)" >按月定投</a></div></td>';
} else {
html1_2 += '<td><div class="ellipsis" >一次性购买</div></td>';
}
html1_2 += ' <td>' + n.FundInvestmentAllMoney.toMyFixed(2) + '</td>';
html1_2 += ' <td><a style="color:#0e8ae5;" onclick="FundDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_2 += '</tr>';
}
if (n.ProductSelectType == 3 && n.index == ind) {
html1_3 += '<tr>';
html1_3 += '<td>' + n.FundCode + '</td>';
html1_3 += '<td><div class="ellipsis" title="' + n.FundName + '">' + n.FundName + '</div></td>';
html1_3 += '<td>' + n.FundType + '</td>';
html1_3 += '<td>' + n.YearlyEarningsRate + '%</td>';
if (n.NAV == 0) {
html1_3 += '<td>--</td>';
} else {
html1_3 += '<td>' + n.NAV.toMyFixed(4) + '</td>';
}
if (n.InvestmentType == "定期定额投资") {
html1_3 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',1)" >按月定投</a></div></td>';
} else {
html1_3 += '<td><div class="ellipsis" >一次性购买</div></td>';
}
html1_3 += ' <td>' + n.FundInvestmentAllMoney.toMyFixed(2) + '</td>';
html1_3 += ' <td><a style="color:#0e8ae5;" onclick="FundDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_3 += '</tr>';
}
if (n.ProductSelectType == 4 && n.index == ind) {
html1_4 += '<tr>';
html1_4 += '<td>' + n.FundCode + '</td>';
html1_4 += '<td><div class="ellipsis" title="' + n.FundName + '">' + n.FundName + '</div></td>';
html1_4 += '<td>' + n.FundType + '</td>';
html1_4 += '<td>' + n.YearlyEarningsRate + '%</td>';
if (n.NAV == 0) {
html1_4 += '<td>--</td>';
} else {
html1_4 += '<td>' + n.NAV.toMyFixed(4) + '</td>';
}
if (n.InvestmentType == "定期定额投资") {
html1_4 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',1)" >按月定投</a></div></td>';
} else {
html1_4 += '<td><div class="ellipsis" >一次性购买</div></td>';
}
html1_4 += ' <td>' + n.FundInvestmentAllMoney.toMyFixed(2) + '</td>';
html1_4 += ' <td><a style="color:#0e8ae5;" onclick="FundDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_4 += '</tr>';
}
});
var html = '';
if (list.length > 0) {
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (html1_1 != '') {
$("#jichujijin_" + ind + "").html(html1 + html1_1 + html);
}
if (html1_2 != '') {
$("#baozhijijin_" + ind + "").html(html1 + html1_2 + html);
}
if (html1_3 != '') {
$("#zengzhijijin_" + ind + "").html(html1 + html1_3 + html);
}
if (html1_4 != '') {
$("#toujijijin_" + ind + "").html(html1 + html1_4 + html);
}
});
}
//银行数据加载
function CreateHtml2() {
var html1 = '';
var list = BankList.GetList();
if (list.length > 0) {
html1 += ' <h4>银行产品</h3>';
html1 += '<div class="table textc" style="margin-bottom:10px;">';
html1 += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html1 += ' <thead>';
html1 += ' <tr>';
html1 += '<th width="14%" scope="col">银行名称</th>';
html1 += '<th width="9%" scope="col">存款币种</th>';
html1 += '<th width="9%" scope="col">存款类型</th>';
html1 += '<th width="9%" scope="col">存期</th>';
html1 += ' <th width="15%" scope="col">年利率(%</th>';
html1 += ' <th width="13%" scope="col">存款金额</th>';
html1 += '<th width="6%" scope="col">操作</th>';
html1 += '</tr>';
html1 += '</thead>';
html1 += ' <tbody>';
}
$("div[eacflag='ProductSelect']").each(function (a, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
var html1_1 = '';
var html1_2 = '';
var html1_3 = '';
var html1_4 = '';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == 1 && n.index == ind) {
html1_1 += '<tr>';
html1_1 += '<td><div class="ellipsis" title="' + n.BankName + '">' + n.BankName + '</div></td>';
html1_1 += '<td><div class="ellipsis" title="' + n.Currency + '">' + n.Currency + '</div></td>';
html1_1 += '<td>' + n.DepositType + '</td>';
if (n.DepositType == "活期") {
html1_1 += '<td>--</td>';
} else {
html1_1 += '<td>' + n.DepositTime + '</td>';
}
html1_1 += '<td>' + n.YearRate.toMyFixed(4) + '</td>';
html1_1 += '<td>' + n.DepositMoney.toMyFixed(2) + '</td>';
html1_1 += ' <td><a style="color:#0e8ae5;" onclick="BankDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_1 += '</tr>';
}
if (n.ProductSelectType == 2 && n.index == ind) {
html1_2 += '<tr>';
html1_2 += '<td><div class="ellipsis" title="' + n.BankName + '">' + n.BankName + '</div></td>';
html1_2 += '<td><div class="ellipsis" title="' + n.Currency + '">' + n.Currency + '</div></td>';
html1_2 += '<td>' + n.DepositType + '</td>';
if (n.DepositType == "活期") {
html1_2 += '<td>--</td>';
} else {
html1_2 += '<td>' + n.DepositTime + '</td>';
}
html1_2 += '<td>' + n.YearRate.toMyFixed(4) + '</td>';
html1_2 += '<td>' + n.DepositMoney.toMyFixed(2) + '</td>';
html1_2 += ' <td><a style="color:#0e8ae5;" onclick="BankDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_2 += '</tr>';
}
if (n.ProductSelectType == 3 && n.index == ind) {
html1_3 += '<tr>';
html1_3 += '<td><div class="ellipsis" title="' + n.BankName + '">' + n.BankName + '</div></td>';
html1_3 += '<td><div class="ellipsis" title="' + n.Currency + '">' + n.Currency + '</div></td>';
html1_3 += '<td>' + n.DepositType + '</td>';
if (n.DepositType == "活期") {
html1_3 += '<td>--</td>';
} else {
html1_3 += '<td>' + n.DepositTime + '</td>';
}
html1_3 += '<td>' + n.YearRate.toMyFixed(4) + '</td>';
html1_3 += '<td>' + n.DepositMoney.toMyFixed(2) + '</td>';
html1_3 += ' <td><a style="color:#0e8ae5;" onclick="BankDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_3 += '</tr>';
}
if (n.ProductSelectType == 4 && n.index == ind) {
html1_4 += '<tr>';
html1_4 += '<td><div class="ellipsis" title="' + n.BankName + '">' + n.BankName + '</div></td>';
html1_4 += '<td><div class="ellipsis" title="' + n.Currency + '">' + n.Currency + '</div></td>';
html1_4 += '<td>' + n.DepositType + '</td>';
if (n.DepositType == "活期") {
html1_4 += '<td>--</td>';
} else {
html1_4 += '<td>' + n.DepositTime + '</td>';
}
html1_4 += '<td>' + n.YearRate.toMyFixed(4) + '</td>';
html1_4 += '<td>' + n.DepositMoney.toMyFixed(2) + '</td>';
html1_4 += ' <td><a style="color:#0e8ae5;" onclick="BankDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_4 += '</tr>';
}
});
var html = '';
if (list.length > 0) {
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (html1_1 != '') {
$("#jichubank_" + ind + "").html(html1 + html1_1 + html);
}
if (html1_2 != '') {
$("#baozhibank_" + ind + "").html(html1 + html1_2 + html);
}
if (html1_3 != '') {
$("#zengzhibank_" + ind + "").html(html1 + html1_3 + html);
}
if (html1_4 != '') {
$("#toujibank_" + ind + "").html(html1 + html1_4 + html);
}
});
}
//P2P数据加载
function CreateHtml3() {
var html1 = '';
var list = P2PList.GetList();
if (list.length > 0) {
html1 += ' <h4>P2P产品</h3>';
html1 += '<div class="table textc" style="margin-bottom:10px;">';
html1 += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html1 += ' <thead>';
html1 += ' <tr>';
html1 += '<th width="14%" scope="col">产品名称</th>';
html1 += '<th width="10%" scope="col">所属平台</th>';
html1 += '<th width="13%" scope="col">投资周期(月)</th>';
html1 += '<th width="13%" scope="col">预期收益率(%</th>';
html1 += '<th width="13%" scope="col">投资金额(元)</th>';
html1 += '<th width="5%" scope="col">操作</th>';
html1 += '</tr>';
html1 += '</thead>';
html1 += ' <tbody>';
}
$("div[eacflag='ProductSelect']").each(function (a, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
var html1_1 = '';
var html1_2 = '';
var html1_3 = '';
var html1_4 = '';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == 1 && n.index == ind) {
html1_1 += '<tr>';
html1_1 += '<td><div class="ellipsis" title="' + n.P2PName + '">' + n.P2PName + '</div></td>';
html1_1 += '<td><div class="ellipsis" title="' + n.InvestmentField + '">' + n.InvestmentField + '</div></td>';
html1_1 += '<td>' + n.InvestmentCycle + '</td>';
html1_1 += '<td>' + n.EarningsRate + '</td>';
html1_1 += ' <td>' + n.P2PInvestmentMoney.toMyFixed(2) + '</td>';
html1_1 += ' <td><a style="color:#0e8ae5;" onclick="P2PDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_1 += '</tr>';
}
if (n.ProductSelectType == 2 && n.index == ind) {
html1_2 += '<tr>';
html1_2 += '<td><div class="ellipsis" title="' + n.P2PName + '">' + n.P2PName + '</div></td>';
html1_2 += '<td><div class="ellipsis" title="' + n.InvestmentField + '">' + n.InvestmentField + '</div></td>';
html1_2 += '<td>' + n.InvestmentCycle + '</td>';
html1_2 += '<td>' + n.EarningsRate + '</td>';
html1_2 += ' <td>' + n.P2PInvestmentMoney.toMyFixed(2) + '</td>';
html1_2 += ' <td><a style="color:#0e8ae5;" onclick="P2PDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_2 += '</tr>';
}
if (n.ProductSelectType == 3 && n.index == ind) {
html1_3 += '<tr>';
html1_3 += '<td><div class="ellipsis" title="' + n.P2PName + '">' + n.P2PName + '</div></td>';
html1_3 += '<td><div class="ellipsis" title="' + n.InvestmentField + '">' + n.InvestmentField + '</div></td>';
html1_3 += '<td>' + n.InvestmentCycle + '</td>';
html1_3 += '<td>' + n.EarningsRate + '</td>';
html1_3 += ' <td>' + n.P2PInvestmentMoney.toMyFixed(2) + '</td>';
html1_3 += ' <td><a style="color:#0e8ae5;" onclick="P2PDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_3 += '</tr>';
}
if (n.ProductSelectType == 4 && n.index == ind) {
html1_4 += '<tr>';
html1_4 += '<td><div class="ellipsis" title="' + n.P2PName + '">' + n.P2PName + '</div></td>';
html1_4 += '<td><div class="ellipsis" title="' + n.InvestmentField + '">' + n.InvestmentField + '</div></td>';
html1_4 += '<td>' + n.InvestmentCycle + '</td>';
html1_4 += '<td>' + n.EarningsRate + '</td>';
html1_4 += ' <td>' + n.P2PInvestmentMoney.toMyFixed(2) + '</td>';
html1_4 += ' <td><a style="color:#0e8ae5;" onclick="P2PDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_4 += '</tr>';
}
});
var html = '';
if (list.length > 0) {
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (html1_1 != '') {
$("#jichuP2P_" + ind + "").html(html1 + html1_1 + html);
}
if (html1_2 != '') {
$("#baozhiP2P_" + ind + "").html(html1 + html1_2 + html);
}
if (html1_3 != '') {
$("#zengzhiP2P_" + ind + "").html(html1 + html1_3 + html);
}
if (html1_4 != '') {
$("#toujiP2P_" + ind + "").html(html1 + html1_4 + html);
}
});
}
//保险数据加载
function CreateHtml4() {
var html1 = '';
var list = InsuranceList.GetList();
if (list.length > 0) {
html1 += ' <h4>保险产品</h3>';
html1 += '<div class="table textc" style="margin-bottom:10px;">';
html1 += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html1 += ' <thead>';
html1 += ' <tr>';
html1 += ' <th width="8%" scope="col">被保险人</th>';
html1 += ' <th width="11%" scope="col">险种类别</th>';
html1 += '<th width="10%" scope="col">产品名称</th>';
html1 += '<th width="15%" scope="col">保险金额(万元)</th>';
html1 += '<th width="8%" scope="col">保险期间</th>';
html1 += ' <th width="8%" scope="col">缴费方式</th>';
html1 += ' <th width="13%" scope="col">年缴保费(元)</th>';
html1 += '<th width="5%" scope="col">操作</th>';
html1 += '</tr>';
html1 += '</thead>';
html1 += ' <tbody>';
}
$("div[eacflag='ProductSelect']").each(function (a, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
var html1_1 = '';
var html1_2 = '';
var html1_3 = '';
var html1_4 = '';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == 1 && n.index == ind) {
html1_1 += '<tr>';
html1_1 += '<td><div class="ellipsis" title="' + n.Theinsured + '">' + n.Theinsured + '</div></td>';
html1_1 += '<td><div class="ellipsis" title="' + n.InsuranceType2 + '">' + n.InsuranceType2 + '</div></td>';
html1_1 += '<td><div class="ellipsis" title="' + n.InsuranceName + '">' + n.InsuranceName + '</div></td>';
html1_1 += '<td>' + n.InsuranceMoney + '</td>';
html1_1 += '<td>' + n.InsuranceTime + '</td>';
html1_1 += ' <td>' + n.ChargeType + '</td>';
html1_1 += ' <td>' + n.AnnualPremium.toMyFixed(2) + '</td>';
html1_1 += ' <td><a style="color:#0e8ae5;" onclick="InsuranceDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_1 += '</tr>';
}
if (n.ProductSelectType == 2 && n.index == ind) {
html1_2 += '<tr>';
html1_2 += '<td><div class="ellipsis" title="' + n.Theinsured + '">' + n.Theinsured + '</div></td>';
html1_2 += '<td><div class="ellipsis" title="' + n.InsuranceType2 + '">' + n.InsuranceType2 + '</div></td>';
html1_2 += '<td><div class="ellipsis" title="' + n.InsuranceName + '">' + n.InsuranceName + '</div></td>';
html1_2 += '<td>' + n.InsuranceMoney + '</td>';
html1_2 += '<td>' + n.InsuranceTime + '</td>';
html1_2 += ' <td>' + n.ChargeType + '</td>';
html1_2 += ' <td>' + n.AnnualPremium.toMyFixed(2) + '</td>';
html1_2 += ' <td><a style="color:#0e8ae5;" onclick="InsuranceDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_2 += '</tr>';
}
if (n.ProductSelectType == 3 && n.index == ind) {
html1_3 += '<tr>';
html1_3 += '<td><div class="ellipsis" title="' + n.Theinsured + '">' + n.Theinsured + '</div></td>';
html1_3 += '<td><div class="ellipsis" title="' + n.InsuranceType2 + '">' + n.InsuranceType2 + '</div></td>';
html1_3 += '<td><div class="ellipsis" title="' + n.InsuranceName + '">' + n.InsuranceName + '</div></td>';
html1_3 += '<td>' + n.InsuranceMoney + '</td>';
html1_3 += '<td>' + n.InsuranceTime + '</td>';
html1_3 += ' <td>' + n.ChargeType + '</td>';
html1_3 += ' <td>' + n.AnnualPremium.toMyFixed(2) + '</td>';
html1_3 += ' <td><a style="color:#0e8ae5;" onclick="InsuranceDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_3 += '</tr>';
}
if (n.ProductSelectType == 4 && n.index == ind) {
html1_4 += '<tr>';
html1_4 += '<td><div class="ellipsis" title="' + n.Theinsured + '">' + n.Theinsured + '</div></td>';
html1_4 += '<td><div class="ellipsis" title="' + n.InsuranceType2 + '">' + n.InsuranceType2 + '</div></td>';
html1_4 += '<td><div class="ellipsis" title="' + n.InsuranceName + '">' + n.InsuranceName + '</div></td>';
html1_4 += '<td>' + n.InsuranceMoney + '</td>';
html1_4 += '<td>' + n.InsuranceTime + '</td>';
html1_4 += ' <td>' + n.ChargeType + '</td>';
html1_4 += ' <td>' + n.AnnualPremium.toMyFixed(2) + '</td>';
html1_4 += ' <td><a style="color:#0e8ae5;" onclick="InsuranceDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_4 += '</tr>';
}
});
var html = '';
if (list.length > 0) {
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (html1_1 != '') {
$("#jichuInsurance_" + ind + "").html(html1 + html1_1 + html);
}
if (html1_2 != '') {
$("#baozhiInsurance_" + ind + "").html(html1 + html1_2 + html);
}
if (html1_3 != '') {
$("#zengzhiInsurance_" + ind + "").html(html1 + html1_3 + html);
}
if (html1_4 != '') {
$("#toujiInsurance_" + ind + "").html(html1 + html1_4 + html);
}
});
}
//黄金数据加载
function CreateHtml5() {
var html1 = '';
var list = GoldList.GetList();
if (list.length > 0) {
html1 += '<h4>实物黄金</h3>';
html1 += '<div class="table textc" style="margin-bottom:10px;">';
html1 += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
html1 += ' <thead>';
html1 += ' <tr>';
html1 += '<th width="16%" scope="col">投资总额(元)</th>';
html1 += '<th width="14%" scope="col">购买方式</th>';
html1 += '<th width="15%" scope="col">近一年收益率(%</th>';
html1 += '<th width="11%" scope="col">操作</th>';
html1 += '</tr>';
html1 += '</thead>';
html1 += ' <tbody>';
}
$("div[eacflag='ProductSelect']").each(function (a, dom) {
var DivId = $(dom).attr("id");
var obj = DivId.split('_');
var ind = obj[1];
var guihuaText = $("#guihua_" + ind + "").val();
var html1_1 = '';
var html1_2 = '';
var html1_3 = '';
var html1_4 = '';
$(list).each(function (i, n) {
//判断这个数据是那个产品层的
if (n.ProductSelectType == 1 && n.index == ind) {
html1_1 += '<tr>';
//定投金额=每期金额*总期数; 其中,总期数 = 投资年限 * 12
var money = 0;
if (n.GoldBuyType == "单笔购买") {
money = (n.GoldInvestMoney);
money = Number(money).toMyFixed(2);
html1_1 += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html1_1 += '<td><div class="ellipsis" >单笔购买</div></td>';
} else {
money = n.GoldInvestMoney * n.GoldInvestDate * 12;
html1_1 += '<td><div class="ellipsis" title="' + money + '">' + money.toMyFixed(2) + '</div></td>';
html1_1 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',2)">按月定投</a></div></td>';
}
//近一年收益率(%
html1_1 += '<td>' + Number(n.NearAnnualYield).toMyFixed(2) + '</td>';
html1_1 += ' <td><a style="color:#0e8ae5;" onclick="GoldDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_1 += '</tr>';
}
if (n.ProductSelectType == 2 && n.index == ind) {
html1_2 += '<tr>';
//定投金额=每期金额*总期数; 其中,总期数 = 投资年限 * 12
var money = 0;
if (n.GoldBuyType == "单笔购买") {
money = (n.GoldInvestMoney);
money = Number(money).toMyFixed(2);
html1_2 += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html1_2 += '<td><div class="ellipsis" >单笔购买</div></td>';
} else {
money = n.GoldInvestMoney * n.GoldInvestDate * 12;
html1_2 += '<td><div class="ellipsis" title="' + money + '">' + money.toMyFixed(2) + '</div></td>';
html1_2 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',2)">按月定投</a></div></td>';
}
//近一年收益率(%
html1_2 += '<td>' + Number(n.NearAnnualYield).toMyFixed(2) + '</td>';
html1_2 += ' <td><a style="color:#0e8ae5;" onclick="GoldDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_2 += '</tr>';
}
if (n.ProductSelectType == 3 && n.index == ind) {
html1_3 += '<tr>';
//定投金额=每期金额*总期数; 其中,总期数 = 投资年限 * 12
var money = 0;
if (n.GoldBuyType == "单笔购买") {
money = (n.GoldInvestMoney);
money = Number(money).toMyFixed(2);
html1_3 += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html1_3 += '<td><div class="ellipsis" >单笔购买</div></td>';
} else {
money = n.GoldInvestMoney * n.GoldInvestDate * 12;
html1_3 += '<td><div class="ellipsis" title="' + money + '">' + money.toMyFixed(2) + '</div></td>';
html1_3 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',2)">按月定投</a></div></td>';
}
//近一年收益率(%
html1_3 += '<td>' + Number(n.NearAnnualYield).toMyFixed(2) + '</td>';
html1_3 += ' <td><a style="color:#0e8ae5;" onclick="GoldDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_3 += '</tr>';
}
if (n.ProductSelectType == 4 && n.index == ind) {
html1_4 += '<tr>';
//定投金额=每期金额*总期数; 其中,总期数 = 投资年限 * 12
var money = 0;
if (n.GoldBuyType == "单笔购买") {
money = (n.GoldInvestMoney);
money = Number(money).toMyFixed(2);
html1_4 += '<td><div class="ellipsis" title="' + money + '">' + money + '</div></td>';
html1_4 += '<td><div class="ellipsis" >单笔购买</div></td>';
} else {
money = n.GoldInvestMoney * n.GoldInvestDate * 12;
html1_4 += '<td><div class="ellipsis" title="' + money + '">' + money.toMyFixed(2) + '</div></td>';
html1_4 += '<td><div class="ellipsis" ><a style="text-decoration:underline;" href="javascript: popMonthCast(' + n.Id + ',2)">按月定投</a></div></td>';
}
//近一年收益率(%
html1_4 += '<td>' + Number(n.NearAnnualYield).toMyFixed(2) + '</td>';
html1_4 += ' <td><a style="color:#0e8ae5;" onclick="GoldDelete(' + n.Id + ',' + n.ProductSelectType + ',' + n.index + ',this)" href="javascript:void(0)">删除</a></td>';
html1_4 += '</tr>';
}
});
var html = '';
if (list.length > 0) {
html += ' </tbody>';
html += '</table>';
html += '</div>';
}
if (html1_1 != '') {
$("#jichuGold_" + ind + "").html(html1 + html1_1 + html);
}
if (html1_2 != '') {
$("#baozhiGold_" + ind + "").html(html1 + html1_2 + html);
}
if (html1_3 != '') {
$("#zengzhiGold_" + ind + "").html(html1 + html1_3 + html);
}
if (html1_4 != '') {
$("#toujiGold_" + ind + "").html(html1 + html1_4 + html);
}
});
}
//加号添加产品选择
function AddList2(index, dom) {
var trHtml = "";
trHtml += '<div class="item b-grayish Tageach" id="ProductSelect_' + index + '" eacflag="ProductSelect">';
trHtml += '<div class="fif-con mb10">';
trHtml += ' <div class="fif-box grid-4" style="float:left;width:25%">';
trHtml += '<label class="fif-text"><i class="c-red">*</i>规划目标:</label>';
trHtml += ' <div class="input" >';
trHtml += '<select id="guihua_' + index + '" class="guihua IsRequired" msgname="规划目标">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">教育规划</option>';
trHtml += '<option value="2">消费规划</option>';
trHtml += '<option value="3">创业规划</option>';
trHtml += ' <option value="4">退休规划</option>';
trHtml += '<option value="5">保险规划</option>';
trHtml += '</select>';
trHtml += ' </div>';
trHtml += ' </div>';
trHtml += '<div class="fif-box" style="float:left;width:72%" id="tabT_' + index + '">';
if (dom.PlanId == 5) {
trHtml += '<div class="fif-box" style="width:49%">';
trHtml += '<label class="fif-text"><i class="c-red">*</i>方案保险需求额度:</label>';
trHtml += '<div class="input"><input type="text" id="planLimit_' + index + '" style="width:75%" eacflag="planLimit" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
trHtml += ' </div>';
trHtml += ' <div class="fif-box" style="width:49%">';
trHtml += '<label class="fif-text"><i class="c-red">*</i>方案保险费用预算:</label>';
trHtml += ' <div class="input"><input type="text" id="planBudget_' + index + '" style="width:75%" eacflag="planBudget" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
trHtml += ' </div>';
} else {
trHtml += ' <div class="fif-box" style="width:75%">';
trHtml += ' <label class="fif-text">方案所需投资收益率(年化):</label>';
trHtml += ' <div class="input"><input type="text" id="investRate_' + index + '" class="ipt-text grid-12 disabled" style="width:50%;" disabled>&nbsp;%</div>';
trHtml += '</div>';
}
trHtml += ' </div> ';
trHtml += ' <a class="spr spr-del js_remove fr" style="margin-top:5px;" onclick="javascript: DelcloseProduct(this,' + index + ')" href="javascript:void(0)"></a>';
trHtml += '</div>';
trHtml += ' <div class="table">';
//基础层
trHtml += '<table class="mb10" width="100%" id="jichu_' + index + '" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += ' <tr>';
trHtml += '<td width="83" rowspan="2" align="center" style="background-color: #92ccfb" class="c-white">基础层</td>';
trHtml += ' </tr>';
trHtml += ' <tr>';
trHtml += ' <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += ' <select id="jichuceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += ' </div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('1','jichuceng_" + index + "')\" id=\"jichucengId" + index + "\" value=\"添 加\">";
trHtml += '</div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="jichujijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="jichubank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="jichuP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="jichuInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="jichuGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//保值层
trHtml += '<table class="mb10" id="baozhi_' + index + '" width="100%" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += '<tr> <td width="83" rowspan="2" align="center" style="background-color: #62b3f5" class="c-white">保值层</td></tr>';
trHtml += ' <tr> <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += '<select id="baozhiceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += '</div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('2','baozhiceng_" + index + "')\" id=\"baozhicengId" + index + "\" value=\"添 加\">";
trHtml += ' </div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="baozhijijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="baozhibank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="baozhiP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="baozhiInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="baozhiGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//增值层
trHtml += '<table class="mb10" width="100%" id="zengzhi_' + index + '" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += '<tr> <td width="83" rowspan="2" align="center" style="background-color: #2a91e7" class="c-white">增值层</td></tr>';
trHtml += ' <tr> <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += '<select id="zengzhiceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += '</div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('3','zengzhiceng_" + index + "')\" id=\"zengzhicengId" + index + "\" value=\"添 加\">";
trHtml += ' </div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="zengzhijijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="zengzhibank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="zengzhiP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="zengzhiInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="zengzhiGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//投机层
trHtml += '<table class="mb10" width="100%" id="touji_' + index + '" border="0" cellspacing="0" cellpadding="0">';
trHtml += ' <tbody>';
trHtml += '<tr> <td width="83" rowspan="2" align="center" style="background-color: #076cc1" class="c-white">投机层</td></tr>';
trHtml += ' <tr> <td>';
trHtml += '<div class="fif-con">';
trHtml += ' <div class="fif-box grid-4" style="width:350px">';
trHtml += ' <label class="fif-text">产品类型:</label>';
trHtml += '<div class="input">';
trHtml += '<select id="toujiceng_' + index + '">';
trHtml += '<option value="0">请选择</option>';
trHtml += ' <option value="1">基金产品</option>';
trHtml += '<option value="2">银行储蓄</option>';
trHtml += '<option value="3">P2P产品</option>';
trHtml += ' <option value="4">保险产品</option>';
trHtml += '<option value="5">实物黄金</option>';
trHtml += '</select>';
trHtml += '</div>';
trHtml += " <input class=\"btn btn-small btn-blue fr ml10 LookFor\" type=\"button\" onclick=\"LookForProduct('4','toujiceng_" + index + "')\" id=\"toujicengId" + index + "\" value=\"添 加\">";
trHtml += ' </div>';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="toujijijin_' + (index) + '">';
trHtml += ' </div>';
trHtml += '<div class="selected-list" id="toujibank_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="toujiP2P_' + (index) + '">';
trHtml += ' </div>';
trHtml += ' <div class="selected-list" id="toujiInsurance_' + (index) + '">';
trHtml += '</div>';
trHtml += '<div class="selected-list" id="toujiGold_' + (index) + '">';
trHtml += '</div>';
trHtml += ' </td>';
trHtml += '</tr>';
trHtml += '</tbody>';
trHtml += '</table>';
//
trHtml += '</div>';
trHtml += '<div class="fif-con" id="tabW_' + (index) + '">';
if (dom.PlanId == 5) {
trHtml += '<div class="fif-box grid-5">';
trHtml += '<label class="fif-text">产品组合总保额:</label>';
trHtml += ' <div class="input"><input type="text" id="productInsured_' + index + '" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
trHtml += ' </div>';
trHtml += ' <div class="fif-box grid-5">';
trHtml += '<label class="fif-text">产品组合总保费:</label>';
trHtml += '<div class="input"><input type="text" id="productPremium_' + index + '" disabled="" class="ipt-text grid-12 disabled" value="0">&nbsp;元</div>';
trHtml += ' </div>';
}
else {
trHtml += '<div class="fif-box grid-5">';
trHtml += '<label class="fif-text">产品组合预期年化收益率:</label>';
trHtml += ' <div class="input"><input type="text" id="productRate_' + (index) + '" disabled="" class="ipt-text grid-12 disabled" value="">&nbsp;%</div>';
trHtml += ' </div>';
trHtml += ' <div class="fif-box grid-5">';
trHtml += '<label class="fif-text">产品组合总投资金额:</label>';
trHtml += '<div class="input"><input type="text" id="productMoney_' + (index) + '" disabled="" class="ipt-text grid-12 disabled" value="">&nbsp;元</div>';
trHtml += '</div>';
}
trHtml += '</div>';
trHtml += '</div>';
trHtml += '';
trHtml += '';
$("#Add").prev().after(trHtml);
$("#jichuceng_" + index + "").val(dom.PlanId);
}
//删除选择产品
function DelcloseProduct(obj, ind) {
$(obj).parent().parent().remove();
//删除集合
var Fund = FundList2.GetList();//基金数据集合
var P2P = P2PList.GetList();//P2P数据临时集合
var Bank = BankList.GetList();//银行数据集合
var Insurance = InsuranceList.GetList();//保险数据集合
var Gold = GoldList.GetList();//黄金数据集合
$(Fund).each(function (c, d) {
if (d.index == ind) {
FundList2.Remove(d.Id);
}
});
$(Bank).each(function (a, b) {
if (b.index == ind) {
BankList.Remove(b.Id);
}
});
$(P2P).each(function (e, f) {
if (f.index == ind) {
P2PList.Remove(f.Id);
}
});
$(Gold).each(function (g, h) {
if (h.index == ind) {
GoldList.Remove(h.Id);
}
});
$(Insurance).each(function (i, j) {
if (j.index == ind) {
InsuranceList.Remove(j.Id);
}
});
}
//给增值曾添加星号
function AddStarSpan(flagDiv, strDiv) {
//HedgeDiv 保值层 AddStar 增值层 SpeculateDiv 投机层
$("#FinanceInvestmentPlanDiv tbody tr td[eacflag='" + flagDiv + "']").each(function () {
$(this).html("<span class=\"c-red\" style=\"padding:5px 2px 0px 0px\">*</span><span>" + strDiv + "</span>");
});
};
//去除增值层中的星号
function ClearStarSpan(flagDiv, strDiv) {
$("#FinanceInvestmentPlanDiv tbody tr td[eacflag='" + flagDiv + "']").each(function () {
$(this).html("<span>" + strDiv + "</span>");
});
}