@@ -3,6 +3,7 @@ | |||
namespace app\admin\controller; | |||
use app\admin\dao\GroupDao; | |||
use app\admin\dao\OrderMemoDao; | |||
use app\admin\model\Area; | |||
use app\admin\service\OrderMainService; | |||
use app\common\controller\Backend; | |||
@@ -18,7 +19,7 @@ use think\Loader; | |||
*/ | |||
class OrderMain extends Backend | |||
{ | |||
protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain"]; | |||
protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain","addMemo","getMemoList"]; | |||
/** | |||
* OrderMain模型对象 | |||
* @var \app\admin\model\OrderMain | |||
@@ -133,4 +134,27 @@ class OrderMain extends Backend | |||
return json($result); | |||
} | |||
/** | |||
* 添加日志记录 | |||
* @return \think\response\Json | |||
*/ | |||
public function addMemo(){ | |||
$params=$this->request->post(); | |||
$params['create_id']=$this->auth->id; | |||
$orderMemoDao = new OrderMemoDao(); | |||
$result = $orderMemoDao->save($params); | |||
return json($result); | |||
} | |||
/** | |||
* 添加日志记录 | |||
* @return \think\response\Json | |||
*/ | |||
public function getMemoList(){ | |||
$params=$this->request->post(); | |||
$orderMemoDao = new OrderMemoDao(); | |||
$result = $orderMemoDao->getListByWhere($params); | |||
return json($result); | |||
} | |||
} |
@@ -0,0 +1,70 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/10/27 | |||
* Time: 11:26 | |||
*/ | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
use app\admin\model\Admin; | |||
use app\admin\model\OrderHotel; | |||
use app\admin\model\OrderItem; | |||
use app\admin\model\OrderMain; | |||
use app\admin\model\OrderMemo; | |||
use think\Db; | |||
use think\Exception; | |||
class OrderMemoDao | |||
{ | |||
/** | |||
* 添加日志 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param) { | |||
try{ | |||
$data = [ | |||
"order_id"=>$param["order_id"], | |||
"memo"=>$param["memo"], | |||
"create_id"=>empty($param['create_id'])?0:$param['create_id'], | |||
"create_name"=>"" | |||
]; | |||
if (!empty($param['create_id'])) { | |||
$adminDao = new AdminDao(); | |||
$admin = $adminDao->getInfoById($param['create_id']); | |||
if ($admin["flag"]) { | |||
$data["create_name"] = $admin["data"]["nickname"]; | |||
} | |||
} | |||
$orderMemo = new OrderMemo(); | |||
$id = $orderMemo->insertGetId($data); | |||
return Util::returnArrSu("", $id); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("新增失败:".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取订单列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getListByWhere($param){ | |||
try { | |||
$offset = ($param['pageNum'] - 1) * $param['pageSize']; | |||
$model = new OrderMemo(); | |||
$count = $model->where(["order_id"=>$param['order_id']])->count(); | |||
$list = $model->where(["order_id"=>$param['order_id']])->limit($offset,$param['pageSize'])->order("id","DESC")->select(); | |||
return Util::returnArrSu("", ["total" => $count, "list" => $list->toArray()]); | |||
}catch (Exception $e){ | |||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
<?php | |||
namespace app\admin\model; | |||
use think\Model; | |||
class OrderMemo extends Model | |||
{ | |||
// 表名 | |||
protected $name = 'order_memo'; | |||
} |
@@ -253,11 +253,14 @@ | |||
</el-popover> | |||
</template> | |||
</el-table-column> | |||
<el-table-column label="操作" min-width="70"> | |||
<el-table-column label="操作" min-width="140"> | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" @click="edit(scope.row.id)" icon="el-icon-edit">编辑</el-button> | |||
</el-button-group> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" @click="showMemoInfo(scope.row.id)" icon="el-icon-edit">备注</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
@@ -284,6 +287,24 @@ | |||
<iframe :src="editPageShowUrl" frameborder="0" width="99%" id="editPageShow" onload="this.height=100"></iframe> | |||
</el-dialog> | |||
</transition> | |||
<transition name="bounce" v-if="showMemo"> | |||
<el-dialog :title="'订单备注 : '+addMemo.order_id" :visible.sync="showMemo" width="90%" height="100%" top="15px"> | |||
<div class="header-search" style="width: 90%;margin: 10px"> | |||
<el-input | |||
type="textarea" | |||
:rows="2" | |||
placeholder="请输入内容" | |||
v-model="addMemo.memo"> | |||
</el-input> | |||
<el-button type="primary" style="margin-top: 10px" @click="saveMemo(1)">+新增</el-button> | |||
</div> | |||
<el-table ref="multipleTable" :data="memoList" border tooltip-effect="dark" style="font-size:12px;width: 100%;margin: 12px"> | |||
<el-table-column prop="create_time" label="时间" min-width="30" ></el-table-column> | |||
<el-table-column prop="create_name" label="用户" min-width="30" ></el-table-column> | |||
<el-table-column prop="memo" label="备注" ></el-table-column> | |||
</el-table> | |||
</el-dialog> | |||
</transition> | |||
</div> | |||
</body> | |||
<!-- import Vue before Element --> | |||
@@ -405,6 +426,12 @@ | |||
} | |||
}] | |||
}, | |||
addMemo: { | |||
"order_id":"", | |||
"memo":"" | |||
}, | |||
memoList:[], | |||
showMemo:false | |||
} | |||
}, | |||
created() { | |||
@@ -587,6 +614,46 @@ | |||
console.log(error); | |||
}); | |||
}, | |||
//獲取列表 | |||
saveMemo() { | |||
if (this.addMemo.memo == "") { | |||
this.$message.error("请输入备注内容");return false; | |||
} | |||
axios.post("/hotel.php/order_main/addMemo", this.addMemo).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message.success("添加成功"); | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
//獲取列表 | |||
getMemoList() { | |||
let param = { | |||
pageNum:1, | |||
pageSize:1000, | |||
order_id:this.addMemo.order_id | |||
} | |||
axios.post("/hotel.php/order_main/getMemoList", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.memoList = data.data.list; | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
showMemoInfo(order_id){ | |||
this.showMemo = true | |||
this.addMemo.order_id = order_id; | |||
this.getMemoList(); | |||
} | |||
} | |||
}) | |||
</script> | |||