<template> 
 | 
  <div class="content1"> 
 | 
    <div class="order-message"> 
 | 
      <div class="content_list_item_top"> 
 | 
        <div class="content_list_item_top_left"> 
 | 
<!--          <span>出库单号:</span>--> 
 | 
          <span>{{ data.code }}</span> 
 | 
        </div> 
 | 
        <div class="content_list_item_top_right"> 
 | 
          <span class="warning" v-if="data.status === 0">待出库</span> 
 | 
          <span class="green" v-else-if="data.status === 1">已出库</span> 
 | 
          <span class="info" v-else-if="data.status === 2">已取消</span> 
 | 
        </div> 
 | 
      </div> 
 | 
      <div class="content_list_item_content"> 
 | 
        <div style="margin-top: 0 " class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">单据类型:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ orderTyepToStr(data.billType) }} 
 | 
          </div> 
 | 
        </div> 
 | 
        <div class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">出货仓库:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ data.warehouseCode + ' | ' + data.warehouseName }} 
 | 
          </div> 
 | 
        </div> 
 | 
        <div class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">计划日期:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ data.planDate }} 
 | 
          </div> 
 | 
        </div> 
 | 
        <div class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">来源类型:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ tyepToStr(data.originType) }} 
 | 
          </div> 
 | 
        </div> 
 | 
        <div class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">来源单号:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ data.originCode ? data.originCode : '-' }} 
 | 
          </div> 
 | 
        </div> 
 | 
        <div v-if="data.updateName" class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">操作人:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ data.updateName + ' - ' + data.updateMobile }} 
 | 
          </div> 
 | 
        </div> 
 | 
        <div v-if="data.updateTime" class="content_list_item_content_item"> 
 | 
          <div class="content_list_item_content_item_label">操作时间:</div> 
 | 
          <div class="content_list_item_content_item_nr"> 
 | 
            {{ data.updateTime }} 
 | 
          </div> 
 | 
        </div> 
 | 
      </div> 
 | 
    </div> 
 | 
    <!-- 转库物料 --> 
 | 
    <div class="title"> 
 | 
      <span class="title-prefix"></span> 
 | 
      <span>{{ data.status==1 ? '已出库物料' : '待出库物料' }}</span> 
 | 
    </div> 
 | 
    <div class="material-content"> 
 | 
      <div class="item-style" v-for="(item, index) in materailArray" :key="index"> 
 | 
        <div class="item-title-style"> 
 | 
          <span style="font-weight: 500;">{{ item.materialName + ' | ' + item.materialCode}}</span> 
 | 
        </div> 
 | 
        <div class="item-content-style"> 
 | 
          <div class="content_list_item_content_item"> 
 | 
            <div class="content_list_item_content_item_label">批次号:</div> 
 | 
            <div class="content_list_item_content_item_nr"> 
 | 
              {{ item.batch }} 
 | 
            </div> 
 | 
          </div> 
 | 
          <div class="content_list_item_content_item"> 
 | 
            <div class="content_list_item_content_item_label">数量:</div> 
 | 
            <div class="content_list_item_content_item_nr"> 
 | 
              {{ item.num + item.unitName }} 
 | 
            </div> 
 | 
          </div> 
 | 
          <div class="content_list_item_content_item"> 
 | 
            <div class="content_list_item_content_item_label">工序:</div> 
 | 
            <div class="content_list_item_content_item_nr"> 
 | 
              {{ item.procedureName || '-' }} 
 | 
            </div> 
 | 
          </div> 
 | 
          <div class="content_list_item_content_item"> 
 | 
            <div class="content_list_item_content_item_label">质量:</div> 
 | 
            <div class="content_list_item_content_item_nr"> 
 | 
              <span v-if="item.qualityType==0" class="green">合格</span> 
 | 
              <span v-else-if="item.qualityType==1" class="yellow">不良</span> 
 | 
              <span v-else-if="item.qualityType==2" class="red">报废</span> 
 | 
              <span v-else>-</span> 
 | 
            </div> 
 | 
          </div> 
 | 
          <div class="content_list_item_content_item"> 
 | 
            <div class="content_list_item_content_item_label">出库货位:</div> 
 | 
            <div class="content_list_item_content_item_nr"> 
 | 
              {{ item.locationName }} 
 | 
            </div> 
 | 
          </div> 
 | 
        </div> 
 | 
<!--        <div style="margin-top:10px; background: #cccccc; height:0.5px"></div>--> 
 | 
      </div> 
 | 
    </div> 
 | 
    <div v-if="data.status === 0" style="height:94px"></div> 
 | 
    <div v-if="data.status === 0" class="bottom-button"> 
 | 
      <button class="button button-action" @click="submit">去出库</button> 
 | 
      <button class="button button-cancel" @click="cancel">取消</button> 
 | 
    </div> 
 | 
  </div> 
 | 
