add-brand-settle
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Fine extends HD_Controller{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_fine_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
$params = $this->input->get();
|
||||
$params['id'] && $_SESSION['srv_biz_id'] = $params['id'];
|
||||
!strlen($params['status']) && $params['status'] = '';
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$pagesize = 20;
|
||||
$where = [
|
||||
'status>=' => 0,
|
||||
'biz_id' => $_SESSION['srv_biz_id']
|
||||
];
|
||||
strlen($params['status']) && $where['status'] = $params['status'];
|
||||
$params['title'] && $where['title'] = $params['title'];
|
||||
$count = $this->receiver_fine_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->receiver_fine_model->select($where, 'id desc', $page, $pagesize);
|
||||
$biz_ids = array_unique(array_column($rows,'biz_id'));
|
||||
$map_biz = [];
|
||||
if(is_array($biz_ids)){
|
||||
$biz_ids = implode(',',array_filter($biz_ids));
|
||||
$where_biz = ["id in ({$biz_ids})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
}
|
||||
foreach ($rows as $val) {
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'biz_id' => $val['biz_id'],
|
||||
'biz_name' => $map_biz[$val['biz_id']],
|
||||
'title' => $val['title'],
|
||||
'price' => $val['price'],
|
||||
'status_cn' => $this->receiver_fine_model->get_status($val['status']),
|
||||
'c_time' => date('Y-m-d H:i',$val['c_time']),
|
||||
'status' => $val['status'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['_title'] = '门店精品成本列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
$this->show_view('biz/fine/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$biz_id = $_SESSION['srv_biz_id'];
|
||||
$id = $this->input->get('id');
|
||||
if(!$biz_id){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$row = $this->receiver_fine_model->get(['id'=>$id]);
|
||||
$info = [
|
||||
'biz_id' => $biz_id,
|
||||
'title' => '',
|
||||
'price' => '',
|
||||
'action' => 'biz/fine/add',
|
||||
];
|
||||
if($row){
|
||||
$info['title'] = $row['title'];
|
||||
$info['price'] = $row['price'];
|
||||
$info['action'] = 'biz/fine/edit';
|
||||
}
|
||||
$this->data['info'] = $info;
|
||||
$this->show_view('biz/fine/get');
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
$data = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'title' => $info['title'],
|
||||
'price' => $info['price'],
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
];
|
||||
$res = $this->receiver_fine_model->add($data);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
$row = $this->receiver_fine_model->get(['id'=>$info['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$data = [
|
||||
'title' => $info['title'],
|
||||
'price' => $info['price'],
|
||||
];
|
||||
$res = $this->receiver_fine_model->update($data,['id'=>$info['id']]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
$field = $this->input->post('field');
|
||||
if ($field === 'ifcheck') {
|
||||
$status = intval($this->input->post('value'));
|
||||
$ids = $this->input->post('id');
|
||||
$ids = explode(',', $ids);
|
||||
if (!$ids || count($ids) < 1) {
|
||||
$this->show_json(0, '请选择要操作的选项');
|
||||
}
|
||||
$ids_str = implode(',', $ids);
|
||||
$where = ["id in({$ids_str})" => null];
|
||||
} else {
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = intval($this->input->post('value'));
|
||||
if (!$id) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$where['id'] = $id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$this->receiver_fine_model->update($data, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function export(){
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,8 @@ class Settle extends HD_Controller
|
||||
'profix_insure' => $v['profix_insure'],
|
||||
'profix_carno' => $v['profix_carno'],
|
||||
'profix_loan' => $v['profix_loan'],
|
||||
'sum_srv' => $v['profix_insure']+$v['profix_carno']+$v['profix_loan'],
|
||||
'profix_fine' => $v['profix_fine'],
|
||||
'sum_srv' => $v['profix_insure']+$v['profix_carno']+$v['profix_loan']+$v['profix_fine'],
|
||||
'price_trucking' => $v['price_trucking'],
|
||||
'name' => $v['name'],
|
||||
'mobile' => $v['mobile'],
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Srv extends HD_Controller{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_business_model');
|
||||
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_settle_srv_model');
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
$params = $this->input->get();
|
||||
$params['id'] && $_SESSION['srv_biz_id'] = $params['id'];
|
||||
!$params['type'] && $params['type'] = '';
|
||||
!strlen($params['status']) && $params['status'] = '';
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$pagesize = 20;
|
||||
$where = [
|
||||
'status>=' => 0,
|
||||
'biz_id' => $_SESSION['srv_biz_id']
|
||||
];
|
||||
strlen($params['status']) && $where['status'] = $params['status'];
|
||||
$params['type'] && $where['type'] = $params['type'];
|
||||
$count = $this->biz_settle_srv_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->biz_settle_srv_model->select($where, 'is_def desc,id desc', $page, $pagesize);
|
||||
$biz_ids = array_unique(array_column($rows,'biz_id'));
|
||||
$map_biz = [];
|
||||
if(is_array($biz_ids)){
|
||||
$biz_ids = implode(',',array_filter($biz_ids));
|
||||
$where_biz = ["id in ({$biz_ids})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
}
|
||||
foreach ($rows as $val) {
|
||||
$other_data = $this->biz_settle_srv_model->get_jsondata($val['type'],$val['jsondata']);
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'biz_id' => $val['biz_id'],
|
||||
'biz_name' => $map_biz[$val['biz_id']],
|
||||
'title' => $val['title'],
|
||||
'other_data' => $other_data,
|
||||
's_effect_time' =>$val['s_effect_time'],
|
||||
'is_def' => $val['is_def'] ? '是':'否',
|
||||
'type_cn' => $this->biz_settle_srv_model->get_type($val['type']),
|
||||
'status_cn' => $this->biz_settle_srv_model->get_status($val['status']),
|
||||
'c_time' => date('Y-m-d H:i',$val['c_time']),
|
||||
'status' => $val['status'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['typeAry'] = $this->biz_settle_srv_model->get_type();
|
||||
$this->data['_title'] = '门店列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
$this->show_view('biz/srv/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$biz_id = $_SESSION['srv_biz_id'];
|
||||
$id = $this->input->get('id');
|
||||
if(!$biz_id){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$row = $this->biz_settle_srv_model->get(['id'=>$id]);
|
||||
$finances = $this->sys_finance_model->select(['status' => 1], '', 0, 0, 'id,title');
|
||||
$info = [
|
||||
'biz_id' => $biz_id,
|
||||
'type' => 1,
|
||||
'is_def' => 0,
|
||||
's_effect_time' => date('Y-m-d'),
|
||||
'action' => 'biz/srv/add',
|
||||
'jsondata' => ['price'=>300,'type'=>1,'finance_id'=>$finances[0]['id'],'finance_num'=>12]
|
||||
];
|
||||
if($row){
|
||||
$info['title'] = $row['title'];
|
||||
$info['id'] = $row['id'];
|
||||
$info['type'] = $row['type'];
|
||||
$info['is_def'] = $row['is_def'];
|
||||
$info['s_effect_time'] = $row['s_effect_time'];
|
||||
$info['action'] = 'biz/srv/edit';
|
||||
$info['jsondata'] = json_decode($row['jsondata'],true);
|
||||
}
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['finances'] = $finances;
|
||||
$this->data['finances_num'] = $this->sys_finance_model->get_nums();
|
||||
$this->data['info'] = $info;
|
||||
$this->data['typeAry'] = $this->biz_settle_srv_model->get_type();
|
||||
$this->show_view('biz/srv/get');
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
$data = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'c_time' => time(),
|
||||
'type' => $info['type'],
|
||||
'is_def' => $info['is_def'] ? 1 : 0,
|
||||
];
|
||||
$info['title'] && $data['title'] = $info['title'];
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = date('Y-m-d',strtotime($info['s_effect_time']));
|
||||
$jsondata = [];
|
||||
if($info['type']==1){
|
||||
$jsondata['price'] = floatval($info['jsondata']['price']);
|
||||
}elseif($info['type']==2){
|
||||
$info['s_time'] && $jsondata['s_time'] = strtotime($info['s_time']);
|
||||
$info['e_time'] && $jsondata['e_time'] = strtotime($info['e_time']);
|
||||
$jsondata['rebate'] = $info['jsondata']['rebate'];
|
||||
$jsondata['type'] = $info['jsondata']['type'];
|
||||
}else{
|
||||
$jsondata['rebate'] = $info['jsondata']['rebate'];
|
||||
$jsondata['finance_id'] = $info['jsondata']['finance_id'];
|
||||
$jsondata['finance_num'] = $info['jsondata']['finance_num'];
|
||||
}
|
||||
//只能有一条默认
|
||||
if($info['is_def']){
|
||||
$where = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'type' => $info['type'],
|
||||
'is_def' => 1
|
||||
];
|
||||
$this->biz_settle_srv_model->update(['is_def'=>0],$where);
|
||||
}
|
||||
$data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$res = $this->biz_settle_srv_model->add($data);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
$row = $this->biz_settle_srv_model->get(['id'=>$info['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$data = [
|
||||
'type' => $info['type'],
|
||||
'is_def' => $info['is_def'] ? 1 : 0,
|
||||
];
|
||||
$info['title'] && $data['title'] = $info['title'];
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = date('Y-m-d',strtotime($info['s_effect_time']));
|
||||
if($info['type']==1){
|
||||
$jsondata['price'] = floatval($info['jsondata']['price']);
|
||||
}elseif($info['type']==2){
|
||||
$info['s_time'] && $jsondata['s_time'] = strtotime($info['s_time']);
|
||||
$info['e_time'] && $jsondata['e_time'] = strtotime($info['e_time']);
|
||||
$jsondata['rebate'] = $info['jsondata']['rebate'];
|
||||
$jsondata['type'] = $info['jsondata']['type'];
|
||||
}else{
|
||||
$jsondata['rebate'] = $info['jsondata']['rebate'];
|
||||
$jsondata['finance_id'] = $info['jsondata']['finance_id'];
|
||||
$jsondata['finance_num'] = $info['jsondata']['finance_num'];
|
||||
$finance = $this->sys_finance_model->get(['id'=>intval($jsondata['finance_id'])],'title');
|
||||
$jsondata['finance_title'] = $finance['title'];
|
||||
}
|
||||
//只能有一条默认
|
||||
if($info['is_def']){
|
||||
$where = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'type' => $info['type'],
|
||||
'is_def' => 1
|
||||
];
|
||||
$this->biz_settle_srv_model->update(['is_def'=>0],$where);
|
||||
}
|
||||
$data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$res = $this->biz_settle_srv_model->update($data,['id'=>$info['id']]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
$field = $this->input->post('field');
|
||||
if ($field === 'ifcheck') {
|
||||
$status = intval($this->input->post('value'));
|
||||
$ids = $this->input->post('id');
|
||||
$ids = explode(',', $ids);
|
||||
if (!$ids || count($ids) < 1) {
|
||||
$this->show_json(0, '请选择要操作的选项');
|
||||
}
|
||||
$ids_str = implode(',', $ids);
|
||||
$where = ["id in({$ids_str})" => null];
|
||||
} else {
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = intval($this->input->post('value'));
|
||||
if (!$id) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$where['id'] = $id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$this->biz_settle_srv_model->update($data, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function export(){
|
||||
}
|
||||
}
|
||||
@@ -1022,7 +1022,8 @@ class Store extends HD_Controller
|
||||
public function get_info()
|
||||
{
|
||||
$biz_id = $this->input->get('id');
|
||||
if (!$this->biz_model->get(['id' => $biz_id])) {
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
if (!$biz) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
|
||||
}
|
||||
$base_info = $this->biz_info_model->get(['biz_id' => $biz_id]);
|
||||
@@ -1047,6 +1048,7 @@ class Store extends HD_Controller
|
||||
'e_time' => $base_info['e_time'] ? date('Y-m-d', $base_info['e_time']) : '',
|
||||
'type' => $base_info['type'],
|
||||
'rate' => strlen($base_info['rate']) ? $base_info['rate'] : 0,
|
||||
'biz_type' => $biz['type'],
|
||||
];
|
||||
$brands = [];
|
||||
$b_rows = $this->biz_trucking_model->select(['biz_id' => $base_info['biz_id'], 'status' => 1], '', '', '', 'auto_b_id,money');
|
||||
@@ -1120,4 +1122,9 @@ class Store extends HD_Controller
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function lists_srv(){
|
||||
$biz_id = $this->input->get('id');
|
||||
echo $biz_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">名称:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="名称" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">成本价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="成本价" v-model="info.price"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info : [],
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/biz/fine/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">名称:</label>
|
||||
<div class="am-para-inline">
|
||||
<input type="text" name="title" v-model="params.title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button data-title="新增" type="button" data-modal="/biz/fine/get" class="am-btn am-btn-success am-btn-sm w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="20%"><span>名称</span></th>
|
||||
<th width="20%"><span>成本价</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['price'] ?></td>
|
||||
<td><?= $v['status_cn'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" class="align-r">
|
||||
<a data-title="修改-<?=$v['title']?>" data-modal="/biz/fine/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
|
||||
<input type="hidden" class="fine-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".fine-id-<?= $v['id'] ?>"
|
||||
data-action="/biz/fine/batch" data-field="" style="height: 30px;width: 70px;">
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>禁用</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>正常</option>
|
||||
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: [],
|
||||
typeAry:<?=$typeAry ? json_encode($typeAry) : '[]'?>
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
watch: {
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -60,6 +60,7 @@
|
||||
<th width="10%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>贷款利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<th width="6%"><span>精品利润</span></th>
|
||||
<th width="6%"><span>水平业务合计</span></th>
|
||||
<th width="6%"><span>拖车费</span></th>
|
||||
<th width="6%"><span>时间</span></th>
|
||||
@@ -82,6 +83,7 @@
|
||||
<td>{{v.profix_insure}}</td>
|
||||
<td>{{v.profix_loan}}</td>
|
||||
<td>{{v.profix_carno}}</td>
|
||||
<td>{{v.profix_fine}}</td>
|
||||
<td>{{v.sum_srv}}</td>
|
||||
<td>{{v.price_trucking}}</td>
|
||||
<td>{{v.month}}</td>
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active" id="swzc">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">供应商:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="供应商" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">生效时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="" id="id-time" v-model="info.s_effect_time" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="type" v-model="info.type">
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">是否默认:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" v-model="info.is_def"/>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.type==1">
|
||||
<div class="am-form-group wp50" >
|
||||
<label class="am-para-label">结算价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="请输入结算价" name="price_insure" v-model="info.jsondata.price" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="info.type==2 || info.type==3">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">返点:</label>
|
||||
<div class="input-group am-para-input w150">
|
||||
<input type="number" placeholder="输入返点" v-model="info.jsondata.rebate">
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="input-group am-para-input">
|
||||
<span class="f12 clr999 lh-default ml5">百分比</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="info.type==2">
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">保险类型:</label>
|
||||
<div class="input-group am-para-input w150">
|
||||
<select v-model="info.jsondata.type">
|
||||
<option value="1">商业险</option>
|
||||
<option value="2">交强险</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group" :style="{'display':info.type==2 ? 'block':'none'}">
|
||||
<label class="am-para-label">时间区间:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="开始时间" autocomplete="off" value="<?=$info['jsondata']['s_time']?>" name="s_time" id="s-time">
|
||||
</div>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="结束时间" autocomplete="off" value="<?=$info['jsondata']['e_time']?>" name="e_time" id="e-time">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="info.type==3">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">产品:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.finance_id">
|
||||
<option v-for="(item,key) in finances" :value="item.id">{{item.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">期数:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.finance_num">
|
||||
<option v-for="item in finances_num" :value="item">{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time'
|
||||
});
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#s-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#e-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
});
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info : [],
|
||||
typeAry:[],
|
||||
yearAry:[],
|
||||
monthAry:[],
|
||||
finances:[],
|
||||
finances_num:[],
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.typeAry = <?=$typeAry ? json_encode($typeAry) : '[]'?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.finances = <?=json_encode($finances)?>;
|
||||
vm.finances_num = <?=json_encode($finances_num)?>;
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
vm.info.s_effect_time = $("#id-time").val();
|
||||
if(vm.info.type==2){
|
||||
vm.info.s_time = $("#s-time").val();
|
||||
vm.info.e_time = $("#e-time").val();
|
||||
}
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/biz/srv/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="type" v-model="params.type">
|
||||
<option value="">请选择</option>
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button data-title="新增" type="button" data-modal="/biz/srv/get" class="am-btn am-btn-success am-btn-sm w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="20%"><span>商家</span></th>
|
||||
<th width="20%"><span>供应商</span></th>
|
||||
<th width="20%"><span>其它参数</span></th>
|
||||
<th width="15%"><span>生效日期</span></th>
|
||||
<th width="8%"><span>类型</span></th>
|
||||
<th width="8%"><span>是否默认</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td>
|
||||
<?foreach ($v['other_data'] as $k2 => $v2){?>
|
||||
<?=$k2?>:<?= $v2 ?><br>
|
||||
<?}?>
|
||||
</td>
|
||||
<td><?= $v['s_effect_time'] ?></td>
|
||||
<td><?= $v['type_cn'] ?></td>
|
||||
<td><?= $v['is_def'] ?></td>
|
||||
<td><?= $v['status_cn'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" class="align-r">
|
||||
<a data-title="修改-<?=$v['title']?>" data-modal="/biz/srv/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
|
||||
<input type="hidden" class="srv-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".srv-id-<?= $v['id'] ?>"
|
||||
data-action="/biz/srv/batch" data-field="" style="height: 30px;width: 70px;">
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>禁用</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>正常</option>
|
||||
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: [],
|
||||
typeAry:<?=$typeAry ? json_encode($typeAry) : '[]'?>
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
watch: {
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -12,7 +12,7 @@
|
||||
<input type="text" placeholder="输入联系电话" name="" v-model="info.mobile"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="am-form-group" v-if="info.biz_type==2">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input w150">
|
||||
<select v-model="info.type">
|
||||
|
||||
@@ -153,7 +153,14 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="align-r">
|
||||
<?if($v['type']==2){?>
|
||||
<a data-open="/biz/fine/lists?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">精品配置
|
||||
</a>
|
||||
<?if($v['type']==1){?>
|
||||
<a data-open="/biz/srv/lists?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">水平业务配置</a>
|
||||
<?}?>
|
||||
<?if(in_array($v['type'],[1,2])){?>
|
||||
<a data-open="/biz/store/store/get_info?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">基本信息</a>
|
||||
<a data-open="/biz/settle/lists_static?id=<?= $v['id'] ?>"
|
||||
|
||||
@@ -7,12 +7,16 @@ class Biz extends HD_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model','orders_model');
|
||||
$this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->load->model('receiver/receiver_fine_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_info_model');
|
||||
$this->load->model('biz/biz_settle_model');
|
||||
$this->load->model('biz/biz_settle_static_model');
|
||||
$this->load->model('biz/biz_settle_srv_model');
|
||||
$this->load->model('biz/biz_trucking_model');
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
}
|
||||
@@ -175,4 +179,143 @@ class Biz extends HD_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//品牌店统计
|
||||
public function settle_brand(){
|
||||
$size = $this->input->get('size');
|
||||
!$size && $size = 5;
|
||||
|
||||
$t1 = 'lc_receiver_orders_v2';
|
||||
$t2 = 'lc_biz_settle';
|
||||
$t3 = 'lc_biz';
|
||||
|
||||
$fields = "$t1.*";
|
||||
$where = [
|
||||
"$t1.status" => 1,
|
||||
"$t1.id>=" => Orders_v2_entity::V2_START_ID,
|
||||
"$t2.id is null" => null,
|
||||
"$t3.type" => 1,
|
||||
];
|
||||
$this->db->from("$t1");
|
||||
$this->db->join("$t2", "$t2.o_id=$t1.id",'left');
|
||||
$this->db->join("$t3", "$t3.id=$t1.biz_id",'left');
|
||||
|
||||
$this->db->select($fields);
|
||||
$this->db->where($where);
|
||||
$this->db->order_by("$t2.id ASC");
|
||||
$this->db->limit($size);
|
||||
$rows = $this->db->get()->result_array();
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
$info_json = json_decode($val['info_json'],true);
|
||||
$money_json = json_decode($val['money_json'],true);
|
||||
//获取创建订单时商务政策
|
||||
$where = [
|
||||
'id' => $info_json['business_id'],
|
||||
];
|
||||
$b_row_one = $this->auto_business_model->get($where);
|
||||
$truck_row = $this->biz_trucking_model->get(['auto_b_id'=>$val['brand_id'],'biz_id'=>$val['biz_id'],'status'=>1]);
|
||||
$price_trucking = $truck_row['money'] ? $truck_row['money'] : 0;
|
||||
//挂牌利润 = 实收 - 成本
|
||||
$profix_carno = 0;
|
||||
if($money_json['fee_carno']>0){
|
||||
$where = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
's_effect_time>=' => date('Y-m-01',$val['c_time']),
|
||||
's_effect_time<=' => date('Y-m-t',$val['c_time']),
|
||||
];
|
||||
$free_row = $this->biz_settle_srv_model->get($where);
|
||||
if(!$free_row){
|
||||
$free_row = $this->biz_settle_srv_model->get(['biz_id'=>$val['biz_id'],'is_def'=>1,'status'=>1,'type'=>1]);
|
||||
}
|
||||
$free_jsondata = json_decode($free_row['jsondata'],true);
|
||||
$cb_fee_carno = $free_jsondata['price'] ? $free_jsondata['price'] : 0;
|
||||
$profix_carno = $money_json['fee_carno'] - $cb_fee_carno;
|
||||
}
|
||||
//保险利润 = 金额(是否含税) * 返点百分比(保险类型):保险生效日
|
||||
$agent_row = $this->order_agents_model->get(['o_id'=>$val['id']]);
|
||||
$agent_json = json_decode($agent_row['jsondata'],true);
|
||||
//强险
|
||||
$where = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'type' => 2,
|
||||
"json_extract(jsondata, '$.type') = '1'" => null
|
||||
];
|
||||
$fd_row = $this->biz_settle_srv_model->get($where);
|
||||
$fd_jsondata = json_decode($fd_row['jsondata'],true);
|
||||
$qx_fd = $fd_jsondata['rebate']/100;
|
||||
$profix_insuer_ins = floatval($agent_json['ins_risk']) * $qx_fd;
|
||||
//商业险
|
||||
$where = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'type' => 2,
|
||||
"json_extract(jsondata, '$.type') = '2'" => null
|
||||
];
|
||||
$bis_fd_row = $this->biz_settle_srv_model->get($where);
|
||||
$bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
|
||||
$bis_fd = $bis_fd_jsondata['rebate']/100;
|
||||
$profix_insuer_bis = floatval($money_json['business_risk'])*$bis_fd;
|
||||
$profix_insuer = $profix_insuer_ins + $profix_insuer_bis;
|
||||
//贷款利润 = 手续费 + 贷款金额 * 返点(对应产品)
|
||||
$profix_loan = floatval($money_json['price_finance']);
|
||||
if($money_json['price_loan']>=0){
|
||||
$loan_row = $this->order_loans_model->get(['o_id'=>$val['id']]);
|
||||
$finance_id = $val['finance_id'];
|
||||
$finance_num = $loan_row['num'] ? $loan_row['num'] : 0;
|
||||
$where = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'type' => 3,
|
||||
"json_extract(jsondata, '$.finance_id') = '{$finance_id}'" => null,
|
||||
"json_extract(jsondata, '$.finance_num') = '{$finance_num}'" => null,
|
||||
];
|
||||
$fd_row = $this->biz_settle_srv_model->get($where);
|
||||
if(!$fd_row){
|
||||
$fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$val['biz_id'],'is_def'=>1,'status'=>1,'type'=>3]);
|
||||
}
|
||||
$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;
|
||||
}
|
||||
//实收 - 成本(赠送的也要算)
|
||||
$profix_fine = 0;
|
||||
$fines = json_decode($val['fines'],true);
|
||||
$fines_ids = array_column($fines,'id');
|
||||
if($fines){
|
||||
$fines_ids = implode(',',$fines_ids);
|
||||
$where = [
|
||||
"id in ({$fines_ids})" => null
|
||||
];
|
||||
$fines_ids && $cb_sum = $this->receiver_fine_model->sum('price',$where);
|
||||
$cb = $cb_sum['price'] ? $cb_sum['price'] : 0; //成本
|
||||
$sh = 0; //实收
|
||||
foreach ($fines as $f_val) {
|
||||
$sh += floatval($f_val['price']);
|
||||
}
|
||||
$profix_fine = $sh-$cb;
|
||||
}
|
||||
$add_data = [
|
||||
'biz_id' => $val['biz_id'],
|
||||
'o_id' => $val['id'],
|
||||
'profix_car' => $b_row_one['profix_car'] ? $b_row_one['profix_car'] : 0,
|
||||
'profix_insure' => $profix_insuer,
|
||||
'profix_loan' => $profix_loan,
|
||||
'profix_carno' => $profix_carno,
|
||||
'price_trucking' => $price_trucking,
|
||||
'profix_fine' => $profix_fine,
|
||||
'year' => date('Y'),
|
||||
'month' => intval(date('m')),
|
||||
'c_time' => time()
|
||||
];
|
||||
if($money_json['price_car']>$b_row_one['price_floor']){
|
||||
$add_data['oflow_profix_car'] = $money_json['price_car'] - $b_row_one['price_floor'];
|
||||
}
|
||||
$this->biz_settle_model->add($add_data);
|
||||
}
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ class CusorderV2 extends Wxapp{
|
||||
$delry_time && $data['delry_time'] = $delry_time;
|
||||
$finance_row && $data['finance_id'] = $finance_row['id'];
|
||||
$data['if_fine'] = $if_fine ? 1:0;
|
||||
$fines && $data['fines'] = json_encode($fines,JSON_UNESCAPED_UNICODE);
|
||||
$data['fines'] = json_encode($fines,JSON_UNESCAPED_UNICODE);
|
||||
|
||||
$color_arr = json_decode($business_row['colors'],true);
|
||||
//获取金额json数据
|
||||
@@ -449,8 +449,8 @@ class CusorderV2 extends Wxapp{
|
||||
}
|
||||
}
|
||||
$data['srv_ids'] = $srv_arr ? json_encode($srv_arr,JSON_UNESCAPED_UNICODE) : "";
|
||||
$money_json['price_fine_select'] = 0;
|
||||
if($fines){
|
||||
$money_json['price_fine_select'] = 0;
|
||||
foreach ($fines as $item) {
|
||||
if($item['price']){
|
||||
$money_json['price_fine_select'] += floatval($item['price']);
|
||||
@@ -514,8 +514,8 @@ class CusorderV2 extends Wxapp{
|
||||
foreach($srv_data['list'] as $val){
|
||||
$car_data['委托代办']['list'][$val['title']] = is_numeric($val['money']) ? sprintf("%.2f",$val['money']):'';
|
||||
}
|
||||
if($row['fines']){
|
||||
$fines = json_decode($row['fines'],true);
|
||||
$fines = json_decode($row['fines'],true);
|
||||
if($fines){
|
||||
$fines_list = [];
|
||||
foreach ($fines as $item) {
|
||||
$fines_list['list'][$item['txt']] = $item['price'] ? sprintf("%.2f",$item['price']) : '';
|
||||
|
||||
@@ -23,6 +23,7 @@ class Fine extends Wxapp{
|
||||
}
|
||||
|
||||
protected function get(){
|
||||
$limbiz = $this->input_param('limbiz');
|
||||
$page = $this->input_param('page');
|
||||
$size = $this->input_param('size');
|
||||
!$page && $page = 1;
|
||||
@@ -31,6 +32,8 @@ class Fine extends Wxapp{
|
||||
$where = [
|
||||
'status' => 1
|
||||
];
|
||||
$biz_id = $this->get_biz_id();
|
||||
$limbiz && $where['biz_id'] = $biz_id;
|
||||
$count = $this->receiver_fine_model->count($where);
|
||||
$list = $this->receiver_fine_model->select($where,'id desc',$page,$size,'id,title,price');
|
||||
$data = [
|
||||
|
||||
@@ -208,7 +208,8 @@ class Orders_v2_entity{
|
||||
'money' => $fine_price
|
||||
];
|
||||
}
|
||||
if($this->order_row['fines']){
|
||||
$fines = json_decode($this->order_row['fines'],true);
|
||||
if($fines){
|
||||
$price_fine_select = $money_json['price_fine_select'] ? $money_json['price_fine_select'] : 0;
|
||||
$list[] = [
|
||||
'title' => '精品选装',
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Biz_settle_srv_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_biz_settle_srv';
|
||||
private $status_ary = [-1 => '删除' , 0 => '禁用', 1 => '正常'];
|
||||
private $type_ary = [
|
||||
1 => '挂牌', 2=>'保险' , 3=> '按揭'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
* @param $status
|
||||
* @return string|string[]
|
||||
*/
|
||||
public function get_status($status){
|
||||
if(strlen($status)){
|
||||
return $this->status_ary[$status];
|
||||
}else{
|
||||
return $this->status_ary;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
* @param $type
|
||||
* @return string|string[]
|
||||
*/
|
||||
public function get_type($type){
|
||||
if(strlen($type)){
|
||||
return $this->type_ary[$type];
|
||||
}else{
|
||||
return $this->type_ary;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* type = 1 (price结算价)
|
||||
* type = 2 (type 保险类型[1商业险 2交强险] rebate 返点 s_time 开始时间 e_time 结束时间)
|
||||
* @param $type
|
||||
* @param $jsondata
|
||||
* @return array
|
||||
*/
|
||||
public function get_jsondata($type,$jsondata){
|
||||
$jsondata = json_decode($jsondata,true);
|
||||
$res = [];
|
||||
if($jsondata){
|
||||
switch ($type){
|
||||
case 1:
|
||||
$res['结算价'] = $jsondata['price'];
|
||||
break;
|
||||
case 2:
|
||||
$res['返点'] = $jsondata['rebate'];
|
||||
$res['保险类型'] = $jsondata['type'] ==1 ? '商业险' : '交强险';
|
||||
$res['时间区间'] = $jsondata['s_time']&&$jsondata['e_time'] ? date('Y-m-d',$jsondata['s_time'])."到".date('Y-m-d',$jsondata['e_time']) : "";
|
||||
break;
|
||||
case 3:
|
||||
$res['返点'] = $jsondata['rebate'];
|
||||
$res['产品'] = $jsondata['finance_title'];
|
||||
$res['期数'] = $jsondata['finance_num'];
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,23 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class Receiver_fine_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_receiver_fine';
|
||||
private $status_ary = [-1 => '删除' , 0 => '禁用', 1 => '正常'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
* @param $status
|
||||
* @return string|string[]
|
||||
*/
|
||||
public function get_status($status){
|
||||
if(strlen($status)){
|
||||
return $this->status_ary[$status];
|
||||
}else{
|
||||
return $this->status_ary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user