<style>
.create-unit .ant-form-item-control {
  line-height: inherit;
}
.create-unit .ant-tabs-bar {
  width: 50%;
  margin: auto;
  margin-bottom: 16px;
  border-bottom: 1px solid #e8e8e8;
  outline: none;
  -webkit-transition: padding 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  transition: padding 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.create-unit .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active {
  color: #fff;
  background: #1890ff !important;
  border-color: #1890ff !important;
  border-bottom: 1px solid #1890ff !important;
}
.create-unit .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab {
  height: 40px;
  margin: 0;
  margin-right: 2px;
  padding: 0 16px;
  line-height: 38px;
  background: #fafafa;
  border: 1px solid #e8e8e8 !important;
  border-radius: 4px 4px 0 0 !important;
  -webkit-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
</style>
<template>
  <div class="create-unit">
    <a-card :body-style="{ padding: '24px 32px' }" :bordered="false">
      <a-form-model ref="unitCreate" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
        <a-tabs type="card" :label-col="labelCol" :wrapper-col="wrapperCol" @change="changeAccount">
          <a-tab-pane :key="item.accountId" :tab="'账户:' + item.accountName" v-for="(item, index) of form.accountArr">
            <a-form-model-item label="计划下组是否相同" prop="campaignAgreement">
              <a-radio-group v-model="item.campaignAgreement" buttonStyle="solid">
                <a-radio-button :value="0">是</a-radio-button>
                <a-radio-button :value="1">否</a-radio-button>
              </a-radio-group>
            </a-form-model-item>
            <a-form-model-item label="计划下组数量" prop="unitCount">
              <a-input-number v-model="item.unitCount" :min="1" :max="10" @change="changeCreateTotal(item)" />
            </a-form-model-item>

            <a-tabs type="card" v-if="item.campaignAgreement == 1">
              <a-tab-pane
                :key="campaign.campaignId"
                :tab="'计划:' + campaign.campaignName"
                v-for="(campaign, campaignIndex) of item.campaignList"
              >
                <a-form-model-item label="组是否相同">
                  <a-radio-group buttonStyle="solid" v-model="campaign.check" @change="nameTypeChange(campaign, item)">
                    <a-radio-button value="1">是</a-radio-button>
                    <a-radio-button value="2">否</a-radio-button>
                  </a-radio-group>
                </a-form-model-item>

                <a-tabs v-if="campaign.check == '2'" type="card">
                  <a-tab-pane
                    :key="indexUnit"
                    :tab="'组 : ' + (indexUnit + 1)"
                    v-for="(unitName, indexUnit) of campaign.unit"
                  >
                    <a-form-model-item
                      ref="unitName"
                      :key="indexUnit"
                      :label="'组名称'"
                      :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unit.' + indexUnit + '.name'"
                      :rules="{
                        required: true,
                        message: '组名称必填',
                        trigger: 'blur',
                      }"
                      ><a-input
                        v-model="unitName.name"
                        placeholder="请输入组名称"
                        style="width: 60%; margin-right: 8px"
                      />
                    </a-form-model-item>
                    <a-form-model-item
                      label="目标应用"
                      ref="appId"
                      v-if="item.campaignType == 2"
                      :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unit.' + indexUnit + '.appId'"
                      :rules="{
                        required: true,
                        message: '目标应用必选',
                        trigger: 'change',
                      }"
                    >
                      <a-select
                        v-model="unitName.appId"
                        showSearch
                        allowClear
                        placeholder="选择应用目标"
                        optionFilterProp="children"
                        style="width: 500px"
                        @focus="handleFocus"
                        @blur="handleBlur"
                        @change="handleChange"
                        :filterOption="filterOption"
                      >
                        <a-select-option
                          v-for="appModel in appList"
                          :key="appModel.appId + 'campaignList'"
                          :value="appModel.appId"
                        >
                          {{ appModel.appName }}&#12288;&nbsp;&#12288;
                          {{ appModel.appVersion }}&#12288;&#12288;&#12288;{{ appModel.platform | platform }}
                        </a-select-option>
                      </a-select>
                    </a-form-model-item>
                    <a-form-model-item label="转化类型" ref="urlType" prop="urlType" v-if="item.campaignType == 3">
                      <a-radio-group buttonStyle="solid" v-model="unitName.urlType">
                        <a-radio-button value="1">淘宝商品</a-radio-button>
                        <a-radio-button value="2">淘客商品</a-radio-button>
                      </a-radio-group>
                    </a-form-model-item>
                    <a-form-model-item
                      :label="item.campaignType == 3 ? ' ' : '链接'"
                      v-if="item.campaignType != 2"
                      :rules="{
                        required: true,
                        message: '链接不能为空',
                        trigger: 'blur',
                      }"
                    >
                      <a-input placeholder="请填写链接" v-model="unitName.url" />
                    </a-form-model-item>

                    <a-form-model-item
                      label="转化目标"
                      v-if="item.campaignType == 2 || item.campaignType == 4 || item.campaignType == 5"
                    >
                      <span v-if="unitName.convertId && !convert" style="display: block; font-size: 16px"
                        >已选择转化目标: {{ convertId.label }}</span
                      >
                      <a-button type="primary" @click="showConvert(item, unitName)">{{
                        unitName.convertId ? '更换转化目标' : '选择转化目标'
                      }}</a-button>
                    </a-form-model-item>

                    <a-form-model-item
                      v-bind="formItemLayout"
                      v-if="
                        item.campaignType == 2 &&
                        (getPlatForm(unitName.appId) == '1' || getPlatForm(unitName.appId) == '2')
                      "
                    >
                      <a-checkbox v-model="unitName.useAppMarket"> 优先从系统应用商店下载 </a-checkbox>
                    </a-form-model-item>
                    <a-form-model-item v-bind="formItemLayout" v-if="unitName.useAppMarket">
                      请勾选投放应用已上架的应用商店（默认全选）
                      <br />
                      <a-checkbox-group v-model="unitName.appStore">
                        <a-checkbox value="huawei">华为</a-checkbox>
                        <a-checkbox value="oppo">OPPO</a-checkbox>
                        <a-checkbox value="vivo">VIVO</a-checkbox>
                        <a-checkbox value="xiaomi">小米</a-checkbox>
                        <a-checkbox value="meizu">魅族</a-checkbox>
                        <a-checkbox value="smartisan">锤子</a-checkbox>
                      </a-checkbox-group>
                    </a-form-model-item>

                    <a-form-model-item
                      label="定向模板"
                      ref="templateId"
                      :prop="
                        'accountArr.' + index + '.campaignList.' + campaignIndex + '.unit.' + indexUnit + '.templateId'
                      "
                      :rules="{
                        required: true,
                        message: '定向模板必选',
                        trigger: 'change',
                      }"
                    >
                      <a-select
                        v-model="unitName.templateId"
                        showSearch
                        allowClear
                        placeholder="选择定向模板"
                        optionFilterProp="children"
                        style="width: 500px"
                        @focus="handleFocus"
                        @blur="handleBlur"
                        @change="handleChange"
                        :filterOption="filterOption"
                      >
                        <a-select-option
                          v-for="appModel in templateList"
                          :key="appModel.templateId"
                          :value="appModel.templateId"
                        >
                          {{ appModel.templateName }}
                        </a-select-option>
                      </a-select>
                      <a style="margin: 0 10px" @click="addTemplate(item.accountId)">新增模板</a>
                      <a
                        @click="lookTemplate(item.accountId, unitName.templateId)"
                        :disabled="unitName.templateId == ''"
                        >查看模板</a
                      >
                    </a-form-model-item>
                    <a-form-model-item label="投放范围">
                      <a-radio-group buttonStyle="solid" v-model="unitName.allianceAccount" disabled>
                        <a-radio-button value="1">默认</a-radio-button>
                        <a-radio-button value="2">联盟广告</a-radio-button>
                      </a-radio-group>
                    </a-form-model-item>

                    <a-form-model-item label="单日预算">
                      <a-radio-group buttonStyle="solid" v-model="unitName.dayBudgetType">
                        <a-radio-button value="0">不限</a-radio-button>
                        <a-radio-button value="1">统一预算</a-radio-button>
                      </a-radio-group>
                    </a-form-model-item>
                    <a-form-model-item
                      label=""
                      v-bind="unitName.dayBudgetType == '1' ? formItemLayout : {}"
                      v-if="unitName.dayBudgetType == '1'"
                      :prop="
                        'accountArr.' + index + '.campaignList.' + campaignIndex + '.unit.' + indexUnit + '.dayBudget'
                      "
                      :rules="{
                        required: true,
                        message: '预算不能为空',
                        trigger: 'blur',
                      }"
                    >
                      <a-input
                        placeholder="不小于100，不超过100000000，仅支持输入自然数"
                        style="width: 60%"
                        v-model="unitName.dayBudget"
                      />
                    </a-form-model-item>
                    <a-form-model-item label="投放方式">
                      <a-radio-group buttonStyle="solid" v-model="unitName.speed">
                        <a-radio-button value="1">正常投放</a-radio-button>
                        <a-radio-button value="2">平滑投放</a-radio-button>
                      </a-radio-group>
                      <br />
                      <span>
                        {{ unitName.speed == '2' ? '平滑匀速投放' : '尽快展示广告消耗预算' }}
                      </span>
                    </a-form-model-item>

                    <a-form-model-item label="排期">
                      <!-- v-decorator="['speed', { initialValue: '1' }]" -->
                      <a-radio-group buttonStyle="solid" v-model="unitName.time" @change="setTime(unitName)">
                        <a-radio-button value="1">从今天开始长期投放</a-radio-button>
                        <a-radio-button value="2">设置开始和结束日期</a-radio-button>
                      </a-radio-group>
                      <br />
                      <a-range-picker
                        v-if="unitName.time == '2'"
                        v-model="unitName.timeRange"
                        format="YYYY-MM-DD"
                        style="margin-top: 15px"
                        :allowClear="false"
                      />
                    </a-form-model-item>
                    <a-form-model-item label="投放时段">
                      <a-radio-group
                        buttonStyle="solid"
                        v-model="unitName.scheduleTimeData"
                        @change="setTimeAll(unitName)"
                      >
                        <a-radio-button value="1">全天</a-radio-button>
                        <a-radio-button value="2">特定时间</a-radio-button>
                      </a-radio-group>
                      <br />
                      <selectCheckAll
                        style="width: 60%; margin-top: 15px"
                        v-if="unitName.scheduleTimeData == '2'"
                        :scheduleTime.sync="unitName.scheduleTime"
                        ref="selectCheck"
                      />
                    </a-form-model-item>
                    <a-form-model-item label="创意展现方式" prop="campaign">
                      <a-radio-group buttonStyle="solid" v-model="unitName.showMode">
                        <a-radio-button value="2">智能优选</a-radio-button>
                        <a-radio-button value="1">随机轮播</a-radio-button>
                      </a-radio-group>
                      <br />
                      <span>
                        {{
                          unitName.showMode == '1'
                            ? '广告组包含的广告创意将随机展现'
                            : '每一次展现的时候，系统会进行CTR预估，预估CTR高的会得到展现机会'
                        }}
                      </span>
                    </a-form-model-item>
                    <a-form-model-item label="场景广告位">
                      <checkBoxGroup
                        :options="[
                          { label: '优选广告位', value: 1 },
                          { label: '信息流广告', value: 7 },
                          { label: '上下滑大屏广告', value: 6 },
                          { label: '视频播放页广告', value: 3 },
                        ]"
                        v-model="unitName.sceneId"
                        @change="changeData"
                        :disabled="unitName.allianceAccount == '2'"
                      />
                    </a-form-model-item>
                    <a-form-model-item label="优化目标">
                      <a-radio-group buttonStyle="solid" v-model="unitName.bidType" @change="changeBidType(unitName)">
                        <a-radio-button :value="1">点击数</a-radio-button>
                        <a-radio-button :value="10">转化数</a-radio-button>
                      </a-radio-group>
                    </a-form-model-item>
                    <a-form-model-item label="转化目标" v-if="unitName.bidType == 10">
                      <a-select v-model="unitName.ocpxActionType" style="width: 60%">
                        <a-select-option :value="2">行为数</a-select-option>
                        <a-select-option :value="180" v-if=" groupTypeData.isActivate == '1'"
                          >激活</a-select-option
                        >
                        <a-select-option
                          :value="53"
                          v-if="
                             groupTypeData.isFormSubmit == '1'
                          "
                          >表单提交</a-select-option
                        >
                        <a-select-option :value="394" v-if="groupTypeData.isOrderSubmit == '1'"
                          >订单提交</a-select-option
                        >
                        <a-select-option :value="348" v-if="groupTypeData.isValidClue == '1'"
                          >使用有效线索</a-select-option
                        >
                        <a-select-option :value="383" v-if="groupTypeData.isCreditGrant == '1'"
                          >授信出价</a-select-option
                        >
                        <a-select-option :value="384" v-if="groupTypeData.isWanJian == '1'">完件出价</a-select-option>
                        <a-select-option :value="190" v-if="groupTypeData.isPurchase == '1'">付费出价</a-select-option>
                        <a-select-option :value="191" v-if="groupTypeData.isFirstdayRoi == '1'"
                          >首日ROI</a-select-option
                        >
                        <a-select-option :value="396" v-if="groupTypeData.isRegister == '1'"
                          >注册优化目标</a-select-option
                        >
                      </a-select>
                    </a-form-model-item>
                    <a-form-model-item
                      label="深度转化目标"
                      v-if="
                        (unitName.ocpxActionType == 180 || unitName.ocpxActionType == 53) &&
                        groupTypeData.deepConversionTypes.length > 0
                      "
                    >
                      <a-select v-model="unitName.deepConversionType" allowClear>
                        <a-select-option
                          :value="items.deepConversionType"
                          v-for="(items, index) of groupTypeData.deepConversionTypes"
                          :key="index"
                        >
                          {{ items.desc }}</a-select-option
                        >
                      </a-select>
                    </a-form-model-item>
                    <a-form-model-item label="计费方式">
                      <a-radio-group defaultValue="1" style="margin-top: 8px">
                        <a-radio value="1">{{ unitName.bidType == 1 ? '点击计费' : '展示计费(oCPM)' }}</a-radio>
                      </a-radio-group>
                    </a-form-model-item>

                    <a-form-model-item
                      label="出价"
                      v-if="unitName.bidType == 1"
                      :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unit.' + indexUnit + '.bid'"
                      :rules="{
                        required: true,
                        message: '出价不能为空',
                        trigger: 'blur',
                      }"
                    >
                      <a-input-number v-model="unitName.bid"> </a-input-number>
                    </a-form-model-item>
                    <a-form-model-item
                      label="目标成本"
                      v-else
                      :prop="
                        'accountArr.' + index + '.campaignList.' + campaignIndex + '.unit.' + indexUnit + '.cpaBid'
                      "
                      :rules="{
                        required: true,
                        message: '目标成本不能为空',
                        trigger: 'blur',
                      }"
                    >
                      <a-input-number v-model="unitName.cpaBid"> </a-input-number>
                    </a-form-model-item>
                    <a-form-model-item
                      label="深度转化出价"
                      :labelCol="{ lg: { span: 6 }, sm: { span: 7 } }"
                      :wrapperCol="{ lg: { span: 18 }, sm: { span: 17 } }"
                      v-if="
                        (unitName.ocpxActionType == 180 || unitName.ocpxActionType == 53) &&
                        groupTypeData.deepConversionTypes.length > 0 &&
                        unitName.deepConversionType != ''
                      "
                    >
                      <a-input-number
                        v-model="unitName.deepConversionBid"
                        :disabled="unitName.cpaBid == '' || unitName.cpaBid == null"
                      ></a-input-number>
                    </a-form-model-item>
                  </a-tab-pane>
                </a-tabs>
                <div v-else>
                  <a-form-model-item
                    label="组名称"
                    :prop="
                      'accountArr.' +
                      index +
                      '.campaignList.' +
                      campaignIndex +
                      '.unitIdentical.unitName.' +
                      unitIndex +
                      '.name'
                    "
                    :rules="{
                      required: true,
                      message: '组名称必填',
                      trigger: 'blur',
                    }"
                    v-for="(unitCount, unitIndex) in campaign.unitIdentical.unitName"
                    :key="unitIndex"
                    :label="unitIndex == 0 ? '组名称' : ''"
                    v-bind="unitIndex !== 0 ? formItemLayout : {}"
                  >
                    <a-input
                      v-model="unitCount.name"
                      placeholder="请输入组名称"
                      style="width: 60%; margin-right: 8px"
                    />
                  </a-form-model-item>
                  <a-form-model-item
                    label="目标应用"
                    ref="appId"
                    prop="appId"
                    v-if="item.campaignType == 2"
                    :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unitIdentical.appId'"
                    :rules="{
                      required: true,
                      message: '应用目标必选',
                      trigger: 'change',
                    }"
                  >
                    <a-select
                      v-model="campaign.unitIdentical.appId"
                      showSearch
                      allowClear
                      placeholder="选择应用目标"
                      optionFilterProp="children"
                      style="width: 500px"
                      @focus="handleFocus"
                      @blur="handleBlur"
                      @change="handleChange"
                      :filterOption="filterOption"
                    >
                      <a-select-option
                        v-for="appModel in appList"
                        :key="appModel.appId + 'unitIdentical'"
                        :value="appModel.appId"
                      >
                        {{ appModel.appName }}&#12288;&nbsp;&#12288; {{ appModel.appVersion }}&#12288;&#12288;&#12288;{{
                          appModel.platform | platform
                        }}
                      </a-select-option>
                    </a-select>
                  </a-form-model-item>

                  <a-form-model-item label="转化类型" ref="urlType" prop="urlType" v-if="item.campaignType == 3">
                    <a-radio-group buttonStyle="solid" v-model="campaign.unitIdentical.urlType">
                      <a-radio-button value="1">淘宝商品</a-radio-button>
                      <a-radio-button value="2">淘客商品</a-radio-button>
                    </a-radio-group>
                  </a-form-model-item>
                  <a-form-model-item
                    :label="item.campaignType == 3 ? ' ' : '链接'"
                    v-if="item.campaignType != 2"
                    :rules="{
                      required: true,
                      message: '链接不能为空',
                      trigger: 'blur',
                    }"
                  >
                    <a-input placeholder="请填写链接" v-model="campaign.unitIdentical.url" />
                  </a-form-model-item>

                  <a-form-model-item
                    label="转化目标"
                    v-if="item.campaignType == 2 || item.campaignType == 4 || item.campaignType == 5"
                  >
                    <span v-if="campaign.unitIdentical.convertId && !convert" style="display: block; font-size: 16px"
                      >已选择转化目标: {{ campaign.unitIdentical.label }}</span
                    >
                    <a-button type="primary" @click="showConvert(item, campaign.unitIdentical)">{{
                      campaign.unitIdentical.convertId ? '更换转化目标' : '选择转化目标'
                    }}</a-button>
                  </a-form-model-item>

                  <a-form-model-item
                    v-bind="formItemLayout"
                    v-if="
                      item.campaignType == 2 &&
                      (getPlatForm(campaign.unitIdentical.appId) == '1' ||
                        getPlatForm(campaign.unitIdentical.appId) == '2')
                    "
                  >
                    <a-checkbox v-model="campaign.unitIdentical.useAppMarket"> 优先从系统应用商店下载 </a-checkbox>
                  </a-form-model-item>
                  <a-form-model-item v-bind="formItemLayout" v-if="campaign.unitIdentical.useAppMarket">
                    请勾选投放应用已上架的应用商店（默认全选）
                    <br />
                    <a-checkbox-group v-model="campaign.unitIdentical.appStore">
                      <a-checkbox value="huawei">华为</a-checkbox>
                      <a-checkbox value="oppo">OPPO</a-checkbox>
                      <a-checkbox value="vivo">VIVO</a-checkbox>
                      <a-checkbox value="xiaomi">小米</a-checkbox>
                      <a-checkbox value="meizu">魅族</a-checkbox>
                      <a-checkbox value="smartisan">锤子</a-checkbox>
                    </a-checkbox-group>
                  </a-form-model-item>

                  <a-form-model-item
                    label="定向模板"
                    ref="templateId"
                    :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unitIdentical.templateId'"
                    :rules="{
                      required: true,
                      message: '定向模板必选',
                      trigger: 'change',
                    }"
                  >
                    <a-select
                      v-model="campaign.unitIdentical.templateId"
                      showSearch
                      allowClear
                      placeholder="选择定向模板"
                      optionFilterProp="children"
                      style="width: 500px"
                      @focus="handleFocus"
                      @blur="handleBlur"
                      @change="handleChange"
                      :filterOption="filterOption"
                    >
                      <a-select-option
                        v-for="appModel in templateList"
                        :key="appModel.templateId"
                        :value="appModel.templateId"
                      >
                        {{ appModel.templateName }}
                      </a-select-option>
                    </a-select>
                    <a style="margin: 0 10px" @click="addTemplate(item.accountId)">新增模板</a>
                    <a
                      @click="lookTemplate(item.accountId, campaign.unitIdentical.templateId)"
                      :disabled="campaign.unitIdentical.templateId == ''"
                      >查看模板</a
                    >
                  </a-form-model-item>

                  <a-form-model-item label="投放范围">
                    <a-radio-group buttonStyle="solid" v-model="campaign.unitIdentical.allianceAccount" disabled>
                      <a-radio-button value="1">默认</a-radio-button>
                      <a-radio-button value="2">联盟广告</a-radio-button>
                    </a-radio-group>
                  </a-form-model-item>

                  <a-form-model-item label="单日预算">
                    <a-radio-group buttonStyle="solid" v-model="campaign.unitIdentical.dayBudgetType">
                      <a-radio-button value="0">不限</a-radio-button>
                      <a-radio-button value="1">统一预算</a-radio-button>
                    </a-radio-group>
                  </a-form-model-item>
                  <a-form-model-item
                    label=""
                    v-bind="campaign.unitIdentical.dayBudgetType == '1' ? formItemLayout : {}"
                    v-if="campaign.unitIdentical.dayBudgetType == '1'"
                    :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unitIdentical.dayBudget'"
                    :rules="{
                      required: true,
                      message: '预算不能为空',
                      trigger: 'blur',
                    }"
                  >
                    <a-input
                      placeholder="不小于100，不超过100000000，仅支持输入自然数"
                      style="width: 60%"
                      v-model="campaign.unitIdentical.dayBudget"
                    />
                  </a-form-model-item>
                  <a-form-model-item label="投放方式">
                    <a-radio-group buttonStyle="solid" v-model="campaign.unitIdentical.speed">
                      <a-radio-button value="1">正常投放</a-radio-button>
                      <a-radio-button value="2">平滑投放</a-radio-button>
                    </a-radio-group>
                    <br />
                    <span>
                      {{ campaign.unitIdentical.speed == '2' ? '平滑匀速投放' : '尽快展示广告消耗预算' }}
                    </span>
                  </a-form-model-item>

                  <a-form-model-item label="排期">
                    <!-- v-decorator="['speed', { initialValue: '1' }]" -->
                    <a-radio-group
                      buttonStyle="solid"
                      v-model="campaign.unitIdentical.time"
                      @change="setTime(campaign.unitIdentical)"
                    >
                      <a-radio-button value="1">从今天开始长期投放</a-radio-button>
                      <a-radio-button value="2">设置开始和结束日期</a-radio-button>
                    </a-radio-group>
                    <br />
                    <a-range-picker
                      v-if="campaign.unitIdentical.time == '2'"
                      v-model="campaign.unitIdentical.timeRange"
                      format="YYYY-MM-DD"
                      style="margin-top: 15px"
                      :allowClear="false"
                    />
                  </a-form-model-item>
                  <a-form-model-item label="投放时段">
                    <a-radio-group
                      buttonStyle="solid"
                      v-model="campaign.unitIdentical.scheduleTimeData"
                      @change="setTimeAll(campaign.unitIdentical)"
                    >
                      <a-radio-button value="1">全天</a-radio-button>
                      <a-radio-button value="2">特定时间</a-radio-button>
                    </a-radio-group>
                    <br />
                    <selectCheckAll
                      style="width: 60%; margin-top: 15px"
                      v-if="campaign.unitIdentical.scheduleTimeData == '2'"
                      :scheduleTime.sync="campaign.unitIdentical.scheduleTime"
                      ref="selectCheck"
                    />
                  </a-form-model-item>
                  <a-form-model-item label="创意展现方式" prop="campaign">
                    <a-radio-group buttonStyle="solid" v-model="campaign.unitIdentical.showMode">
                      <a-radio-button value="2">智能优选</a-radio-button>
                      <a-radio-button value="1">随机轮播</a-radio-button>
                    </a-radio-group>
                    <br />
                    <span>
                      {{
                        campaign.unitIdentical.showMode == '1'
                          ? '广告组包含的广告创意将随机展现'
                          : '每一次展现的时候，系统会进行CTR预估，预估CTR高的会得到展现机会'
                      }}
                    </span>
                  </a-form-model-item>
                  <a-form-model-item label="场景广告位">
                    <checkBoxGroup
                      :options="[
                        { label: '优选广告位', value: 1 },
                        { label: '信息流广告', value: 7 },
                        { label: '上下滑大屏广告', value: 6 },
                        { label: '视频播放页广告', value: 3 },
                      ]"
                      v-model="campaign.unitIdentical.sceneId"
                      @change="changeData"
                      :disabled="campaign.unitIdentical.allianceAccount == '2'"
                    />
                  </a-form-model-item>
                  <a-form-model-item label="优化目标">
                    <a-radio-group
                      buttonStyle="solid"
                      v-model="campaign.unitIdentical.bidType"
                      @change="changeBidType(campaign.unitIdentical)"
                    >
                      <a-radio-button :value="1">点击数</a-radio-button>
                      <a-radio-button :value="10">转化数</a-radio-button>
                    </a-radio-group>
                  </a-form-model-item>
                  <a-form-model-item label="转化目标" v-if="campaign.unitIdentical.bidType == 10">
                    <a-select v-model="campaign.unitIdentical.ocpxActionType" style="width: 60%">
                      <a-select-option :value="2">行为数</a-select-option>
                      <a-select-option :value="180" v-if=" groupTypeData.isActivate == '1'"
                        >激活</a-select-option
                      >
                      <a-select-option
                        :value="53"
                        v-if="
                           groupTypeData.isFormSubmit == '1'
                        "
                        >表单提交</a-select-option
                      >
                      <a-select-option :value="394" v-if="groupTypeData.isOrderSubmit == '1'">订单提交</a-select-option>
                      <a-select-option :value="348" v-if="groupTypeData.isValidClue == '1'"
                        >使用有效线索</a-select-option
                      >
                      <a-select-option :value="383" v-if="groupTypeData.isCreditGrant == '1'">授信出价</a-select-option>
                      <a-select-option :value="384" v-if="groupTypeData.isWanJian == '1'">完件出价</a-select-option>
                      <a-select-option :value="190" v-if="groupTypeData.isPurchase == '1'">付费出价</a-select-option>
                      <a-select-option :value="191" v-if="groupTypeData.isFirstdayRoi == '1'">首日ROI</a-select-option>
                      <a-select-option :value="396" v-if="groupTypeData.isRegister == '1'"
                        >注册优化目标</a-select-option
                      >
                    </a-select>
                  </a-form-model-item>
                  <a-form-model-item
                    label="深度转化目标"
                    v-if="
                      (campaign.unitIdentical.ocpxActionType == 180 || campaign.unitIdentical.ocpxActionType == 53) &&
                      groupTypeData.deepConversionTypes.length > 0
                    "
                  >
                    <a-select v-model="campaign.unitIdentical.deepConversionType" allowClear>
                      <a-select-option
                        :value="items.deepConversionType"
                        v-for="(items, index) of groupTypeData.deepConversionTypes"
                        :key="index"
                      >
                        {{ items.desc }}</a-select-option
                      >
                    </a-select>
                  </a-form-model-item>
                  <a-form-model-item label="计费方式">
                    <a-radio-group defaultValue="1" style="margin-top: 8px">
                      <a-radio value="1">{{
                        campaign.unitIdentical.bidType == 1 ? '点击计费' : '展示计费(oCPM)'
                      }}</a-radio>
                    </a-radio-group>
                  </a-form-model-item>

                  <a-form-model-item
                    label="出价"
                    v-if="campaign.unitIdentical.bidType == 1"
                    :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unitIdentical.bid'"
                    :rules="{
                      required: true,
                      message: '出价不能为空',
                      trigger: 'change',
                    }"
                  >
                    <a-input-number v-model="campaign.unitIdentical.bid"> </a-input-number>
                  </a-form-model-item>
                  <a-form-model-item
                    label="目标成本"
                    v-else
                    :prop="'accountArr.' + index + '.campaignList.' + campaignIndex + '.unitIdentical.cpaBid'"
                    :rules="{
                      required: true,
                      message: '目标成本不能为空',
                      trigger: 'change',
                    }"
                  >
                    <a-input-number v-model="campaign.unitIdentical.cpaBid"> </a-input-number>
                  </a-form-model-item>
                  <a-form-model-item
                    label="深度转化出价"
                    :labelCol="{ lg: { span: 6 }, sm: { span: 7 } }"
                    :wrapperCol="{ lg: { span: 18 }, sm: { span: 17 } }"
                    v-if="
                      (campaign.unitIdentical.ocpxActionType == 180 || campaign.unitIdentical.ocpxActionType == 53) &&
                      groupTypeData.deepConversionTypes.length > 0 &&
                      campaign.unitIdentical.deepConversionType != ''
                    "
                  >
                    <a-input-number
                      v-model="campaign.unitIdentical.deepConversionBid"
                      :disabled="campaign.unitIdentical.cpaBid == '' || campaign.unitIdentical.cpaBid == null"
                    ></a-input-number>
                  </a-form-model-item>
                </div>
              </a-tab-pane>
            </a-tabs>
            <div v-else>
              <a-form-model-item
                ref="unitName"
                v-for="(unitName, indexUnit) of item.campaignOne.unitNames"
                :key="indexUnit"
                :label="indexUnit == 0 ? '组名称' : ''"
                v-bind="indexUnit !== 0 ? formItemLayout : {}"
                :prop="'accountArr.' + index + '.campaignOne.unitNames.' + indexUnit + '.value'"
                :rules="{
                  required: true,
                  message: '组名称必填',
                  trigger: 'blur',
                }"
                ><a-input v-model="unitName.value" placeholder="请输入组名称" style="width: 60%; margin-right: 8px" />
              </a-form-model-item>

              <a-form-model-item
                label="目标应用"
                ref="appId"
                prop="appId"
                v-if="item.campaignType == 2"
                :prop="'accountArr.' + index + '.campaignOne.appId'"
                :rules="{
                  required: true,
                  message: '目标应用必选',
                  trigger: 'change',
                }"
              >
                <a-select
                  v-model="item.campaignOne.appId"
                  showSearch
                  allowClear
                  placeholder="选择应用目标"
                  optionFilterProp="children"
                  style="width: 500px"
                  @focus="handleFocus"
                  @blur="handleBlur"
                  @change="handleChange"
                  :filterOption="filterOption"
                >
                  <a-select-option
                    v-for="appModel in appList"
                    :key="appModel.appId + 'campaignOne'"
                    :value="appModel.appId"
                  >
                    {{ appModel.appName }}&#12288;&nbsp;&#12288; {{ appModel.appVersion }}&#12288;&#12288;&#12288;{{
                      appModel.platform | platform
                    }}
                  </a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item label="转化类型" ref="urlType" prop="urlType" v-if="item.campaignType == 3">
                <a-radio-group buttonStyle="solid" v-model="item.campaignOne.urlType">
                  <a-radio-button value="1">淘宝商品</a-radio-button>
                  <a-radio-button value="2">淘客商品</a-radio-button>
                </a-radio-group>
              </a-form-model-item>
              <a-form-model-item
                :label="item.campaignType == 3 ? ' ' : '链接'"
                v-if="item.campaignType != 2"
                :rules="{
                  required: true,
                  message: '链接不能为空',
                  trigger: 'blur',
                }"
              >
                <a-input placeholder="请填写链接" v-model="item.campaignOne.url" />
              </a-form-model-item>

              <a-form-model-item
                label="转化目标"
                v-if="item.campaignType == 2 || item.campaignType == 4 || item.campaignType == 5"
              >
                <span v-if="item.campaignOne.convertId && !convert" style="display: block; font-size: 16px"
                  >已选择转化目标: {{ item.campaignOne.convertId.label }}</span
                >
                <a-button type="primary" @click="showConvert(item, item.campaignOne)">{{
                  item.campaignOne.convertId ? '更换转化目标' : '选择转化目标'
                }}</a-button>
              </a-form-model-item>

              <a-form-model-item
                v-bind="formItemLayout"
                v-if="
                  item.campaignType == 2 &&
                  (getPlatForm(item.campaignOne.appId) == '1' || getPlatForm(item.campaignOne.appId) == '2')
                "
              >
                <a-checkbox v-model="item.campaignOne.useAppMarket"> 优先从系统应用商店下载 </a-checkbox>
              </a-form-model-item>
              <a-form-model-item v-bind="formItemLayout" v-if="item.campaignOne.useAppMarket">
                请勾选投放应用已上架的应用商店（默认全选）
                <br />
                <a-checkbox-group v-model="item.campaignOne.appStore">
                  <a-checkbox value="huawei">华为</a-checkbox>
                  <a-checkbox value="oppo">OPPO</a-checkbox>
                  <a-checkbox value="vivo">VIVO</a-checkbox>
                  <a-checkbox value="xiaomi">小米</a-checkbox>
                  <a-checkbox value="meizu">魅族</a-checkbox>
                  <a-checkbox value="smartisan">锤子</a-checkbox>
                </a-checkbox-group>
              </a-form-model-item>

              <a-form-model-item
                label="定向模板"
                ref="templateId"
                :prop="'accountArr.' + index + '.campaignOne.templateId'"
                :rules="{
                  required: true,
                  message: '定向模板必选',
                  trigger: 'change',
                }"
              >
                <a-select
                  v-model="item.campaignOne.templateId"
                  showSearch
                  allowClear
                  placeholder="选择定向模板"
                  optionFilterProp="children"
                  style="width: 500px"
                  @focus="handleFocus"
                  @blur="handleBlur"
                  @change="handleChange"
                  :filterOption="filterOption"
                >
                  <a-select-option
                    v-for="appModel in templateList"
                    :key="appModel.templateId"
                    :value="appModel.templateId"
                  >
                    {{ appModel.templateName }}
                  </a-select-option>
                </a-select>
                <a style="margin: 0 10px" @click="addTemplate(item.accountId)">新增模板</a>
                <a
                  @click="lookTemplate(item.accountId, item.campaignOne.templateId)"
                  :disabled="item.campaignOne.templateId == ''"
                  >查看模板</a
                >
              </a-form-model-item>

              <a-form-model-item label="投放范围">
                <a-radio-group buttonStyle="solid" v-model="item.campaignOne.allianceAccount" disabled>
                  <a-radio-button value="1">默认</a-radio-button>
                  <a-radio-button value="2">联盟广告</a-radio-button>
                </a-radio-group>
              </a-form-model-item>

              <a-form-model-item label="单日预算">
                <a-radio-group buttonStyle="solid" v-model="item.campaignOne.dayBudgetType">
                  <a-radio-button value="0">不限</a-radio-button>
                  <a-radio-button value="1">统一预算</a-radio-button>
                </a-radio-group>
              </a-form-model-item>
              <a-form-model-item
                label=""
                v-bind="item.campaignOne.dayBudgetType == '1' ? formItemLayout : {}"
                v-if="item.campaignOne.dayBudgetType == '1'"
                :prop="'accountArr.' + index + '.campaignOne.dayBudget'"
                :rules="{
                  required: true,
                  message: '预算不能为空',
                  trigger: 'blur',
                }"
              >
                <a-input
                  placeholder="不小于100，不超过100000000，仅支持输入自然数"
                  style="width: 60%"
                  v-model="item.campaignOne.dayBudget"
                />
              </a-form-model-item>
              <a-form-model-item label="投放方式">
                <a-radio-group buttonStyle="solid" v-model="item.campaignOne.speed">
                  <a-radio-button value="1">正常投放</a-radio-button>
                  <a-radio-button value="2">平滑投放</a-radio-button>
                </a-radio-group>
                <br />
                <span>
                  {{ item.campaignOne.speed == '2' ? '平滑匀速投放' : '尽快展示广告消耗预算' }}
                </span>
              </a-form-model-item>

              <a-form-model-item label="排期">
                <!-- v-decorator="['speed', { initialValue: '1' }]" -->
                <a-radio-group buttonStyle="solid" v-model="item.campaignOne.time" @change="setTime(item.campaignOne)">
                  <a-radio-button value="1">从今天开始长期投放</a-radio-button>
                  <a-radio-button value="2">设置开始和结束日期</a-radio-button>
                </a-radio-group>
                <br />
                <a-range-picker
                  v-if="item.campaignOne.time == '2'"
                  v-model="item.campaignOne.timeRange"
                  format="YYYY-MM-DD"
                  style="margin-top: 15px"
                  :allowClear="false"
                />
              </a-form-model-item>
              <a-form-model-item label="投放时段">
                <a-radio-group
                  buttonStyle="solid"
                  v-model="item.campaignOne.scheduleTimeData"
                  @change="setTimeAll(item.campaignOne)"
                >
                  <a-radio-button value="1">全天</a-radio-button>
                  <a-radio-button value="2">特定时间</a-radio-button>
                </a-radio-group>
                <br />
                <selectCheckAll
                  style="width: 60%; margin-top: 15px"
                  v-if="item.campaignOne.scheduleTimeData == '2'"
                  :scheduleTime.sync="item.campaignOne.scheduleTime"
                  ref="selectCheck"
                />
              </a-form-model-item>
              <a-form-model-item label="创意展现方式" prop="campaign">
                <a-radio-group buttonStyle="solid" v-model="item.campaignOne.showMode">
                  <a-radio-button value="2">智能优选</a-radio-button>
                  <a-radio-button value="1">随机轮播</a-radio-button>
                </a-radio-group>
                <br />
                <span>
                  {{
                    item.campaignOne.showMode == '1'
                      ? '广告组包含的广告创意将随机展现'
                      : '每一次展现的时候，系统会进行CTR预估，预估CTR高的会得到展现机会'
                  }}
                </span>
              </a-form-model-item>
              <a-form-model-item label="场景广告位">
                <checkBoxGroup
                  :options="[
                    { label: '优选广告位', value: 1 },
                    { label: '信息流广告', value: 7 },
                    { label: '上下滑大屏广告', value: 6 },
                    { label: '视频播放页广告', value: 3 },
                  ]"
                  v-model="item.campaignOne.sceneId"
                  @change="changeData"
                  :disabled="item.campaignOne.allianceAccount == '2'"
                />
              </a-form-model-item>
              <a-form-model-item label="优化目标">
                <a-radio-group
                  buttonStyle="solid"
                  v-model="item.campaignOne.bidType"
                  @change="changeBidType(item.campaignOne)"
                >
                  <a-radio-button :value="1">点击数</a-radio-button>
                  <a-radio-button :value="10">转化数</a-radio-button>
                </a-radio-group>
              </a-form-model-item>
              <a-form-model-item label="转化目标" v-if="item.campaignOne.bidType == 10">
                <a-select v-model="item.campaignOne.ocpxActionType" style="width: 60%">
                  <a-select-option :value="2">行为数</a-select-option>
                  <a-select-option :value="180" v-if=" groupTypeData.isActivate == '1'"
                    >激活</a-select-option
                  >
                  <a-select-option
                    :value="53"
                    v-if=" groupTypeData.isFormSubmit == '1'"
                    >表单提交</a-select-option
                  >
                  <a-select-option :value="394" v-if="groupTypeData.isOrderSubmit == '1'">订单提交</a-select-option>
                  <a-select-option :value="348" v-if="groupTypeData.isValidClue == '1'">使用有效线索</a-select-option>
                  <a-select-option :value="383" v-if="groupTypeData.isCreditGrant == '1'">授信出价</a-select-option>
                  <a-select-option :value="384" v-if="groupTypeData.isWanJian == '1'">完件出价</a-select-option>
                  <a-select-option :value="190" v-if="groupTypeData.isPurchase == '1'">付费出价</a-select-option>
                  <a-select-option :value="191" v-if="groupTypeData.isFirstdayRoi == '1'">首日ROI</a-select-option>
                  <a-select-option :value="396" v-if="groupTypeData.isRegister == '1'">注册优化目标</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item
                label="深度转化目标"
                v-if="
                  (item.campaignOne.ocpxActionType == 180 || item.campaignOne.ocpxActionType == 53) &&
                  groupTypeData.deepConversionTypes.length > 0
                "
              >
                <a-select v-model="item.campaignOne.deepConversionType" allowClear>
                  <a-select-option
                    :value="items.deepConversionType"
                    v-for="(items, index) of groupTypeData.deepConversionTypes"
                    :key="index"
                  >
                    {{ items.desc }}</a-select-option
                  >
                </a-select>
              </a-form-model-item>
              <a-form-model-item label="计费方式">
                <a-radio-group defaultValue="1" style="margin-top: 8px">
                  <a-radio value="1">{{ item.campaignOne.bidType == 1 ? '点击计费' : '展示计费(oCPM)' }}</a-radio>
                </a-radio-group>
              </a-form-model-item>

              <a-form-model-item
                label="出价"
                v-if="item.campaignOne.bidType == 1"
                :prop="'accountArr.' + index + '.campaignOne.bid'"
                :rules="{
                  required: true,
                  message: '出价不能为空',
                  trigger: 'blur',
                }"
              >
                <a-input-number v-model="item.campaignOne.bid"> </a-input-number>
              </a-form-model-item>
              <a-form-model-item
                label="目标成本"
                v-else
                :prop="'accountArr.' + index + '.campaignOne.cpaBid'"
                :rules="{
                  required: true,
                  message: '目标成本不能为空',
                  trigger: 'blur',
                }"
              >
                <a-input-number v-model="item.campaignOne.cpaBid"> </a-input-number>
              </a-form-model-item>
              <a-form-model-item
                label="深度转化出价"
                :labelCol="{ lg: { span: 6 }, sm: { span: 7 } }"
                :wrapperCol="{ lg: { span: 18 }, sm: { span: 17 } }"
                v-if="
                  (item.campaignOne.ocpxActionType == 180 || item.campaignOne.ocpxActionType == 53) &&
                  groupTypeData.deepConversionTypes.length > 0 &&
                  item.campaignOne.deepConversionType != ''
                "
              >
                <a-input-number
                  v-model="item.campaignOne.deepConversionBid"
                  :disabled="item.campaignOne.cpaBid == '' || item.campaignOne.cpaBid == null"
                ></a-input-number>
              </a-form-model-item>
            </div>
          </a-tab-pane>
        </a-tabs>
        <a-form-model-item
          :wrapperCol="{
            xs: { span: 24, offset: 0 },
            sm: { span: 20, offset: 7 },
          }"
        >
          <a-button type="primary" html-type="submit" @click="submitForm('unitCreate')" :loading="submitFormLoading">
            提交
          </a-button>
          <a-button style="margin-left: 10px" @click="resetForm('unitCreate')" :loading="submitFormLoading">
            重置
          </a-button>
        </a-form-model-item>
        <!-- <a-form-model-item
          ref="unitName"
          prop="unitName"
          v-for="(domain, index) in tabList[activeIndex].form.unitName"
          :key="index"
          :label="index === 0 ? '组名称' : ''"
          :prop="'unitName.' + index + '.value'"
          :rules="{
            required: true,
            message: '组名称必填',
            trigger: 'blur',
            
          }"
          ><a-input v-model="domain.value" placeholder="请输入组名称" style="width: 60%; margin-right: 8px" />
        </a-form-model-item> -->
      </a-form-model>
      <a-modal v-model="convert" title="选择转化目标">
        <template slot="footer">
          <a-button key="back" @click="convert = false">取消</a-button>
          <a-button key="submit" type="primary" @click="convert = false"> 确定 </a-button>
        </template>
        <a-form-model-item label="追踪方式" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }">
          <a-radio-group buttonStyle="solid" v-model="convertType" @change="convertChange(convertData)">
            <a-radio-button value="1" v-show="convertData.campaignType == 4 || convertData.campaignType == 5"
              >JS布玛</a-radio-button
            >
            <a-radio-button value="2" v-show="convertData.campaignType == 4 || convertData.campaignType == 5"
              >Xpath</a-radio-button
            >
            <a-radio-button
              value="3"
              v-show="convertData.campaignType == 2 && (convertData.appId == 1 || convertData.appId == 2)"
              >应用-SDK
            </a-radio-button>
            <a-radio-button value="7" v-show="convertData.campaignType == 2">应用-API</a-radio-button>
          </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="选择转化" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }">
          <a-select
            allowClear
            labelInValue
            style="width: 100%"
            v-model="convertData.convertId"
            @focus="getConvertList(convertData.accountId)"
          >
            <a-select-option :value="item.convert_id" v-for="(item, index) in convertList" :key="item.convert_id">
              {{ item.convert_name }}</a-select-option
            >
          </a-select>
        </a-form-model-item>
      </a-modal>
      <a-modal v-model="showCreate" title="创建失败条数">
        <template slot="footer">
          <a-button key="back" @click="showCreate = false">取消</a-button>
          <a-button key="submit" type="primary" @click="tiaozhuan"> 确定 </a-button>
        </template>
        <ul v-if="createUnitList.length > 0">
          <li v-for="(item, index) in createUnitList">
            <p v-if="item.code == -1">
              组名称：{{ item.unitName }}，创建失败 <br /><span style="margin-left: 10px"
                >失败原因：{{ item.message }}</span
              >
            </p>
          </li>
        </ul>
        <div v-else style="width: 100%; height: 200px; text-align: center; line-height: 200px">无创建失败条数</div>
      </a-modal>
      <templateModal ref="templateModal" @getData="getTemplateList" />
    </a-card>
  </div>
