configuration-modal.vue 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286
  1. <template>
  2. <div class="configuration-modal">
  3. <div>
  4. <a-form-model
  5. ref="ruleForm"
  6. class="config-form-modal"
  7. :model="configForm"
  8. :rules="rules"
  9. :label-col="labelCol"
  10. :wrapper-col="wrapperCol"
  11. >
  12. <p class="separate-title-header">{{ modalTitle === 'add' ? '新增' : '编辑'}}配置信息</p>
  13. <div class="separate-module-con">
  14. <a-form-model-item label="广告账户">
  15. <acount-search
  16. class="acount-search-class"
  17. :disabled="modalTitle === 'edit'"
  18. :appId.sync="configForm.accountId"
  19. :multiple="false"
  20. request="1,3"
  21. >
  22. </acount-search>
  23. </a-form-model-item>
  24. <a-form-model-item label="dp链接">
  25. <a-radio-group
  26. :disabled="modalTitle === 'edit'"
  27. v-model="configForm.dpLinkIndexUsed"
  28. button-style="solid"
  29. @change="handleDpLinkIndexUsed"
  30. >
  31. <a-radio-button :value="0">关闭</a-radio-button>
  32. <a-radio-button :value="1">开启</a-radio-button>
  33. </a-radio-group>
  34. </a-form-model-item>
  35. <div v-if="configForm.dpLinkIndexUsed === 1">
  36. <a-form-model-item label="dp链接范围" class="dp-link-start" prop="dpLinkStartIndex">
  37. <a-input-number
  38. class="common-input"
  39. v-model="configForm.dpLinkStartIndex"
  40. :disabled="modalTitle === 'edit'"
  41. :min="1"
  42. placeholder="请输入"
  43. @change="handleDplinkStart"
  44. />
  45. <span>~</span>
  46. </a-form-model-item>
  47. <a-form-model-item class="dp-link-end" prop="dpLinkEndIndex">
  48. <a-input-number
  49. class="common-input"
  50. v-model="configForm.dpLinkEndIndex"
  51. :disabled="modalTitle === 'edit'"
  52. :min="getEndIndex"
  53. placeholder="请输入"
  54. @change="handleDplinkEnd"
  55. />
  56. </a-form-model-item>
  57. </div>
  58. <a-form-model-item label="预算方式">
  59. <a-radio-group
  60. v-model="configForm.accountBudgetMode"
  61. button-style="solid"
  62. @change="handleAccountMode"
  63. >
  64. <a-radio-button value="1">不限预算</a-radio-button>
  65. <a-radio-button value="2">指定预算</a-radio-button>
  66. </a-radio-group>
  67. </a-form-model-item>
  68. <a-form-model-item v-if="configForm.accountBudgetMode === '2'" label="账户日预算" prop="accountBudget">
  69. <a-input-number
  70. v-model="configForm.accountBudget"
  71. :min="1000"
  72. :max="9999999.99"
  73. :step="0.01"
  74. @blur="handleAccountBudget"
  75. /> 元
  76. </a-form-model-item>
  77. <div v-if="adBudgetShowTitle" style="width: 500px;color: #f00;margin-left: 140px;">单次修改预算幅度, 不能低于100.0元</div>
  78. </div>
  79. <div class="separate-module-con">
  80. <p class="rock-title">广告组信息</p>
  81. <a-form-model-item label="推广目标">
  82. <a-radio-group :disabled="modalTitle === 'edit'" v-model="configForm.campaignLandingType" button-style="solid">
  83. <a-radio-button value="APP">应用</a-radio-button>
  84. <a-radio-button value="LINK" disabled>销售线索收集</a-radio-button>
  85. <a-radio-button value="SHOP" disabled>电商店铺推广</a-radio-button>
  86. </a-radio-group>
  87. </a-form-model-item>
  88. <a-form-model-item label="广告类型">
  89. <a-radio-group :disabled="modalTitle === 'edit'" v-model="configForm.advertisingType" button-style="solid">
  90. <a-radio-button value="1">信息流广告</a-radio-button>
  91. <a-radio-button value="2">搜索广告</a-radio-button>
  92. </a-radio-group>
  93. </a-form-model-item>
  94. </div>
  95. <div class="separate-module-con">
  96. <p class="rock-title">基础信息</p>
  97. <a-form-model-item label="广告组名称" prop="campaignName">
  98. <a-input
  99. class="common-input-long"
  100. v-model="configForm.campaignName"
  101. allow-clear
  102. placeholder="请输入广告组名称"
  103. />
  104. </a-form-model-item>
  105. <a-form-model-item label="广告计划名称" prop="adName">
  106. <a-input
  107. class="common-input-long"
  108. id="groupName"
  109. v-model="configForm.adName"
  110. allow-clear
  111. placeholder="请输入广告计划名称"
  112. />
  113. <div>
  114. <a-tag
  115. v-for="item in adNameTags"
  116. :key="item"
  117. color="#1890ff"
  118. @click="handleGetChangeAll(item, 'groupName')"
  119. >
  120. + {{ item }}
  121. </a-tag>
  122. </div>
  123. </a-form-model-item>
  124. <a-form-model-item label="创建数量: 广告组数量" class="campaign-cnt-class" prop="campaignCnt">
  125. <a-input-number v-model="configForm.campaignCnt" :min="1" @change="handleCampaignCnt" :disabled="configForm.dpLinkIndexUsed === 0"/>
  126. <a-tooltip placement="top">
  127. <template slot="title">
  128. <span>输入的数量为每天所创建的广告组数量</span>
  129. <span>以及每个广告组创建的广告计划数量</span>
  130. </template>
  131. <a-icon class="form-itrm-icon" type="smile-o"/>
  132. </a-tooltip>
  133. <div v-if="campaignStatus" style="width: 500px;color: #f00;">单账号每天创建计划上限500个</div>
  134. </a-form-model-item>
  135. <a-form-model-item label="广告计划数量" class="campaign-ad-class" prop="campaignAdCnt">
  136. <a-input-number v-model="configForm.campaignAdCnt" :min="1" @change="handleCampaignAdCnt"/>
  137. </a-form-model-item>
  138. </div>
  139. <div class="separate-module-con">
  140. <p class="rock-title">投放内容</p>
  141. <a-form-model-item label="投放目标">
  142. <a-radio-group :disabled="modalTitle === 'edit'" v-model="configForm.launchTarget" button-style="solid">
  143. <a-radio-button value="OCPM">转化量</a-radio-button>
  144. <a-radio-button value="CPC" disabled>点击量</a-radio-button>
  145. <a-radio-button value="CPM" disabled>展示量</a-radio-button>
  146. </a-radio-group>
  147. </a-form-model-item>
  148. <a-form-model-item label="下载方式">
  149. <a-radio-group
  150. :disabled="modalTitle === 'edit'"
  151. v-model="configForm.adDownloadType"
  152. button-style="solid"
  153. @change="handleAdDownLoadType"
  154. >
  155. <a-radio-button value="DOWNLOAD_URL">下载链接</a-radio-button>
  156. <a-radio-button value="EXTERNAL_URL">落地页</a-radio-button>
  157. </a-radio-group>
  158. </a-form-model-item>
  159. <a-form-model-item v-if="configForm.adDownloadType === 'EXTERNAL_URL'" label="落地页链接" prop="adExternalUrl">
  160. <a-input
  161. class="common-input-long"
  162. :disabled="modalTitle === 'edit'"
  163. v-model="configForm.adExternalUrl"
  164. placeholder="请输入落地页链接"
  165. allow-clear
  166. />
  167. </a-form-model-item>
  168. <a-form-model-item v-if="configForm.adDownloadType === 'EXTERNAL_URL'" label="直达链接内容">
  169. <a-input
  170. class="common-input-long"
  171. v-model="configForm.adOpenUrl"
  172. placeholder="请输入直达链接内容"
  173. allow-clear
  174. />
  175. </a-form-model-item>
  176. <a-form-model-item v-if="configForm.adDownloadType === 'DOWNLOAD_URL'" label="下载链接" prop="adDownloadUrl">
  177. <a-input
  178. class="common-input-long"
  179. :disabled="modalTitle === 'edit'"
  180. v-model="configForm.adDownloadUrl"
  181. placeholder="请输入下载链接"
  182. allow-clear
  183. @change="handleDownloadLink"
  184. />
  185. </a-form-model-item>
  186. <a-form-model-item v-if="configForm.adDownloadType === 'DOWNLOAD_URL'" label="应用包名" prop="adPackage">
  187. <a-input
  188. class="common-input-long"
  189. :disabled="modalTitle === 'edit'"
  190. v-model="configForm.adPackage"
  191. placeholder="请输入应用包名"
  192. allow-clear
  193. />
  194. </a-form-model-item>
  195. </div>
  196. <div class="separate-module-con">
  197. <p class="rock-title">优化目标</p>
  198. <a-form-model-item label="转化跟踪方式" :prop="configForm.launchTarget === 'OCPM' ? 'adConvertType' : ''">
  199. <a-select
  200. class="common-input-long"
  201. :disabled="modalTitle === 'edit'"
  202. v-model="configForm.adConvertType"
  203. placeholder="请选择"
  204. @change="handleConvertTypeChange"
  205. >
  206. <a-select-option value="AD_CONVERT_SOURCE_TYPE_APP_DOWNLOAD">应用下载API</a-select-option>
  207. <a-select-option value="AD_CONVERT_SOURCE_TYPE_SDK">应用下载SDK</a-select-option>
  208. <a-select-option value="AD_CONVERT_SOURCE_TYPE_OPEN_URL">应用直达API(应用直达链接)</a-select-option>
  209. <a-select-option value="AD_CONVERT_SOURCE_TYPE_NORMAL_APP_DOWNLOAD">普通应用下载</a-select-option>
  210. </a-select>
  211. </a-form-model-item>
  212. <a-form-model-item label="优化目标" :prop="configForm.launchTarget === 'OCPM' ? 'adConvertId' : ''">
  213. <a-select
  214. class="common-input-long"
  215. :disabled="modalTitle === 'edit'"
  216. v-model="configForm.adConvertId"
  217. placeholder="请选择"
  218. @change="handleConvertChange"
  219. >
  220. <a-select-option
  221. v-for="(item, index) in optimizationOption"
  222. :key="index"
  223. :value="item.convert_id"
  224. >
  225. {{ item.external_name }}
  226. </a-select-option>
  227. </a-select>
  228. </a-form-model-item>
  229. </div>
  230. <div class="separate-module-con">
  231. <p class="rock-title">设置投放位置</p>
  232. <a-form-model-item label="广告位置">
  233. <a-radio-group
  234. :disabled="modalTitle === 'edit'"
  235. v-model="configForm.adverPosition"
  236. button-style="solid"
  237. @change="handleAdverPosition"
  238. >
  239. <a-radio-button value="a">系统优选广告位</a-radio-button>
  240. <a-radio-button value="b">按媒体指定位置</a-radio-button>
  241. <a-radio-button value="c">按场景指定位置</a-radio-button>
  242. </a-radio-group>
  243. </a-form-model-item>
  244. <div class="adver-position-radio">
  245. <p v-if="configForm.adverPosition === 'a'">
  246. 系统将根据您设置的定向,选择预估效果最好的广告位进行投放,并触达尽可能多的目标用户
  247. </p>
  248. <div v-if="configForm.adverPosition === 'c'" class="position-radio-change">
  249. <p>位置选择</p>
  250. <a-radio-group v-model="configForm.radioChangeValue">
  251. <a-radio :style="radioStyle" value="VIDEO_SCENE">沉浸式竖版视频场景</a-radio>
  252. <a-radio :style="radioStyle" value="FEED_SCENE">信息流场景</a-radio>
  253. <a-radio :style="radioStyle" value="TAIL_SCENE">视频后贴和尾帧场景</a-radio>
  254. </a-radio-group>
  255. </div>
  256. <div v-if="configForm.adverPosition === 'b'" class="position-radio-change">
  257. <p>位置选择</p>
  258. <a-checkbox-group v-model="configForm.checkboxChangeValue">
  259. <a-checkbox :style="radioStyle" value="INVENTORY_FEED">今日头条</a-checkbox>
  260. <a-checkbox :style="radioStyle" value="INVENTORY_VIDEO_FEED">西瓜视频</a-checkbox>
  261. <a-checkbox :style="radioStyle" value="INVENTORY_HOTSOON_FEED">抖音火山版</a-checkbox>
  262. <a-checkbox :style="radioStyle" value="INVENTORY_AWEME_FEED">抖音短视频</a-checkbox>
  263. <a-checkbox :style="radioStyle" value="INVENTORY_UNION_SLOT">穿山甲</a-checkbox>
  264. <a-checkbox :style="radioStyle" value="UNION_BOUTIQUE_GAME">ohayoo精品游戏</a-checkbox>
  265. <a-checkbox :style="radioStyle" value="INVENTORY_TOMATO_NOVEL">番茄小说</a-checkbox>
  266. </a-checkbox-group>
  267. </div>
  268. </div>
  269. </div>
  270. <div class="separate-module-con">
  271. <a-tabs v-model="selectPackageTabs" @change="handleSelectPackageTabs">
  272. <a-tab-pane key="1" tab="新建定向">
  273. <p class="rock-title">用户定向</p>
  274. <a-form-model-item label="地域">
  275. <a-radio-group v-model="configForm.adDistrict" button-style="solid">
  276. <a-radio-button value="NONE">不限</a-radio-button>
  277. <a-radio-button value="CITY">按省市</a-radio-button>
  278. <a-radio-button value="COUNTY" disabled>按区县</a-radio-button>
  279. </a-radio-group>
  280. </a-form-model-item>
  281. <div v-if="configForm.adDistrict === 'CITY'" class="adver-position-radio selected-city-arr">
  282. <link-multi-select
  283. title="省份"
  284. :listArr="listArr"
  285. :maxLayers="2"
  286. :listUrl="regionCityListUrl"
  287. @getSelectedArr="getSelectedCityArr"
  288. @checkedShowList="handleCheckedShowList"
  289. >
  290. </link-multi-select>
  291. <a-radio-group class="city-arr-radio-group" v-model="configForm.adLocationType">
  292. <a-radio value="HOME">居住在该地区的用户</a-radio>
  293. <a-radio value="TRAVEL"> 到该地区旅行的用户</a-radio>
  294. <a-radio value="ALL">该地区内的所有用户</a-radio>
  295. <a-radio value="CURRENT">正在该地区的用户</a-radio>
  296. </a-radio-group>
  297. </div>
  298. <a-form-model-item label="性别">
  299. <a-radio-group v-model="configForm.adGender" button-style="solid">
  300. <a-radio-button value="NONE">不限</a-radio-button>
  301. <a-radio-button value="GENDER_MALE">男</a-radio-button>
  302. <a-radio-button value="GENDER_FEMALE">女</a-radio-button>
  303. </a-radio-group>
  304. </a-form-model-item>
  305. <a-form-model-item label="年龄">
  306. <radio-check v-model="configForm.adSelectAge" :options="ageArr" @change="getAgeSelect"></radio-check>
  307. </a-form-model-item>
  308. <a-form-model-item label="自定义人群">
  309. <a-radio-group v-model="configForm.customPerson" button-style="solid" @change="handleCustomPerson">
  310. <a-radio-button value="NONE">不限</a-radio-button>
  311. <a-radio-button value="a">自定义人群</a-radio-button>
  312. </a-radio-group>
  313. </a-form-model-item>
  314. <a-form-model-item v-if="configForm.customPerson === 'a'" label="定向逻辑">
  315. <a-radio-group v-model="configForm.adRetargetingTagsType" button-style="solid" @change="handleDirectionalLogic">
  316. <a-radio-button value="1">定向</a-radio-button>
  317. <a-radio-button value="2">排除</a-radio-button>
  318. <a-radio-button value="3">同时定向排除</a-radio-button>
  319. </a-radio-group>
  320. </a-form-model-item>
  321. <div v-if="configForm.customPerson === 'a' && configForm.adRetargetingTagsType === '1'" class="adver-position-radio">
  322. <div style="width: 60%;">
  323. <directional-logic
  324. ref="direct"
  325. packtype="directional"
  326. multitype="alone"
  327. :defaultlist="directionalData"
  328. :valueids="configForm.adRetargetingTagsType"
  329. :updatelistinclude="configForm.updateGetingInclude" @selection-alone-event="handleSelectionAloneEvent"
  330. @clearlist="handleClearlist"
  331. >
  332. </directional-logic>
  333. </div>
  334. </div>
  335. <div v-if="configForm.customPerson === 'a' && configForm.adRetargetingTagsType === '2'" class="adver-position-radio">
  336. <div style="width: 60%;">
  337. <directional-logic
  338. ref="exclude"
  339. packtype="exclude"
  340. multitype="alone"
  341. :defaultlist="directionalData"
  342. :valueids="configForm.adRetargetingTagsType"
  343. :updatelistexclude="configForm.updateGetingExclude" @selection-alone-event="handleSelectionAloneEvent"
  344. @clearlist="handleClearlist"
  345. >
  346. </directional-logic>
  347. </div>
  348. </div>
  349. <div v-if="configForm.customPerson === 'a' && configForm.adRetargetingTagsType === '3'" class="adver-position-radio">
  350. <div style="width: 60%;">
  351. <directional-logic
  352. ref="twoway"
  353. packtype="twoway"
  354. multitype="all"
  355. :defaultlist="directionalData"
  356. :valueids="configForm.adRetargetingTagsType"
  357. :updatelistinclude="configForm.updateGetingInclude"
  358. :updatelistexclude="configForm.updateGetingExclude" @selection-direct-event="handleDirectEvent"
  359. @selection-exclude-event="handleExcludeEvent"
  360. @clearlist="handleClearlist"
  361. >
  362. </directional-logic>
  363. </div>
  364. </div>
  365. <a-form-model-item label="媒体定向">
  366. <a-radio-group v-model="configForm.adSuperiorPopularityType" button-style="solid">
  367. <a-radio-button value="NONE">不限</a-radio-button>
  368. <a-radio-button value="GAME" disabled>游戏优质媒体</a-radio-button>
  369. <a-radio-button value="b" disabled>自定义</a-radio-button>
  370. </a-radio-group>
  371. </a-form-model-item>
  372. <a-form-model-item label="平台">
  373. <a-radio-group v-model="configForm.adPlatform" button-style="solid">
  374. <a-radio-button value="NONE" :disabled="platformLoadingType === 'APP_IOS' || platformLoadingType === 'APP_ANDROID'">不限</a-radio-button>
  375. <a-radio-button value="IOS" :disabled="platformLoadingType === 'APP_ANDROID'">IOS</a-radio-button>
  376. <a-radio-button value="ANDROID" :disabled="platformLoadingType === 'APP_IOS'">Andriod</a-radio-button>
  377. <a-radio-button value="PC" :disabled="platformLoadingType === 'APP_IOS' || platformLoadingType === 'APP_ANDROID'">PC</a-radio-button>
  378. </a-radio-group>
  379. </a-form-model-item>
  380. <a-form-model-item label="设备类型">
  381. <radio-check v-model="configForm.adDeviceSelectType" :options="deviceTypeList" @change="getAgeSelect"></radio-check>
  382. </a-form-model-item>
  383. <a-form-model-item v-if="configForm.adDownloadUrl" label="安卓版本">
  384. <a-radio-group v-model="configForm.adAndroidVersion" button-style="solid" @change="handleAndroidVersion">
  385. <a-radio-button value="NONE">不限</a-radio-button>
  386. <a-radio-button value="a">自定义</a-radio-button>
  387. </a-radio-group>
  388. </a-form-model-item>
  389. <div class="adver-position-radio">
  390. <div v-if="configForm.adDownloadUrl && configForm.adAndroidVersion === 'a'" class="position-radio-change">
  391. <p>安卓版本</p>
  392. <a-radio-group v-model="configForm.androidChangeValue">
  393. <a-radio :style="radioStyle" value="9.0">Andriod 9.0及以上</a-radio>
  394. <a-radio :style="radioStyle" value="8.1">Andriod 8.1及以上</a-radio>
  395. <a-radio :style="radioStyle" value="8.0">Andriod 8.0及以上</a-radio>
  396. <a-radio :style="radioStyle" value="7.1">Andriod 7.1及以上</a-radio>
  397. <a-radio :style="radioStyle" value="7.0">Andriod 7.0及以上</a-radio>
  398. <a-radio :style="radioStyle" value="6.0">Andriod 6.0及以上</a-radio>
  399. <a-radio :style="radioStyle" value="5.1">Andriod 5.1及以上</a-radio>
  400. </a-radio-group>
  401. </div>
  402. </div>
  403. <a-form-model-item label="网络">
  404. <radio-check v-model="configForm.adSelectAc" :options="adAcList" @change="getAgeSelect"></radio-check>
  405. </a-form-model-item>
  406. <a-form-model-item label="已安装用户">
  407. <a-radio-group v-model="configForm.adHideIfExists" button-style="solid">
  408. <a-radio-button value="0">不限</a-radio-button>
  409. <a-radio-button value="1">过滤</a-radio-button>
  410. <a-radio-button value="2">定向</a-radio-button>
  411. </a-radio-group>
  412. </a-form-model-item>
  413. <a-form-model-item v-if="configForm.adConvertType" label="过滤已转化用户">
  414. <a-radio-group v-model="configForm.adHideIfConverted" button-style="solid">
  415. <a-radio-button
  416. v-for="item in adHideIfConvertedDataOption"
  417. :key="item.id"
  418. :value="item.id"
  419. >
  420. {{ item.name }}
  421. </a-radio-button>
  422. </a-radio-group>
  423. </a-form-model-item>
  424. <a-form-model-item label="智能放量">
  425. <a-radio-group v-model="configForm.adAutoExtendEnabled" button-style="solid">
  426. <a-radio-button value="0">不开启</a-radio-button>
  427. <a-radio-button value="1">开启</a-radio-button>
  428. </a-radio-group>
  429. </a-form-model-item>
  430. </a-tab-pane>
  431. <a-tab-pane key="2" tab="选择定向包">
  432. <a-form-model-item class="select-orientation-class" label="选择已有定向包" :prop="selectPackageTabs === '2' ? 'adAudiencePackageId' : ''">
  433. <a-select
  434. class="common-input-long"
  435. v-model="configForm.adAudiencePackageId"
  436. allow-clear
  437. placeholder="请选择已有定向包名称"
  438. :disabled="selectOrientPlaceholder !== 'able'"
  439. @change="handleSelectiveOrientation"
  440. >
  441. <a-select-option
  442. v-for="(item, index) in selectiveList"
  443. :key="index"
  444. :value="item.audience_package_id"
  445. >
  446. {{ item.name }}
  447. </a-select-option>
  448. </a-select>
  449. <span style="margin-left: 20px;">
  450. <a-button :disabled="selectOrientPlaceholder !== 'able'" type="primary" @click="handleAsyncPackage">同步定向包</a-button>
  451. </span>
  452. <a-tooltip placement="top">
  453. <template slot="title">
  454. <span>已有定向包只展示当前推广目的和投放范围下,定向功能升级后仍可用的定向包</span>
  455. </template>
  456. <a-icon class="form-itrm-icon orientation-icon" type="smile-o"/>
  457. </a-tooltip>
  458. </a-form-model-item>
  459. <span v-if="selectOrientPlaceholder !== 'able'" style="color: #f00; margin-left: 198px;">{{ selectOrientPlaceholder }}</span>
  460. <div class="select-orientation-content">
  461. <p class="orientation-header-title">已选定向信息</p>
  462. <div v-if="packageMessageDetail.length" class="orientation-content-substance">
  463. <div class="content-substance-singal">
  464. <span class="singal-spn">定向人群包:</span>
  465. <span class="singal-content">{{ packageMessageDetail[0].description }}</span>
  466. </div>
  467. <div class="content-substance-singal">
  468. <span class="singal-spn">地域:</span>
  469. <span class="singal-content">{{ packageMessageDetail[0].replaceCitys }}</span>
  470. </div>
  471. <div class="content-substance-singal">
  472. <span class="singal-spn">性别:</span>
  473. <span class="singal-content">{{ packageMessageDetail[0].replaceSex }}</span>
  474. </div>
  475. <div class="content-substance-singal">
  476. <span class="singal-spn">年龄:</span>
  477. <span class="singal-content">{{ packageMessageDetail[0].replaceAge }}</span>
  478. </div>
  479. <div class="content-substance-singal">
  480. <span class="singal-spn">平台:</span>
  481. <span class="singal-content">{{ packageMessageDetail[0].replacePlate }}</span>
  482. </div>
  483. <div class="content-substance-singal">
  484. <span class="singal-spn">智能放量:</span>
  485. <span class="singal-content">{{ packageMessageDetail[0].replaceEnabled }}</span>
  486. </div>
  487. </div>
  488. <div v-else class="orientation-content-msg">
  489. <div class="icon"><a-icon type="container"/></div>
  490. <div>请在上方选择一个已有定向包</div>
  491. </div>
  492. </div>
  493. </a-tab-pane>
  494. </a-tabs>
  495. </div>
  496. <div class="separate-module-con">
  497. <p class="rock-title">预算与出价</p>
  498. <a-form-model-item label="投放场景">
  499. <a-radio-group v-model="configForm.adSmartBidType" button-style="solid">
  500. <a-radio-button value="SMART_BID_CUSTOM" :disabled="modalTitle === 'edit'">常规投放</a-radio-button>
  501. <a-radio-button value="SMART_BID_CONSERVATIVE" disabled>放量投放</a-radio-button>
  502. </a-radio-group>
  503. </a-form-model-item>
  504. <a-form-model-item label="预算">
  505. <a-input-group compact>
  506. <a-select
  507. :disabled="modalTitle === 'edit'"
  508. v-model="configForm.adBudgetMode"
  509. @change="handleBudgetMode"
  510. >
  511. <a-select-option value="BUDGET_MODE_DAY">日预算</a-select-option>
  512. <a-select-option value="BUDGET_MODE_TOTAL">总预算</a-select-option>
  513. </a-select>
  514. <a-input-number
  515. class="common-input"
  516. v-model="configForm.adBudget"
  517. :min="adBudgetNum"
  518. :step="0.01"
  519. @blur="handleAdBudgetBlur"
  520. />
  521. </a-input-group>
  522. </a-form-model-item>
  523. <a-form-model-item label="投放时间">
  524. <a-radio-group :disabled="modalTitle === 'edit'" v-model="configForm.adScheduleType" button-style="solid" @change="handleAdScheduleType">
  525. <a-radio-button value="SCHEDULE_FROM_NOW">从今天起长期投放</a-radio-button>
  526. <a-radio-button value="SCHEDULE_START_END">设置开始和结束日期</a-radio-button>
  527. </a-radio-group>
  528. </a-form-model-item>
  529. <div class="adver-position-radio">
  530. <div v-if="configForm.adScheduleType === 'SCHEDULE_START_END'" class="position-radio-change">
  531. <a-range-picker
  532. v-model="configForm.launchDateRange"
  533. :disabled="modalTitle === 'edit'"
  534. format="YYYY-MM-DD"
  535. @change="handleLaunchData"
  536. />
  537. </div>
  538. </div>
  539. <a-form-model-item label="投放时段">
  540. <a-radio-group v-model="configForm.launchTimeInterval" button-style="solid" @change="handleLaunchTimeInterval">
  541. <a-radio-button value="buxian">不限</a-radio-button>
  542. <a-radio-button value="a">指定时间段</a-radio-button>
  543. </a-radio-group>
  544. </a-form-model-item>
  545. <div class="adver-position-radio">
  546. <div v-if="configForm.launchTimeInterval === 'a'" class="position-radio-change">
  547. <selectCheckAll
  548. style="width:100%"
  549. :scheduleTime.sync="configForm.scheduleTimeData"
  550. ref="selectCheck"
  551. />
  552. </div>
  553. </div>
  554. <a-form-model-item label="付费方式">
  555. <a-radio-group v-model="configForm.adPricing" button-style="solid">
  556. <a-radio-button value="PRICING_OCPM" :disabled="modalTitle === 'edit'">按展示付费(oCPM)</a-radio-button>
  557. </a-radio-group>
  558. </a-form-model-item>
  559. <a-form-model-item label="出价方式">
  560. <a-radio-group v-model="configForm.adBidCreateType" button-style="solid" @change="handleBiddingMethod">
  561. <a-radio-button value="FIX">固定出价</a-radio-button>
  562. <a-radio-button value="RAND">随机出价</a-radio-button>
  563. <a-radio-button value="STEP">阶梯出价</a-radio-button>
  564. </a-radio-group>
  565. </a-form-model-item>
  566. <a-form-model-item v-if="configForm.adBidCreateType === 'FIX'" label="目标转化出价" :prop="configForm.launchTarget === 'OCPM' ? 'adCpaBid' : ''">
  567. <a-input-number
  568. class="common-input"
  569. v-model="configForm.adCpaBid"
  570. :min="0.1"
  571. :step="0.01"
  572. @blur="handleAdCpaBidBlur"
  573. /> 元
  574. <div v-if="isAdCpaBidBlur" style="width: 500px;color: #f00;">{{ adCpaBidBlurTxt }}</div>
  575. </a-form-model-item>
  576. <div v-if="configForm.adBidCreateType === 'RAND'">
  577. <a-form-model-item label="目标转化出价"
  578. class="dp-link-start" prop="adMinBid">
  579. <a-input-number
  580. class="common-input"
  581. v-model="configForm.adMinBid"
  582. :min="0.1"
  583. :max="10000"
  584. :step="0.01"
  585. placeholder="请输入"
  586. @blur="handleAdMinBidBlur"
  587. />
  588. <span>~</span>
  589. </a-form-model-item>
  590. <a-form-model-item class="dp-link-end" prop="adMaxBid">
  591. <a-input-number
  592. class="common-input"
  593. v-model="configForm.adMaxBid"
  594. :min="0.1"
  595. :max="10000"
  596. :step="0.01"
  597. placeholder="请输入"
  598. @blur="handleAdMaxBidBlur"
  599. /> 元
  600. </a-form-model-item>
  601. <div v-if="isAdCpaBidBlur" style="width: 500px;color: #f00;margin-left: 140px;">{{ adCpaBidBlurTxt }}</div>
  602. </div>
  603. <div v-if="configForm.adBidCreateType === 'STEP'">
  604. <a-form-model-item label="目标转化出价" class="dp-link-start" prop="adMinBid">
  605. <a-input-number
  606. class="common-input"
  607. v-model="configForm.adMinBid"
  608. :min="0.1"
  609. :max="10000"
  610. :step="0.01"
  611. placeholder="请输入"
  612. @blur="handleAdMinBidBlur"
  613. />
  614. <span>~</span>
  615. </a-form-model-item>
  616. <a-form-model-item class="dp-link-end" prop="adMaxBid">
  617. <a-input-number
  618. class="common-input"
  619. v-model="configForm.adMaxBid"
  620. :min="0.1"
  621. :max="10000"
  622. :step="0.01"
  623. placeholder="请输入"
  624. @blur="handleAdMaxBidBlur"
  625. /> 元
  626. </a-form-model-item>
  627. <div v-if="isAdCpaBidBlur" style="width: 500px;color: #f00;margin-left: 140px">{{ adCpaBidBlurTxt }}</div>
  628. <a-form-model-item label="浮动间隔" prop="adStepBid">
  629. <a-input-number
  630. class="common-input"
  631. v-model="configForm.adStepBid"
  632. :step="0.01"
  633. placeholder="请输入"
  634. @blur="handleFloatingInterval"
  635. /> 元
  636. </a-form-model-item>
  637. </div>
  638. </div>
  639. <div class="separate-module-con">
  640. <p class="rock-title">第三方检测链接</p>
  641. <a-form-model-item label="点击监测">
  642. <a-input
  643. class="common-input-long"
  644. placeholder="请输入链接地址"
  645. v-model="configForm.creativeActionTrackUrl"
  646. allow-clear
  647. />
  648. </a-form-model-item>
  649. </div>
  650. <div class="separate-module-con">
  651. <p class="rock-title">创意信息</p>
  652. <a-form-model-item label="创意方式">
  653. <a-radio-group v-model="configForm.creativeMaterialMode" button-style="solid">
  654. <a-radio-button value="STATIC_ASSEMBLE" :disabled="modalTitle === 'edit'">程序化创意</a-radio-button>
  655. <a-radio-button value="NONE" :disabled="modalTitle === 'edit'">自定义创意</a-radio-button>
  656. </a-radio-group>
  657. </a-form-model-item>
  658. <a-form-model-item label="创意内容">
  659. <a-radio-group v-model="configForm.creativeImageMode" button-style="solid">
  660. <a-radio-button value="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL">竖版视频</a-radio-button>
  661. <a-radio-button value="CREATIVE_IMAGE_MODE_VIDEO">横版视频</a-radio-button>
  662. <a-radio-button value="CREATIVE_IMAGE_MODE_LARGE">大图横图</a-radio-button>
  663. <a-radio-button value="CREATIVE_IMAGE_MODE_SMALL">小图</a-radio-button>
  664. <a-radio-button value="CREATIVE_IMAGE_MODE_LARGE_VERTICAL">大图竖图</a-radio-button>
  665. </a-radio-group>
  666. </a-form-model-item>
  667. <a-form-model-item label="卡片主图">
  668. <a-upload
  669. name="avatar"
  670. list-type="picture-card"
  671. class="avatar-uploader"
  672. :show-upload-list="false"
  673. :before-upload="beforeUpload"
  674. >
  675. <div v-if="imageUrl" class="upload-img-class" @mouseover="handleChangeActive">
  676. <div class="img-flex-url">
  677. <img :src="imageUrl" alt="avatar"/>
  678. </div>
  679. <!-- TODO 划过图片显示覆盖层 -->
  680. <!-- <div v-if="isCoverImgDiv" class="cover-img-div" @mouseleave="handleRemoveActive">
  681. <a-icon class="delete-icon-class" type="delete" @click.stop="handleDeleteImg"/>
  682. </div> -->
  683. </div>
  684. <div v-else>
  685. <a-icon type="plus" style="margin-top: 10px;"/>
  686. <div class="ant-upload-text">Upload</div>
  687. </div>
  688. </a-upload>
  689. <span class="especial-label">*</span>
  690. </a-form-model-item>
  691. <a-form-model-item label="卡片标题" prop="creativeProductDescription">
  692. <a-input
  693. class="common-input-long"
  694. placeholder="请输入卡片标题"
  695. v-model="configForm.creativeProductDescription"
  696. allow-clear
  697. />
  698. </a-form-model-item>
  699. <a-form-model-item label="推广卖点">
  700. <a-button type="primary" @click="handleAddOrigin">
  701. <a-icon type="plus" />推广卖点
  702. </a-button>
  703. <span class="especial-label">*</span>
  704. </a-form-model-item>
  705. <div class="adver-position-radio">
  706. <a-form-model-item
  707. v-for="(item, index) in configForm.defaultFormList"
  708. :key="item.id"
  709. class="examin-form-model"
  710. :prop="'defaultFormList.' + index + '.value'"
  711. :rules="[
  712. {required: true, message: '请输入', trigger: 'blur'},
  713. {min: 6, max: 9, message: '请输入6-9个字', trigger: 'blur'},
  714. ]"
  715. >
  716. <a-input class="common-input-long" v-model="item.value" placeholder="请输入" allow-clear/>
  717. <a-icon class="examin-form-icon" type="delete" @click="handleDelOrigin(item)"/>
  718. </a-form-model-item>
  719. </div>
  720. <a-form-model-item label="行动号召">
  721. <a-radio-group v-model="configForm.creativeEnablePersonalAction" button-style="solid">
  722. <a-radio-button :value="true">开启智能优选</a-radio-button>
  723. <a-radio-button :value="false">关闭智能优选</a-radio-button>
  724. </a-radio-group>
  725. <span class="especial-label">*</span>
  726. </a-form-model-item>
  727. <div class="adver-position-radio">
  728. <a-form-model-item prop="creativeCallToAction">
  729. <a-select
  730. class="common-input-long"
  731. v-model="configForm.creativeCallToAction"
  732. >
  733. <a-select-option
  734. v-for="(item, index) in configForm.creativeOptions"
  735. :key="index + 1"
  736. :value="item"
  737. >
  738. {{ item }}
  739. </a-select-option>
  740. </a-select>
  741. </a-form-model-item>
  742. </div>
  743. <a-form-model-item label="来源" :prop="getSource">
  744. <a-input
  745. class="common-input-long"
  746. placeholder="请输入来源"
  747. v-model="configForm.creativeSource"
  748. allow-clear
  749. />
  750. </a-form-model-item>
  751. </div>
  752. <div class="separate-module-con">
  753. <p class="rock-title">创意分类</p>
  754. <a-form-model-item label="创意分类" prop="creativeThirdIndustryIds">
  755. <a-cascader
  756. v-model="configForm.creativeThirdIndustryIds"
  757. class="common-input-long"
  758. :options="createOptions"
  759. :fieldNames="fieldNames"
  760. placeholder="请选择创意分类"
  761. />
  762. </a-form-model-item>
  763. <a-form-model-item label="创意标签">
  764. <a-select
  765. v-model="configForm.creativeLabel"
  766. :token-separators="[',', ' ', ',']"
  767. mode="tags"
  768. style="width: 320px"
  769. placeholder="按回车生成标签"
  770. dropdownClassName="display-none-selset"
  771. @change="handleEnterChang"
  772. >
  773. </a-select>
  774. <span class="especial-label">*</span>
  775. </a-form-model-item>
  776. <div class="adver-position-radio">
  777. <div class="creative-label-content">
  778. <p>已选:{{ creativeTag.length || 0 }}</p>
  779. <div class="label-content-select-tag">
  780. <a-tag
  781. v-for="item in creativeTag"
  782. :key="item"
  783. :closable="true"
  784. class="tag-select-class"
  785. @close="handleTagsClose(item)"
  786. >
  787. {{ item }}
  788. </a-tag>
  789. </div>
  790. </div>
  791. </div>
  792. </div>
  793. <div class="separate-module-con btn-Unique-con">
  794. <a-button class="sure-btn" type="primary" @click="handleRelaxSure">确定</a-button>
  795. <a-button class="cancel-btn" @click="handleRelaxCancel">取消</a-button>
  796. </div>
  797. </a-form-model>
  798. </div>
  799. </div>
  800. </template>
  801. <script>
  802. import AcountSearch from '@/views/modules/Statistics/components/Treeselect.vue';
  803. import SelectCheckAll from '../../BatchCreate/toutiaoTime';
  804. import radioCheck from '@/components/formComponents/checkBoxGroup';
  805. import linkMultiSelect from '@/views/modules/BatchCreate/linkMultiSelect';
  806. import DirectionalLogic from './directional-logic/directional-logic';
  807. import moment from 'moment';
  808. import BMF from 'browser-md5-file';
  809. import {urlAcount} from '../account-config-server.js';
  810. import {getAction, postAction, putAction} from '@/api/manage';
  811. import {mapGetters} from 'vuex';
  812. let COS = require('cos-js-sdk-v5');
  813. let cos = new COS({
  814. SecretId: 'AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets',
  815. SecretKey: 'tXzuwMfplTTK3c9GFUyETilasvQfePu9'
  816. });
  817. let str = '';
  818. for (let i = 0; i < 7 * 48; i++) {
  819. str += '0';
  820. }
  821. export default {
  822. name: 'configuration-modal',
  823. props: {
  824. visible: {
  825. type: Boolean,
  826. default: false
  827. }
  828. },
  829. components: {
  830. AcountSearch,
  831. SelectCheckAll,
  832. radioCheck,
  833. linkMultiSelect,
  834. DirectionalLogic
  835. },
  836. data() {
  837. let handleConfirmValue = (rule, value, callback) => {
  838. const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
  839. if (urlregex.test(value)) {
  840. callback();
  841. }
  842. else {
  843. callback('请输入正确的格式');
  844. }
  845. };
  846. let handleCharacterLen100 = (rule, value, callback) => {
  847. this.handleExportRules(value, 1, 100, callback);
  848. };
  849. let handleCharacterLen20 = (rule, value, callback) => {
  850. this.handleExportRules(value, 4, 20, callback);
  851. };
  852. let floatingIntervalValidator = (rule, value, callback) => {
  853. const finallyResult = Number(this.configForm.adMinBid) + Number(value);
  854. if (finallyResult < Number(this.configForm.adMaxBid)) {
  855. callback();
  856. }
  857. else {
  858. callback('最低出价+浮动间隔<最高出价');
  859. }
  860. };
  861. let adMinBidValidator = (rule, value, callback) => {
  862. const finallyResult = Number(this.configForm.adMaxBid);
  863. if (finallyResult && value && Number(value) < finallyResult) {
  864. this.$refs['ruleForm'].clearValidate(['adMaxBid']);
  865. callback();
  866. }
  867. else {
  868. callback('最低出价不能高于最高出价');
  869. }
  870. };
  871. let adMaxBidValidator = (rule, value, callback) => {
  872. const finallyResult = Number(this.configForm.adMinBid);
  873. if (finallyResult && value && Number(value) > finallyResult) {
  874. this.$refs['ruleForm'].clearValidate(['adMinBid']);
  875. callback();
  876. }
  877. else {
  878. callback('最高出价不能低于最低出价');
  879. }
  880. };
  881. return {
  882. directionalData: [],
  883. platformLoadingType: '',
  884. selectPackageTabs: '1',
  885. deviceTypeList: [
  886. {
  887. value: 'NONE',
  888. label: '不限'
  889. },
  890. {
  891. value: 'MOBILE',
  892. label: '智能手机'
  893. },
  894. {
  895. value: 'PAD',
  896. label: '平板'
  897. }
  898. ],
  899. adAcList: [
  900. {
  901. value: 'NONE',
  902. label: '不限'
  903. },
  904. {
  905. value: 'WIFI',
  906. label: 'WI-FI'
  907. },
  908. {
  909. value: '2G',
  910. label: '2G'
  911. },
  912. {
  913. value: '3G',
  914. label: '3G'
  915. },
  916. {
  917. value: '4G',
  918. label: '4G'
  919. }
  920. ],
  921. adHideIfConvertedDataOption: [ // 过滤已转化用户option
  922. {
  923. id: 'NO_EXCLUDE',
  924. name: '不限'
  925. },
  926. {
  927. id: 'AD',
  928. name: '广告计划'
  929. },
  930. {
  931. id: 'CAMPAIGN',
  932. name: '广告组'
  933. },
  934. {
  935. id: 'ADVERTISER',
  936. name: '广告账户'
  937. },
  938. {
  939. id: 'CUSTOMER',
  940. name: '公司账户'
  941. },
  942. {
  943. id: 'APP',
  944. name: 'APP'
  945. }
  946. ],
  947. packageMessageDetail: [],
  948. selectiveList: [],
  949. isLadderBlur: false,
  950. ladderBlurTxt: '',
  951. isAdCpaBid11Blur: false,
  952. adCpaBid11BlurTxt: '',
  953. isAdCpaBidBlur: false,
  954. adCpaBidBlurTxt: '',
  955. listArr: [],
  956. regionCityListUrl: 'ctop/bytedanceAreaInfo/list',
  957. defaultAdBudget: '',
  958. adBudgetShowTitle: false,
  959. adBudgetNum: 1,
  960. campaignStatus: false,
  961. detailData: {},
  962. modalTitle: '',
  963. toolConvertList: [],
  964. optimizationOption: [],
  965. md5Result: '',
  966. urlResult: '',
  967. createOptions: [],
  968. adNameTags: ['出价方式', '素材名称', '日期', '创意方式'],
  969. fieldNames: {
  970. label: 'industryName',
  971. value: 'industryId',
  972. children: 'children'
  973. },
  974. ageArr: [
  975. {
  976. value: 'NONE',
  977. label: '不限'
  978. },
  979. {
  980. value: 'AGE_BETWEEN_18_23',
  981. label: '18-23岁'
  982. },
  983. {
  984. value: 'AGE_BETWEEN_24_30',
  985. label: '24-30岁'
  986. },
  987. {
  988. value: 'AGE_BETWEEN_31_40',
  989. label: '31-40岁'
  990. },
  991. {
  992. value: 'AGE_BETWEEN_41_49',
  993. label: '41-49岁'
  994. },
  995. {
  996. value: 'AGE_ABOVE_50',
  997. label: '50岁+'
  998. }
  999. ],
  1000. fileList: [],
  1001. isCoverImgDiv: false,
  1002. imageUrl: '',
  1003. creativeTag: [],
  1004. radioStyle: {
  1005. display: 'block',
  1006. height: '30px',
  1007. lineHeight: '30px',
  1008. marginLeft: 0
  1009. },
  1010. labelCol: {span: 4},
  1011. wrapperCol: {span: 14},
  1012. rules: {
  1013. adExternalUrl: [
  1014. {required: true, message: '请输入', trigger: 'blur'},
  1015. {validator: handleConfirmValue, trigger: 'blur'}
  1016. ],
  1017. adPackage: [
  1018. {required: true, message: '请输入', trigger: 'blur'}
  1019. ],
  1020. adDownloadUrl: [
  1021. {required: true, message: '请输入', trigger: 'blur'},
  1022. {validator: handleConfirmValue, trigger: 'blur'}
  1023. ],
  1024. campaignCnt: [
  1025. {required: true, message: '请输入', trigger: 'blur'}
  1026. ],
  1027. campaignAdCnt: [
  1028. {required: true, message: '请输入', trigger: 'blur'}
  1029. ],
  1030. dpLinkStartIndex: [
  1031. {required: true, message: '请输入', trigger: 'blur'}
  1032. ],
  1033. dpLinkEndIndex: [
  1034. {required: true, message: '请输入', trigger: 'blur'}
  1035. ],
  1036. accountBudget: [
  1037. {required: true, message: '请输入', trigger: 'blur'}
  1038. ],
  1039. campaignName: [
  1040. {required: true, message: '请输入广告组名称', trigger: 'blur'},
  1041. {validator: handleCharacterLen100, trigger: 'blur'}
  1042. ],
  1043. creativeSource: [
  1044. {required: true, message: '请输入', trigger: 'blur'},
  1045. {validator: handleCharacterLen20, trigger: 'blur'}
  1046. ],
  1047. adCpaBid: [
  1048. {required: true, message: '请输入', trigger: 'blur'}
  1049. ],
  1050. adStepBid: [
  1051. {required: true, message: '请输入', trigger: 'blur'},
  1052. {validator: floatingIntervalValidator, trigger: 'blur'}
  1053. ],
  1054. adMinBid: [
  1055. {required: true, message: '请输入最低出价', trigger: 'blur'},
  1056. {validator: adMinBidValidator, trigger: 'blur'}
  1057. ],
  1058. adMaxBid: [
  1059. {required: true, message: '请输入最高出价', trigger: 'blur'},
  1060. {validator: adMaxBidValidator, trigger: 'blur'}
  1061. ],
  1062. adName: [
  1063. {required: true, message: '请输入广告计划名称'},
  1064. {validator: handleCharacterLen100, trigger: 'blur'}
  1065. ],
  1066. creativeProductDescription: [
  1067. {required: true, message: '请输入', trigger: 'blur'},
  1068. {min: 1, max: 7, message: '请输入1-7个字', trigger: 'blur'}
  1069. ],
  1070. adAudiencePackageId: [{required: true, message: '请选择', trigger: 'change'}],
  1071. creativeCallToAction: [{required: true, message: '请选择', trigger: 'change'}],
  1072. adConvertType: [{required: true, message: '请选择', trigger: 'change'}],
  1073. adConvertId: [{required: true, message: '请选择', trigger: 'change'}],
  1074. creativeThirdIndustryIds: [{required: true, message: '请选择', trigger: 'change'}]
  1075. },
  1076. configForm: {
  1077. dpLinkIndexUsed: 0,
  1078. adRetargetingTagsType: '',
  1079. adAudiencePackageId: undefined,
  1080. adStepBid: 0,
  1081. ladderOne: '',
  1082. ladderTwo: '',
  1083. adMinBid: '',
  1084. adMaxBid: '',
  1085. adBidCreateType: 'FIX',
  1086. creativeOptions: [],
  1087. advancedCreativeType: 'ATTACHED_CREATIVE_NONE',
  1088. adLocationType: 'HOME',
  1089. adCity: '',
  1090. adSelectCity: [],
  1091. defaultFormList: [],
  1092. productSellingPoints: [], // 商品买点
  1093. adBudgetMode: 'BUDGET_MODE_DAY', // 预算类型
  1094. adDownloadUrl: '', // 下载链接
  1095. accountBudget: 1000, // 账户日预算
  1096. accountId: undefined, // 账户
  1097. dpLinkStartIndex: 1,
  1098. dpLinkEndIndex: 2,
  1099. accountBudgetMode: '1', // 预算方式
  1100. campaignLandingType: 'APP', // 推广目标
  1101. advertisingType: '1', // 广告类型
  1102. campaignName: '', // 广告组名称
  1103. adName: '', // 广告计划名称
  1104. campaignCnt: 1, // 广告组计划数量
  1105. campaignAdCnt: 1, // 广告计划数量
  1106. launchTarget: 'OCPM', // 投放目标
  1107. adDownloadType: 'EXTERNAL_URL', // 下载方式
  1108. adExternalUrl: '', // 落地页链接
  1109. adOpenUrl: '', // 直达链接内容
  1110. adPackage: '', // 应用包名
  1111. adConvertType: '', // 转化跟踪方式
  1112. adConvertId: '', // 优化目标 -- 走接口
  1113. adverPosition: 'a', // 广告位置
  1114. radioChangeValue: '', // 广告位置-按照场景指定位置
  1115. checkboxChangeValue: [], // 广告位置-按照媒体指定位置
  1116. adDistrict: 'NONE', // 定向-区域
  1117. adGender: 'NONE', // 定向-性别
  1118. adAge: '', // 定向-年龄
  1119. adSelectAge: ['NONE'],
  1120. customPerson: 'NONE', // 定向-自定义
  1121. adSuperiorPopularityType: 'NONE', // 定向-媒体定向
  1122. adPlatform: 'NONE', // 定向-平台
  1123. adDeviceSelectType: ['NONE'],
  1124. adSelectAc: ['NONE'],
  1125. adAc: '', // 定向-网络
  1126. adHideIfExists: '0', // 定向-已安装用户
  1127. adHideIfConverted: 'NO_EXCLUDE', // 定向-已转化用户
  1128. adAutoExtendEnabled: '0', // 定向-智能播放
  1129. adAndroidVersion: 'NONE', // 定向-安卓版本
  1130. androidChangeValue: '', // 安卓版本-自定义
  1131. adSmartBidType: 'SMART_BID_CUSTOM', // 投放场景
  1132. adBudget: 1, // 预算
  1133. adScheduleType: 'SCHEDULE_FROM_NOW', // 投放时间
  1134. launchDateRange: [], // 设置开始和结束时间
  1135. launchTimeInterval: 'buxian', // 投放时段
  1136. scheduleTimeData: str, // 指定时段选择
  1137. adPricing: 'PRICING_OCPM', // 付费方式
  1138. adCpaBid: 0.1, // 目标转化出价
  1139. creativeActionTrackUrl: '', // 监测地址
  1140. creativeMaterialMode: 'STATIC_ASSEMBLE', // 创意方式
  1141. creativeImageMode: 'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL', // 创意内容
  1142. creativeProductDescription: '', // 卡片标题
  1143. creativeEnablePersonalAction: true, // 智能优选
  1144. creativeSource: '', // 来源
  1145. creativeThirdIndustryId: '', // 创意分类
  1146. creativeThirdIndustryIds: [], // 创意分类
  1147. adKeywords: [], // 创意标签
  1148. updateGetingInclude: [],
  1149. updateGetingExclude: [],
  1150. adRetargetingTagsInclude: '',
  1151. adRetargetingTagsExclude: '',
  1152. creativeCallToAction: '', // 行动号召
  1153. creativeLabel: undefined // 倡议标签
  1154. }
  1155. };
  1156. },
  1157. computed: {
  1158. selectOrientPlaceholder() {
  1159. if (!this.configForm.accountId) {
  1160. return '请选择账户';
  1161. }
  1162. else if (this.configForm.adDownloadType === 'DOWNLOAD_URL' && !this.platformLoadingType) {
  1163. return '请填写投放内容';
  1164. }
  1165. else if (this.configForm.adDownloadType === 'EXTERNAL_URL' && !this.configForm.adExternalUrl) {
  1166. return '请填写投放内容';
  1167. }
  1168. else {
  1169. return 'able';
  1170. }
  1171. },
  1172. getEndIndex() {
  1173. return Number(this.configForm.dpLinkStartIndex) + 1;
  1174. },
  1175. getSource() {
  1176. if (this.configForm.campaignLandingType !== 'APP' || (this.configForm.campaignLandingType === 'APP' && this.configForm.adDownloadType === 'EXTERNAL_URL')) {
  1177. return 'creativeSource';
  1178. }
  1179. },
  1180. NewAountId() {
  1181. return this.configForm.accountId;
  1182. },
  1183. NewAdPackage() {
  1184. return this.configForm.adPackage;
  1185. },
  1186. NewAdExternalUrl() {
  1187. return this.configForm.adExternalUrl;
  1188. }
  1189. },
  1190. watch: {
  1191. NewAdExternalUrl(newVal, oldVal) {
  1192. if (newVal && this.configForm.accountId) {
  1193. const paramsData = {
  1194. advancedCreativeType: 'ATTACHED_CREATIVE_NONE',
  1195. advertiserId: this.configForm.accountId,
  1196. deliveryRange: 'DEFAULT',
  1197. externalUrl: this.configForm.adExternalUrl,
  1198. landingType: this.configForm.campaignLandingType,
  1199. promotionContent: this.configForm.adDownloadType
  1200. };
  1201. this.handleGetOptimizationObjective(paramsData);
  1202. this.handleGetAdAudiencePackage();
  1203. }
  1204. },
  1205. NewAdPackage(newVal, oldVal) {
  1206. if (newVal && this.configForm.accountId) {
  1207. const paramsData = {
  1208. advancedCreativeType: 'ATTACHED_CREATIVE_NONE',
  1209. advertiserId: this.configForm.accountId,
  1210. appType: 'APP_ANDROID',
  1211. deliveryRange: 'DEFAULT',
  1212. externalUrl: this.configForm.adExternalUrl,
  1213. landingType: this.configForm.campaignLandingType,
  1214. packageName: this.configForm.adPackage,
  1215. promotionContent: this.configForm.adDownloadType
  1216. };
  1217. this.handleGetOptimizationObjective(paramsData);
  1218. }
  1219. },
  1220. platformLoadingType(newVal, oldVal) {
  1221. if (newVal && this.configForm.accountId) {
  1222. this.handleGetAdAudiencePackage();
  1223. }
  1224. },
  1225. NewAountId(newVal, oldVal) {
  1226. if (newVal && this.configForm.adPackage) {
  1227. const paramsData = {
  1228. advancedCreativeType: 'ATTACHED_CREATIVE_NONE',
  1229. advertiserId: this.configForm.accountId,
  1230. appType: 'APP_ANDROID',
  1231. deliveryRange: 'DEFAULT',
  1232. externalUrl: this.configForm.adExternalUrl,
  1233. landingType: this.configForm.campaignLandingType,
  1234. packageName: this.configForm.adPackage,
  1235. promotionContent: this.configForm.adDownloadType
  1236. };
  1237. this.handleGetOptimizationObjective(paramsData);
  1238. }
  1239. if (newVal && this.platformLoadingType) {
  1240. this.handleGetAdAudiencePackage();
  1241. }
  1242. if (newVal) {
  1243. this.handleGetCreativeClassification();
  1244. this.handleGetAdvertiserStrategy();
  1245. this.handleDirectionalList();
  1246. }
  1247. else {
  1248. this.createOptions = [];
  1249. this.creativeOptions = [];
  1250. this.selectiveList = [];
  1251. this.optimizationOption = [];
  1252. }
  1253. }
  1254. },
  1255. mounted() {
  1256. const routeQuery = JSON.parse(localStorage.getItem('queryList'));
  1257. if (routeQuery.accountModal === 'edit') {
  1258. this.modalTitle = 'edit';
  1259. this.handleGetDetailList();
  1260. }
  1261. else if (routeQuery.accountModal === 'add') {
  1262. this.modalTitle = 'add';
  1263. }
  1264. },
  1265. methods: {
  1266. ...mapGetters(['nickname', 'avatar', 'userInfo']),
  1267. moment,
  1268. handleSelectPackageTabs(e) {
  1269. if (this.modalTitle === 'add') {
  1270. if (e === '1') {
  1271. this.configForm.adAudiencePackageId = undefined;
  1272. this.packageMessageDetail = [];
  1273. }
  1274. else if (e === '2') {
  1275. this.configForm.adDistrict = 'NONE';
  1276. this.listArr = [];
  1277. this.configForm.adLocationType = 'HOME';
  1278. this.configForm.adGender = 'NONE';
  1279. this.configForm.adSelectAge = ['NONE'];
  1280. this.configForm.customPerson = 'NONE';
  1281. this.configForm.updateGetingInclude = [];
  1282. this.configForm.adRetargetingTagsInclude = '';
  1283. this.configForm.adRetargetingTagsExclude = '';
  1284. this.configForm.updateGetingExclude = [];
  1285. this.configForm.adRetargetingTagsType = '';
  1286. if (!this.platformLoadingType) {
  1287. this.configForm.adPlatform = 'NONE';
  1288. this.platformLoadingType = '';
  1289. }
  1290. this.configForm.adDeviceSelectType = ['NONE'];
  1291. this.configForm.adAndroidVersion = 'NONE';
  1292. this.configForm.adSelectAc = ['NONE'];
  1293. this.configForm.adHideIfExists = '0';
  1294. this.configForm.adAutoExtendEnabled = '0';
  1295. }
  1296. }
  1297. },
  1298. handleCustomPerson(e) {
  1299. const defaultValue = e.target.value;
  1300. if (defaultValue === 'NONE') {
  1301. this.configForm.updateGetingInclude = [];
  1302. this.configForm.adRetargetingTagsInclude = '';
  1303. this.configForm.adRetargetingTagsExclude = '';
  1304. this.configForm.updateGetingExclude = [];
  1305. this.configForm.adRetargetingTagsType = '';
  1306. }
  1307. else if (defaultValue === 'a') {
  1308. this.configForm.adRetargetingTagsType = '1';
  1309. }
  1310. },
  1311. handleAsyncPackage() {
  1312. this.handleGetAdAudiencePackage();
  1313. this.configForm.adAudiencePackageId = undefined;
  1314. this.packageMessageDetail = [];
  1315. },
  1316. handleDpLinkIndexUsed(e) {
  1317. const defaultId = e.target.value;
  1318. if (defaultId === 0) {
  1319. this.adNameTags.pop();
  1320. this.configForm.dpLinkStartIndex = 1;
  1321. this.configForm.dpLinkEndIndex = 2;
  1322. this.configForm.campaignCnt = 1;
  1323. }
  1324. else if (defaultId === 1) {
  1325. this.adNameTags.push('dp链接标识');
  1326. }
  1327. },
  1328. handleDplinkStart(e) {
  1329. this.configForm.dpLinkStartIndex = Math.round(e);
  1330. },
  1331. handleDplinkEnd(e) {
  1332. this.configForm.dpLinkEndIndex = Math.round(e);
  1333. },
  1334. handleFloatingInterval(e) {
  1335. this.configForm.adStepBid = Number(Number(e.target.value).toFixed(2));
  1336. },
  1337. handleAdMinBidBlur(e) {
  1338. this.configForm.adMinBid = Number(Number(e.target.value).toFixed(2));
  1339. },
  1340. handleAdMaxBidBlur(e) {
  1341. const defaultValue = e.target.value;
  1342. this.configForm.adMaxBid = Number(Number(defaultValue).toFixed(2));
  1343. if (this.configForm.adBudget > 0 && defaultValue > this.configForm.adBudget) {
  1344. this.isAdCpaBidBlur = true;
  1345. this.adCpaBidBlurTxt = '出价不能大于预算';
  1346. }
  1347. else {
  1348. this.isAdCpaBidBlur = false;
  1349. }
  1350. },
  1351. handleDirectionalList() {
  1352. const paramsData = {
  1353. accountId: this.configForm.accountId
  1354. };
  1355. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getDMPCustomAudience', paramsData).then(result => {
  1356. if (result.code === 0) {
  1357. result.result.forEach(item => {
  1358. item.key = item.custom_audience_id;
  1359. });
  1360. this.directionalData = result.result;
  1361. }
  1362. else {
  1363. this.$message.error(result.message);
  1364. }
  1365. }).catch(error => {
  1366. console.log(error, 'eeee');
  1367. });
  1368. },
  1369. handleSelectionAloneEvent(list) {
  1370. if (this.configForm.adRetargetingTagsType === '1') {
  1371. this.configForm.updateGetingInclude = list;
  1372. this.configForm.adRetargetingTagsInclude = list && list.join(',');
  1373. this.configForm.adRetargetingTagsExclude = '';
  1374. this.configForm.updateGetingExclude = [];
  1375. }
  1376. else if (this.configForm.adRetargetingTagsType === '2') {
  1377. this.configForm.updateGetingExclude = list;
  1378. this.configForm.adRetargetingTagsExclude = list && list.join(',');
  1379. this.configForm.updateGetingInclude = [];
  1380. this.configForm.adRetargetingTagsInclude = '';
  1381. }
  1382. },
  1383. handleClearlist() {
  1384. this.configForm.updateGetingInclude = [];
  1385. this.configForm.adRetargetingTagsInclude = '';
  1386. this.configForm.adRetargetingTagsExclude = '';
  1387. this.configForm.updateGetingExclude = [];
  1388. },
  1389. handleDirectEvent(list) {
  1390. this.configForm.updateGetingInclude = list;
  1391. this.configForm.adRetargetingTagsInclude = list && list.join(',');
  1392. },
  1393. handleExcludeEvent(list) {
  1394. this.configForm.updateGetingExclude = list;
  1395. this.configForm.adRetargetingTagsExclude = list && list.join(',');
  1396. },
  1397. handleDirectionalLogic(e) {
  1398. const selectValue = e.target.value;
  1399. this.handleDirectionalList();
  1400. if (selectValue === '1') {
  1401. this.$refs.exclude.aloneInput = '';
  1402. this.$refs.twoway.directInput = '';
  1403. this.$refs.twoway.excludeInput = '';
  1404. }
  1405. else if (selectValue === '2') {
  1406. this.$refs.direct.aloneInput = '';
  1407. this.$refs.twoway.directInput = '';
  1408. this.$refs.twoway.excludeInput = '';
  1409. }
  1410. else if (selectValue === '3') {
  1411. this.$refs.direct.aloneInput = '';
  1412. this.$refs.exclude.aloneInput = '';
  1413. }
  1414. },
  1415. handleGetAdAudiencePackage() {
  1416. const params = {
  1417. accountId: this.configForm.accountId,
  1418. landingType: this.configForm.adDownloadType === 'DOWNLOAD_URL' ? this.platformLoadingType : 'EXTERNAL'
  1419. };
  1420. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getAdAudiencePackage', params)
  1421. .then(result => {
  1422. if (result.code === 0) {
  1423. this.selectiveList = result.result || [];
  1424. }
  1425. else {
  1426. this.$message.error(result.message);
  1427. }
  1428. })
  1429. .catch(error => {
  1430. console.log(error, 'eeee');
  1431. });
  1432. },
  1433. handleSelectiveOrientation(e) {
  1434. const ageUpdateList = [];
  1435. const defaultData = this.selectiveList.filter(item => item.audience_package_id === e);
  1436. defaultData.forEach(item => {
  1437. item.replaceSex = item.audience.gender === 'NONE' ? '不限' : item.audience.gender === 'GENDER_FEMALE' ? '女' : '男';
  1438. item.replaceEnabled = item.audience.auto_extend_enabled === 1 ? '开启' : '不开启';
  1439. item.replacePlate = item.audience.platform && item.audience.platform.length ? item.audience.platform.join(',') : '不限';
  1440. item.replaceCitys = item.audience.cityNames && item.audience.cityNames.length ? item.audience.cityNames.join(',') : '不限';
  1441. this.ageArr.forEach(val => {
  1442. if (item.audience.age && item.audience.age.length && item.audience.age.includes(val.value)) {
  1443. ageUpdateList.push(val.label);
  1444. }
  1445. });
  1446. item.replaceAge = ageUpdateList.length ? ageUpdateList.join(',') : '不限';
  1447. });
  1448. this.packageMessageDetail = defaultData;
  1449. },
  1450. handleBiddingMethod(e) {
  1451. this.configForm.adCpaBid = 0;
  1452. this.configForm.adMinBid = '';
  1453. this.configForm.adMaxBid = '';
  1454. this.configForm.adStepBid = 0;
  1455. this.isAdCpaBidBlur = false;
  1456. this.$refs['ruleForm'].clearValidate(['adMinBid']);
  1457. this.$refs['ruleForm'].clearValidate(['adMaxBid']);
  1458. },
  1459. handleAdCpaBidBlur(e) {
  1460. const defaultValue = e.target.value;
  1461. this.configForm.adCpaBid = Number(Number(defaultValue).toFixed(2));
  1462. if (this.configForm.adBudget > 0 && defaultValue > this.configForm.adBudget) {
  1463. this.isAdCpaBidBlur = true;
  1464. this.adCpaBidBlurTxt = '出价不能大于预算';
  1465. }
  1466. else if (defaultValue > 10000) {
  1467. this.isAdCpaBidBlur = true;
  1468. this.adCpaBidBlurTxt = '目标转化出价不少于0.1元,不超过10000元,请正确输入';
  1469. }
  1470. else {
  1471. this.isAdCpaBidBlur = false;
  1472. }
  1473. },
  1474. handleGetAdvertiserStrategy() {
  1475. const params = {
  1476. accountId: this.configForm.accountId,
  1477. landingType: this.configForm.campaignLandingType,
  1478. advancedCreativeType: 'ATTACHED_CREATIVE_NONE'
  1479. };
  1480. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getAdActionText', params)
  1481. .then(result => {
  1482. if (result.code === 0) {
  1483. this.configForm.creativeOptions = result.result;
  1484. }
  1485. else {
  1486. this.$message.error(result.message);
  1487. }
  1488. })
  1489. .catch(error => {
  1490. console.log(error, 'eeee');
  1491. });
  1492. },
  1493. // 获取选中的城市
  1494. getSelectedCityArr(val) {
  1495. setTimeout(() => {
  1496. this.configForm.adSelectCity = val;
  1497. }, 200);
  1498. },
  1499. handleCheckedShowList(val) {
  1500. if (val.length) {
  1501. this.configForm.adSelectCity = val.map(item => item.code);
  1502. }
  1503. else {
  1504. this.configForm.adSelectCity = [];
  1505. }
  1506. },
  1507. getAgeSelect(data) {
  1508. if (data.length > 1 && data.findIndex(item => item === 'NONE') === 0) {
  1509. data.splice(data.findIndex(item => item === 'NONE'), 1);
  1510. }
  1511. else if (data.length > 1 && data.findIndex(item => item === 'NONE') === data.length - 1) {
  1512. data.splice(0, data.length - 1);
  1513. }
  1514. else if (data.length === 0) {
  1515. data.push('NONE');
  1516. }
  1517. },
  1518. handleAdBudgetBlur(e) {
  1519. const adBudgetInput = e.target.value;
  1520. this.configForm.adBudget = Number(Number(adBudgetInput).toFixed(2));
  1521. if (this.configForm.adCpaBid > adBudgetInput) {
  1522. this.isAdCpaBidBlur = true;
  1523. this.adCpaBidBlurTxt = '出价不能大于预算';
  1524. }
  1525. else {
  1526. this.isAdCpaBidBlur = false;
  1527. }
  1528. },
  1529. handleAccountBudget(e) {
  1530. const adBudgetInput = e.target.value;
  1531. this.configForm.accountBudget = Number(Number(adBudgetInput).toFixed(2));
  1532. if (this.modalTitle === 'edit') {
  1533. if (Number(adBudgetInput) >= Number(this.defaultAdBudget) && Number(adBudgetInput) < (Number(this.defaultAdBudget) + 100)) {
  1534. this.adBudgetShowTitle = true;
  1535. }
  1536. else if (Number(adBudgetInput) <= Number(this.defaultAdBudget) && Number(adBudgetInput) > (Number(this.defaultAdBudget) - 100)) {
  1537. this.adBudgetShowTitle = true;
  1538. }
  1539. else {
  1540. this.adBudgetShowTitle = false;
  1541. }
  1542. }
  1543. },
  1544. handleExportRules(value, min, max, callback) {
  1545. let cnReg = /([\u4e00-\u9fa5]|[\u3000-\u303F]|[\uFF00-\uFF60])/;
  1546. let length = 0;
  1547. let strArr = value.split('');
  1548. strArr.forEach(item => {
  1549. if (cnReg.test(item)) {
  1550. length += 2;
  1551. }
  1552. else {
  1553. length += 1;
  1554. }
  1555. });
  1556. if (min <= length && length <= max) {
  1557. callback();
  1558. }
  1559. else {
  1560. callback(`只能输入${min}-${max}个字符`);
  1561. }
  1562. },
  1563. handleGetPackage() {
  1564. const params = {
  1565. urlPath: this.configForm.adDownloadUrl
  1566. };
  1567. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getPackageNameByUrl', params)
  1568. .then(result => {
  1569. if (result.code === 0) {
  1570. this.configForm.adPackage = result.result.package || '';
  1571. this.platformLoadingType = result.result.platform || '';
  1572. if (result.result.platform && result.result.platform === 'APP_ANDROID') {
  1573. this.configForm.adPlatform = 'ANDROID';
  1574. }
  1575. else if (result.result.platform && result.result.platform === 'APP_IOS') {
  1576. this.configForm.adPlatform = 'IOS';
  1577. }
  1578. }
  1579. else {
  1580. this.$message.error(result.message);
  1581. }
  1582. })
  1583. .catch(error => {
  1584. console.log(error, 'eeee');
  1585. });
  1586. },
  1587. handleAndroidVersion(e) {
  1588. if (e.target.value === 'NONE') {
  1589. this.configForm.androidChangeValue = '';
  1590. }
  1591. },
  1592. handleAdScheduleType(e) {
  1593. if (e.target.value === 'SCHEDULE_FROM_NOW') {
  1594. this.configForm.launchDateRange = [];
  1595. }
  1596. },
  1597. handleLaunchTimeInterval(e) {
  1598. if (e.target.value === 'buxian') {
  1599. this.configForm.scheduleTimeData = str;
  1600. }
  1601. },
  1602. handleAdverPosition(e) {
  1603. if (e.target.value === 'a') {
  1604. this.configForm.radioChangeValue = '';
  1605. this.configForm.checkboxChangeValue = [];
  1606. }
  1607. else if (e.target.value === 'b') {
  1608. this.configForm.radioChangeValue = '';
  1609. }
  1610. else if (e.target.value === 'c') {
  1611. this.configForm.checkboxChangeValue = [];
  1612. }
  1613. },
  1614. handleAccountMode(e) {
  1615. if (e.target.value === '1') {
  1616. this.configForm.accountBudget = 0;
  1617. }
  1618. else if (e.target.value === '2') {
  1619. this.configForm.accountBudget = 1000;
  1620. }
  1621. },
  1622. handleAdDownLoadType(e) {
  1623. this.optimizationOption = [];
  1624. const defaultValue = e.target.value;
  1625. if (defaultValue === 'DOWNLOAD_URL') {
  1626. this.configForm.adExternalUrl = '';
  1627. this.configForm.adOpenUrl = '';
  1628. this.$refs.ruleForm.clearValidate(['adExternalUrl']);
  1629. }
  1630. else if (defaultValue === 'EXTERNAL_URL') {
  1631. this.configForm.adDownloadUrl = '';
  1632. this.configForm.adPackage = '';
  1633. this.configForm.adConvertId = '';
  1634. this.$refs.ruleForm.clearValidate(['adDownloadUrl']);
  1635. this.$refs.ruleForm.clearValidate(['adPackage']);
  1636. }
  1637. },
  1638. handleCampaignCnt(e) {
  1639. const finallyResult = e * this.configForm.campaignAdCnt;
  1640. if (finallyResult > 500) {
  1641. this.campaignStatus = true;
  1642. }
  1643. else {
  1644. this.campaignStatus = false;
  1645. }
  1646. },
  1647. handleCampaignAdCnt(e) {
  1648. const finallyResult = e * this.configForm.campaignCnt;
  1649. if (finallyResult > 500) {
  1650. this.campaignStatus = true;
  1651. }
  1652. else {
  1653. this.campaignStatus = false;
  1654. }
  1655. },
  1656. handleConvertChange(e) {
  1657. const convertTitle = this.optimizationOption.filter(item => item.convert_id === e);
  1658. this.configForm.creativeActionTrackUrl = convertTitle[0].action_track_url;
  1659. },
  1660. handleGetDetailList() {
  1661. const routeQuery = JSON.parse(localStorage.getItem('queryList'));
  1662. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/queryById', {id: routeQuery.id})
  1663. .then(result => {
  1664. if (result.code === 0) {
  1665. const detailData = result.result;
  1666. this.configForm.accountId = detailData.accountId;
  1667. if (detailData.adAudiencePackageId) {
  1668. this.selectPackageTabs = '2';
  1669. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getAdAudiencePackage', {accountId: detailData.accountId})
  1670. .then(result => {
  1671. if (result.code === 0) {
  1672. this.selectiveList = result.result || [];
  1673. this.configForm.adAudiencePackageId = Number(detailData.adAudiencePackageId);
  1674. this.handleSelectiveOrientation(Number(detailData.adAudiencePackageId));
  1675. }
  1676. else {
  1677. this.$message.error(result.message);
  1678. }
  1679. })
  1680. .catch(error => {
  1681. console.log(error, 'eeee');
  1682. });
  1683. }
  1684. else {
  1685. this.selectPackageTabs = '1';
  1686. }
  1687. this.configForm.dpLinkStartIndex = detailData.dpLinkStartIndex;
  1688. this.configForm.dpLinkEndIndex = detailData.dpLinkEndIndex;
  1689. this.configForm.accountBudgetMode = detailData.accountBudgetMode;
  1690. this.configForm.accountBudget = detailData.accountBudget;
  1691. this.configForm.campaignLandingType = detailData.campaignLandingType;
  1692. this.configForm.advertisingType = detailData.advertisingType || '1';
  1693. this.configForm.campaignName = detailData.campaignName || '';
  1694. this.configForm.dpLinkIndexUsed = detailData.dpLinkIndexUsed;
  1695. if (detailData.dpLinkIndexUsed === 1) {
  1696. this.adNameTags.push('dp链接标识');
  1697. }
  1698. this.configForm.adName = detailData.adName || '';
  1699. this.configForm.campaignCnt = detailData.campaignCnt || '';
  1700. this.configForm.campaignAdCnt = detailData.campaignAdCnt || '';
  1701. this.configForm.launchTarget = detailData.launchTarget || 'OCPM';
  1702. this.configForm.adDownloadType = detailData.adDownloadType;
  1703. this.configForm.adPlatform = detailData.adPlatform;
  1704. this.configForm.adExternalUrl = detailData.adExternalUrl || '';
  1705. this.configForm.adOpenUrl = detailData.adOpenUrl || '';
  1706. this.configForm.adDownloadUrl = detailData.adDownloadUrl || '';
  1707. this.configForm.adPackage = detailData.adPackage || '';
  1708. this.configForm.adConvertType = detailData.adConvertType || '';
  1709. this.configForm.adDistrict = detailData.adDistrict || 'NONE';
  1710. if (detailData.adDownloadType === 'DOWNLOAD_URL') {
  1711. this.handleGetPackage();
  1712. }
  1713. setTimeout(() => {
  1714. this.listArr = detailData.adCity.split(',');
  1715. this.configForm.adSelectCity = detailData.adCity.split(',');
  1716. }, 200);
  1717. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getDMPCustomAudience', {accountId: detailData.accountId}).then(result => {
  1718. if (result.code === 0) {
  1719. result.result.forEach(item => {
  1720. item.key = item.custom_audience_id;
  1721. });
  1722. this.directionalData = result.result;
  1723. this.configForm.adRetargetingTagsType = detailData.adRetargetingTagsType || '1';
  1724. if (detailData.adRetargetingTagsType === '3') {
  1725. this.configForm.customPerson = 'a';
  1726. this.configForm.adRetargetingTagsInclude = detailData.adRetargetingTagsInclude;
  1727. this.configForm.adRetargetingTagsExclude = detailData.adRetargetingTagsExclude;
  1728. this.configForm.updateGetingExclude = detailData.adRetargetingTagsExclude ? detailData.adRetargetingTagsExclude.split(',').map(item => Number(item)) : [];
  1729. this.configForm.updateGetingInclude = detailData.adRetargetingTagsInclude ? detailData.adRetargetingTagsInclude.split(',').map(item => Number(item)) : [];
  1730. }
  1731. else if (detailData.adRetargetingTagsType === '2') {
  1732. this.configForm.customPerson = 'a';
  1733. this.configForm.adRetargetingTagsExclude = detailData.adRetargetingTagsExclude;
  1734. this.configForm.updateGetingExclude = detailData.adRetargetingTagsExclude.split(',').map(item => Number(item));
  1735. this.configForm.updateGetingInclude = [];
  1736. }
  1737. else if (detailData.adRetargetingTagsType === '1') {
  1738. this.configForm.customPerson = 'a';
  1739. this.configForm.adRetargetingTagsInclude = detailData.adRetargetingTagsInclude;
  1740. this.configForm.updateGetingExclude = [];
  1741. this.configForm.updateGetingInclude = detailData.adRetargetingTagsInclude.split(',').map(item => Number(item));
  1742. }
  1743. else {
  1744. this.configForm.customPerson = 'NONE';
  1745. this.configForm.adRetargetingTagsExclude = '';
  1746. this.configForm.updateGetingExclude = '';
  1747. this.configForm.updateGetingInclude = [];
  1748. this.configForm.updateGetingExclude = [];
  1749. }
  1750. }
  1751. else {
  1752. this.$message.error(result.message);
  1753. }
  1754. }).catch(error => {
  1755. console.log(error, 'eeee');
  1756. });
  1757. this.configForm.adGender = detailData.adGender || 'NONE';
  1758. this.configForm.adLocationType = detailData.adLocationType;
  1759. this.configForm.adSelectAge = detailData.adAge.split(',');
  1760. this.configForm.adSelectAc = detailData.adAc.split(',');
  1761. this.configForm.adDeviceSelectType = detailData.adDeviceType.split(',');
  1762. this.configForm.adSuperiorPopularityType = detailData.adSuperiorPopularityType;
  1763. this.configForm.adAc = detailData.adAc;
  1764. this.configForm.adHideIfExists = String(detailData.adHideIfExists);
  1765. this.configForm.adHideIfConverted = detailData.adHideIfConverted;
  1766. this.configForm.adAutoExtendEnabled = detailData.adAutoExtendEnabled;
  1767. this.configForm.adSmartBidType = detailData.adSmartBidType;
  1768. this.configForm.adBudgetMode = detailData.adBudgetMode;
  1769. this.configForm.adBudget = detailData.adBudget;
  1770. this.defaultAdBudget = detailData.accountBudget;
  1771. this.configForm.adScheduleType = detailData.adScheduleType;
  1772. this.configForm.launchDateRange[0] = detailData.adStartTime;
  1773. this.configForm.launchDateRange[1] = detailData.adEndTime;
  1774. this.configForm.adPricing = detailData.adPricing;
  1775. this.configForm.adCpaBid = detailData.adCpaBid;
  1776. this.configForm.creativeActionTrackUrl = detailData.creativeActionTrackUrl;
  1777. this.configForm.creativeMaterialMode = detailData.creativeMaterialMode;
  1778. this.configForm.creativeImageMode = detailData.creativeImageMode;
  1779. this.configForm.creativeProductDescription = detailData.creativeProductDescription;
  1780. this.configForm.creativeEnablePersonalAction = detailData.creativeEnablePersonalAction;
  1781. this.configForm.creativeCallToAction = detailData.creativeCallToAction;
  1782. this.configForm.creativeSource = detailData.creativeSource;
  1783. this.configForm.adBidCreateType = detailData.adBidCreateType;
  1784. this.configForm.adMinBid = detailData.adMinBid;
  1785. this.configForm.adMaxBid = detailData.adMaxBid;
  1786. this.configForm.adStepBid = detailData.adStepBid;
  1787. this.configForm.adBidCreateType = detailData.adBidCreateType;
  1788. this.configForm.creativeThirdIndustryIds[0] = detailData.creativeThirdIndustryId.substr(0, 4);
  1789. this.configForm.creativeThirdIndustryIds[1] = detailData.creativeThirdIndustryId.substr(0, 6);
  1790. this.configForm.creativeThirdIndustryIds[2] = detailData.creativeThirdIndustryId;
  1791. this.imageUrl = detailData.imageUrl;
  1792. this.urlResult = detailData.imageUrl;
  1793. this.md5Result = detailData.creativeProductImageCode;
  1794. if (detailData.adAndroidOsv !== 'NONE') {
  1795. this.configForm.adAndroidVersion = 'a';
  1796. this.configForm.androidChangeValue = detailData.adAndroidOsv;
  1797. }
  1798. else {
  1799. this.configForm.adAndroidVersion = 'NONE';
  1800. }
  1801. if (detailData.productSellingPoints) {
  1802. let productPointsList = [];
  1803. const randomNum = new Date().getTime() + Math.ceil(Math.random() * 1000);
  1804. detailData.productSellingPoints.forEach((item, index) => {
  1805. productPointsList.push({
  1806. id: randomNum + index,
  1807. value: item
  1808. });
  1809. });
  1810. this.configForm.defaultFormList = productPointsList;
  1811. }
  1812. if (detailData.adScheduleTime.indexOf(1) !== -1) {
  1813. this.configForm.launchTimeInterval = 'a';
  1814. this.configForm.scheduleTimeData = detailData.adScheduleTime;
  1815. }
  1816. else {
  1817. this.configForm.launchTimeInterval = 'buxian';
  1818. }
  1819. if (detailData.creativeSceneInventory) {
  1820. this.configForm.adverPosition = 'c';
  1821. this.configForm.radioChangeValue = detailData.creativeSceneInventory;
  1822. }
  1823. else if (detailData.creativeInventoryType) {
  1824. this.configForm.adverPosition = 'b';
  1825. this.configForm.checkboxChangeValue = detailData.creativeInventoryType.split(',');
  1826. }
  1827. else {
  1828. this.configForm.adverPosition = 'a';
  1829. }
  1830. if (detailData.adKeywords) {
  1831. this.creativeTag = detailData.adKeywords;
  1832. }
  1833. let paramsData = {};
  1834. if (this.configForm.adDownloadType === 'DOWNLOAD_URL') {
  1835. paramsData = {
  1836. advancedCreativeType: 'ATTACHED_CREATIVE_NONE',
  1837. advertiserId: this.configForm.accountId,
  1838. appType: 'APP_ANDROID',
  1839. deliveryRange: 'DEFAULT',
  1840. externalUrl: this.configForm.adExternalUrl,
  1841. landingType: this.configForm.campaignLandingType,
  1842. packageName: this.configForm.adPackage,
  1843. promotionContent: this.configForm.adDownloadType
  1844. };
  1845. }
  1846. else if (this.configForm.adDownloadType === 'EXTERNAL_URL') {
  1847. paramsData = {
  1848. advancedCreativeType: 'ATTACHED_CREATIVE_NONE',
  1849. advertiserId: this.configForm.accountId,
  1850. deliveryRange: 'DEFAULT',
  1851. externalUrl: this.configForm.adExternalUrl,
  1852. landingType: this.configForm.campaignLandingType,
  1853. promotionContent: this.configForm.adDownloadType
  1854. };
  1855. }
  1856. postAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getToolConvert', paramsData).then(result => {
  1857. if (result.code === 0) {
  1858. const updateResult = result.result.filter(item => item.external_actions.length > 0);
  1859. this.configForm.adConvertType = updateResult[0].convert_type;
  1860. this.optimizationOption = updateResult[0].external_actions;
  1861. setTimeout(() => {
  1862. this.configForm.adConvertId = detailData.adConvertId;
  1863. }, 300);
  1864. }
  1865. else {
  1866. this.$message.error(result.message);
  1867. }
  1868. }).catch(error => {
  1869. console.log(error, 'eeee');
  1870. });
  1871. }
  1872. else {
  1873. this.$message.error(result.message);
  1874. }
  1875. })
  1876. .catch(error => {
  1877. console.log(error, 'eeee');
  1878. });
  1879. },
  1880. handleConvertTypeChange(e) {
  1881. this.configForm.adConvertId = '';
  1882. this.toolConvertList.forEach(item => {
  1883. if (item.convert_type === e) {
  1884. this.optimizationOption = item.external_actions;
  1885. }
  1886. });
  1887. },
  1888. // 优化目标数据获取
  1889. handleGetOptimizationObjective(paramsData) {
  1890. postAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getToolConvert', paramsData).then(result => {
  1891. if (result.code === 0) {
  1892. this.toolConvertList = result.result;
  1893. if (this.configForm.adConvertType) {
  1894. this.handleConvertTypeChange(this.configForm.adConvertType);
  1895. }
  1896. }
  1897. else {
  1898. this.$message.error(result.message);
  1899. }
  1900. }).catch(error => {
  1901. console.log(error, 'eeee');
  1902. });
  1903. },
  1904. // 创意分类接口
  1905. handleGetCreativeClassification() {
  1906. const paramsData = {
  1907. accountId: this.configForm.accountId
  1908. };
  1909. getAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/getIndustryList', paramsData).then(result => {
  1910. if (result.code === 0) {
  1911. this.createOptions = result.result;
  1912. }
  1913. else {
  1914. this.$message.error(result.message);
  1915. }
  1916. }).catch(error => {
  1917. console.log(error, 'eeee');
  1918. });
  1919. },
  1920. handleAddList(data) {
  1921. postAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/addBytedanceStrategy', data).then(result => {
  1922. if (result.code === 0) {
  1923. this.$message.success('创建成功');
  1924. this.$router.replace('/account-config/account-config');
  1925. this.$bus.$emit('remove', '/account-config/components/configuration-modal');
  1926. }
  1927. else {
  1928. this.$message.error(result.message);
  1929. }
  1930. }).catch(error => {
  1931. console.log(error, 'eeee');
  1932. });
  1933. },
  1934. // 点击获取光标位置进行字段插入
  1935. handleGetChangeAll(item, field) {
  1936. let node = document.getElementById(field);
  1937. let startPos = node.selectionStart; // input 第0个字符到选中的字符
  1938. let endPos = node.selectionEnd; // 选中的字符到最后的字符
  1939. let txt = node.value;
  1940. if (startPos === 0 || endPos === 0) {
  1941. this.configForm.adName += '-{{' + item + '}}-';
  1942. }
  1943. else {
  1944. this.configForm.adName = txt.substring(0, startPos) + '-{{' + item + '}}-' + txt.substring(endPos);
  1945. node.selectionStart = startPos + item.length + 6;
  1946. node.selectionEnd = startPos + item.length + 6;
  1947. }
  1948. node.focus();
  1949. node.blur();
  1950. },
  1951. handleLaunchData(date, dateString) {
  1952. this.configForm.launchDateRange = dateString;
  1953. },
  1954. handleBudgetMode(e) {
  1955. if (e === 'BUDGET_MODE_TOTAL') {
  1956. this.configForm.adScheduleType = 'SCHEDULE_START_END';
  1957. this.adBudgetNum = this.configForm.launchTarget === 'OCPM' ? 300 : 0;
  1958. this.configForm.adBudget = 300;
  1959. if (Number(this.configForm.adCpaBid) > Number(this.configForm.adBudget)) {
  1960. this.isAdCpaBidBlur = true;
  1961. this.adCpaBidBlurTxt = '出价不能大于预算';
  1962. }
  1963. else {
  1964. this.isAdCpaBidBlur = false;
  1965. this.adCpaBidBlurTxt = '';
  1966. }
  1967. this.$message.warning('请设置投放时间');
  1968. }
  1969. else if (e === 'BUDGET_MODE_DAY') {
  1970. this.adBudgetNum = 0;
  1971. this.configForm.adBudget = 0;
  1972. }
  1973. },
  1974. handleDelOrigin(list) {
  1975. let formData = this.configForm.defaultFormList;
  1976. this.configForm.defaultFormList = formData.filter(item => list.id !== item.id);
  1977. },
  1978. handleAddOrigin() {
  1979. if (this.configForm.defaultFormList.length >= 10) {
  1980. this.$message.error('最多可以添加10个卖点');
  1981. return;
  1982. }
  1983. const randomNum = new Date().getTime() + Math.ceil(Math.random() * 1000);
  1984. this.$nextTick(() => {
  1985. this.configForm.defaultFormList.push({
  1986. id: randomNum,
  1987. value: ''
  1988. });
  1989. });
  1990. },
  1991. handleDownloadLink(e) {
  1992. this.handleGetPackage();
  1993. },
  1994. handleDeleteImg() {
  1995. this.imageUrl = '';
  1996. this.isCoverImgDiv = false;
  1997. },
  1998. handleChangeActive() {
  1999. this.isCoverImgDiv = true;
  2000. },
  2001. handleRemoveActive() {
  2002. this.isCoverImgDiv = false;
  2003. },
  2004. getBase64(img, callback) {
  2005. const reader = new FileReader();
  2006. reader.addEventListener('load', () => callback(reader.result));
  2007. reader.readAsDataURL(img);
  2008. },
  2009. beforeUpload(info) {
  2010. const isZip = info.type.includes('png') || info.type.includes('jpeg');
  2011. const fileOvesize = info.size > (1024 * 1024);
  2012. if (!isZip) {
  2013. this.$message.error('请上传正确类型的图片');
  2014. this.imageUrl = '';
  2015. this.urlResult = '';
  2016. this.md5Result = '';
  2017. return;
  2018. }
  2019. if (fileOvesize) {
  2020. this.$message.error('图片大小不能超过1M');
  2021. this.imageUrl = '';
  2022. this.urlResult = '';
  2023. this.md5Result = '';
  2024. return;
  2025. }
  2026. new Promise(function (resolve, reject) {
  2027. let width = 108;
  2028. let height = 108;
  2029. let _URL = window.URL || window.webkitURL;
  2030. let img = new Image();
  2031. img.onload = function () {
  2032. let valid = img.width === width && img.height === height;
  2033. valid ? resolve() : reject();
  2034. };
  2035. img.src = _URL.createObjectURL(info);
  2036. }).then(() => {
  2037. this.handleMd5(info);
  2038. this.getBase64(info, imageUrl => {
  2039. this.imageUrl = imageUrl;
  2040. });
  2041. }, () => {
  2042. this.$message.error('图片尺寸必须是108*108!');
  2043. this.imageUrl = '';
  2044. this.urlResult = '';
  2045. this.md5Result = '';
  2046. return Promise.reject();
  2047. });
  2048. },
  2049. cosUpload(file) {
  2050. let that = this;
  2051. let date = new Date();
  2052. let y = date.getFullYear();
  2053. let MM = date.getMonth() + 1;
  2054. MM = MM < 10 ? '0' + MM : MM;
  2055. let d = date.getDate();
  2056. d = d < 10 ? '0' + d : d;
  2057. let timeElse = new Date().getTime();
  2058. let arr = file.name.split('.');
  2059. let str = '';
  2060. for (let i = 0; i < arr.length; i++) {
  2061. if (i === arr.length - 1) {
  2062. }
  2063. else {
  2064. if (i === arr.length - 2) {
  2065. str += arr[i];
  2066. }
  2067. else {
  2068. str += arr[i] + '.';
  2069. }
  2070. }
  2071. }
  2072. cos.putObject(
  2073. {
  2074. Bucket: 'media-1301855440',
  2075. Region: 'ap-chongqing',
  2076. // 存储桶所在地域,必须字段
  2077. Key: that.uploadType + '/' + y + '-' + MM + '-' + d + '/' + str + '-' + timeElse + '.' + arr[arr.length - 1],
  2078. StorageClass: 'STANDARD',
  2079. Body: file // 上传文件对象
  2080. },
  2081. function (err, data) {
  2082. if (err) {
  2083. that.$message.error('上传失败!!!' + err);
  2084. return;
  2085. }
  2086. that.loadingElse = false;
  2087. that.fileList.push({
  2088. uid: file.name,
  2089. name: file.name,
  2090. status: 'done',
  2091. url: '//' + data.Location
  2092. });
  2093. that.urlResult = '//' + data.Location;
  2094. }
  2095. );
  2096. },
  2097. handleMd5(file) {
  2098. let bmf = new BMF();
  2099. let that = this;
  2100. return new Promise(function (resolve, reject) {
  2101. bmf.md5(file, (err, md5) => {
  2102. that.md5Result = md5;
  2103. getAction('/file/imageCheck', {code: md5}).then(result => {
  2104. if (result.code === -206) {
  2105. that.cosUpload(file);
  2106. resolve();
  2107. }
  2108. else {
  2109. that.urlResult = result.url;
  2110. // reject();
  2111. }
  2112. }).catch(error => {
  2113. console.log(error, 'eeee');
  2114. reject();
  2115. });
  2116. });
  2117. });
  2118. },
  2119. handleRelaxSure() {
  2120. let paramsFormData = this.configForm;
  2121. if (this.adBudgetShowTitle) {
  2122. return;
  2123. }
  2124. if (this.configForm.adDistrict === 'CITY') {
  2125. if (!this.configForm.adSelectCity.length) {
  2126. this.$message.error('请选择省市');
  2127. return;
  2128. }
  2129. }
  2130. if (this.selectPackageTabs === '2' && !this.configForm.adAudiencePackageId) {
  2131. this.$message.error('请选择已有定向包');
  2132. return;
  2133. }
  2134. if (paramsFormData.customPerson === 'a') {
  2135. if (paramsFormData.adRetargetingTagsType === '1' && !paramsFormData.adRetargetingTagsInclude) {
  2136. this.$message.error('请选择人群');
  2137. return;
  2138. }
  2139. else if (paramsFormData.adRetargetingTagsType === '2' && !paramsFormData.adRetargetingTagsExclude) {
  2140. this.$message.error('请选择人群');
  2141. return;
  2142. }
  2143. else if (paramsFormData.adRetargetingTagsType === '3' && (!paramsFormData.adRetargetingTagsExclude || !paramsFormData.adRetargetingTagsInclude)) {
  2144. this.$message.error('请选择人群');
  2145. return;
  2146. }
  2147. }
  2148. if (this.configForm.adScheduleType === 'SCHEDULE_START_END' && !this.configForm.launchDateRange.length) {
  2149. this.$message.error('请选择投放时间');
  2150. return;
  2151. }
  2152. if (this.configForm.launchTimeInterval === 'a' && this.configForm.scheduleTimeData === str) {
  2153. this.$message.error('请选择投放时段');
  2154. return;
  2155. }
  2156. if (!this.urlResult) {
  2157. this.$message.error('请上传图片');
  2158. return;
  2159. }
  2160. if (!this.configForm.defaultFormList.length) {
  2161. this.$message.error('请添加卖点');
  2162. return;
  2163. }
  2164. if (!this.creativeTag.length) {
  2165. this.$message.error('请添加标签');
  2166. return;
  2167. }
  2168. if (this.campaignStatus) {
  2169. return;
  2170. }
  2171. if (this.configForm.adBudget < this.configForm.adCpaBid) {
  2172. this.isAdCpaBidBlur = true;
  2173. this.adCpaBidBlurTxt = '出价不能大于预算';
  2174. return;
  2175. }
  2176. else {
  2177. this.isAdCpaBidBlur = false;
  2178. }
  2179. if (paramsFormData.adverPosition === 'a') {
  2180. paramsFormData.creativeSmartInventory = 1;
  2181. }
  2182. else if (paramsFormData.adverPosition === 'b') {
  2183. paramsFormData.creativeInventoryTypes = paramsFormData.checkboxChangeValue;
  2184. }
  2185. else if (paramsFormData.adverPosition === 'c') {
  2186. paramsFormData.creativeSceneInventory = paramsFormData.radioChangeValue;
  2187. }
  2188. if (paramsFormData.launchTimeInterval === 'buxian') {
  2189. paramsFormData.adScheduleTime = '';
  2190. }
  2191. else if (paramsFormData.launchTimeInterval === 'a') {
  2192. paramsFormData.adScheduleTime = paramsFormData.scheduleTimeData;
  2193. }
  2194. if (paramsFormData.adScheduleType === 'SCHEDULE_START_END') {
  2195. paramsFormData.adStartTime = paramsFormData.launchDateRange[0];
  2196. paramsFormData.adEndTime = paramsFormData.launchDateRange[1];
  2197. }
  2198. else if (paramsFormData.adScheduleType === 'SCHEDULE_FROM_NOW') {
  2199. paramsFormData.adStartTime = '';
  2200. paramsFormData.adEndTime = '';
  2201. }
  2202. if (paramsFormData.launchTimeInterval === 'buxian') {
  2203. paramsFormData.adScheduleTime = str;
  2204. }
  2205. else if (paramsFormData.launchTimeInterval === 'a') {
  2206. paramsFormData.adScheduleTime = paramsFormData.scheduleTimeData;
  2207. }
  2208. if (paramsFormData.adAndroidVersion === 'a') {
  2209. paramsFormData.adAndroidOsv = paramsFormData.androidChangeValue;
  2210. }
  2211. else {
  2212. paramsFormData.adAndroidOsv = 'NONE';
  2213. }
  2214. paramsFormData.adCity = paramsFormData.adSelectCity.join(',');
  2215. paramsFormData.adAge = paramsFormData.adSelectAge.join(',');
  2216. paramsFormData.adAc = paramsFormData.adSelectAc.join(',');
  2217. paramsFormData.adDeviceType = paramsFormData.adDeviceSelectType.join(',');
  2218. paramsFormData.productSellingPoints = this.configForm.defaultFormList && this.configForm.defaultFormList.map(item => item.value);
  2219. paramsFormData.creativeThirdIndustryId = paramsFormData.creativeThirdIndustryIds[2];
  2220. paramsFormData.creativeProductImageCode = this.md5Result;
  2221. paramsFormData.imageUrl = this.urlResult;
  2222. paramsFormData.adKeywords = this.creativeTag;
  2223. paramsFormData.userId = this.userInfo().id;
  2224. this.$refs.ruleForm.validate(valid => {
  2225. if (valid) {
  2226. if (this.modalTitle === 'add') {
  2227. this.handleAddList(paramsFormData);
  2228. }
  2229. else if (this.modalTitle === 'edit') {
  2230. this.handleEditList(paramsFormData);
  2231. }
  2232. }
  2233. else {
  2234. console.log('error submit!!');
  2235. return false;
  2236. }
  2237. });
  2238. },
  2239. handleEditList(data) {
  2240. const queryData = data;
  2241. const routeQuery = JSON.parse(localStorage.getItem('queryList'));
  2242. queryData.id = routeQuery.id;
  2243. putAction(urlAcount + '/bytedance-api/advertiser/aiBytedanceAdvertiserStrategy/edit', queryData).then(result => {
  2244. if (result.code === 0) {
  2245. this.$message.success(result.message);
  2246. this.$router.replace('/account-config/account-config');
  2247. this.$bus.$emit('remove', '/account-config/components/configuration-modal');
  2248. }
  2249. else {
  2250. this.$message.error(result.message);
  2251. }
  2252. }).catch(error => {
  2253. console.log(error, 'eeee');
  2254. });
  2255. },
  2256. handleRelaxCancel() {
  2257. this.$router.replace('/account-config/account-config');
  2258. this.$bus.$emit('remove', '/account-config/components/configuration-modal');
  2259. },
  2260. handleEnterChang(value) {
  2261. this.creativeTag.push(...value);
  2262. this.creativeTag = [...new Set(this.creativeTag)];
  2263. for (let i = 0; i < this.creativeTag.length; i++) {
  2264. if (this.creativeTag[i].length > 10) {
  2265. this.creativeTag.splice(i, 1);
  2266. this.$message.error('创意标签最多只能十个字符,超过的已清除');
  2267. }
  2268. }
  2269. this.configForm.creativeLabel = [];
  2270. },
  2271. handleTagsClose(removedTag) {
  2272. const tags = this.creativeTag.filter(tag => tag !== removedTag);
  2273. this.creativeTag = tags;
  2274. }
  2275. }
  2276. };
  2277. </script>
  2278. <style lang="less">
  2279. @import "configuration-modal";
  2280. .display-none-selset {
  2281. display: none !important;
  2282. }
  2283. </style>