</template> 
 | 
  
 | 
<script setup lang="ts"> 
 | 
import { onMounted, ref, reactive } from 'vue' 
 | 
import { useRoute, useRouter } from 'vue-router' 
 | 
import { getBoundDetail, cancelBound } from '@/apis/materialStorage' 
 | 
import { Toast } from 'vant' 
 | 
import { orderTyepToStr } from '@/constData' 
 | 
  
 | 
interface boundlDetail { 
 | 
  materialName: string, 
 | 
  materialCode: string, 
 | 
  batch: string, 
 | 
  num: number, 
 | 
  locationName: number 
 | 
} 
 | 
  
 | 
interface TransferDetailModel { 
 | 
  code: string; 
 | 
  createName: string; 
 | 
  planDate: string; 
 | 
  dealDate: string; 
 | 
  status: number; 
 | 
  originType: number; 
 | 
  originCode: string; 
 | 
  updateName: string; 
 | 
  updateMobile: string; 
 | 
  updateTime: string; 
 | 
  warehouseName: string; 
 | 
  warehouseCode: string; 
 | 
  outPlandate: string; 
 | 
  inPlandate: string; 
 | 
  woutboundDetailsWait: Array<boundlDetail> // 待出库 
 | 
  woutboundDetailsOut: Array<boundlDetail> // 已出库 
 | 
} 
 | 
const route = useRoute() 
 | 
const router = useRouter() 
 | 
  
 | 
const data = ref<TransferDetailModel>( 
 | 
  { 
 | 
    code: "", 
 | 
    createName: "", 
 | 
    planDate: "", 
 | 
    dealDate: "", 
 | 
    status: 0, 
 | 
    originType: 0, 
 | 
    originCode: "", 
 | 
    updateName: "", 
 | 
    updateMobile: "", 
 | 
    updateTime: "", 
 | 
    warehouseName: "", 
 | 
    warehouseCode: "", 
 | 
    outPlandate: "", 
 | 
    inPlandate: "", 
 | 
    woutboundDetailsWait: [], 
 | 
    woutboundDetailsOut: [] 
 | 
  } 
 | 
) 
 | 
// 来源单据类型  0采购订单、1生产工单、2销售订单、3转库单、4盘点单 
 | 
let types: Array<{name: string, id: string, isActive: boolean }> = reactive( 
 | 
  [ 
 | 
    { name: '全部', id: '', isActive: true }, 
 | 
    { name: '采购订单', id: '0', isActive: false }, 
 | 
    { name: '生产工单', id: '1', isActive: false }, 
 | 
    { name: '销售订单', id: '2', isActive: false }, 
 | 
    { name: '转库单', id: '3', isActive: false }, 
 | 
    { name: '盘点单', id: '4', isActive: false }, 
 | 
  ] 
 | 
) 
 | 
  
 | 
let materailArray: Array<boundlDetail> = reactive([]) 
 | 
  
 | 
onMounted(() => { 
 | 
  getBoundDetail({ id: route.query.id }) 
 | 
    .then(res => { 
 | 
      data.value = res.data 
 | 
      console.log(data.value) 
 | 
      if (data.value.status === 1) { 
 | 
        materailArray.push(...data.value.woutboundDetailsOut) 
 | 
      } else { 
 | 
        materailArray.push(...data.value.woutboundDetailsWait) 
 | 
      } 
 | 
      console.log(materailArray) 
 | 
    }) 
 | 
}) 
 | 
  
 | 
const tyepToStr = (type: number): string => { 
 | 
  //  <!-- 1、车间领料;2、车间备料;3、其他;4、完工入库 --> 
 | 
  for (const item of types) { 
 | 
    if (parseInt(item.id) === type) { 
 | 
      return item.name 
 | 
    } 
 | 
  } 
 | 
  return '-' 
 | 
} 
 | 
  
 | 
const submit = (): void => { 
 | 
  
 | 
} 
 | 
const cancel = (): void => { 
 | 
  cancelBound({ id: route.query.id }) 
 | 
    .then(res => { 
 | 
      console.log(res) 
 | 
      Toast.success('取消成功') 
 | 
      router.back() 
 | 
    }) 
 | 
    .catch(err => { 
 | 
      Toast.fail(err.message) 
 | 
    }) 
 | 
} 
 | 
</script> 
 | 
  
 | 
<style lang="scss"> 
 | 