</template>

<script>
import { deleteAction, postAction, getAction } from '@/api/manage'
import moment from 'moment'
import { mapActions, mapGetters } from 'vuex'
import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
import selectCheckAll from '../account/stepForm/stepModule/test'
import checkBoxGroup from '@/components/formComponents/checkBoxGroup'
import templateModal from './templateModal'
export default {
  name: 'create-unit',
  components: {
    Treeselect,
    selectCheckAll,
    checkBoxGroup,
    templateModal,
  },
  data() {
    return {
      groupTypeData: {},
      appList: [],
      allAppList: [],
      templateList: [],
      labelCol: { span: 7 },
      wrapperCol: { span: 17 },
      formItemLayout: {
        labelCol: {
          xs: { span: 7 },
          sm: { span: 7 },
        },
        wrapperCol: {
          xs: { span: 17, offset: 0 },
          sm: { span: 17, offset: 7 },
        },
      },
      form: {
        accountArr: [],
      },
      tabList: [
        {
          key: 'article',
          tab: '账户1',
          form: {
            campaignAgreement: 0,
            unitName: [{ value: '' }],
          },
        },
        {
          key: 'app',
          tab: '账户2',
          form: {
            campaignAgreement: 0,
            unitName: [{ value: '' }],
          },
        },
        {
          key: 'project',
          tab: '账户3',
          form: {
            campaignAgreement: 1,
            unitName: [{ value: '' }],
          },
        },
      ],
      key: 'article',
      activeIndex: 0,
      accountIds: [],
      active: null,
      promotionName: '',
      tabs: [],
      dayBudgetSchedule: [{ one: '' }, { one: '' }, { one: '' }, { one: '' }, { one: '' }, { one: '' }, { one: '' }],
      type: '2',
      typeList: {},
      showBudgetDaily: false,
      campaignName: '',
      campaignBudget: 'UNLIMITED',
      dayBudget: 0,
      showApp: true,
      redirectUrl: '', // 链接地址
      showRedirect: false,
      urlType: '1',
      showUrlType: false,
      channelType: '1',
      showChannelType: false,
      loading: false,

      url: {
        dictListUrl: 'toutiao/dictitem/list',
        appListUrl: '/kuaishou/kuaiShouCreateAppTemplate/list',
        insertTemplateUrl: '/kuaishou/batch/campaignCreate',
      },
      createTotal: [],
      convert: false,
      convertType: '1',
      convertList: [],
      convertData: {},
      submitFormLoading: false,
      showCreate: false,
      createUnitList: [],
      createUnitSuccess: [],
    }
  },
  methods: {
    lookTemplate(accountId, templateId) {
      this.$refs.templateModal.handleOk(accountId, templateId, 'look')
    },
    addTemplate(accountId) {
      this.$refs.templateModal.create(accountId, 'add')
    },
    tiaozhuan() {
      this.showCreate = false
      localStorage.setItem('crossAccountUnit', JSON.stringify(this.createUnitSuccess))
      this.$router.replace({ path: '/crossAccount/createCreative' })
      this.$bus.$emit('remove', '/crossAccount/createUnit')
    },
    getPlatForm(appId) {
      if (appId) {
        var data = this.allAppList.filter((item) => {
          return item.appId == appId
        })

        return data[0].platform
      }
    },
    showConvert(item, data) {
      this.convertChange(data)
      this.convertData = { ...item, campaignType: item.campaignType, ...data }
      if (item.campaignType == 2) {
        if (this.convertData.appId) {
          this.convert = true
          if (this.convertData.appId == 1 || this.convertData.appId == 2) {
            this.convertType = '3'
          } else {
            this.convertType = '7'
          }
        } else {
          this.$message.error('请选择应用')
        }
      } else {
        this.convert = true
        this.convertType = '1'
      }
      this.getConvertList(this.convertData.accountId)
    },
    convertChange(data) {
      data.convertId = ''
    },
    getConvertList(accountId) {
      var params = {}
      params.accountId = accountId
      params.type = this.convertType
      this.convertList = []
      getAction('/kuaishou/batch/getConvertList', params).then((res) => {
        console.log(res)
        if (res.success) {
          this.convertList = res.result.map((item) => {
            return {
              ...item,
              convert_id: item.convert_id + '',
            }
          })
        }
      })
    },
    changeBidType(data) {
      console.log(data)
      if (data.bidType == 1) {
        data.ocpxActionType = null
        data.cpaBid = null
      } else if (data.bidType == 10) {
        data.ocpxActionType = 2
        data.bid = null
      }
    },
    changeData(data) {
      if (data.length > 1 && data.findIndex((item) => item == 1) == 0) {
        data.splice(
          data.findIndex((item) => item == 1),
          1
        )
      } else if (data.length > 1 && data.findIndex((item) => item == 1) == data.length - 1) {
        data.splice(0, data.length - 1)
      } else if (data.length == 0) {
        data.push(1)
      }
    },
    setTime(item) {
      console.log(item)
      this.$nextTick(() => {
        if (item.time == '2') {
          item.timeRange = []
          item.timeRange[0] = moment().startOf('day')
          item.timeRange[1] = moment().add(1, 'months')
        } else {
          item.timeRange = []
        }
      })
    },
    setTimeAll(item) {
      //   console.log(moment('2019-12-27'))
      if (item.scheduleTimeData == '2') {
      } else {
        item.scheduleTime =
          '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      }
    },
    changeAccount(data) {
      this.getAppList(data)
      this.getIsActivate(data)
      this.getTemplate(data)
      this.getTemplateList(data)
    },
    getTemplate(accountId) {
      getAction('/batch/kuaishouTemplate/getTemplateByAccountId', {
        accountId: accountId,
      }).then((res) => {
        if (res.success) {
          this.getTemplateList(accountId)
        }
      })
    },
    getTemplateList(accountId) {
      this.templateList = []
      getAction('/batch/kuaishouTemplate/list', {
        accountId: accountId,
      }).then((res) => {
        if (res.success) {
          this.templateList = res.result.map((item, index) => {
            return {
              ...item,
              key: index,
            }
          })
        }
      })
    },
    getAppList(accountId) {
      this.appList = []
      let params = {}
      params.accountId = accountId
      getAction('/kuaishou/batch/getAppList', params).then((res) => {
        if (res.success) {
          this.appList = res.result.map((item, index) => {
            return {
              ...item,
              key: index,
            }
          })
          this.allAppList.push(...this.appList)
        }
      })
    },
    getIsActivate(accountId) {
      getAction('/kuaishou/batch/getIsActivate', {
        accountId: accountId,
      }).then((res) => {
        if (res.success) {
          this.groupTypeData = res.result
        }
      })
    },
    submitForm(formName) {
      this.submitFormLoading = true
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // alert('submit!')

          var params = this.form.accountArr.map((item) => {
            // campaignAgreement: 0, //判断是否计划相同   0为相同取值campaignOne   1不同取值1不同取值campaignList
            if (item.campaignAgreement == 0) {
              return {
                ...item,
                campaignList: null,
                campaignOne: {
                  useAppMarket: item.campaignOne.useAppMarket,
                  appStore: item.campaignOne.useAppMarket ? item.campaignOne.appStore : null,
                  convertId: item.campaignOne.convertId ? item.campaignOne.convertId.key : null,
                  campaignIds: item.campaignOne.campaignIds,
                  unitNames: item.campaignOne.unitNames.map((c) => {
                    return c.value
                  }),
                  allianceAccount: item.campaignOne.allianceAccount,
                  appId: item.campaignOne.appId,
                  urlType: item.campaignOne.urlType,
                  url: item.campaignOne.url,
                  templateId: item.campaignOne.templateId,
                  dayBudget: item.campaignOne.dayBudget == null ? null : item.campaignOne.dayBudget * 1000,
                  dayBudgetType: item.campaignOne.dayBudgetType,
                  speed: item.campaignOne.speed,
                  time: item.campaignOne.time,
                  timeRange: item.campaignOne.timeRange,
                  beginTime:
                    item.campaignOne.time == '1'
                      ? moment().startOf('day').format('YYYY-MM-DD')
                      : moment(item.campaignOne.timeRange[0]).format('YYYY-MM-DD'),
                  endTime:
                    item.campaignOne.time == '2' ? moment(item.campaignOne.timeRange[1]).format('YYYY-MM-DD') : '',
                  scheduleTimeData: item.campaignOne.scheduleTimeData,
                  scheduleTime: item.campaignOne.scheduleTime,
                  showMode: item.campaignOne.showMode,
                  sceneId: item.campaignOne.allianceAccount == '1' ? item.campaignOne.sceneId : [5],
                  ocpxActionType: item.campaignOne.ocpxActionType,
                  bidType: item.campaignOne.bidType,
                  deepConversionType: item.campaignOne.deepConversionType,
                  bid:
                    item.campaignOne.bid == null || item.campaignOne.bid == '' || item.campaignOne.bid == undefined
                      ? null
                      : item.campaignOne.bid * 1000,
                  cpaBid:
                    item.campaignOne.cpaBid == null ||
                    item.campaignOne.cpaBid == '' ||
                    item.campaignOne.cpaBid == undefined
                      ? null
                      : item.campaignOne.cpaBid * 1000,
                  deepConversionBid:
                    item.campaignOne.deepConversionBid == null ||
                    item.campaignOne.deepConversionBid == '' ||
                    item.campaignOne.deepConversionBid == undefined
                      ? null
                      : item.campaignOne.deepConversionBid * 1000,
                  unitType: '4',
                },
              }
            } else {
              return {
                ...item,
                campaignOne: null,
                campaignList: item.campaignList.map((i) => {
                  if (i.check == '1') {
                    return {
                      ...i,
                      unit: null,
                      unitIdentical: {
                        unitType: '4',
                        useAppMarket: i.unitIdentical.useAppMarket,
                        appStore: i.unitIdentical.useAppMarket ? i.unitIdentical.appStore : null,
                        convertId: i.unitIdentical.convertId ? i.unitIdentical.convertId.key : null,
                        unitName: i.unitIdentical.unitName.map((b) => {
                          return b.name
                        }),
                        allianceAccount: i.unitIdentical.allianceAccount,
                        appId: i.unitIdentical.appId,
                        urlType: i.unitIdentical.urlType,
                        url: i.unitIdentical.url,
                        templateId: i.unitIdentical.templateId,
                        dayBudget: i.unitIdentical.dayBudget == null ? null : i.unitIdentical.dayBudget * 1000,
                        dayBudgetType: i.unitIdentical.dayBudgetType,
                        speed: i.unitIdentical.speed,
                        time: i.unitIdentical.time,
                        timeRange: i.unitIdentical.timeRange,

                        beginTime:
                          i.unitIdentical.time == '1'
                            ? moment().startOf('day').format('YYYY-MM-DD')
                            : moment(i.unitIdentical.timeRange[0]).format('YYYY-MM-DD'),
                        endTime:
                          i.unitIdentical.time == '2' ? moment(i.unitIdentical.timeRange[1]).format('YYYY-MM-DD') : '',
                        scheduleTimeData: i.unitIdentical.scheduleTimeData,
                        scheduleTime: i.unitIdentical.scheduleTime,
                        showMode: i.unitIdentical.showMode,
                        sceneId: i.unitIdentical.allianceAccount == '1' ? i.unitIdentical.sceneId : [5],
                        ocpxActionType: i.unitIdentical.ocpxActionType,
                        bidType: i.unitIdentical.bidType,
                        deepConversionType: i.unitIdentical.deepConversionType,
                        bid:
                          i.unitIdentical.bid == null || i.unitIdentical.bid == '' || i.unitIdentical.bid == undefined
                            ? null
                            : i.unitIdentical.bid * 1000,
                        cpaBid:
                          i.unitIdentical.cpaBid == null ||
                          i.unitIdentical.cpaBid == '' ||
                          i.unitIdentical.cpaBid == undefined
                            ? null
                            : i.unitIdentical.cpaBid * 1000,
                        deepConversionBid:
                          i.unitIdentical.deepConversionBid == null ||
                          i.unitIdentical.deepConversionBid == '' ||
                          i.unitIdentical.deepConversionBid == undefined
                            ? null
                            : i.unitIdentical.deepConversionBid * 1000,
                      },
                    }
                  } else {
                    return {
                      ...i,
                      unitIdentical: null,
                      unit: i.unit.map((c) => {
                        return {
                          unitType: '4',
                          useAppMarket: c.useAppMarket,
                          appStore: c.useAppMarket ? c.appStore : null,
                          convertId: c.convertId ? c.convertId.key : null,
                          name: c.name,
                          allianceAccount: c.allianceAccount,
                          appId: c.appId,
                          urlType: c.urlType,
                          url: c.url,
                          templateId: c.templateId,
                          dayBudget: c.dayBudget == null ? c.dayBudget : c.dayBudget * 1000,
                          dayBudgetType: c.dayBudgetType,
                          speed: c.speed,
                          time: c.time,
                          timeRange: c.timeRange,

                          beginTime:
                            c.time == '1'
                              ? moment().startOf('day').format('YYYY-MM-DD')
                              : moment(c.timeRange[0]).format('YYYY-MM-DD'),
                          endTime: c.time == '2' ? moment(c.timeRange[1]).format('YYYY-MM-DD') : '',

                          scheduleTimeData: c.scheduleTimeData,
                          scheduleTime: c.scheduleTime,
                          showMode: c.showMode,
                          sceneId: c.allianceAccount == '1' ? c.sceneId : [5],
                          ocpxActionType: c.ocpxActionType,
                          bidType: c.bidType,
                          deepConversionType: c.deepConversionType,
                          bid: c.bid == null || c.bid == '' || c.bid == undefined ? null : c.bid * 1000,
                          cpaBid: c.cpaBid == null || c.cpaBid == '' || c.cpaBid == undefined ? null : c.cpaBid * 1000,
                          deepConversionBid:
                            c.deepConversionBid == null || c.deepConversionBid == '' || c.deepConversionBid == undefined
                              ? null
                              : c.deepConversionBid * 1000,
                        }
                      }),
                    }
                  }
                }),
              }
            }
          })
          console.log(params)
          postAction('/kuaishou/crossAccount/crossAccountUnitCreate', { accountArr: params }).then((res) => {
            console.log(res)
            if (res.success) {
              this.createUnitList = res.result.filter((item) => {
                return item.code != 0
              })
              this.createUnitSuccess = res.result.filter((item) => {
                return item.code == 0
              })
              this.submitFormLoading = false
              this.showCreate = true
            } else {
              this.submitFormLoading = false
            }
          })
        } else {
          setTimeout(() => {
            var isError = document.getElementsByClassName('has-error')
            console.log(isError)
            isError[0].querySelector('input').focus()
          }, 100)
          this.submitFormLoading = false
          console.log('error submit!!')
          return false
        }
      })
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },
    onTabChange(key, type) {
      console.log(key, type)
      this[type] = key
      this.activeIndex = this.tabList.findIndex((item) => this.key == item.key)
    },
    ...mapGetters(['nickname', 'avatar', 'userInfo']),
    numberReturn(num) {
      var arr = ['一', '二', '三', '四', '五', '六', '天']
      return arr[num]
    },
    changeCreateTotal(item) {
      this.$nextTick(() => {
        var arr = []
        var arrUnitName = []
        for (let i = 0; i < item.unitCount; i++) {
          arr.push({
            useAppMarket: false,
            appStore: ['huawei', 'oppo', 'vivo', 'xiaomi', 'meizu', 'smartisan'],
            convertId: '',
            name: '',
            allianceAccount: '1',
            appId: '',
            templateId: '',
            urlType: '1',
            url: '',
            dayBudget: null,
            dayBudgetType: '0',
            speed: '1',
            time: '1',
            timeRange: [],
            scheduleTimeData: '1',
            scheduleTime:
              '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
            showMode: '2',
            sceneId: [1],
            ocpxActionType: 2,
            bidType: 10,
            deepConversionType: null,
            bid: null,
            cpaBid: null,
            deepConversionBid: null,
          })
          arrUnitName.push({ name: '' })
        }
        item.campaignOne.unitNames = JSON.parse(JSON.stringify(arr))
        item.campaignList.forEach((element) => {
          if (element.check == '1') {
            element.unitIdentical = JSON.parse(
              JSON.stringify({
                useAppMarket: false,
                appStore: ['huawei', 'oppo', 'vivo', 'xiaomi', 'meizu', 'smartisan'],
                convertId: '',
                unitName: arrUnitName,
                allianceAccount: '1',
                appId: '',
                urlType: '1',
                url: '',
                templateId: '',
                dayBudget: null,
                dayBudgetType: '0',
                speed: '1',
                time: '1',
                timeRange: [],
                scheduleTimeData: '1',
                scheduleTime:
                  '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
                showMode: '2',
                sceneId: [1],
                ocpxActionType: 2,
                bidType: 10,
                deepConversionType: null,
                bid: null,
                cpaBid: null,
                deepConversionBid: null,
              })
            )
          } else {
            element.unit = []
            element.unit = JSON.parse(JSON.stringify(arr))
          }
        })
      })
    },
    AllTypeChange(e) {
      console.log(e.target.value)
      if (e.target.value == 1) {
        if (this.accountIds.length > 0) {
        }
      } else {
      }
    },
    nameTypeChange(item, accountData) {
      console.log(item)
      this.changeCreateTotal(accountData)
    },
    getChangeAll(name, indexBest, index, items) {
      var node = document.getElementsByClassName('rending')[indexBest]
      var v = '{{' + name + '}}-'
      if (document.selection) {
        //IE
        node.focus()
        var sel = document.selection.createRange()
        sel.text = v
        sel.select()
        items.campaignName = v
      } else if (node.selectionStart || node.selectionStart == '0') {
        //MOZILLA/GOOGLE
        var startPos = node.selectionStart
        var endPos = node.selectionEnd
        var restoreTop = node.scrollTop
        node.value = node.value.substring(0, startPos) + v + node.value.substring(endPos, node.value.length)
        if (restoreTop > 0) {
          node.scrollTop = restoreTop
        }
        items.campaignName = node.value
        node.focus()
        node.selectionStart = startPos + v.length
        node.selectionEnd = startPos + v.length
        // this.campaignName = node.value
      } else {
        //OTHER
        node.value += v
        items.campaignName = node.value
        node.focus()
        // this.campaignName = node.value
      }
    },
    getChange(name, index) {
      console.log(index, document.getElementsByClassName('rending'))
      var node = document.getElementsByClassName('rending')[index]
      var v = '{{' + name + '}}-'
      if (document.selection) {
        //IE
        node.focus()
        var sel = document.selection.createRange()
        sel.text = v
        sel.select()
        this.campaignName = v
      } else if (node.selectionStart || node.selectionStart == '0') {
        //MOZILLA/GOOGLE
        var startPos = node.selectionStart
        var endPos = node.selectionEnd
        var restoreTop = node.scrollTop
        node.value = node.value.substring(0, startPos) + v + node.value.substring(endPos, node.value.length)
        if (restoreTop > 0) {
          node.scrollTop = restoreTop
        }
        this.campaignName = node.value
        node.focus()
        node.selectionStart = startPos + v.length
        node.selectionEnd = startPos + v.length
        // this.campaignName = node.value
      } else {
        //OTHER
        node.value += v
        this.campaignName = node.value
        node.focus()
        // this.campaignName = node.value
      }
    },
    handleConfirmValue(rule, value, callback) {
      if (value == '' || value < 500 || value >= 100000000) {
        callback('请输入正确预算金额')
      }
      callback()
    },

    handleConfirmAppId(rule, value, callback) {
      if (this.type == 2 && (this.appId == '0' || this.appId == '')) {
        callback('请选择目标应用')
      }
      callback()
    },

    handleSubmit(e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          this.loading = true

          let params = {}
          params.type = values.type
          //   params.campaignBudget = this.campaignBudget
          if (this.campaignBudget == 'UNLIMITED') {
            params.dayBudget = 0
          } else if (this.campaignBudget == 'AS_BUDGET') {
            params.dayBudget = values.dayBudget * 1000
          } else {
            params.dayBudgetSchedule = this.dayBudgetSchedule.map((item) => {
              if (item.one == '') {
                return 0
              } else {
                return item.one * 1000
              }
            })
          }
          // if (this.getData('nameType') == 0) {
          //   var dataArr = this.campaignName.split('-')
          //   if (dataArr[dataArr.length - 1] == '') {
          //     dataArr.pop()
          //   }
          //   params.campaignName = dataArr.join('-')
          // } else {
          //   params.nameArr = this.tabs.map((item) => {
          //     return {
          //       accountId: item.accountId,
          //       campaignNames: item.campaignNames.map((i) => {
          //         return i.campaignName
          //       }),
          //     }
          //   })
          // }

          params.accountArr = this.accountIds
          params.nameType = values.nameType
          params.createTotal = values.createTotal
          console.log(params)

          postAction('/kuaishou/crossAccount/batchCampaignCreate', params).then((res) => {
            console.log(res)
            if (res.success) {
              this.$message.success('创建成功')
              localStorage.setItem('campaignId', res.result)
              this.loading = false
              this.nextStep(res.result)
            } else {
              this.$message.error(res.message)
              this.loading = false
            }
          })
        }
      })
    },
    onChange(value) {
      console.log(value)
    },
    showBudgetStatusChange() {
      if (this.campaignBudget == 'UNLIMITED') {
        this.showBudgetDaily = false
        this.dayBudget = 0
      } else {
        this.showBudgetDaily = true
        this.dayBudget = ''
      }
    },
    typeChange() {
      if (this.type == 2) {
        this.promotionName = '提升应用安装'
        this.showApp = true
        this.showRedirect = false
        this.showUrlType = false
        this.showChannelType = false
      }
      if (this.type == 3) {
        this.promotionName = '获取电商下单'
        this.showApp = false
        this.showRedirect = true
        this.showUrlType = true
        this.showChannelType = false
      }
      if (this.type == 4) {
        this.promotionName = '推广品牌活动'
        this.showApp = false
        this.showRedirect = true
        this.showUrlType = false
        this.showChannelType = false
      }
      if (this.type == 5) {
        this.promotionName = '收集销售线索'
        this.showApp = false
        this.showRedirect = true
        this.showUrlType = false
        this.showChannelType = true
      }
      this.campaignName = this.promotionName + '_' + moment(new Date())
    },
    handleChange(value) {
      console.log(`selected ${value}`)
    },
    handleBlur() {
      console.log('blur')
    },
    handleFocus() {
      console.log('focus')
    },
    filterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    nextStep() {
      this.$emit('nextStep')
    },
    // getData(className) {
    //   return this.form.getFieldValue(className)
    // },
    getLOLTrue(accountId) {
      getAction('/kuaishou/batch/getWhiteList', {
        accountId: accountId,
      }).then((res) => {
        if (res.success) {
          console.log(res)
          if (res.result) {
            if (res.result.alliance_account == 1) {
              return true
            } else {
              return false
            }
          } else {
            return false
          }
        }
      })
    },
  },
  filters: {
    getDate(value) {
      let date = new Date(value)
      let y = date.getFullYear()
      let MM = date.getMonth() + 1
      MM = MM < 10 ? '0' + MM : MM
      let d = date.getDate()
      d = d < 10 ? '0' + d : d
      return y + '-' + MM + '-' + d
    },
    platform(str) {
      var data = {
        1: 'Android应用下载',
        2: 'Android网页游戏',
        3: 'iOS应用下载',
        4: 'iOS网页游戏',
      }
      return data[str]
    },
  },
  mounted: function () {
    this.$nextTick(() => {
      // this.changeCreateTotal()
      if (localStorage.getItem('crossAccountCampaign')) {
        var data = JSON.parse(localStorage.getItem('crossAccountCampaign'))
        this.form.accountArr = data.map((item) => {
          return {
            accountId: item.accountId,
            accountName: item.accountId,
            campaignAgreement: 0, //判断是否计划相同   0为相同取值campaignOne   1不同取值campaignList
            unitCount: 1,
            allianceAccount: true,
            campaignType: item.createDetail[0].type,
            //多个计划分开创建
            campaignList: item.createDetail.map((c) => {
              return {
                campaignId: c.campaignId,
                campaignName: c.campaignName,
                check: '1', //判断计划下组是否相同  1为相同取值 unitIdentical      2为不同  取值unit
                unit: [
                  {
                    useAppMarket: false,
                    appStore: ['huawei', 'oppo', 'vivo', 'xiaomi', 'meizu', 'smartisan'],
                    convertId: '',
                    name: '',
                    allianceAccount: '1',
                    appId: '',
                    urlType: '1',
                    url: '',
                    templateId: '',
                    dayBudget: null,
                    dayBudgetType: '0',
                    speed: '1',
                    time: '1',
                    timeRange: [],
                    scheduleTimeData: '1',
                    scheduleTime:
                      '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
                    showMode: '2',
                    sceneId: [1],
                    ocpxActionType: 2,
                    bidType: 10,
                    deepConversionType: null,
                    bid: null,
                    cpaBid: null,
                    deepConversionBid: null,
                    unitType: '4',
                  },
                ],
                unitIdentical: {
                  useAppMarket: false,
                  appStore: ['huawei', 'oppo', 'vivo', 'xiaomi', 'meizu', 'smartisan'],
                  convertId: '',
                  unitName: [{ name: '' }],
                  allianceAccount: '1',
                  appId: '',
                  urlType: '1',
                  url: '',
                  templateId: '',
                  dayBudget: null,
                  dayBudgetType: '0',
                  speed: '1',
                  time: '1',
                  timeRange: [],
                  scheduleTimeData: '1',
                  scheduleTime:
                    '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
                  showMode: '2',
                  sceneId: [1],
                  ocpxActionType: 2,
                  bidType: 10,
                  deepConversionType: null,
                  bid: null,
                  cpaBid: null,
                  deepConversionBid: null,
                  unitType: '4',
                },
              }
            }),
            //所有计划创建一样
            campaignOne: {
              useAppMarket: false,
              appStore: ['huawei', 'oppo', 'vivo', 'xiaomi', 'meizu', 'smartisan'],
              convertId: '',
              campaignIds: item.createDetail.map((c) => {
                return c.campaignId
              }),
              unitNames: [{ value: '' }],
              allianceAccount: '1',
              appId: '',
              urlType: '1',
              url: '',
              templateId: '',
              dayBudget: null,
              dayBudgetType: '0',
              speed: '1',
              time: '1',
              timeRange: [],
              scheduleTimeData: '1',
              scheduleTime:
                '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
              showMode: '2',
              sceneId: [1],
              ocpxActionType: 2,
              bidType: 10,
              deepConversionType: null,
              bid: null,
              cpaBid: null,
              deepConversionBid: null,
              unitType: '4',
            },
          }
        })

        this.getAppList(this.form.accountArr[0].accountId)
        this.getIsActivate(this.form.accountArr[0].accountId)
        this.getTemplate(this.form.accountArr[0].accountId)
        this.getTemplateList(this.form.accountArr[0].accountId)
      }
    })
  },
}
</script>
