<template>
  <view class="top-bar">
    <!--左边-->
    <view class="titleCls">
      <view>
        <img src="../../static/image/cart/1.png" style="width:100%;height:100%;">
      </view>
      <span class="text"> {{ $t('pageTitle.proName') }}</span>
    </view>
    <!--右边-->
    <view v-if="showRight == '1'" @click="switchIdentity" class="change">
      <!-- {{ $t('pages.index.index.purchaser') }} -->
	  {{ userShop ? '供应商' : '采购商' }}
    </view>
  </view>
</template>

<script>
import {mapGetters} from 'vuex'

export default {
  props: {
    showRight: {
      default: '0',
      type: String,
    }
  },
  mounted() {
    console.log(this.$store.state, "this.$store.state")
  },
  data() {
    return {

    }
  },
  computed: {
    ...mapGetters(['userShop']),
  },
  methods: {
    // 切换身份
    switchIdentity() {
      uni.navigateTo({
        url: '/pages_order/auth/selectionIdentity'
      })
    }
    ,
  }
}
</script>

<style lang="scss" scoped>
// 顶部栏
.top-bar {
  display: flex;
  justify-content: space-between;
  height: 120rpx;
  background-color: $uni-color;

  .titleCls {
    display: flex;
    padding: 20rpx 10rpx;

    .text {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 30rpx;
      color: #FFFFFF;
      margin-left: 20rpx;
    }
  }

  .change {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30%;
    height: 70rpx;
    border-radius: 40rpx;
    color: white;
    font-size: 28rpx;
    margin: 20rpx 10rpx 0 0;
    background: $uni-color;
    border: 1px solid #757986;
    //margin-top: 20rpx;
    border-radius: 40rpx;
  }
}
</style>
