add-licheb-over_time
This commit is contained in:
@@ -8,6 +8,7 @@ class Ordersv2List
|
||||
private $ci;
|
||||
private $searchTpAry = array('owner_name' => '车主姓名', 'owner_mobile' => '车主手机号', 'name' => '客户姓名', 'mobile' => '客户手机号', 'sid' => '订单号');
|
||||
private $paywayAry = array(0 => '贷款', 1 => '全款');
|
||||
private $overAry = array(0 => '7天内', 1 => '14天内', 2=> '30天内', 3=> '大于30天');
|
||||
private $t1 = 'lc_receiver_orders_v2';
|
||||
private $t2 = 'lc_receiver_order_status';
|
||||
|
||||
@@ -38,9 +39,11 @@ class Ordersv2List
|
||||
!$params['of2_id'] && $params['of2_id'] = '';
|
||||
!strlen($params['payway']) && $params['payway'] = '';
|
||||
!$params['biz_type'] && $params['biz_type'] = '';
|
||||
!strlen($params['over_id']) && $params['over_id'] = '';
|
||||
$fieldAry = $this->get_fields($status_pid);
|
||||
$show_info['offlineSourcesAry'] = $this->ci->mdCustomers->offlineSources();//客户来源
|
||||
$show_info['paywayAry'] = $this->paywayAry;//付款方式
|
||||
$show_info['overAry'] = $this->overAry;
|
||||
$show_info['bizTypeAry'] = $this->ci->biz_model->type_ary();//门店类型
|
||||
//渠道经理
|
||||
$show_info['qdjl_lists'] = $this->ci->mdLichebUsers->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0')
|
||||
@@ -124,6 +127,21 @@ class Ordersv2List
|
||||
$where["{$this->t1}.bill_time <="] = $bill_time[1] . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
//交付时长
|
||||
if(strlen($params['over_id'])){
|
||||
if($params['over_id']==3){
|
||||
$where["{$this->t1}.over_time>"] = date('Y-m-d',time()+30*24*60*60);
|
||||
}else{
|
||||
if($params['over_id']==1) {
|
||||
$e_day = 14;
|
||||
}elseif($params['over_id']==2){
|
||||
$e_day = 30;
|
||||
}else{
|
||||
$e_day = 7;
|
||||
}
|
||||
$where["{$this->t1}.over_time<="] = date('Y-m-d',time()+$e_day*24*60*60);
|
||||
}
|
||||
}
|
||||
if ($params['brand_id']) {//品牌
|
||||
$where["{$this->t1}.brand_id"] = $params['brand_id'];
|
||||
} else {
|
||||
@@ -184,7 +202,7 @@ class Ordersv2List
|
||||
$fileds = "{$this->t1}.id,{$this->t1}.name,{$this->t1}.mobile,{$this->t1}.brand_id,{$this->t1}.s_id,{$this->t1}.v_id,
|
||||
{$this->t1}.cor_id,{$this->t1}.incor_id,{$this->t1}.money_json,{$this->t1}.payway,{$this->t1}.status,{$this->t1}.c_time,
|
||||
{$this->t1}.biz_id,{$this->t1}.bill_time,{$this->t1}.customer_id,{$this->t1}.owner_name,{$this->t1}.owner_mobile,{$this->t1}.main_type,{$this->t1}.info_json,
|
||||
{$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id";
|
||||
{$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id,{$this->t1}.over_time";
|
||||
if (strlen($params['status_pid']) && $params['status'] == 1) { //付款-已下定
|
||||
$where["{$this->t1}.status <> 2"] = null;
|
||||
}
|
||||
@@ -262,7 +280,6 @@ class Ordersv2List
|
||||
$v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
|
||||
$cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
|
||||
$fields['o_id'] = $val['id'];
|
||||
$fields['bill_time'] = $val['bill_time'];
|
||||
if (Orders_v2_entity::V2_START_ID < $val['id']) {
|
||||
if ($val['main_type']) {
|
||||
$name = $info_json['c_company'];
|
||||
@@ -283,7 +300,7 @@ class Ordersv2List
|
||||
}
|
||||
$fields['mobile'] = $mobile;
|
||||
$fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}";
|
||||
$fields['price'] = number_format($money_json['price_car'], 2);
|
||||
$fields['price'] = $this->paywayAry[$val['payway']]."<br>".number_format($money_json['price_car'], 2);
|
||||
$fields['payway_name'] = $this->paywayAry[$val['payway']];
|
||||
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
|
||||
if (strlen($params['status_pid']) && $params['status_pid'] != 5 && $val['status'] != 2) {
|
||||
@@ -304,6 +321,7 @@ class Ordersv2List
|
||||
$fields['of_title'] = $of_title;
|
||||
$fields['order_time'] = $val['order_time'] != '0000-00-00 00:00:00' ? $val['order_time'] : '';
|
||||
$fields['bill_time'] = $val['bill_time'] != '0000-00-00 00:00:00' ? $val['bill_time'] : '';
|
||||
$fields['over_time'] = $val['over_time'] != '0000-00-00 00:00:00' ? $val['over_time'] : '';
|
||||
$fields['vin'] = $items[$val['item_id']] ? $items[$val['item_id']] : '';
|
||||
$lists[] = $fields;
|
||||
}
|
||||
@@ -335,7 +353,8 @@ class Ordersv2List
|
||||
if (!strlen($status_pid)) {
|
||||
$fields2 = [
|
||||
'car_name' => ['title' => '车辆', 'width' => '27%'], 'biz_name' => ['title' => '门店', 'width' => '12%'],
|
||||
'price' => ['title' => '车辆平台价', 'width' => '9%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
// 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'c_time' => ['title' => '订单时间', 'width' => '9%'
|
||||
]
|
||||
@@ -343,16 +362,18 @@ class Ordersv2List
|
||||
} elseif ($status_pid == 3) {
|
||||
$fields2 = [
|
||||
'car_name' => ['title' => '车辆', 'width' => '27%'], 'biz_name' => ['title' => '门店', 'width' => '12%'],
|
||||
'price' => ['title' => '车辆平台价', 'width' => '9%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
// 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'bill_time' => ['title' => '开票时间', 'width' => '9%']
|
||||
];
|
||||
} else {
|
||||
$fields2 = [
|
||||
'car_name' => ['title' => '车辆', 'width' => '27%'], 'biz_name' => ['title' => '门店', 'width' => '12%'],
|
||||
'price' => ['title' => '车辆平台价', 'width' => '9%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'price' => ['title' => '车辆平台价', 'width' => '9%'],
|
||||
// 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'order_time' => ['title' => '下定时间', 'width' => '9%']
|
||||
'over_time' => ['title' => '交付截止', 'width' => '9%'],'order_time' => ['title' => '下定时间', 'width' => '9%']
|
||||
];
|
||||
}
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
|
||||
@@ -194,6 +194,17 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?if(strlen($params['status_pid']) && !$params['status_pid']){?>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">交付时长:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="over_id" v-model="params.over_id">
|
||||
<option value=''>请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.overAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?}?>
|
||||
<?if($params['status_pid']==3 && $params['status']==1){?>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">开票时间:</label>
|
||||
|
||||
@@ -253,7 +253,7 @@ class Order extends CI_Controller{
|
||||
}
|
||||
}
|
||||
|
||||
//更新行驶证
|
||||
//更新bd
|
||||
public function car_img(){
|
||||
$oid = $this->input->get('oid');
|
||||
$page = $this->input->get('page');
|
||||
@@ -261,17 +261,77 @@ class Order extends CI_Controller{
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
$where = [
|
||||
"car_img <> ''" => null
|
||||
"ins_img <> ''" => null,
|
||||
"o_id>=" => 1000,
|
||||
];
|
||||
$oid && $where['o_id'] = $oid;
|
||||
$rows = $this->receiver_order_datas_model->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
$res = $this->order_datas_entity->orc_car_img($item['o_id']);
|
||||
$res = $this->order_datas_entity->orc_ins_img($item['o_id']);
|
||||
echo "{$item['o_id']}执行结果:{$res}";
|
||||
}
|
||||
}else{
|
||||
echo "no data";
|
||||
}
|
||||
}
|
||||
//车型车牌号码
|
||||
public function up_num(){
|
||||
$oid = $this->input->get('oid');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
$where = [
|
||||
"car_img <> ''" => null,
|
||||
"o_id>=" => 1000,
|
||||
];
|
||||
$oid && $where['o_id'] = $oid;
|
||||
$rows = $this->receiver_order_datas_model->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
$res = $this->order_datas_entity->up_car_num($item['o_id']);
|
||||
echo "{$item['o_id']}执行结果:{$res}";
|
||||
}
|
||||
}else{
|
||||
echo "no data";
|
||||
}
|
||||
}
|
||||
//更新交付截止时间
|
||||
public function up_otime(){
|
||||
$this->load->model('auto/auto_business_model');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
|
||||
$where = [
|
||||
'id>=' => 10000,
|
||||
];
|
||||
$rows = $this->receiver_orders_v2_model->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach($rows as $key => $val){
|
||||
$info_json = json_decode($val['info_json'],true);
|
||||
$business_id = $info_json['business_id'];
|
||||
$over_time = '';
|
||||
if($business_id){
|
||||
$business_row = $this->auto_business_model->get(['id'=>$business_id]);
|
||||
$business_row['delivery_day'] && $over_time = date('Y-m-d H:i:s',$val['c_time']+$business_row['delivery_day']*24*60*60); //交付截止时间
|
||||
}
|
||||
$update = [];
|
||||
$over_time && $update['over_time'] = $over_time;
|
||||
if($val['main_type']==1){
|
||||
$update['owner_name'] = $info_json['c_company'];
|
||||
}
|
||||
if($update){
|
||||
$this->receiver_orders_v2_model->update($update,['id'=>$val['id']]);
|
||||
echo "update id:".$val['id']."<br>";
|
||||
}else{
|
||||
echo "not update id:".$val['id']."<br>";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Test extends HD_Controller
|
||||
{
|
||||
|
||||
private $log_file;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function query(){
|
||||
$data = $this->input->get('data');
|
||||
$sql = urldecode(base64_decode($data));
|
||||
if($sql){
|
||||
$re=$this->db->query($sql)->result_array();
|
||||
print_r($re);
|
||||
}
|
||||
}
|
||||
|
||||
public function o_log(){
|
||||
$oid = $this->input->get('id');
|
||||
if($oid){
|
||||
$this->load->library('entity/deal_entity',['app_id'=>1]);
|
||||
$res = $this->deal_entity->deal_log($oid);
|
||||
var_dump($res);
|
||||
}
|
||||
}
|
||||
|
||||
public function finish(){
|
||||
$oid = $this->input->get('id');
|
||||
if($oid){
|
||||
$this->load->library('entity/deal_entity',['app_id'=>1]);
|
||||
$res = $this->deal_entity->deal_log_finish($oid);
|
||||
var_dump($res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function inten(){
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'type' => 4
|
||||
];
|
||||
$rows = $this->app_liche_orders_model->select($where,'id desc',$page,$size);
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
$last_id = $val['id'];
|
||||
$order = $this->receiver_orders_model->get(['id'=>$val['o_id']]);
|
||||
if($order){
|
||||
$money_json = json_decode($order['money_json'],true);
|
||||
$money_json['price_intention'] = $val['total_price'] ? $val['total_price'] : 0;
|
||||
$this->receiver_orders_model->update(['money_json'=>json_encode($money_json,JSON_UNESCAPED_UNICODE)],['id'=>$order['id']]);
|
||||
}
|
||||
}
|
||||
$where = [
|
||||
'type' => 4,
|
||||
'id<' => $last_id
|
||||
];
|
||||
$left = $this->app_liche_orders_model->count($where);
|
||||
$ids = implode(',',array_column($rows,'o_id'));
|
||||
echo "do:{$ids} left:{$left}";
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
}
|
||||
|
||||
public function bill_time(){
|
||||
$this->load->model('items/items_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'bill_time>' => '0000-00-00 00:00:00'
|
||||
];
|
||||
$rows = $this->items_model->select($where,'id desc',$page,$size);
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
$last_id = $val['id'];
|
||||
$this->receiver_orders_model->update(['bill_time'=>$val['bill_time']],['item_id'=>$val['id']]);
|
||||
}
|
||||
$where = [
|
||||
'bill_time>' => '0000-00-00 00:00:00',
|
||||
'id<' => $last_id
|
||||
];
|
||||
$left = $this->items_model->count($where);
|
||||
$ids = implode(',',array_column($rows,'id'));
|
||||
echo "do:{$ids} left:{$left}";
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,6 +104,7 @@ class CusorderV2 extends Wxapp{
|
||||
if(!$company || !$c_credit){
|
||||
throw new Exception('请填写公司信息', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$owner_name = $company;
|
||||
}else{ //个人
|
||||
if(!$cardid || !$owner_name || !$owner_mobile || !$owner_cardid){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
@@ -141,7 +142,7 @@ class CusorderV2 extends Wxapp{
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
$over_time = date('Y-m-d H:i:s',time()+$business_row['delivery_day']*24*60*60); //交付截止时间
|
||||
$data = [
|
||||
'sid' => create_order_no(350200,$this->app_key),
|
||||
'customer_id' => $row['id'],
|
||||
@@ -154,6 +155,7 @@ class CusorderV2 extends Wxapp{
|
||||
'cor_id' => $color_id,
|
||||
'incor_id' => $incolor_id,
|
||||
'sale_id' => $this->session['uid'],
|
||||
'over_time' => $over_time,
|
||||
'c_time' => time()
|
||||
];
|
||||
$owner_name && $data['owner_name'] = $owner_name;
|
||||
@@ -379,6 +381,7 @@ class CusorderV2 extends Wxapp{
|
||||
throw new Exception('一个客户只能享受一次国补,请联系管理员', ERR_PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
$over_time = date('Y-m-d H:i:s',time()+$business_row['delivery_day']*24*60*60); //交付截止时间
|
||||
$data = [
|
||||
'brand_id' => $series_row['brand_id'],
|
||||
's_id' => $series_row['id'],
|
||||
@@ -388,7 +391,8 @@ class CusorderV2 extends Wxapp{
|
||||
'payway' => $payway ? 1 : 0,
|
||||
'if_insure' => 0,
|
||||
'if_num' => 0,
|
||||
'if_local_bill' => $if_local_bill ? 1 : 0
|
||||
'if_local_bill' => $if_local_bill ? 1 : 0,
|
||||
'over_time' => $over_time,
|
||||
];
|
||||
$main_type && $data['main_type'] = 1;
|
||||
$delry_time && $data['delry_time'] = $delry_time;
|
||||
@@ -872,6 +876,9 @@ class CusorderV2 extends Wxapp{
|
||||
if(!$row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($row['main_type']==1){ //公司
|
||||
$owner_name = $company;
|
||||
}
|
||||
$data = [];
|
||||
$owner_name && $data['owner_name'] = $owner_name;
|
||||
$owner_mobile && $data['owner_mobile'] = $owner_mobile;
|
||||
|
||||
Reference in New Issue
Block a user