Explorar el Código

Merge branch '管理后台' of http://1.15.137.157:3000/front_end/tingbang into 管理后台

zhangxw hace 3 años
padre
commit
35b12be054

+ 3 - 0
htmldev/dashboard/src/App.vue

@@ -44,6 +44,9 @@ export default {
       immediate: true
     }
   },
+  async created () {
+    await this.$store.dispatch('common/fetchBarList')
+  },
   mounted () {
     const routeName = this.$route.name
     this.activeTab = ['PlaceList', 'PlaceReserve'].findIndex(item => item === routeName) > -1 ? routeName : ''

+ 40 - 2
htmldev/dashboard/src/store/modules/common.js

@@ -1,6 +1,11 @@
+import { apiBarList } from '../../views/place/list/api'
+import { Toast } from 'vant'
+
 const state = {
   phone: '', // 登录手机号
-  token: '' // APP登录
+  token: '', // APP登录
+  BarList: [], // 所有酒吧列表
+  objCurrentBarInfo: {} // 当前所在酒吧
 }
 
 const getters = {
@@ -9,6 +14,12 @@ const getters = {
   },
   token (state) {
     return state.token
+  },
+  BarList (state) {
+    return state.BarList
+  },
+  objCurrentBarInfo (state) {
+    return state.objCurrentBarInfo
   }
 }
 
@@ -18,6 +29,32 @@ const mutations = {
   },
   UPDATE_TOKEN (state, value) {
     state.token = value
+  },
+  UPDATE_BARLIST (state, value) {
+    state.BarList = value
+  },
+  UPDATE_OBJCURRENTBARINFO (state, value) {
+    state.objCurrentBarInfo = value
+  }
+}
+
+const actions = {
+  async fetchBarList ({ commit }) {
+    try {
+      const { data, status, msg } = await apiBarList()
+      if (status) {
+        if (data.length) {
+          commit('UPDATE_BARLIST', data)
+          commit('UPDATE_OBJCURRENTBARINFO', data[0])
+        } else {
+          Toast('门店不存在')
+        }
+      } else {
+        Toast(msg)
+      }
+    } catch (err) {
+      console.log(err)
+    }
   }
 }
 
@@ -25,5 +62,6 @@ export default {
   namespaced: true,
   state,
   getters,
-  mutations
+  mutations,
+  actions
 }

+ 30 - 32
htmldev/dashboard/src/views/place/list/index.vue

@@ -64,6 +64,7 @@
             </div>
           </div>
         </div>
+        <p class="btimap" v-if="booFetch && !item.list.length">暂无数据</p>
       </van-tab>
     </van-tabs>
     <!--选择-->
@@ -177,7 +178,8 @@
           <p class="count">
             <span>预付:</span>
             <span
