viewer.vue 4.31 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">{{ 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.documentPreparationDate }}</text></view>
      <view class="row"><text class="label">所属办</text><text class="value">{{ form.deptName }}</text>
      </view>
    </view>

    <view class="mgb10">
      <Product mode="view" :list="form.purchaseOrderRevokeLineList"
        :totalQuantity="form.totalQuantity || 0" :totalRevokeQuantity="form.totalRevokeQuantity || 0" />
    </view>

    <view class="section">
      <view class="row"><text class="label">撤销原因</text><text class="value">{{ form.revokeReason }}</text></view>
    </view>

    <view class="section">
      <view class="row"><text class="label">撤销确认凭证</text><text class="value act">{{ form.confirmationVoucherFileName }}</text></view>
    </view>

  </view>
</template>

<script>
import { getDetailApi } from '@/api/revoke_list.js'
import Product from './product.vue'

export default {
  name: 'RevokeListViewer',
  components: { Product },
  props: { id: { type: [String, Number], default: '' } },
  data() {
    return {
      form: {},
    }
  },
  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 = {}
      }
    },
    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);
    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>