<script setup>
import Api from "../../../../../api/index.js";
import XSelect from "../../../../../components/XSelect/index.vue";
import FormTitle from "../../../../../components/FormTitle/index.vue";
import UploadOne from "../../../../../components/upload/UploadOne.vue";

const emits = defineEmits(['success', 'prev']);
const form = defineModel('form');

const success = () => {
    emits('success', form.value);
}
</script>

<template>
    <FormTitle>
        <template #title>发布管理</template>

        <a-form
            class="mt-[30px]"
            :model="form"
            :label-col-props="{span: 4}"
            :wrapper-col-props="{span: 12, offset: 1}">
            <a-form-item label="发布次数">
                <XSelect
                    v-model:model-value="form.fb_num"
                    :init="true"
                    :api="Api.merchant.getNumberOfReleases">
                </XSelect>
            </a-form-item>

            <a-form-item label="每次素材是否相同">
                <a-radio-group v-model:model-value="form.is_identical">
                    <a-radio :value="1">相同</a-radio>
                    <a-radio :value="0">不同</a-radio>
                </a-radio-group>
            </a-form-item>

            <a-form-item label="每次发布间隔时长">
                <XSelect
                    v-model:model-value="form.duration"
                    placeholder="无要求"
                    :init="true"
                    :api="Api.merchant.getPublicationDuration">
                </XSelect>
            </a-form-item>

            <a-form-item label="特殊要求">
                <a-input v-model:model-value="form.special_text"
                         placeholder="请输入特殊要求，如：请勿截图，必须下载原图再上传到抖音"></a-input>
            </a-form-item>

            <a-form-item label="">
                {{ form.special_images }}
                <upload-one :file="form.special_images" size="100px" :api="Api.system.uploadFile2"></upload-one>
            </a-form-item>

            <a-form-item label="选择限制 IP">
                <XSelect
                    multiple
                    :max-tag-count="4"
                    :init="true"
                    v-model:model-value="form.choose_area"
                    :api="Api.merchant.getProvince">
                </XSelect>
            </a-form-item>

            <a-form-item label="每个设备可参加几次">
                <a-input-number placeholder="敬请期待" disabled></a-input-number>
            </a-form-item>

            <a-form-item class="mt-[30px]">
                <a-button class="mr-[24px]" @click="emits('prev')">上一步</a-button>
                <a-button type="primary" @click="success">下一步</a-button>
            </a-form-item>
        </a-form>
    </FormTitle>
</template>

<style scoped>

</style>
