|
@@ -197,9 +197,10 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { Tabs, Tab, Icon, Popup, Field, Toast, Button } from 'vant'
|
|
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 { getCookieValue } from '../../../utils'
|
|
import { platform } from '../../../utils/platform'
|
|
import { platform } from '../../../utils/platform'
|
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'index',
|
|
name: 'index',
|
|
@@ -214,8 +215,6 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
platform: platform,
|
|
platform: platform,
|
|
- BarList: [], // 门店列表
|
|
|
|
- objCurrentBarInfo: {}, // 当前门店信息
|
|
|
|
placeList: [],
|
|
placeList: [],
|
|
objCurrentPlaceInfo: {}, // 当前座位信息
|
|
objCurrentPlaceInfo: {}, // 当前座位信息
|
|
active: 0,
|
|
active: 0,
|
|
@@ -232,6 +231,9 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
|
|
+ ...mapGetters({
|
|
|
|
+ objCurrentBarInfo: 'common/objCurrentBarInfo'
|
|
|
|
+ }),
|
|
phone () {
|
|
phone () {
|
|
return this.$store.getters['common/phone'] || getCookieValue('afhousephone')
|
|
return this.$store.getters['common/phone'] || getCookieValue('afhousephone')
|
|
},
|
|
},
|
|
@@ -239,13 +241,21 @@ export default {
|
|
return this.$store.getters['common/token'] || getCookieValue('afhousetoken')
|
|
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) {
|
|
if (platform.isWeixin) {
|
|
this.order_pay_type = 1
|
|
this.order_pay_type = 1
|
|
} else if (platform.isAlipay) {
|
|
} else if (platform.isAlipay) {
|
|
this.order_pay_type = 2
|
|
this.order_pay_type = 2
|
|
}
|
|
}
|
|
- this.fetchBarList()
|
|
|
|
},
|
|
},
|
|
async mounted () {
|
|
async mounted () {
|
|
await this.$nextTick()
|
|
await this.$nextTick()
|
|
@@ -253,34 +263,16 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
handleChange () {},
|
|
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 () {
|
|
async fetchPlaceList () {
|
|
|
|
+ const { id } = this.objCurrentBarInfo
|
|
|
|
+ if (!id) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
- const { data, status, msg } = await apiPlaceList(this.bar_id)
|
|
|
|
|
|
+ const { data, status, msg } = await apiPlaceList(id)
|
|
if (status) {
|
|
if (status) {
|
|
- const { bar, place } = data
|
|
|
|
- this.objCurrentBarInfo = bar
|
|
|
|
|
|
+ const { place } = data
|
|
this.placeList = place
|
|
this.placeList = place
|
|
} else {
|
|
} else {
|
|
Toast(msg)
|
|
Toast(msg)
|