<template><page-meta :root-font-size="fontSize+'px'"></page-meta>
    <seller-base :show="false">
    <view class="div container">
        <view class="div common-header-wrap">
            <view :style="'height:'+navHeight+'px'"></view>
            <view class="common-header-holder"></view>
            <view class="common-header-fixed">
            <title-header />
            <uni-nav-bar title="设置" class="common-header" left-icon="back" @clickLeft="goBack()">
            </uni-nav-bar>
        </view>
        </view>
        <view class="div main-content">
            <view class="div"  @click="goSettingInfo">
                <flex-line :is-link="true" :show-border="true"><text class="span line-name">店铺管理</text></flex-line>
            </view>
            <view class="div pt-10 pb-10">
                <view class="div common-btn ds-button-large" @click="logout">退出登录</view>
            </view>
        </view>
    </view>
</seller-base>
</template>

<script>
import {getFontSize} from '@/util/common'
import TitleHeader from '../../TitleHeader'
import SellerBase from '../SellerBase'
import { mapState, mapMutations } from 'vuex'

import { logout } from '../../../api/seller'
import flexLine from '../../flexLine'
export default {
  name: 'Index',
  data(){
    return {
      navHeight:0
    }
  },
  computed:{
    fontSize(){
      return getFontSize()
    },
    ...mapState({
      seller: state => state.seller.info
    })
  },
  components:{ TitleHeader, SellerBase, flexLine },
  mounted(){
  // #ifdef  MP-WEIXIN
  this.navHeight = uni.getMenuButtonBoundingClientRect().height
  // #endif
  },
  methods:{
    goBack(){uni.navigateBack({delta:1})},
    ...mapMutations({
      sellerLogout: 'sellerLogout'
    }),
    logout () {
      logout(this.seller.seller_name).then(res => {
        this.sellerLogout()
        uni.navigateTo({url:'/pages/home/sellerlogin/Login'})
      }).catch(function (error) {
        uni.showToast({icon:'none',title: error.message})
      })
    },
    goSettingInfo () {
      uni.navigateTo({url:'/pages/seller/setting/Info'})
    }

  }
}
</script>

<style scoped lang="scss">
.main-content{background: #fff;padding:0 $pageSpace}
</style>
