<style scoped>
.tabbarMain {
  height: 100upx;
  position: fixed;
  z-index: 50;
  flex: 1;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999999;
  border-top: 1upx solid #ddd;
  padding-top: 96rpx;
  background: #fff;
}
.tabbarMainIphone {
  height: 156upx;
  padding-bottom: 64upx;
}
.tabBtnMina {
  width: 750upx;
  height: 88upx;
  position: absolute;
  z-index: 2;
  bottom: 0;
  flex-direction: row;
  /* #ifndef */
  padding-bottom: constant(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-top);
  /* #endif */
  display: flex;
  left: 0;
  right: 0;
  z-index: 99999999;
}
.tabBtnMinaIphone {
  height: 156upx;
  padding-bottom: 64upx;
}
.imgse {
  /* width: 48upx; */
  height: 48upx;
  width: auto;
}
.txtBtn {
  font-size: 24upx;
  color: #666666;
}
.txtBtnSel {
  font-size: 24upx;
  color: #333333;
}
.itmMain {
  /* width: 250upx; */
  width: 150upx;
  flex: 1;
  justify-content: center;
  align-items: center;
  display: flex;
  flex-direction: column;
}
.imgseTs {
  width: 150upx;
  height: 140upx;
  margin-bottom: 90upx;
  position: relative;
  z-index: 1;
  bottom: 0upx;
}

.btnfixMin {
  width: 750upx;
  height: 178upx;
  position: absolute;
  z-index: 1;
  bottom: 0;
}
.btnfixMinIphone {
  bottom: 64upx;
}
.fixTpm {
  width: 150upx;
  height: 140upx;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 0;
}
.imgseTsAnds {
  width: 150upx;
  height: 150upx;
  position: fixed;
  z-index: 1;
  bottom: 10upx;
  border-radius: 150upx;
}
</style>
<template>
  <view>
    <view>
      <view
        class="tabbarMain"
        :class="[flagTypeInfo ? 'tabbarMainIphone' : '']"
        v-if="navs && navs.length > 0"
      >
        <view
          class="tabBtnMina"
          :class="[flagTypeInfo ? 'tabBtnMinaIphone' : '']"
          mode=""
        >
          <view
            class="itmMain"
            v-for="(x, i) in navs"
            :key="i"
            @click.stop="goUrl(x.url)"
          >
            <image
              class="imgse"
              :fade-show="false"
              v-if="active != i"
              mode="heightFix"
              :src="x.icon"
            ></image>
            <image
              class="imgse"
              :fade-show="false"
              v-if="active === i"
              mode="heightFix"
              :src="x.active_icon"
            ></image>
            <text
              class="txtBtn"
              :style="{ color: active == i ? x.active_color : x.color }"
              >{{ x.text }}</text
            >
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      active: 0,
      platforms: "",
      leftWidth: 0,
      flagTypeInfo: false,
      crtPath: "",
      isShowIcon: 1,
      navs:[{
					url:"/pages/MallMange/index",
					icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/home2.png",
					active_icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/home.png",
					color:"#CCCED5",
					active_color:"#446dfc",
					text:"首页",
				},{
					url:"/pages/MallMange/order",
					icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/order_fill2.png",
					active_icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/order_fill.png",
					color:"#CCCED5",
					active_color:"#446dfc",
					text:"订单",
				},
        // {
				// 	url:"/pages/MallMange/goods",
				// 	icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/goods2.png",
				// 	active_icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/goods.png",
				// 	color:"#CCCED5",
				// 	active_color:"#446dfc",
				// 	text:"商品",
				// },
        {
					url:"/pages/MallMange/set",
					icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/setup-fill2.png",
					active_icon:"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/setup-fill.png",
					color:"#CCCED5",
					active_color:"#446dfc",
					text:"设置",
				}]
    };
  },
  mounted() {
    this.flagTypeInfo = this.$uiConfig.is_bang;
    let tempSystem = uni.getSystemInfoSync();
    this.platforms = tempSystem.platform;
    this.$nextTick(() => {
      // #ifdef APP-NVUE || APP-PLUS || APP-PLUS-NVUE ||APP-VUE
      if (this.platforms == "android") {
        let temp = this.$refs.leftWidth;
        this.leftWidth = tempSystem.screenWidth / 2;
      }
      // #endif
    });
    this.activeHandler();
  },
  methods: {
    activeHandler() {
      let t = getCurrentPages();
      let query = t[t.length - 1].__displayReporter.query;
      let queryString = "";
      for (var k in query) {
        queryString += `&${k}=${query[k]}`;
      }
      if (queryString != "") {
        queryString = "?" + queryString.substring(1, queryString.length);
      }
      this.crtPath = "/" + t[t.length - 1].route + queryString;
      this.navs.forEach((x, i) => {
        if (x.url == this.crtPath) {
          this.active = i;
        }
      });
    },
    goUrl(url) {
      if (this.crtPath != url) {
        uni.redirectTo({
          url: url,
        });
      } else {
        uni.reLaunch({
          url: url,
        });
      }
    },
  },
};
</script>
