123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace app\order\controller;
- use library\Controller;
- use think\Db;
- /**
- * 订单管理
- * Class Order
- * @package app\order\controller
- */
- class Order extends Controller
- {
- protected $table = 'StoreOrder';
- /**
- * 订单列表
- * @auth true
- * @menu true
- */
- public function index()
- {
- $this->title = '线上商城订单管理';
- $this->order_status = ['待支付','已支付/待发货','已发货/待收货','已收货','已评论','','','','','已取消'];
- $query = $this->_query($this->table);
- $where = [];
- if($this->request->request('tel'))$where[]= ['u.phone','like','%'.$this->request->request('tel').'%'];
- if($this->request->request('user_name'))$where[]= ['u.name','like','%'.$this->request->request('user_name').'%'];
- if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.$this->request->request('order_no').'%'];
- if($this->request->request('order_status') > -1) $where[]= ['o.status','=',$this->request->request('order_status')];
- $where[] =['source','=',0] ;
- $query->alias('o')
- ->field('o.* , u.name as user_name ,u.phone')
- ->join('store_member u',' o.uid = u.id ','LEFT');
- if(!empty($where)) $query->where($where);
- $query ->order('o.id desc')->page();
- }
- /**
- * 订单详情
- * @auth true
- * @menu true
- */
- public function detail()
- {
- $this->title = '订单详情';
- $order_id = input('id');
- $detail = Db::table('store_order o')
- ->field('o.* , u.name as user_name ,u.phone')
- ->join('store_member u',' o.uid = u.id ','LEFT')
- ->where('o.id',$order_id)
- ->find();
- $this->assign('detail',$detail);
- $this->fetch('detail');
- }
- /**
- * 订单发货
- * @auth true
- * @menu true
- */
- public function deliver()
- {
- $this->title = '发货';
- $this->express_company = Db::table('store_express_company')->field('id,express_title')->select();
- $this->_form($this->table,'deliver');
- }
- /**
- * 表单数据处理
- * @auth true
- * @menu true
- * @param array $data
- */
- protected function _form_filter(&$data)
- {
- if ($this->request->isPost() && $this->request->action() == 'deliver') {
- $express_company = Db::table('store_express_company')->field('id,express_title')->find($data['express_company_id']);
- $data['express_company_title'] = $express_company['express_title'] ? $express_company['express_title'] : '';
- $data['express_send_at'] = date("Y-m-d H:i:s");
- $data['express_state'] = 1;
- }
- }
- }
|