酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 20 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <!-- import CSS -->
  6. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  7. </head>
  8. <body>
  9. <div id="app" class="table">
  10. <div>
  11. <div class="header-search">
  12. <span>ID:</span>
  13. <el-input v-model="search.id" style="width: 120px;" placeholder="请输入内容"></el-input>
  14. <span>名称:</span>
  15. <el-input v-model="search.plan_name" style="width: 120px;" placeholder="请输入内容"></el-input>
  16. <span>酒店</span>
  17. <el-select v-model="search.hotel_id" placeholder="请选择" style="width: 120px;" clearable>
  18. <el-option
  19. v-for="item in hotelList"
  20. :key="item.id"
  21. :label="item.name"
  22. :value="item.id">
  23. </el-option>
  24. </el-select>
  25. <span>房型</span>
  26. <el-select v-model="search.room_id" placeholder="请选择" style="width: 120px;" clearable>
  27. <el-option
  28. v-for="item in roomList"
  29. :key="item.id"
  30. :label="item.name"
  31. :value="item.id">
  32. </el-option>
  33. </el-select>
  34. <span>采购负责人</span>
  35. <el-select v-model="search.purchase_user_id" placeholder="请选择" style="width: 120px;" clearable>
  36. <el-option
  37. v-for="item in userList"
  38. :key="item.id"
  39. :label="item.name"
  40. :value="item.id">
  41. </el-option>
  42. </el-select>
  43. <el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
  44. <el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增</el-button>
  45. </div>
  46. <el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark"
  47. style="font-size:12px;width: 100%;margin-top: 12px">
  48. <el-table-column prop="id" label="ID" min-width="50"></el-table-column>
  49. <el-table-column prop="plan_name" label="名称" min-width="120"></el-table-column>
  50. <el-table-column label="酒店" :formatter="getHotelName" min-width="180"></el-table-column>
  51. <el-table-column label="房型" :formatter="getRoomName" min-width="180"></el-table-column>
  52. <el-table-column prop="breakfast_num" label="早餐数量" min-width="60"></el-table-column>
  53. <el-table-column prop="book_end_day" label="提前几天预定" min-width="60"></el-table-column>
  54. <el-table-column prop="book_end_hour" label="几点前预定" min-width="60"></el-table-column>
  55. <el-table-column prop="continuity_type" label="入住类型" :formatter="getTypeName" min-width="60"></el-table-column>
  56. <el-table-column prop="coutinuity_day" label="连续入住天数" min-width="60"></el-table-column>
  57. <el-table-column prop="plan_memo" label="方案说明" min-width="60">
  58. <template slot-scope="scope">
  59. <el-popover
  60. placement="top-start"
  61. title=""
  62. width="200"
  63. trigger="hover"
  64. :content="scope.row.plan_memo">
  65. <div slot="reference" v-html="scope.row.plan_memo" style="overflow:hidden;white-space: nowrap;"></div>
  66. </el-popover>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="purchase_user_id" label="采购负责人" :formatter="getPurchaseName" min-width="90"></el-table-column>
  70. <el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column>
  71. <el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column>
  72. <el-table-column label="操作" min-width="180">
  73. <template slot-scope="scope">
  74. <el-button-group>
  75. <el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button>
  76. <el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button>
  77. </el-button-group>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <el-pagination
  82. :page-size="search.pageSize"
  83. :pager-count="11"
  84. layout="total, sizes, prev, pager, next, jumper"
  85. :total="total"
  86. :current-page="search.pageNum"
  87. :page-sizes="[10, 20, 30, 40, 50]"
  88. @size-change="sizeChange"
  89. @current-change="getData"
  90. @prev-click="getData"
  91. @next-click="getData"
  92. ></el-pagination>
  93. </div>
  94. <transition name="bounce" v-if="editShow">
  95. <el-dialog title="详情" :visible.sync="editShow" width="90%" top="15px">
  96. <el-form ref="form" label-width="140px" style="width: 100%;padding-bottom: 20px">
  97. <el-form-item v-if="editType" label="ID:" style="width: 100%">
  98. <div v-html="editData.id"></div>
  99. </el-form-item>
  100. <el-form-item label="名称:" style="width: 100%">
  101. <el-input v-model="editData.plan_name" style="width: 280px;" placeholder="请输入内容"></el-input>
  102. </el-form-item>
  103. <el-form-item label="酒店:" style="width: 100%">
  104. <el-select v-model="editData.hotel_id" placeholder="请选择" style="width: 120px;" clearable>
  105. <el-option
  106. v-for="item in hotelList"
  107. :key="item.id"
  108. :label="item.name"
  109. :value="item.id">
  110. </el-option>
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item label="房型:" style="width: 100%">
  114. <el-select v-model="editData.room_id" placeholder="请选择" style="width: 120px;" clearable>
  115. <el-option
  116. v-for="item in editRoomList"
  117. :key="item.id"
  118. :label="item.name"
  119. :value="item.id">
  120. </el-option>
  121. </el-select>
  122. </el-form-item>
  123. <el-form-item label="早餐数量:" style="width: 100%">
  124. <el-input v-model="editData.breakfast_num" style="width: 280px;" placeholder="请输入内容"></el-input>
  125. </el-form-item>
  126. <el-form-item label="提前预定天数:" style="width: 100%">
  127. <el-input v-model="editData.book_end_day" style="width: 280px;" placeholder="请输入内容"></el-input>
  128. </el-form-item>
  129. <el-form-item label="几点前预定:" style="width: 100%">
  130. <el-input v-model="editData.book_end_hour" style="width: 280px;" placeholder="请输入内容"></el-input>
  131. </el-form-item>
  132. <el-form-item label="连续入住类型:" style="width: 100%">
  133. <el-radio-group v-model="editData.continuity_type" size="small">
  134. <el-radio-button :label="0">无限制</el-radio-button>
  135. <el-radio-button :label="1">连住几晚</el-radio-button>
  136. <el-radio-button :label="2">连住几晚及以上</el-radio-button>
  137. <el-radio-button :label="3">连住几晚及其倍数</el-radio-button>
  138. </el-radio-group>
  139. </el-form-item>
  140. <el-form-item v-if="editData.continuity_type != 0" label="连续入住天数:" style="width: 100%">
  141. <el-input v-model="editData.coutinuity_day" style="width: 280px;" placeholder="请输入内容"></el-input>
  142. </el-form-item>
  143. <el-form-item label="采购负责人:" style="width: 100%">
  144. <el-select v-model="editData.purchase_user_id" placeholder="请选择" style="width: 120px;" clearable>
  145. <el-option
  146. v-for="item in userList"
  147. :key="item.id"
  148. :label="item.name"
  149. :value="item.id">
  150. </el-option>
  151. </el-select>
  152. </el-form-item>
  153. <el-form-item label="方案说明:" style="width: 100%">
  154. <el-input
  155. type="textarea"
  156. :rows="4"
  157. placeholder="请输入内容"
  158. v-model="editData.plan_memo">
  159. </el-input>
  160. </el-form-item>
  161. <el-form-item>
  162. <el-button type="primary" @click="editDoing()" style="margin: 10px" > 保 存 </el-button>
  163. </el-form-item>
  164. </el-form>
  165. </el-dialog>
  166. </transition>
  167. </div>
  168. </body>
  169. <!-- import Vue before Element -->
  170. <script src="/assets/js/vue/vue.js"></script>
  171. <!-- import JavaScript -->
  172. <script src="/assets/js/vue/index.js"></script>
  173. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  174. <script>
  175. new Vue({
  176. el: '#app',
  177. data: function () {
  178. return {
  179. search: {
  180. id:"",
  181. hotel_id: "",
  182. room_id: "",
  183. purchase_user_id:"",
  184. plan_name:"",
  185. pageSize:10,
  186. pageNum: 1
  187. },
  188. total: 0,
  189. tableData: [],
  190. editShow: false,
  191. editType: false,
  192. editData: {
  193. },
  194. hotelList:[],
  195. roomList:[],
  196. editRoomList:[],
  197. roomAllList:[],
  198. userList: [],
  199. //连续入住类型 0无限制 1连住几晚 2连住几晚及以上 3连住几晚及其倍数
  200. typeList:[
  201. {id:0,name:"无限制"},
  202. {id:1,name:"连住几晚"},
  203. {id:2,name:"连住几晚及以上"},
  204. {id:3,name:"连住几晚及其倍数"}
  205. ],
  206. edit_city_set:2
  207. }
  208. },
  209. created() {
  210. this.getHotelList();
  211. this.getRoomAllList();
  212. this.getAdminUser();
  213. this.getData(1)
  214. },
  215. watch: {
  216. "search.hotel_id" : function (newVal,oldVal){
  217. this.roomList = []
  218. axios.post("/hotel.php/cf_room_info/getRoomList?hotelId="+newVal, {}).then((response) => {
  219. let data = response.data;
  220. this.roomList = data.list;
  221. }).catch(function (error) {
  222. console.log(error);
  223. });
  224. },
  225. "editData.hotel_id" : function (newVal,oldVal){
  226. if (this.edit_city_set==2) {
  227. this.editRoomList = []
  228. this.editData.room_id = ""
  229. }
  230. if (newVal == "") {
  231. return false
  232. }
  233. axios.post("/hotel.php/cf_room_info/getRoomList?hotelId="+newVal, {}).then((response) => {
  234. let data = response.data;
  235. this.editRoomList = data.list;
  236. this.edit_city_set++
  237. }).catch(function (error) {
  238. console.log(error);
  239. });
  240. },
  241. "editData.continuity_type" : function (newVal,oldVal) {
  242. if (newVal == 0) {
  243. this.editData.coutinuity_day = 0;
  244. }
  245. }
  246. },
  247. methods: {
  248. getPurchaseName(info) {
  249. for (let i = 0; i < this.userList.length; i++) {
  250. if (this.userList[i].id == info.purchase_user_id) {
  251. return this.userList[i].name
  252. }
  253. }
  254. return "-"
  255. },
  256. getTypeName(info) {
  257. for (let i = 0; i < this.typeList.length; i++) {
  258. if (this.typeList[i].id == info.continuity_type) {
  259. return this.typeList[i].name
  260. }
  261. }
  262. return "-"
  263. },
  264. getHotelName(info) {
  265. for (let i = 0; i < this.hotelList.length; i++) {
  266. if (this.hotelList[i].id == info.hotel_id) {
  267. return this.hotelList[i].name
  268. }
  269. }
  270. return "-"
  271. },
  272. getRoomName(info) {
  273. for (let i = 0; i < this.roomAllList.length; i++) {
  274. if (this.roomAllList[i].id == info.room_id) {
  275. return this.roomAllList[i].name
  276. }
  277. }
  278. return "-"
  279. },
  280. getRoomAllList(){
  281. axios.post("/hotel.php/cf_room_info/getList", this.search).then((response) => {
  282. this.roomAllList = response.data.list;
  283. }).catch(function (error) {
  284. console.log(error);
  285. });
  286. },
  287. getAdminUser() {
  288. axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => {
  289. this.userList = response.data.list;
  290. }).catch(function (error) {
  291. console.log(error);
  292. });
  293. },
  294. getHotelList(){
  295. axios.post("/hotel.php/cf_hotel_info/getHotelList", {}).then((response) => {
  296. let data = response.data;
  297. this.hotelList = data.list;
  298. }).catch(function (error) {
  299. console.log(error);
  300. });
  301. },
  302. sizeChange(pageSize) {
  303. this.search.pageSize = pageSize;
  304. this.getData(this.search.pageNum)
  305. },
  306. //獲取列表
  307. getData(page) {
  308. this.search.pageNum = page;
  309. axios.post("/hotel.php/cf_room_plan/list", this.search).then((response) => {
  310. let data = response.data;
  311. if (data.flag) {
  312. this.tableData = data.data.list;
  313. this.total = data.data.total;
  314. } else {
  315. this.$message.error(response.msg);
  316. }
  317. }).catch(function (error) {
  318. console.log(error);
  319. });
  320. },
  321. edit(info) {
  322. if (info == null) {
  323. this.editType = false;
  324. this.editData = {
  325. hotel_id:"",
  326. room_id:"",
  327. plan_name:"",
  328. breakfast_num:0,
  329. book_end_day:0,
  330. book_end_hour:0,
  331. continuity_type:0,
  332. coutinuity_day:0,
  333. plan_memo:"",
  334. purchase_user_id:"",
  335. }
  336. } else {
  337. this.edit_city_set = 1;
  338. this.editType = true;
  339. this.editData = {
  340. id:info.id,
  341. hotel_id:info.hotel_id,
  342. room_id:info.room_id,
  343. plan_name:info.plan_name,
  344. breakfast_num:info.breakfast_num,
  345. book_end_day:info.book_end_day,
  346. book_end_hour:info.book_end_hour,
  347. continuity_type:info.continuity_type,
  348. coutinuity_day:info.coutinuity_day,
  349. plan_memo:info.plan_memo,
  350. purchase_user_id:info.purchase_user_id,
  351. }
  352. }
  353. this.editShow = true;
  354. },
  355. editDoing(){
  356. if (this.editData.hotel_id==''){
  357. this.$message.error("请选择酒店");return false;
  358. }
  359. if (this.editData.room_id==''){
  360. this.$message.error("请选择房型");return false;
  361. }
  362. if (this.editData.plan_name==''){
  363. this.$message.error("名称不能为空");return false;
  364. }
  365. if (this.editData.breakfast_num===''){
  366. this.$message.error("早餐数量不能为空");return false;
  367. }
  368. if (this.editData.book_end_day===''){
  369. this.$message.error("提前几天预定不能为空");return false;
  370. }
  371. if (this.editData.book_end_hour===''){
  372. this.$message.error("几点前预定不能为空");return false;
  373. }
  374. if (this.editData.coutinuity_day===''){
  375. this.$message.error("连续入住天数不能为空");return false;
  376. }
  377. if (this.editData.purchase_user_id==''){
  378. this.$message.error("请选择采购负责人");return false;
  379. }
  380. axios.post("/hotel.php/cf_room_plan/save", this.editData).then( (response)=> {
  381. let data = response.data;
  382. console.log(this.tableData);
  383. if (data.flag) {
  384. this.$message.success("保存成功");
  385. this.editShow = false;
  386. this.getData(1);
  387. } else {
  388. this.$message.error(data.msg);
  389. }
  390. }).catch(function (error) {
  391. this.$message.error("保存失败");
  392. console.log(error);
  393. });
  394. },
  395. delAll(id){
  396. this.$confirm('确定删除?', '提示', {
  397. confirmButtonText: '确定',
  398. cancelButtonText: '取消',
  399. type: 'warning'
  400. }).then(() => {
  401. let param = {
  402. id: id
  403. }
  404. axios.post("/hotel.php/cf_room_plan/delAll", param).then((response) => {
  405. let data = response.data;
  406. if (data.flag) {
  407. this.getData(this.search.pageNum)
  408. this.$message.success("保存成功");
  409. } else {
  410. this.$message.error(response.msg);
  411. }
  412. }).catch(function (error) {
  413. console.log(error);
  414. });
  415. }).catch(() => {
  416. this.$message.info("已取消");
  417. this.getData(this.search.pageNum)
  418. })
  419. }
  420. }
  421. })
  422. </script>
  423. <style lang="scss" scoped>
  424. .el-table thead {
  425. background-color: #5a5e66 !important;
  426. }
  427. .header-search {
  428. font-size: 14px;
  429. font-weight: 900;
  430. }
  431. body {
  432. background-color: white;
  433. }
  434. .table {
  435. width: 100%;
  436. font-size: 12px;
  437. margin-top: 12px;
  438. background-color: white;
  439. }
  440. .el-form-item{
  441. margin-bottom: 5px !important;
  442. }
  443. </style>
  444. </html>