|
|
@@ -1,14 +1,23 @@
|
|
|
<template>
|
|
|
<div class="manageHotel-wrapper">
|
|
|
<a-tabs>
|
|
|
- <a-tab-pane tab="录入客房" key="1">
|
|
|
- <a-form :form="form" style="margin-top: 30px">
|
|
|
-
|
|
|
- </a-form>
|
|
|
+ <a-tab-pane tab="酒店管理" key="1">
|
|
|
+ <div style="width: 100%; text-align: right; margin:20px 0">
|
|
|
+ <a-button type="primary" @click="addHotel"><a-icon type="plus" />添加酒店</a-button>
|
|
|
+ </div>
|
|
|
+ <a-table
|
|
|
+ :columns="columns1"
|
|
|
+ :dataSource="data"
|
|
|
+ bordered
|
|
|
+ >
|
|
|
+ <span slot="action" slot-scope="text, record">
|
|
|
+ <a-button type="primary" @click="order(record)">录入房间</a-button>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
</a-tab-pane>
|
|
|
<a-tab-pane tab="订单管理" key="2">
|
|
|
<a-table
|
|
|
- :columns="columns"
|
|
|
+ :columns="columns2"
|
|
|
:dataSource="data"
|
|
|
bordered
|
|
|
>
|
|
|
@@ -23,11 +32,36 @@
|
|
|
</a-table>
|
|
|
</a-tab-pane>
|
|
|
</a-tabs>
|
|
|
+ <AddHotelModal></AddHotelModal>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters, mapMutations, mapActions } from 'vuex'
|
|
|
-const columns = [
|
|
|
+import AddHotelModal from './components/addHotalModal'
|
|
|
+const columns1 = [
|
|
|
+ {
|
|
|
+ title: '酒店名',
|
|
|
+ dataIndex: 'name',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '地址',
|
|
|
+ dataIndex: 'address',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '评分',
|
|
|
+ dataIndex: 'hotelRate',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '简介',
|
|
|
+ dataIndex: 'description',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'action',
|
|
|
+ scopedSlots: { customRender: 'action' },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+const columns2 = [
|
|
|
{
|
|
|
title: '酒店名',
|
|
|
dataIndex: 'hotelName',
|
|
|
@@ -64,58 +98,37 @@ export default {
|
|
|
return {
|
|
|
formLayout: 'horizontal',
|
|
|
pagination: {},
|
|
|
- columns,
|
|
|
+ columns1,
|
|
|
+ columns2,
|
|
|
data: [],
|
|
|
form: this.$form.createForm(this, { name: 'manageHotel' }),
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
+ AddHotelModal
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters([
|
|
|
-
|
|
|
+ 'orderList',
|
|
|
+ 'addHotelModalVisible',
|
|
|
+ 'addRoomModalVisible'
|
|
|
])
|
|
|
},
|
|
|
mounted() {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations([
|
|
|
+ 'set_addHotelModalVisible',
|
|
|
+ 'set_addRoomModalVisible'
|
|
|
+ ]),
|
|
|
...mapActions([
|
|
|
'updateUserInfoById',
|
|
|
]),
|
|
|
- saveModify() {
|
|
|
- this.form.validateFields((err, values) => {
|
|
|
- if (!err) {
|
|
|
- const data = {
|
|
|
- username: this.form.getFieldValue('username'),
|
|
|
- nickname: this.form.getFieldValue('nickname'),
|
|
|
- email: this.form.getFieldValue('email'),
|
|
|
- phoneNumber: this.form.getFieldValue('phoneNumber'),
|
|
|
- gender: this.form.getFieldValue('gender'),
|
|
|
- address: this.form.getFieldValue('address')
|
|
|
- }
|
|
|
- this.updateUserInfoById(data).then(()=>{
|
|
|
- this.modify = false
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- modifyInfo() {
|
|
|
- setTimeout(() => {
|
|
|
- this.form.setFieldsValue({
|
|
|
- 'username': this.userInfo.username,
|
|
|
- 'nickname': this.userInfo.nickname,
|
|
|
- 'email': this.userInfo.email,
|
|
|
- 'phoneNumber': this.userInfo.phoneNumber,
|
|
|
- 'gender': this.userInfo.gender,
|
|
|
- 'address': this.userInfo.address
|
|
|
- })
|
|
|
- }, 0)
|
|
|
- this.modify = true
|
|
|
+ addHotel() {
|
|
|
+ this.set_addHotelModalVisible(true)
|
|
|
},
|
|
|
- cancelModify() {
|
|
|
- this.modify = false
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -132,7 +145,7 @@ export default {
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="less">
|
|
|
- .info-wrapper {
|
|
|
+ .manageHotel-wrapper {
|
|
|
.ant-tabs-bar {
|
|
|
padding-left: 30px
|
|
|
}
|