1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace app\order\controller;
- use library\Controller;
- use think\Db;
- /**
- * 元石充值订单管理
- * Class CrystalOrder
- * @package app\order\controller
- */
- class CrystalOrder extends Controller
- {
- protected $table = 'CrystalOrder';
- /**
- * 充值订单
- * @auth true
- * @menu true
- */
- public function index()
- {
- $this->title = '充值订单';
- $this->order_status = ['待支付','已支付'];
- $order_stat = Db::table('crystal_order')
- ->where('status',1)
- ->field('price_total')
- ->select();
- $this->order_num = empty($order_stat) ? 0: count($order_stat);
- $this->total_money = empty($order_stat) ? 0: array_sum(array_column($order_stat,'price_total'));
- $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').'%'];
- $where[]= ['o.status','=',1];
- $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('crystal_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
- * @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;
- }
- }
- }
|