datatables和template列表查询分页单元格合并

html代码:

页面需要引用template.js和dataTables.js:

<script type="text/javascript" src="${p_static}/admin/partnerCheck/js/template.js"></script>
<script src="${static_ctx}/lte/plugins/datatables/jquery.dataTables.min.js"></script>
<div class="box-body">
     <#-- artTemplate 插件表格显示 用于展示合并表格数据 -->
      <table id="purchaseListDiv" class="table table-bordered dataTable">
      </table>

     <#-- jqueryTables 插件表格隐藏 仅用于分页处理 -->
      <table id="dataTable" class="table table-bordered table-striped dataTable" style="display: none;">
         <colgroup>
           <col width="10%">
           <col width="15%">
           <col width="8%">
           <col width="10%">
           <col width="35%">
           <col width="6%">
           <col width="10%">
           <col width="10%">
         </colgroup>
         <thead>
           <tr>
             <th style="text-align: center;">账单号</th>
             <th style="text-align: center;">总公司</th>
             <th style="text-align: center;">采购员/礼包创建员</th>
             <th style="text-align: center;">下单/账单时间</th>
             <th style="text-align: center;">商品名称</th>
             <th style="text-align: center;">数量</th>
             <th style="text-align: center;">单价</th>
             <th style="text-align: center;">总价</th>
           </tr>
         </thead>
       </table>
</div>
<script id="purchaseListTable" type="text/html">
    <colgroup>
        <col width="10%">
        <col width="15%">
        <col width="15%">
        <col width="14%">
        <col width="30%">
        <col width="6%">
        <col width="10%">
        <col width="10%">
    </colgroup>
    <thead>
    <tr>
        <th style="text-align: center;">账单号</th>
        <th style="text-align: center;">总公司</th>
        <th style="text-align: center;">采购员/礼包创建员</th>
        <th style="text-align: center;">下单/账单时间</th>
        <th style="text-align: center;">商品名称</th>
        <th style="text-align: center;">数量</th>
        <th style="text-align: center;">单价</th>
        <th style="text-align: center;">总价</th>
    </tr>
    </thead>
    <tbody>
        {{if purchaseListInfo && purchaseListInfo.length > 0}}
        {{each purchaseListInfo as purchaseList index}}
        <tr class="purchaseListTr">
            <td class="orderNo">{{purchaseList.orderNo}}</td>
            <td class="parentCompany">{{purchaseList.parentCompany}}</td>
            <td class="realName">{{purchaseList.realName}}</td>
            <td class="dateCreated">{{purchaseList.dateCreated}}</td>
            <td style="text-align: left;">{{purchaseList.productName}}</td>
            <td>{{purchaseList.count}}</td>
            <td>{{purchaseList.salePrice}}</td>
            <td>{{purchaseList.commodityAmount}}</td>
        </tr>
        {{/each}}
        {{else}}
        <tr style="background-color: #f9f9f9;">
            <td valign="top" colspan="8" class="dataTables_empty"><label
                    style="font-weight: normal;">没有检索到数据</label></td>
        </tr>
        {{/if}}
    </tbody>
</script>

js代码:

