TG.WXCRM.V4/WEB/Views/WeiXin/OrderDeposit/Add.cshtml

196 lines
7.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@model CRM.Core.DTO.Ord.OrderDepositDto
@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("AddOrderDeposit", "JZOrder", null, FormMethod.Post, new { Id = "CreateForm" }))
{
@Html.ValidationSummary(true)
<input type="hidden" name="resid" value="@Request.QueryString["CustomerId"]" />
<table class="fromEditTable ">
@*<tr>
<td style="width:120px;">客户ID</td>
<td style="width:310px">
<input type="text" value="@Request.QueryString["CustomerId"]" disabled readonly>
</td>
<td width="120px"></td>
</tr>*@
@if (ViewBag.DeptList != null)
{
<tr>
<td>部门归属:</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 style="width:120px;">支付类型:</td>
<td style="width:310px">
@Html.DropDownList("PAYTYPE", new List<SelectListItem>() {
new SelectListItem(){Text="支付宝",Value="1",Selected=true},
new SelectListItem(){Text="银行转账",Value="3"},
new SelectListItem(){Text="微信支付",Value="5"}})
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">订金日期:</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>订金金额:</td>
<td>
<input type="text" id="payprice" name="payprice" placeholder="¥">
</td>
<td></td>
</tr>
<tr>
<td style="width:120px;">付款人姓名:</td>
<td style="width:310px">
<input type="text" id="payname" name="payname" placeholder="请输入">
</td>
<td width="120px"></td>
</tr>
<tr>
<td>支付流水号:</td>
<td><input type="text" id="payno" name="payno" placeholder="请输入"></td>
<td></td>
</tr>
<tr>
<td style="width:120px;">备注:</td>
<td style="width:310px">
<textarea placeholder="请输入内容" name="remark" class="layui-textarea" rows="5" style=" width: 250px;"></textarea>
</td>
<td width="120px"></td>
</tr>
</table>
}
<script type="text/javascript">
$(function () {
$("#btnSave").click(function () {
if ($("#CreateForm").valid()) {
var paydate = $("#paydate").val();
var payprice = $("#payprice").val();
var payname = $("#payname").val();
var payno = $("#payno").val();
var paytype = $("#PAYTYPE").val();
if (paydate == "") {
$.messager.alert("错误","订金日期不能为空!","error");
return;
}
if (payprice == "") {
$.messager.alert("错误", "付款金额不能为空!", "error");
return;
}
else {
if (!validate(payprice)) {
$.messager.alert("错误", "请输入数字!", "error");
return;
}
else {
if (parseFloat(payprice) > 1000000) {
$.messager.alert("错误", "金额太大了!", "error");
return;
}
}
}
if (payname == "") {
$.messager.alert("错误", "付款人姓名不能为空!", "error");
return;
}
if (payno == "") {
$.messager.alert("错误", "支付流水号不能为空!", "error");
return;
}
else {
if (paytype == 1 || paytype == 5) {
var len = payno.length;
if (len < 28) {
$.messager.alert("错误", "支付流水号错误!", "error");
return;
}
//if (len > 28) {
// payno = payno.substring(0, 28);
//}
//console.log(payno);
if (isNaN(payno)) {
$.messager.alert("错误", "支付流水号只能是数字,不能有字符或者空格!", "error");
return;
}
var start = payno.substring(0, 1);
//console.log(start);
if (start == 2 && paytype != 1) {
$.messager.alert("错误", "支付流水号跟支付类型不匹配!", "error");
return;
}
if (start == 4 && paytype != 5) {
$.messager.alert("错误", "支付流水号跟支付类型不匹配!", "error");
return;
}
}
}
@if (ViewBag.DeptList != null)
{
@Html.Raw("var deptcode = $('#deptcode');");
@Html.Raw("if (!$.trim(deptcode.val())){");
@Html.Raw(" $.messager.alert('错误', '请选择部门归属!', 'error'); return;");
@Html.Raw("}");
}
$.r_ajax({
url: "/WeiXin/OrderDeposit/Add",
type: "Post",
data: $("#CreateForm").serialize(),
dataType: "json",
loading: true,
success: function (data) {
if (data.type == 1) {
$.messager.alert("提示", '提交成功!', "info", function () { window.parent.location.reload(); });
}
else {
$.messager.alert("警告", data.message, "error");
}
}
});
}
return false;
});
});
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='no' frameborder='0'' src='" + src + "'></iframe>";
}
function frameReturnByClose() {
$("#modalwindow").window('close');
}
</script>