<html>
<style>
.list{height:20px; border:1px solid gray; border-bottom:0px;? }
.list tr td{ border-bottom:1px solid gray; padding: 5px 5px 5px 5px; }
</style>??? ?
<body>
? <div>
??? ??? ??? <table class="list">
??? ??? ??? ??? <thead>
??? ??? ??? ??? ??? <tr>
??? ??? ??? ??? ??? ??? <td>商户名称</td>
??? ??? ??? ??? ??? ??? <td>商户订单状态</td>
??? ??? ??? ??? ??? ??? <td>物流单号</td>
??? ??? ??? ??? ??? ??? <td>商户订单合计</td>
??? ??? ??? ??? ??? </tr>
??? ??? ??? ??? </thead>
??? ??? ??? ??? <tbody id="prodListTable" class="list">
??? ??? ??? ??? </tbody>
??? ??? ??? </table>
??? ??? </div>
?</body>
</html>
?
?function showProd(storeId,storeName,prodId,prodName,salePrice,buyNum,stockNum, prodAttrId,prodAttrStringList){
??? ??????? console.log("storeId=="+storeId);
??? ??? ??? ?console.log("storeName=="+storeName);
??? ??? ??? ?console.log("prodId=="+prodId);
??? ??? ??? ?console.log("prodName=="+prodName);
??? ??? ??? ?console.log("salePrice=="+salePrice);
??? ??? ??? ?console.log("buyNum=="+buyNum);
??? ??? ??? ?console.log("stockNum=="+stockNum);
??? ??? ??? ?console.log("prodAttrId=="+prodAttrId);
??? ??? ??? ?prodAttrStringList = prodAttrStringList.replace(/null/g,'');?
??? ??? ??
??? ??? ??? ?var t=document.getElementById("prodListTable");? //获取Table
??? ??? ??? var storeIdFlag = 0;
??? ??? ??? var storeIdIndex =0;
??? ??? ??? var length= t.rows.length;????????? //获得Table下的行数
??? ?? ? ?? if(length!=0){????????????? //? 如果已经有商户了,就循环判断有没有相同的商户
??? ??????????? for(var i=0;i<length;i++)?
??? ??????????? {?
??? ??????????? ??? var _tr = t.rows[i];
??? ??????????? ??? var _pIdValue = _tr.id;
??? ??????????? ??? if (storeId == _pIdValue){? //判断有没有这个商户? 第一层table里面判断
??? ??????????? ??? ??? storeIdFlag =1;
??? ??????????? ??? ??? storeIdIndex = i;
??? ??????????? ??? ??? break;
??? ??????????? ??? }
??? ??????????? }
??? ??? }
?
?????? if (storeIdFlag==1){ // 表示已经有这个商户了
??? ??? ??? ??? ??? ??? // 得到商品的列表tbody
??? ??? ??? ??? ? ? ?? var _body = t.rows[storeIdIndex].cells[4].childNodes[0].childNodes[0];? // 第5列
??? ??? ??? ??? ??? ???
??? ??? ??? ??? ??? ??? //判断商品是否存在
??? ??? ??? ??? ??? ??? var prodIdFlag = 0;
??? ??? ??? ??? ??? ??? var prodIdIndex =0;
??? ??? ??? ??? ??? ??? var length= _body.rows.length;????????? //获得Table下的行数
??? ??? ??? ??? ??????? if(length!=0){????????????? //
??? ??? ??? ??? ??????????? for(var i=0;i<length;i++)?
??? ??? ??? ??? ??????????? {?
??? ??? ??? ??? ??????????? ??? var prodIdOld = _body.rows[i].id;
??? ??? ??? ??? ??????????? ??? var prodAttrIdOld = _body.rows[i].cells[3].childNodes[0].value;
??? ??? ??? ??? ????????????
??? ??? ??? ??? ??????????? ??? if (prodIdOld == prodId? && prodAttrIdOld==prodAttrId){? //这个地方是通过2个列值来判断是否有相同的行
??? ??? ??? ??? ??????????? ??? ??? prodIdFlag =1;
??? ??? ??? ??? ??????????? ??? ??? prodIdIndex = i;
??? ??? ??? ??? ??????????? ??? ??? break;
??? ??? ??? ??? ??????????? ??? }
??? ??? ??? ??? ??????????? }
??? ??? ??? ??? ??????? }
??? ??? ??? ??? ??? ???
??? ??? ??? ??? ??? ??? if (prodIdFlag ==1){?? // 如果已经有这个商品了? todo
??? ??? ??? ??? ??? ??? ??? ?? alert('如果已经有该属性商品了!');
??????????????? ? ? ? ? ? ? ?? return false;
??? ??? ??? ??? ??? ??? }else? {?
??? ??? ??? ??? ??? ??? ??? var totalPrice = salePrice * buyNum;
??? ??? ??? ??? ??? ??????? var c5Html = '';
??? ??? ??? ??? ??? ??????? c5Html += '<td>'+prodId+'</td>';
??? ??? ??? ??? ??? ??????? c5Html += '<td>'+prodName+'</td>';
??? ??? ??? ??? ??? ??????? c5Html +=