ComplianceServer/oldcode/WEB/Views/WeiXin/JZOrder/Edit.cshtml

408 lines
15 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>
<form id="CreateForm" action="/WeiXin/JZOrder/Edit" method="post" enctype="multipart/form-data">
@Html.ValidationSummary(true)
<table class="fromEditTable ">
<tr>
<td style="width:120px;">
客户ID
</td>
<td style="width:310px">
@Model.RESID
@Html.HiddenFor(m => m.ORDERID)
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
产品大类:
</td>
<td style="width:310px">
<select id="productId" name="productId" style="width:150px;height:22px" onChange="changeselect(this.value)" disabled>
<option value="0">--请选中产品大类--</option>
@foreach (var item in ViewBag.productList as List<SelectListItem>)
{
<option value="@item.Value">@item.Text</option>
}
</select>
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
产品小类:
</td>
<td style="width:310px">
<select id="subProductId" name="subProductId" style="width:220px;height:22px" onChange="changeSubProduct(this.value)" disabled>
<option value="0">--请选中产品小类--</option>
</select>
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
订单类型
</td>
<td style="width:310px">
<select id="ORDERTYPE" name="ORDERTYPE" style="height:22px;">
<option value="1">普通订单</option>
<option value="2">续费订单</option>
<option value="3">升级订单</option>
</select>
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">
备注
</td>
<td style="width:310px">
@Html.TextAreaFor(m => m.REMARK, new { style = "width:300px;height:100px" })
</td>
<td width="120px"></td>
</tr>
<tr style="display:none;">
<td style="width:120px;">
开通天数
</td>
<td style="width:310px">
@Model.OPENDAYS
@Html.HiddenFor(m => m.OPENDAYS)
</td>
<td width="120px">@Html.ValidationMessageFor(m => m.OPENDAYS)</td>
</tr>
<tr>
<td style="width:120px;">
留&nbsp;&nbsp;痕
</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">自找资源</option>
@*<option value="6">企微推广</option>*@
</select>
</td>
<td width="120px"></td>
</tr>
<tr id="customerSource" style="display:none">
@{ bool fujian = ViewBag.ShowFuJian; }
<td style="width:152px;">
客户微信用户名:
<span style="display:none;">
<br /> 客户企微姓名:
</span>
<br />客户企微:
@if (fujian == true)
{
<br /><span>附件:</span>}
</td>
<td style="width:383px">
<input disabled value="" id="wxUserName" />
<input type="button" onclick="ChooseCustomerWx()" value="选择微信用户" />
@Html.HiddenFor(m => m.CUSTOMERUSERNAME)
<div style="display:none;">
<br />
<input disabled value="" id="qwUserName" />
<input type="button" onclick="ChooseCustomerQw()" value="选择企业微信" />
@Html.HiddenFor(m => m.WEWORK_REMOTEID)
</div>
<br />
<input disabled value="" id="wwUserName" />
<input type="button" onclick="ChooseCustomerWw()" value="选择付费企业微信" />
@Html.HiddenFor(m => m.EXTERNAL_USERID)
<input type="hidden" name="userid" id="userid" value="@Html.Raw(ViewBag.userid )" />
<input type="hidden" name="corpid" id="corpid" value="@Html.Raw(ViewBag.corpid )" />
<input id="FUJIAN" name="FUJIAN" value="@Html.Raw(Model.FUJIAN)" type="hidden" />
@if (fujian == true)
{
<input id="FileMobile" name="FileMobile" type="file" accept=".doc,.docx" />
}
@if (!string.IsNullOrEmpty(Model.FUJIAN))
{
<button id="ShowFuJian" onclick="window.open('ShowFuJian?fujian=@Html.Raw(Model.FUJIAN)')" type="button" class="layui-btn layui-btn-sm layui-btn-warm" title="查看已上传的附件">
<i class="layui-icon">&#xe655;</i> 查看已传附件
</button>
}
</td>
<td width="120px"></td>
</tr>
<tr>
<td>预计开通时间</td>
<td>
<input id="ESTIMATEOTIME" name="ESTIMATEOTIME" class="Wdate" type="text" value="@Html.Raw(!Model.ESTIMATEOTIME.HasValue?"": Model.ESTIMATEOTIME.Value.ToString("yyyy-MM-dd"))" onclick="WdatePicker()" realvalue="">
</td>
<td></td>
</tr>
@*<tr id="trQwSource" style="display:none;">
<td>客户企微姓名</td>
<td>
</td>
<td></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;"></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>
</form>
<script type="text/javascript">
$(function () {
$('#CreateForm').ajaxForm({
dataType: 'json',
beforeSend: ForEverajaxLoading,
complete: ForEverajaxLoadEnd,
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");
}
},
error: function () {
$.messager.alert("警告", "操作失败", "error");
}
});
$("#btnSave").click(function () {
if ($("#CreateForm").valid()) {
$('#CreateForm').submit();
//$.r_ajax({
// url: "/WeiXin/JZOrder/Edit",
// 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;
});
var productId = @Model.PRODUCTID;
var subProductId = @Model.SUBPRODUCTID;
var orderType = @Model.ORDERTYPE;
var source = '@Model.SOURCE';
$('#SOURCE').val(source);
if (source == '1') {
$('#wxUserName').val('@Model.CUSTOMERUSERNAME');
$('#qwUserName').val('@Model.WEWORK_REMOTEID');
$('#wwUserName').val('@Model.EXTERNAL_USERID');
$('#customerSource').show();
}
//var openOrder = @Model.OPENORDER;
$('#productId').val(productId);
$('#ORDERTYPE').val(orderType);
//$('#OPENORDER').val(openOrder);
//子类绑定
var nb1defaultIndex = 0;
$.r_post("/SzzyOrder/GetSubProductList?productId=" + productId, function (data) {
$("#subProductId").unbind();
$("#subProductId").html("<option value='0'>--请选中产品小类--</option>");
$(data).each(function (n, m) {
if (m.Value== subProductId) {
$("#subProductId").append("<option value='" + m.Value + "' selected='selected'>" + m.Text + "</option>");
}
else {
$("#subProductId").append("<option value='" + m.Value + "'>" + m.Text + "</option>");
}
});
nb1defaultIndex++;
}, "json");
});
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
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 (val == 1) {
$('#customerSource').show();
}
else {
$('#customerSource').hide();
}
$('#CUSTOMERUSERNAME').val('');
$('#WEWORK_REMOTEID').val('');
$('#EXTERNAL_USERID').val('');
$('#wxUserName').val('');
$('#qwUserName').val('');
$('#wwUserName').val('');
}
function changeSubProduct(subProductId) {
$.r_post("/SzzyOrder/GetSubProductPriceById?subProductId=" + subProductId, function (data) {
if (data.result) {
$("#NEEdPAY").val(data.price);
}
}, "json");
}
function selectCustomerWx(userName) {
$('#wxUserName').val(userName);
$('#CUSTOMERUSERNAME').val(userName);
}
function ChooseCustomerWx() {
var orderId = $("#ORDERID").val();
$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/RContactIndex?orderid=" + orderId));
$("#modalwindow").window({ title: '选择客户微信', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
}
function SelectCustomerQw(userName, userId) {
$('#qwUserName').val(userName);
$('#WEWORK_REMOTEID').val(userName);
if (userId != '') {
SelectCustomerWw(userId);
}
}
function ChooseCustomerQw() {
$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/WeWorkRcontact"));
$("#modalwindow").window({ title: '选择企业微信', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
}
function SelectCustomerWw(userName) {
$('#wwUserName').val(userName);
$('#EXTERNAL_USERID').val(userName);
}
function ChooseCustomerWw() {
var wwmessageurl = "@Html.Raw(ViewBag.WwMessage_Url)";
var companycode = "@Html.Raw(ViewBag.companycode)";
if (wwmessageurl.indexOf("$") > -1) {
wwmessageurl = wwmessageurl.split("$")[0];
}
if (wwmessageurl.indexOf("|") > -1) {//分内外网
var ssw = window.location.href;
if (ssw.indexOf("192.168.") > -1 || ssw.indexOf("localhost") > -1) {//内网无疑
wwmessageurl = wwmessageurl.split('|')[0];
} else {
wwmessageurl = wwmessageurl.split('|')[1];
}
}
$("#modalwindow").html(GetIframeHtml(wwmessageurl + "/Admin/OutHHuser/Choose?companycode=" + companycode));
$("#modalwindow").window({ title: '选择付费企业微信', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
//$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/WwExtuser"));
//$("#modalwindow").window({ title: '选择付费企业微信', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
}
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function frameReturnByClose() {
$("#modalwindow").window('close');
}
</script>
<script>
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
console.log("收到消息了,该死的");
console.log(event.data);
var mydata = event.data;
if (mydata.type == "choose") {
$('#wwUserName').val(mydata.extuserid);
$('#userid').val(mydata.userid);
$('#corpid').val(mydata.corpid);
$('#EXTERNAL_USERID').val(mydata.extuserid);
}
frameReturnByClose();
}
</script>