diff --git a/admin/controllers/app/liche/Main.php b/admin/controllers/app/liche/Main.php index b9528932..b57c6a5f 100644 --- a/admin/controllers/app/liche/Main.php +++ b/admin/controllers/app/liche/Main.php @@ -63,6 +63,18 @@ class Main extends HD_Controller //array('name' => '查看详情', 'url' => '/sys/company?app_id=' . $this->app_id), ), ); + + //消费订单 + $this->load->model('apporder/order_purchase_model'); + $value = $this->order_purchase_model->count(array('app_id' => $this->app_id)); + $list[] = array( + 'title' => '消费订单(笔)', + 'value' => $value, + 'btns' => array( + array('name' => '查看详情', 'url' => '/order/purchase?app_id=' . $this->app_id), + ), + ); + $conditions[] = array('icon' => 'am-icon-home', 'list' => $list); /*小程序设置 end*/ diff --git a/admin/controllers/order/Purchase.php b/admin/controllers/order/Purchase.php new file mode 100644 index 00000000..62096e18 --- /dev/null +++ b/admin/controllers/order/Purchase.php @@ -0,0 +1,143 @@ +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. + } + + +} diff --git a/admin/views/order/purchase/lists.php b/admin/views/order/purchase/lists.php new file mode 100644 index 00000000..3c8b6dc4 --- /dev/null +++ b/admin/views/order/purchase/lists.php @@ -0,0 +1,187 @@ +