repair_price_set.php
6.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
$this->title = '设置价格';
$this->params['breadcrumbs'][] = '设备管理';
$this->params['breadcrumbs'][] = ['label' => '维修方案设置', 'url' => ['/device/fault/repair-plan-set?type=1&modelDeviceFaultId='.$gets['modelDeviceFaultId']]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="panel panel-default">
<div class="panel-heading bg-success">
<?=$gets['info']; ?> > <?=$fault['name'] ?> > <?=$plan['name']?>
</div>
<div class="panel-heading">
<div class="clearfix"></div>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered" id="brand-table">
<thead>
<tr>
<th>型号</th>
<th>维修价格</th>
</tr>
</thead>
<tbody>
<tr>
<td><?=$gets['model'] ?></td>
<td class="text-center align-middle hqy-row-select">
配件价格:<input type="number" style="width:80px;" value="<?=$plan['parts_price']?>" id="txt_parts_price" class="txt_parts_price" man_hour_fee="<?=$man_hour_fee ?>" /> ,
工时费:<label id="lbl_labor_price" style="color:red;"><?=$man_hour_fee * $plan['repair_hours']*$plan['difficulty_degree']?> 元</label>
(<?=$man_hour_fee?>元/小时*标准工时:<input type="number" style="width:80px;" value="<?=$plan['repair_hours']?>" id="txt_repair_hours" class="txt_repair_hours" man_hour_fee="<?=$man_hour_fee ?>" />小时*
难度系数:<input type="number" style="width:80px;" value="<?=$plan['difficulty_degree']?>" id="txt_difficulty_degree" class="txt_difficulty_degree" man_hour_fee="<?=$man_hour_fee ?>"/>)
保修等级:<select id="warranty_level">
<?php foreach($warrantyLevel as $k=>$v){ ?> <option value="<?=$k?>" <?php if ($plan['warranty_level'] == $k) { echo 'selected="selected"'; }?> ><?=$v['desc']?> </option><?php }?>
</select>
<br/>
维修价格:<label id="last_price" style="color:red;"><?=$plan['price'] ?> 元</label>
<input type="hidden" id="modelsRepairPlanPricesId" value="<?=$plan['id'] ?>"/>
</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer text-center">
<button type="button" class="btn btn-primary" id="save">提 交</button>
</div>
<div class="panel-footer">
<div class="hqy-panel-pager">
<div class="clearfix"></div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$(".txt_parts_price").bind("change",function () {
var man_hour_fee = $(this).attr("man_hour_fee");
reckon(man_hour_fee);
});
$(".txt_repair_hours").bind("change",function () {
var man_hour_fee = $(this).attr("man_hour_fee");
reckon(man_hour_fee);
});
$(".txt_difficulty_degree").bind("change",function () {
var man_hour_fee = $(this).attr("man_hour_fee");
reckon(man_hour_fee);
});
function reckon(man_hour_fee) {
var parts_price = parseFloat($("#txt_parts_price").val());
var repair_hours = parseFloat($("#txt_repair_hours").val());
var difficulty_degree = parseFloat($("#txt_difficulty_degree").val());
$("#last_price").html((parts_price + man_hour_fee * repair_hours * difficulty_degree)+" 元");
$("#lbl_labor_price").html((man_hour_fee * repair_hours * difficulty_degree)+" 元");
}
$("#save").bind("click",function () {
var id = $("#modelsRepairPlanPricesId").val();
var parts_price = parseFloat($("#txt_parts_price").val());
var repair_hours = parseFloat($("#txt_repair_hours").val());
var difficulty_degree = parseFloat($("#txt_difficulty_degree").val());
var warranty_level = $("#warranty_level").val()
if (confirm("确认提交报价数据吗?")){
$.ajax({
type: "post",
url: "update-models-repair-plan-price",
dataType:"json",
data: $.csrf({"modelsRepairPlanPricesId":id,"parts_price":parts_price,"repair_hours":repair_hours,"difficulty_degree":difficulty_degree ,"warranty_level":warranty_level}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
location.reload();
}else{
//提示确认失败
}
},
error:function(msg){
//提示确认失败
}
});
}
});
//执行删除维修方案报价
$(".btn_fault_models_replan_").bind("click",function(){
var model_price_id = $(this).attr("model_price_id");
//var model_id = $(this).attr("model_id");
if (model_price_id == null || model_price_id == ""){
alert("删除失败,请刷新后再试");
return false;
}
var thiz = $(this);
if (confirm("你确定要删除此维修方案吗?")){
$.ajax({
type: "post",
url: "fault-repair-plan-del",
dataType:"json",
data: $.csrf({"ids":model_price_id}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
thiz.parents('tr').remove();
}else{
}
},
error:function(msg){
}
});
}
});
});
</script>