1582 lines
63 KiB
Plaintext
1582 lines
63 KiB
Plaintext
@model WX.CRM.Model.MAP.WX_SZZYORDER_Extend
|
||
@using WX.CRM.WebHelper;
|
||
@using WX.CRM.Model.Entity;
|
||
|
||
@{
|
||
ViewBag.Title = "订单录入";
|
||
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
|
||
|
||
}
|
||
<script src="~/Scripts/jquery.form.js"></script>
|
||
|
||
<div class="mvctool bgb">
|
||
@Html.ToolButtonPlain("btnSave", "icon-save", "保存", false, "")
|
||
</div>
|
||
<style>
|
||
.tdRight {
|
||
text-align: right;
|
||
}
|
||
|
||
.BorderErro {
|
||
border-color: red !important;
|
||
}
|
||
|
||
.formContent {
|
||
height: 100%;
|
||
}
|
||
|
||
#ul_deposit li {
|
||
line-height: 30px;
|
||
}
|
||
|
||
.settime {
|
||
width: 40%;
|
||
}
|
||
|
||
.select_user_box {
|
||
position: absolute;
|
||
overflow-x: hidden;
|
||
border-radius: 4px;
|
||
background-color: #fff;
|
||
height: 150px;
|
||
width: 193px;
|
||
border: 1px solid #e6e6e6;
|
||
padding: 2px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
z-index: 99;
|
||
}
|
||
|
||
.select_user_box p {
|
||
padding: 2px;
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.select_user_box p:hover {
|
||
background: #b9b9b9;
|
||
}
|
||
</style>
|
||
|
||
<form id="CreateForm" action="/WeiXin/JZOrder/AddAndPayInList" method="post" enctype="multipart/form-data">
|
||
@Html.ValidationSummary(true)
|
||
<table class="fromEditTable " style="width: auto;margin: 1px 10px;">
|
||
<thead>
|
||
<tr>
|
||
<th colspan="3">下单</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td style="width:130px;" class="tdRight">客户ID</td>
|
||
<td style="width:310px"><input type="text" name="resid" id="resid" value="@ViewBag.CustomerId" autocomplete="off" /><input onclick="SearchResid()" type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-border-blue" value="查找/注册" /></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">用户名</td>
|
||
<td>
|
||
<select name="SoftUserName" id="SoftUserName"> </select>
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
@if (ViewBag.DeptList != null)
|
||
{
|
||
<tr>
|
||
<td class="tdRight">部门归属</td>
|
||
<td>
|
||
<select id="deptcode" name="deptcode">
|
||
<option value="">请选择...</option>
|
||
@foreach (var item in ViewBag.DeptList as List<SelectListItem>)
|
||
{
|
||
<option value="@item.Value">@item.Text</option>
|
||
}
|
||
</select>
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
}
|
||
<tr>
|
||
<td class="tdRight">员工归属</td>
|
||
<td>
|
||
<input type="text" name="selectEId" id="selectEId" autocomplete="off">
|
||
<input type="hidden" id="eid" value="">
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">姓 名</td>
|
||
<td>@Html.TextBoxFor(m => m.Name)</td>
|
||
<td>@Html.ValidationMessageFor(m => m.Name)</td>
|
||
</tr>
|
||
<tr style="display:none">
|
||
<td class="tdRight">产品系列:</td>
|
||
<td>
|
||
<select id="productId" name="productId" style="width:150px;height:22px">
|
||
<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 class="tdRight">产品大类</td>
|
||
<td>
|
||
<select id="midProductId" name="midProductId" style="width:220px;height:22px" onChange="changeMidProduct(this.value)">
|
||
<option value="0">--请选中产品大类--</option>
|
||
@foreach (var item in ViewBag.midproductList as List<SelectListItem>)
|
||
{
|
||
<option value="@item.Value">@item.Text</option>
|
||
}
|
||
</select>
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">产品小类</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 class="tdRight">订单类型</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 class="tdRight">开通天数</td>
|
||
<td>
|
||
@*@if (ViewBag.DeptCode == "DNZZ")
|
||
{
|
||
<input type="text" id="OpenDays" name="OpenDays" value="" />
|
||
}
|
||
else
|
||
{
|
||
<span id="opendaystext" style="color:green;"></span><input type="hidden" id="curOpenDays" /> @Html.HiddenFor(m => m.OpenDays)
|
||
}*@
|
||
<span id="opendaystext" style="color:green;"></span><input type="text" id="opendays2" style="display:none;" /><input type="hidden" id="curOpenDays" /> @Html.HiddenFor(m => m.OpenDays)
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr style="display:none">
|
||
<td class="tdRight">售后电话服务归属</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 class="tdRight">下单金额</td>
|
||
<td>
|
||
<span id="needpaytext" style="color:red;"></span>
|
||
<input type="hidden" name="needPay" id="NEEdPAY" />
|
||
<input type="hidden" id="curNeedPay" />
|
||
|
||
</td>
|
||
<td>
|
||
@{
|
||
if (ViewBag.roleCodes.IndexOf("[GLY]") > -1 || ViewBag.roleCodes.IndexOf("[ZJZL]") > -1)
|
||
{
|
||
<input type="checkbox" id="chkTest" />@:测试单
|
||
}
|
||
}
|
||
<input type="hidden" name="isTest" id="isTest" value="0" />
|
||
<input type="hidden" id="payTest" />
|
||
</td>
|
||
</tr>
|
||
@*<tr style="display:none">
|
||
<td class="tdRight">支付类型</td>
|
||
<td>
|
||
@Html.DropDownList("PAYTYPE", new List<SelectListItem>() {
|
||
new SelectListItem(){Text="银行转账",Value="3",Selected=false},
|
||
new SelectListItem(){Text="支付宝",Value="1",Selected=false},
|
||
new SelectListItem(){Text="微信支付",Value="5",Selected=true}})
|
||
</td>
|
||
<td></td>
|
||
</tr>*@
|
||
<tr style="display:none;">
|
||
<td style="" class="tdRight">产品数</td>
|
||
<td style="width:310px"><input type="text" id="bookNum" name="bookNum" value="1" /></td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
<tr id="promotionTR" style="display:none;">
|
||
<td class="tdRight"><span style="color:red; font-weight:bold;">促销信息</span></td>
|
||
<td><select id="promotion" style="display:none;"></select></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr id="promotionTR2" style="display:none;">
|
||
<td class="tdRight"><span style="color:red; font-weight:bold;">促销信息</span></td>
|
||
<td><span id="promotion2" style="display:none;"></span></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr id="discountTR" style="background-color:pink; display:none;">
|
||
<td class="tdRight">折扣</td>
|
||
<td><select id="DDLDiscount" style="display:none;"></select><input type="hidden" name="discount" id="discount" /></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr id="customprisceTR" style="background-color:pink; display:none;">
|
||
<td>折后价</td>
|
||
<td>
|
||
<select id="DDLCustomPrisce" style="display:none;"></select><input type="hidden" name="customprisce" id="customprisce" />
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr id="upgradeOrderShow1" style="background-color:pink; display:none;">
|
||
<td class="tdRight">订单升级原CRM订单号列表</td>
|
||
<td><textarea name="UPGRADEORDERIDS" id="UPGRADEORDERIDS" rows="2" style="width:250px" onChange="getOrderLeftValue(this.value)"></textarea></td>
|
||
<td>以逗号分隔</td>
|
||
</tr>
|
||
<tr id="upgradeOrderShow2" style="background-color:pink; display:none;">
|
||
<td class="tdRight">原订单剩余金额</td>
|
||
@*<td><input type="text" name="totalupgradevalue" id="TOTALUPGRADEVALUE" /></td>*@
|
||
@*<td><input type="text" name="TOTALUPGRADEVALUE" id="TOTALUPGRADEVALUE" readonly /></td>*@
|
||
<td><input type="text" name="TOTALUPGRADEVALUE" id="TOTALUPGRADEVALUE" @{ if (ViewBag.DeptCode != "SHZZ" && ViewBag.DeptCode != "DNG8") { @Html.Raw("readonly") } } /></td>
|
||
<td><input type="checkbox" id="chkOriginalPrice" />原价</td>
|
||
</tr>
|
||
<tr id="trgiftdays" style="display:none; background-color:lightgoldenrodyellow">
|
||
<td class="tdRight">赠送<span id="giftdayslab"></span></td>
|
||
<td>
|
||
@if (ViewBag.DeptCode == "SHZZ")
|
||
{
|
||
<input type="text" name="giftdays" value="" />
|
||
}
|
||
else
|
||
{
|
||
<select id="giftdays" name="giftdays"></select>
|
||
}
|
||
@*<select id="giftdays" name="giftdays"></select>*@
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr id="trgiftdays2" style="display:none; background-color:lightgoldenrodyellow">
|
||
<td class="tdRight">赠送<span id="giftdays2lab"></span></td>
|
||
<td><select id="giftdays2" name="giftdays2"></select></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">留 痕</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">自找资源</option>
|
||
</select>
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr id="customerSource" style="display:none;">
|
||
@{ bool fujian = ViewBag.ShowFuJian; }
|
||
<td class="tdRight">
|
||
客户微信:<br />
|
||
<span style="display:none;">
|
||
客户企微姓名:<br />
|
||
</span>
|
||
客户企微:
|
||
@if (fujian == true)
|
||
{<br /><span>附件:</span>}
|
||
</td>
|
||
<td>
|
||
<input disabled value="" id="wxUserName" />
|
||
<input type="button" onclick="ChooseCustomerWx()" value="选择微信用户" />
|
||
@Html.HiddenFor(m => m.wx_SzzyOrder.CUSTOMERUSERNAME)
|
||
<br />
|
||
<div style="display:none;">
|
||
<input disabled value="" id="qwUserName" />
|
||
<input type="button" onclick="ChooseCustomerQw()" value="选择企业微信" />
|
||
@Html.HiddenFor(m => m.wx_SzzyOrder.WEWORK_REMOTEID)
|
||
<br />
|
||
</div>
|
||
|
||
<input disabled value="" id="wwUserName" />
|
||
<input type="button" onclick="ChooseCustomerWw()" value="选择付费企业微信" />
|
||
@Html.HiddenFor(m => m.wx_SzzyOrder.EXTERNAL_USERID)
|
||
<input type="hidden" name="userid" id="userid" />
|
||
<input type="hidden" name="corpid" id="corpid" />
|
||
@if (fujian == true)
|
||
{
|
||
<br />
|
||
<input id="FileMobile" name="FileMobile" type="file" accept=".doc,.docx" />
|
||
}
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td style="">客户希望回访的时间</td>
|
||
<td style="width:310px">
|
||
<input id="startTime" name="ai_hgrecord_stime" class="Wdate settime" type="text" onclick="WdatePicker({ qsEnabled:false,isShowToday:false,dateFmt: 'HH:mm' })" placeholder="开始时间" autocomplete="off" onchange="changeTime()" />
|
||
|
||
- <input id="endTime" name="ai_hgrecord_etime" class="Wdate settime" type="text" onclick="WdatePicker({ qsEnabled:false,isShowToday:false,dateFmt: 'HH:mm' })" placeholder="结束时间" autocomplete="off" />
|
||
</td>
|
||
<td width="120px">
|
||
非必填
|
||
<img style="margin-left: 10px;cursor: pointer;" src="/image/icon/tip.png" title="非必填,若填写,则回访会优先按照这
个时间进行回访">
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="" class="tdRight">预计开通时间</td>
|
||
<td style="width:310px">
|
||
<input id="ESTIMATEOTIME" name="ESTIMATEOTIME" class="Wdate" type="text" value="@Html.Raw(DateTime.Now.ToString("yyyy-MM-dd"))" onclick="WdatePicker()" realvalue="">
|
||
</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
<tr>
|
||
<td style="" class="tdRight">备注</td>
|
||
<td style="width:310px">@Html.TextAreaFor(m => m.wx_SzzyOrder.REMARK, new { style = "width:300px;height:30px" })</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
|
||
|
||
</tbody>
|
||
</table>
|
||
<table class="fromEditTable " style="width: auto;margin: 10px 10px;">
|
||
<thead>
|
||
<tr>
|
||
<th colspan="3">可用金额</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr id="td_deposit">
|
||
<td style="width:130px;">
|
||
剩余使用金额:
|
||
</td>
|
||
<td style="width:310px;">
|
||
@*<ul id="ul_deposit"><li>无</li></ul>*@
|
||
<input type="hidden" id="depprice" name="depprice" />
|
||
<input type="text" id="deppriceUseTxt" value="" disabled="" readonly="">
|
||
@*<span id="deppriceUseTxt" style="color: red"></span>*@
|
||
剩余金额:<span id="deppriceTxt" style="color:red"></span>
|
||
</td>
|
||
<td width="120px">
|
||
@*有<span id="depositCount" style="color:red;">0</span>笔可用订金*@
|
||
@*<a class="layui-btn layui-btn-sm layui-btn-normal" onclick="UsePriceShow()">使用金额</a>*@
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr id="td_deposit">
|
||
<td colspan="3">
|
||
还需支付金额:<span id="justpayTxt" style="color:red"></span>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
@*<table class="fromEditTable " style="width: auto;margin: 10px 10px;">
|
||
<thead>
|
||
<tr>
|
||
<th colspan="3">支付</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="tdRight">是否有支付</td>
|
||
<td style="width:310px">
|
||
<select onchange="showPayPannel()" id="sltshow" name="HasPay">
|
||
<option value="1">是</option>
|
||
<option value="0">否</option>
|
||
</select>
|
||
</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
</tbody>*@
|
||
<script type="text/html" id="wxTpl">
|
||
<tr>
|
||
<td class="tdRight" style="width:130px;">支付类型:</td>
|
||
<td style="width:310px">
|
||
<select name="PAYTYPE" id="PAYTYPE">
|
||
<option value="1">支付宝</option>
|
||
<option value="3">银行转账</option>
|
||
<option value="5" selected="selected">微信支付</option>
|
||
</select>
|
||
</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">付款日期:</td>
|
||
<td style="width:310px">
|
||
<input id="paydate" name='paydate' class='Wdate' type='text' value='@DateTime.Now.ToString("yyy-MM-dd")' onclick='javascript: WdatePicker();' />
|
||
</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">付款金额:</td>
|
||
<td>
|
||
<input type="text" id="payprice" name="payprice" placeholder="¥">
|
||
</td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">付款人姓名:</td>
|
||
<td style="width:310px">
|
||
<input type="text" id="payname" name="payname" placeholder="请输入">
|
||
</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">支付流水号:</td>
|
||
<td><input type="text" id="payno" name="payno" placeholder="请输入" style="width:300px;"></td>
|
||
<td></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="tdRight">备注:</td>
|
||
<td style="width:310px">
|
||
<textarea placeholder="请输入内容" name="remark" class="layui-textarea" rows="5" style=" width: 250px;"></textarea>
|
||
</td>
|
||
<td width="120px"></td>
|
||
</tr>
|
||
<tr style="display:none;">
|
||
<td colspan="3"><input type="hidden" id="deposit" name="deposit" /></td>
|
||
</tr>
|
||
</script>
|
||
@*</table>*@
|
||
<div style="padding:10px 10px 30px 50px;"><a href="javascript:AddPayMorePay();" style="text-decoration:underline;" id="contuniuePay">+继续添加支付</a></div>
|
||
<div id="modalwindow" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
|
||
</form>
|
||
<div id="dlg" class="easyui-dialog" closed="true" style="width: 400px; height: 400px; padding: 10px;">
|
||
<table class="fromEditTable">
|
||
<tr>
|
||
<td>剩余金额:</td>
|
||
<td><span id="alldeppay" style="color:red"></span></td>
|
||
</tr>
|
||
<tr>
|
||
<td>使用金额:</td>
|
||
<td><input type="text" id="usePrice" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td></td>
|
||
<td>
|
||
<input id="BtnUse" type="button" class="layui-btn layui-btn-sm layui-btn-normal" value="确认" onclick="Use()" />
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<script type="text/javascript">
|
||
var oldProductPrice = 0;
|
||
var _disCount = "";
|
||
var _customPrisce = "";
|
||
var deptCode = '@ViewBag.DeptCode';
|
||
$(function () {
|
||
$(".mvctool2").appendTo("#niubxassx");
|
||
$("#customerSource").hide();
|
||
$("#upgradeOrderShow1").hide();
|
||
$("#upgradeOrderShow2").hide();
|
||
$("#trgiftdays").hide();
|
||
$("#trgiftdays2").hide();
|
||
$("#promotionTR").hide();
|
||
$("#discountTR").hide();
|
||
$("#customprisceTR").hide();
|
||
$('#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");
|
||
}
|
||
});
|
||
var isCanSubMit = true;
|
||
$("#btnSave").click(function () {
|
||
isCanSubMit = true;
|
||
//主订单信息
|
||
$(".BorderErro").removeClass("BorderErro");
|
||
var resid = $("#resid");
|
||
if (!$.trim($(resid).val())) {
|
||
return ErroBox(resid, "客户ID不能为空!");
|
||
}
|
||
var SoftUserName = $("#SoftUserName");
|
||
if (!$.trim($(SoftUserName).val())) {
|
||
return ErroBox(SoftUserName, "用户名不能为空!");
|
||
}
|
||
var Name = $("#Name");
|
||
if (!$.trim($(Name).val())) {
|
||
return ErroBox(Name, "姓名不能为空!");
|
||
}
|
||
var midProductId = $("#midProductId");
|
||
|
||
if ($(midProductId).val()=="0") {
|
||
return ErroBox(midProductId, "请选择产品!","change");
|
||
}
|
||
var subProductId = $("#subProductId");
|
||
if ($(subProductId).val() == "0") {
|
||
return ErroBox(subProductId, "请选择产品!", "change");
|
||
}
|
||
var SOURCE = $("#SOURCE");
|
||
if (!$(SOURCE).val()) {
|
||
return ErroBox(SOURCE, "请选择留痕!", "change");
|
||
}
|
||
var selectEId = $("#selectEId");
|
||
if (!$.trim(selectEId.val())) {
|
||
return ErroBox(selectEId, "请填写员工归属!");
|
||
}
|
||
@if (ViewBag.DeptList != null)
|
||
{
|
||
@Html.Raw("var deptcode = $('#deptcode');");
|
||
@Html.Raw("if (!$.trim(deptcode.val())){");
|
||
@Html.Raw(" return ErroBox(deptcode, '请选择部门归属!');");
|
||
@Html.Raw("}");
|
||
}
|
||
var needpay = $("#NEEdPAY");
|
||
if (needpay.val() < 0) {
|
||
var needpaytext = $("#needpaytext");
|
||
return ErroBox(needpaytext, "下单金额不能小于0!");
|
||
}
|
||
|
||
if ($("#CreateForm").valid()) {
|
||
|
||
//支付界面的循环验证,必须通过验证才能
|
||
var oldPayNo = new Array();
|
||
var payIndex = 0;
|
||
$(".MyPayPannel").each(function (a, b) {
|
||
var paytype = $(b).find("#PAYTYPE").val();
|
||
var paydate = $(b).find("#paydate");
|
||
if (!$.trim($(paydate).val())) {
|
||
return ErroBox(paydate, "支付日期不能为空!");
|
||
}
|
||
var payprice = $(b).find("#payprice");
|
||
if (!validate($(payprice).val())) {
|
||
return ErroBox(payprice,"请输入正确的金额!");
|
||
}
|
||
var payname = $(b).find("#payname");
|
||
if (!$.trim($(payname).val())) {
|
||
return ErroBox(payname, "付款人姓名不能为空!");
|
||
}
|
||
var payno = $(b).find("#payno");
|
||
if (!$.trim($(payno).val())) {
|
||
return ErroBox(payno, "支付流水号不能为空!");
|
||
} else {
|
||
var paynoValue = $.trim($(payno).val());
|
||
if (paytype == 1 || paytype == 5) {
|
||
var len = paynoValue.length;
|
||
if (len < 28) {
|
||
return ErroBox(payno, "支付流水号错误!");
|
||
}
|
||
//if (len > 28) {
|
||
// paynoValue = paynoValue.substring(0, 28);
|
||
//}
|
||
if (isNaN(paynoValue)) {
|
||
return ErroBox(payno, "支付流水号只能是数字,不能有字符或者空格!");
|
||
}
|
||
var start = paynoValue.substring(0, 1);
|
||
//console.log(start);
|
||
if (start == 2 && paytype != 1) {
|
||
return ErroBox(payno, "支付流水号跟支付类型不匹配!");
|
||
}
|
||
if (start == 4 && paytype != 5) {
|
||
return ErroBox(payno, "支付流水号跟支付类型不匹配!");
|
||
}
|
||
}
|
||
var canContuie = true;
|
||
$(oldPayNo).each(function(a,x){
|
||
if (x == paynoValue) {
|
||
canContuie = false;
|
||
return ErroBox(payno, "流水号输入重复!");
|
||
}
|
||
});
|
||
if (!canContuie) {
|
||
return false;
|
||
}
|
||
oldPayNo[payIndex] = paynoValue;
|
||
payIndex++;
|
||
}
|
||
|
||
});
|
||
if (isCanSubMit) {//最终验证通过才能进行提交
|
||
console.log("最终提交!!");
|
||
$('#CreateForm').submit();
|
||
}
|
||
}
|
||
return false;
|
||
});
|
||
function ErroBox(_control, title, shijian) {
|
||
if (shijian) {//兼容ie,360等垃圾浏览器
|
||
$(_control).addClass("BorderErro").focus().one(shijian, function () {
|
||
$(_control).removeClass("BorderErro");
|
||
});
|
||
} else {
|
||
$(_control).addClass("BorderErro").focus().one("keyup", function () {
|
||
$(_control).removeClass("BorderErro");
|
||
});
|
||
}
|
||
//$(_control).addClass("BorderErro").focus().one(shijian??"keyup", function () {
|
||
// $(_control).removeClass("BorderErro");
|
||
//});
|
||
$.messager.alert("警告", title, "error");
|
||
isCanSubMit = false;
|
||
return false;
|
||
}
|
||
function validate(num) {
|
||
var reg = /^\d+(?=\.{0,1}\d+$|$)/
|
||
if (reg.test(num)) return true;
|
||
return false;
|
||
}
|
||
$("#btnQuery").click(function () {
|
||
$('#tablist').tablegrid("Search");
|
||
});
|
||
|
||
$("#bookNum").change(function () {
|
||
var num = $("#bookNum").val();
|
||
if (num == 0) {
|
||
num = 1
|
||
$("#bookNum").val(1);
|
||
}
|
||
var days = $("#curOpenDays").val();
|
||
var price = $("#curNeedPay").val();
|
||
$("#opendaystext").html(num * days);
|
||
$("#OpenDays").val(num * days);
|
||
$("#NEEdPAY").val(num * price);
|
||
$("#needpaytext").html(num * price);
|
||
jisuanNeedUse();
|
||
$("#payTest").val(num * price);
|
||
});
|
||
|
||
$("#TOTALUPGRADEVALUE").change(function () {
|
||
if ($("#UPGRADEORDERIDS").val() == "") {
|
||
$.messager.alert("警告", "请先输入升级单号", "error");
|
||
return;
|
||
}
|
||
//alert(this.value);
|
||
var changePrice = parseFloat(this.value);
|
||
var productPrice = parseFloat($("#curNeedPay").val());
|
||
if (isNaN(changePrice)) {
|
||
$(this).val(0);
|
||
$.messager.alert("警告", "金额只能是数字", "error");
|
||
return;
|
||
}
|
||
if (changePrice > productPrice) {
|
||
$.messager.alert("警告", "金额不能大于产品金额", "error");
|
||
return;
|
||
}
|
||
//alert(oldProductPrice);
|
||
//alert(productPrice);
|
||
var orderType = $("#ORDERTYPE").val();
|
||
if (orderType == 4)
|
||
{
|
||
setChangeOrderPrice();
|
||
}
|
||
else {
|
||
setOrderLeftValue(this.value);
|
||
}
|
||
//setOrderLeftValue(this.value);
|
||
});
|
||
|
||
//选择所属员工
|
||
$("#selectEId").focus(function () {
|
||
select_user($("#selectEId").val(), 12);
|
||
|
||
}).bind("input", function () {
|
||
select_user($("#selectEId").val(), 12);
|
||
|
||
}).blur(function () {
|
||
setTimeout(function () { $(".select_user_box").hide(); }, 250)
|
||
});
|
||
|
||
});
|
||
//function showPayPannel() {
|
||
// var isshow = $("#sltshow").val();
|
||
// if (isshow == 0) {
|
||
// $(".MyPayPannel").hide();
|
||
// $("#contuniuePay").hide();
|
||
|
||
// } else {
|
||
// $(".MyPayPannel").show();
|
||
// $("#contuniuePay").show();
|
||
// }
|
||
//}
|
||
function changeTime() {
|
||
var endValue = $("#endTime").val();
|
||
var value = $("#startTime").val();
|
||
if (value != "" && endValue == "") {
|
||
var dateStr = value.split(":");
|
||
if (dateStr.length > 1) {
|
||
parseInt((parseInt(dateStr[1]) + 30) / 60)
|
||
var endStr = parseInt(dateStr[0]) * 60 + parseInt(dateStr[1]) + 30;
|
||
var hourstr = parseInt(endStr / 60);
|
||
var minStr = endStr % 60;
|
||
if (hourstr < 9) {
|
||
hourstr = "0" + hourstr;
|
||
}
|
||
if (minStr < 9) {
|
||
minStr = "0" + minStr;
|
||
}
|
||
endValue = hourstr + ":" + minStr;
|
||
$("#endTime").val(endValue);
|
||
}
|
||
}
|
||
}
|
||
function checkEid(uname,eid) {
|
||
$("#selectEId").val(eid);
|
||
$(".select_user_box").hide();
|
||
}
|
||
function select_user(inStr, len) {
|
||
if (inStr.trim() != "") {
|
||
$.ajax({
|
||
url: "/JZOrder/SelectHhuser",
|
||
data: { inStr: inStr.trim(), len: len },
|
||
async: false,
|
||
success: function (res) {
|
||
if (res.result) {
|
||
var obj = $("#selectEId");
|
||
let of = obj.offset();
|
||
var dilg = "<div class='select_user_box' style='top:" + (of.top + 28) + "px;left:" + of.left + "px'></div>";
|
||
var p = "";
|
||
res.data.forEach(function (e, i) {
|
||
p += "<p onclick=\"checkEid(\'" + e.uname + "\',\'" + e.eid + "\')\" title=\"" + e.eid + "(" + e.uname + ")\">" + e.eid + "(" + e.uname + ")</p>";
|
||
});
|
||
|
||
if ($(".select_user_box").length > 0) {
|
||
$(".select_user_box *").remove();
|
||
} else {
|
||
$("#niubxassx").append(dilg)
|
||
}
|
||
$(".select_user_box").append(p).show();
|
||
}
|
||
else console.log(res.msg);
|
||
}
|
||
});
|
||
} else {
|
||
$(".select_user_box").hide();
|
||
}
|
||
}
|
||
function reset() {
|
||
$("#UPGRADEORDERIDS").val("");
|
||
setOrderLeftValue(0);
|
||
$("#trgiftdays").hide();
|
||
$("#trgiftdays2").hide();
|
||
$("#promotionTR").hide();
|
||
$("#promotion").empty().hide();
|
||
$("#discountTR").hide();
|
||
$("#customprisceTR").hide();
|
||
$("#DDLDiscount").empty().hide();
|
||
$("#DDLCustomPrisce").empty().hide();
|
||
$("#discount").val('');
|
||
$("#customprisce").val('');
|
||
////北一至尊版不需要升级单,(已经改成需要升级订单,但是只能至尊版间相互升级)
|
||
if (deptCode == "SHZZ") {
|
||
$("#ORDERTYPE").empty().append(new Option("普通订单", "1")).append(new Option("续费订单", "2")).append(new Option("升级订单", "3")).append(new Option("换课订单(不补款)", "4")).append(new Option("换课订单(补款)", "5"));
|
||
}
|
||
else {
|
||
$("#ORDERTYPE").empty().append(new Option("普通订单", "1")).append(new Option("续费订单", "2")).append(new Option("升级订单", "3"));
|
||
//$("#ORDERTYPE").empty().append(new Option("普通订单", "1")).append(new Option("续费订单", "2")).append(new Option("升级订单", "3")).append(new Option("换课订单(不补款)", "4")).append(new Option("换课订单(补款)", "5"));
|
||
}
|
||
_disCount = "";
|
||
_customPrisce = "";
|
||
//$("#ORDERTYPE").val(1).change();
|
||
}
|
||
|
||
|
||
function changeselect(productId) {
|
||
//var nb1defaultIndex = 0;
|
||
reset();
|
||
if (productId == 0) {
|
||
$("#subProductId").unbind();
|
||
$("#subProductId").html("<option value='0'>--请选中产品小类--</option>");
|
||
return;
|
||
}
|
||
$.r_post("/JzOrder/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");
|
||
}
|
||
//var nowdepoist;
|
||
var payNum = 0;
|
||
var lastprice = 0;
|
||
function AddPayMorePay() {
|
||
var needpay = $("#NEEdPAY").val();
|
||
if (!needpay) {
|
||
$.messager.alert("警告", "请先选择产品!", "error");
|
||
return;
|
||
}
|
||
var dpriceVal=$("#depprice").val();
|
||
if (dpriceVal) {
|
||
mydprice = parseFloat(dpriceVal);
|
||
var wwxa = parseFloat(needpay);
|
||
if (mydprice >= needpay) {
|
||
$.messager.alert("警告", "金额已经够了,无需再添加!", "error");
|
||
return;
|
||
}
|
||
}
|
||
payNum++;
|
||
var html = '<table class="layui-table MyPayPannel" style="width: auto;margin: 10px 10px;"><thead><tr><th colspan="3">支付' + payNum + '<i class="layui-icon layui-icon-close" title="删除" onClick="$(this).parent().parent().parent().parent().remove();" style="float:right;color: red;cursor: pointer;"></i></th></tr></thead><tbody id="paypannel' + payNum+'">';
|
||
html += $("#wxTpl").html()+"</tbody>";
|
||
$("#contuniuePay").parent().before(html);
|
||
$("#paypannel" + payNum + " #td_deposit").remove();
|
||
}
|
||
function SearchResid() {
|
||
$.r_post("/JzOrder/GetResid?resid=" + $("#resid").val(), function (data) {
|
||
|
||
if (data.result) {
|
||
$("#SoftUserName").html("");
|
||
$(data.data).each(function (n, m) {
|
||
$("#SoftUserName").append("<option value='" + m.Value + "'>" + m.Text + "</option>");
|
||
});
|
||
$("#Name").val(data.customername);
|
||
//nowdepoist = null;
|
||
//$("#ul_deposit").html("");
|
||
//$("#depositCount").html("0");
|
||
/* if (data.lastPriceSum) {*/
|
||
//所有的订金
|
||
console.log(data.lastPriceSum);
|
||
////nowdepoist = data.depoist;
|
||
//$(data.depoist).each(function (n, m) {
|
||
// console.log(m);
|
||
// lastprice += m.LASTPRICE;
|
||
//});
|
||
lastprice = data.lastPriceSum;
|
||
$("#deppriceTxt").html(data.lastPriceSum);
|
||
jisuanNeedUse();//重新计算金额
|
||
//$("#depprice").val(lastprice);
|
||
//var html = "";
|
||
//$(data.depoist).each(function (n, m) {
|
||
// var mtdate = new Date(m.PAYDATE);
|
||
// html += '<li><input type="checkbox" name="ckDeposit" value="' + m.ID + '" />订金金额:' + m.PAYPRICE + ' 付款时间:' + dateFormat("YYYY-mm-dd",mtdate) +'</li>';
|
||
//});
|
||
//$("#ul_deposit").html(html);
|
||
|
||
//$("#depositCount").html(data.depoist.length);
|
||
//}
|
||
} else {
|
||
$.messager.alert("警告", data.message, "error");
|
||
}
|
||
}, "json");
|
||
}
|
||
function dateFormat(fmt, date) {
|
||
let ret;
|
||
const opt = {
|
||
"Y+": date.getFullYear().toString(), // 年
|
||
"m+": (date.getMonth() + 1).toString(), // 月
|
||
"d+": date.getDate().toString(), // 日
|
||
"H+": date.getHours().toString(), // 时
|
||
"M+": date.getMinutes().toString(), // 分
|
||
"S+": date.getSeconds().toString() // 秒
|
||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
||
};
|
||
for (let k in opt) {
|
||
ret = new RegExp("(" + k + ")").exec(fmt);
|
||
if (ret) {
|
||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
||
};
|
||
};
|
||
return fmt;
|
||
}
|
||
function changeMidProduct(midproductId) {
|
||
if (midproductId == 0) {
|
||
return;
|
||
}
|
||
reset();
|
||
$.r_post("/JzOrder/GetSubProductList?productId=0&midproductId=" + midproductId, function (data) {
|
||
//$("#subProductId").unbind();
|
||
|
||
$("#subProductId").html("<option value='0'>--请选中产品小类--</option>");
|
||
|
||
$(data).each(function (n, m) {
|
||
$("#subProductId").append("<option value='" + m.Value + "'>" + m.Text + "</option>");
|
||
});
|
||
}, "json");
|
||
}
|
||
|
||
function ordertypeselect(type) {
|
||
var subProductId = $("#subProductId").val();
|
||
if (subProductId == 0) {
|
||
$.messager.alert("警告", "请先选择产品!", "error");
|
||
$("#ORDERTYPE").val(1);
|
||
return;
|
||
}
|
||
else {
|
||
$("#promotion").empty();
|
||
$("#promotion2").empty();
|
||
$("#promotionTR").hide();
|
||
$("#promotionTR2").hide();
|
||
$("#discountTR").hide();
|
||
$("#UPGRADEORDERIDS").val("");
|
||
$("#customprisceTR").hide();
|
||
$("#discount").val('');
|
||
$("#customprisce").val('');
|
||
setOrderLeftValue(0);
|
||
$('#upgradeOrderShow1').hide();
|
||
$('#upgradeOrderShow2').hide();
|
||
$('#opendaystext').show();
|
||
$('#opendays2').hide();
|
||
//console.log("_disCount:" + _disCount);
|
||
if (_disCount != '' && _disCount != undefined && _disCount != null) {
|
||
$("#DDLDiscount").empty().append(new Option("可选择折扣", ""));
|
||
var disArr = _disCount.split(',');
|
||
for (var i = 0; i < disArr.length; i++) {
|
||
var title = disArr[i] / 10 + "折";
|
||
$("#DDLDiscount").append(new Option(title, disArr[i]));
|
||
}
|
||
}
|
||
//折后价
|
||
if (_customPrisce != '' && _customPrisce != undefined && _customPrisce != null) {
|
||
$("#DDLCustomPrisce").empty().append(new Option("可选择折后价", ""));
|
||
var disArr = _customPrisce.split(',');
|
||
for (var i = 0; i < disArr.length; i++) {
|
||
var title = disArr[i];
|
||
$("#DDLCustomPrisce").append(new Option(title, disArr[i]));
|
||
}
|
||
}
|
||
if (type == 3 || type == 4) {
|
||
//新媒体三,升级,补课订单两种促销方式都支持
|
||
//if (deptCode == "SHZZ" || deptCode == "QBJX") {
|
||
/*if (_disCount != '' && _disCount != undefined && _disCount != null) {
|
||
var checkhtml = '<input id="zk" type="checkbox" onchange="zhikou(this)" /><label for="zk">折扣</label><span style="padding:0 10px"></span><input id="dk" type="checkbox" onchange="dikou(this)" /><label for="dk">抵扣</label>';
|
||
$("#promotion2").append(checkhtml).show();
|
||
}
|
||
else*/ if (_customPrisce != '' && _customPrisce != undefined && _customPrisce != null) {
|
||
var checkhtml = '<input id="zk" type="checkbox" onchange="zhihoujia(this)" /><label for="zk">折后价</label><span style="padding:0 10px"></span><input id="dk" type="checkbox" onchange="dikou(this)" /><label for="dk">抵扣</label>';
|
||
$("#promotion2").append(checkhtml).show();
|
||
}
|
||
else {
|
||
$("#promotion2").append('<input id="dk" type="checkbox" onchange="dikou(this)" /><label for="dk">抵扣</label>').show();
|
||
}
|
||
$("#promotionTR2").show();
|
||
//}
|
||
//else {
|
||
// if (_disCount != '' && _disCount != undefined && _disCount != null) {
|
||
// $("#promotion").append(new Option('请选择', '')).append(new Option('折扣', 1)).append(new Option("抵扣", 2)).show();
|
||
// }
|
||
// else if (_customPrisce != '' && _customPrisce != undefined && _customPrisce != null) {
|
||
// $("#promotion").append(new Option('请选择', '')).append(new Option('折后价', 3)).append(new Option("抵扣", 2)).show();
|
||
// }
|
||
// else {
|
||
// $("#promotion").append(new Option("抵扣", 2)).show();
|
||
// }
|
||
// $("#promotionTR").show();
|
||
//}
|
||
|
||
if (deptCode == "SHZZ") {
|
||
$("#opendays2").show();
|
||
$("#opendaystext").hide();
|
||
}
|
||
}
|
||
else if (type == 5)
|
||
{
|
||
if (_disCount != '' && _disCount != undefined && _disCount != null) {
|
||
var checkhtml = '<input id="zk" type="checkbox" onchange="zhikou(this)" /><label for="zk">折扣</label><span style="padding:0 10px"></span><input id="dk" type="checkbox" onchange="dikou(this)" /><label for="dk">抵扣</label>';
|
||
$("#promotion2").append(checkhtml).show();
|
||
}
|
||
else if (_customPrisce != '' && _customPrisce != undefined && _customPrisce != null) {
|
||
var checkhtml = '<input id="zk" type="checkbox" onchange="zhihoujia(this)" /><label for="zk">折后价</label><span style="padding:0 10px"></span><input id="dk" type="checkbox" onchange="dikou(this)" /><label for="dk">抵扣</label>';
|
||
$("#promotion2").append(checkhtml).show();
|
||
}
|
||
else {
|
||
$("#promotion2").append('<input id="dk" type="checkbox" onchange="dikou(this)" /><label for="dk">抵扣</label>').show();
|
||
}
|
||
$("#promotionTR2").show();
|
||
|
||
if (deptCode == "SHZZ") {
|
||
$("#opendays2").show();
|
||
$("#opendaystext").hide();
|
||
}
|
||
}
|
||
else if (type == 2 || deptCode == "SHZZ" || deptCode == "DNZZ" || (deptCode == "QBJX" && (subProductId == 1008194 || subProductId == 1008196))) {
|
||
if (_disCount != '' && _disCount != undefined && _disCount != null) {
|
||
$("#promotion").append(new Option("折扣", 1)).show();
|
||
$("#promotionTR").show();
|
||
}
|
||
if (_customPrisce != '' && _customPrisce != undefined && _customPrisce != null) {
|
||
$("#promotion").append(new Option("折后价", 3)).show();
|
||
$("#promotionTR").show();
|
||
}
|
||
}
|
||
|
||
var len = $("#promotion option").length;
|
||
if (len == 1) {
|
||
$("#promotion").change();
|
||
}
|
||
}
|
||
}
|
||
|
||
function sourceselect(val) {
|
||
if (val == 1) {
|
||
$('#customerSource').show();
|
||
//$("#trQwSource").hide();
|
||
} /*else if (val == 6) {
|
||
$('#customerSource').hide();
|
||
$("#trQwSource").show();
|
||
}*/
|
||
else {
|
||
$('#customerSource').hide();
|
||
//$("#trQwSource").hide();
|
||
}
|
||
$('#wx_SzzyOrder_CUSTOMERUSERNAME').val('');
|
||
$('#wx_SzzyOrder_WEWORK_REMOTEID').val('');
|
||
$('#wx_SzzyOrder_EXTERNAL_USERID').val('');
|
||
$('#wxUserName').val('');
|
||
$('#qwUserName').val('');
|
||
$('#wwUserName').val('');
|
||
}
|
||
|
||
function changeSubProduct(subProductId) {
|
||
reset();
|
||
$.r_post("/JZOrder/GetSubProductPriceById?subProductId=" + subProductId, function (data) {
|
||
//console.log(data.discount);
|
||
if (data.result) {
|
||
$("#NEEdPAY").val(data.price);
|
||
$("#needpaytext").html(data.price);
|
||
jisuanNeedUse();
|
||
$("#OpenDays").val(data.days);
|
||
$("#opendaystext").html(data.days);
|
||
$("#opendays2").val(data.days);
|
||
$("#bookNum").val(1);
|
||
$("#curOpenDays").val(data.days);
|
||
$("#curNeedPay").val(data.price);
|
||
$("#payTest").val(data.price);
|
||
loadGift('trgiftdays', 'giftdays', data.gifts);
|
||
loadGift('trgiftdays2', 'giftdays2', data.gifts2);
|
||
if (data.discount != '') {
|
||
_disCount = data.discount;
|
||
}
|
||
if (data.customprisce != '') {
|
||
_customPrisce = data.customprisce;
|
||
}
|
||
$("#ORDERTYPE").change()
|
||
}
|
||
}, "json");
|
||
}
|
||
|
||
function loadGift(trid, id, gifts) {
|
||
$("#" + id).empty();
|
||
if (gifts != null && !$.isEmptyObject(gifts)) {
|
||
$.each(gifts, function (m, n) {
|
||
if (m == 0) {
|
||
$("#" + id + "lab").text(n.GIFTNAME);
|
||
}
|
||
$("#" + id).append("<option value='" + n.GIFTDAYS + "'>" + n.GIFTDAYSNAME + "</option>");
|
||
});
|
||
$("#" + trid).show();
|
||
}
|
||
}
|
||
|
||
function selectCustomerWx(userName) {
|
||
$('#wxUserName').val(userName);
|
||
$('#wx_SzzyOrder_CUSTOMERUSERNAME').val(userName);
|
||
}
|
||
|
||
function ChooseCustomerWx() {
|
||
$("#modalwindow").html(GetIframeHtml("/WeiXin/SzzyOrder/RContactIndex"));
|
||
$("#modalwindow").window({ title: '选择客户微信', width: 650, height: 500, iconCls: 'icon-add' }).window('open');
|
||
|
||
}
|
||
|
||
function SelectCustomerQw(userName, userId) {
|
||
$('#qwUserName').val(userName);
|
||
$('#wx_SzzyOrder_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);
|
||
$('#wx_SzzyOrder_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 getOrderLeftValue(val) {
|
||
var orderType = $("#ORDERTYPE").val();
|
||
if (orderType == 4 && val != "" && val.indexOf(',') > -1) {
|
||
$.messager.alert("警告", "换课订单只能输入一个", "error");
|
||
return;
|
||
}
|
||
$.r_post("/JZOrder/GetOrderLeftValue?oldOrderIds=" + val + "&subProductId=" + $('#subProductId').val(), function (data) {
|
||
if (data.result) {
|
||
var arr = data.data.oldProductPriceList.split(',');
|
||
oldProductPrice = arr[0];
|
||
setOrderLeftValue(data.data.leftValues);
|
||
}
|
||
else {
|
||
//$(this).prop("checked", false);
|
||
setOrderLeftValue(0);
|
||
$("#UPGRADEORDERIDS").val('');
|
||
$.messager.alert("警告", data.message, "error");
|
||
}
|
||
}, "json");
|
||
}
|
||
|
||
function setOrderLeftValue(val) {
|
||
var orderType = $("#ORDERTYPE").val();
|
||
if (orderType == 4) {
|
||
setChangeOrderPrice();
|
||
|
||
var leftValue = parseFloat(val);
|
||
$('#TOTALUPGRADEVALUE').val(leftValue);
|
||
}
|
||
//else if (orderType == 5 || (deptCode == "QBJX" && orderType == 3))
|
||
else if (orderType == 5 || orderType == 3)
|
||
{
|
||
var curNeedPay = $('#curNeedPay').val();
|
||
if (curNeedPay == "")
|
||
curNeedPay = 0;
|
||
if ($("#zk").is(":checked") && !$("#DDLDiscount").val() != '' && $("#DDLDiscount").val() != null && $("#DDLDiscount").val() != undefined) {
|
||
//$("#DDLDiscount").change();
|
||
var v = (100 - $("#DDLDiscount").val()) / 100;
|
||
var cnp = parseFloat(curNeedPay);
|
||
|
||
//取整
|
||
var pay = parseInt(cnp - (cnp * v));
|
||
|
||
curNeedPay = pay;
|
||
|
||
}
|
||
if ($("#zk").is(":checked") && $("#DDLCustomPrisce").val() != '' && $("#DDLCustomPrisce").val() != null && $("#DDLCustomPrisce").val() != undefined) {
|
||
//更新到 折后价
|
||
curNeedPay = $("#DDLCustomPrisce").val();
|
||
|
||
}
|
||
|
||
var leftValue = parseFloat(val);
|
||
var needPay = parseFloat(curNeedPay);
|
||
$("#NEEdPAY").val(needPay - leftValue);
|
||
$("#needpaytext").html(needPay - leftValue);
|
||
jisuanNeedUse();
|
||
$('#TOTALUPGRADEVALUE').val(leftValue);
|
||
$("#payTest").val(needPay - leftValue);
|
||
}
|
||
else {
|
||
var curNeedPay = $('#curNeedPay').val();
|
||
if (curNeedPay == "")
|
||
curNeedPay = 0;
|
||
var leftValue = parseFloat(val);
|
||
var needPay = parseFloat(curNeedPay);
|
||
$("#NEEdPAY").val(needPay - leftValue);
|
||
$("#needpaytext").html(needPay - leftValue);
|
||
jisuanNeedUse();
|
||
$('#TOTALUPGRADEVALUE').val(leftValue);
|
||
$("#payTest").val(needPay - leftValue);
|
||
}
|
||
}
|
||
|
||
function setChangeOrderPrice() {
|
||
$("#NEEdPAY").val(0);
|
||
$("#needpaytext").html(0);
|
||
jisuanNeedUse();
|
||
$("#payTest").val(0);
|
||
}
|
||
|
||
$("#chkTest").change(function () {
|
||
var needpay = $("#NEEdPAY").val();
|
||
if (needpay == "") {
|
||
$.messager.alert("警告", "请先选择产品!", "error");
|
||
$(this).prop("checked", false);
|
||
return;
|
||
}
|
||
|
||
if ($(this).prop("checked")) {
|
||
$("#NEEdPAY").val(0.01);
|
||
$("#needpaytext").html(0.01);
|
||
jisuanNeedUse();
|
||
$("#isTest").val(1);
|
||
}
|
||
else {
|
||
$("#NEEdPAY").val($("#payTest").val());
|
||
$("#needpaytext").html($("#payTest").val());
|
||
jisuanNeedUse();
|
||
$("#isTest").val(0);
|
||
}
|
||
});
|
||
|
||
$("#chkOriginalPrice").change(function () {
|
||
var orders = $("#UPGRADEORDERIDS").val();
|
||
if (orders == "") {
|
||
setOrderLeftValue(0);
|
||
$.messager.alert("警告", "请先输入升级单号!", "error");
|
||
$(this).prop("checked", false);
|
||
return;
|
||
}
|
||
var isOriginalPrice = 0;
|
||
if ($(this).prop("checked"))
|
||
isOriginalPrice = 1;
|
||
$.r_post("/JZOrder/GetOrderLeftValue?oldOrderIds=" + orders + "&subProductId=" + $('#subProductId').val() + "&isOriginalPrice=" + isOriginalPrice, function (data) {
|
||
//if (data.type) {
|
||
// setOrderLeftValue(data.message);
|
||
//} else {
|
||
// $(this).prop("checked", false);
|
||
// //alert(data.message);
|
||
// $.messager.alert("警告", data.message, "error");
|
||
//}
|
||
if (data.result) {
|
||
var arr = data.data.oldProductPriceList.split(',');
|
||
oldProductPrice = arr[0];
|
||
setOrderLeftValue(data.data.leftValues);
|
||
}
|
||
else {
|
||
$(this).prop("checked", false);
|
||
$.messager.alert("警告", data.message, "error");
|
||
}
|
||
}, "json");
|
||
});
|
||
|
||
$("#DDLDiscount").change(function () {
|
||
//alert(this.value);
|
||
var curNeedPay = $('#curNeedPay').val();
|
||
if (curNeedPay == "")
|
||
curNeedPay = 0;
|
||
|
||
if (this.value != '') {
|
||
var v = (100 - this.value) / 100;
|
||
var cnp = parseFloat(curNeedPay);
|
||
|
||
//取整
|
||
var pay = parseInt(cnp - (cnp * v));
|
||
$("#NEEdPAY").val(pay);
|
||
$("#needpaytext").html(pay);
|
||
jisuanNeedUse();
|
||
$("#discount").val(this.value);
|
||
}
|
||
else {
|
||
$("#NEEdPAY").val(curNeedPay);
|
||
$("#needpaytext").html(curNeedPay);
|
||
jisuanNeedUse();
|
||
$("#discount").val('');
|
||
}
|
||
});
|
||
|
||
//折后价选择
|
||
$("#DDLCustomPrisce").change(function () {
|
||
var curNeedPay = $('#curNeedPay').val();
|
||
if (curNeedPay == "")
|
||
curNeedPay = 0;
|
||
|
||
if (this.value != '') {
|
||
var v = this.value;
|
||
$("#NEEdPAY").val(v);
|
||
$("#needpaytext").html(v);
|
||
jisuanNeedUse();
|
||
$("#customprisce").val(this.value);
|
||
}
|
||
else {
|
||
$("#NEEdPAY").val(curNeedPay);
|
||
$("#needpaytext").html(curNeedPay);
|
||
jisuanNeedUse();
|
||
$("#customprisce").val('');
|
||
|
||
}
|
||
var isdk = $("#dk").is(':checked');
|
||
if (isdk) {
|
||
$("#UPGRADEORDERIDS").val("");
|
||
setOrderLeftValue(0);
|
||
}
|
||
});
|
||
//计算需要使用的金额
|
||
function jisuanNeedUse() {
|
||
var curNeedPay = $('#NEEdPAY').val();
|
||
if (!curNeedPay) {
|
||
$("#deppriceUseTxt").val("0");
|
||
$("#depprice").val("0");
|
||
$("#justpayTxt").html("0");
|
||
|
||
|
||
} else {
|
||
var dneedpay = parseFloat(curNeedPay);
|
||
if (dneedpay >= lastprice) {
|
||
$("#deppriceUseTxt").val("" + lastprice);
|
||
$("#depprice").val("" + lastprice);
|
||
$("#justpayTxt").html(dneedpay - lastprice);
|
||
} else {
|
||
$("#deppriceUseTxt").val("" + dneedpay);
|
||
$("#depprice").val("" + dneedpay);
|
||
$("#justpayTxt").html("0");
|
||
}
|
||
}
|
||
|
||
}
|
||
$("#promotion").change(function () {
|
||
if (this.value == 1) {
|
||
$("#discountTR").show();
|
||
$("#customprisceTR").hide();
|
||
$("#upgradeOrderShow1").hide();
|
||
$("#upgradeOrderShow2").hide();
|
||
|
||
var productid = $("#subProductId").val();
|
||
if (deptCode == "QBJX" && (productid == 1008194 || productid == 1008196)) {
|
||
$("#DDLDiscount").attr("disabled", "disabled").get(0).selectedIndex = 1;
|
||
$("#DDLDiscount").change();
|
||
//console.log($("#DDLDiscount").get(0));
|
||
}
|
||
else {
|
||
$("#DDLDiscount").removeAttr("disabled");
|
||
}
|
||
|
||
$("#DDLDiscount").show();
|
||
}
|
||
else if (this.value == 2) {
|
||
$("#discountTR").hide();
|
||
$("#customprisceTR").hide();
|
||
//$("#upgradeOrderShow1").show();
|
||
//$("#upgradeOrderShow2").show();
|
||
|
||
$("#DDLDiscount").hide();
|
||
$("#discount").val('');
|
||
|
||
var type = $("#ORDERTYPE").val();
|
||
setOrderLeftValue(0);
|
||
if (type == 3 || type == 4 || type == 5) {
|
||
$('#upgradeOrderShow1').show();
|
||
$('#upgradeOrderShow2').show();
|
||
} else {
|
||
$("#UPGRADEORDERIDS").val("");
|
||
|
||
$('#upgradeOrderShow1').hide();
|
||
$('#upgradeOrderShow2').hide();
|
||
}
|
||
} else if (this.value == 3) {
|
||
$("#customprisceTR").show();
|
||
$("#discountTR").hide();
|
||
$("#upgradeOrderShow1").hide();
|
||
$("#upgradeOrderShow2").hide();
|
||
|
||
var productid = $("#subProductId").val();
|
||
if (productid == 1008194 || productid == 1008196) {
|
||
$("#DDLCustomPrisce").attr("disabled", "disabled").get(0).selectedIndex = 1;
|
||
$("#DDLCustomPrisce").change();
|
||
}
|
||
else {
|
||
$("#DDLCustomPrisce").removeAttr("disabled");
|
||
}
|
||
$("#DDLCustomPrisce").show();
|
||
}
|
||
else {
|
||
$("#discountTR").hide();
|
||
$("#DDLDiscount").hide();
|
||
$("#customprisceTR").hide();
|
||
$("#discount").val('');
|
||
|
||
$("#UPGRADEORDERIDS").val("");
|
||
setOrderLeftValue(0);
|
||
$('#upgradeOrderShow1').hide();
|
||
$('#upgradeOrderShow2').hide();
|
||
}
|
||
});
|
||
|
||
$("#opendays2").change(function () {
|
||
if (this.value == '') {
|
||
$(this).val($("#curOpenDays").val());
|
||
$.messager.alert("警告", "天数不能为空!", "error");
|
||
return;
|
||
}
|
||
if (isNaN(this.value) || this.value == '') {
|
||
$(this).val($("#curOpenDays").val());
|
||
$.messager.alert("警告", "天数只能是数字!", "error");
|
||
return;
|
||
}
|
||
$("#OpenDays").val(this.value);
|
||
});
|
||
|
||
function zhikou(obj) {
|
||
var ischeck = $(obj).is(':checked');
|
||
if (ischeck) {
|
||
$("#discountTR").show();
|
||
|
||
var productid = $("#subProductId").val();
|
||
if (productid == 1008194 || productid == 1008196) {
|
||
$("#DDLDiscount").attr("disabled", "disabled").get(0).selectedIndex = 1;
|
||
$("#DDLDiscount").change();
|
||
}
|
||
else {
|
||
$("#DDLDiscount").removeAttr("disabled");
|
||
}
|
||
|
||
$("#DDLDiscount").show();
|
||
}
|
||
else {
|
||
$("#DDLDiscount").val('').change().hide();
|
||
$("#discountTR").hide();
|
||
setOrderLeftValue(0);
|
||
}
|
||
}
|
||
function zhihoujia(obj) {
|
||
var ischeck = $(obj).is(':checked');
|
||
if (ischeck) {
|
||
$("#customprisceTR").show();
|
||
|
||
var productid = $("#subProductId").val();
|
||
if (productid == 1008194 || productid == 1008196) {
|
||
$("#DDLCustomPrisce").attr("disabled", "disabled").get(0).selectedIndex = 1;
|
||
$("#DDLCustomPrisce").change();
|
||
}
|
||
else {
|
||
$("#DDLCustomPrisce").removeAttr("disabled");
|
||
}
|
||
|
||
$("#DDLCustomPrisce").show();
|
||
}
|
||
else {
|
||
$("#DDLCustomPrisce").val('').change().hide();
|
||
$("#customprisceTR").hide();
|
||
setOrderLeftValue(0);
|
||
}
|
||
}
|
||
|
||
|
||
function dikou(obj) {
|
||
var ischeck = $(obj).is(':checked');
|
||
|
||
if (ischeck) {
|
||
$('#upgradeOrderShow1').show();
|
||
$('#upgradeOrderShow2').show();
|
||
} else {
|
||
$("#UPGRADEORDERIDS").val("");
|
||
setOrderLeftValue(0);
|
||
$('#upgradeOrderShow1').hide();
|
||
$('#upgradeOrderShow2').hide();
|
||
}
|
||
|
||
}
|
||
|
||
function UsePriceShow() {
|
||
var needpay = $("#NEEdPAY").val();
|
||
if (!needpay) {
|
||
$.messager.alert("警告", "请先选择产品!", "error");
|
||
return;
|
||
}
|
||
if (lastprice == 0) {
|
||
$.messager.alert("错误", "无可用金额!", "error");
|
||
return;
|
||
}
|
||
var needpay = $("#NEEdPAY").val();
|
||
if (needpay != null) {
|
||
var needpayPrice = parseFloat(needpay);
|
||
if (needpay <= lastprice) {
|
||
$("#usePrice").val(needpay);
|
||
}
|
||
else {
|
||
$("#usePrice").val(lastprice);//金额不够用,默认全部使用
|
||
}
|
||
}
|
||
|
||
$("#alldeppay").html(lastprice);
|
||
$('#dlg').dialog({
|
||
title: "使用金额",
|
||
width: 400,
|
||
height: 250,
|
||
closed: false,
|
||
cache: false,
|
||
modal: true
|
||
});
|
||
}
|
||
|
||
function Use() {
|
||
var usePrice = $("#usePrice").val();
|
||
if (usePrice == '') {
|
||
$.messager.alert("错误", "使用金额不能为空!", "error");
|
||
return;
|
||
}
|
||
if (!validate(usePrice)) {
|
||
$.messager.alert("错误", "金额必须是数字!", "error");
|
||
return;
|
||
}
|
||
var alldeppay = lastprice;
|
||
var diffpay = alldeppay - usePrice;
|
||
if (diffpay < 0) {
|
||
$.messager.alert("错误", "使用金额不能超过剩余金额!", "error");
|
||
return;
|
||
}
|
||
var needpay = parseFloat($("#NEEdPAY").val());
|
||
if (usePrice > needpay) {
|
||
$.messager.alert("错误", "使用金额不能超过订单金额!", "error");
|
||
return;
|
||
}
|
||
|
||
$("#depprice").val(usePrice);
|
||
$("#deppriceUseTxt").val(usePrice);
|
||
|
||
$('#dlg').dialog('close');
|
||
}
|
||
|
||
function validate(num) {
|
||
var reg = /^\d+(?=\.{0,1}\d+$|$)/
|
||
if (reg.test(num)) return true;
|
||
return false;
|
||
}
|
||
|
||
function GetIframeHtml(src) {
|
||
return "<iframe width='100%' height='98%' scrolling='yes' 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);
|
||
$('#wx_SzzyOrder_EXTERNAL_USERID').val(mydata.extuserid);
|
||
}
|
||
frameReturnByClose();
|
||
}
|
||
</script>
|