@@ -3,6 +3,7 @@ | |||||
namespace app\admin\controller; | namespace app\admin\controller; | ||||
use app\admin\dao\GroupDao; | use app\admin\dao\GroupDao; | ||||
use app\admin\dao\OrderMainDao; | |||||
use app\admin\dao\OrderMemoDao; | use app\admin\dao\OrderMemoDao; | ||||
use app\admin\model\Area; | use app\admin\model\Area; | ||||
use app\admin\service\OrderMainService; | use app\admin\service\OrderMainService; | ||||
@@ -19,7 +20,7 @@ use think\Loader; | |||||
*/ | */ | ||||
class OrderMain extends Backend | 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模型对象 | * OrderMain模型对象 | ||||
* @var \app\admin\model\OrderMain | * @var \app\admin\model\OrderMain | ||||
@@ -157,4 +158,14 @@ class OrderMain extends Backend | |||||
return json($result); | 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); | |||||
} | |||||
} | } |
@@ -333,7 +333,7 @@ class OrderHotelDao | |||||
public function getOrderListByOrderIds($orderIds){ | public function getOrderListByOrderIds($orderIds){ | ||||
$subOrderModel = new OrderHotel(); | $subOrderModel = new OrderHotel(); | ||||
try { | 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) { | if (null == $subOrderList) { | ||||
return []; | return []; | ||||
} | } | ||||
@@ -284,7 +284,7 @@ class OrderItemDao | |||||
public function getOrderListByOrderIds($orderIds){ | public function getOrderListByOrderIds($orderIds){ | ||||
$subOrderModel = new OrderItem(); | $subOrderModel = new OrderItem(); | ||||
try { | 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) { | if (null == $subOrderList) { | ||||
return []; | return []; | ||||
} | } | ||||
@@ -359,11 +359,29 @@ class OrderMainDao | |||||
left join hbp_order_item c on c.order_id = a.id and c.del_flag=0 | left join hbp_order_item c on c.order_id = a.id and c.del_flag=0 | ||||
where {$where} | where {$where} | ||||
GROUP BY a.id | GROUP BY a.id | ||||
order by a.id desc | |||||
order by a.hot_seq desc,a.id desc | |||||
limit {$limit} offset {$offset} | limit {$limit} offset {$offset} | ||||
"; | "; | ||||
$list = Db::query($sqlList); | $list = Db::query($sqlList); | ||||
$result = ["list"=>$list,"total"=>$totalRe[0]['cnt']]; | $result = ["list"=>$list,"total"=>$totalRe[0]['cnt']]; | ||||
return Util::returnArrSu("",$result); | 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()); | |||||
} | |||||
} | |||||
} | } |
@@ -152,6 +152,12 @@ | |||||
</div> | </div> | ||||
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | <el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | ||||
style="font-size:12px;width: 100%;margin-top: 12px"> | style="font-size:12px;width: 100%;margin-top: 12px"> | ||||
<el-table-column width="50"> | |||||
<template slot-scope="scope" > | |||||
<i class="el-icon-star-off" style="font-size: 18px" v-if="scope.row.hot_seq == 0" @click="setHotSeq(scope.$index,10)"></i> | |||||
<i class="el-icon-star-on" style="font-size:22px;color: red" v-if="scope.row.hot_seq > 0" @click="setHotSeq(scope.$index,0)"></i> | |||||
</template> | |||||
</el-table-column> | |||||
<el-table-column prop="id" label="订单ID" min-width="30" ></el-table-column> | <el-table-column prop="id" label="订单ID" min-width="30" ></el-table-column> | ||||
<el-table-column prop="commissioner" label="专员" min-width="40" ></el-table-column> | <el-table-column prop="commissioner" label="专员" min-width="40" ></el-table-column> | ||||
<el-table-column prop="channel_order_no" label="渠道" min-width="120" > | <el-table-column prop="channel_order_no" label="渠道" min-width="120" > | ||||
@@ -653,6 +659,24 @@ | |||||
this.showMemo = true | this.showMemo = true | ||||
this.addMemo.order_id = order_id; | this.addMemo.order_id = order_id; | ||||
this.getMemoList(); | 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); | |||||
}); | |||||
} | } | ||||
} | } | ||||
}) | }) | ||||