|
@@ -197,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',
|
|
@@ -214,8 +215,6 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
platform: platform,
|
|
|
- BarList: [], // 门店列表
|
|
|
- objCurrentBarInfo: {}, // 当前门店信息
|
|
|
placeList: [],
|
|
|
objCurrentPlaceInfo: {}, // 当前座位信息
|
|
|
active: 0,
|
|
@@ -232,6 +231,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ objCurrentBarInfo: 'common/objCurrentBarInfo'
|
|
|
+ }),
|
|
|
phone () {
|
|
|
return this.$store.getters['common/phone'] || getCookieValue('afhousephone')
|
|
|
},
|
|
@@ -239,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()
|
|
@@ -253,34 +263,16 @@ 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)
|