<template>
  <view class="query-wrap">
    <view class="card">
      <view class="search-view">
        <uni-easyinput
          prefixIcon="search"
          :value="value"
          placeholder="请输入采购订单号"
          @iconClick="iconClick"
          @input="input"
          style="width: 100%; flex: 1"
        >
        </uni-easyinput>
      </view>
    </view>
    <z-paging
      ref="paging"
      @query="getData"
      v-model="filteredList"
      :use-page-scroll="true"
    >
      <view
        v-for="(item, index) in filteredList"
        :key="index"
        class="inner-item"
        @click="goDetail(item)"
      >
        <view class="item-stats">
          <span>{{ item.stasDes }}</span>
        </view>
        <view class="inventory-item">
          <view class="shuo-item">
            <view class="shuo-label"> 采购品种: </view>
            <view class="shuo-cont">
              {{ item.detlCnt || "" }}
            </view>
          </view>
          <view class="shuo-item">
            <view class="shuo-label"> 采购总数: </view>
            <view class="shuo-cont">
              {{ item.purcCntSum }}
            </view>
          </view>
        </view>
        <view class="inventory-item">
          <view class="shuo-item">
            <view class="shuo-label"> 采购总额: </view>
            <view class="shuo-cont">
              {{ item.purcAmt || "" }}
            </view>
          </view>
        </view>
        <view class="inventory-item">
          <view class="shuo-item">
            <view class="shuo-label"> 来源机构： </view>
            <view class="shuo-cont">
              {{ item.orgName }}
            </view>
          </view>
        </view>
        <view class="inventory-item">
          <view class="shuo-item-name">
            <view class="shuo-label"> 采购时间: </view>
            <view class="shuo-cont">
              {{ item.docmkDate }}
            </view>
          </view>
        </view>
      </view>
    </z-paging>
  </view>
</template>

<script>
import ZPMixin from "@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js";
import { debounce } from "lodash";
export default {
  mixins: [ZPMixin],
  data() {
    return {
      searchNo: "",
      currentTab: 0,
      filteredList: [],
      value: "",
    };
  },
  methods: {
    getData(pageNo, pageSize) {
      this.$http(
        "drugHospital.getApprList",
        {
          id: this.value,
          current: pageNo,
          size: pageSize,
        },
        "加载中"
      ).then((res) => {
        if (res && res.data) {
          this.$refs.paging.complete(res.data);
        }
      });
    },
    iconClick() {},
    input: debounce(function (e) {
      this.value = e;
      this.$refs.paging.reload();
    }, 500),
    changeTab(idx) {
      this.currentTab = idx;
      this.getData();
    },
    goDetail(item) {
      uni.setStorage({
        key: "planApprovalDetail",
        data: item,
      });
      uni.navigateTo({
        url:
          "/consumablespkg/pages/planApproval/details/index?activeTab=" + this.currentTab,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.query-wrap {
  width: 100%;
  padding: 20rpx;
  box-sizing: border-box;
  background-color: #f1f1f1;
  overflow-y: scroll;
  overflow-x: hidden;
}

uni-page-body {
  width: 100%;
  height: 100%;
}

.search-view {
  width: 100%;
  height: 100rpx;
  display: flex;
  align-items: center;
  padding: 0rpx 20rpx 0rpx 20rpx;
  box-sizing: border-box;

  .filter-text {
    width: 72rpx;
    height: 50rpx;
    line-height: 50rpx;
    color: rgba(1, 169, 146, 1);
    font-size: 36rpx;
    font-family: PingFangSC-bold;
    padding-left: 20rpx;
  }
}
.card {
  background: #fff;
  border-radius: 20rpx;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  padding: 0;
  margin-bottom: 20rpx;
}
.search-view uni-easyinput {
  width: 100% !important;
  flex: 1 !important;
}
</style>
