You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
simple-yewu/frontend/views/business-order/ajax-metal-plate-install-li...

151 lines
8.9 KiB

<?php if(count($items)>0): ?>
<style>
.color1 {
background-color: #299AD6;
color: white;
}
</style>
<?php if(isset($items[2])): ?>
<?php $group_name =[1=>'微伤',2=>'轻度',3=>'中度',4=>'重度'] ?>
<div style="width:98%; margin: 0 auto;color:#1E5494" class="add-title">
<h3 onclick="show('list4')">维修清单<span id="list4_title">▼</span></h3>
</div>
<div id="list4">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"
style="table-layout: fixed;">
<tr>
<td width="5%" align="center" class="td_bg" nowrap></td>
<td width="5%" align="center" class="td_bg" nowrap><input type="checkbox" onclick="batchChoice($(this))"></td>
<td width="10%" align="center" class="td_bg" nowrap><input type="button" value="批量确认" class="color1" onclick="batchSave($(this),3)"></td>
<td align="center" class="td_bg" nowrap colspan="8"></td>
</tr>
<tr>
<td width="5%" align="center" class="bg_tr" nowrap>序号</td>
<td align="center" class="bg_tr" nowrap>选</td>
<td align="center" class="bg_tr" nowrap>快速</td>
<td width="100" align="center" class="bg_tr" nowrap>修理项目</td>
<td width="100" align="center" class="bg_tr" nowrap>报案号</td>
<td width="100" align="center" class="bg_tr" nowrap>修理分组</td>
<td width="100" align="center" class="bg_tr" nowrap>损伤程度</td>
<td width="50" align="center" class="bg_tr" nowrap>单价</td>
<td width="80" align="center" class="bg_tr" nowrap>数量</td>
<td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
<td width="100" align="center" class="bg_tr" nowrap>状态</td>
</tr>
<?php foreach ($items[2] as $index => $item): ?>
<?php $project = \common\models\FixCarProject::findOne($item['fk_id']) ?>
<input type="hidden" class="item_id" value="<?= $item['id'] ?>">
<tr>
<td align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
<td align="center" class="td_bg" nowrap><input type="checkbox" class="one-choice" value="<?= $item['id'] ?>"></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0)" onclick="confirmFix($(this),<?= $item['id'] ?>,3)" style="color: green;">确认</a>]
</td>
<td align="center" class="td_bg" style="word-break: break-all"><?= $project->category->name ?></td>
<td align="center" class="td_bg" style="word-break: break-all"><?= is_null($item['report_id']) ? '--' : \common\models\FixCarReport::findOne($item['report_id'])->report_no ?></td>
<td align="center" class="td_bg" style="word-break: break-all"><?= $project->group->name ?></td>
<td align="center" class="td_bg" style="word-break: break-all"><?= 7 == $project->group_id ? $group_name[$project->car_price] : '--' ?></td>
<td align="center" class="td_bg" style="word-break: break-all"><?= $project->price ?>元</td>
<td align="center" class="td_bg" nowrap><?= $item['count'] ?></td>
<td align="center" class="td_bg" nowrap><?= 1 == $item['pay_type'] ? '保险理赔' : '自费维修' ?></td>
<td align="center" class="td_bg st" nowrap><?= 0 == $item['metal_plate_install'] ? '<span class="red_1">未确认</span>' : '<span class="green_1">已确认</span>' ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div style="clear: both"></div>
<?php endif; ?>
<?php if(isset($items[3])): ?>
<div style="width:98%; margin: 0 auto;color:#1E5494" class="add-title">
<h3 onclick="show('list5')">辅料清单<span id="list5_title">▼</span></h3>
</div>
<div id="list5">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"
style="table-layout: fixed;">
<tr>
<td width="5%" align="center" class="td_bg" nowrap></td>
<td width="5%" align="center" class="td_bg" nowrap><input type="checkbox" onclick="batchChoice($(this))"></td>
<td width="10%" align="center" class="td_bg" nowrap><input type="button" value="批量确认" class="color1" onclick="batchSave($(this),2)"></td>
<td align="center" class="td_bg" nowrap colspan="4"></td>
</tr>
<tr>
<td width="5%" align="center" class="bg_tr" nowrap>序号</td>
<td align="center" class="bg_tr" nowrap>选</td>
<td align="center" class="bg_tr" nowrap>快速</td>
<td width="100" align="center" class="bg_tr" nowrap>辅料名</td>
<td width="50" align="center" class="bg_tr" nowrap>单价</td>
<td width="80" align="center" class="bg_tr" nowrap>数量</td>
<td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
</tr>
<?php foreach ($items[3] as $index => $item): ?>
<?php $store = \common\models\StoreRoom::findOne($item['fk_id']); ?>
<tr>
<td align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
<td align="center" class="td_bg" nowrap><input type="checkbox" class="one-choice" value="<?= $item['id'] ?>"></td>
<td align="center" class="td_bg" nowrap>
<?php if($item['count'] <= 0): ?>
[<a href="javascript:void(0)" style="color:red;">使用</a>]
<?php else: ?>
[<a href="javascript:void(0)" onclick="confirmFix($(this),<?= $item['id'] ?>,2)" style="color: green">使用</a>]
<?php endif; ?>
</td>
<td align="center" class="td_bg" style="word-break: break-all"><?= $store->category->name ?></td>
<td align="center" class="td_bg" style="word-break: break-all"><?= $store->price ?>元</td>
<td align="center" class="td_bg count" nowrap><?= $item['count'] ?></td>
<td align="center" class="td_bg" nowrap><?= $item['pay_type'] == 1 ? '保险理赔' : '自费维修' ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div style="clear: both"></div>
<?php endif; ?>
<?php endif; ?>
<script>
//确认维修
function confirmFix(obj,itemId,type){
if(itemId <= 0 || !confirm('确认完成了吗?')) return false;
obj.parents('tr').find('.one-choice').attr('checked',true);
$.post('/fix-car-item/confirm-fix',{item_id:itemId,type:type},function(data){
alert(data.msg);
if(data.success){
if(3 == type){
obj.parents('tr').find('.st').removeClass('red_1').addClass('green_1').text('已确认');
}else if(2 == type){
obj.parents('tr').find('.count').text(data.content);
if(0 == data.content) obj.on('click',null);
}
}
},'json');
}
//批量选择
function batchChoice(obj){
obj.parents('table').find('.one-choice').attr('checked',(obj.attr('checked') ? true : false));
}
//批量添加
function batchSave(obj,type){
if(type < 1 || !confirm('确认完成了吗?')) return false;
var checkboxObj = obj.parents('table').find('.one-choice:checked'),
len = checkboxObj.length,
itemIds = [];
if(len < 1) return false;
checkboxObj.each(function(){
itemIds.push($(this).val());
});
if(itemIds.length < 1) return false;
$.post('/fix-car-item/batch-confirm-fix',{item_id:itemIds,type:type},function(data){
alert(data.msg);
if(data.success){
if(3 == type){
checkboxObj.each(function(){
$(this).parents('tr').find('.st').removeClass('red_1').addClass('green_1').text('已确认');
})
}else{
checkboxObj.each(function(i){
$(this).parents('tr').find('.count').text(data.content[i]);
})
}
}
});
}
</script>