var purchaseList = {}
purchaseList.init = function () {
}
var purchaseListPage = parseInt('1');
var purchaseListSize = ('10');
var scoreDetailPage = parseInt('1');
var scoreDetailPageSize = ('10');
var totalPage;
purchaseList.init.prototype = {
    initTable: function () {
        $('#dataTable').DataTable({
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉, 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
                "sProcessing": "<img src='./loading.gif' />",
                "sSearch": "搜索"
            },
            "sDom":'rt<"row"<"col-xs-2a"i><"col-xs-8a"p><"col-xs-2b"l>>',//自定义布局
            /*"scrollX": true,*/
            "bServerSide": true, //需要向后端传jqueryDataTablesVo数据,是否启动服务器端数据导入
            "bStateSave": false,
            "bJQueryUI": true,
            "bPaginate": true,// 分页按钮
            "bFilter": false,// 搜索栏
            "bLengthChange": true,// 每行显示记录数
            "iDisplayLength": 10,// 每页显示行数
            "aLengthMenu" : [5, 10, 20, 50, 100,200], //更改显示记录数选项
            "bSort": false,// 排序
            "bInfo": true,// Showing 1 to 10 of 23 entries 总记录数没也显示多少等信息
            "bWidth": true,
            "bScrollCollapse": true,
            "sPaginationType": "full_numbers", // 分页,一共两种样式 另一种为two_button // 是datatables默认
            //  "bProcessing" : true,
            "bDestroy": true,
            "bSortCellsTop": true,
            "sAjaxSource": STATIC_CTX + "/purchaseList/purchaseListTotalCount",
            //  "sScrollY": "100%",
            "fnInitComplete": function () {
                this.fnAdjustColumnSizing(true);
            },
             "fnDrawCallback" : function(table) {
                 //指定跳转页面
                 $("#dataTable_paginate").append("<input  class='margin text-center paginput pipt' id='changePage' type='text'> 页  <a class='btn btn-default shiny pagbtn' style='margin-bottom:5px' href='javascript:void(0);' id='dataTable-btn'>跳转</a>");
                 var oTable = $("#dataTable").dataTable();
                 $('#dataTable-btn').click(function(e) {
                     if($("#changePage").val() && $("#changePage").val() > 0 && parseInt($("#changePage").val()) <= totalPage) {
                         purchaseListPage = $("#changePage").val();
                         new purchaseList.init().getPurchaseListData();
                         oTable.fnPageChange(parseInt(purchaseListPage - 1));
                     } else {
                        // purchaseListPage = parseInt('1');
                         $("#changePage").val("")
                     }
                 });
             },
            "fnServerParams": function (aoData) {
                aoData.push(
                    {
                        "name": "orderNo",
                        "value": $("#orderNo").val()
                    },
                    {
                        "name": "parentCompany",
                        "value": $("#parentCompany").val()
                    },
                    {
                        "name": "orderStartTime",
                        "value": encodeURI($("#startDate-order").val())
                    },
                    {
                        "name": "orderEndTime",
                        "value": encodeURI($("#endDate-order").val())
                    },
                    {
                        "name": "pageSize",
                        "value": purchaseListSize
                    }
                );
            },
            "aoColumns": [
                {
                    "data": "orderNo",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                },
                {
                    "data": "parentCompany",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                },
                {
                    "data": "realName",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                },
                {
                    "data": "dateCreated",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                },
                {
                    "data": "productName",
                    "render": function (data, type, full, meta) {
                        if (data == null) {
                            return "";
                        } else {
                            if (full.freight == '0') {
                                return data;
                            } else {
                                return data + "\n运费:" + full.freight;
                            }
                        }
                    }
                },
                {
                    "data": "count",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                },
                {
                    "data": "salePrice",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                },
                {
                    "data": "commodityAmount",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        } else {
                            return data;
                        }
                    }
                }
            ],
            "fnRowCallback": function (nRow, aData, iDisplayIndex) {//相当于对字段格式化
                if (aData.JDSTATUS == "2") {
                    $(nRow).css("color", "red");
                }
            },
            "fnServerData": function (sSource, aoData, fnCallback) {
                var serializeData = function (aoData) {
                    var data = {};
                    for (var i = 0; i < aoData.length; i++) {
                        var dd = aoData[i];
                        if (dd['value']) {
                            data[dd['name']] = dd['value'];
                        }
                    }
                    return $.param(data);
                };
                $.ajax({
                    "type": 'post',
                    "url": sSource,
                    "data": serializeData(aoData),
                    "success": function (resp) {
                        // artTemplate 加载数据
                        totalPage = resp.totalPage;
                        if(purchaseListSize != $(".input-sm").val()){
                            purchaseListPage = parseInt('1');
                            purchaseListSize = $(".input-sm").val();
                            $("#dataTable").dataTable().fnPageChange(parseInt(purchaseListPage-1));
                        }
                        new purchaseList.init().getPurchaseListData();
                        fnCallback(resp);
                        var total = $("td");
                        if (total.size() < 2 && searchFlag) {
                            window.wxc.xcConfirm("很抱歉,系统找不到您的记录,请换个条件试试!", "info");
                        }
                    },
                    "error": function (resp) {
                        window.wxc.xcConfirm("系统异常,请联系管理员并稍后重试!", "error");
                    }
                });
            }
        });
    },
    getPurchaseListData: function () {
        $.ajax({
            url: '/admin-web/purchaseList/purchaseList',
            type: "POST",
            data: {
                page: purchaseListPage,
                pageSize: purchaseListSize,
                orderNo: $("#orderNo").val(),
                parentCompany: $("#parentCompany").val(),
                orderStartTime: $("#startDate-order").val(),
                orderEndTime: $("#endDate-order").val()
            },
            success: function (data) {
                var purchaseListInfo;
                var html = template("purchaseListTable", {purchaseListInfo: data.purchaseListDtos});
                $("#purchaseListDiv").html(html);
                //合并单元格
                new purchaseList.init().priceParityMerge();
            }
        })
    },

