@@ -2,6 +2,7 @@ | |||||
namespace app\admin\controller; | namespace app\admin\controller; | ||||
use app\admin\dao\CfRoomPlanDao; | |||||
use app\admin\dao\GroupDao; | use app\admin\dao\GroupDao; | ||||
use app\admin\model\Area; | use app\admin\model\Area; | ||||
use app\common\controller\Backend; | use app\common\controller\Backend; | ||||
@@ -16,7 +17,7 @@ use think\exception\ValidateException; | |||||
*/ | */ | ||||
class CfRoomPlan extends Backend | class CfRoomPlan extends Backend | ||||
{ | { | ||||
protected $noNeedRight = ['getList']; | |||||
protected $noNeedRight = ['getList',"list","save","delAll"]; | |||||
/** | /** | ||||
* CfRoomPlan模型对象 | * CfRoomPlan模型对象 | ||||
* @var \app\admin\model\CfRoomPlan | * @var \app\admin\model\CfRoomPlan | ||||
@@ -73,143 +74,40 @@ class CfRoomPlan extends Backend | |||||
} | } | ||||
/** | /** | ||||
* 查看 | |||||
* 获取列表 | |||||
* @return \think\response\Json | |||||
*/ | */ | ||||
public function index() | |||||
{ | |||||
//设置过滤方法 | |||||
$this->request->filter(['strip_tags', 'trim']); | |||||
if ($this->request->isAjax()) { | |||||
//如果发送的来源是Selectpage,则转发到Selectpage | |||||
if ($this->request->request('keyField')) { | |||||
return $this->selectpage(); | |||||
} | |||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | |||||
$groupDao = new GroupDao(); | |||||
$group_id = $groupDao->getTopGroup($this->auth->getGroupId()); | |||||
$list = $this->model | |||||
->alias("a") | |||||
->join('hbp_admin','a.purchase_user_id = hbp_admin.id','left') | |||||
->join('hbp_cf_room_info e','a.room_id = e.id','left') | |||||
->join('hbp_cf_hotel_info f','a.hotel_id = f.id','left') | |||||
->field("a.*,hbp_admin.nickname,e.room_name,f.hotel_name") | |||||
->where($where); | |||||
$list = $list | |||||
->where("a.group_id","=",$group_id) | |||||
->order($sort, $order) | |||||
->paginate($limit); | |||||
$result = $list->items(); | |||||
foreach ($result as $k=>$item){ | |||||
$result[$k]["continuity_type"]=$this->continuity_type[$item["continuity_type"]]; | |||||
$result[$k]["hbp_admin.nickname"] = $item["nickname"]; | |||||
} | |||||
$result = array("total" => $list->total(), "rows" => $result); | |||||
return json($result); | |||||
} | |||||
return $this->view->fetch(); | |||||
public function list(){ | |||||
$params=$this->request->post(); | |||||
$params['create_id']=$this->auth->id; | |||||
$groupDao = new GroupDao(); | |||||
$params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); | |||||
$service = new CfRoomPlanDao(); | |||||
return json($service->getList($params)); | |||||
} | } | ||||
/** | /** | ||||
* 添加 | |||||
* 保存记录 | |||||
* @return \think\response\Json | |||||
*/ | */ | ||||
public function add() | |||||
{ | |||||
if ($this->request->isPost()) { | |||||
$params = $this->request->post("row/a"); | |||||
if ($params) { | |||||
$params = $this->preExcludeFields($params); | |||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | |||||
$params[$this->dataLimitField] = $this->auth->id; | |||||
} | |||||
$result = false; | |||||
Db::startTrans(); | |||||
try { | |||||
//是否采用模型验证 | |||||
if ($this->modelValidate) { | |||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); | |||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; | |||||
$this->model->validateFailException(true)->validate($validate); | |||||
} | |||||
$groupDao = new GroupDao(); | |||||
$params['create_id']=$this->auth->id; | |||||
$params['group_id']=$groupDao->getTopGroup($this->auth->getGroupId()); | |||||
$result = $this->model->allowField(true)->save($params); | |||||
Db::commit(); | |||||
} catch (ValidateException $e) { | |||||
Db::rollback(); | |||||
$this->error($e->getMessage()); | |||||
} catch (PDOException $e) { | |||||
Db::rollback(); | |||||
$this->error($e->getMessage()); | |||||
} catch (Exception $e) { | |||||
Db::rollback(); | |||||
$this->error($e->getMessage()); | |||||
} | |||||
if ($result !== false) { | |||||
$this->success(); | |||||
} else { | |||||
$this->error(__('No rows were inserted')); | |||||
} | |||||
} | |||||
$this->error(__('Parameter %s can not be empty', '')); | |||||
} | |||||
$this->view->assign("continuity_type", $this->continuity_type); | |||||
return $this->view->fetch(); | |||||
public function save(){ | |||||
$params=$this->request->post(); | |||||
$params['create_id']=$this->auth->id; | |||||
$groupDao = new GroupDao(); | |||||
$params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); | |||||
$service = new CfRoomPlanDao(); | |||||
return json($service->save($params)); | |||||
} | } | ||||
/** | /** | ||||
* 编辑 | |||||
* 删除 | |||||
* @return \think\response\Json | |||||
*/ | */ | ||||
public function edit($ids = null) | |||||
{ | |||||
$row = $this->model->get($ids); | |||||
if (!$row) { | |||||
$this->error(__('No Results were found')); | |||||
} | |||||
$adminIds = $this->getDataLimitAdminIds(); | |||||
if (is_array($adminIds)) { | |||||
if (!in_array($row[$this->dataLimitField], $adminIds)) { | |||||
$this->error(__('You have no permission')); | |||||
} | |||||
} | |||||
if ($this->request->isPost()) { | |||||
$params = $this->request->post("row/a"); | |||||
if ($params) { | |||||
$params = $this->preExcludeFields($params); | |||||
$result = false; | |||||
Db::startTrans(); | |||||
try { | |||||
//是否采用模型验证 | |||||
if ($this->modelValidate) { | |||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); | |||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; | |||||
$row->validateFailException(true)->validate($validate); | |||||
} | |||||
$result = $row->allowField(true)->save($params); | |||||
Db::commit(); | |||||
} catch (ValidateException $e) { | |||||
Db::rollback(); | |||||
$this->error($e->getMessage()); | |||||
} catch (PDOException $e) { | |||||
Db::rollback(); | |||||
$this->error($e->getMessage()); | |||||
} catch (Exception $e) { | |||||
Db::rollback(); | |||||
$this->error($e->getMessage()); | |||||
} | |||||
if ($result !== false) { | |||||
$this->success(); | |||||
} else { | |||||
$this->error(__('No rows were updated')); | |||||
} | |||||
} | |||||
$this->error(__('Parameter %s can not be empty', '')); | |||||
} | |||||
$this->view->assign("continuity_type", $this->continuity_type); | |||||
$this->view->assign("row", $row); | |||||
return $this->view->fetch(); | |||||
public function delAll(){ | |||||
$params=$this->request->post(); | |||||
$service = new CfRoomPlanDao(); | |||||
return json($service->del($params)); | |||||
} | } | ||||
} | } |
@@ -128,12 +128,13 @@ class CfSuplierInfo extends Backend | |||||
$this->model->field('id,supplier_name as name'); | $this->model->field('id,supplier_name as name'); | ||||
$groupDao = new GroupDao(); | $groupDao = new GroupDao(); | ||||
$group_id = $groupDao->getTopGroup($this->auth->getGroupId()); | $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); | ||||
$where = ["group_id"=>$group_id]; | |||||
if($keyValue){ | if($keyValue){ | ||||
$this->model->where(['id'=>$keyValue,"group_id"=>$group_id]); | |||||
$where = ['id'=>$keyValue,"group_id"=>$group_id]; | |||||
}elseif($name){ | }elseif($name){ | ||||
$this->model->where(['supplier_name'=>['like','%'.$name.'%'],"group_id"=>$group_id]); | |||||
$where = ['supplier_name'=>['like','%'.$name.'%'],"group_id"=>$group_id]; | |||||
} | } | ||||
$result= $this->model->select(); | |||||
$result= $this->model->where($where)->select(); | |||||
if($keyValue){ | if($keyValue){ | ||||
return json(['list' => $result]); | return json(['list' => $result]); | ||||
} | } | ||||
@@ -0,0 +1,107 @@ | |||||
<?php | |||||
/** | |||||
* Created by PhpStorm. | |||||
* User: nizongfeng | |||||
* Date: 2021/11/30 | |||||
* Time: 19:01 | |||||
*/ | |||||
namespace app\admin\dao; | |||||
use app\admin\command\Util; | |||||
use app\admin\model\CfRoomPlan; | |||||
class CfRoomPlanDao | |||||
{ | |||||
/** | |||||
* 添加记录 | |||||
* @param $param | |||||
* @return array | |||||
*/ | |||||
public function save($param) | |||||
{ | |||||
try { | |||||
$data = [ | |||||
'hotel_id' => $param['hotel_id'], | |||||
'room_id' => $param['room_id'], | |||||
'plan_name' => $param['plan_name'], | |||||
'breakfast_num' => $param['breakfast_num'], | |||||
'book_end_day' => $param['book_end_day'], | |||||
'book_end_hour' => $param['book_end_hour'], | |||||
'continuity_type' => $param['continuity_type'], | |||||
"coutinuity_day"=>$param['coutinuity_day'], | |||||
'plan_memo' => $param['plan_memo'], | |||||
'purchase_user_id' => $param['purchase_user_id'] | |||||
]; | |||||
$model = new CfRoomPlan(); | |||||
if (empty($param['id'])) { | |||||
$data['create_id'] = $param['create_id']; | |||||
$data['group_id'] = $param['group_id']; | |||||
$id = $model->insertGetId($data); | |||||
return Util::returnArrSu("", $id); | |||||
} else { | |||||
$model->save($data, ['id' => $param['id']]); | |||||
return Util::returnArrSu("", $param['id']); | |||||
} | |||||
} catch (\Exception $e) { | |||||
return Util::returnArrEr("更新记录失败:" . $e->getMessage()); | |||||
} | |||||
} | |||||
/** | |||||
* 获取列表 | |||||
* @param $param | |||||
* @return array | |||||
*/ | |||||
public function getList($param) | |||||
{ | |||||
try { | |||||
$where = ["del_flag"=>0]; | |||||
if (!empty($param['hotel_id'])) { | |||||
$where["hotel_id"] = $param['hotel_id']; | |||||
} | |||||
if (!empty($param['room_id'])) { | |||||
$where["room_id"] = $param['room_id']; | |||||
} | |||||
if (!empty($param['plan_name'])) { | |||||
$where["plan_name"] = ["like","%".$param['plan_name']."%"]; | |||||
} | |||||
if (!empty($param['purchase_user_id'])) { | |||||
$where["purchase_user_id"] = $param['purchase_user_id']; | |||||
} | |||||
if (!empty($param['id'])) { | |||||
$where['id'] = $param['id']; | |||||
} | |||||
if (!empty($param['group_id'])) { | |||||
$where['group_id'] = $param['group_id']; | |||||
} | |||||
$offset = ($param['pageNum'] - 1) * $param['pageSize']; | |||||
$model = new CfRoomPlan(); | |||||
$total = $model->where($where)->count(); | |||||
$list = $model->where($where) | |||||
->limit($offset, $param['pageSize']) | |||||
->order("id","DESC")->select(); | |||||
$data = ["total" => $total, "list" => $list->toArray()]; | |||||
return Util::returnArrSu("", $data); | |||||
} catch (\Exception $e) { | |||||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||||
} | |||||
} | |||||
/** | |||||
* 删除 | |||||
* @param $id | |||||
* @return array | |||||
*/ | |||||
public function del($param){ | |||||
try { | |||||
//设置收购单状态 | |||||
$model = new CfRoomPlan(); | |||||
$model->save(['del_flag' =>1], ['id' => $param['id']]); | |||||
return Util::returnArrSu(); | |||||
} catch (\Exception $e) { | |||||
return Util::returnArrEr("修改状态失败" . $e->getMessage()); | |||||
} | |||||
} | |||||
} |
@@ -1,35 +1,458 @@ | |||||
<div class="panel panel-default panel-intro"> | |||||
{:build_heading()} | |||||
<div class="panel-body"> | |||||
<div id="myTabContent" class="tab-content"> | |||||
<div class="tab-pane fade active in" id="one"> | |||||
<div class="widget-body no-padding"> | |||||
<div id="toolbar" class="toolbar"> | |||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | |||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('cf_room_plan/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | |||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('cf_room_plan/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | |||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('cf_room_plan/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | |||||
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('cf_room_plan/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a> | |||||
<div class="dropdown btn-group {:$auth->check('cf_room_plan/multi')?'':'hide'}"> | |||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | |||||
<ul class="dropdown-menu text-left" role="menu"> | |||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | |||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | |||||
</ul> | |||||
</div> | |||||
</div> | |||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" | |||||
data-operate-edit="{:$auth->check('cf_room_plan/edit')}" | |||||
data-operate-del="{:$auth->check('cf_room_plan/del')}" | |||||
width="100%"> | |||||
</table> | |||||
</div> | |||||
</div> | |||||
<!DOCTYPE html> | |||||
<html> | |||||
<head> | |||||
<meta charset="UTF-8"> | |||||
<!-- import CSS --> | |||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> | |||||
</head> | |||||
<body> | |||||
<div id="app" class="table"> | |||||
<div> | |||||
<div class="header-search"> | |||||
<span>ID:</span> | |||||
<el-input v-model="search.id" style="width: 120px;" placeholder="请输入内容"></el-input> | |||||
<span>名称:</span> | |||||
<el-input v-model="search.plan_name" style="width: 120px;" placeholder="请输入内容"></el-input> | |||||
<span>酒店</span> | |||||
<el-select v-model="search.hotel_id" placeholder="请选择" style="width: 120px;" clearable> | |||||
<el-option | |||||
v-for="item in hotelList" | |||||
:key="item.id" | |||||
:label="item.name" | |||||
:value="item.id"> | |||||
</el-option> | |||||
</el-select> | |||||
<span>房型</span> | |||||
<el-select v-model="search.room_id" placeholder="请选择" style="width: 120px;" clearable> | |||||
<el-option | |||||
v-for="item in roomList" | |||||
:key="item.id" | |||||
:label="item.name" | |||||
:value="item.id"> | |||||
</el-option> | |||||
</el-select> | |||||
<span>采购负责人</span> | |||||
<el-select v-model="search.purchase_user_id" placeholder="请选择" style="width: 120px;" clearable> | |||||
<el-option | |||||
v-for="item in userList" | |||||
:key="item.id" | |||||
:label="item.name" | |||||
:value="item.id"> | |||||
</el-option> | |||||
</el-select> | |||||
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | |||||
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增</el-button> | |||||
</div> | </div> | ||||
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | |||||
style="font-size:12px;width: 100%;margin-top: 12px"> | |||||
<el-table-column prop="id" label="ID" min-width="50"></el-table-column> | |||||
<el-table-column prop="plan_name" label="名称" min-width="120"></el-table-column> | |||||
<el-table-column label="酒店" :formatter="getHotelName" min-width="180"></el-table-column> | |||||
<el-table-column label="房型" :formatter="getRoomName" min-width="180"></el-table-column> | |||||
<el-table-column prop="breakfast_num" label="早餐数量" min-width="60"></el-table-column> | |||||
<el-table-column prop="book_end_day" label="提前几天预定" min-width="60"></el-table-column> | |||||
<el-table-column prop="book_end_hour" label="几点前预定" min-width="60"></el-table-column> | |||||
<el-table-column prop="continuity_type" label="入住类型" :formatter="getTypeName" min-width="60"></el-table-column> | |||||
<el-table-column prop="coutinuity_day" label="连续入住天数" min-width="60"></el-table-column> | |||||
<el-table-column prop="plan_memo" label="方案说明" min-width="60"> | |||||
<template slot-scope="scope"> | |||||
<el-popover | |||||
placement="top-start" | |||||
title="" | |||||
width="200" | |||||
trigger="hover" | |||||
:content="scope.row.plan_memo"> | |||||
<div slot="reference" v-html="scope.row.plan_memo" style="overflow:hidden;white-space: nowrap;"></div> | |||||
</el-popover> | |||||
</template> | |||||
</el-table-column> | |||||
<el-table-column prop="purchase_user_id" label="采购负责人" :formatter="getPurchaseName" min-width="90"></el-table-column> | |||||
<el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column> | |||||
<el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column> | |||||
<el-table-column label="操作" min-width="180"> | |||||
<template slot-scope="scope"> | |||||
<el-button-group> | |||||
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button> | |||||
<el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button> | |||||
</el-button-group> | |||||
</template> | |||||
</el-table-column> | |||||
</el-table> | |||||
<el-pagination | |||||
:page-size="search.pageSize" | |||||
:pager-count="11" | |||||
layout="total, sizes, prev, pager, next, jumper" | |||||
:total="total" | |||||
:current-page="search.pageNum" | |||||
:page-sizes="[10, 20, 30, 40, 50]" | |||||
@size-change="sizeChange" | |||||
@current-change="getData" | |||||
@prev-click="getData" | |||||
@next-click="getData" | |||||
></el-pagination> | |||||
</div> | </div> | ||||
<transition name="bounce" v-if="editShow"> | |||||
<el-dialog title="详情" :visible.sync="editShow" width="90%" top="15px"> | |||||
<el-form ref="form" label-width="140px" style="width: 100%;padding-bottom: 20px"> | |||||
<el-form-item v-if="editType" label="ID:" style="width: 100%"> | |||||
<div v-html="editData.id"></div> | |||||
</el-form-item> | |||||
<el-form-item label="名称:" style="width: 100%"> | |||||
<el-input v-model="editData.plan_name" style="width: 280px;" placeholder="请输入内容"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="酒店:" style="width: 100%"> | |||||
<el-select v-model="editData.hotel_id" placeholder="请选择" style="width: 120px;" clearable> | |||||
<el-option | |||||
v-for="item in hotelList" | |||||
:key="item.id" | |||||
:label="item.name" | |||||
:value="item.id"> | |||||
</el-option> | |||||
</el-select> | |||||
</el-form-item> | |||||
<el-form-item label="房型:" style="width: 100%"> | |||||
<el-select v-model="editData.room_id" placeholder="请选择" style="width: 120px;" clearable> | |||||
<el-option | |||||
v-for="item in editRoomList" | |||||
:key="item.id" | |||||
:label="item.name" | |||||
:value="item.id"> | |||||
</el-option> | |||||
</el-select> | |||||
</el-form-item> | |||||
<el-form-item label="早餐数量:" style="width: 100%"> | |||||
<el-input v-model="editData.breakfast_num" style="width: 280px;" placeholder="请输入内容"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="提前预定天数:" style="width: 100%"> | |||||
<el-input v-model="editData.book_end_day" style="width: 280px;" placeholder="请输入内容"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="几点前预定:" style="width: 100%"> | |||||
<el-input v-model="editData.book_end_hour" style="width: 280px;" placeholder="请输入内容"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="连续入住类型:" style="width: 100%"> | |||||
<el-radio-group v-model="editData.continuity_type" size="small"> | |||||
<el-radio-button :label="0">无限制</el-radio-button> | |||||
<el-radio-button :label="1">连住几晚</el-radio-button> | |||||
<el-radio-button :label="2">连住几晚及以上</el-radio-button> | |||||
<el-radio-button :label="3">连住几晚及其倍数</el-radio-button> | |||||
</el-radio-group> | |||||
</el-form-item> | |||||
<el-form-item v-if="editData.continuity_type != 0" label="连续入住天数:" style="width: 100%"> | |||||
<el-input v-model="editData.coutinuity_day" style="width: 280px;" placeholder="请输入内容"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="采购负责人:" style="width: 100%"> | |||||
<el-select v-model="editData.purchase_user_id" placeholder="请选择" style="width: 120px;" clearable> | |||||
<el-option | |||||
v-for="item in userList" | |||||
:key="item.id" | |||||
:label="item.name" | |||||
:value="item.id"> | |||||
</el-option> | |||||
</el-select> | |||||
</el-form-item> | |||||
<el-form-item label="方案说明:" style="width: 100%"> | |||||
<el-input | |||||
type="textarea" | |||||
:rows="4" | |||||
placeholder="请输入内容" | |||||
v-model="editData.plan_memo"> | |||||
</el-input> | |||||
</el-form-item> | |||||
<el-form-item> | |||||
<el-button type="primary" @click="editDoing()" style="margin: 10px" > 保 存 </el-button> | |||||
</el-form-item> | |||||
</el-form> | |||||
</el-dialog> | |||||
</transition> | |||||
</div> | </div> | ||||
</body> | |||||
<!-- import Vue before Element --> | |||||
<script src="/assets/js/vue/vue.js"></script> | |||||
<!-- import JavaScript --> | |||||
<script src="/assets/js/vue/index.js"></script> | |||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |||||
<script> | |||||
new Vue({ | |||||
el: '#app', | |||||
data: function () { | |||||
return { | |||||
search: { | |||||
id:"", | |||||
hotel_id: "", | |||||
room_id: "", | |||||
purchase_user_id:"", | |||||
plan_name:"", | |||||
pageSize:10, | |||||
pageNum: 1 | |||||
}, | |||||
total: 0, | |||||
tableData: [], | |||||
editShow: false, | |||||
editType: false, | |||||
editData: { | |||||
}, | |||||
hotelList:[], | |||||
roomList:[], | |||||
editRoomList:[], | |||||
roomAllList:[], | |||||
userList: [], | |||||
//连续入住类型 0无限制 1连住几晚 2连住几晚及以上 3连住几晚及其倍数 | |||||
typeList:[ | |||||
{id:0,name:"无限制"}, | |||||
{id:1,name:"连住几晚"}, | |||||
{id:2,name:"连住几晚及以上"}, | |||||
{id:3,name:"连住几晚及其倍数"} | |||||
], | |||||
edit_city_set:2 | |||||
} | |||||
}, | |||||
created() { | |||||
this.getHotelList(); | |||||
this.getRoomAllList(); | |||||
this.getAdminUser(); | |||||
this.getData(1) | |||||
}, | |||||
watch: { | |||||
"search.hotel_id" : function (newVal,oldVal){ | |||||
this.roomList = [] | |||||
axios.post("/hotel.php/cf_room_info/getRoomList?hotelId="+newVal, {}).then((response) => { | |||||
let data = response.data; | |||||
this.roomList = data.list; | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
"editData.hotel_id" : function (newVal,oldVal){ | |||||
if (this.edit_city_set==2) { | |||||
this.editRoomList = [] | |||||
this.editData.room_id = "" | |||||
} | |||||
if (newVal == "") { | |||||
return false | |||||
} | |||||
axios.post("/hotel.php/cf_room_info/getRoomList?hotelId="+newVal, {}).then((response) => { | |||||
let data = response.data; | |||||
this.editRoomList = data.list; | |||||
this.edit_city_set++ | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
"editData.continuity_type" : function (newVal,oldVal) { | |||||
if (newVal == 0) { | |||||
this.editData.coutinuity_day = 0; | |||||
} | |||||
} | |||||
}, | |||||
methods: { | |||||
getPurchaseName(info) { | |||||
for (let i = 0; i < this.userList.length; i++) { | |||||
if (this.userList[i].id == info.purchase_user_id) { | |||||
return this.userList[i].name | |||||
} | |||||
} | |||||
return "-" | |||||
}, | |||||
getTypeName(info) { | |||||
for (let i = 0; i < this.typeList.length; i++) { | |||||
if (this.typeList[i].id == info.continuity_type) { | |||||
return this.typeList[i].name | |||||
} | |||||
} | |||||
return "-" | |||||
}, | |||||
getHotelName(info) { | |||||
for (let i = 0; i < this.hotelList.length; i++) { | |||||
if (this.hotelList[i].id == info.hotel_id) { | |||||
return this.hotelList[i].name | |||||
} | |||||
} | |||||
return "-" | |||||
}, | |||||
getRoomName(info) { | |||||
for (let i = 0; i < this.roomAllList.length; i++) { | |||||
if (this.roomAllList[i].id == info.room_id) { | |||||
return this.roomAllList[i].name | |||||
} | |||||
} | |||||
return "-" | |||||
}, | |||||
getRoomAllList(){ | |||||
axios.post("/hotel.php/cf_room_info/getList", this.search).then((response) => { | |||||
this.roomAllList = response.data.list; | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
getAdminUser() { | |||||
axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => { | |||||
this.userList = response.data.list; | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
getHotelList(){ | |||||
axios.post("/hotel.php/cf_hotel_info/getHotelList", {}).then((response) => { | |||||
let data = response.data; | |||||
this.hotelList = data.list; | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
sizeChange(pageSize) { | |||||
this.search.pageSize = pageSize; | |||||
this.getData(this.search.pageNum) | |||||
}, | |||||
//獲取列表 | |||||
getData(page) { | |||||
this.search.pageNum = page; | |||||
axios.post("/hotel.php/cf_room_plan/list", this.search).then((response) => { | |||||
let data = response.data; | |||||
if (data.flag) { | |||||
this.tableData = data.data.list; | |||||
this.total = data.data.total; | |||||
} else { | |||||
this.$message.error(response.msg); | |||||
} | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
edit(info) { | |||||
if (info == null) { | |||||
this.editType = false; | |||||
this.editData = { | |||||
hotel_id:"", | |||||
room_id:"", | |||||
plan_name:"", | |||||
breakfast_num:0, | |||||
book_end_day:0, | |||||
book_end_hour:0, | |||||
continuity_type:0, | |||||
coutinuity_day:0, | |||||
plan_memo:"", | |||||
purchase_user_id:"", | |||||
} | |||||
} else { | |||||
this.edit_city_set = 1; | |||||
this.editType = true; | |||||
this.editData = { | |||||
id:info.id, | |||||
hotel_id:info.hotel_id, | |||||
room_id:info.room_id, | |||||
plan_name:info.plan_name, | |||||
breakfast_num:info.breakfast_num, | |||||
book_end_day:info.book_end_day, | |||||
book_end_hour:info.book_end_hour, | |||||
continuity_type:info.continuity_type, | |||||
coutinuity_day:info.coutinuity_day, | |||||
plan_memo:info.plan_memo, | |||||
purchase_user_id:info.purchase_user_id, | |||||
} | |||||
} | |||||
this.editShow = true; | |||||
}, | |||||
editDoing(){ | |||||
if (this.editData.hotel_id==''){ | |||||
this.$message.error("请选择酒店");return false; | |||||
} | |||||
if (this.editData.room_id==''){ | |||||
this.$message.error("请选择房型");return false; | |||||
} | |||||
if (this.editData.plan_name==''){ | |||||
this.$message.error("名称不能为空");return false; | |||||
} | |||||
if (this.editData.breakfast_num===''){ | |||||
this.$message.error("早餐数量不能为空");return false; | |||||
} | |||||
if (this.editData.book_end_day===''){ | |||||
this.$message.error("提前几天预定不能为空");return false; | |||||
} | |||||
if (this.editData.book_end_hour===''){ | |||||
this.$message.error("几点前预定不能为空");return false; | |||||
} | |||||
if (this.editData.coutinuity_day===''){ | |||||
this.$message.error("连续入住天数不能为空");return false; | |||||
} | |||||
if (this.editData.purchase_user_id==''){ | |||||
this.$message.error("请选择采购负责人");return false; | |||||
} | |||||
axios.post("/hotel.php/cf_room_plan/save", this.editData).then( (response)=> { | |||||
let data = response.data; | |||||
console.log(this.tableData); | |||||
if (data.flag) { | |||||
this.$message({ | |||||
message: '保存成功!', | |||||
type: 'success' | |||||
}); | |||||
this.editShow = false; | |||||
this.getData(1); | |||||
} else { | |||||
this.$message.error(data.msg); | |||||
} | |||||
}).catch(function (error) { | |||||
this.$message.error("保存失败"); | |||||
console.log(error); | |||||
}); | |||||
}, | |||||
delAll(id){ | |||||
this.$confirm('确定删除?', '提示', { | |||||
confirmButtonText: '确定', | |||||
cancelButtonText: '取消', | |||||
type: 'warning' | |||||
}).then(() => { | |||||
let param = { | |||||
id: id | |||||
} | |||||
axios.post("/hotel.php/cf_room_plan/delAll", param).then((response) => { | |||||
let data = response.data; | |||||
if (data.flag) { | |||||
this.getData(this.search.pageNum) | |||||
this.$message.success("保存成功"); | |||||
} else { | |||||
this.$message.error(response.msg); | |||||
} | |||||
}).catch(function (error) { | |||||
console.log(error); | |||||
}); | |||||
}).catch(() => { | |||||
this.$message({ | |||||
type: 'info', | |||||
message: '已取消' | |||||
}); | |||||
this.getData(this.search.pageNum) | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
</script> | |||||
<style lang="scss" scoped> | |||||
.el-table thead { | |||||
background-color: #5a5e66 !important; | |||||
} | |||||
.header-search { | |||||
font-size: 14px; | |||||
font-weight: 900; | |||||
} | |||||
body { | |||||
background-color: white; | |||||
} | |||||
.table { | |||||
width: 100%; | |||||
font-size: 12px; | |||||
margin-top: 12px; | |||||
background-color: white; | |||||
} | |||||
.el-form-item{ | |||||
margin-bottom: 5px !important; | |||||
} | |||||
</style> | |||||
</html> |
@@ -72,6 +72,7 @@ | |||||
v-model="search.startTime" | v-model="search.startTime" | ||||
type="date" | type="date" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
~ | ~ | ||||
@@ -80,6 +81,7 @@ | |||||
v-model="search.endTime" | v-model="search.endTime" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
type="date" | type="date" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
</div> | </div> | ||||
@@ -115,6 +117,7 @@ | |||||
v-model="search.startInDate" | v-model="search.startInDate" | ||||
type="date" | type="date" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
~ | ~ | ||||
@@ -123,6 +126,7 @@ | |||||
v-model="search.endInDate" | v-model="search.endInDate" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
type="date" | type="date" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
<span>离店时间</span> | <span>离店时间</span> | ||||
@@ -131,6 +135,7 @@ | |||||
v-model="search.startOutDate" | v-model="search.startOutDate" | ||||
type="date" | type="date" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
~ | ~ | ||||
@@ -139,6 +144,7 @@ | |||||
v-model="search.endOutDate" | v-model="search.endOutDate" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
type="date" | type="date" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | <el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | ||||
@@ -376,7 +382,32 @@ | |||||
{"id": 2, 'value': "已付款"} | {"id": 2, 'value': "已付款"} | ||||
], | ], | ||||
type_list:[], | type_list:[], | ||||
supplierList:[] | |||||
supplierList:[], | |||||
pickerOptions: { | |||||
disabledDate(time) { | |||||
return time.getTime() > Date.now(); | |||||
}, | |||||
shortcuts: [{ | |||||
text: '今天', | |||||
onClick(picker) { | |||||
picker.$emit('pick', new Date()); | |||||
} | |||||
}, { | |||||
text: '昨天', | |||||
onClick(picker) { | |||||
const date = new Date(); | |||||
date.setTime(date.getTime() - 3600 * 1000 * 24); | |||||
picker.$emit('pick', date); | |||||
} | |||||
}, { | |||||
text: '一周前', | |||||
onClick(picker) { | |||||
const date = new Date(); | |||||
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); | |||||
picker.$emit('pick', date); | |||||
} | |||||
}] | |||||
}, | |||||
} | } | ||||
}, | }, | ||||
created() { | created() { | ||||
@@ -205,6 +205,7 @@ | |||||
v-model="orderMainListSearch.startTime" | v-model="orderMainListSearch.startTime" | ||||
type="date" | type="date" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
~ | ~ | ||||
@@ -213,6 +214,7 @@ | |||||
v-model="orderMainListSearch.endTime" | v-model="orderMainListSearch.endTime" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
type="date" | type="date" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
<el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button> | <el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button> | ||||
@@ -357,6 +359,31 @@ | |||||
hotelList:[], | hotelList:[], | ||||
itemList:[], | itemList:[], | ||||
type_list:[], | type_list:[], | ||||
pickerOptions: { | |||||
disabledDate(time) { | |||||
return time.getTime() > Date.now(); | |||||
}, | |||||
shortcuts: [{ | |||||
text: '今天', | |||||
onClick(picker) { | |||||
picker.$emit('pick', new Date()); | |||||
} | |||||
}, { | |||||
text: '昨天', | |||||
onClick(picker) { | |||||
const date = new Date(); | |||||
date.setTime(date.getTime() - 3600 * 1000 * 24); | |||||
picker.$emit('pick', date); | |||||
} | |||||
}, { | |||||
text: '一周前', | |||||
onClick(picker) { | |||||
const date = new Date(); | |||||
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); | |||||
picker.$emit('pick', date); | |||||
} | |||||
}] | |||||
}, | |||||
} | } | ||||
}, | }, | ||||
created() { | created() { | ||||
@@ -185,6 +185,7 @@ | |||||
v-model="orderMainListSearch.startTime" | v-model="orderMainListSearch.startTime" | ||||
type="date" | type="date" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
~ | ~ | ||||
@@ -193,6 +194,7 @@ | |||||
v-model="orderMainListSearch.endTime" | v-model="orderMainListSearch.endTime" | ||||
value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
type="date" | type="date" | ||||
:picker-options="pickerOptions" | |||||
placeholder="选择日期"> | placeholder="选择日期"> | ||||
</el-date-picker> | </el-date-picker> | ||||
<el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button> | <el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button> | ||||
@@ -315,7 +317,32 @@ | |||||
{id:11,name:"已取消"} | {id:11,name:"已取消"} | ||||
], | ], | ||||
channelList:[], | channelList:[], | ||||
multipleSelection: [] | |||||
multipleSelection: [], | |||||
pickerOptions: { | |||||
disabledDate(time) { | |||||
return time.getTime() > Date.now(); | |||||
}, | |||||
shortcuts: [{ | |||||
text: '今天', | |||||
onClick(picker) { | |||||
picker.$emit('pick', new Date()); | |||||
} | |||||
}, { | |||||
text: '昨天', | |||||
onClick(picker) { | |||||
const date = new Date(); | |||||
date.setTime(date.getTime() - 3600 * 1000 * 24); | |||||
picker.$emit('pick', date); | |||||
} | |||||
}, { | |||||
text: '一周前', | |||||
onClick(picker) { | |||||
const date = new Date(); | |||||
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); | |||||
picker.$emit('pick', date); | |||||
} | |||||
}] | |||||
}, | |||||
} | } | ||||
}, | }, | ||||
created() { | created() { | ||||