107 lines
2.7 KiB
Vue
107 lines
2.7 KiB
Vue
<template>
|
|
<ai-list v-if="!isShowDetail">
|
|
<template slot="title">
|
|
<ai-title title="积分超市" :isShowBottomBorder="false">
|
|
</ai-title>
|
|
</template>
|
|
<template slot="tabs">
|
|
<el-tabs v-model="currIndex">
|
|
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
|
|
<component :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
</template>
|
|
</ai-list>
|
|
<AddGoods v-else-if="componentName === 'AddGoods'" :params="params" :instance="instance" :dict="dict" @change="onChange"></AddGoods>
|
|
<AddStore v-else-if="componentName === 'AddStore'" :params="params" :instance="instance" :dict="dict" @change="onChange"></AddStore>
|
|
</template>
|
|
|
|
<script>
|
|
import AddGoods from './components/addGoods'
|
|
import AddStore from './components/AddStore'
|
|
import StoreList from './components/StoreList'
|
|
import GoodsList from './components/GoodsList'
|
|
import { mapState } from 'vuex'
|
|
|
|
export default {
|
|
name: 'AppIntegratingSupermarket',
|
|
label: '积分超市',
|
|
|
|
components: {
|
|
GoodsList,
|
|
StoreList,
|
|
AddGoods,
|
|
AddStore
|
|
},
|
|
|
|
props: {
|
|
instance: Function,
|
|
dict: Object,
|
|
permissions: Function
|
|
},
|
|
|
|
computed: {
|
|
...mapState(['user']),
|
|
|
|
tabs () {
|
|
const tabList = [
|
|
{label: '商品信息', name: 'GoodsList', comp: GoodsList, permission: ''},
|
|
{label: '店铺管理', name: 'StoreList', comp: StoreList, permission: ''}
|
|
].filter(item => {
|
|
return true
|
|
})
|
|
|
|
return tabList
|
|
}
|
|
},
|
|
|
|
data () {
|
|
return {
|
|
activeName: 'GoodsList',
|
|
currIndex: '0',
|
|
componentName: '',
|
|
params: {},
|
|
isShowDetail: false
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
onAreaChange () {
|
|
if (this.currIndex === '0') {
|
|
this.$nextTick(() => {
|
|
this.$refs[this.currIndex][0].getList()
|
|
})
|
|
}
|
|
},
|
|
|
|
onChange (data) {
|
|
if (data.type === 'GoodsList') {
|
|
this.componentName = 'GoodsList'
|
|
this.isShowDetail = false
|
|
this.params = data.params
|
|
}
|
|
if (data.type === 'StoreList') {
|
|
this.componentName = 'StoreList'
|
|
this.isShowDetail = false
|
|
this.params = data.params
|
|
}
|
|
|
|
if (data.type === 'AddGoods') {
|
|
this.componentName = 'AddGoods'
|
|
this.isShowDetail = true
|
|
this.params = data.params
|
|
}
|
|
|
|
if (data.type === 'AddStore') {
|
|
this.componentName = 'AddStore'
|
|
this.isShowDetail = true
|
|
this.params = data.params
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
</style>
|