//合并单元格 priceParityMerge: function () { var $lastOrderNo = null; var $lastParentCompany = null; var $lastRealName = null; var $lastDateCreated = null; $(".purchaseListTr").each(function (trIndex, tr) { var $prevOrderNo = null; var $prevParentCompany = null; var $prevRealName = null; var $prevDateCreated = null; var $orderNo = $(tr).find(".orderNo"); var $parentCompany = $(tr).find(".parentCompany"); var $realName = $(tr).find(".realName"); var $dateCreated = $(tr).find(".dateCreated"); if (trIndex != 0) { $prevOrderNo = $($(".purchaseListTr")[trIndex - 1]).find(".orderNo"); $prevParentCompany = $($(".purchaseListTr")[trIndex - 1]).find(".parentCompany"); $prevRealName = $($(".purchaseListTr")[trIndex - 1]).find(".realName"); $prevDateCreated = $($(".purchaseListTr")[trIndex - 1]).find(".dateCreated"); } $lastOrderNo = new purchaseList.init().marge($lastOrderNo, $prevOrderNo, $orderNo); if ($lastOrderNo != null) { $lastParentCompany = new purchaseList.init().marge($lastParentCompany, $prevParentCompany, $parentCompany); $lastRealName = new purchaseList.init().marge($lastRealName, $prevRealName, $realName); $lastDateCreated = new purchaseList.init().marge($lastDateCreated, $prevDateCreated, $dateCreated); } }); }, marge: function ($last, $pre, $now) { if ($pre != null && $pre.html() == $now.html()) { var rowspan = $pre.attr("rowspan"); if (rowspan === undefined || rowspan === null) { $pre.attr("rowspan", 2); $last = $pre; $now.remove(); } } else if ($last != null && $now.html() == $last.html()) { var rowspan = parseInt($last.attr("rowspan")); rowspan = rowspan + 1; $last.attr("rowspan", rowspan); $now.remove(); } else { $last = null; } return $last; }, } $(function () { var obj = new purchaseList.init(); obj.orderStartTime(); obj.initTable(); }) //页码点击事件 $(document).on("click", ".dataTables_wrapper a", purchaseListPageClick); function purchaseListPageClick() { if (!$(this).parent().hasClass("disabled")) { var page = null; if ($(this).parents(".dataTables_wrapper").prev().attr("id") == "purchaseListDiv") { page = purchaseListPage; } else { page = scoreDetailPage; } if ($(this).html() == "首页") { page = 1; } else if ($(this).html() == "前一页") { page = page - 1; } else if ($(this).html() == "后一页") { page = page + 1; } else if ($(this).html() == "尾页") { page = parseInt($(this).parent().parent().find("#dataTable_next").prev().find("a").html()); } else { page = parseInt($(this).html()); } if ($(this).parents(".dataTables_wrapper").prev().attr("id") == "purchaseListDiv") { purchaseListPage = page; } else { scoreDetailPage = page; } } }

 temolate复杂合并单元格:根据多个条件选择合并单元格

