ComplianceServer/oldcode/WEB/Views/WeiXin/SzzyOrder/Add.cshtml

358 lines
12 KiB
Plaintext

@model WX.CRM.Model.Entity.WX_SZZYORDER
@using WX.CRM.WebHelper;
@{
ViewBag.Title = "订单录入";
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
}
<div class="mvctool bgb">
@Html.ToolButtonPlain("btnSave", "icon-save", "保存", false, "")
</div>
@using (Html.BeginForm("Add", "SzzyOrder", null, FormMethod.Post, new { Id = "CreateForm" }))
{
@Html.ValidationSummary(true)
<table class="fromEditTable" style="margin-bottom:0px">
<tr>
<td style="width:120px;">
客户手机号
</td>
<td style="width:420px">
<input type="text" name="mobile" id="mobile" />
</td>
<td width="100px">
</td>
</tr>
<tr>
<td>
客户姓名
</td>
<td>
<input type="text" name="cname" id="cname" value="@ViewBag.cname" />
</td>
<td></td>
</tr>
<tr>
<td>
产品大类:
</td>
<td>
<select id="productId" name="productId" style="width:150px;height:22px" onChange="changeselect(this.value)">
<option value="0">--请选中产品大类--</option>
@foreach (var item in ViewBag.productList as List<SelectListItem>)
{
<option value="@item.Value">@item.Text</option>
}
</select>
</td>
<td>
</td>
</tr>
<tr>
<td>
产品小类:
</td>
<td>
<select id="subProductId" name="subProductId" style="width:220px;height:22px" onChange="changeSubProduct(this.value)">
<option value="0">--请选中产品小类--</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td>
订单类型
</td>
<td>
<select id="ORDERTYPE" name="ORDERTYPE" style="height:22px;" onChange="ordertypeselect(this.value)">
<option value="1">普通订单</option>
<option value="2">续费订单</option>
<option value="3">升级订单</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td>
应付金额
</td>
<td>
<input type="text" name="NEEdPAY" id="NEEdPAY" /> 应付金额=客户付款总金额(定金+余款)
</td>
<td></td>
</tr>
<tr>
<td>
售后电话服务归属
</td>
<td>
<select id="TEAMSERVE" name="TEAMSERVE" style="height:22px;">
@*<option value="0">总公司负责电话售后服务</option>*@
<option value="1" selected>分公司负责电话售后服务</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td>
订单归属
</td>
<td>
<select id="SALEDEPTID" name="SALEDEPTID" style="height:22px;">
@foreach (var item in ViewBag.SaleDeptList as List<SelectListItem>)
{
<option value="@item.Value" @(item.Selected?"selected":"")>@item.Text</option>
}
</select>
</td>
<td></td>
</tr>
<!--<tr>
<td>
是否同时开通订单
</td>
<td>
<select id="OPENORDER" name="OPENORDER" style="height:22px;">
<option value="0">否</option>
<option value="1">是</option>
</select>
</td>
<td></td>
</tr>-->
<tr>
<td>
备注
</td>
<td>
@Html.TextAreaFor(m => m.REMARK, new { style = "width:300px;height:40px" })
</td>
<td></td>
</tr>
<tr>
<td>
客户来源
</td>
<td>
<select id="SOURCE" name="SOURCE" style="height:22px;" onChange="sourceselect(this.value)">
<!--<option value="">请选择</option>-->
<option value="1">推广资源</option>
<option value="2">线下资源</option>
<option value="3">自找资源</option>
<option value="4">营销QQ</option>
<option value="5">公众号</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td>
定金编号
</td>
<td>
<input type="text" readonly="readonly" value="" id="prepaymentIds" name="prepaymentIds" /> <input type="button" onclick="ChoosePrepayment()" value="选择定金支付" />
</td>
<td></td>
</tr>
</table>
<table id="customerSource" class="fromEditTable" style="margin-bottom:0px">
<tr>
<td style="width:120px;">
客户微信用户名
</td>
<td style="width:420px">
<input disabled value="" id="wxUserName" />
@Html.HiddenFor(m => m.CUSTOMERUSERNAME, new { style = "width:200px;" }) <input type="button" onclick="ChooseCustomerWx()" value="选择微信用户" />
</td>
<td width="100px"></td>
</tr>
</table>
<table id="upgradeOrderShow" style="display:none" class="fromEditTable ">
<tr >
<td style="width:120px;">
订单升级源CRM订单号列表
</td>
<td style="width:420px">
<textarea name="UPGRADEORDERIDS" id="UPGRADEORDERIDS" rows="5" style="width:250px" onblur="getOrderLeftValue(this.value)"></textarea>
</td>
<td width="100px">以逗号分隔</td>
</tr>
<tr>
<td style="width:120px;">
原订单剩余金额
</td>
<td style="width:420px">
<input type="text" name="TOTALUPGRADEVALUE" id="TOTALUPGRADEVALUE" readonly/>
</td>
<td width="100px"></td>
</tr>
</table>
<div id="modalwindow" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
}
<script type="text/javascript">
var userNameRequired = "@ViewBag.userNameRequired";
$(function () {
$("#btnSave").click(function () {
if ($("#CreateForm").valid()) {
$.r_ajax({
url: "/WeiXin/SzzyOrder/Add",
type: "Post",
data: $("#CreateForm").serialize(),
dataType: "json",
loading: true,
success: function (data) {
if (data.type == 1) {
//window.parent.frameReturnByMes(data.message);
window.parent.frameReturnByMes('订单创建成功');
window.parent.frameReturnByReload(true);
//window.parent.frameReturnByClose();
window.location="/WeiXin/CommissionRule/Edit?orderid="+data.value;
}
else {
$.messager.alert("警告", data.message, "error");
}
}
});
}
return false;
});
$("#btnQuery").click(function () {
$('#tablist').tablegrid("Search");
});
/*$('#productId').val('20008');
changeselect('20008');*/
});
function changeselect(productId) {
var nb1defaultIndex = 0;
if (productId == 0) {
$("#subProductId").unbind();
$("#subProductId").html("<option value='0'>--请选中产品小类--</option>");
return;
}
$.r_post("/SzzyOrder/GetSubProductList?productId=" + productId, function (data) {
$("#subProductId").unbind();
$("#subProductId").html("<option value='0'>--请选中产品小类--</option>");
$(data).each(function (n, m) {
/*if (nb1defaultIndex == 0) {
$("#slt_subProductId").append("<option value='" + m.Value + "' selected='selected'>" + m.Text + "</option>");
}
else {*/
$("#subProductId").append("<option value='" + m.Value + "'>" + m.Text + "</option>");
//}
});
nb1defaultIndex++;
/*if(productId=='20008'){
changeSubProduct('80095');
}*/
}, "json");
}
function ordertypeselect(type) {
if (type == 3) {
$('#upgradeOrderShow').css('display', 'block');
} else {
$('#upgradeOrderShow').css('display', 'none');
}
}
function sourceselect(val) {
if (userNameRequired === "0") {
if (val == 1) {
$('#customerSource').css('display', 'block');
} else {
$('#CUSTOMERUSERNAME').val('');
$('#wxUserName').val('');
$('#customerSource').css('display', 'none');
}
}else {
$('#customerSource').css('display', 'block');
}
}
function changeSubProduct(subProductId) {
$.r_post("/SzzyOrder/GetSubProductPriceById?subProductId=" + subProductId, function (data) {
if (data.result) {
$("#NEEdPAY").val(data.price);
$('#subProductId').val(subProductId)
}
}, "json");
}
function selectPerpayment(ids) {
$('#prepaymentIds').val(ids);
}
function selectCustomerWx(userName) {
$('#wxUserName').val(userName);
$('#CUSTOMERUSERNAME').val(userName);
}
function ChooseCustomerWx() {
var type = $('#SOURCE').val();
if (type == 5) {
$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/OfficeAccountUserList"));
} else {
$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/RContactIndex"));
}
$("#modalwindow").window({ title: '选择客户微信', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
}
function ChoosePrepayment() {
var mobile = $('#mobile').val();
if (mobile == undefined || mobile == "") {
alert('请输入电话号码!');
return;
}
$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/PrepaymentList?mobile=" + mobile));
$("#modalwindow").window({ title: '选择定金', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
}
function getOrderLeftValue(val) {
$.r_post("/SzzyOrder/GetOrderLeftValue?oldOrderIds=" + val, function (data) {
if (data.type) {
var leftValue = parseFloat(data.message);
var needPay = parseFloat($('#NEEdPAY').val());
$("#NEEdPAY").val(needPay-leftValue);
$('#TOTALUPGRADEVALUE').val(data.message);
} else {
alert(data.message);
}
}, "json");
}
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function frameReturnByClose() {
$("#modalwindow").window('close');
}
</script>