<template>
  <div id="detailInfo">
    <el-row>
      <el-col :span="24">
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
          <el-form-item label="产品名称:">
            <span>{{ ruleForm.name }}</span>
          </el-form-item>
          <span v-if="ruleForm.status === '1' || ruleForm.status === '2'">
            <el-form-item label="发布状态:">
              <span>{{ ruleForm.status === '0' ? '未发布' : ruleForm.status === '1' ? '发布' : '下架' }}</span>
            </el-form-item>
          </span>
          <el-form-item label="图片:">
            <el-image :src="ruleForm.pic"></el-image>
          </el-form-item>
          <el-form-item>
            <span v-if="ruleForm.status === '0'">
              <el-button type="primary" @click="submitForm('ruleForm')">发布</el-button>
            </span>
            <span v-if="ruleForm.status === '1'">
              <el-button type="danger" @click="resetForm('ruleForm')">下架</el-button>
            </span>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'detailInfo',
  props: {
    ruleForm: null,
    rules: null,
  },
  components: {},
  data: () => ({}),
  created() {},
  computed: {},
  methods: {
    submitForm(ruleForm) {
      this.$emit('submitForm', { data: this.ruleForm });
    },
    resetForm(ruleForm) {
      this.$emit('resetForm', { data: this.ruleForm });
    },
  },
};
</script>

<style lang="scss" scoped></style>