html:

 1 <script id="returnsGoodsTable" type="text/html">
 2     <colgroup>
 3         <col width="8%">
 4         <col width="8%">
 5         <col width="25%">
 6         <col width="8%">
 7         <col width="5%">
 8         <col width="5%">
 9         <col width="6%">
10         <col width="5%">
11         <col width="8%">
12         <col width="8%">
13     </colgroup>
14     <thead>
15     <tr>
16         <th style="text-align:center; width: 150px;">退货录入时间</th>
17         <th style="text-align:center; width: 200px;">包裹号</th>
18         <th style="text-align:center; width: 150px;">退货商品</th>
19         <th style="text-align:center; width: 120px;">商品sku</th>
20         <th style="text-align:center; width: 120px;">销售单价</th>
21         <th style="text-align:center; width: 120px;">退货数量</th>
22         <th style="text-align:center; width: 120px;">总退货金额</th>
23         <th style="text-align:center; width: 120px;">退货来源</th>
24         <th style="text-align:center; width: 120px;">状态</th>
25         <th style="text-align:center; width: 200px;">操作</th>
26     </tr>
27     </thead>
28     <tbody>
29     {{if returnsOrderHistoryInfo && returnsOrderHistoryInfo.length > 0}}
30     {{each returnsOrderHistoryInfo as returnsOrderHistory index}}
31     <tr class="returnsGoodsTableTr">
32         <td class="returnRntryTime" returnid="{{returnsOrderHistory.rgid}}">{{returnsOrderHistory.returnRntryTime}}</td>
33         <td class="subOrderNo">{{returnsOrderHistory.subOrderNo}}</td>
34         <td class="goodsName" style="text-align: left;">{{returnsOrderHistory.goodsName}}</td>
35         <td class="sku">{{returnsOrderHistory.sku}}</td>
36         <td class="salePrice">{{returnsOrderHistory.salePrice}}</td>
37         <td class="count">{{returnsOrderHistory.count}}</td>
38         <td class="totalReturnAmount">{{returnsOrderHistory.totalReturnAmount}}</td>
39         <td class="returnSource">{{returnsOrderHistory.returnSource}}</td>
40         <td class="checkStatus">{{returnsOrderHistory.checkStatus}}</td>
41         {{if returnsOrderHistory.returnSource == "系统"}}
42             {{if returnsOrderHistory.checkStatus == "待审核"}}
43               <td class="handle"><a href="javascript:void(0);" style="margin-right: 24px;cursor: pointer;" onclick="new retuensGoods.init().returnAudit(this)">审核</a></td>
44             {{else}}
45               <td class="handle"></td>
46             {{/if}}
47         {{else}}
48             {{if returnsOrderHistory.checkStatus == "待处理"}}
49              <td class="handle">
50                  <a href="javascript:void(0);" style="margin-right: 10px;cursor: pointer;" onclick="new retuensGoods.init().editReturnInfo(this);">编辑</a>
51                  <a href="javascript:void(0);" style="cursor: pointer;" onclick="new retuensGoods.init().deleteReturnInfo(this);">删除</a>
52              </td>
53             {{else}}
54               <td class="handle"></td>
55             {{/if}}
56         {{/if}}
57     </tr>
58     {{/each}}
59     {{else}}
60     <tr style="background-color: #f9f9f9;">
61         <td valign="top" colspan="10" class="dataTables_empty"><label
62                     style="font-weight: normal;">没有检索到数据</label></td>
63     </tr>
64     {{/if}}
65     </tbody>
66 </script>

