TG.WXCRM.V4/WEB/Views/QH/CommissionApply/Edit.cshtml

272 lines
12 KiB
Plaintext

@model WX.CRM.Model.QueryMap.QHCommissionRuleInfo
@using WX.CRM.WebHelper;
@{
ViewBag.Title = "佣金分成编辑";
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
}
<style type="text/css">
table tr td {
height: 25px;
}
table tr td li {
height: 25px;
}
.text_right {
text-align: right;
}
.width120 {
width: 120px;
}
.width200 {
width: 200px;
}
#saleuser_ul0, #saleuser_ul1, #saleuser_ul2 {
float: left;
list-style: none;
font-size: 0;
}
#saleuser_ul0 li {
float: left;
width: 100%;
}
#saleuser_ul1 li, #saleuser_ul2 li {
float: left;
width: 370px;
}
#saleuser_ul0 li span, #saleuser_ul1 li span, #saleuser_ul2 li span {
font-size: 12px;
width: 120px;
text-align: right;
display: inline-block;
}
#saleuser_ul0 li span.percent, #saleuser_ul1 li span.percent, #saleuser_ul2 li span.percent {
font-size: 12px;
width: 5px;
display: inline;
}
#saleuser_ul0 li label, #saleuser_ul1 li label, #saleuser_ul2 li label {
font-size: 12px;
padding: 0 5px 0;
}
</style>
<script type="text/javascript">
$(function () {
$("#btnSave").click(function () {
if ($("#EditForm").valid()) {
$.r_ajax({
url: "/QH/CommissionApply/Edit",
type: "Post",
data: $("#EditForm").serialize(),
dataType: "json",
loading: true,
success: function (data) {
if (data.type == 1) {
window.parent.frameReturnByMes(data.message);
window.parent.frameReturnByReload(true);
window.parent.frameReturnByClose();
}
else {
window.parent.frameReturnByMes(data.message);
}
}
});
}
return false;
});
showUserName();
});
function intiDataByTradeCode(o) {
var isOwner = $("#isOwner").val();
var key = $(o).val();
$.getJSON("/QH/CommissionApply/InitDataByTradeCode?tradeCode=" + key + "&mySelf=" + isOwner, function (data) {
if (data.tradeStatus == 1) {
$("#userAccount").val(data.userAccount);
$("#userName").val(data.userName);
$("#sdDate").val(data.sdDateChar);
$("#edDate").val(data.edDateChar);
$("#item0_eid").val(data.item0.eid);
$("#item0_ratio").val(data.item0.ratio);
$("#item1_eid").val(data.item1.eid);
$("#item1_ratio").val(data.item1.ratio);
$("#item2_eid").val(data.item2.eid);
$("#item2_ratio").val(data.item2.ratio);
$("#item3_eid").val(data.item3.eid);
$("#item3_ratio").val(data.item3.ratio);
$("#item4_eid").val(data.item4.eid);
$("#item4_ratio").val(data.item4.ratio);
$("#item5_eid").val(data.item5.eid);
$("#item5_ratio").val(data.item5.ratio);
$("#item6_eid").val(data.item6.eid);
$("#item6_ratio").val(data.item6.ratio);
$("#item7_eid").val(data.item7.eid);
$("#item7_ratio").val(data.item7.ratio);
$("#item8_eid").val(data.item8.eid);
$("#item8_ratio").val(data.item8.ratio);
$("#btnSave").removeAttr("disabled");
showUserName();
} else {
$("#btnSave").attr("disabled", "disabled");
window.parent.frameReturnByMes(data.errStr);
}
});
}
function showUserName(obj) {
if (obj != null) {
var v = $(obj).val();
if (!IsNum(v)) {
return;
}
var c = 0;
$("table tr td li").each(function (i, j) {
if (v != "") {
if ($("#item" + i + "_eid").val() == v) {
c = c + 1;
}
}
});
if (c > 1) {
$("#btnSave").attr("disabled", true);
window.parent.frameReturnByMes("同一个工号只需填写一个分成");
return;
} else {
$("#btnSave").removeAttr("disabled");
}
};
$("table tr td li").each(function (i, j) {
var o = $(this).find("input").eq(0);
if (o != null && o != undefined && o.val() != "") {
$.ajax({
url: "/QH/CommissionApply/GetUserByEid?EID=" + o.val(),
dataType: "text",
loading: true,
success: function (data) {
if (data != "") {
//$("#item" + i + "_eid_username").text(data);
$(o).next().text(data);
} else {
o.val(o.val() + "?");
$("#EditForm").valid();
}
}
});
}
});
}
function IsNum(num) {
var reNum = /^\d*$/;
return (reNum.test(num));
}
</script>
@using (Html.BeginForm("Edit", "CommissionApply", null, FormMethod.Post, new { Id = "EditForm" }))
{
@Html.ValidationSummary(true)
<table align="center" style=" width:100%;">
<tr>
<td class="text_right width120">交易商代码:</td>
<td class="wid150">
@Html.TextBoxFor(m => m.userAccount, new { @style = "width:120px;", onchange = "intiDataByTradeCode(this,0)" })
@Html.ValidationMessageFor(m => m.userAccount)
@Html.HiddenFor(m => m.pkid, new { @Value = Model == null ? "0" : Model.pkid.ToString() })
@Html.HiddenFor(m => m.isOwner, new { @Value = Model == null ? "0" : Model.isOwner.ToString() })
</td>
<td class="text_right width120">交易商名称:</td>
<td class="wid150">@Html.TextBoxFor(m => m.userName, new { @style = "width:120px;", @disabled = "disabled" })</td>
<td class="wid100"><input id="btnSave" type="button" style="@Model.viewKey" value="保存" />&nbsp;&nbsp;<input id="Button1" type="button" value="关闭" onclick="window.parent.$('#dlg3').dialog('close')" /></td>
</tr>
<tr>
<td class="text_right width120">起止日期:</td>
<td>@Html.TextBoxFor(m => m.sdDate, new { @style = "width:120px;", @class = "Wdate", Value = String.Format("{0:yyyy-MM-dd}", Model.sdDate), onclick = "WdatePicker({dateFmt:'yyyy-MM-dd'})" })@Html.ValidationMessageFor(m => m.sdDate)</td>
<td>~</td>
<td>@Html.TextBoxFor(m => m.edDate, new { @style = "width:120px;", @class = "Wdate", Value = String.Format("{0:yyyy-MM-dd}", Model.edDate), onclick = "WdatePicker({dateFmt:'yyyy-MM-dd'})" })@Html.ValidationMessageFor(m => m.edDate)</td>
<td></td>
</tr>
<tr>
<td colspan="5">
<ul id="saleuser_ul0">
<li>
<span>经纪人工号:</span>
@Html.TextBoxFor(m => m.item0.eid, new { @style = "width:80px;", @ison = "1", onchange = "showUserName(this)" })
<label id="item0_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item0.ratio, new { @style = "width:40px;", @ison = "1" })<span class="percent">%</span>
</li>
</ul>
<ul id="saleuser_ul1">
<li>
<span>参与分成人员工号:</span>
@Html.TextBoxFor(m => m.item1.eid, new { @style = "width:80px;", @ison = "2", onchange = "showUserName(this)" })
<label id="item1_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item1.ratio, new { @style = "width:40px;", @ison = "2" })<span class="percent">%</span>
</li>
<li>
<span>需返还人员工号:</span>
@Html.TextBoxFor(m => m.item4.eid, new { @style = "width:80px;", @ison = "3", onchange = "showUserName(this)" })
<label id="item4_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item4.ratio, new { @style = "width:40px;", @ison = "3" })<span class="percent">%</span>
</li>
<li>
<span>参与分成人员工号:</span>
@Html.TextBoxFor(m => m.item2.eid, new { @style = "width:80px;", @ison = "2", onchange = "showUserName(this)" })
<label id="item2_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item2.ratio, new { @style = "width:40px;", @ison = "2" })<span class="percent">%</span>
</li>
<li>
<span>需返还人员工号:</span>
@Html.TextBoxFor(m => m.item5.eid, new { @style = "width:80px;", @ison = "3", onchange = "showUserName(this)" })
<label id="item5_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item5.ratio, new { @style = "width:40px;", @ison = "3" })<span class="percent">%</span>
</li>
<li>
<span>参与分成人员工号:</span>
@Html.TextBoxFor(m => m.item3.eid, new { @style = "width:80px;", @ison = "2", onchange = "showUserName(this)" })
<label id="item3_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item3.ratio, new { @style = "width:40px;", @ison = "2" })<span class="percent">%</span>
</li>
<li>
<span>需返还人员工号:</span>
@Html.TextBoxFor(m => m.item6.eid, new { @style = "width:80px;", @ison = "3", onchange = "showUserName(this)" })
<label id="item6_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item6.ratio, new { @style = "width:40px;", @ison = "3" })<span class="percent">%</span>
</li>
</ul>
<ul id="saleuser_ul2">
<li>
<span>操盘手工号:</span>
@Html.TextBoxFor(m => m.item7.eid, new { @style = "width:80px;", @ison = "4", onchange = "showUserName(this)" })
<label id="item7_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item7.ratio, new { @style = "width:40px;", @ison = "4" })<span class="percent">%</span>
</li>
<li>
<span>操盘手工号:</span>
@Html.TextBoxFor(m => m.item8.eid, new { @style = "width:80px;", @ison = "4", onchange = "showUserName(this)" })
<label id="item8_eid_username"></label>&nbsp;
比例:@Html.TextBoxFor(m => m.item8.ratio, new { @style = "width:40px;", @ison = "4" })<span class="percent">%</span>
</li>
</ul>
</td>
</tr>
<tr>
<td colspan="5">
@Html.ValidationMessageFor(m => m.item0.eid)@Html.ValidationMessageFor(m => m.item0.ratio)
@Html.ValidationMessageFor(m => m.item1.eid)@Html.ValidationMessageFor(m => m.item1.ratio)
@Html.ValidationMessageFor(m => m.item2.eid)@Html.ValidationMessageFor(m => m.item2.ratio)
@Html.ValidationMessageFor(m => m.item3.eid)@Html.ValidationMessageFor(m => m.item3.ratio)
@Html.ValidationMessageFor(m => m.item4.eid)@Html.ValidationMessageFor(m => m.item4.ratio)
@Html.ValidationMessageFor(m => m.item5.eid)@Html.ValidationMessageFor(m => m.item5.ratio)
@Html.ValidationMessageFor(m => m.item6.eid)@Html.ValidationMessageFor(m => m.item6.ratio)
@Html.ValidationMessageFor(m => m.item7.eid)@Html.ValidationMessageFor(m => m.item7.ratio)
@Html.ValidationMessageFor(m => m.item8.eid)@Html.ValidationMessageFor(m => m.item8.ratio)
</td>
</tr>
</table>
}