-              v-if="objCurrentPlaceInfo.place_pre_type === 1">¥{{ objCurrentPlaceInfo.place_price * order_user_num | fen2Yuan
+              v-if="objCurrentPlaceInfo.place_pre_type === 1">¥{{
+                objCurrentPlaceInfo.place_price * order_user_num | fen2Yuan
               }}</span>
             <span v-else>¥{{ objCurrentPlaceInfo.place_price | fen2Yuan }}</span>
           </p>
@@ -195,9 +197,10 @@
 
 <script>
 import { Tabs, Tab, Icon, Popup, Field, Toast, Button } from 'vant'
-import { apiBarList, apiPlaceList, apiPlacePreOrder } from './api'
+import { apiPlaceList, apiPlacePreOrder } from './api'
 import { getCookieValue } from '../../../utils'
 import { platform } from '../../../utils/platform'
+import { mapGetters } from 'vuex'
 
 export default {
   name: 'index',
@@ -212,8 +215,6 @@ export default {
   data () {
     return {
       platform: platform,
-      BarList: [], // 门店列表
-      objCurrentBarInfo: {}, // 当前门店信息
       placeList: [],
       objCurrentPlaceInfo: {}, // 当前座位信息
       active: 0,
@@ -225,10 +226,14 @@ export default {
       order_user_name: '', // 订单联系人姓名
       order_user_sex: '先生', // 订单联系人性别
       order_pay_type: 2, // 支付方式(1微信2支付宝)
-      booLock: false
+      booLock: false,
+      booFetch: false
     }
   },
   computed: {
+    ...mapGetters({
+      objCurrentBarInfo: 'common/objCurrentBarInfo'
+    }),
     phone () {
       return this.$store.getters['common/phone'] || getCookieValue('afhousephone')
     },
@@ -236,13 +241,21 @@ export default {
       return this.$store.getters['common/token'] || getCookieValue('afhousetoken')
     }
   },
-  created () {
+  watch: {
+    'objCurrentBarInfo.id': {
+      immediate: true,
+      handler: function () {
+        console.log(111)
+        this.fetchPlaceList()
+      }
+    }
+  },
+  async created () {
     if (platform.isWeixin) {
       this.order_pay_type = 1
     } else if (platform.isAlipay) {
       this.order_pay_type = 2
     }
-    this.fetchBarList()
   },
   async mounted () {
     await this.$nextTick()
@@ -250,39 +263,24 @@ export default {
   },
   methods: {
     handleChange () {},
-    // 获取门店列表
-    async fetchBarList () {
-      try {
-        const { data, status, msg } = await apiBarList()
-        if (status) {
-          this.BarList = data
-          if (this.BarList.length) {
-            // 暂时只有一家门店
-            const { id } = this.BarList[0]
-            this.bar_id = id
-            this.fetchPlaceList()
-          } else {
-            Toast('门店不存在')
-          }
-        } else {
-          Toast(msg)
-        }
-      } catch (err) {
-
-      }
-    },
     // 获取订座列表
     async fetchPlaceList () {
+      const { id } = this.objCurrentBarInfo
+      if (!id) {
+        return
+      }
       try {
-        const { data, status, msg } = await apiPlaceList(this.bar_id)
+        const { data, status, msg } = await apiPlaceList(id)
         if (status) {
-          const { bar, place } = data
-          this.objCurrentBarInfo = bar
+          const { place } = data
           this.placeList = place
         } else {
           Toast(msg)
         }
-      } catch (err) {}
+        this.booFetch = true
+      } catch (err) {
+        this.booFetch = true
+      }
     },
     handleShowPopup (place, week) {
       if (!(this.phone && this.token)) {

+ 10 - 0
htmldev/dashboard/src/views/place/list/style/index.scss

@@ -584,3 +584,13 @@
     text-align: center;
   }
 }
+
+.btimap {
+  margin-top: 100px;
+  text-align: center;
+  font-size: 16px;
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #736F6F;
+  line-height: 22px;
+}

+ 39 - 34
htmldev/dashboard/src/views/show/plan/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="af-place-list-container">
+  <div class="af-plan-list-container">
     <!--头部-->
     <div class="header">
       <div class="store-name">
@@ -25,18 +25,32 @@
           <p class="week">{{ item.week }}</p>
           <p class="date">{{ item.time }}</p>
         </template>
-        <div class="place-list"
-             v-for="(place, idx) in item.list"
+        <div class="plan-list"
+             v-for="(plan, idx) in item.list"
              :key="idx">
+          <div class="left">
+            <div class="avatar">
+              <img :src="plan.plan_head_url" alt="">
+            </div>
+            <p class="name">
+              <span>{{ plan.plan_author_name }}</span>
+              <span>{{ plan.plan_desc }}</span>
+            </p>
+          </div>
+          <div class="right">
+            <p>{{ plan.plan_start_time }}-{{ plan.plan_end_time }}</p>
+          </div>
         </div>
+        <p class="btimap" v-if="booFetch && !item.list.length">暂无数据</p>
       </van-tab>
     </van-tabs>
   </div>
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import { Tabs, Tab, Toast } from 'vant'
-import { apiBarList, apiShowPlanList } from './api'
+import { apiShowPlanList } from './api'
 import { getCookieValue } from '../../../utils'
 
 export default {
@@ -47,15 +61,17 @@ export default {
   },
   data () {
     return {
-      BarList: [], // 门店列表
-      objCurrentBarInfo: {}, // 当前门店信息
       showPlanList: [],
       active: 0,
       listData: [],
-      bar_id: ''
+      bar_id: '',
+      booFetch: false
     }
   },
   computed: {
+    ...mapGetters({
+      objCurrentBarInfo: 'common/objCurrentBarInfo'
+    }),
     phone () {
       return this.$store.getters['common/phone'] || getCookieValue('afhousephone')
     },
@@ -63,46 +79,35 @@ export default {
       return this.$store.getters['common/token'] || getCookieValue('afhousetoken')
     }
   },
-  created () {
-    this.fetchBarList()
+  watch: {
+    'objCurrentBarInfo.id': {
+      immediate: true,
+      handler: function () {
+        this.fetchShowPlanList()
+      }
+    }
   },
   async mounted () {
     await this.$nextTick()
   },
   methods: {
     handleChange () {},
-    // 获取门店列表
-    async fetchBarList () {
-      try {
-        const { data, status, msg } = await apiBarList()
-        if (status) {
-          this.BarList = data
-          if (this.BarList.length) {
-            // 暂时只有一家门店
-            const { id } = this.BarList[0]
-            this.bar_id = id
-            this.objCurrentBarInfo = this.BarList[0]
-            this.fetchPlaceList()
-          } else {
-            Toast('门店不存在')
-          }
-        } else {
-          Toast(msg)
-        }
-      } catch (err) {
-
+    async fetchShowPlanList () {
+      const { id } = this.objCurrentBarInfo
+      if (!id) {
+        return
       }
-    },
-    // 获取订座列表
-    async fetchPlaceList () {
       try {
-        const { data, status, msg } = await apiShowPlanList(this.bar_id)
+        const { data, status, msg } = await apiShowPlanList(id)
         if (status) {
           this.showPlanList = data
         } else {
           Toast(msg)
         }
-      } catch (err) {}
+        this.booFetch = true
+      } catch (err) {
+        this.booFetch = true
+      }
     }
   }
 }

+ 43 - 85
htmldev/dashboard/src/views/show/plan/style/index.scss

@@ -1,5 +1,5 @@
 @charset "utf-8";
-.af-place-list-container {
+.af-plan-list-container {
   position: relative;
   left: 0;
   top: 0;
@@ -134,114 +134,72 @@
   }
 }
 
-.place-list {
-  position: relative;
-  left: 0;
-  top: 0;
+.plan-list {
   display: flex;
   justify-content: space-between;
-  align-items: center;
-  padding: 22px 20px;
-  border-bottom: 1px solid #EBEBEB;
+  width: 335px;
+  padding: 16px 0;
+  margin: 0 auto;
 
   .left {
-    width: 60%;
+    display: flex;
+    align-items: center;
   }
 
-  .right {
-    width: 40%;
-    text-align: right;
-  }
+  .avatar {
+    width: 54px;
+    height: 54px;
+    margin-right: 10px;
+    border-radius: 50%;
+    overflow: hidden;
 
-  .sell-out {
-    width: 40%;
-    text-align: right;
+    img {
+      display: block;
+      width: 100%;
+    }
   }
 
   .name {
-    font-size: 18px;
-    font-family: PingFangSC-Semibold, PingFang SC;
-    font-weight: 700;
-    color: #1F1E1E;
-    line-height: 25px;
-  }
-
-  .des {
-    max-width: 100%;
-    margin-top: 6px;
-    font-size: 12px;
-    color: #736F6F;
-    line-height: 17px;
-    word-break: break-all;
-  }
-
-  .price {
     display: flex;
-    justify-content: flex-end;
-    align-items: flex-end;
-    color: #D32323;
+    flex-direction: column;
 
     span {
+      word-break: break-all;
+
       &:nth-of-type(1) {
-        font-size: 24px;
-        font-weight: bold;
-        line-height: 28px;
+        font-size: 16px;
+        font-family: PingFangSC-Medium, PingFang SC;
+        font-weight: 500;
+        color: #1F1E1E;
+        line-height: 22px;
       }
 
       &:nth-of-type(2) {
-        font-size: 16px;
-        font-weight: bold;
-        line-height: 26px;
+        margin-top: 4px;
+        font-size: 12px;
+        color: #736F6F;
+        line-height: 17px;
       }
     }
-
-    &.disabled {
-      color: #CCC6C6;
-    }
-  }
-
-  .btn-wrap {
-    display: flex;
-    align-items: center;
-    justify-content: flex-end;
-    margin-top: 3px;
   }
 
-  .btn {
-    font-size: 12px;
-    color: #1F1E1E;
-    line-height: 17px;
-    margin-right: 4px;
-  }
-
-  .sell-out {
-    position: absolute;
-    top: 8px;
-    right: 20px;
-    z-index: 1;
-
-    img {
-      width: 80px;
-      height: 74px;
-    }
-
-    div {
-      position: absolute;
-      right: 0;
-      top: 13px;
-      z-index: 1;
-
-      p {
-        white-space: nowrap;
-      }
-    }
+  .right {
+    padding-top: 9px;
 
-    .sell-des {
-      margin-top: 3px;
+    p {
       font-size: 12px;
-      color: #D32323;
+      color: #736F6F;
       line-height: 17px;
-      text-align: right;
     }
   }
 }
+
+.btimap {
+  margin-top: 100px;
+  text-align: center;
+  font-size: 16px;
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #736F6F;
+  line-height: 22px;
+}