viewer.vue 7.64 KB
<template>
  <view class="page">
    <scroll-view class="scroll" scroll-y>
      <view class="detail-page">
        <view class="section">
          <text class="row company">{{ form.orderNo }}</text>
          <view :class="['status', `status_${form.status}`]" />
          <view class="row"><text class="label">供货单位</text><text class="value">{{ getDicName('SUPPLIER',
            form.supplyUnit, dicOptions.SUPPLIER) }}</text></view>
          <view class="row"><text class="label">订货单位</text><text class="value">{{ form.orderingUnitName }}</text>
          </view>
          <view class="row"><text class="label">订货日期</text><text class="value">{{ form.orderDate }}</text></view>
          <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view>
          <view class="row"><text class="label">办事处</text><text class="value">{{ form.deptName }}</text></view>
          <view class="row"><text class="label">区域</text><text class="value">{{ form.regionName }}</text></view>
          <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ form.stockUpCompanyName }}</text></view>
          <view class="row"><text class="label">结算方式或期限</text><text class="value">{{ form.settlementTerms }}</text></view>
          <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryMethod }}</text></view>
        </view>

        <!-- 产品 -->
        <view class="mgb10">
          <Product mode="view" :list="form.purchaseOrderLineList" :totalQuantity="form.totalQuantity || 0" />
        </view>
       
        <view class="section">
          <view class="row"><text class="label">价格表编号</text><text class="value">{{ form.priceListNo }}</text></view>
          <view class="row"><text class="label">开票情况</text><text class="value">{{ form.invoicingStatus }}</text></view>
          <view class="row"><text class="label">运费</text><text class="value">{{ form.shippingCost }}</text></view>
          <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD',
            form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</text></view>
          <view v-if="form.executionStandard === 'OTHER'" class="row"><text class="label">标准</text><text class="value">{{ form.executionStandardRemarks }}</text></view>
        </view>
        
        <view class="title-header">
          <image class="title-header_icon" src="/static/images/title.png" />
          <span>具体质量要求</span>
        </view>
        <view class="section">
          <view class="row"><text class="label">件重条头</text><text class="value">{{ form.pieceWeightHeader }}</text></view>
          <view class="row"><text class="label">表面</text><text class="value">{{ form.surface }}</text></view>
          <view class="row"><text class="label">公差</text><text class="value">{{ form.tolerance }}</text></view>
          <view class="row"><text class="label">性能</text><text class="value">{{ form.performance }}</text></view>
          <view class="row"><text class="label">成分</text><text class="value">{{ form.element }}</text></view>
          <view class="row"><text class="label">包装</text><text class="value">{{ form.packaging }}</text></view>
          <view class="row"><text class="label">备注</text><text class="value">{{ form.remarks }}</text></view>
          <!-- 品质科 可查看 -->
          <view v-if="form.showProductionProcess" class="row"><text class="label">生产工艺</text><text class="value">{{ form.productionProcess }}</text></view>
        </view>

      </view>
    </scroll-view>
    
  </view>
</template>

<script>
import { getDetailApi } from '@/api/order_list.js'
import Product from './product.vue'
import {
  getDicName
} from '@/utils/dic.js'
import {
  getDicByCodes
} from '@/utils/dic'

export default {
  name: 'OrderListViewer',
  props: { id: { type: [String, Number], default: '' } },
  components: { Product },
  data() {
    return {
      form: {},
      enterpriseTypeOptions: [],
      categoryOptions: [],
      historyList: [],
      showExamine: false,
      dicOptions: {
        SUPPLIER: [],
        APPLICABLE_STANDARD: [],
      },
    }
  },
  computed: {
  },
  created() {
    this.loadAllDicData()
  },
  watch: {
    id: {
      immediate: true,
      handler(val) {
        const v = (val !== undefined && val !== null) ? String(val) : ''
        if (v) this.loadDetail(v)
      }
    }
  },
  methods: {
    async loadDetail(id) {
      try {
        const res = await getDetailApi(id)
        const data = res.data || {}
        this.form = { ...data }
      } catch (e) {
        this.form = {}
      }
    },
    loadAllDicData() {
      const dicCodes = ['SUPPLIER', 'APPLICABLE_STANDARD']
      return getDicByCodes(dicCodes).then(results => {
        this.dicOptions.SUPPLIER = results.SUPPLIER.data || []
        this.dicOptions.APPLICABLE_STANDARD = results.APPLICABLE_STANDARD.data || []
      }).catch(() => {
        this.dicOptions = {
          SUPPLIER: [],
          APPLICABLE_STANDARD: [],
        }
      })
    },
    getDicName: getDicName,
  }
}
</script>

<style lang="scss" scoped>
.page {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.scroll {
  flex: 1;
}

.detail-page {
  background: #f3f3f3;
}

.section {
  padding: 32rpx;
  background: #fff;
  margin-bottom: 20rpx;
  position: relative;

  .status {
    position: absolute;
    top: 16rpx;
    right: 52rpx;
    width: 180rpx;
    height: 146rpx;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;

    // 已下发
    &_ISSUED {
      background-image: url('~@/static/images/order_list/status_ISSUED.png');
    }

    // 待发货
    &_WAIT {
      background-image: url('~@/static/images/order_list/status_WAIT.png');
    }

    // 部分发货
    &_TRANSIT {
      background-image: url('~@/static/images/order_list/status_TRANSIT.png');
    }

    // 发货完成
    &_SHIPPED {
      background-image: url('~@/static/images/order_list/status_SHIPPED.png');
    }

    // 已签收
    &_DELIVERED {
      background-image: url('~@/static/images/order_list/status_DELIVERED.png');
    }

  }
}

.mgb10 {
  margin-bottom: 20rpx;
}

.row {
  display: flex;
  margin-bottom: 28rpx;

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

  &.company {
    font-size: 36rpx;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.9);
    padding-top: 32rpx;
    line-height: 50rpx;
  }

  .label {
    max-width: 420rpx;
    line-height: 32rpx;
    font-size: 28rpx;
    color: rgba(0, 0, 0, 0.6);
  }

  .value {
    flex: 1;
    line-height: 32rpx;
    font-size: 28rpx;
    color: rgba(0, 0, 0, 0.9);
    text-align: right;

    &.act {
      color: $theme-primary;
    }

    .category {
      display: inline-block;
      padding: 4rpx 12rpx;
      border-radius: 6rpx;
      font-size: 24rpx;
      width: auto;

      &.category_A {
        background: #FFF0ED;
        color: #D54941;
      }

      &.category_B {
        background: #FFF1E9;
        color: #E37318;
      }

      &.category_C {
        background: #F2F3FF;
        color: $theme-primary;
      }

      &.category_D {
        background: #E3F9E9;
        color: #2BA471;
      }
    }
  }
}

.card {
  padding: 16rpx 0 8rpx;
  border-top: 1rpx solid #f0f0f0;
}


.title-header {
  background-color: #fff;
  display: flex;
  align-items: center;
  padding: 32rpx 32rpx 22rpx;

  .title-header_icon {
    width: 32rpx;
    height: 28rpx;
    margin-right: 16rpx;
  }

  span {
    color: rgba(0, 0, 0, 0.9);
    font-size: 32rpx;
    line-height: 44rpx;
    font-weight: 600;
  }
}

</style>