<template>
  <div>
    <el-form ref="form" class="el-form-box" :model="form" label-width="120px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="订单编号：" prop="orderNo">
            <el-input v-model="form.orderNo" disabled></el-input>
          </el-form-item>
          <el-form-item label="合同名称：" prop="contractName">
            <el-input v-model="form.contractName" disabled></el-input>
          </el-form-item>
          <el-form-item label="合同编号：" prop="contractNumber">
            <el-input v-model="form.contractNumber" disabled></el-input>
          </el-form-item>
          <el-form-item label="结算方式：" prop="settlementModeName">
            <el-input v-model="form.settlementModeName" disabled></el-input>
          </el-form-item>

          <el-form-item label="客户收货地址：" prop="receiveAddress">
            <el-input v-model="form.receiveAddress" disabled></el-input>
          </el-form-item>
          <el-form-item label="订单备注：" prop="remark">
            <el-input type="textarea" v-model="form.remark" disabled></el-input>
          </el-form-item>
          <el-form-item prop="orderFiles" label="订单附件：">
            <fileMain v-model="form.orderFiles" type="view"></fileMain>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="项目名称：" prop="projectName">
            <el-input v-model="form.projectName" disabled></el-input>
          </el-form-item>
          <el-form-item label="销售部门：" prop="salesDeptName">
            <el-input v-model="form.salesDeptName" disabled></el-input>
          </el-form-item>
          <el-form-item label="销售类型：" prop="saleTypeName">
            <el-input v-model="form.saleTypeName" disabled></el-input>
          </el-form-item>
          <el-form-item label="总金额：" prop="totalAmount">
            <el-input v-model="form.totalAmount" disabled>
              <template slot="append"> 元 </template>
            </el-input>
          </el-form-item>
          <el-form-item label="优惠后总金额：" prop="payAmount">
            <el-input v-model="form.payAmount" disabled>
              <template slot="append"> 元 </template>
            </el-input>
          </el-form-item>

          <el-form-item
            label="订单类型"
            prop="needProduce"
            style="margin-bottom: 22px"
          >
            <el-radio v-model="form.needProduce" :label="1">有客户生产性订单</el-radio>
            <el-radio v-model="form.needProduce" disabled :label="0"
              >库存式订单</el-radio
            >
            <el-radio v-model="form.needProduce" disabled :label="2"
              >无客户生产性订单</el-radio
            >
            <el-radio
              v-model="form.needProduce"
              disabled
              :label="4"
              v-if="clientEnvironmentId != 5"
              >不定向订单</el-radio
            >
          </el-form-item>
          <el-form-item
            label="总数"
            prop="totalPlanNum"
            v-if="form.needProduce == 4"
          >
            <el-input v-model="form.totalPlanNum" class="totalPlanNum" disabled>
              <template slot="append">
                <DictSelection
                  dictName="计量单位"
                  disabled
                  v-model="form.planNumUnit"
                >
                </DictSelection>
              </template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="客户名称：" prop="partaName">
            <el-input v-model="form.partaName" disabled></el-input>
          </el-form-item>
          <el-form-item
            label="客户统一社会信用代码："
            prop="partaUnifiedSocialCreditCode"
            class="form_item_label"
          >
            <el-input
              v-model="form.partaUnifiedSocialCreditCode"
              disabled
            ></el-input>
          </el-form-item>
          <el-form-item label="客户联系人：" prop="partaLinkName">
            <el-input v-model="form.partaLinkName" disabled></el-input>
          </el-form-item>
          <el-form-item label="客户电话：" prop="partaTel">
            <el-input v-model="form.partaTel" disabled></el-input>
          </el-form-item>
          <el-form-item label="客户传真：" prop="partaFax">
            <el-input v-model="form.partaFax" disabled></el-input>
          </el-form-item>
          <el-form-item label="	客户Email：" prop="partaEmail">
            <el-input v-model="form.partaEmail" disabled></el-input>
          </el-form-item>
          <el-form-item label="客户地址：" prop="partaAddress">
            <el-input v-model="form.partaAddress" disabled></el-input>
          </el-form-item>
          <el-form-item label="创建人：" prop="createUserName">
            <el-input v-model="form.createUserName" disabled></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="售出方名称：" prop="partbName">
            <el-input v-model="form.partbName" disabled></el-input>
          </el-form-item>
          <el-form-item
            label="售出方统一社会信用代码："
            prop="partbUnifiedSocialCreditCode"
            class="form_item_label"
          >
            <el-input
              v-model="form.partbUnifiedSocialCreditCode"
              disabled
            ></el-input>
          </el-form-item>
          <el-form-item label="售出方联系人：" prop="partbLinkName">
            <el-input v-model="form.partbLinkName" disabled></el-input>
          </el-form-item>
          <el-form-item
            prop="partbTel"
            label="售出方联系电话："
            class="form_item_label"
          >
            <el-input v-model="form.partbTel" disabled></el-input>
          </el-form-item>
          <el-form-item prop="partbFax" label="售出方传真：">
            <el-input v-model="form.partbFax" disabled></el-input>
          </el-form-item>

          <el-form-item label="售出方Email：" prop="partbEmail">
            <el-input v-model="form.partbEmail" disabled></el-input>
          </el-form-item>

          <el-form-item label="售出方地址：" prop="partbAddress">
            <el-input v-model="form.partbAddress" disabled></el-input>
          </el-form-item>

          <el-form-item label="创建时间：" prop="createTime">
            <el-input v-model="form.createTime" disabled></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <headerTitle title="物品清单" v-if="form.needProduce != 4"></headerTitle>
    <inventoryTabledetail
      v-if="form.needProduce != 4"
      ref="inventoryTabledetailRef"
      :isCustomerMark="true"
      :isDiscountTotalPrice="true"
      :isArrivalWay="true"
      pageName="send"
    ></inventoryTabledetail>
    <headerTitle title="类型清单" v-if="form.needProduce == 4"></headerTitle>
    <typeList
      v-if="form.needProduce == 4"
      ref="typeListRef"
      type="view"
    ></typeList>
  </div>
</template>

<script>
import { getFile } from '@/api/system/file';
import inventoryTabledetail from '@/BIZComponents/inventoryTableDetails.vue';
// import fileMain from '@/components/addDoc/index.vue';
import typeList from '../typeList.vue';

import dictMixins from '@/mixins/dictMixins';
export default {
  mixins: [dictMixins],
  components: { inventoryTabledetail,
    //  fileMain, 
     typeList },
  data() {
    return {
      form: {}
    };
  },
  computed: {
      clientEnvironmentId() {
        return this.$store.state.user.info.clientEnvironmentId;
      }
    },
  methods: {
    async init(row) {
      console.log(row,'rowsdds')
      this.form = row;
      this.$nextTick(() => {
        this.$refs.inventoryTabledetailRef &&
          this.$refs.inventoryTabledetailRef.putTableValue(row);
        this.$refs.typeListRef &&
          this.$refs.typeListRef.putTableValue(row.typedetailList);
      });
    },

    downloadFile(file) {
      getFile({ objectName: file.storePath }, file.name);
    }
  }
};
</script>
<style lang="scss" scoped>
.totalPlanNum {
  :deep(.el-input-group__append) {
    width: 160px;
  }
}
</style>
