diff --git a/application/admin/controller/OrderMain.php b/application/admin/controller/OrderMain.php index b76383c..d6f4c3b 100755 --- a/application/admin/controller/OrderMain.php +++ b/application/admin/controller/OrderMain.php @@ -3,6 +3,7 @@ namespace app\admin\controller; use app\admin\dao\GroupDao; +use app\admin\dao\OrderMainDao; use app\admin\dao\OrderMemoDao; use app\admin\model\Area; use app\admin\service\OrderMainService; @@ -19,7 +20,7 @@ use think\Loader; */ class OrderMain extends Backend { - protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain","addMemo","getMemoList"]; + protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain","addMemo","getMemoList","setHotFlag"]; /** * OrderMain模型对象 * @var \app\admin\model\OrderMain @@ -157,4 +158,14 @@ class OrderMain extends Backend return json($result); } + /** + * 添加日志记录 + * @return \think\response\Json + */ + public function setHotFlag(){ + $params=$this->request->post(); + $model = new OrderMainDao(); + $result = $model->setHotFlag($params["order_id"],$params["val"]); + return json($result); + } } diff --git a/application/admin/dao/OrderHotelDao.php b/application/admin/dao/OrderHotelDao.php index c61d5de..8e5ff59 100644 --- a/application/admin/dao/OrderHotelDao.php +++ b/application/admin/dao/OrderHotelDao.php @@ -333,7 +333,7 @@ class OrderHotelDao public function getOrderListByOrderIds($orderIds){ $subOrderModel = new OrderHotel(); try { - $subOrderList = $subOrderModel->where(["order_id" => ["in",$orderIds], "del_flag" => 0])->select()->toArray(); + $subOrderList = $subOrderModel->where(["order_id" => ["in",$orderIds], "del_flag" => 0])->order("id","DESC")->select()->toArray(); if (null == $subOrderList) { return []; } diff --git a/application/admin/dao/OrderItemDao.php b/application/admin/dao/OrderItemDao.php index 15971fe..e56c4ef 100644 --- a/application/admin/dao/OrderItemDao.php +++ b/application/admin/dao/OrderItemDao.php @@ -284,7 +284,7 @@ class OrderItemDao public function getOrderListByOrderIds($orderIds){ $subOrderModel = new OrderItem(); try { - $subOrderList = $subOrderModel->where(["order_id" => ["in",$orderIds], "del_flag" => 0])->select()->toArray(); + $subOrderList = $subOrderModel->where(["order_id" => ["in",$orderIds], "del_flag" => 0])->order("id","DESC")->select()->toArray(); if (null == $subOrderList) { return []; } diff --git a/application/admin/dao/OrderMainDao.php b/application/admin/dao/OrderMainDao.php index 647c7c6..b1b7e8e 100644 --- a/application/admin/dao/OrderMainDao.php +++ b/application/admin/dao/OrderMainDao.php @@ -359,11 +359,29 @@ class OrderMainDao left join hbp_order_item c on c.order_id = a.id and c.del_flag=0 where {$where} GROUP BY a.id - order by a.id desc + order by a.hot_seq desc,a.id desc limit {$limit} offset {$offset} "; $list = Db::query($sqlList); $result = ["list"=>$list,"total"=>$totalRe[0]['cnt']]; return Util::returnArrSu("",$result); } + + /** + * 设置星标 + * @param $params + * @return array + */ + public function setHotFlag($order_id,$val) { + try{ + $data = [ + "hot_seq"=>$val + ]; + $model = new OrderMain(); + $model->save($data,["id"=>$order_id]); + return Util::returnArrSu(); + }catch (Exception $e){ + return Util::returnArrEr("将主订单从收款单下移除失败".$e->getMessage()); + } + } } \ No newline at end of file diff --git a/application/admin/view/order_main/index.html b/application/admin/view/order_main/index.html index 5c7faf9..fc7021c 100755 --- a/application/admin/view/order_main/index.html +++ b/application/admin/view/order_main/index.html @@ -152,6 +152,12 @@ + + + @@ -653,6 +659,24 @@ this.showMemo = true this.addMemo.order_id = order_id; this.getMemoList(); + }, + setHotSeq(index,val){ + let info = this.tableData[index] + let param = { + order_id:info["id"], + val:val + } + axios.post("/hotel.php/order_main/setHotFlag", param).then((response) => { + let data = response.data; + if (data.flag) { + this.tableData[index].hot_seq=val + this.$message.success("设置成功"); + } else { + this.$message.error(response.msg); + } + }).catch(function (error) { + console.log(error); + }); } } })