<template>
  <view class="page-receipt-detail">
    <view class="header">
      <view class="left">
        <u-icon class="icon" name="arrow-left" @click="uni.navigateBack()" />
      </view>
      <view class="title"> {{ $t("message.Inventory_query") }}</view>
      <view class="right"></view>
    </view>
    <div class="library-num">
      <div class="label">
        <div class="title">{{ $t("message.po_MaterielNo") }}</div>
        <input type="text" placeholder="请输入" v-model="params.materialCode" />
      </div>
      <div class="label">
        <div class="title">{{ $t("message.product_Location") }}</div>
        <input type="text" placeholder="请输入" v-model="params.wlCode" />
      </div>
    </div>
    <u-table class="library-table">
      <u-tr class="u-tr">
        <u-th class="u-th">{{ $t("message.po_MaterielNo") }}</u-th>
        <u-th class="u-th">{{ $t("message.product_Location") }}</u-th>
        <u-th class="u-th">{{ $t("message.product_Number") }}</u-th>
        <u-th class="u-th">{{ $t("message.product_Unit") }}</u-th>
      </u-tr>
      <u-tr class="u-tr" v-for="(item, index) in LocationList" :key="index">
        <u-td class="u-td" style="width: 40%">{{ item.materialCode }}</u-td>
        <u-td class="u-td" style="width: 20%">{{ item.wlCode }}</u-td>
        <u-td class="u-td" style="width: 20%">{{ item.amount }}</u-td>
        <u-td class="u-td" style="width: 20%">{{ item.userDefined1 }}</u-td>
      </u-tr>
    </u-table>
    <view class="bottom-bar">
      <div class="extra"></div>
      <div class="container">
        <u-row>
          <u-col :span="3">
            <u-button
              type="primary"
              size="medium"
              class="confirm"
              @click="confirm"
              >{{ $t("message.Summary_Result") }}</u-button
            >
          </u-col>
        </u-row>
      </div>
    </view>
  </view>
</template>

<script lang="ts">
import { Component } from "vue-property-decorator";
import { BasePage } from "@/components/base/page";
import model from "./model";
import { headers } from "./config";
import jPicker from "@/components/J-Picker/jPicker.vue";
import { session } from "@/store/modules/session";
import combox from "@/components/J-Picker/jPicker.vue";
// @Component
@Component({
  components: {
    jPicker,
    combox,
  },
})
export default class RawReceiptDetail extends BasePage {
  /**
   * 页面Module
   */
  model = model;
  /**
   * 实际数量
   */
  LocationList = [];
  params: any = {
    wlCode: "",
    materialCode: "",
  };
  /**
   * 表头
   */
  headers = headers;
  onReady() {
    let mater: any = JSON.parse(sessionStorage.getItem("mater") as any);
    this.params.materialCode = mater.materialCode;
    console.log(this.params);
  }
  async confirm() {
    let res = await this.model.queryStockList({
      loginName: "6668",
    });
    this.LocationList = res.data.records;
    console.log("LocationList>", this.LocationList);
  }
}
</script>

<style lang="scss" scoped>
.page-receipt-detail {
  background: #f2f2f2
    linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
  background-size: 100% 600rpx;
  padding: 30rpx;
  min-height: 100%;
  padding-top: 118rpx;

  .header {
    position: fixed;
    top: 36rpx;
    left: 0;
    right: 0;
    display: flex;
    height: 88rpx;
    line-height: 88rpx;
    color: #fff;
    font-size: 34rpx;
    font-weight: 500;
    text-align: center;
    .title {
      flex: 3;
    }
    .left,
    .right {
      flex: 1;
    }
    .icon {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 88rpx;
      height: 88rpx;
    }
  }

  .content {
    width: 100%;
    height: 500rpx;

    .content-item {
      width: 100%;
      height: 100rpx;
      display: flex;
      text-align: center;
      line-height: 100rpx;
      background-color: white;
      .item-left {
        width: 30%;
      }
      .item-right {
        width: 70%;
      }
    }
  }
  .library-num {
    .label {
      margin-top: 20rpx;
      display: flex;
      .title {
        width: 100rpx;
        height: 60rpx;
        text-align: center;
        line-height: 60rpx;
        margin-left: 100rpx;
      }
      input {
        display: block;
        width: 50%;
        padding: 10rpx;
        background-color: white;
      }
    }
  }
  .library-table {
    margin-top: 30rpx;
  }

  .table-wrapper {
    background-color: #fff;
  }

  .form {
    background-color: #fff;
    padding: 40rpx;
    border-radius: 10rpx;
  }

  .bottom-bar {
    z-index: 21;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;

    .container {
      background: #ffffff;
      box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
      padding: 20rpx;
      height: 60rpx;
      position: relative;
      .confirm {
        position: absolute;
        top: 15rpx;
        right: 0rpx;
      }
    }

    .extra {
      margin: 5px;
      border-radius: 5px;
      padding: 0 10px;
    }
  }
}
</style>
