<template>
    <div>
        <van-nav-bar title="应急仓库" left-arrow placeholder @click-left="goback" :fixed="true" @click-right="bjclick">
            <template #right>
              <van-icon size="18" name="question-o" />
          <!-- <router-link to="/warehouse/search"><van-icon name="search" size="18" /></router-link> -->
      </template>
    </van-nav-bar>
    <van-sticky>
    <van-search v-model="value1" disabled @click="gosearch" placeholder="请输入搜索关键词" />
    </van-sticky>
    <div v-if="!isempt">
      <div class="content">
        <div class="itemc" v-for="item in cklist" >
          <div class="itemcc">
            <div class="title" @click="gotockedit(item)">{{item.name}}
              <div class="btng">
                <!-- <div class="wbtn"></div> -->
                <div class="hbtn" @click.stop="gotowzedit(item)"></div>
              </div>
            </div>
            <div class="content">
              <div>
                <span class="left-title">管理单位：</span
                ><span class="left-content">{{item.manageUnit}}</span>
              </div>
              <div>
                <span class="left-title">联系人：</span
                ><span class="left-content">{{item.contactName}}</span>
              </div>
              <div>
                <span class="left-title">联系方式：</span
                ><span class="left-content">{{item.contactPhone}}</span>
              </div>
              <div>
                <span class="left-title">地址：</span
                ><span class="left-content"
                  >{{item.address}}</span
                >
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div><van-empty v-if="isempt" description="无仓库" /></div>
  </div>
</template>

<script setup>
import { ref, reactive, onUpdated, onMounted, watch } from 'vue';
import { useCommonStore, useIncidentStore, useMainStore } from '@/store';
import { RouterView, useRoute, useRouter } from 'vue-router';
import {
    api_getckList,
    
} from '@/service/warehouse';
import { Toast, Notify, Dialog } from 'vant';
import { BaseMediaUrl } from '@/utils';
import { upload } from '@/api/common';
import router from '@/router';

const value1 = ref("");

const cklist = ref([])
const gotockedit=(item)=>{
  localStorage.setItem("cck",JSON.stringify(item))
  localStorage.setItem("cedit",false)

  router.push("/warehouse/edit"+(taskid==""?"":`?taskid=${taskid}`))

}
const gotowzedit=(item)=>{
  localStorage.setItem("cck",JSON.stringify(item))
   localStorage.setItem("cedit",false)
  router.push("/warehouse/detail1"+(taskid==""?"":`?taskid=${taskid}`))
}
const gosearch = () => { 
  router.push("/warehouse/search");
}
const bjclick = () => {

  useMainStore().gotohelp("4ebfdaebd5e347f28383b039ed9d11bd");
}
const goback = () => {
  try {
    uni.navigateBack();
  } catch (E) {}
   //window.history.back();
};
let taskid = "";
onMounted(()=>{


  Toast.loading({
    message: '加载中...',
    duration: 0,
    forbidClick: true,
  });
  api_getckList("").then(res=>{
    Toast.clear();
    // console.log(res);
    cklist.value = res.rows;
  })
})

</script>

<style lang="scss">
.content label,
.content span {
    font-size: 15px;
    font-family: PingFangSC, PingFangSC-Regular;
    color: #333333;
}

.bjbtn {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    background: #bb0000;
    padding: 3px 8px;
    border-radius: 2px;
}

.content {
    .itemc {
        padding: 12px 15px;
        padding-bottom: 0;;
        .itemcc {
            background: #ffffff;
            border-radius: 2%;
            box-shadow: 0px 2px 6px 0px rg;
            .title {
                font-size: 16px;
                font-family: PingFangSC, PingFangSC-Medium;
                font-weight: 500;
                padding: 11px 15px;
                border-bottom: 1px solid #f0f2f5;
                position: relative;color:#0b33a8;

                .btng {
                    position: absolute;
                    right:15px;
                    top:11px;
                    .wbtn {
                        background: url("../../assets/icons/incident/storehouse@2x.png");
                        width: 24px;
                        height: 24px;
                        background-size: 100% 100%;
                        display:inline-block;
                        margin-right:16px;
                    }
                    .hbtn {
                        background: url("../../assets/icons/incident/materials@2x.png");
                        width: 24px;
                        height: 24px;
                        background-size: 100% 100%;
                        display:inline-block;
                    }
                }
            }
            .content {
                padding: 11px 15px;
                margin-bottom: 3px;
                font-size: 14px;
                word-wrap: break-word;
                .left-title {
                    color: #999999;
                }
                .left-content {
                    color: rgb(38, 38, 38);
                    word-wrap: break-word;
                }
            }
        }
    }
    .cell-header {
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        line-height: 42px;
        padding: 0px 15px;
        span {
            font-size: 12px;
        }
        div {
            font-size: 14px;
            color: #0b33a8;
        }
    }
}
</style>
