<template>
  <view class="gather">
    <zbpSwiper></zbpSwiper>
    <u-empty :show="jurisdiction" marginTop="260" mode="permission" :text="emptyText"
      icon="http://cdn.uviewui.com/uview/empty/permission.png"></u-empty>
    <block v-if="isLogin">
      <!-- <view class="special_work com" v-if="userInfoData.mer_info.type_id === 12"> -->
      <view class="special_work com" v-if="true">
        <view class="title">市级供应链</view>
        <view class="content">
          <view class="examine" @click="navigator(`/pages/nongKe/supply_chain/goods_list?merid=${mer_id}`)">
            <image class="icon_img" :src="`${prefix}zsgl.png`" mode="aspectFill"></image>
            <text class="text">在售管理</text>
          </view>
          <view class="examine" @click="navigator(`/pages/admin/order/index?mer_id=${mer_id}&product_type=98`)">
            <image class="icon_img" :src="`${prefix}cwgl.png`" mode="aspectFill"></image>
            <text class="text">财务管理</text>
          </view>
          <view class="examine" @click="navigator(`/pages/nongKe/gather/select_warehouse?mer_id=${mer_id}&stype=1`)">
            <image class="icon_img" :src="`${prefix}rkgl.png`" mode="aspectFill">
            </image>
            <text class="text">入库管理</text>
          </view>
          <view class="examine" @click="navigator(`/pages/product/basicSet?mer_id=${mer_id}&product_type=98`, '商户设置')">
            <image class="icon_img" :src="`${prefix}shsz.png`" mode="aspectFill"></image>
            <text class="text">商户设置</text>
          </view>
          <view class="examine" @click="navigator(`/pages/product/list/index?mer_id=${mer_id}`)">
            <image class="icon_img" :src="`${prefix}spgl.png`" mode="aspectFill">
            </image>
            <text class="text">商品管理</text>
          </view>
          <view class="examine" @click="navigator(`/pages/users/embody/embody?mer_id=${mer_id}`)">
            <image class="icon_img" :src="`${prefix}txgl.png`" mode="aspectFill">
            </image>
            <text class="text">提现管理</text>
          </view>
          <view class="examine" @click="navigator(`/pages/nongKe/teach_video/teach_video`)">
            <image class="icon_img" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/spjs.png"
              mode="aspectFill">
            </image>
            <text class="text">视频教学</text>
          </view>
        </view>
      </view>

      <!-- <view class="business com" v-if="userInfoData.mer_info.type_id === 10"> -->
      <view class="business com" v-if="true">
        <view class="special_work com">
          <view class="title">我的店铺</view>
          <view class="content ">
            <view class="examine"
              @click="navigator(`/pages/nongKe/supply_chain/supplier?type_id=12&isDetail=1&product_type=98`)">
              <image class="icon_img" :src="`${prefix}ghcg.png`" mode="aspectFill"></image>
              <text class="text">供货采购</text>
            </view>
            <view class="examine" @click="navigator('/pages/nongKe/supply_chain/purchase_control')">
              <image class="icon_img" :src="`${prefix}jhgl.png`" mode="aspectFill"></image>
              <text class="text">进货管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/admin/stockOut/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}smck.png`" mode="aspectFill">
              </image>
              <text class="text">扫码出库</text>
            </view>
            <view class="examine" @click="navigator(`/pages/nongKe/gather/select_warehouse?mer_id=${mer_id}&stype=2`)">
              <image class="icon_img" :src="`${prefix}rkgl.png`" mode="aspectFill">
              </image>
              <text class="text">入库管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/users/embody/embody?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}txgl.png`" mode="aspectFill">
              </image>
              <text class="text">提现管理</text>
            </view>

            <view class="examine" @click="navigator(`/pages/chat/customer_list/index?type=1&mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}kfjl.png`" mode="aspectFill">
              </image>
              <text class="text">客服记录</text>
            </view>
            <view class="examine" @click="navigator(`/pages/admin/order_cancellation/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}ddhx.png`" mode="aspectFill">
              </image>
              <text class="text">订单核销</text>
            </view>
            <view class="examine" @click="navigator(`/pages/admin/order/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}ddgl.png`" mode="aspectFill">
              </image>
              <text class="text">订单管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/product/list/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}spgl.png`" mode="aspectFill">
              </image>
              <text class="text">商品管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/product/basicSet?mer_id=${mer_id}`, '商户设置')">
              <image class="icon_img" :src="`${prefix}shsz.png`" mode="aspectFill">
              </image>
              <text class="text">商户设置</text>
            </view>

          </view>
        </view>

        <!-- <gatherBusiness :userInfoData="userInfoData" /> -->
      </view>

      <!-- <view class="business com" v-if="userInfoData.mer_info.type_id === 11"> -->
      <view class="business com" v-if="true">
        <view class="special_work com">
          <view class="title">里海云仓</view>
          <view class="content ">
            <view class="examine"
              @click="navigator(`/pages/nongKe/supply_chain/supplier?type_id=12&isDetail=1&product_type=98`)">
              <image class="icon_img" :src="`${prefix}ghcg.png`" mode="aspectFill"></image>
              <text class="text">供货采购</text>
            </view>
            <view class="examine" @click="navigator('/pages/nongKe/supply_chain/purchase_control')">
              <image class="icon_img" :src="`${prefix}jhgl.png`" mode="aspectFill"></image>
              <text class="text">进货管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/admin/stockOut/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}smck.png`" mode="aspectFill">
              </image>
              <text class="text">扫码出库</text>
            </view>
            <view class="examine" @click="navigator(`/pages/nongKe/gather/select_warehouse?mer_id=${mer_id}&stype=2`)">
              <image class="icon_img" :src="`${prefix}rkgl.png`" mode="aspectFill">
              </image>
              <text class="text">入库管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/users/embody/embody?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}txgl.png`" mode="aspectFill">
              </image>
              <text class="text">提现管理</text>
            </view>

            <view class="examine" @click="navigator(`/pages/chat/customer_list/index?type=1&mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}kfjl.png`" mode="aspectFill">
              </image>
              <text class="text">客服记录</text>
            </view>
            <view class="examine" @click="navigator(`/pages/admin/order_cancellation/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}ddhx.png`" mode="aspectFill">
              </image>
              <text class="text">订单核销</text>
            </view>
            <view class="examine" @click="navigator(`/pages/admin/order/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}ddgl.png`" mode="aspectFill">
              </image>
              <text class="text">订单管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/product/list/index?mer_id=${mer_id}`)">
              <image class="icon_img" :src="`${prefix}spgl.png`" mode="aspectFill">
              </image>
              <text class="text">商品管理</text>
            </view>
            <view class="examine" @click="navigator(`/pages/product/basicSet?mer_id=${mer_id}`, '商户设置')">
              <image class="icon_img" :src="`${prefix}shsz.png`" mode="aspectFill">
              </image>
              <text class="text">商户设置</text>
            </view>

          </view>
        </view>
      </view>
    </block>
    <!-- <m-tabbar native>
      <template v-slot:tabbar_index_2>
        <view class="custom_style">
          <view class="custom_style_icon"></view>
        </view>
      </template>
    </m-tabbar> -->
  </view>
</template>

<script>
  import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
  import zbpSwiper from '@/components/zbpSwiper'
  import { mapState, mapGetters } from 'vuex'
  import { getWorkArticleCount, getSlideAPI } from '@/api/article.js'
  import { getStoreList, getUserInfo } from '@/api/user.js'
  import { microSeachBarCode, microEadtProduct } from '@/api/store.js'
  import { Toast } from '@/libs/uniApi';
  import { getDiy } from '@/api/api.js'
  export default {
    components: {
      mTabbar,
      zbpSwiper
    },
    data() {
      return {
        emptyText: '暂无可用应用',
        jurisdiction: false, // 是否有权限
        mer_id: '',
        userInfoData: { mer_info: { type_id: 0 } },
        prefix: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/11/',
      };
    },
    computed: {
      ...mapGetters(['userInfo', 'location', 'isLogin'])
    },
    created() {},
    onLoad() {},
    onShow() {
      if (this.isLogin) {
        this.emptyText = '暂无可用应用'
      } else {
        this.emptyText = '请登录'
        this.jurisdiction = true
      }
      this.getUserInfo()
    },
    onPullDownRefresh() {
      this.getUserInfo()
      uni.stopPullDownRefresh()
    },
    methods: {
      navigator(url, t) {
        // if (this.userInfoData.is_wsxx === 0 && t != '商户设置') return Toast("请完善商户信息");
        uni.navigateTo({
          url: url
        })
      },
      getUserInfo: function() {
        let that = this;
        getUserInfo().then(res => {
          that.userInfoData = res.data;
          this.mer_id = res.data.service.mer_id
          if (!res.data.mer_info) {
            that.$set(this, 'jurisdiction', true);
          }
        });
      }
    }
  };
</script>
<style lang="scss" scoped>
  .gather {
    padding-bottom: 164.91rpx;
    background: linear-gradient(180deg, #FFFFFF 0%, #F6F6F6 100%);
  }

  .top_box {
    // padding-top: 180rpx;
    background: linear-gradient(#36A2FF, #fff);
  }

  .com {
    margin-left: 50%;
    transform: translate(-50%);
  }

  .business {
    width: 694.74rpx;
    // margin-bottom: 175rpx;
  }

  .special_work {
    // padding: 17.54rpx;
    width: 694.74rpx;
    margin-top: 52.63rpx;
    border-radius: 17.54rpx;
    // box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);

    .title {
      font-size: 31.58rpx;
      font-weight: 700;
      margin-bottom: 38.6rpx;
    }

    .content {
      display: flex;
      align-content: center;
      flex-wrap: wrap;
      // justify-content: space-between;

      .examine {
        margin-bottom: 35rpx;
        width: 173.68rpx;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        // margin: 0 0 33.33rpx 33.33rpx !important;

        .icon_img {
          width: 63.16rpx;
          height: 63.16rpx;
        }

        .text {
          font-size: 26.32rpx;
          margin-top: 21.05rpx;
          color: #000;
        }
      }

      .text {
        font-size: 29.82rpx;
        color: #a4a4a4;
      }
    }

    .cont_jus {
      margin-top: 56.14rpx;
      justify-content: flex-start;

      &:first-child {
        // margin-right: 33rpx;
      }

      .examine {
        margin-right: 48rpx;

        &:first-child {
          margin-right: 48rpx;
        }
      }
    }
  }
</style>