<template>
  <view>
    <NavBar title="采购入库扫描"></NavBar>
    <view class="btn">
      <u-button @tap="handleScanCode" type="primary">扫描库位</u-button>
      <u-button @tap="handleScanCode" type="primary">扫描产品包装条码/外箱码</u-button>
    </view>
    <view class="total">
      <view class="left">入库明细</view>
      <view class="right">
        批次数：
        <text class="blue">{{ number }}</text>
        <text class="line">|</text>
        总数量：
        <text class="blue">{{ total }}</text>
      </view>
    </view>

    <view class="cardbox">
      <view class="cardContent">
        <view class="listItemTitle">
          <view>
            <view class="item">入库批次：L99999999</view>
            <view class="item">物料编号：L99999999</view>
            <view class="item">物料描述：L99999999</view>
            <view class="item">入库数量：L99999999</view>
            <view class="item">入库库位：L99999999</view>
          </view>
          <u-button size="mini" type="primary" plain>
            <u-icon name="trash" size="28"></u-icon>
            删除
          </u-button>
        </view>
        <view class="listBottom">
          <view class="bottomTitle" @tap="show = !show">
            <view class="desc">卷条码明细</view>
            <view class="topIcons">
              <text v-if="show">
                <u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
                展开
              </text>
              <text v-else>
                <u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
                收起
              </text>
            </view>
          </view>
          <view v-if="!show" class="bottomBox">
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
            <view class="bottomItem">
              <view class="items">C00990099900027</view>
              <view class="items">C009900|防霉抗菌包装纸</view>
              <view class="items">数量：80PCS</view>
              <view class="items">生产日期：2023-10-27</view>
            </view>
          </view>
        </view>
      </view>
    </view>

    <view class="bottomBtn">
      <u-button @tap="handleBack" type="warning">返回</u-button>
      <u-button type="primary">提交</u-button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      number: 2,
      total: 200,
      show: true
    };
  },
  methods: {
    handleBack() {
      uni.navigateBack();
    },
    handleScanCode() {
      uni.scanCode({
        success: function (res) {
          console.log('条码类型：' + res.scanType);
          console.log('条码内容：' + res.result);
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
page {
  background: #f8f8f8;
}
.btn {
  padding: 20rpx;
  display: flex;
  justify-content: space-between;
  background: #fff;
}
.bottomBtn {
  position: sticky;
  padding: 20rpx;
  display: flex;
  justify-content: space-between;
  background: #fff;
  bottom: 0rpx;
  margin-top: 20rpx;
  .u-btn {
    width: 300rpx;
  }
}
.blue {
  color: #3f9dcc;
}
.total {
  color: #000;
  padding: 0rpx 40rpx;
  display: flex;
  justify-content: space-between;
  font-size: 32rpx;
  .line {
    margin: 0px 10rpx;
  }
}
.cardbox {
  min-height: calc(100vh - 480rpx);
  padding: 0rpx 20rpx;
  margin-top: 20rpx;
}
.cardContent {
  border-radius: 8px;
  background: #fff;
}
.listItemTitle {
  display: flex;
  justify-content: space-between;
  padding: 20rpx;
  border-bottom: 2px solid #f8f8f8;
  .u-btn {
    width: 150rpx;
    margin: 0px;
    margin-top: 10rpx;
  }
  .item {
    height: 50rpx;
    line-height: 50rpx;
    color: #000;
    font-size: 28rpx;
    font-weight: 500;
  }
}
.listBottom {
  .bottomTitle {
    height: 80rpx;
    position: relative;
    .desc {
      color: #bbb;
      font-size: 24rpx;
      line-height: 80rpx;
      padding-left: 20rpx;
    }
    .topIcons {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      color: #aaa;
    }
  }
  .bottomBox {
    padding: 20rpx;
    .bottomItem {
      background: #f8f8f8;
      padding: 20rpx;
      margin-bottom: 20rpx;
      .items {
        color: #333;
        font-size: 24rpx;
        height: 40rpx;
        line-height: 40rpx;
      }
    }
  }
}
</style>
