<!--點擊觸發彈窗,彈窗顯示表格內容-->
<a onclick="ODxp(<?=$v['id']?>,<?=$v['logis_price']?>)">查看詳情</a>
<!-- 彈出層 -->
html:
```
<div class="ODxp" style="display: none; padding:10px; width: 520px">
<table class="table table-bordered table-striped" >
<tr>
<th>序號</th>
<th>商品名</th>
<th>商品規格</th>
<th>數量</th>
<!-- <th>包裝數量</th> -->
<th>供貨單價</th>
</tr>
<tbody id='ab'>
//記錄id,通過id進行賦值操作
</tbody>
</table>
<div style="text-align: right;">運費:<i id="yunfei"></i></div>
<div style="text-align: right;">總價:<i id='zongjia'></i></div>
</div>
js:
function ODxp(param1,param2){
//
var id = param1;
var logis_price = param2;
var url = "<?php echo site_url('ware_center/order_list_gooods_details');?>"
$.ajax({
//提交參數到后端獲取數據
url:url,
type:'post',
dataType:'json',
data:{'id':id,'logis_price':logis_price},
success:function(resData){
console.log(resData)
var html = '';
$.each(resData.data.data,function(k,v){
html +='<tr>';
//循環返回的數據,插入到表格中
html +='<td>'+k+'</td>';
html +='<td>'+v.sku_name+'</td>';
html +='<td>'+v.sku_attrstr+'</td>';
html +='<td>'+v.num+'</td>';
html +='<td>'+v.sku_sum_price+'</td>';
html +='</tr>';
});
$('#ab').html(html);
$('#yunfei').html(resData.data.freight);
//表格后插入其他數據
$('#zongjia').html(resData.data.order_sum_price);
}
})
layer.open({
//觸發展示的彈窗
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
skin: 'yourclass',
area: ['520px', '300px'],
content: $(".ODxp")
});
}
```