.content1 { 
 | 
  padding: 30px; 
 | 
  background: white; 
 | 
  .order-message { 
 | 
    display: flex; 
 | 
    flex-direction: column; 
 | 
    // border-bottom: 1px solid #ececec; 
 | 
    .content_list_item_top { 
 | 
      display: flex; 
 | 
      align-items: center; 
 | 
      justify-content: space-between; 
 | 
      .content_list_item_top_left { 
 | 
        display: flex; 
 | 
        // align-items: center; 
 | 
        span { 
 | 
          font-size: 32px; 
 | 
          font-weight: 500; 
 | 
          color: #333333; 
 | 
        } 
 | 
      } 
 | 
      .content_list_item_top_right { 
 | 
        font-size: 26px; 
 | 
        font-weight: 400; 
 | 
        .created { 
 | 
          color: $nav-stateColor1 !important; 
 | 
        } 
 | 
        .warning { 
 | 
          color: $nav-stateColor5 !important; 
 | 
        } 
 | 
        .green { 
 | 
          color: $nav-stateColor6 !important; 
 | 
        } 
 | 
        .info { 
 | 
          color: $nav-stateColor3 !important; 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
    .content_list_item_content { 
 | 
      padding: 24px 30px; 
 | 
      background: #f7f7f7; 
 | 
      border-radius: 16px; 
 | 
      display: flex; 
 | 
      flex-wrap: wrap; 
 | 
      justify-content: space-between; 
 | 
      margin-top: 32px; 
 | 
      .content_list_item_content_item { 
 | 
        width: 100%; 
 | 
        display: flex; 
 | 
        margin-top: 24px; 
 | 
        .content_list_item_content_item_label { 
 | 
          font-size: 24px; 
 | 
          font-weight: 400; 
 | 
          color: #666666; 
 | 
          flex-shrink: 0; 
 | 
        } 
 | 
        .content_list_item_content_item_nr { 
 | 
          font-size: 24px; 
 | 
          font-weight: 400; 
 | 
          color: #222222; 
 | 
          margin-right: 10px; 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  } 
 | 
  
 | 
  .title { 
 | 
    font-size: 30px; 
 | 
    display: flex; 
 | 
    align-items: center; 
 | 
    margin-top: 30px; 
 | 
    .title-prefix { 
 | 
      display: inline-block; 
 | 
      background-color: #4275FC; 
 | 
      height: 30px; 
 | 
      width: 8px; 
 | 
      border-radius: 1px; 
 | 
      margin-right: 12px; 
 | 
    } 
 | 
  } 
 | 
  .material-content { 
 | 
    margin-top: 30px; 
 | 
    .item-style { 
 | 
      width: initial; 
 | 
      border-bottom: 1PX solid #ececec; 
 | 
      margin-top: 30px; 
 | 
      &:last-child { 
 | 
        border: none; 
 | 
      } 
 | 
      .item-title-style { 
 | 
        margin-bottom: 12px; 
 | 
        font-size: 30px; 
 | 
      } 
 | 
      .item-content-style { 
 | 
        // padding: 24px 30px; 
 | 
        // background-color: #f7f7f7; 
 | 
        // border-radius: 16px; 
 | 
        display: flex; 
 | 
        flex-wrap: wrap; 
 | 
        justify-content: space-between; 
 | 
        padding: 1px 1px 30px 1px; 
 | 
        .content_list_item_content_item { 
 | 
          width: 100%; 
 | 
          display: flex; 
 | 
          margin-top: 24px; 
 | 
          .content_list_item_content_item_label { 
 | 
            font-size: 24px; 
 | 
            font-weight: 400; 
 | 
            color: #666666; 
 | 
            flex-shrink: 0; 
 | 
          } 
 | 
          .content_list_item_content_item_nr { 
 | 
            font-size: 24px; 
 | 
            font-weight: 400; 
 | 
            color: #222222; 
 | 
            margin-right: 10px; 
 | 
          } 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  } 
 | 
  .bottom-button { 
 | 
    padding: 1px; 
 | 
    background-color: #f7f7f7; 
 | 
    position: fixed; 
 | 
    width: 100%; 
 | 
    bottom: 0; 
 | 
    height: 188px; 
 | 
    display: flex; 
 | 
    justify-content: space-between; 
 | 
  
 | 
    .button-action { 
 | 
      background: #fff; 
 | 
      color: $nav-color; 
 | 
    } 
 | 
    .button-cancel { 
 | 
      background: $nav-color; 
 | 
      color: #FFFFFF; 
 | 
    } 
 | 
    .button { 
 | 
      margin: 32px 32px 68px 32px; 
 | 
      height: 88px; 
 | 
      width: 334px; 
 | 
      border: none; 
 | 
      border-radius: 8px; 
 | 
      box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.08); 
 | 
      display: flex; 
 | 
      align-items: center; 
 | 
      justify-content: center; 
 | 
    } 
 | 
  } 
 | 
} 
 | 
</style> 
 |