Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     $orderModel = new \Loan\Model\OrderModel();
     $this->_type = $orderModel->getType();
     $this->_status = $orderModel->getStatus();
 }
 public function __construct()
 {
     parent::__construct();
     $orderModel = new \Loan\Model\OrderModel();
     $this->_field_text_map['order_type'] = $this->_order_type = $orderModel->getType();
     $this->_field_text_map['status'] = $this->_status = $orderModel->getStatus();
 }
 protected function _detail($uid)
 {
     $model = M()->table('zj_user_red_packet r')->join('zj_user u on u.uid=r.uid');
     $user = $model->where(['r.uid' => $uid])->find() or $this->error('找不到此用户信息!');
     $this->assign('user', $user);
     // 未完成记录
     $orderModel = new \Loan\Model\OrderModel();
     $model = M()->table('zj_loan_order_red_packet r')->join('zj_loan_order o on o.id=r.order_id');
     $order = $model->field('r.*,o.status order_status')->where(['r.uid' => $uid])->order('r.created desc')->select();
     int_to_string($order, ['order_status' => $orderModel->getStatus(), 'status' => ['0' => '待完成', '1' => '已完成', '2' => '已关闭']]);
     $this->assign('_order', $order);
     // 红包记录
     $log = M('user_red_packet_log')->where(['uid' => $uid])->order('created desc')->select();
     int_to_string($log, ['action' => ['1' => '订单完成', '2' => '提现']]);
     $this->assign('_log', $log);
     // 提现记录
     $withdraw = M('user_red_packet_withdraw')->where(['uid' => $uid])->order('created desc')->select();
     int_to_string($withdraw, ['status' => ['0' => '待审核', '1' => '审核通过', '2' => '已关闭']]);
     $this->assign('_withdraw', $withdraw);
     $this->meta_title = '红包详情';
     $this->display('detail');
 }
Exemplo n.º 4
0
 public function detail()
 {
     $orderModel = new \Loan\Model\OrderModel();
     // 商家类型
     $where = ['id' => I('id')];
     if ($this->_salesman['type_id'] == 3) {
         $where['_string'] = ' id in (select order_id from zj_loan_order_salesman where uid=' . $this->_user['uid'] . ') ';
     }
     $order = $orderModel->where($where)->find() or $this->error('找不到此订单信息!');
     int_to_string($order, ['type' => $orderModel->getType(), 'status' => $orderModel->getStatus()]);
     // 检查订单用户认证状态
     $where = ['uid' => $order['uid']];
     if (M('loan_user')->where($where)->count()) {
         $user_auth_text = '个人认证(已通过)';
     } else {
         $contract_status = M('loan_user_contract')->where($where)->getField('status');
         if ($contract_status === null) {
             $user_auth_text = '个人认证(未提交资料)';
         } elseif ($contract_status == 0) {
             // 检查提交资料是否完善
             $user_auth = M('loan_user_contract_auth')->where($where)->getField('auth_id', true);
             if ($user_auth) {
                 $auth_config = M('loan_config_auth')->where('type=1 and status=1 and is_required=1')->getField('id', true);
                 foreach ($auth_config as $key => $id) {
                     if (in_array($id, $user_auth)) {
                         unset($auth_config[$key]);
                     }
                 }
                 if ($auth_config) {
                     $user_auth_text = '个人认证(待完善资料)';
                 } else {
                     $user_auth_text = '个人认证(等待审核)';
                 }
             } else {
                 $user_auth_text = '个人认证(未提交资料)';
             }
         } elseif ($contract_status == 2) {
             $user_auth_text = '个人认证(审核不通过)';
         }
     }
     $this->assign('user_auth_text', $user_auth_text);
     // 检查订单签约状态
     $where = ['order_id' => $order['id']];
     $order_auth = M('loan_order_auth')->where($where)->getField('auth_id', true);
     if ($order_auth) {
         $auth_config = M('loan_config_auth')->where('type=2 and status=1 and is_required=1')->getField('id', true);
         if ($auth_config) {
             foreach ($auth_config as $key => $id) {
                 if (in_array($id, $order_auth)) {
                     unset($auth_config[$key]);
                 }
             }
             $order_auth_text = '订单签约(待完善资料)';
         } else {
             $order_auth_text = '订单签约(等待审核)';
         }
     } else {
         $order_auth_text = '订单签约(未提交资料)';
     }
     $this->assign('order_auth_text', $order_auth_text);
     // 验证特派的状态
     $order_salesman = M('loan_order_salesman')->where(['order_id' => $order['id']])->find();
     if ($order_salesman) {
         $order_salesman['uname'] = get_user($order_salesman['uid'])['uname'];
     }
     $this->assign('order_salesman', $order_salesman);
     $this->assign('order_salesman_status', $order_salesman ? $order_salesman['status'] : -1);
     // 是否允许转派给别人
     $this->assign('allow_special_salesman', $order['type'] == 2 && (!$order_salesman || $order_salesman['uid'] == $this->_user['uid']));
     // 是否允许关闭
     $this->assign('allowClose', false);
     $this->assign('order', $order);
     $this->assign('orderModel', $orderModel);
     $this->display();
 }
 public function _excel()
 {
     $where = $this->_getWhere();
     $model = M()->table('zj_loan_order_salesman s')->join('zj_loan_order o on o.id=s.order_id');
     $model->join('zj_user u on u.uid=s.uid');
     $model->join('zj_university_campus c on c.id=o.campus_id');
     $fields = 's.*,o.seller_name,o.realname order_realname,o.created,o.status,o.loan_money,o.type,o.title,o.realname,o.seller_name,u.realname,u.mobile,c.city,c.university_name,c.name campus_name';
     $list = $model->where($where)->order('lend_time')->field($fields)->select();
     $orderModel = new \Loan\Model\OrderModel();
     int_to_string($list, ['type' => $orderModel->getType(), 'status' => $orderModel->getStatus()]);
     foreach ($list as $key => $vo) {
         $list[$key]['created'] = time_format($vo['created']);
         $list[$key]['lend_time'] = time_format($vo['lend_time']);
     }
     excel('业绩数据', $list, ['城市' => 'city', '类型' => 'type_text', '学校' => 'university_name', '校区' => 'campus_name', '订单号' => 'order_id', '放款时间' => 'lend_time', '下单时间' => 'created', '学生姓名' => 'order_realname', '订单标题' => 'title', '订单状态' => 'status_text', '贷款金额' => 'loan_money', '业务员姓名' => 'realname', '业务员手机号' => 'mobile', '商家店名' => 'seller_name']);
 }
