123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace app\order\controller;
- use library\Controller;
- use think\Db;
- /**
- * 兑换订单管理
- * Class IntegralOrder
- * @package app\order\controller
- */
- class ExchangeOrder extends Controller
- {
- protected $table = 'ExchangeOrder';
- /**
- * 订单列表
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOExceptio
- */
- public function index()
- {
- $this->title = '兑换订单管理';
- $this->order_status = ['待支付','已支付/待发货','已发货/待收货','已收货'];
- $query = $this->_query($this->table);
- $where = [];
- $where[] = ['o.is_deleted','=',0];
- $where[] = ['o.cancel_state','=',0];
- 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')];
- $query->alias('o')
- ->field('o.* , u.name as u_name ,u.phone as u_phone')
- ->join('store_member u',' o.user_id = u.id ','LEFT');
- if(!empty($where)) $query->where($where);
- $query ->order('o.id desc')->page();
- }
- /**
- * 订单详情
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOExceptio
- */
- public function detail()
- {
- $this->title = '兑换订单详情';
- $order_id = input('id');
- $detail = Db::name('exchange_order o')
- ->field('o.* , u.name as user_name ,u.phone')
- ->join('store_member u',' o.user_id = u.id ','LEFT')
- ->where('o.id',$order_id)
- ->find();
- $this->assign('detail',$detail);
- $this->fetch('detail');
- }
- /**
- * 订单发货
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOExceptio
- */
- public function deliver()
- {
- $this->title = '发货';
- $this->express_company = Db::name('express_company')->field('id,express_title,express_code')->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::name('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;
- $data['status'] = 2;
- }
- }
- }
|