viewer.vue 7.05 KB
<template>
  <view class="detail-page">
    <view class="section">
      <text class="row company">{{ form.orderNo }}</text>
      <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.settlementTerms }}</text>
      </view>
      <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryMethod }}</text></view>
    </view>

    <!-- 产品-变更前 -->
    <view class="mgb10">
      <Product title="变更前" mode="view" :options="genderOptions" :list="form.beforeChangeSpecList"
        :totalQuantity="form.totalQuantity || 0" />
    </view>

    <!-- 产品-变更后 -->
    <view class="mgb10">
      <Product title="变更后" mode="view" :options="genderOptions" :list="form.afterChangeSpecList"
        :totalQuantity="form.afterTotalQuantity || 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">{{ form.packagingFee }}</text></view>
      <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD',
        form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</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>

  </view>
</template>

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

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

<style lang="scss" scoped>
.detail-page {
  background: #f3f3f3;
}

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

}

.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;
}

.history-header {
  display: flex;
  background: #F7F7F7;
  padding: 20rpx 52rpx 20rpx 32rpx;

  .col {
    font-size: 28rpx;
    color: rgba(0, 0, 0, 0.9);
    line-height: 40rpx;
  }

  .col1 {
    width: 20%;
  }

  .col2 {
    width: 50%;
    text-align: center;
  }

  .col3 {
    width: 30%;
    text-align: right;
  }
}

.history-row {
  display: flex;
  padding: 20rpx 52rpx 20rpx 32rpx;
  border-bottom: 1rpx solid #f7f7f7;

  .col {
    font-size: 28rpx;
    color: rgba(0, 0, 0, 0.9);
    line-height: 40rpx;
  }

  .col1 {
    width: 20%;
  }

  .col2 {
    width: 50%;
    text-align: center;
  }

  .col3 {
    width: 30%;
    text-align: right;
  }

  .link {
    color: $theme-primary;
  }
}

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

  &_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>