<template>
  <view class="page-product-receipt">
    <view class="header" :style="{ backgroundColor: `rgba(250, 53, 52, ${scrollTop / 100})` }">
      <view class="left">
        <u-icon class="icon" name="arrow-left" @click="uni.navigateBack({})" />
      </view>
      <view class="title">生产质检详细</view>
      <view class="right"></view>
    </view>
    <u-form class="form" ref="form" label-width="180rpx">
      <!-- 单号 -->
      <u-form-item label="订单">
        <u-input :disabled="true" v-model="model.rowdata.rfid" placeholder="" style="overflow: hidden" />
      </u-form-item>
      <!-- <view class="single">
        <view class="single-left">
          <view>rfid:</view>
          <u-search placeholder="请扫描" v-model="orderNo" @search="query" :show-action="false"></u-search>
        </view>
        <view class="single-right">
          <u-button type="primary" @click="query">扫描</u-button>
        </view>
      </view> -->
      <!-- 物料编码 -->
      <!-- <u-form-item :label="$t('message.matcode')">
        <jPicker sureColor="#ff0000" @bindpicker="selectProductCode" showKey="value" valKey="value" :val="productCodeList.value" :options="model.productCodeList" />
      </u-form-item> -->
      <!-- 物料编码 -->
      <!-- <u-form-item :label="$t('message.matcode')">
        <u-input :disabled="true" v-model="histroyItem.materialDesc" placeholder="" style="overflow: hidden" />
      </u-form-item> -->
      <!-- 订单 -->
      <u-form-item label="订单">
        <u-input :disabled="true" v-model="model.rowdata.orderCode" placeholder="" style="overflow: hidden" />
      </u-form-item>
      <!-- 机台 -->
      <u-form-item label="机台">
        <u-input :disabled="true" v-model="model.rowdata.machineName" placeholder="" style="overflow: hidden" />
      </u-form-item>
      <!-- 产品 -->
      <u-form-item label="产品">
        <u-input :disabled="true" v-model="model.rowdata.productName" placeholder="" />
      </u-form-item>
      <!-- 工单 -->
      <u-form-item label="工单">
        <u-input :disabled="true" v-model="model.rowdata.workorderCode" placeholder="" />
      </u-form-item>
      <!-- 是否合格 -->
      <u-form-item label="是否合格">
        <u-input :disabled="true" :value="model.rowdata.isqua === '1' ? '合格' : '不合格'" placeholder="" />
        <!-- <jPicker sureColor="#ff0000" @bindpicker="selectProductCode" showKey="label" valKey="value" :val="productCodeList.value" :options="isqualified" /> -->
      </u-form-item>
      <!-- 不良描述 -->
      <u-form-item label="不良描述">
        <u-input :disabled="true" v-model="model.rowdata.badMeg" placeholder="" type="textarea" :border="border" :height="height" :auto-height="autoHeight" />
      </u-form-item>
      <view class="boxtitle">照片</view>
      <scroll-view class="scroll-view_H" scroll-x="true" :scroll-left="scrollLeft()">
        <view class="photoList">
          <view class="itemBox photoBox" v-for="(img, index) in imglist" :key="index">
            <!-- <view class="closeBtn" @click="deleteImg(img)">
									<image class="img" src="../../static/img/iconCloseGray.svg" mode="scaleToFill"></image>
								</view> -->
            <image class="img" :src="img" mode="aspectFit" @click="showScreenImg(index)"></image>
          </view>
          <!-- <view class="itemBox chooseBtn" @click="chooseImg">
            <view class="inner">
              <image class="img" src="../../../static/images/upload-pic-icon.svg" mode="scaleToFill"></image>
              <text class="desc">添加照片</text>
            </view>
          </view> -->
        </view>
      </scroll-view>
    </u-form>
    <!-- <view class="bottom-bar">
      <u-row class="button-bar">
       
        <u-col :span="6">
          <u-button @click="onSubmit" type="primary">确定</u-button>
        </u-col>
        
        <u-col :span="6">
          <u-button type="error" @click="uni.navigateBack({})">返回</u-button>
        </u-col>
      </u-row>
    </view> -->
  </view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import jPicker from '@/components/J-Picker/jPicker.vue';
