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

291 lines
11 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("SupplementOrder", "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:310px">
<input type="text" name="mobile" id="mobile" />
</td>
<td width="120px">
</td>
</tr>
<tr>
<td style="width:120px;">
客户姓名
</td>
<td style="width:310px">
<input type="text" name="cname" id="cname" value="@ViewBag.cname" />
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
客服工号
</td>
<td style="width:310px">
<input type="text" name="eid" id="eid" />
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
订单号
</td>
<td style="width:310px">
<input type="text" name="szzyOrderId" id="szzyOrderId" />
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
订单类型
</td>
<td style="width:310px">
<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 width="120px"></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 style="width:120px;">
客户来源
</td>
<td style="width:310px">
<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 width="120px"></td>
</tr>
@*<tr>
<td style="width:152px;">
定金编号
</td>
<td style="width:383px">
<input readonly="readonly" value="" id="prepaymentIds" name="prepaymentIds" /> <input type="button" onclick="ChoosePrepayment()" value="选择定金支付" />
</td>
<td width="120px"></td>
</tr>*@
</table>
<table id="customerSource" style="display:none;margin-bottom:0px" class="fromEditTable ">
<tr>
<td style="width:152px;">
客户微信用户名
</td>
<td style="width:383px">
<input disabled value="" id="wxUserName" />
@Html.HiddenFor(m => m.CUSTOMERUSERNAME, new { style = "width:200px;" }) <input type="button" onclick="ChooseCustomerWx()" value="选择微信用户" />
</td>
<td width="120px"></td>
</tr>
</table>
<table id="upgradeOrderShow" style="display:none;" class="fromEditTable ">
<tr>
<td style="width:152px;">
订单升级源CRM订单号列表
</td>
<td style="width:383px">
<textarea name="UPGRADEORDERIDS" id="UPGRADEORDERIDS" rows="5" style="width:250px" onblur="getOrderLeftValue(this.value)"></textarea>
</td>
<td width="120px">以逗号分隔</td>
</tr>
<tr>
<td style="width:120px;">
原订单剩余金额
</td>
<td style="width:310px">
<input type="text" name="TOTALUPGRADEVALUE" id="TOTALUPGRADEVALUE" />
</td>
<td width="120px"></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/SupplementOrder",
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;
});
});
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++;
}, "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);
}
}, "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?eid=" + $('#eid').val().trim()));
}
$("#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>