Exemplo n.º 6
0
 public function repay()
 {
     $this->meta_title = '还款记录';
     $where = $where_created = [];
     $start = I('get.start', date('Y-m-01', strtotime('-1 month')));
     if ($start) {
         $where_created[] = ['egt', strtotime($start . ' 00:00:00')];
     }
     $end = I('get.end');
     if ($end) {
         $where_created[] = ['elt', strtotime($end . ' 23:59:59')];
     }
     if ($where_created) {
         $where['p.created'] = $where_created;
     }
     $realname = I('get.realname');
     if ($realname) {
         $where['o.realname'] = $realname;
     }
     // 初始化搜索
     $status = I('get.status', -1, 'intval');
     if ($status >= 0) {
         $where['_string'] = $status > 0 ? 'b.status=2' : 'b.status<>2';
     }
     $_status = ['-1' => '所有状态', '0' => '还款中', '1' => '已还款'];
     $this->assign('_status', $_status);
     $this->assign('_status_name', $_status[$status]);
     $model = M()->table('zj_loan_bill_pay p')->join('zj_loan_bill b on b.order_id=p.order_id and b.issue=p.issue')->join('zj_loan_order o on o.id=b.order_id')->field('o.title,o.type,p.created,p.money,o.realname,p.issue,b.money_principal,b.money_fee,b.money_delay,b.money_total,b.return_money,b.return_limit_time,b.status bill_status')->where($where);
     $_model = clone $model;
     $page = new \Think\Page($_model->count(), 20, (array) I('request.'));
     I('get.export') || $model->limit($page->firstRow . ',' . $page->listRows);
     $list = $model->order('created DESC')->select();
     $orderModel = new \Loan\Model\OrderModel();
     int_to_string($list, ['type' => $orderModel->getStatus()]);
     $this->assign('_page', $page->show());
     $this->assign('start', $start);
     $this->assign('list', $list);
     if (I('get.export')) {
         $end = $end ?: date('Y-m-d');
         if ($realname) {
             $realname .= '的';
         }
         $this->exportAsExcel("{$start} 至 {$end} {$realname}还款记录({$_status[$status]}).xlsx", $list);
     } else {
         $this->display();
     }
 }