list.html 9.27 KB
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>Yoho!Buy运营平台</title>
    <script src="/ufoPlatform/js/include.js"></script>
</head>
<body class="easyui-layout">
<input type="hidden" id="buyerOrderCode">
<input type="skup" id="skup">
<div region="north" style="height:230px;">
    <script>
        document.write(addHead('打款管理', '列表管理'));
    </script>

    <div style="padding:20px;">
        <label>订单编号:</label>
        <input id="orderCode" type="text" class="easyui-textbox" style="width:150px">

        <label>UID:</label>
        <input id="uid" type="text" class="easyui-textbox" style="width:150px"/>

        <label>手机号:</label>
        <input id="mobile" type="text" class="easyui-textbox" style="width:150px"/>

        <label>金额类型:</label>
        <select id="moneyType" class="easyui-combobox" style="width:150px;"  >
            <option value="">全部状态</option>
            <option value="12">买家货款</option>
            <option value="13">买家补偿款</option>
            <option value="22">卖家货款</option>
            <option value="23">卖家补偿款</option>
            <option value="21">卖家保证金</option>
        </select>
        <br><br>

        <label>订单状态:</label>
        <select id="status" class="easyui-combobox" style="width:150px;">
            <option value="">全部状态</option>
            <option value="100">成功</option>
            <option value="999">失败</option>
        </select>

        <a id="searchBtn" class="btn-info">查询</a>
        <!--<a id="allBtn" class="btn-success">全部</a>-->
    </div>
</div>

<div id="tradeBillsList" region="center">
	<table id="tradeBillsListTable"></table>
</div>

<div id="refundConfirmDialog" class="easyui-dialog"  style="width:400px;height:300px;"
     data-options="title:'人工打款确认',buttons:'#refundConfirmDialog_tb',modal:true,closed:true">
    <div style="padding:20px;">
        <input id="refund_sceneId" type="hidden"  readonly disabled/>
        <input id="refund_tradeBillsId" type="hidden"  readonly disabled/>
        <input id="refund_uid" type="hidden"  readonly disabled/>
        <label>订 单 编 号:</label>
        <input id="refund_orderCode" type="text" class="easyui-textbox" style="width:250px" readonly disabled/>

        <br/><br/>
        <label>支付宝账号:</label>
        <input id="refund_alipayAccount" type="text" class="easyui-textbox" style="width:250px" readonly disabled/>

        <br/><br/>
        <label>打 款 金 额:</label>
        <input id="refund_amount" type="text" class="easyui-textbox" style="width:250px" readonly disabled/>

    </div>
</div>
<div id="refundConfirmDialog_tb">
    <a href="#" id="refundConfirmDialog_btn_save" onclick="refundGo();" class="easyui-linkbutton btn-danger" >确定</a>
    <a href="#" id="refundConfirmDialog_btn_close" onclick="$('#refundConfirmDialog').dialog('close');" class="easyui-linkbutton btn-info" >关闭</a>
</div>

<script>
$(function() {
    $("#moneyType").combobox({
        panelHeight:'auto',
        multiple:false
    });

    $("#status").combobox({
        panelHeight:'auto',
        multiple:false
    });

	$("#searchBtn").linkbutton({
        iconCls : "icon-search",
        onClick : function() {
            /*if(!$("#orderCode").val()
                && !$("#uid").val()
                && !$("#mobile").val()){
                $.messager.alert("提示","请录入查询条件<br/>[订单编号、UID、手机号]至少选择一个!");
                $("#orderCode").focus();
                return;
            }*/

            loadTradeBillsData();
        }
    });
    
    getTradeBillsList();
});

function loadTradeBillsData() {
    $("#tradeBillsListTable").datagrid("load", {
        moneyType:$("#moneyType").myCombobox("getValue"),
        status : $("#status").myCombobox("getValue"),
        orderCode : $("#orderCode").val(),
        uid : $("#uid").val(),
        mobile : $("#mobile").val()
    });
}

