<template>
  <div id="tabs-1">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-form :model="form" :rules="rules" ref="form" label-width="180px">
            <el-col :span="18">
              <el-form-item label="活动时间" prop="act_time">
                <el-form ref="act_time" :model="act_time" label-width="80px">
                  <el-form-item label="是否显示">
                    <el-select v-model="act_time.is_use" placeholder="请选择">
                      <el-option v-for="i in isuseList" :key="i.model" :label="i.label" :value="i.value"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="活动标题">
                    <el-input v-model="act_time.title"></el-input>
                  </el-form-item>
                  <el-form-item label="说明">
                    <el-input v-model="act_time.value"></el-input>
                  </el-form-item>
                </el-form>
              </el-form-item>
            </el-col>
            <el-col :span="13">
              <el-form-item label="是否在首页展示" prop="show_index">
                <el-select v-model="form.show_index" clearable filterable placeholder="请选择是否在首页展示" size="small" style="width: 100%">
                  <el-option v-for="i in isuseList" :key="i.value" :label="i.label" :value="i.value"> </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="13">
              <el-form-item label="是否开启" prop="is_use">
                <el-select v-model="form.is_use" clearable filterable placeholder="请选择是否开启" size="small" style="width: 100%">
                  <el-option v-for="i in isuseList" :key="i.value" :label="i.label" :value="i.value"> </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="13">
              <el-form-item label="排序" prop="sort">
                <el-input v-model="form.sort" placeholder="请输入排序" size="small" type="Number"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="13">
              <el-form-item label="活动类型" prop="type" v-if="goodsAct == true">
                <el-select v-model="form.type" clearable filterable placeholder="请选择活动类型" size="small" style="width: 100%">
                  <el-option v-for="i in act_typeList" :key="i.value" :label="i.label" :value="i.value"> </el-option>
                </el-select>
                <p>活动有商品时,不允许修改活动类型</p>
              </el-form-item>
              <el-form-item label="活动类型" prop="type" v-else-if="goodsAct == false">
                <el-select v-model="form.type" disabled clearable filterable placeholder="请选择活动类型" size="small" style="width: 100%">
                  <el-option v-for="i in act_typeList" :key="i.value" :label="i.label" :value="i.value"> </el-option>
                </el-select>
                <p>活动有商品时,不允许修改活动类型</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-col :span="8">
                <el-form-item label="分享图片(237*190)" prop="share">
                  <c-upload :url="url" v-model="form.share" :limit="1"></c-upload>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="封面图片(345*85)" prop="cover">
                  <c-upload :url="url" v-model="form.cover" :limit="1"></c-upload>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :span="24">
              <el-form-item label="活动说明" prop="content">
                <el-form ref="content" :model="content" label-width="80px">
                  <el-form-item label="是否显示">
                    <el-select v-model="content.is_use" placeholder="请选择">
                      <el-option v-for="i in isuseList" :key="i.model" :label="i.label" :value="i.value"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <editor v-model="content.value" url="/files/point/act/upload" />
                  </el-form-item>
                </el-form>
              </el-form-item>
            </el-col>
          </el-form>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'tabs-1',
  props: {
    form: { type: Object },
    act_time: { type: Object },
    content: { type: Object },
    act_typeList: { type: Array },
    isuseList: { type: Array },
    url: { type: String },
    rules: { type: Object },
    goodsAct: { type: Boolean },
  },
  components: {
    editor: () => import('@/components/editor.vue'),
    cUpload: () => import('@/components/usual/c-upload.vue'),
  },
  data: function () {
    return {};
  },
  created() {},
  methods: {},
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

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