From 338f7f3d430195e80897e9c87db8b7240c35f1a9 Mon Sep 17 00:00:00 2001 From: nizongfeng Date: Tue, 30 Nov 2021 19:51:27 +0800 Subject: [PATCH 1/3] 1 --- application/admin/controller/CfRoomPlan.php | 158 ++------- application/admin/dao/CfRoomPlanDao.php | 107 ++++++ application/admin/view/cf_room_plan/index.html | 437 +++++++++++++++++++++++-- 3 files changed, 540 insertions(+), 162 deletions(-) create mode 100644 application/admin/dao/CfRoomPlanDao.php 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/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..99cc504 100755 --- a/application/admin/view/cf_room_plan/index.html +++ b/application/admin/view/cf_room_plan/index.html @@ -1,35 +1,408 @@ -
- {:build_heading()} - -
-
- - + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ +
+
+
+
+ + + +
+
+ + + + + + + + + + +
+
+ + + +
+
+ 保存 +
+
+
+
+ + + + + + + + + From 00ae1304b12f8c28ef3ffd952c88ca3d5c794af2 Mon Sep 17 00:00:00 2001 From: nizongfeng Date: Wed, 1 Dec 2021 10:53:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/CfSuplierInfo.php | 7 +- application/admin/view/cf_room_plan/index.html | 152 ++++++++++++++++--------- 2 files changed, 105 insertions(+), 54 deletions(-) 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/view/cf_room_plan/index.html b/application/admin/view/cf_room_plan/index.html index 99cc504..46e2499 100755 --- a/application/admin/view/cf_room_plan/index.html +++ b/application/admin/view/cf_room_plan/index.html @@ -96,37 +96,74 @@ - -
- -
-
-
-
- - - -
-
- - - - - - - - - - -
-
- - - -
-
- 保存 -
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + 无限制 + 连住几晚 + 连住几晚及以上 + 连住几晚及其倍数 + + + + + + + + + + + + + + + + + 保 存 +
@@ -159,6 +196,7 @@ }, hotelList:[], roomList:[], + editRoomList:[], roomAllList:[], userList: [], //连续入住类型 0无限制 1连住几晚 2连住几晚及以上 3连住几晚及其倍数 @@ -167,8 +205,8 @@ {id:1,name:"连住几晚"}, {id:2,name:"连住几晚及以上"}, {id:3,name:"连住几晚及其倍数"} - ] - + ], + edit_city_set:2 } }, created() { @@ -186,6 +224,27 @@ }).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: { @@ -263,27 +322,25 @@ }); }, edit(info) { - this.$message.error("功能待完善"); - return false if (info == null) { this.editType = false; this.editData = { hotel_id:"", room_id:"", plan_name:"", - breakfast_num:"", - book_end_day:"", - book_end_hour:"", + breakfast_num:0, + book_end_day:0, + book_end_hour:0, continuity_type:0, - coutinuity_day:"", + 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, @@ -308,28 +365,21 @@ if (this.editData.plan_name==''){ this.$message.error("名称不能为空");return false; } - if (this.editData.breakfast_num==''){ + if (this.editData.breakfast_num===''){ this.$message.error("早餐数量不能为空");return false; } - if (this.editData.book_end_day==''){ + if (this.editData.book_end_day===''){ this.$message.error("提前几天预定不能为空");return false; } - if (this.editData.book_end_hour==''){ + if (this.editData.book_end_hour===''){ this.$message.error("几点前预定不能为空");return false; } - if (this.editData.continuity_type==''){ - this.$message.error("选择入住类型不能");return false; - } - if (this.editData.coutinuity_day==''){ + if (this.editData.coutinuity_day===''){ this.$message.error("连续入住天数不能为空");return false; } - if (this.editData.plan_memo==''){ - this.$message.error("方案说明不能为空");return false; - } if (this.editData.purchase_user_id==''){ this.$message.error("请选择采购负责人");return false; } - this.setAreaName(); axios.post("/hotel.php/cf_room_plan/save", this.editData).then( (response)=> { let data = response.data; console.log(this.tableData); From 4c91fa1beab288f827149e93b9ff4bc83d9ef14f Mon Sep 17 00:00:00 2001 From: nizongfeng Date: Wed, 1 Dec 2021 12:01:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/order_main/index.html | 33 ++++++++++++++++++++++++- application/admin/view/payment_order/index.html | 27 ++++++++++++++++++++ application/admin/view/receipt_order/index.html | 29 +++++++++++++++++++++- 3 files changed, 87 insertions(+), 2 deletions(-) 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() {