function getTradeBillsList(){
	$("#tradeBillsListTable").myDatagrid({
        fit: true,
        fitColumns: true,
        striped: true,
        url: contextPath + "/tradeBills/queryTradeBillsList",
        method: 'POST',
        queryParams: {},
        loadFilter: function (data) {
        	var temp = defaultLoadFilter(data);
            temp=null==temp?[]:temp;
            temp.rows = temp.list;
            return temp;
        },

        columns: [[{
            title: "订单编号",
            field: "orderCode",
            width: 30,
            align: "center"
        },{
            title: "打款金额",
            field: "amount",
            width: 30,
            align: "center"
        },{
            title: "金额类型",
            field: "moneyTypeDesc",
            width: 30,
            align: "center"
        },{
            title: "用户uid",
            field: "uid",
            width: 30,
            align: "center"
        },{
            title: "用户手机号",
            field: "mobile",
            width: 30,
            align: "center",
            formatter: function (value, rowData) {
                return "-"  //公司要求隐藏卖家敏感信息
            }
        } ,{
            title: "打款时间",
            field: "createTimeStr",
            width: 20,
            align: "center"
        },{
            title: "操作员",
            field: "operatorName",
            width: 20,
            align: "center"
        },{
            title: "订单状态",
            field: "tradeStatus",
            width: 20,
            align: "center",
            formatter: function (value, rowData, rowIndex) {
                var moneyFlow="";
                if(rowData.moneyFlow!=null){
                    moneyFlow=rowData.moneyFlow;
                }
                if (value == 100) {
                    return moneyFlow+"成功";
                }else {
                    return "<span style='color: red'>"+moneyFlow+"失败</span>";
                }
            }
        }, {
            title: "原因",
            field: "tradeStatusDesc",
            width: 20,
            align: "center"
        }, {
            title: "操作",
            field: "asdf",
            width: 40,
            align: "center",
            formatter: function (value, rowData, rowIndex) {
            	if (rowData.tradeStatus != 100) {
                    var btn= "<a role='refundsConfirm' onclick='openConfirmDialog(0,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\")' style='margin-left:10px;background-color: #5cb85c !important;'>打款</a>";
                    btn = btn.replace("%s",rowData.id);
                    btn = btn.replace("%s",rowData.uid);
                    btn = btn.replace("%s",rowData.orderCode);
                    btn = btn.replace("%s",rowData.alipayAccount);
                    btn = btn.replace("%s",rowData.amount);
                    var markPaidBtn = "<a role='refundsConfirm' onclick='openConfirmDialog(10,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\")' style='margin-left:10px;background-color: #5cb85c !important;'>已打款</a>";
                    markPaidBtn = markPaidBtn.replace("%s",rowData.id);
                    markPaidBtn = markPaidBtn.replace("%s",rowData.uid);
                    markPaidBtn = markPaidBtn.replace("%s",rowData.orderCode);
                    markPaidBtn = markPaidBtn.replace("%s",rowData.alipayAccount);
                    markPaidBtn = markPaidBtn.replace("%s",rowData.amount);
                    return btn + markPaidBtn;
                }
            }
        }]],
        cache: false,
        pagination: true,
        //pageSize: 20,
        idField: "id",
        singleSelect: true,
        onLoadSuccess: function (data) {
            $(this).datagrid("getPanel").find("a[role='refundsConfirm']").linkbutton({});
        }
    });
}

function openConfirmDialog(sceneId,id,uid,orderCode,alipayAccount,amount) {
    //重新赋值
    $("#refund_sceneId").val(sceneId);
    $("#refund_tradeBillsId").val(id);
    $("#refund_uid").val(uid);
    $("#refund_orderCode").textbox('setValue',orderCode);
    $("#refund_alipayAccount").textbox('setValue',alipayAccount);
    $("#refund_amount").textbox('setValue',amount);
    $("#refundConfirmDialog").dialog('open');
}

//确认打款
function refundGo() {
    var param={};
    param.sceneId = $("#refund_sceneId").val();
    param.tradeBillsId = $("#refund_tradeBillsId").val();
    param.uid=$("#refund_uid").val();
    param.orderCode=$("#refund_orderCode").val();
    param.alipayAccount=$("#refund_alipayAccount").val();
    param.amount=$("#refund_amount").val();


    //发送请求
    $.ajax({
        type: "POST",
        url: contextPath + '/tradeBills/manualRefund',
        data: param,
        async: false,
        cache: false,
        dataType: 'json',
        success: function (result) {
            if(result.code == 200) {
                $("#refundConfirmDialog").dialog('close');
                loadTradeBillsData();
            }
            else {
                $.messager.alert("失败", result.message, "error");
                $("#refundConfirmDialog").dialog('close');
                loadTradeBillsData();
            }
        }
    });

    //按钮置灰
    $("#refundConfirmDialog_btn_save").linkbutton("disabled");
    $("#refundConfirmDialog_btn_close").linkbutton("disabled");
}

</script>
</body>
</html>