bidDetail.html 10.2 KB
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>Yoho!Buy运营平台</title>
    <script src="/ufoPlatform/js/include.js"></script>
    <script src="/ufoPlatform/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 160px">
    <script>
        document.write(addHead('库存详情', ''));
    </script>
    <style>
        .div_search input {margin-top: 20px;}
        .div_search .textbox {margin-top: 20px;}
        .div_search .easyui-linkbutton {margin-top: 20px;}
    </style>

    <div style="margin-left: 30px;" class="div_search">
        <input id="status" type="text"/>
        <input id="SKUP" type="text">
        <input id="attribute" type="text">
        <input id="bidUid" type="text">
        <input id="storageId" type="text">
        <input id="sizeId" type="text">

        <a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
        <a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
        <a id="returnList" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">返回列表</a>
    </div>
</div>
<div region="center">
    <div style="margin-left: 30px;margin-top: 20px;height: 660px">
        <table id="skupTable"></table>
    </div>
</div>

<script type="text/javascript">
    var ENUM = {
        sku_p_status: {
            0   : '待付保证金',
            1   : '出售中',
            2   : '卖家取消支付',
            3   : '卖家支付超时',
            4   : '卖家取消出售',
            10  : '待审核',
            11  : '审核不通过',
            100 : '已出售',
            101 : '出售中',    // 买家手动取消、买家超时未支付对应 --》skup 出售中
            102 : '出售中',
            200 : '平台取消出售',
            201 : '已出售'     // 订单鉴定失败 --》skup 已出售
        }
    };
    function parseURL(url){
        var url = url.split("?")[1];
        var para = url.split("&");
        var len = para.length;
        var res = {};
        var arr = [];
        for(var i=0;i<len;i++){
            arr = para[i].split("=");
            res[arr[0]] = arr[1];
        }
        return res;
    }
    $(function () {
        var productId = parseURL(window.location.href).productId;
        var midSortId = parseURL(window.location.href).midSortId;

        $('#returnList').linkbutton({
            onClick: function () {
                location.href = contextPath + "/html/goods/storage/storageList.html?time_version=" + new Date().getTime();
            }
        });
        //
        // * 卖家操作
        //*  0:初始(未支付保证金),*1:可售(已经支付保证金),2:卖家取消支付保证金,3:卖家超时未支付保证金,4:卖家支付保证金后取消售卖
        //* 买家操作
        //*  100:购买使得商品卖出(可能下单未支付,且未超时,或者已支付),101:取消卖出(买家手动),102:取消卖出(超时未支付)
        //* 平台操作
        //*  200:客服取消,201:鉴定失败
        $("#status").myCombobox({
            prompt: "状态",
            width: 200,
            data: [{id: '10',text: '求购中'},        {id: '60',text: '求购成功'},   {id: '71',text: '求购关闭(买家取消求购)'}, {id: '72',text: '求购关闭(买家求购超时)'},
                   {id: '73',text: '求购关闭(平台取消求购)'}],
            valueField: "id",
            textField: "text"
        });

        $("#attribute").myCombobox({
            prompt: "SKU_P类型",
            width: 200,
            data: [{id: '1',text: '现货'}],
            valueField: "id",
            textField: "text"
        });

        $("#SKUP").textbox({
            prompt: "SKU_P"
        });
        $("#bidUid").textbox({
            prompt: "卖家UID"
        });

        $("#storageId").textbox({
            prompt: "SKU"
        });

        $.ajax({
            contentType: "application/json",
            dataType: "json",
            type: "GET",
            url: contextPath + '/size/queryAllSize4Goods?sortId=' + midSortId,
            success: function (data) {
                if (data.code != 200 || !data.data || data.data.length == 0) {
                    return;
                }
                $("#sizeId").myCombobox({
                    prompt: "尺码",
                    width: 200,
                    data: data.data,
                    valueField: "id",
                    textField: "text"
                });
            }
        });

        $("#skupTable").myDatagrid({
            fit: true,
            fitColumns: true,
            nowrap: false,
            url: contextPath + "/storage/bidPriceList",
            method: 'POST',
            queryParams: {
             'productId': productId,
            },
            loadFilter: function (data) {
                var temp = defaultLoadFilter(data);
                temp.rows = temp.list;
                return temp;
            },
            columns: [[{
                title: "SKU_P",
                field: "skup",
                width: 40,
                align: "center"
            }, {
                title: "SKUP类型",
                field: "attributeStr",
                width: 80,
                align: "center",
            }, {
                title: "SKU",
                field: "storageId",
                width: 80,
                align: "center"
            }, {
                title: "颜色",
                field: "colorName",
                width: 100,
                align: "center"
            }, {
                title: "尺码",
                field: "sizeName",
                width: 80,
                align: "center"
            }, {
                title: "买家UID",
                field: "bidUid",
                width: 200,
                align: "center"
            }, {
                title: "求购价",
                field: "price",
                width: 50,
                align: "center",
            }, {
                title: "状态",
                field: "statusStr",
                width: 50,
                align: "center"
            }, {
                title: "创建时间",
                field: "createTimeStr",
                width: 130,
                align: "center"
            }, {
                title: "操作",
                field: "operations",
                width: 120,
                align: "center",
                formatter: function (value, rowData) {
                    var button = '';
                    if (rowData.status == 10) {
                        button += "<a  role='cancel' dataId='" + rowData.skup + "' product_name='" +  rowData.productName + "'  style='margin-left:10px;background-color: #f0ad4e'>取消求购</a>";
                    }
                    return button;
                }
            }]],
            cache: false,
            pagination: true,
            pageSize: 50,
            idField: "id",
            singleSelect: false,
            checkOnSelect: false,
            onLoadSuccess: function () {

                // 取消
                $(this).myDatagrid("getPanel").find("a[role='cancel']").linkbutton({
                    iconCls: "icon-edit",
                    onClick: function () {
                        var id = $(this).attr("dataId");
                        cancelBid(id);
                    }
                });
            }
        });


        // 搜索
        $("#searchLinkButton").linkbutton({
            onClick: function () {
                var param = getParams();
                $("#skupTable").myDatagrid("load", param);
            }
        });

        // 搜索全部
        $("#searchAllLinkButton").linkbutton({
            onClick: function () {
                $('#status').combobox('clear');
                $('#SKUP').textbox('clear');
                $('#attribute').combobox('clear');
                $('#bidUid').textbox('clear');
                $('#storageId').textbox('clear');
                $('#sizeId').combobox('clear');
                var param = {};
                $("#skupTable").myDatagrid("load", param);
            }
        });

        /**
         * 提取出搜索参数
         * <input id="status" type="text"/>
         <input id="SKUP" type="text">
         <input id="bidUid" type="text">
         <input id="storageId" type="text">
         */
        function getParams() {
            var status = $('#status').combobox('getValue');
            var skup = $('#SKUP').textbox('getValue');
            var attribute = $('#attribute').combobox('getValue');
            var bidUid = $('#bidUid').textbox('getValue');
            var storageId = $('#storageId').textbox('getValue');
            var sizeId = $('#sizeId').combobox('getValue');
            var param = {'productId': productId};

            if (undefined !== status && null !== status && "" !== status) {
                param.status = status;
            }
            if (undefined !== skup && null !== skup && "" !== skup) {
                param.skup = skup;
            }
            if (undefined !== attribute && null !== attribute && "" !== attribute) {
                param.attribute = attribute;
            }
            if (undefined !== bidUid && null !== bidUid && "" !== bidUid) {
                param.bidUid = bidUid;
            }
            if (undefined !== storageId && null !== storageId && "" !== storageId) {
                param.storageId = storageId;
            }
            if (undefined !== sizeId && null !== sizeId && "" !== sizeId) {
                param.sizeId = sizeId;
            }
            return param;
        }


        // 取消求购
        function cancelBid(skup) {
            $.post(contextPath + "/storage/cancelBid",{"skup":skup}, function (data) {
                $.messager.progress("close");
                if (data.code == 200) {
                    $("#skupTable").myDatagrid("reload");
                    $.messager.show({title: "提示", msg: '操作成功', height: 120});
                } else {
                    $.messager.alert("失败", '操作失败', "error");
                }
            }, "json");
        }

    });


</script>

</body>
</html>