diff --git a/application/admin/controller/CfRoomPlan.php b/application/admin/controller/CfRoomPlan.php index 1ff12e1..c89825c 100755 --- a/application/admin/controller/CfRoomPlan.php +++ b/application/admin/controller/CfRoomPlan.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\CfRoomPlanDao; use app\admin\dao\GroupDao; use app\admin\model\Area; use app\common\controller\Backend; @@ -16,7 +17,7 @@ use think\exception\ValidateException; */ class CfRoomPlan extends Backend { - protected $noNeedRight = ['getList']; + protected $noNeedRight = ['getList',"list","save","delAll"]; /** * 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)); } + + } diff --git a/application/admin/controller/CfSuplierInfo.php b/application/admin/controller/CfSuplierInfo.php index 629f4f9..d5ce07e 100755 --- a/application/admin/controller/CfSuplierInfo.php +++ b/application/admin/controller/CfSuplierInfo.php @@ -128,12 +128,13 @@ class CfSuplierInfo extends Backend $this->model->field('id,supplier_name as name'); $groupDao = new GroupDao(); $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); + $where = ["group_id"=>$group_id]; if($keyValue){ - $this->model->where(['id'=>$keyValue,"group_id"=>$group_id]); + $where = ['id'=>$keyValue,"group_id"=>$group_id]; }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){ return json(['list' => $result]); } diff --git a/application/admin/dao/CfRoomPlanDao.php b/application/admin/dao/CfRoomPlanDao.php new file mode 100644 index 0000000..9507991 --- /dev/null +++ b/application/admin/dao/CfRoomPlanDao.php @@ -0,0 +1,107 @@ + $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()); + } + } +} \ No newline at end of file diff --git a/application/admin/view/cf_room_plan/index.html b/application/admin/view/cf_room_plan/index.html index 760e636..46e2499 100755 --- a/application/admin/view/cf_room_plan/index.html +++ b/application/admin/view/cf_room_plan/index.html @@ -1,35 +1,458 @@ -
- {:build_heading()} - -
-
- - + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + 无限制 + 连住几晚 + 连住几晚及以上 + 连住几晚及其倍数 + + + + + + + + + + + + + + + + + 保 存 + +
+
+
+ + + + + + + + + diff --git a/application/admin/view/order_main/index.html b/application/admin/view/order_main/index.html index d2f5ee7..8ee39c9 100755 --- a/application/admin/view/order_main/index.html +++ b/application/admin/view/order_main/index.html @@ -72,6 +72,7 @@ v-model="search.startTime" type="date" value-format="yyyy-MM-dd" + :picker-options="pickerOptions" placeholder="选择日期"> ~ @@ -80,6 +81,7 @@ v-model="search.endTime" value-format="yyyy-MM-dd" type="date" + :picker-options="pickerOptions" placeholder="选择日期">
@@ -115,6 +117,7 @@ v-model="search.startInDate" type="date" value-format="yyyy-MM-dd" + :picker-options="pickerOptions" placeholder="选择日期"> ~ @@ -123,6 +126,7 @@ v-model="search.endInDate" value-format="yyyy-MM-dd" type="date" + :picker-options="pickerOptions" placeholder="选择日期"> 离店时间 @@ -131,6 +135,7 @@ v-model="search.startOutDate" type="date" value-format="yyyy-MM-dd" + :picker-options="pickerOptions" placeholder="选择日期"> ~ @@ -139,6 +144,7 @@ v-model="search.endOutDate" value-format="yyyy-MM-dd" type="date" + :picker-options="pickerOptions" placeholder="选择日期"> 搜索 @@ -376,7 +382,32 @@ {"id": 2, 'value': "已付款"} ], 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() { diff --git a/application/admin/view/payment_order/index.html b/application/admin/view/payment_order/index.html index 6923940..750cc8b 100755 --- a/application/admin/view/payment_order/index.html +++ b/application/admin/view/payment_order/index.html @@ -205,6 +205,7 @@ v-model="orderMainListSearch.startTime" type="date" value-format="yyyy-MM-dd" + :picker-options="pickerOptions" placeholder="选择日期"> ~ @@ -213,6 +214,7 @@ v-model="orderMainListSearch.endTime" value-format="yyyy-MM-dd" type="date" + :picker-options="pickerOptions" placeholder="选择日期"> 搜索 @@ -357,6 +359,31 @@ hotelList:[], itemList:[], 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() { diff --git a/application/admin/view/receipt_order/index.html b/application/admin/view/receipt_order/index.html index 8415a1c..dfc0738 100755 --- a/application/admin/view/receipt_order/index.html +++ b/application/admin/view/receipt_order/index.html @@ -185,6 +185,7 @@ v-model="orderMainListSearch.startTime" type="date" value-format="yyyy-MM-dd" + :picker-options="pickerOptions" placeholder="选择日期"> ~ @@ -193,6 +194,7 @@ v-model="orderMainListSearch.endTime" value-format="yyyy-MM-dd" type="date" + :picker-options="pickerOptions" placeholder="选择日期"> 搜索 @@ -315,7 +317,32 @@ {id:11,name:"已取消"} ], 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() {