<template>
  <view class="gather">

    <!-- <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}6/oaimg10%402x.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}6/oaimg11%402x.png`" mode="aspectFill"></image>
          <text class="text">财务管理</text>
        </view>
        <view class="examine" @click="navigator(`/pages/nongKe/gather/select_warehouse?mer_id=${mer_id}`)">
          <image class="icon_img" :src="`${prefix}6/oaimg8%402x.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}6/oaimg4%402x.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}6/oaimg3%402x.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}6/oaimg21%402x.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=11`)">
            <image class="icon_img" :src="`${prefix}6/oaimg6%402x.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}6/oaimg7%402x.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}6/oaimg9%402x.png`" mode="aspectFill">
            </image>
            <text class="text">扫码出库</text>
          </view>
          <view class="examine" @click="navigator(`/pages/nongKe/gather/select_warehouse?mer_id=${mer_id}`)">
            <image class="icon_img" :src="`${prefix}6/oaimg8%402x.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}6/oaimg3%402x.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}6/oaimg1%402x.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}6/oaimg2%402x.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}6/oaimg5%402x.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}6/oaimg3%402x.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}6/oaimg4%402x.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`)">
            <image class="icon_img" :src="`${prefix}6/oaimg6%402x.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}6/oaimg7%402x.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}6/oaimg9%402x.png`" mode="aspectFill">
            </image>
            <text class="text">扫码出库</text>
          </view>
          <view class="examine" @click="navigator(`/pages/nongKe/gather/select_warehouse?mer_id=${mer_id}`)">
            <image class="icon_img" :src="`${prefix}6/oaimg8%402x.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}6/oaimg3%402x.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}6/oaimg1%402x.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}6/oaimg2%402x.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}6/oaimg5%402x.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}6/oaimg3%402x.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}6/oaimg4%402x.png`" mode="aspectFill">
            </image>
            <text class="text">商户设置</text>
          </view>

        </view>
      </view>

    </view>
    <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>
  var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
  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 { getIndexData } from '@/api/api.js'
  export default {
    components: {
      mTabbar
    },
    data() {
      return {
        product_id: '',
        editGoodsCode: '',
        editGoodsName: '',
        editGoodsPrice: '',
        editGoodsStore: '',
        editGoodsShow: false, // 扫码修改商品信息
        mer_id: '',
        statusBarHeight: statusBarHeight, //系统导航条高度
        userInfoData: { mer_info: { type_id: 0 } },
        prefix: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/',
        page: 0,
        group_id: 1,
        count: {
          shuqiu: 0,
          solve_count: 0,
          time: 0
        },
        loading: true,
        //消息提示图标
        xiaoxi: {
          maodun: 0,
          saohei: 0,
          shuqiu: 0,
          sos: 0,
          xiejiao: 0
        },
        swiper: {
          url: [{
            img: ''
          }],
          indicatorDots: true, // 显示面板指示点
          vertical: false, // 滑动方向是否为纵向
          autoplay: true, // 是否自动切换
          interval: 2000, // 自动切换时间间隔
          duration: 500 // 滑动动画时长
        },
      };
    },
    computed: {
      ...mapGetters(['userInfo', 'location'])
    },
    created() {},
    onLoad() {
      uni.hideTabBar()
      this.getBanner()
    },
    onShow() {
      //获取商家
      this.getUserInfo()
      this.group_id = this.userInfo.group_id
      this.get_count()

    },
    // 下拉刷新
    onPullDownRefresh() {
      this.getUserInfo()
      this.get_count()
      // 停止刷新
      uni.stopPullDownRefresh()
    },
    methods: {
      // 轮播图请求
      async getBanner() {
        const { data } = await getIndexData()
        this.swiper.url = data.banner
      },
      async editGoodsClose() {
        const data = {
          price: this.editGoodsPrice,
          stock: this.editGoodsStore,
          id: this.product_id
        }
        const res = await microEadtProduct(data)
        this.editGoodsShow = false
      },
      // 扫码核销
      scanCode() {
        if (this.userInfoData.is_wsxx === 0) return Toast("请完善商户信息")
        uni.navigateTo({
          url: `/pages/nongKe/gather/select_warehouse?mer_id=${this.mer_id}`
        })
      },
      handeGo() {
        uni.navigateTo({
          url: `/pages/shopping/shopping?mer_id=${this.userInfoData.service.mer_id}`
        })
      },
      navigator(url, t) {
        console.log('t', 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
        });
      },
      CompanyCertification() {
        uni.navigateTo({
          url: '/pages/users/enter_company/enter_company'
        })
      },
      navCeshi() {
        uni.showToast({
          title: "功能暂未开放",
          icon: 'none'
        })
      },
      purchase() {
        uni.navigateTo({
          url: '/pages/purchase/index'
        })
      },

      // 跳议事大厅
      voteList() {
        uni.navigateTo({
          url: '/pages/nongKe/article/vote_list'
        });
      },
      navOpen(id, title, title2) {
        uni.navigateTo({
          url: '/pages/nongKe/article/open_list?category_id=' + id + '&title=' + title + '&title2=' +
            title2
        });
      },
      //合集文章
      IndexArticle(id, title, title2, is_vote, time) {
        let is_time = 0
        if (time) {
          is_time = time
        }
        uni.navigateTo({
          url: '/pages/nongKe/article/list?category_id=' + id + '&title=' + title + '&title2=' + title2 +
            '&is_vote=' +
            is_vote + '&is_time=' + is_time
        });
      },

      // 跳转党务公开
      partyOpen() {
        uni.navigateTo({
          url: '/pages/nongKe/party/article/list'
        });
      },

      // 采集信息 、 信息录入
      peasantMsg() {
        uni.navigateTo({
          url: '/pages/nongKe/gather/entering'
        });
      },
      // 保存
      get_count() {
        getWorkArticleCount().then(res => {
          this.count = res
          this.loading = false
          //消息提示图标
          this.xiaoxi = this.count.one
        })
      }
    }
  };
</script>
<style lang="scss" scoped>
  .gather {
    padding-bottom: 164.91rpx;
    /* #ifdef MP || MP-WEIXIN */
    padding-top: 43.86rpx;
    /* #endif */
  }

  page {
    background-color: #fff;
  }

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

  // 轮播图
  .supply_chains-head {
    margin-bottom: 31.58rpx;

    .swiper {
      width: 100%;
      height: 500rpx;
      // margin: 0 auto;

      .swi_item {
        width: 100%;
        height: 500rpx;
        // border-radius: 8px;
      }
    }
  }

  .work_header {
    width: 693.93rpx;
    height: 230rpx;
    color: #fff;
    margin: 0 auto;
    position: relative;
    margin-bottom: 21rpx;

    .w_top {
      width: 693.93rpx;
      height: 184.25rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      color: #fff;
      font-size: 25rpx;
      padding-left: 25rpx;
      padding-right: 7rpx;
      background: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/5/oabg1%402x.png') no-repeat;
      background-size: 693.93rpx 184.25rpx;

      .yun {
        font-weight: bold;
        font-size: 42rpx;
      }
    }

    .message_box {
      padding: 0 43.86rpx;
      width: 719.3rpx;
      height: 78.95rpx;
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translate(-50%, 53%);
      background-image: url("http://lihai001.oss-cn-chengdu.aliyuncs.com/storage/202303/4e5e92a2c82ee6af76ede722194924ed.jpg");
      background-size: cover;
      background-repeat: no-repeat;
    }

    .tenant_name {
      font-size: 42.11rpx;
      font-weight: bold;
    }

    .tabs_box {
      padding: 35.09rpx 0 70.18rpx 0;

      .tab_item {
        font-size: 24.56rpx;
        padding: 17.54rpx 21.05rpx;
        border-radius: 4px;
        border: 1px solid #fff;
        margin-right: 19.3rpx;

        &:last-child {
          margin-right: 0;
        }
      }

    }
  }

  .shop_box {
    width: 694rpx;
    height: 79rpx;
    background: linear-gradient(207deg, #2199FC 0%, #2D96FF 100%);
    box-shadow: 0rpx -4rpx 14rpx 2rpx rgba(25, 106, 170, 0.68);
    border-radius: 0rpx 0rpx 14rpx 14rpx;
    margin: 0 auto;
    position: absolute;
    bottom: 6rpx;
    display: flex;
    justify-content: space-between;
    font-size: 28rpx;
    align-items: center;
    padding-left: 32rpx;
    padding-right: 26rpx;

    .s_shop {
      font-size: 32rpx;
    }
  }

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

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

  .topCard {
    color: #fff;
    width: 694.74rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .title {
      font-size: 28.07rpx;

      .num {
        font-size: 82.46rpx;
      }
    }

    .card_left {
      width: 331.58rpx;
      height: 336.84rpx;
      border-radius: 14.04rpx;
      padding: 21.05rpx 35.09rpx;
      background-size: cover;
      background: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/5/oabg3%402x.png') no-repeat;
      background-size: 331rpx 336rpx;
    }

    .card_right {

      .postpone,
      .over {
        padding: 21.05rpx 35.09rpx;
        width: 331.58rpx;
        height: 159.65rpx;
        background-size: cover;
        background-repeat: no-repeat;
        border-radius: 14.04rpx;
        opacity: 1;
      }

      .postpone {
        background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/5/oabg2%402x.png');
      }

      .over {
        margin-top: 17.54rpx;
        background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/5/oabg2%402x.png');
      }
    }
  }

  .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;
        }
      }
    }
  }

  .head-wrapper {
    z-index: 999;
    display: flex;
    align-items: center;
    position: fixed;
    left: 30rpx;
    top: 0;
    /* #ifdef MP */
    height: 43px;
    /* #endif */
    /* #ifdef H5 */
    height: 114rpx;
    /* #endif */
  }

  .head-menu {
    display: flex;
    align-items: center;
    height: 54rpx;
    width: 140rpx;
    background: rgba(0, 0, 0, .25);
    border-radius: 27rpx;

    .iconfont {
      flex: 1;
      text-align: center;
      color: #fff;
      box-sizing: border-box;

      &.icon-xiangzuo {
        border-right: 1px solid #fff;
      }
    }
  }
</style>