前言,原先数据格式,主要是嵌套循环,for in 循环 对象、然后 后面 内容 循环两个数组。特此记录下
{state:200,
data:[
{getReconProductTradeInfos:[a:aa,b:bb,c:cc,name:xx]},
{getReconDistributions:[d:dd,e:ee,f:ff,name:xx]}
] }
循环 处理后
detail:{
xx:[getReconProductTradeInfo:[a:aa,b:bb,c:cc ] ],
xx:[getReconDistribution:[d:dd,e:ee,f:ff ] ]
}
function recorderDetail() {
var url = 'dizhineirongxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// var url = WebApi.addressUrl + 'api/v1/recorderDetail';
var params={
'bill_type':scope.bill_type,
'bill_period':scope.bill_period,
'cust_id':scope.cust_id,
}
WebApi.post(params, url).then(function (res) {
if(res.msg == 'SUCCESS'){
console.log(res);
// 交易信息 getReconProductTradeInfos
var getReconProductTradeInfo = res.data[1].getReconProductTradeInfos;
console.log(getReconProductTradeInfo);
// 分配信息 getReconDistributions
var getReconDistribution = res.data[0].getReconDistributions;
console.log(getReconDistribution);
if( res.data[1].getReconProductTradeInfos.length == '0' && res.data[0].getReconDistributions.length =='0'){
scope.part2Count = false;
return false;
}
var companymess = [];
var detail = {};
getReconProductTradeInfo.forEach(function (item,index) {
if (!detail[item.product_NAME]) {
detail[item.product_NAME] = {
getReconProductTradeInfo: [],
getReconDistribution: []
}
}
detail[item.product_NAME].getReconProductTradeInfo.push(item)
})
getReconDistribution.forEach(function (item,index) {
if (!detail[item.product_NAME]) {
detail[item.product_NAME] = {
getReconProductTradeInfo: [],
getReconDistribution: []
}
}
detail[item.product_NAME].getReconDistribution.push(item)
})
console.log(getReconProductTradeInfo) // 合同信息
console.log(getReconDistribution) // 交易信息
console.log(detail);
scope.detail = detail;
ued.$apply();
}else{
weui.alert(res.data);
}
});
}
html部分
<div ng-repeat="(key, val) in detail track by $index" ng-if="detail">
<h5 class="title">{{$index+1}}.{{key}}</h5>
<h5><i class="dot"></i>期间信托合同交易信息</h5>
<table>
<thead>
<tr>
<th>交易类型</th>
<th>成交日期</th>
<th>成交单位净值</th>
<th>金额</th>
<th>份额</th>
<th>收益</th>
<th>扣减费用</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item1 in val.getReconProductTradeInfo">
<td>{{item1.bill_BIZ_TYPE }}</td>
<td>{{item1.trade_DATE }}</td>
<td>{{item1.net_VALUE}}</td>
<td>{{rmb(item1.amount)}}</td>
<td>{{rmb(item1.shares )}}</td>
<td>{{rmb(item1.fp_AMOUNT)}}</td>
<td>{{rmb(item1.fee_AMOUNT)}}</td>
</tr>
<tr ng-show="val.getReconProductTradeInfo.length == 0">
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</tr>
</tbody>
</table>
<h5><i class="dot"></i>期间信托合同分配信息</h5>
<table>
<thead>
<tr>
<th>分配类型</th>
<th>分配方式</th>
<th>分配日</th>
<th>分配金额</th>
<th>分配份额</th>
<th>收款银行</th>
<th>收款账号</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item2 in val.getReconDistribution" >
<td>{{item2.bill_FP_TYPE}}</td>
<td>{{item2.bill_FP_WAY}}</td>
<td>{{item2.fp_DATE}}</td>
<td>{{rmb(item2.amount)}}</td>
<td>{{rmb(item2.shares) }}</td>
<td>{{item2.fp_BANKE}}</td>
<td>{{item2.fp_ACCOUNT_NUM }}</td>
</tr>
<tr ng-show="val.getReconDistribution.length == 0">
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</tr>
</tbody>
</table>
</div>
网友评论