add-api-mycar_v2

This commit is contained in:
lccsw
2022-07-08 15:26:30 +08:00
parent a1a8288884
commit b27b141067
4 changed files with 112 additions and 2 deletions
+17 -1
View File
@@ -188,12 +188,28 @@ class Orders extends HD_Controller
? str_replace(" 00:00:00", "", $row['delry_time']) : '';
//获取车辆服务费
$srv_info = $this->orders_v2_entity->order_srv_money($row['id'], 2);
$fine_title = '';
if($row['fines']){
$fines = json_decode($row['fines'],true);
$split = $fine_title = '';
foreach($fines as $key=>$val){
$fine_title = $fine_title.$split.$val['txt'].$split;
$price = number_format(floatval($val['price']),2);
$fine_title = $fine_title.$split."{$val['txt']}:{$price}";
$split = ' ';
}
}
$row['fine_title'] = $fine_title;
$srv_info['total'] = number_format($srv_info['total'], 2);
$srv_detail = "";
if ($srv_info['list']) {
foreach ($srv_info['list'] as $key => $val) {
$d = $srv_detail ? ',' : '';
$srv_detail .= $d . $val['title'] . ":" . number_format(floatval($val['money']), 2);
if($val['key']=='price_fine_select' && $fine_title){
$srv_detail .= $d . $val['title'] . ":" . number_format(floatval($val['money']), 2)."<span class='text-success'>[$fine_title]</span>";
}else{
$srv_detail .= $d . $val['title'] . ":" . number_format(floatval($val['money']), 2);
}
}
}
$srv_info['detail'] = $srv_detail;
@@ -166,6 +166,19 @@
</div>
</div>
</div>
<div class="am-form-inline">
<div class="am-form-group am-u-lg-6">
<label class="am-para-label label-width"><span class="span-bold">客户身份证:</span></label>
<div class="am-para-input">
<label class="am-para-label-con">{{info.cardid}}</label>
</div>
</div>
<div class="am-form-group am-u-lg-6">
<label class="am-para-label label-width"><span class="span-bold">&nbsp;</span></label>
<div class="am-para-input">
</div>
</div>
</div>
<template v-if="info.main_type!=1"> <!--个人-->
<div class="am-form-inline">
<div class="am-form-group am-u-lg-6">
+3 -1
View File
@@ -60,7 +60,9 @@
<div class="am-para-input" style="margin-left:120px">
<label class="am-para-label-con" v-if="info.srv_info">
{{info.srv_info.total}}
<span class="text-danger" v-if="info.srv_info.detail">({{info.srv_info.detail}})</span>
<template v-if="info.srv_info.detail">
(<span class="text-danger" v-html="info.srv_info.detail"></span>)
</template>
</label>
<span v-if="info.is_admin" class="am-btn am-btn-primary am-btn-xs" data-title="修改服务费" :data-modal="'/receiver/orderv2/orders/edit_srv?id='+info.id">修改</span>
</div>
+79
View File
@@ -365,4 +365,83 @@ class User extends Wxapp{
$this->app_user_model->update(['jsondata'=>json_encode($jsondata,JSON_UNESCAPED_UNICODE)],['id'=>$uid]);
throw new Exception('保存成功', API_CODE_SUCCESS);
}
//我的爱车2
protected function get_mycar__1_1(){
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 10;
$mobile = $this->session['mobile'];
$where = [
"(mobile={$mobile} or owner_name={$mobile})" => null,
"status" => 1,
];
$count = $this->receiver_orders_v2_model->count($where);
$lists = [];
if($count){
$this->load->model("items/items_model");
$this->load->model('receiver/order/receiver_order_agents_model','agents_model');
$rows = $this->receiver_orders_v2_model->select($where,'id desc',$page,$size);
//品牌车型
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name');
//车系车型
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
foreach($rows as $key=>$val){
$item = $this->items_model->get(['id'=>$val['item_id']],'vin');
$agent = $this->agents_model->get(['o_id'=>$val['id']]);
$color = $this->auto_attr_model->get(['id'=>$val['cor_id']],'title,jsondata');
$color && $color['jsondata'] = json_decode($color['jsondata'],true);
$agent['ins_time'] = $agent['ins_time'] ? date('Y.m.d',strtotime($agent['ins_time'])):'';
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
$car_img = [];
if($agent['car_img']){
$car_img[] = build_qiniu_image_url($agent['car_img']);
}
$ins_img = [];
if($agent['ins_img']){
$ins_imgs = json_decode($agent['ins_img']);
foreach($ins_imgs as $key =>$val){
$ins_img[] = build_qiniu_image_url($val);
}
}
$other[] = [
'icon'=>'icon-hangshizheng',
'title'=>'行驶证',
'img'=> $car_img
];
$other[] = [
'icon'=>'icon-baodan',
'title'=>'保单',
'img'=> $ins_img
];
$lists[] = [
'title' => "{$brand_name}{$serie_name}",
'model' => [
'title' => $color['title'],
'img' => $color['jsondata']['img']? build_qiniu_image_url($color['jsondata']['img']):'',
'color' => $color['jsondata']['code']
],
'vincode' => "车架号 {$item['vin']}",
'platenumber' => $agent['car_num'],
'insure' => "{$agent['ins_time']}到期",
'other' => $other
];
}
}
$data = [
'list' => $lists,
'total' => $count
];
return $data;
}
}