js:

  1 priceParityMerge: function () {
  2         var resultReturnRntryTime = {
  3             result: null,
  4             resultVal: null
  5         };
  6         var resultSubOrderNo = {
  7             result: null,
  8             resultVal: null
  9         };
 10         var resultTotalReturnAmount = {
 11             result: null,
 12             resultVal: null
 13         };
 14         var resultReturnSource = {
 15             result: null,
 16             resultVal: null
 17         };
 18         var resultCheckStatus = {
 19             result: null,
 20             resultVal: null
 21         };
 22         var resultHandle = {
 23             result: null,
 24             resultVal: null
 25         };
 26         var resultGoodsName = {
 27             result: null,
 28             resultVal: null
 29         };
 30         var resultSku = {
 31             result: null,
 32             resultVal: null
 33         };
 34         var resultSalePrice = {
 35             result: null,
 36             resultVal: null
 37         };
 38         var resultCount = {
 39             result: null,
 40             resultVal: null
 41         };
 42         $(".returnsGoodsTableTr").each(function (trIndex, tr) {
 43             var $preReturnRntryTime = null;
 44             var preReturnRntryTimeVal = null;
 45 
 46             var $preSubOrderNo = null;
 47             var preSubOrderNoVal = null;
 48 
 49             var $preTotalReturnAmount = null;
 50             var preTotalReturnAmountVal = null;
 51 
 52             var $preReturnSource = null;
 53             var preReturnSourceVal = null;
 54 
 55             var $preCheckStatus = null;
 56             var preCheckStatusVal = null;
 57 
 58             var $preHandle = null;
 59             var preHandleVal = null;
 60 
 61             var $preGoodsName = null;
 62             var preGoodsNameVal = null;
 63 
 64             var $preSku = null;
 65             var preSku = null;
 66 
 67             var $preSalePrice = null;
 68             var preSalePrice = null;
 69 
 70             var $preCount = null;
 71             var preCount = null;
 72 
 73             var $returnRntryTime = $(tr).find(".returnRntryTime");
 74             var returnRntryTimeVal = $(tr).find(".returnRntryTime").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 75 
 76             var $subOrderNo = $(tr).find(".subOrderNo");
 77             var subOrderNoVal = $(tr).find(".subOrderNo").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 78 
 79             var $totalReturnAmount = $(tr).find(".totalReturnAmount");
 80             var totalReturnAmountVal = $(tr).find(".totalReturnAmount").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 81 
 82             var $returnSource = $(tr).find(".returnSource");
 83             var returnSourceVal = $(tr).find(".returnSource").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 84 
 85             var $checkStatus = $(tr).find(".checkStatus");
 86             var checkStatusVal = $(tr).find(".checkStatus").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 87 
 88             var $handle = $(tr).find(".handle");
 89             var handleVal = $(tr).find(".handle").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 90 
 91             var $goodsName = $(tr).find(".goodsName");
 92             var goodsNameVal = $(tr).find(".goodsName").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 93 
 94             var $sku = $(tr).find(".sku");
 95             var skuVal = $(tr).find(".sku").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 96 
 97             var $salePrice = $(tr).find(".salePrice");
 98             var salePriceVal = $(tr).find(".salePrice").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
 99 
100             var $count = $(tr).find(".count");
101             var countVal = $(tr).find(".count").text() + $(tr).find(".returnSource").text() + $(tr).find(".checkStatus").text();
102 
103             if (trIndex != 0) {
104                 $preReturnRntryTime = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnRntryTime");
105                 preReturnRntryTimeVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnRntryTime").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
106 
107                 $preSubOrderNo = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".subOrderNo");
108                 preSubOrderNoVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".subOrderNo").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
109 
110                 $preTotalReturnAmount = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".totalReturnAmount");
111                 preTotalReturnAmountVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".totalReturnAmount").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
112 
113                 $preReturnSource = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource");
114                 preReturnSourceVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
115 
116                 $preCheckStatus = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus");
117                 preCheckStatusVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
118 
119                 $preHandle = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".handle");
120                 preHandleVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".handle").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
121 
122                 $preGoodsName = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".goodsName");
123                 preGoodsNameVal = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".goodsName").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
124 
125                 $preSku = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".sku");
126                 preSku = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".sku").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
127 
128                 $preSalePrice = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".salePrice");
129                 preSalePrice = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".salePrice").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
130 
131                 $preCount = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".count");
132                 preCount = $($(".returnsGoodsTableTr")[trIndex - 1]).find(".count").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".returnSource").text() + $($(".returnsGoodsTableTr")[trIndex - 1]).find(".checkStatus").text();
133             }
134             var oldReturnId = $returnRntryTime.attr("returnId");
135 
136             resultReturnRntryTime = new retuensGoods.init().marge(resultReturnRntryTime.result, resultReturnRntryTime.resultVal, $preReturnRntryTime, preReturnRntryTimeVal, $returnRntryTime, returnRntryTimeVal);
137 
138             if (resultReturnRntryTime.result != null) {
139                 resultReturnRntryTime.result.attr("returnId", resultReturnRntryTime.result.attr("returnId") + "," + oldReturnId);
140                 resultSubOrderNo = new retuensGoods.init().marge(resultSubOrderNo.result, resultSubOrderNo.resultVal, $preSubOrderNo, preSubOrderNoVal, $subOrderNo, subOrderNoVal);
141                 resultTotalReturnAmount = new retuensGoods.init().marge(resultTotalReturnAmount.result, resultTotalReturnAmount.resultVal, $preTotalReturnAmount, preTotalReturnAmountVal, $totalReturnAmount, totalReturnAmountVal);
142                 resultReturnSource = new retuensGoods.init().marge(resultReturnSource.result, resultReturnSource.resultVal, $preReturnSource, preReturnSourceVal, $returnSource, returnSourceVal);
143                 resultCheckStatus = new retuensGoods.init().marge(resultCheckStatus.result, resultCheckStatus.resultVal, $preCheckStatus, preCheckStatusVal, $checkStatus, checkStatusVal);
144                 resultHandle = new retuensGoods.init().marge(resultHandle.result, resultHandle.resultVal, $preHandle, preHandleVal, $handle, handleVal);
145                 resultGoodsName = new retuensGoods.init().marge(resultGoodsName.result, resultGoodsName.resultVal, $preGoodsName, preGoodsNameVal, $goodsName, goodsNameVal);
146                 resultSku = new retuensGoods.init().marge(resultSku.result, resultSku.resultVal, $preSku, preSku, $sku, skuVal);
147                 resultSalePrice = new retuensGoods.init().marge(resultSalePrice.result, resultSalePrice.resultVal, $preSalePrice, preSalePrice, $salePrice, salePriceVal);
148                 resultCount = new retuensGoods.init().marge(resultCount.result, resultCount.resultVal, $preCount, preCount, $count, countVal);
149             }
150         });
151     },
152     marge: function ($result, resultVal, $pre, preVal, $now, nowVal) {
153         if ($pre != null && preVal == nowVal && $pre.html() == $now.html()) {
154             var rowspan = $pre.attr("rowspan");
155             if (rowspan === undefined || rowspan === null) {
156                 $pre.attr("rowspan", 2);
157                 $result = $pre;
158                 resultVal = preVal;
159                 $now.remove();
160             }
161         } else if ($result != null && nowVal == resultVal && $now.html() == $result.html()) {
162             var rowspan = parseInt($result.attr("rowspan"));
163             rowspan = rowspan + 1;
164             $result.attr("rowspan", rowspan);
165             $now.remove();
166         } else {
167             $result = null;
168             resultVal = null;
169         }
170         var result = {
171             result: $result,
172             resultVal: resultVal
173         }
174         return result;
175     },

 

 

 

  

 

posted @ 2018-07-19 14:42  坚持就是胜利66  阅读(979)  评论(0编辑  收藏  举报