import model from './model';
@Component({
  components: {
    jPicker,
  },
})
export default class productCheckReceiptdetail extends BasePage {
  model = model;
  // remove: any = {};
  // async onReady() {
  //   await this.model.queryLocation();
  //   this.remove = this.model.WlList[0];
  // }
  // selectItem(e: any) {
  //   this.remove = e.pickerName;
  // }
  // orderNo: any = '';
  // badMeg = '';
  border = true;
  height = 100;
  autoHeight = true;
  imglist: any = [];
  // imgList: any = [];
  // imgUrlList: any = [];
  // isqualified = [
  //   {
  //     label: '合格',
  //     value: '1',
  //   },
  //   {
  //     label: '不合格',
  //     value: '0',
  //   },
  // ];

  productCodeList: any = {};
  scrollLeft() {
    return 222 * (this.imglist.length + 1);
  }
  showScreenImg(i) {
    let list = this.imglist;
    uni.previewImage({
      current: i,
      urls: list,
      // loop: true
    });
  }
  async onLoad() {
    console.log('xxxxx', model.rowdata);
    this.imglist = model.rowdata.fileList;
    //console.log('aaa', model.rowdata);
  }
}
</script>
<style lang="scss" scoped>
.page-product-receipt {
  background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #f8262c 51%, #d9001b 100%) no-repeat;
  background-size: 100% 600rpx;
  padding: 118rpx 30rpx 162rpx;
  min-height: 100%;

  .header {
    position: fixed;
    top: 0rpx;
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    height: 120rpx;
    line-height: 88rpx;
    color: #fff;
    font-size: 34rpx;
    font-weight: 500;
    text-align: center;
    padding: 45rpx 0rpx 0rpx;
    .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: 280rpx;
        height: 64rpx;
        background: rgb(242, 242, 242);
        border-radius: 110rpx;
      }
    }

    .single {
      width: 100%;
      height: 100rpx;
      display: flex;

      .single-left {
        width: 80%;
        height: 100%;
        display: flex;

        view {
          width: 142rpx;
          height: 100%;
          line-height: 100rpx;
        }
      }

      .single-right {
        button {
          margin-top: 15rpx;
          width: 140rpx;
          height: 70rpx;
          background-color: #fa3534;
        }
      }
    }
  }

  .bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: #ffffff;
    box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
    padding: 20rpx;
  }

  .button-bar {
  }

  .photoList {
    display: flex;
    padding-top: 12rpx;

    .chooseBtn {
      width: 202rpx;
      height: 202rpx;
      background: #fafafa;
      border-radius: 12rpx;
      border: 2rpx dashed #e2e2e2;
      display: flex;
      justify-content: center;
      align-items: center;

      .inner {
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
      }

      .desc {
        font-size: 28rpx;
        font-weight: 400;
        color: #24252a;
        line-height: 40rpx;
      }

      .img {
        width: 50rpx;
        height: 50rpx;
        margin-bottom: 6rpx;
      }
    }

    .photoBox {
      width: 202rpx;
      height: 202rpx;
      background: #fafafa;
      border-radius: 12rpx;
      position: relative;

      .closeBtn {
        position: absolute;
        top: -12rpx;
        right: -12rpx;
        z-index: 2;
        width: 36rpx;
        height: 36rpx;

        .img {
          width: 36rpx;
          height: 36rpx;
        }
      }

      .img {
        width: 202rpx;
        height: 202rpx;
        border-radius: 12rpx;
      }
    }

    .itemBox {
      flex: 0 0 202rpx;
      margin-right: 20rpx;

      &:last-child {
        margin-right: 0;
      }
    }

    // /deep/ .remarksBox textarea {
    //   font-size: 24rpx;
    // }
  }
}
</style>
