diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 86915179..51aeb77c 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -302,6 +302,12 @@ class Orders extends HD_Controller $agent['company'] = $company; $agent['ins_risk'] = $ins_risk; $agent['business_risk'] = $business_risk; + $insurance_img = json_decode($img_data['insurance_img'],true); + $business_img = json_decode($img_data['business_img'],true); + $agent['insurance_price'] = $insurance_img['price']; + $agent['insurance_product'] = $insurance_img['product']; + $agent['business_price'] = $business_img['price']; + $agent['business_product'] = $business_img['product']; $row['agent'] = $agent; //获取销售员 if ($row['sale_id']) { @@ -1045,16 +1051,10 @@ class Orders extends HD_Controller return $this->show_json(SYS_CODE_FAIL, '参数错误!'); } $agent = $this->order_agents_model->get(['o_id' => $row['id']]); - $jsondata = json_decode($agent['jsondata'],true); $update = []; $update['car_num'] = $params['car_num']; $update['ins_time'] = $params['ins_time'] ? date('Y-m-d H:i:s', strtotime($params['ins_time'])) : '0000-00-00 00:00:00'; - $jsondata['company'] = $params['company']; - $jsondata['ins_risk'] = $params['ins_risk']; - $jsondata['business_risk'] = $params['business_risk']; - - $update['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE); if ($agent) { $result = $this->order_agents_model->update($update, ['id' => $agent['id']]); } else { @@ -1063,6 +1063,18 @@ class Orders extends HD_Controller $result = $this->order_agents_model->add($update); } if ($result) { + $img_data = $this->receiver_order_datas_model->get(['o_id'=>$row['id']]); + $insurance_img = json_decode($img_data['insurance_img'],true); + $business_img = json_decode($img_data['business_img'],true); + $insurance_img['product'] = $params['insurance_product']; + $insurance_img['price'] = $params['insurance_price']; + $business_img['product'] = $params['business_product']; + $business_img['price'] = $params['business_price']; + $up_data = [ + 'insurance_img' => json_encode($insurance_img,JSON_UNESCAPED_UNICODE), + 'business_img' => json_encode($business_img,JSON_UNESCAPED_UNICODE) + ]; + $this->receiver_order_datas_model->update($up_data,['o_id'=>$row['id']]); return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); } else { return $this->show_json(SYS_CODE_FAIL, '保存失败'); @@ -1323,4 +1335,54 @@ class Orders extends HD_Controller } return $imgs; } + + public function del_img(){ + $info = $this->input->post(); + if(!$info['type'] || !$info['field']){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + $res = false; + if($info['type']=='data'){ + $row = $this->receiver_order_datas_model->get(['o_id'=>$info['id']]); + if(!$row){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + if($info['field']=='ins_img'){ + $jsondata = json_decode($row[$info['field']],true); + $new_jsondata = []; + foreach ($jsondata as $item) { + if(strpos($info['value'],$item) !== false) { + }else{ + $new_jsondata[] = $item; + } + } + $update = [ + $info['field'] => json_encode($new_jsondata,JSON_UNESCAPED_UNICODE) + ]; + }elseif ($info['field']=='insurance_img'||$info['field']=='business_img'){ + $update = [ + $info['field'] => json_encode([]) + ]; + }else{ + $update = [ + $info['field'] => '' + ]; + } + $res = $this->receiver_order_datas_model->update($update,['o_id'=>$info['id']]); + }elseif($info['type']=='load_info'){ + $row = $this->order_loans_model->get(['o_id'=>$info['id']]); + if(!$row){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + $update = [ + $info['field'] => '' + ]; + $res = $this->order_loans_model->update($update,['o_id'=>$info['id']]); + } + if($res){ + return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); + }else{ + return $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + } } diff --git a/admin/views/biz/settle/lists_brand.php b/admin/views/biz/settle/lists_brand.php index d1395d12..96658b57 100644 --- a/admin/views/biz/settle/lists_brand.php +++ b/admin/views/biz/settle/lists_brand.php @@ -57,6 +57,7 @@ 门店 订单信息 + 单车毛利 单车毛利税后 保险利润 贷款利润 @@ -80,6 +81,7 @@ {{v.title}} {{v.vin}} + {{v.profix_car}} {{v.profix_car_after}} {{v.profix_insure}} {{v.profix_loan}} diff --git a/admin/views/receiver/orderv2/get/ckinfo.php b/admin/views/receiver/orderv2/get/ckinfo.php index 61bedd18..fef6400c 100644 --- a/admin/views/receiver/orderv2/get/ckinfo.php +++ b/admin/views/receiver/orderv2/get/ckinfo.php @@ -16,10 +16,10 @@
- +
@@ -40,7 +40,7 @@
+
@@ -50,14 +50,19 @@
- +
+
-
+ +
+ +
+
保存 @@ -74,7 +79,8 @@

    -
  • +
  • +
    x
    @@ -95,25 +101,15 @@

    身份证: -

      -
    • +
    • +
      x
      身份证正面
      -
    • @@ -126,16 +122,12 @@
    • -
    • +
    • +
      x
      身份证反面
      -
    • @@ -153,22 +145,12 @@

      国补资料:

        -
      • +
      • +
        x
        登记证
        -
      • @@ -181,22 +163,12 @@
      • -
      • +
      • +
        x
        行驶证
        -
      • @@ -217,7 +189,8 @@

          -
        • +
        • +
          x
          @@ -234,7 +207,8 @@
        • -
        • +
        • +
          x
          @@ -257,30 +231,20 @@

          其它保单: -

            $val) {?> -
          • +
          • +
            x
            -
          • @@ -298,25 +262,15 @@

            交车合照: -

              $val) {?> -
            • +
            • +
              x
              -
            • @@ -361,4 +315,23 @@ } }, 'json'); } + function del_img(type,field,value){ + layer.confirm('您确定要删除?', {icon: 3, title:'提示'}, function(index){ + layer.close(index); + $.post("/receiver/orderv2/orders/del_img", { + 'id': , + 'type': type, + 'field': field, + 'value': value, + }, function (data) { + if (data.code) { + layer.msg(data.msg, {time: 2000, icon: 1}, function () { + $.form.reload(); + }); + } else { + layer.msg(data.msg, {icon: 2}); + } + }, 'json'); + }); + } diff --git a/admin/views/receiver/orderv2/get/loaninfo.php b/admin/views/receiver/orderv2/get/loaninfo.php index 42b54b94..214c8e1d 100644 --- a/admin/views/receiver/orderv2/get/loaninfo.php +++ b/admin/views/receiver/orderv2/get/loaninfo.php @@ -58,19 +58,12 @@
                -
              • +
              • +
                x
                -
              @@ -97,19 +90,12 @@
                -
              • +
              • +
                x
                -
              diff --git a/api/controllers/plan/Biz.php b/api/controllers/plan/Biz.php index 293cf1bc..6913cfd1 100644 --- a/api/controllers/plan/Biz.php +++ b/api/controllers/plan/Biz.php @@ -271,7 +271,7 @@ class Biz extends HD_Controller 'biz_id' => $val['biz_id'], 'title' => $insurance_img['product'], 'type' => 2, - "json_extract(jsondata, '$.type') = '1'" => null, + "json_extract(jsondata, '$.type') = '2'" => null, "json_extract(jsondata, '$.s_time') >= '{$time}'" => null, "json_extract(jsondata, '$.e_time') <= '{$time}'" => null ]; @@ -282,7 +282,7 @@ class Biz extends HD_Controller 'title' => $insurance_img['product'], 'type' => 2, 'is_def' => 1, - "json_extract(jsondata, '$.type') = '1'" => null, + "json_extract(jsondata, '$.type') = '2'" => null, ]; $fd_row = $this->biz_settle_srv_model->get($where); } @@ -297,7 +297,7 @@ class Biz extends HD_Controller 'biz_id' => $val['biz_id'], 'title' => $business_img['product'], 'type' => 2, - "json_extract(jsondata, '$.type') = '2'" => null, + "json_extract(jsondata, '$.type') = '1'" => null, "json_extract(jsondata, '$.s_time') >= '{$time}'" => null, "json_extract(jsondata, '$.e_time') <= '{$time}'" => null ]; @@ -308,7 +308,7 @@ class Biz extends HD_Controller 'title' => $business_img['product'], 'type' => 2, 'is_def' => 1, - "json_extract(jsondata, '$.type') = '2'" => null, + "json_extract(jsondata, '$.type') = '1'" => null, ]; $bis_fd_row = $this->biz_settle_srv_model->get($where); } @@ -339,7 +339,21 @@ class Biz extends HD_Controller $fd_jsondata = json_decode($fd_row['jsondata'],true); $loan_fd = $fd_jsondata['rebate'] ? $fd_jsondata['rebate']/100:0; $profix_loan = $money_json['price_loan']*$loan_fd; + //获取贷款手续费 + $srv_loan = 0; + $srv_json = json_decode($val['srv_ids'],true); + if($srv_json){ + foreach ($srv_json as $v2) { + if($v2['key']=='price_finance'){ + $srv_loan = $v2['price']; + break; + } + } + } + $profix_loan += $srv_loan; } + $settle_money_json['profix_insuer_ins'] = $profix_insuer_ins; + $settle_money_json['profix_insuer_bis'] = $profix_insuer_bis; $settle_money_json['in']['commission'] = $profix_loan+$profix_insuer; //精品成本(赠送的也要算) $profix_fine = 0; diff --git a/api/controllers/wxapp/app/Business.php b/api/controllers/wxapp/app/Business.php index 3e9d1c27..a773ad9b 100644 --- a/api/controllers/wxapp/app/Business.php +++ b/api/controllers/wxapp/app/Business.php @@ -68,6 +68,18 @@ class Business extends Wxapp{ 's_effect_time<=' => $e_time, ]; $row = $this->auto_business_model->get($where); + if(!$row){ + $where = [ + 'city_id' => $old_business_row['city_id'], + 'brand_id' => $old_business_row['brand_id'], + 's_id' => $s_id, + 'v_id' => $v_id, + 'if_effect' => 1, + 'status' => 1 + ]; + $new_row = $this->auto_business_model->select($where,'id desc',1,1); + $row = $new_row ? $new_row[0] : ''; + } } } }