瀏覽代碼

逻辑完善

qh 2 年之前
父節點
當前提交
b785ff7bbc

+ 27 - 0
src/api/hotel.js

@@ -0,0 +1,27 @@
+import api from './index'
+import { axios } from '@/utils/request'
+
+/**
+ * 添加酒店
+ * @param {参数} parameter 
+ * @returns 
+ */
+export function newHotel(parameter) {
+    return axios({
+        url: '/business/busHotel/add',
+        method: 'post',
+        data: parameter
+    })
+}
+
+/**
+ * 当前租户的酒店列表
+ * @param {参数} parameter 
+ * @returns 
+ */
+ export function hotelList(parameter) {
+    return axios({
+        url: '/business/busHotel/list?pageNo='+(parameter.pageNo||1)+'&pageSize='+(parameter.pageSize||10)+"&key="+parameter.key,
+        method: 'get',
+    })
+}

+ 1 - 1
src/components/layouts/HotelSelect.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        {{ index }}
+        123123
     </div>
 </template>
 

+ 7 - 10
src/config/router.config.js

@@ -5,16 +5,9 @@ import { UserLayout, TabLayout, RouteView, BlankLayout, PageView, HotelSelect }
  * @type {[null,null]}
  */
 export const asyncRouterMap = [
+ 
   {
-    path: '/entey/select_hotel',
-    name: 'hotelEntry',
-    component: HotelSelect,
-    meta: { title: '选择酒店' },
-    redirect: '/entey/select_hotel',
-    children: []
-  },
-  {
-    path: '/home',
+    path: '/',
     name: 'dashboard',
     component: TabLayout,
     meta: { title: '首页' },
@@ -385,5 +378,9 @@ export const constantRouterMap = [
     path: '/404',
     component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
   },
-
+  {
+    path: '/hotel/entry',
+    component: () => import('@/views/hotel/entry'),
+    meta: { title: '选择酒店' },
+  },
 ]

+ 5 - 0
src/permission.js

@@ -26,6 +26,11 @@ router.beforeEach((to, from, next) => {
   NProgress.start() // start progress bar
 
   if (Vue.ls.get(ACCESS_TOKEN)) {
+    if(to.path == '/hotel/entry'){
+      next({meta: { title: '选择酒店' }, replace: true})
+      NProgress.done()
+      return;
+    }
     /* has token */
     if (to.path === '/user/login' || to.path === OAUTH2_LOGIN_PAGE_PATH) {
       next({ path: INDEX_MAIN_PAGE_PATH })

+ 6 - 0
src/router/index.js

@@ -2,6 +2,12 @@ import Vue from 'vue'
 import Router from 'vue-router'
 import { constantRouterMap } from '@/config/router.config'
 
+const originalPush = Router.prototype.push
+Router.prototype.push = function push(location, onResolve, onReject) {
+  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
+  return originalPush.call(this, location).catch(err => err)
+}
+
 Vue.use(Router)
 
 export default new Router({

+ 339 - 0
src/views/hotel/entry.vue

@@ -0,0 +1,339 @@
+<template>
+    <div>
+
+        <a-row class="header-rw">
+            <a-col :span="4" class="title-head-logo">
+                <img src="~@/assets/logo.svg" class="logo" alt="logo"></img>
+            </a-col>
+            <a-col :span="1" class="title-head-divider">
+                <div class="divider"></div>
+            </a-col>
+            <a-col :span="2" class="title-header-tip">商家中心</a-col>
+            <a-col :span="15"></a-col>
+            <a-col :span="2" class="title-header-tip">
+                <a-button type="link" block @click="logout">
+                    注销
+                </a-button>
+            </a-col>
+        </a-row>
+        <div class="main-container">
+            <a-tabs @change="handleChangeTab" type="card">
+                <a-tab-pane tab="酒店" :forceRender="true" key="1">
+                    <div class="main-list-card">
+                        <div class="top-content">
+                            <div class="store-list-title">
+                                门店列表<a-icon @click="refreshData" class="redo-refresh" type="redo" />
+                            </div>
+                            <div style="flex:1;height:1px;"></div>
+                            <div class="new-store-btn">
+                                <a-button type="link" block @click="newHtl">
+                                    新建门店
+                                </a-button>
+                            </div>
+                        </div>
+                        <!-- 条件搜索 -->
+                        <div class="search-wrapper">
+                            <a-input-search v-model="keywords" placeholder="姓名/手机/地址" enter-button="查询" size="default"
+                                @search="onSearch" />
+                        </div>
+                        <a-divider>门店列表</a-divider>
+                        <div class="store-list-wrapper">
+                            <div class="list-items" v-if="list.length > 0">
+                                <div class="list-item" v-for="item in list" :key="item.id">
+                                    <!-- 图片 -->
+                                    <div class="img-hotel no-img" v-if="!item.ewmLogo">暂无照片</div>
+                                    <div class="img-hotel" v-else>
+                                        <img :src="item.ewmLogo" alt="">
+                                    </div>
+                                    <div class="right-temp">
+                                        <div class="hotel-name"> {{ item.name }} </div>
+                                        <div class="hotel-address">{{ item.address }}</div>
+                                        <div class="hotel-status">
+                                            <div v-if="item.checkStatus == 0" class="wait-check">待审核</div>
+                                            <div v-if="item.checkStatus == 1" class="check-success">
+                                                <a-button type="link" @click="enter($event, item)">进入管理</a-button>
+                                            </div>
+                                            <div v-if="item.checkStatus == 2" class="check-faild">审核未通过</div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <a-empty v-else />
+                        </div>
+                    </div>
+                </a-tab-pane>
+            </a-tabs>
+        </div>
+
+        <j-modal title="新建门店" :width="1000" :visible="visible" @cancel="handleCancel" :mask="true" @ok="frmsubmit"
+            :fullscreen="false" draggable class="j-super-query-modal" style="top:5%;max-height: 95%;">
+            <new-htl-frm ref="htlFrm" @addSuccess="visible = false">
+
+            </new-htl-frm>
+        </j-modal>
+    </div>
+</template>
+
+<script>
+import { mapActions } from 'vuex'
+import newHtlFrm from './newHotelForm.vue'
+import { hotelList } from '../../api/hotel'
+export default {
+    components: {
+        newHtlFrm
+    },
+    data() {
+        return {
+            index: 1,
+            list: [],
+            visible: false,
+            pageNo: 1,
+            keywords: ''
+        }
+    },
+    mounted() {
+        this.getStoreList()
+    },
+    methods: {
+        ...mapActions(["Logout"]),
+        getStoreList() {
+            hotelList({
+                pageNo: this.pageNo,
+                pageSize: 20,
+                key: this.keywords
+            }).then(res => {
+                console.log(res)
+                if (res.code == 200 && res.result && res.result.records) {
+                    this.list = res.result.records
+                }
+            })
+        },
+        handleChangeTab() {
+            // this.$refs[`editableTable${key}`].resetScrollTop()
+        },
+        // 搜索事件
+        onSearch() {
+            this.getStoreList()
+        },
+        // 刷新门店
+        refreshData() {
+
+        },
+        // 新建酒店按钮
+        newHtl() {
+            this.visible = true
+        },
+        // 模态框取消
+        handleCancel() {
+            this.visible = false
+        },
+        frmsubmit() {
+            this.$refs.htlFrm.handleSubmit(1)
+        },
+        // 进入管理
+        enter(event, item) {
+            localStorage.setItem("storeInfo", JSON.stringify(item))
+            this.$router.push({ path: '/' })
+        },
+        // 注销
+        logout() {
+            const that = this
+
+            this.$confirm({
+                title: '提示',
+                content: '真的要注销登录吗 ?',
+                onOk() {
+                    return that.Logout({}).then(() => {
+                        // update-begin author:scott date:20211223 for:【JTC-198】退出登录体验不好
+                        //that.$router.push({ path: '/user/login' });
+                        window.location.reload()
+                        // update-end author:scott date:20211223 for:【JTC-198】退出登录体验不好
+                    }).catch(err => {
+                        that.$message.error({
+                            title: '错误',
+                            description: err.message
+                        })
+                    })
+                },
+                onCancel() {
+                },
+            });
+        }
+    }
+}
+</script>
+
+<style scoped>
+.logo {
+    height: 54px !important;
+    vertical-align: top !important;
+
+    border-style: none !important;
+    margin-top: 5px;
+}
+
+.title-head-logo {
+    text-align: right;
+    display: flex;
+    align-items: center;
+    justify-content: end;
+}
+
+.title-head-divider {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.header-rw {
+    height: 64px;
+    margin-top: 5px;
+    line-height: 64px;
+    border-top: 1px solid #CCCCCC88;
+    border-bottom: 1px solid #CCCCCC88;
+}
+
+.divider {
+    width: 1px;
+    height: 44px;
+    background-color: #CCCCCCCC;
+    margin-top: 10px;
+}
+
+.title-header-tip {
+    color: #888888;
+}
+
+.main-container {
+    width: 70%;
+    margin: 40px auto;
+    padding-bottom: 10px;
+}
+
+.ant-tabs {
+    width: 100% !important;
+}
+
+.main-list-card {
+    display: flex;
+    flex-direction: column;
+    width: 98%;
+    margin: 0 auto;
+    height: 50vh;
+    overflow-y: auto;
+    border-radius: 5px;
+    box-shadow: 0 0 5px 5px #EEEEEECC;
+    margin-bottom: 10px;
+    overflow: hidden;
+}
+
+.ant-tabs .ant-tabs-top-content>.ant-tabs-tabpane,
+.ant-tabs .ant-tabs-bottom-content>.ant-tabs-tabpane {
+    padding-bottom: 10px !important;
+}
+
+.redo-refresh {
+    cursor: pointer;
+}
+
+.top-content {
+    display: flex;
+    height: 50px;
+    justify-content: center;
+    align-items: center;
+    width: 100%;
+    margin: 0 auto;
+    padding: 0 10px;
+}
+
+.search-wrapper {
+    width: 30%;
+    padding: 0 10px;
+
+}
+
+.store-list-wrapper {
+    flex: 1;
+
+    width: 100%;
+    overflow-y: auto;
+    overflow-x: hidden;
+
+}
+
+.list-items {
+    width: 100%;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-wrap: wrap;
+}
+
+.list-item {
+    width: 40%;
+    height: 120px;
+    margin: 10px auto;
+    display: flex;
+    padding: 8px;
+    border: 1px solid #CCCCCC88;
+    border-radius: 6px;
+}
+
+.list-item:hover {
+    border: none;
+    box-shadow: 0 0 5px 5px #EEEEEECC;
+}
+
+.img-hotel {
+    width: 45%;
+    height: 90%;
+    margin-right: 10px;
+}
+
+.no-img {
+    background-color: #AAAAAA;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    color: #FFFFFF;
+}
+
+.img-hotel img {
+    width: 100%;
+    height: auto;
+}
+
+.hotel-name {
+    color: #666666;
+}
+
+.hotel-address {
+    display: flex;
+    align-items: center;
+    color: #aaaaaa;
+    flex: 1;
+}
+
+.right-temp {
+    display: flex;
+    flex-direction: column;
+    width: 100%;
+}
+
+.divi {
+    flex: 1;
+}
+
+.hotel-status {
+    width: 100%;
+    text-align: right;
+}
+
+.wait-check {
+    color: #aaaaaa;
+}
+
+.check-faild {
+    color: #A00;
+}
+</style>

+ 133 - 0
src/views/hotel/newHotelForm.vue

@@ -0,0 +1,133 @@
+<template>
+    <a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 17 }" @submit="handleSubmit">
+        <a-form-item label="酒店名称">
+            <a-input class="short-anl" placeholder="请填写酒店名称"
+                v-decorator="['name', { rules: [{ required: true, message: '请填写酒店名称!' }] }]" />
+        </a-form-item>
+
+        <a-form-item label="酒店联系人">
+            <a-input class="short-anl" placeholder="请填写酒店联系人"
+                v-decorator="['linkName', { rules: [{ required: true, message: '请填写酒店联系人!' }] }]" />
+        </a-form-item>
+
+        <a-form-item label="酒店联系人电话">
+            <a-input class="short-anl" placeholder="请填写酒店联系人电话"
+                v-decorator="['linkTel', { rules: [{ required: true, message: '请填写酒店联系人电话!' }] }]" />
+        </a-form-item>
+
+        <a-form-item label="酒店电话">
+            <a-input class="short-anl" placeholder="请填写酒店电话"
+                v-decorator="['tel', { rules: [{ required: true, message: '请填写酒店电话!' }] }]" />
+        </a-form-item>
+
+        <a-form-item label="酒店地址">
+            <a-input class="short-anl" placeholder="请填写酒店地址"
+                v-decorator="['address', { rules: [{ required: true, message: '请填写酒店地址!' }] }]" />
+        </a-form-item>
+
+
+        <a-form-item label="经纬度">
+            <a-input style="width: 50%;" placeholder="经纬度"
+                v-decorator="['latlng', { rules: [{ required: true, message: '请填写经纬度!' }] }]" />
+            <a-button-group>
+                <a-button type="primary"> <a-icon type="thunderbolt" />快速获取 </a-button>
+                <a-button type="primary"><a-icon type="environment" />地图选点</a-button>
+            </a-button-group>
+        </a-form-item>
+
+
+        <a-form-item label="酒店星级">
+            <a-radio-group v-decorator="['star',{ rules: [{ required: true, message: '请选择星级!' }] }]">
+                <a-radio-button value="1">
+                    一星及以下/经济
+                </a-radio-button>
+                <a-radio-button value="2">
+                    二星/实惠
+                </a-radio-button>
+                <a-radio-button value="3">
+                    三星/舒适
+                </a-radio-button>
+                <a-radio-button value="4">
+                    四星/高档
+                </a-radio-button>
+                <a-radio-button value="5">
+                    五星/豪华
+                </a-radio-button>
+            </a-radio-group>
+        </a-form-item>
+
+        <a-form-item label="总房间数">
+            <a-input-number placeholder="1~9999" style="width: 180px;" :min="1" :max="9999"  v-decorator="['roomCount', { rules: [{ required: true, message: '1~9999' }], }]"/>
+        </a-form-item>
+
+        
+
+
+        <a-form-item label="集团品牌">
+            <a-select class="short-anl" v-decorator="[
+                'companyBrand', ]" placeholder="请选择" @change="handleSelectChange">
+                <a-select-option value="2">
+                    七天连锁酒店
+                </a-select-option>
+                <a-select-option value="3">
+                    一曼酒店
+                </a-select-option>
+                <a-select-option value="4">
+                    长房地产
+                </a-select-option>
+            </a-select>
+        </a-form-item>
+
+        <a-form-model-item  label="酒店介绍" class="j-field-content">
+            <j-editor v-model="form_editor_content" />
+          </a-form-model-item>
+
+        <!-- <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
+            <a-button type="primary" html-type="submit">
+                Submit
+            </a-button>
+        </a-form-item> -->
+    </a-form>
+</template>
+
+<script>
+import { newHotel } from '../../api/hotel';
+
+export default {
+    data() {
+        return {
+            formLayout: 'horizontal',
+            form: this.$form.createForm(this, { name: 'coordinated' }),
+            form_editor_content:""
+        };
+    },
+    methods: {
+        handleSubmit(e) {
+            // e.preventDefault();
+            this.form.validateFields((err, values) => {
+                if (!err) {
+                    values['lat'] = values.latlng.split(',')[0]
+                    values['lng'] = values.latlng.split(',')[1]
+                    if(this.form_editor_content) values['introduction'] = this.form_editor_content
+                    newHotel(values).then(res=>{
+                        this.$emit('addSuccess');
+                    })
+                    console.log('Received values of form: ', values);
+                }
+            });
+        },
+        handleSelectChange(value) {
+            console.log(value);
+            this.form.setFieldsValue({
+                note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`,
+            });
+        },
+    },
+}
+</script>
+
+<style>
+.short-anl{
+    width: 70%;
+}
+</style>

+ 35 - 0
src/views/settings/components/storeAuthInfo.vue

@@ -0,0 +1,35 @@
+<template>
+    <a-form-model ref="form" :model="model">
+        <a-form-model-item label="门头照" >
+            <j-image-upload class="avatar-uploader" text="上传" v-model="model.ewm" ></j-image-upload>
+          </a-form-model-item>
+          <a-form-model-item label="照片" >
+            <j-image-upload class="avatar-uploader" text="上传" v-model="model.imgList" :isMultiple="true"></j-image-upload>
+          </a-form-model-item>
+          <a-button type="primary" @click="submit">确定</a-button>
+    </a-form-model>
+</template>
+
+<script>
+export default {
+    created() {
+        // alert("这里获取当前缓存门店信息,照片信息");
+    },
+    data() {
+        return {
+            model: {
+                ewm: null,
+                imgList: null
+            }
+        }
+    },
+    methods: {
+        submit() {
+            console.log(this.model)
+        }
+    },
+}
+</script>
+
+<style scoped>
+</style>

+ 35 - 0
src/views/settings/components/storeImages.vue

@@ -0,0 +1,35 @@
+<template>
+    <a-form-model ref="form" :model="model">
+        <a-form-model-item label="门头照" >
+            <j-image-upload class="avatar-uploader" text="上传" v-model="model.ewm" ></j-image-upload>
+          </a-form-model-item>
+          <a-form-model-item label="照片" >
+            <j-image-upload class="avatar-uploader" text="上传" v-model="model.imgList" :isMultiple="true"></j-image-upload>
+          </a-form-model-item>
+          <a-button type="primary" @click="submit">确定</a-button>
+    </a-form-model>
+</template>
+
+<script>
+export default {
+    created() {
+        // alert("这里获取当前缓存门店信息,照片信息");
+    },
+    data() {
+        return {
+            model: {
+                ewm: null,
+                imgList: null
+            }
+        }
+    },
+    methods: {
+        submit() {
+            console.log(this.model)
+        }
+    },
+}
+</script>
+
+<style scoped>
+</style>

+ 47 - 0
src/views/settings/hotelInfo.vue

@@ -0,0 +1,47 @@
+<template>
+    <a-card style="width: 100%; height:100%;">
+        <a-tabs default-active-key="1">
+            <a-tab-pane key="1">
+                <span slot="tab">
+                    <a-icon type="picture" />
+                    门店照片
+                </span>
+                <store-images></store-images>
+            </a-tab-pane>
+            <a-tab-pane key="2">
+                <span slot="tab">
+                    <a-icon type="audit" />
+                    实名信息
+                </span>
+                实名信息
+            </a-tab-pane>
+            <a-tab-pane key="3">
+                <span slot="tab">
+                    <a-icon type="shop" />
+                    门店信息
+                </span>
+                门店信息
+            </a-tab-pane>
+        </a-tabs>
+    </a-card>
+</template>
+
+<script>
+import storeImages from './components/storeImages.vue';
+export default {
+    components:{
+        storeImages
+    },
+    data() {
+        return {
+
+        }
+    }
+}
+</script>
+
+<style scoped>
+.main{
+    height: 70% !important;
+}
+</style>

+ 3 - 5
src/views/user/Login.vue

@@ -127,11 +127,9 @@ export default {
       },
       //登录成功
       loginSuccess () {
-        alert('登录跳转')
-        this.$router.push({ path: "/entey/select_hotel" }).catch((error)=>{
-          debugger
-          console.log('登录跳转首页出错,这个错误从哪里来的:'+error)
-
+        this.$router.push({ path: "/hotel/entry" }).then(re=>{
+        }).catch((ex)=>{
+          console.log('登录跳转首页出错,这个错误从哪里来的::::'+ex)
         })
         this.$notification.success({
           message: '欢迎',