TG.WXCRM.V4/WEB/Views/WeiXin/JZOrder/ApplyOrderRefund.cshtml

338 lines
13 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.OrderRefundDto
@using WX.CRM.WebHelper;
@{
ViewBag.Title = "退款申请";
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
}
<style>
.layui-table td, .layui-table th {
padding: 5px 15px;
}
</style>
<div class="mvctool bgb">
@Html.ToolButtonPlain("btnSave", "icon-save", "保存", false, "")
</div>
@using (Html.BeginForm("AddOrderPay", "JZOrder", null, FormMethod.Post, new { Id = "CreateForm" }))
{
@Html.ValidationSummary(true)
<table class="fromEditTable ">
<tr>
<td style="width:120px;">订单号:</td>
<td style="width:310px">
<input type="text" value="@Html.DisplayFor(m => m.orderid)" disabled readonly>
<input type="hidden" id="orderid" name="orderid" value="@Html.DisplayFor(m => m.orderid)" />
</td>
<td width="120px"></td>
</tr>
<tr>
<td>类型:</td>
<td>
<input type="radio" value="1" name="isacturalrefund" id="isacturalrefund1" checked onchange="ShowAllHidden()" /> <label for="isacturalrefund1">需实际退款</label>
<input type="radio" value="0" name="isacturalrefund" id="isacturalrefund0" onchange="ShowAllHidden()" /> <label for="isacturalrefund0">退回可用余额</label>
</td>
<td></td>
</tr>
<tr id="tr_paytype">
<td style="width:120px;">支付类型:</td>
<td style="width:310px">
@Html.DropDownListFor(m => m.refundtype, new List<SelectListItem>() {
new SelectListItem(){Text="支付宝",Value="1",Selected=true},
new SelectListItem(){Text="银行转账",Value="3"},
new SelectListItem(){Text="财富通",Value="2"},
new SelectListItem(){Text="微信支付",Value="5"},
new SelectListItem(){Text="网银支付",Value="4"},
new SelectListItem(){Text="支付宝银联",Value="6"},
new SelectListItem(){Text="苹果支付",Value="11"},
new SelectListItem(){Text="华为支付",Value="12"},
new SelectListItem(){Text="魅族支付",Value="13"}
})
</td>
<td width="120px"></td>
</tr>
<tr id="tr_account">
<td style="width:120px;">退款人账号:</td>
<td style="width:310px">
<input type="text" id="account" name="account">
</td>
<td width="120px"></td>
</tr>
<tr id="tr_name">
<td style="width:120px;">退款人姓名:</td>
<td style="width:310px">
<input type="text" id="username" name="username">
</td>
<td width="120px"></td>
</tr>
<tr>
<td>退款金额:</td>
<td>
<input type="text" id="refundprice" name="refundprice" placeholder="¥" value='@Model.refundprice'>
</td>
<td></td>
</tr>
@*<tr>
<td style="width:120px;">退款日期:</td>
<td style="width:310px">
<input id="refunddate" name='refunddate' class='Wdate' type='text' value='@DateTime.Now.ToString("yyy-MM-dd")' onclick='javascript: WdatePicker();' />
</td>
<td width="120px"></td>
</tr>*@
<tr>
<td style="width:120px;">
<div class="layui-form" style="width:15px;">
<input type="checkbox" style="height:15px" id="Retrace_refund_checkbox" lay-filter="Retrace_refund_filter" title="非原路退款:" lay-skin="primary">
</div>
</td>
<td style="width:310px">
<div id="Retrace_refund_uploaddiv">
<input name="Retrace_refund" id="Retrace_refund" autocomplete="off" class="layui-hide" type="hidden">
<button type="button" class="layui-btn layui-btn-sm" id="Retrace_refundUpload">上传</button>
<a href="" id="Retrace_refund_file"> 附件</a>
<a href="~/UploadFile/Download/Retrace_refund.docx" style=" float:right"> 下载模板</a>
</div>
</td>
<td width="120px"></td>
</tr>
<tr style="display:none;">
<td>附件:</td>
<td><input type="file" id="att" name="att" /></td>
<td></td>
</tr>
<tr>
<td style="width:120px;">退款原因:</td>
<td style="width:310px">
<div class="layui-form">
<select lay-filter="RefundReasonType-filter">
<option value="">请选择</option>
@foreach (var item in ViewBag.RefundReasonTypeList )
{
<optgroup label="@item.TopType">
@foreach (var itemtype in item.Type)
{
<option value="@item.TopType|@itemtype">@itemtype</option>
}
</optgroup>
}
</select>
</div>
</td>
<td width="120px"></td>
</tr>
<tr>
<td style="width:120px;">退款说明:</td>
<td style="width:310px">
<textarea placeholder="请输入内容" id="remark" name="remark" class="layui-textarea" rows="5" style=" width: 250px;"></textarea>
</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 RefundReasonType = "";
layui.use(['layer', 'form', 'upload', 'element'], function () {
var form = layui.form,
layer = layui.layer,
upload = layui.upload,
element = layui.element;
var token = $.cookie("AuthToken");
$("#Retrace_refund_file").hide();
upload.render({
elem: '#Retrace_refundUpload'
, url: '@ViewBag.ApiUrl/InvoiceHandler.ashx'
, data: { action: 'upload', FileName: 'Retrace_refund', SavePath: "contract/Refund" }
, headers: { auth: token }
, auto: true
, accept: 'file'
, exts:'doc|docx|xls|xlsx|pdf|zip|jpg|png|gif|bmp|jpeg|'
, before: function (obj) {
//预读本地文件示例不支持ie8
obj.preview(function (index, file, result) {
console.log(result);
// $("#Retrace_refund_file").attr('href', +@ViewBag.ZxdCoreUrl+res.retmsg); //图片链接base64
});
}
, done: function (res) {
//如果上传失败
if (!res.result) {
return layer.msg('上传失败');
}
//上传成功的一些操作
console.log(res);
$("#Retrace_refund_file").attr('href', '@ViewBag.ZxdCoreUrl'+res.retmsg); //图片链接base64
$("#Retrace_refund").val(res.retmsg);
$("#Retrace_refund_file").show();
}
, error: function () {
$("#Retrace_refund_file").removeAttr('src');
layer.msg('上传失败,请重试!');
}
});
if (@ViewBag.isRetrace_refund==0) {
$("#Retrace_refund_uploaddiv").hide();
}else{
layui.$("#Retrace_refund_checkbox").prop('checked',true);
form.render('checkbox');
}
form.on('checkbox(Retrace_refund_filter)', function (data) {
var elem = data.elem; // 获得 checkbox 原始 DOM 对象
var checked = elem.checked; // 获得 checkbox 选中状态
if (checked) {
$("#Retrace_refund_uploaddiv").show();
} else {
$("#Retrace_refund_uploaddiv").hide();
}
});
form.on('select(RefundReasonType-filter)', function (data) {
var value = data.value; // 获得被选中的值
//$("#remark").val(value);
RefundReasonType = value;
});
});
$(function () {
$("#btnSave").click(function () {
if ($("#CreateForm").valid()) {
var orderarrypay="@ViewBag.OrderArryPay";
var orderid = $("#orderid").val();
var refundtype = $("#refundtype").val();
var account = $("#account").val();
var username = $("#username").val();
var refundprice = $("#refundprice").val();
var Retrace_refund = $("#Retrace_refund").val();
var remark = $("#remark").val();
if (orderid == "") {
$.messager.alert("错误", "订单ID不能为空", "error");
return;
}
if (refundprice == "") {
$.messager.alert("错误", "退款金额不能为空!", "error");
return;
}
else {
if (!validate(refundprice)) {
$.messager.alert("错误", "请输入数字!", "error");
return;
}
else {
if (parseFloat(refundprice) > 1000000) {
$.messager.alert("错误", "金额太大了!", "error");
return;
}
}
}
if (orderarrypay && parseFloat(orderarrypay) < parseFloat(refundprice)) {
$.messager.alert("错误", "退款金额不能超过到账金额!", "error");
return;
}
if (remark == "") {
$.messager.alert("错误", "退款说明不能为空!", "error");
return;
}
if (RefundReasonType == "") {
$.messager.alert("错误", "退款原因不能为空!", "error");
return;
}
var isacturalrefund= $('input[name="isacturalrefund"]:checked').val();
if (@ViewBag.isRetrace_refund== 1) {
if (Retrace_refund == "") {
$.messager.alert("错误", "一年前退款须提交非原路退款协议!", "error");
return;
}
}
var para = new FormData();
para.append("orderId", orderid);
para.append("refundtype", refundtype);
if (account != "") {
para.append("account", account);
}
if (username != "") {
para.append("username", username);
}
para.append("refundprice", refundprice);
//para.append("refunddate", refunddate);
para.append("isacturalrefund", isacturalrefund);//退款类型
para.append("Retrace_refund_file", Retrace_refund);//原路退款附件
para.append("RefundReasonType", RefundReasonType);//退款原因
var file = $("#att")[0].files[0];
//console.log(file);
if (file != undefined) {
para.append("att", $("#att")[0].files[0]);
}
para.append("remark", remark);
$.r_ajax({
url: "/WeiXin/JZOrder/ApplyOrderRefund",
type: "Post",
cache: false,
//data: $("#CreateForm").serialize(),
data: para,
dataType: "json",
contentType: false,
loading: true,
processData: false,
success: function (data) {
if (data.type == 1) {
//window.parent.frameReturnByMes(data.message);
window.parent.frameReturnByMes('提交成功');
window.parent.frameReturnByReload(true);
window.parent.frameReturnByClose();
}
else {
$.messager.alert("警告", data.message, "error");
}
}
});
}
return false;
});
});
function ShowAllHidden() {
var isacturalrefund = $('input[name="isacturalrefund"]:checked').val();
if (isacturalrefund == "0") {
$("#tr_account").hide();
$("#tr_name").hide();
//$("#tr_paytype").hide();
} else {
$("#tr_account").show();
$("#tr_name").show();
//$("#tr_paytype").show();
}
}
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>