<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.Pi_QueryResults") }}</view>
      <view class="right"></view>
    </view>
    <u-form
      class="form"
      ref="form"
      style="padding-left: 30px"
      label-width="180rpx"
    >
      <u-form-item :label="$t('message.Transfer')">
        <u-input v-model="cpRef4" placeholder="" class="Transfer" />
        <u-button
          type="primary"
          style="height: 60rpx; margin-left: 20rpx"
          @click="generate"
          >{{ $t("message.Query") }}</u-button
        >
      </u-form-item>
    </u-form>
    <view class="table-wrapper">
      <wyb-table
        class="table"
        ref="table"
        width="100%"
        show-left-and-right-border
        :headers="headers"
        :contents="detailedList"
        :show-vert-border="false"
      ></wyb-table>
    </view>
  </view>
</template>
<script lang="ts">
import { Component } from "vue-property-decorator";
import { BasePage } from "@/components/base/page";
import { Headers } from "./config";
import model from "./model";

@Component
export default class RawReceiptDetail extends BasePage {
  model = model;
  headers = Headers;
  cpRef4: any = "";
  detailedList: any = [];
  async generate() {
    if (this.cpRef4 == "") {
      uni.showToast({
        icon: "none",
        title: this.$t("message._tips6") as any,
      });
      return;
    }
    let person = JSON.parse(
      localStorage.getItem("__GWMS_APP_STATE_DATA__") as any
    );
    let content = {
      loginName: person.session.user.loginName,
      cpRef4: this.cpRef4,
    };
    await this.model.querydetaildlist(content);
    let arr = this.model.detailedList;
    arr.forEach((item: any) => {
      if (item.oiType == 10 || item.oiType == "10") {
        item.oiType = this.$t("message.enter");
      } else {
        item.oiType = this.$t("message.Out");
      }
    });
    this.detailedList = arr;
  }
}
</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;
  padding-bottom: 162rpx;

  .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;
    }
  }
  .form {
    background-color: #fff;
    // padding: 40rpx;
    border-radius: 10rpx;
    box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);

    .u-form-item {
      // padding: 30rpx 0;
      line-height: 35rpx;
      .Transfer {
        width: 180rpx;
        height: 64rpx;
        background: rgb(242, 242, 242);
        border-radius: 110rpx;
      }
    }
  }
  .table-wrapper {
    background-color: #fff;
  }

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