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

165 lines
5.7 KiB
Plaintext

@model CRM.Core.DTO.Ord.OrderPayDto
@{
ViewBag.Title = "支付记录录入";
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
}
<style>
.layui-table td, .layui-table th {
padding: 5px 15px;
}
</style>
<div class="mvctool bgb">
<input class="layui-btn layui-btn-ok" id="btnGen" type="button" value="生成支付二维码" />
<input class="layui-btn" type="button" id="btnAdd" value="继续添加" style="display:none;" />
<input class="layui-btn layui-btn-primary" id="btnClose" type="button" value="关闭" style="display:none;" />
</div>
@using (Html.BeginForm("Add2", "OrderDeposit", null, FormMethod.Post, new { Id = "CreateForm" }))
{
<table class="fromEditTable" id="qrcodeTab">
<tr>
<td style="width:120px;">订单号:</td>
<td style="width:310px">
<input type="text" value="@Html.DisplayFor(m => m.orderid)" disabled readonly>
<input type="hidden" name="orderid" value="@Html.DisplayFor(m => m.orderid)" />
<input type="hidden" name="needpay" value="@Html.DisplayFor(m => m.needpay)" />
</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">
<select name="PAYTYPE" id="PAYTYPE">
<option value="1">支付宝</option>
<option value="5" selected="selected">微信支付</option>
</select>
</td>
<td width="120px"></td>
</tr>
<tr>
<td>付款金额:</td>
<td>
<input type="text" id="payprice" name="payprice" value="@Html.DisplayFor(m => m.needpay)" placeholder="¥">
</td>
<td>
@if (!string.IsNullOrEmpty(ViewBag.QuoTa as string))
{
<span id="quotaTip" style="color:red">限额:@ViewBag.QuoTa</span>
}
<input type="hidden" id="quota" value="@ViewBag.QuoTa" />
</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>
</table>
<div id="qrcodeDiv" style="text-align:center;display:none;">
<img id="QrCodeImg" width="300" />
</div>
}
<script type="text/javascript">
$(function () {
$("#PAYTYPE").change(function () {
if (this.value == 1) {
$("#quotaTip").hide();
}
else {
$("#quotaTip").show();
}
});
$("#btnGen").click(function () {
var payType = $("#PAYTYPE").val();
var payprice = $("#payprice").val();
var payname = $("#payname").val();
if (payprice == "") {
$.messager.alert("错误", "付款金额不能为空!", "error");
return;
}
if (payname == "") {
$.messager.alert("错误", "付款人姓名不能为空!", "error");
return;
}
if (payType == 5) {
var quota = $("#quota").val();
if (quota != '') {
if (parseFloat(payprice) > parseFloat(quota)) {
$.messager.alert("错误", "付款金额不能大于限额" + quota, "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/Add2",
type: "Post",
data: $("#CreateForm").serialize(),
dataType: "json",
loading: true,
success: function (data) {
if (data.type == 1) {
//$.messager.alert("提示", '提交成功!', "info");
$("#QrCodeImg").attr("src", "/weixin/OrderDeposit/GetQRCode?id=" + data.message + "&r=" + Math.random());
$("#qrcodeDiv").show();
$("#qrcodeTab").hide();
$("#btnGen").hide();
$("#btnAdd").show();
$("#btnClose").show();
}
else {
$.messager.alert("警告", data.message, "error");
}
}
});
return false;
});
$("#btnAdd").click(function () {
$("#btnGen").show();
$("#btnAdd").hide();
$("#btnClose").hide();
$("#qrcodeDiv").hide();
$("#qrcodeTab").show();
});
$("#btnClose").click(function () {
parent.layer.closeAll();
});
});
</script>