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-electromechanical-list...

271 lines
17 KiB

5 years ago
<?php if(count($items)>0): ?>
<style>
.color1 {
background-color: #299AD6;
color: white;
}
</style>
<?php if(isset($items[1])): ?>
<div style="width:98%; margin: 0 auto;color:#1E5494" class="add-title">
<h3 onclick="show('list3')">更换清单<span id="list3_title"></span></h3>
</div>
<div id="list3">
<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),1)"></td>
<td align="center" class="td_bg" nowrap colspan="6"></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="80" 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[1] 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>
[<a href="javascript:void(0)" onclick="confirmFix($(this),<?= $item['id'] ?>,1)" style="color: green;">确认</a>]
[<a href="javascript:void(0)" onclick="getItem($(this),<?= $item['id'] ?>,1)" style="color: green;">领料</a>]
</td>
<td align="center" class="td_bg" style="word-break: break-all"><?= $store->category->name ?></td>
<td align="center" class="td_bg" nowrap><?= $item['insurance_price'] ?></td>
<td align="center" class="td_bg" style="word-break: break-all"><?= number_format($store->price * ($store->fixCarScale->scale/100+1),2) ?></td>
<td align="center" class="td_bg" nowrap><?= $item['count'] ?></td>
<td align="center" class="td_bg" nowrap><?= $item['pay_type'] == 1 ? '保险理赔' : '自费维修' ?></td>
<td align="center" class="td_bg" nowrap>
[<?= 0 === $item['fix_status'] ? '<span class="red_1 st">未确认</span>' : '<span class="green_1 st">已确认</span>' ?>]
[<?= 0 === $item['is_get'] ? '<span class="get-1" style="color: red">未通知</span>' : '<span class="get-1" style="color: green">已通知</span>' ?>]
[<?= '0000-00-00 00:00:00' === $item['get_time'] ? '<span class="get-2" style="color: red">未领取</span>' : '<span class="get-2" style="color: green">已领取</span>' ?>]
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div style="clear: both"></div>
<?php endif; ?>
<?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),1)"></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'] ?>,1)" 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['fix_status'] ? '<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[6])): ?>
<?php $group_name =[1=>'微伤',2=>'轻度',3=>'中度',4=>'重度'] ?>
<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),1)"></td>
<td align="center" class="td_bg" nowrap colspan="7"></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="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[6] as $index => $item): ?>
<?php $store = $project = null; ?>
<?php $project = \common\models\FixCarProject::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>
[<a href="javascript:void(0)" onclick="confirmFix($(this),<?= $item['id'] ?>,1)" 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">
<?= $project->group->name ?>
</td>
<td align="center" class="td_bg" style="word-break: break-all">--</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><?= $item['pay_type'] == 1 ? '保险理赔' : '自费维修' ?></td>
<td align="center" class="td_bg st" nowrap><?= 0 == $item['fix_status'] ? '<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="5"></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>
<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>
[<a href="javascript:void(0)" onclick="getItem($(this),<?= $item['id'] ?>,1)" style="color: green;">领料</a>]
</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>
<td align="center" class="td_bg" nowrap>
[<?= 0 === $item['is_get'] ? '<span class="get-1" style="color: red">未通知</span>' : '<span class="get-1" style="color: green">已通知</span>' ?>]
[<?= '0000-00-00 00:00:00' === $item['get_time'] ? '<span class="get-2" style="color: red">未领取</span>' : '<span class="get-2" style="color: green">已领取</span>' ?>]
</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(1 == type){
obj.parents('tr').find('.st').removeClass('red_1').addClass('green_1').text('已确认');
obj.parents('tr').find('.get-1').removeClass('red_1').addClass('green_1').text('已通知');
obj.parents('tr').find('.get-2').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(1 == 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]);
})
}
}
});
}
//领料
function getItem(obj,id){
if(id < 1) return false;
$.post('/fix-car-item/ajax-get-item',{id:id},function(data){
alert(data.msg);
if(data.success){
obj.parents('tr').find('.get-1').css('color','green').text('已通知');
}
},'json');
}
//批量领料
</script>