list.html 14.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
<!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>
        <input id="startTime" type="text">
        <input id="endTime" type="text">
        <br><br>
        <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>
            <option value="24">申请寄存返利</option>
        </select>
        <label>订单状态:</label>
        <select id="status" class="easyui-combobox" style="width:150px;">
            <option value="">全部状态</option>
            <option value="100">成功</option>
            <option value="999">失败</option>
        </select>
        <label>支付失败状态:</label>
        <select id="payErrorCode" class="easyui-combobox" style="width:150px;">
            <option value="">全部状态</option>
        </select>
        <a id="searchBtn" class="btn-info">查询</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_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/>

        <input id="refund_alipayAccount" type="hidden" 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>


<div id="markPaidConfirmDialog" class="easyui-dialog"  style="width:400px;height:300px;"
     data-options="title:'确定财务已经完成打款?',buttons:'#markPaidConfirmDialog_tb',modal:true,closed:true">
    <div style="padding:20px;">
        <input id="mark_paid_tradeBillsId" type="hidden" />
        <input id="mark_paid_uid" type="hidden" />
        <label>订单编号:</label>
        <input id="mark_paid_orderCode" type="text" class="easyui-textbox" style="width:250px" readonly disabled/>

        <br/><br/>
        <label>打款渠道:</label>
        <select id="mark_paid_sceneId" class="easyui-combobox" style="width:250px">
            <option value="102">支付宝</option>
            <option value="103">银行卡</option>
        </select>
        <br/><br/>
        <label>打款金额:</label>
        <input id="mark_paid_amount" type="text" class="easyui-textbox" style="width:250px" readonly disabled/>

    </div>
</div>
<div id="markPaidConfirmDialog_tb">
    <a href="#" id="markPaidConfirmDialog_btn_save" onclick="markPaidGo();" class="easyui-linkbutton btn-danger" >确定</a>
    <a href="#" id="markPaidConfirmDialog_btn_close" onclick="$('#markPaidConfirmDialog').dialog('close');" class="easyui-linkbutton btn-info" >关闭</a>
</div>

