144 lines
4.4 KiB
PHP
144 lines
4.4 KiB
PHP
<?php
|
|
/**
|
|
* Notes:订单管理
|
|
* Created on: 2019/12/12 13:46
|
|
* Created by: dengbw
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
Class Purchase extends HD_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('app/app_model');
|
|
$this->load->model('apporder/order_purchase_model');
|
|
|
|
$this->load->service('apporder/order_service');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return $this->lists();
|
|
}
|
|
|
|
public function lists()
|
|
{
|
|
$params = $this->input->get();
|
|
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
|
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
|
|
|
$searchAry = array(
|
|
'sid' => '订单号',
|
|
'uname' => '买家姓名',
|
|
'mobile' => '买家手机号',
|
|
'item_title' => '标题',
|
|
'app_uid' => '用户ID'
|
|
);
|
|
|
|
$statusAry = $this->order_service->statusAry();
|
|
$statusDAry = $this->order_service->statusDetailAry();
|
|
$paywayAry = $this->order_service->paywayAry();
|
|
|
|
$where = array('app_id' => $params['app_id']);
|
|
|
|
if($params['search_v']){
|
|
switch($params['search_k']){
|
|
case 'uname':
|
|
case 'mobile':
|
|
case 'item_title':
|
|
$where["{$params['search_k']} like '%{$params['search_v']}%'"] = null;
|
|
break;
|
|
default:
|
|
$where[$params['search_k']] = $params['search_v'];
|
|
}
|
|
}
|
|
!$params['search_k'] && $params['search_k'] = 'sid';
|
|
|
|
if($params['status']){
|
|
$where['status'] = $params['status'];
|
|
} else {
|
|
$params['status'] = '';
|
|
}
|
|
|
|
if($params['status_detail']){
|
|
$where['status_detail'] = $params['status_detail'];
|
|
} else{
|
|
$params['status_detail'] = '';
|
|
}
|
|
|
|
if ($params['time']) {
|
|
$time = explode(' ~ ', $params['time']);
|
|
$time[0] && $where["c_time >="] = strtotime($time[0] . ' 00:00:00');
|
|
$time[1] && $where["c_time <="] = strtotime($time[1] . ' 23:59:59');
|
|
}
|
|
|
|
if (strlen($params['payway']) > 0) {
|
|
$where['payway'] = $params['payway'];
|
|
} else {
|
|
$params['payway'] = '';
|
|
}
|
|
|
|
$total = $this->order_purchase_model->count($where);
|
|
|
|
$lists = array();
|
|
if($total){
|
|
$orderby = 'id desc';
|
|
$select = 'id,sid,item_title,item_num,item_price,total_price,pay_price,
|
|
uname,mobile,payway,status,status_detail,c_time';
|
|
$rows = $this->order_purchase_model->select($where, $orderby, $params['page'], $params['size'], $select);
|
|
foreach($rows as $v){
|
|
$lists[] = array(
|
|
'id' => $v['id'],
|
|
'sid' => $v['sid'],
|
|
'uname' => $v['uname'],
|
|
'mobile' => $v['mobile'],
|
|
'title' => $v['item_title'],
|
|
'c_time' => date('Y-m-d H:i:s', $v['c_time']),
|
|
'item_price_name' => "¥{$v['item_price']}*{$v['item_num']}",
|
|
'pay_price_name' => "¥{$v['pay_price']}",
|
|
'status_name' => $statusDAry[$v['status']][$v['status_detail']],
|
|
'payway_name' => $paywayAry[$v['payway']],
|
|
);
|
|
}
|
|
}
|
|
|
|
$this->data['_title'] = '消费订单管理';
|
|
$this->data['searchAry'] = $searchAry;
|
|
$this->data['statusAry'] = $statusAry;
|
|
$this->data['statusDAry'] = $statusDAry;
|
|
$this->data['paywayAry'] = $paywayAry;
|
|
$this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
|
$this->data['lists'] = $lists;
|
|
$this->data['params'] = $params;
|
|
return $this->show_view('/order/purchase/lists', true);
|
|
}
|
|
|
|
public function get(){
|
|
// TODO: Implement get() method.
|
|
}
|
|
|
|
public function add(){
|
|
// TODO: Implement add() method.
|
|
}
|
|
|
|
public function edit(){
|
|
// TODO: Implement edit() method.
|
|
}
|
|
|
|
public function del(){
|
|
// TODO: Implement del() method.
|
|
}
|
|
|
|
public function batch(){
|
|
// TODO: Implement batch() method.
|
|
}
|
|
|
|
public function export(){
|
|
// TODO: Implement export() method.
|
|
}
|
|
|
|
|
|
}
|