edit-admin-srv_price
This commit is contained in:
@@ -1234,24 +1234,24 @@ class Orders extends HD_Controller
|
||||
$money_json = json_decode($row['money_json'],true);
|
||||
$services = json_decode($row['srv_ids'],true);
|
||||
if($this->input->method()=='post'){
|
||||
$new_services = [];
|
||||
$info = $this->input->post();
|
||||
if(is_array($info['money'])){
|
||||
foreach ($info['money'] as $key => $val) {
|
||||
if($val['checkbox']){
|
||||
$money_json[$key] = floatval($val['value']);
|
||||
unset($val['checkbox']);
|
||||
$new_services[] = $val;
|
||||
$money_json[$key] = floatval($val['price']);
|
||||
}else{
|
||||
$money_json[$key] = 0;
|
||||
foreach ($services as $k => $v) {
|
||||
if($key==$v['key']){
|
||||
unset($services[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$srv_ids = is_array($new_services) ? array_column($new_services,'id') : [];
|
||||
$updata = [
|
||||
'srv_ids' => json_encode($services,JSON_UNESCAPED_UNICODE),
|
||||
'if_insure' => in_array(1,$srv_ids) ? 0 : 1,
|
||||
'if_num' => in_array(2,$srv_ids) ? 0 : 1,
|
||||
'srv_ids' => json_encode($new_services,JSON_UNESCAPED_UNICODE),
|
||||
'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE)
|
||||
];
|
||||
$res = $this->receiver_orders_v2_model->update($updata,['id'=>$id]);
|
||||
@@ -1273,21 +1273,15 @@ class Orders extends HD_Controller
|
||||
}
|
||||
}
|
||||
//获取车辆服务费
|
||||
$lists = [];
|
||||
if($services){
|
||||
$srv_ids = array_column($services,'id');
|
||||
$ids = implode(',',$srv_ids);
|
||||
if($srv_ids){
|
||||
$where["id in ($ids)"] = null;
|
||||
$rows = $this->services_model->map('id','title',$where,'','','','id,title');
|
||||
foreach($services as $key=>$val){
|
||||
$lists[] = [
|
||||
'title' => $rows[$val['id']],
|
||||
'key' => $val['key'],
|
||||
'money' => $money_json[$val['key']]
|
||||
];
|
||||
}
|
||||
}
|
||||
$lists = [
|
||||
['id'=>1,'key'=>'price_insure','title'=>'代办保险'],
|
||||
['id'=>2,'key'=>'fee_carno','title'=>'代办上牌']
|
||||
];
|
||||
!$row['payway'] && $lists[] = ['id'=>4,'key'=>'price_finance','title'=>'代办分期'];
|
||||
$srv_ids = is_array($services) ? array_column($services,'id') : [];
|
||||
foreach($lists as $key=>$val){
|
||||
$lists[$key]['money'] = $money_json[$val['key']] ? $money_json[$val['key']] : 0;
|
||||
$lists[$key]['checked'] = in_array($val['id'],$srv_ids) ? 'checked' : '';
|
||||
}
|
||||
$this->data['srv_info'] = $lists;
|
||||
$this->data['id'] = $id;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<form class="am-form am-form-horizontal" action="/receiver/orderv2/orders/edit_srv" data-auto="true" method="post"
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<? foreach ($srv_info as $value) {?>
|
||||
<? foreach ($srv_info as $key=>$value) {?>
|
||||
<div class="am-form-group">
|
||||
<input type="hidden" value="<?=$value['id']?>" name="money[<?=$key?>][id]"/>
|
||||
<input type="hidden" value="<?=$value['key']?>" name="money[<?=$key?>][key]"/>
|
||||
<label class="am-para-label">
|
||||
<input type="checkbox" name="money[<?=$value['key']?>][checkbox]" checked value="1">
|
||||
<input type="checkbox" name="money[<?=$key?>][checkbox]" <?=$value['checked']?> value="1">
|
||||
<?=$value['title']?>:
|
||||
</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" value="<?=$value['money']?>" name="money[<?=$value['key']?>][value]" <?=$value['key']=='price_insure' ? 'readonly' : ''?>/>
|
||||
<input type="text" value="<?=$value['money']?>" name="money[<?=$key?>][price]" <?=$value['key']=='price_insure' ? 'readonly' : ''?>/>
|
||||
</div>
|
||||
</div>
|
||||
<?}?>
|
||||
|
||||
Reference in New Issue
Block a user