<script>
$(function() {

    //渲染开始时间和结束时间
    $('#startTime').datebox({});
    $('#endTime').datebox({});

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

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

    let Init = {setPayErrorCodeOptions : function () {
            $.ajax({
                type: "POST",
                url: contextPath + '/tradeBills/getPayErrorCodeOptions',
                async: false,
                cache: false,
                dataType: 'json',
                success: function (result) {
                    if(result.code == 200) {
                        var optionData = result.data
                        var arrys=new Array();
                        arrys.push({"code":"", "text":"全部"});
                        $.each(optionData,function(index, data){
                            arrys.push({"code":index, "text":data});});
                        console.log(arrys);

                        $("#payErrorCode").combobox({
                            data: arrys,
                            valueField:'code',
                            textField:'text'
                        });
                    }

                }
            });
        }
    };
    Init.setPayErrorCodeOptions();


	$("#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(reload) {
    let loadType = reload ? "reload" : "load";
    let startTime = $('#startTime').datebox('getValue');
    let endTime = $('#endTime').datebox('getValue');
    if (startTime) {
        startTime = new Date(startTime + " 00:00:00").getTime() / 1000;
    } else {
        startTime = null;
    }
    if (endTime) {
        endTime = new Date(endTime + " 23:59:59").getTime() / 1000;
    } else {
        endTime = null;
    }
    if (startTime && endTime) {
        if (startTime > endTime) {
            $.messager.alert("提示", "开始日期不能超过结束日期");
            return;
        } else if (endTime - startTime > 31 * 24 * 3600) {
            $.messager.alert("提示", "日期差不能超过一个月");
            return;
        }
    }
    $("#tradeBillsListTable").datagrid(loadType, {
        moneyType:$("#moneyType").myCombobox("getValue"),
        status : $("#status").myCombobox("getValue"),
        payErrorCode : $("#payErrorCode").combobox("getValue"),
        orderCode : $("#orderCode").val(),
        uid : $("#uid").val(),
        mobile : $("#mobile").val(),
        startTime : startTime,
        endTime : endTime,
    });
}

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: 25,
            align: "center",
            formatter: function (value, rowData, rowIndex) {
                var href = contextPath + "/html/orderManage/detail.html?orderCode=" + value + "&ver=" + new Date().getTime();
                return "<a href='" + href + "' target='_blank'>" + value + "</a>";
            }
        },{
            title: "付款单号",
            field: "paidOrderCode",
            width: 25,
            align: "center"
        },{
            title: "打款金额",
            field: "amount",
            width: 20,
            align: "center"
        },{
            title: "金额类型",
            field: "moneyTypeDesc",
            width: 25,
            align: "center"
        },{
            title: "用户uid",
            field: "uid",
            width: 30,
            align: "center"
        } ,{
            title: "打款时间",
            field: "createTimeStr",
            width: 30,
            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 == 0) {
                    return "新账单";
                } else if (value == 10) {
                    return "待收款";
                } else if (value == 11) {
                    return "打款中";
                } else if (value == 90) {
                    return "转账中";
                } else 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) {
                var tradeStatus = rowData.tradeStatus;
                if(tradeStatus == 100){
                    return;
                }
                // 构造已打款按钮
                var markPaidBtn= "<a role='confirmDialog' onclick='openMarkPaidConfirmDialog(\"%s\",\"%s\",\"%s\",\"%s\",\"%s\")' style='margin-left:10px;background-color: #d9534f !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);
                if (tradeStatus == 90) {
                    return markPaidBtn;
                }
                // 构造打款按钮
                var payBtn= "<a role='confirmDialog' onclick='openConfirmDialog(\"%s\",\"%s\",\"%s\",\"%s\",\"%s\")' style='margin-left:10px;background-color: #5cb85c !important;'>打款</a>";
                payBtn = payBtn.replace("%s",rowData.id);
                payBtn = payBtn.replace("%s",rowData.uid);
                payBtn = payBtn.replace("%s",rowData.orderCode);
                payBtn = payBtn.replace("%s",rowData.alipayAccount);
                payBtn = payBtn.replace("%s",rowData.amount);
                return payBtn + markPaidBtn;
            }
        }]],
        cache: false,
        pagination: true,
        //pageSize: 20,
        idField: "id",
        singleSelect: true,
        onLoadSuccess: function (data) {
            $(this).datagrid("getPanel").find("a[role='confirmDialog']").linkbutton({});
        }
    });
}

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

    $("#refundConfirmDialog").dialog('open');
}

function openMarkPaidConfirmDialog(id,uid,orderCode,alipayAccount,amount) {
    //重新赋值
    $("#mark_paid_sceneId").combobox('setValue','102');
    $("#mark_paid_tradeBillsId").val(id);
    $("#mark_paid_uid").val(uid);
    $("#mark_paid_orderCode").textbox('setValue',orderCode);

    $("#mark_paid_amount").textbox('setValue',amount);

    $("#markPaidConfirmDialog").dialog('open');
}

//确认打款
function refundGo() {
    var param={};
    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) {
                $.messager.alert("失败", result.message, "error");
            }
            $("#refundConfirmDialog").dialog('close');
            loadTradeBillsData(true);
        }
    });

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


function markPaidGo() {
    var param={};
    param.sceneId = $("#mark_paid_sceneId").combobox('getValue');
    param.tradeBillsId = $("#mark_paid_tradeBillsId").val();
    param.uid=$("#mark_paid_uid").val();
    param.orderCode=$("#mark_paid_orderCode").val();
    param.alipayAccount="0";
    param.amount=$("#mark_paid_amount").val();

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

    //按钮置灰
    $("#markPaidConfirmDialog_btn_save").linkbutton("disabled");
    $("#markPaidConfirmDialog_btn_close").linkbutton("disabled");
}

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