Files
liche/common/models/receiver/order/Receiver_orders_model.php
T
2021-10-21 17:51:23 +08:00

117 lines
4.4 KiB
PHP

<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/07/09
* Time: 13:47
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_orders_model extends HD_Model
{
private $table_name = 'lc_receiver_orders';
private $status_arr = [0 => '合同签订', 1 => '办理分期', 2 => '车辆分配', 3 => '申请开票', 4 => '代办服务', 5 => '交付确认', 6 => '完成交付', 7 => '申请退款'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* Notes:订单状态
* Created on: 2021/9/15 10:25
* Created by: dengbw
* @param $status
* @return array
*/
public function statusAry($status = '')
{
$status_ary[0] = array('name' => '合同签订', 'show' => true, 'list' => array(2 => '已付定金', 1 => '已签合同', 0 => '未签合同'),
'menu_list' => array(2 => '已付定金',1 => '已签合同', 0 => '未签合同'), 'menu_default' => 2);
$status_ary[1] = array('name' => '分期办理', 'show' => true, 'list' => array(0 => '审核中', 1 => '已通过', 2 => '已放款'),
'menu_list' => array(0 => '审核中', 1 => '已通过', 2 => '等待放款', 3 => '按揭完成'), 'menu_default' => 0);
$status_ary[2] = array('name' => '车辆分配', 'show' => true, 'list' => array(0 => '车辆分配中', 1 => '用户未签名', 2 => '尾款未支付', 3 => '已确定'),
'menu_list' => array(0 => '车辆分配中', 1 => '用户未签名', 2 => '尾款未支付'), 'menu_default' => 0);
$status_ary[3] = array('name' => '开票相关', 'show' => true, 'list' => array(0 => '未开票', 1 => '已开票'),
'menu_list' => array(0 => '未开票'), 'menu_default' => 0);
$status_ary[4] = array('name' => '代办服务', 'show' => true, 'list' => array(0 => '代办中', 1 => '已完成代办'),
'menu_list' => array(0 => '代办中'), 'menu_default' => 0);
$status_ary[5] = array('name' => '交付车辆', 'show' => true, 'list' => array(0 => '待用户确认', 1 => '用户已确认', 2 => '销售已确认'),
'menu_list' => array(0 => '待用户确认', 1 => '用户已确认', 2 => '销售已确认'), 'menu_default' => 0);
$status_ary[6] = array('name' => '交易完成', 'show' => true, 'list' => array(), 'menu_list' => array());
$status_ary[7] = array('name' => '退款', 'show' => true, 'list' => array(), 'menu_list' => array());
if (strlen($status)) {
$return_status = $status_ary[$status];
} else {
$return_status = $status_ary;
}
return $return_status;
}
public function get_step($mobile)
{
$t1 = 'lc_receiver_orders';
//$t2 = 'lc_receiver_order_contracts';
$this->db->select("$t1.*");
$this->db->from($t1);
//$this->db->join($t2, "$t2.o_id = $t1.id and $t2.type=3",'left');
//$where = [
// "$t1.mobile" => $mobile,
// "($t2.status<1 or $t2.status is null)" => null
//];
$where = [
"$t1.mobile" => $mobile,
"$t1.status<" => 6,
"$t1.status>=" => 0
];
$this->db->where($where);
$this->db->order_by("$t1.id desc");
$this->db->limit(1);
$row = $this->db->get()->row_array();
return $row;
}
//获取交车列表
public function get_finsh($mobile, $page, $size, $count)
{
$t1 = 'lc_receiver_orders';
//$t2 = 'lc_receiver_order_contracts';
$this->db->select("$t1.*");
$this->db->from($t1);
//$this->db->join($t2, "$t2.o_id = $t1.id and $t2.type=3",'left');
//$where = [
// "$t1.mobile" => $mobile,
// "$t2.status" => 1,
//];
$where = [
"$t1.mobile" => $mobile,
"$t1.status" => 6,
];
$this->db->where($where);
if ($count) {
return $this->db->count_all_results();
}
$this->db->order_by("$t1.id desc");
if ($page) {
$offset = ($page - 1) * $size;
$limit = $size;
} else {
$offset = null;
$limit = null;
}
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
public function get_status()
{
return $this->status_arr;
}
}