setProjectBudget.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <template>
  2. <div class="newPlan">
  3. <div class="moduler">
  4. <div v-if="projectInfo.length>0">
  5. <span style="margin-right:8px"> 项目:<strong>{{projectInfo[0].name||''}}</strong></span>
  6. <span style="margin-right:8px"> 推广目的:<strong>{{projectInfo[0].landingType=='APP'?'应用推广':'销售线索收集'||''}}</strong></span>
  7. <span style="margin-right:8px"> 投放媒体:<strong>{{projectInfo[0].deliveryRange=="DEFAULT"?'默认':'穿山甲'||''}}</strong></span>
  8. <span style="margin-right:8px"> 投放方式:
  9. <strong v-if="projectInfo[0].adTarget=='CPA'">优先成本</strong>
  10. <strong v-if="projectInfo[0].adTarget=='COST'">优先跑量</strong>
  11. <strong v-if="projectInfo[0].adTarget=='PUSH'">激进抢量</strong>
  12. </span>
  13. </div>
  14. </div>
  15. <div class="moduler">
  16. <a-form :form="form">
  17. <div class="moduler-title">预算与出价</div>
  18. <div class="ad-range">
  19. <div class="row-item" >
  20. <div class="hint-item"></div>
  21. <div class="label-item">
  22. <div class="text-item">投放时间</div>
  23. <!-- <div class="required-item"></div> -->
  24. </div>
  25. <div class="input-item">
  26. <a-form-item>
  27. <a-radio-group v-decorator="['scheduleType', { initialValue:'SCHEDULE_FROM_NOW' }]">
  28. <a-radio-button value="SCHEDULE_FROM_NOW">从今天起长期投放</a-radio-button>
  29. <a-radio-button value="SCHEDULE_START_END">设置开始和结束时间</a-radio-button>
  30. </a-radio-group>
  31. <p style="margin-top:15px">
  32. <a-range-picker
  33. @change="dateChange"
  34. v-model="dateRange"
  35. v-if="getFormData('scheduleType')=='SCHEDULE_START_END'"
  36. />
  37. </p>
  38. </a-form-item>
  39. </div>
  40. </div>
  41. <div class="row-item">
  42. <div class="hint-item"></div>
  43. <div class="label-item">
  44. <div class="text-item">投放时段</div>
  45. <!-- <div class="required-item"></div> -->
  46. </div>
  47. <div class="input-item">
  48. <a-form-item>
  49. <a-radio-group v-decorator="['scheduleTime', { initialValue:'' }]">
  50. <a-radio-button value=''>不限</a-radio-button>
  51. <a-radio-button value="SpecifiedTImePeriod">指定时间段</a-radio-button>
  52. </a-radio-group>
  53. <div
  54. v-show="getFormData('scheduleTime')=='SpecifiedTImePeriod'"
  55. style="margin-top:15px"
  56. >
  57. <selectCheckAll
  58. style="width:100%"
  59. :scheduleTime.sync="scheduleTimeData"
  60. ref="selectCheck"
  61. />
  62. </div>
  63. </a-form-item>
  64. </div>
  65. </div>
  66. <div class="row-item">
  67. <div class="hint-item">
  68. <a-tooltip>
  69. <template slot="title">
  70. <span>单次预算修改幅度不小于100元,日修改预算不超过20次。如果是总预算广告,且设了起始日期,将要求您预算设置需要大于或等于[投放天数 * 100],即满足每日最低预算300的要求</span>
  71. </template>
  72. <a-icon type="question-circle" />
  73. </a-tooltip>
  74. </div>
  75. <div class="label-item">
  76. <div class="text-item">预算</div>
  77. <div class="required-item"></div>
  78. </div>
  79. <div class="input-item">
  80. <a-form-item>
  81. <a-input-group compact>
  82. <a-select :disabled="true" v-decorator="['budgetMode', { initialValue:'BUDGET_MODE_DAY' }]">
  83. <a-select-option value="BUDGET_MODE_DAY" >日预算</a-select-option>
  84. <!-- <a-select-option
  85. value="BUDGET_MODE_TOTAL"
  86. v-if="getFormData('smartBidType')=='SMART_BID_CUSTOM'"
  87. >总预算</a-select-option> -->
  88. </a-select>
  89. <a-input style="width: 25%" v-decorator="['budget', { initialValue:300 }]" />
  90. </a-input-group>
  91. <span class="tip" v-if="getFormData('budget')<300">请输入预算,不少于300元,不超过9999999.99元</span>
  92. </a-form-item>
  93. </div>
  94. </div>
  95. <div class="row-item" >
  96. <div class="hint-item"></div>
  97. <div class="label-item">
  98. <div class="text-item">付费方式</div>
  99. <div class="required-item"></div>
  100. </div>
  101. <div class="input-item">
  102. <a-form-item>
  103. <a-radio-group v-decorator="['pricing', { initialValue:'PRICING_OCPM' }]">
  104. <a-radio-button value="PRICING_OCPM" >按展示付费(oCPM)</a-radio-button>
  105. <!-- <a-radio-button value="PRICING_CPC" >按点击付费(CPC)</a-radio-button>
  106. <a-radio-button value="PRICING_CPM" >按展示付费(CPM)</a-radio-button>
  107. <a-radio-button value="PRICING_CPA">按转化付费(CPA)</a-radio-button>
  108. <a-radio-button value="PRICING_OCPC">按点击付费(oCPC)</a-radio-button> -->
  109. </a-radio-group>
  110. </a-form-item>
  111. </div>
  112. </div>
  113. <div class="row-item" >
  114. <div class="hint-item">
  115. <a-tooltip>
  116. <template slot="title">
  117. <span>请填入您当前预算下,每个转化事件的真实预期成本,预期成本过低可能影响模型的优化能力。此成本仅作为投放参考,实际扣费仍以后台展示为准。</span>
  118. </template>
  119. <a-icon type="question-circle" />
  120. </a-tooltip>
  121. </div>
  122. <div class="label-item">
  123. <div class="text-item">预期成本</div>
  124. <div class="required-item"></div>
  125. </div>
  126. <div class="input-item">
  127. <a-form-item>
  128. <a-input-number
  129. style="width:200px"
  130. :max="1500"
  131. :step="0.1"
  132. v-decorator="['bid', {rules:validationRules.bid} ]"
  133. />
  134. <span style="margin-left:5px">元</span>
  135. <!-- <span style="margin-left:20px">请填入必填字段,获取建议出价</span> -->
  136. </a-form-item>
  137. <span
  138. class="tip"
  139. v-if="getFormData('bid')<0.1"
  140. >请输入预期成本,不少于0.1元,不超过10000元</span>
  141. </div>
  142. </div>
  143. <div class="row-item" >
  144. <div class="hint-item"> </div>
  145. <div class="label-item">
  146. <div class="text-item">深度优化方式</div>
  147. <div class="required-item"></div>
  148. </div>
  149. <div class="input-item">
  150. <a-form-item>
  151. <a-radio-group
  152. v-decorator="['deepBidType', { initialValue:'DEEP_BID_MIN' }]"
  153. >
  154. <a-radio-button value="DEEP_BID_MIN" >自定义双出价</a-radio-button>
  155. </a-radio-group>
  156. </a-form-item>
  157. </div>
  158. </div>
  159. <div class="row-item" >
  160. <div class="hint-item"> </div>
  161. <div class="label-item">
  162. <div class="text-item">深度转化出价</div>
  163. <div class="required-item"></div>
  164. </div>
  165. <div class="input-item">
  166. <a-form-item>
  167. <a-input-number
  168. style="width:200px"
  169. :max="10000"
  170. :step="0.1"
  171. :min='0.1'
  172. v-decorator="['deepBid', {rules:validationRules.bid} ]"
  173. />
  174. <span style="margin-left:5px">元</span>
  175. </a-form-item>
  176. <span
  177. class="tip"
  178. v-if="getFormData('pricing')!='PRICING_CPA'&&getFormData('deepCpabid')<0.1"
  179. >请输入深度转化出价,不少于0.1元,不超过10000元</span>
  180. </div>
  181. </div>
  182. <div class="row-item">
  183. <div class="hint-item"></div>
  184. <div class="label-item">
  185. <div class="text-item">超成本自动暂停</div>
  186. <div class="required-item"></div>
  187. </div>
  188. <div class="input-item">
  189. <a-form-item>
  190. <a-radio-group v-decorator="['autoStop', { initialValue:0 }]">
  191. <a-radio-button :value="1">开启</a-radio-button>
  192. <a-radio-button :value="0">关闭</a-radio-button>
  193. </a-radio-group>
  194. </a-form-item>
  195. </div>
  196. </div>
  197. </div>
  198. </a-form>
  199. </div>
  200. <!-- 当前账户 -->
  201. <div class="moduler">
  202. <div class="adName">
  203. <span>当前账户:</span>
  204. <div class="nameList">
  205. <strong v-for="item in LHKaccountInfo" :key="item.value" class="item">{{item.title+'('+item.value+')'}}</strong>
  206. </div>
  207. </div>
  208. </div>
  209. <!-- 操作 -->
  210. <div class="moduler">
  211. <!-- <div class="moduler-title">计划名称</div> -->
  212. <div class="opt">
  213. <a-button type="default" style="margin-right:15px" @click="goBack">取消</a-button>
  214. <a-button type="primary" @click="goNext" :loading="goNextloading">下一步</a-button>
  215. </div>
  216. </div>
  217. <!-- 投放链接 -->
  218. <div class="infoModal">
  219. <a-modal v-model="visible" title="提示" @ok="handleOk" :keyboard='false' :maskClosable='false'>
  220. <ul>
  221. <li v-for="(item,index) in errorInfo" :key="index">
  222. <span>账户{{LHKaccountInfo[index].title}}:</span>{{item.message || '设置转化信息成功'}}
  223. </li>
  224. </ul>
  225. <template slot="footer">
  226. <a-button key="back" @click="handleCancel">
  227. 返回本页
  228. </a-button>
  229. <a-button key="submit" type="primary" @click="handleOk">
  230. 下一步
  231. </a-button>
  232. </template>
  233. </a-modal>
  234. </div>
  235. </div>
  236. </template>
  237. <script>
  238. import moment from 'moment'
  239. import { getAction, postAction, downFile, downFilePost } from '@/api/manage'
  240. import selectCheckAll from '../BatchCreate/toutiaoTime'
  241. import qs from 'qs'
  242. var str = ""
  243. for (let i = 0; i < 7*48; i++) {
  244. str+='0'
  245. }
  246. export default {
  247. components: {
  248. selectCheckAll,
  249. // newDirectedPackage,
  250. },
  251. data() {
  252. return {
  253. projectInfo:[],
  254. LHKaccountInfo:[],
  255. form: this.$form.createForm(this),
  256. showIndex:0,
  257. goNextloading:false,
  258. goPlanShowloading:false,
  259. dateRange: [moment(), moment()],
  260. scheduleTime: '',
  261. scheduleTimeData:str,
  262. visible:false,
  263. errorInfo:[],
  264. validationRules: {
  265. url: [
  266. {
  267. required: true,
  268. validator: this.validateURL,
  269. },
  270. ],
  271. name:[{
  272. required: true,
  273. validator: this.validateName,
  274. }],
  275. bid:[{
  276. required: true,
  277. message:'出价信息必须填写',
  278. // validator: this.validateBid,
  279. }],
  280. roi:[{
  281. required: true,
  282. message:'ROI系数必须填写',
  283. // validator: this.validateBid,
  284. }],
  285. },
  286. currentConvertTypes:[],
  287. convertIds:[],
  288. }
  289. },
  290. watch: {
  291. },
  292. methods: {
  293. callback(val) {
  294. console.log(val);
  295. },
  296. handleOk(e) {
  297. this.visible=false;
  298. // this.$router.push('/LaunchHousekeeper/setProjectDirectional')
  299. this.$router.push({path:'/LaunchHousekeeper/setProjectDirectional'})
  300. this.$bus.$emit('remove', '/LaunchHousekeeper/setProjectConvert')
  301. },
  302. handleCancel(e) {
  303. this.visible = false;
  304. },
  305. //获取表单的某一个属性值
  306. getFormData(className) {
  307. return this.form.getFieldValue(className)
  308. },
  309. dateChange(date, dateString) {
  310. // console.log(date,dateString)
  311. this.form.getFieldDecorator('startTime')
  312. this.form.getFieldDecorator('endTime')
  313. this.form.setFieldsValue({
  314. startTime: date[0].format('YYYY-MM-DD HH:mm'),
  315. endTime: date[1].format('YYYY-MM-DD HH:mm'),
  316. })
  317. },
  318. // 验证网址
  319. IsURL(res) {
  320. // var strRegex = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/
  321. var strRegex = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+(.+[A-Za-z0-9-~\/])+$/
  322. var re = new RegExp(strRegex)
  323. // console.log(re.test(res))
  324. if (re.test(res)) {
  325. return true
  326. } else {
  327. return false
  328. }
  329. },
  330. validateURL(rule, value, callback) {
  331. // console.log(rule, value, callback);
  332. if (this.IsURL(value)) {
  333. callback()
  334. } else if (value && !this.IsURL(value)) {
  335. callback('链接地址无法访问,请正确输入')
  336. } else {
  337. callback('链接必须填写')
  338. }
  339. },
  340. validateName(rule, value, callback){
  341. // console.log(rule, value, callback);
  342. if (value) {
  343. callback()
  344. } else {
  345. callback('应用包名称必须填写')
  346. }
  347. },
  348. validateBid(rule, value, callback){
  349. // console.log(rule, value, callback);
  350. if (value) {
  351. callback()
  352. } else {
  353. callback('出价必须填写')
  354. }
  355. },
  356. goBack() {
  357. this.$router.replace('/modules/LaunchHousekeeper/LaunchHousekeeperList')
  358. this.$bus.$emit('remove', '/LaunchHousekeeper/setProjectConvert')
  359. },
  360. // 保存并新建创意
  361. goNext() {
  362. this.$nextTick(()=>{
  363. this.form.validateFields((err, values) => {
  364. if (!err) {
  365. console.log('Received values of form: ', values)
  366. this.goNextloading=true;
  367. if(this.getFormData('scheduleTime')!=''){
  368. values.weekTime=this.scheduleTimeData
  369. }
  370. values.startTime=this.dateRange[0].format('YYYY-MM-DD HH:mm');
  371. values.endTime= this.dateRange[1].format('YYYY-MM-DD HH:mm');
  372. let params=[];
  373. params=this.projectInfo.map((item,index)=>{
  374. return {
  375. ...item,
  376. ...values,
  377. }
  378. })
  379. console.log(values)
  380. postAction('/adlab/Project/setBudget', params).then((res) => {
  381. console.log(res)
  382. if (res.success) {
  383. this.goNextloading=false;
  384. if(res.result){
  385. // this.errorInfo=res.result;
  386. // this.visible=true;
  387. // let projectInfo=[]
  388. // res.result.forEach(item=>{
  389. // if(item.code==0){
  390. // projectInfo.push(item)
  391. // }
  392. // })
  393. // sessionStorage.setItem('projectInfo',JSON.stringify(projectInfo))
  394. }
  395. } else {
  396. this.goNextloading=false;
  397. this.$message.error(res.message)
  398. }
  399. })
  400. }else{
  401. this.$message.error('请正确填写必填项目')
  402. }
  403. })
  404. })
  405. },
  406. EchoPageInfo(){
  407. },
  408. },
  409. mounted() {
  410. this.$bus.$emit('remove', '/LaunchHousekeeper/setProjectCreate')
  411. let projectInfo=sessionStorage.getItem('projectInfo');
  412. if(projectInfo){
  413. this.projectInfo=JSON.parse(projectInfo)
  414. }
  415. let LHKaccountInfo=sessionStorage.getItem('LHKaccountInfo');
  416. if(LHKaccountInfo){
  417. this.LHKaccountInfo=JSON.parse(LHKaccountInfo)
  418. }
  419. let editLHKProjectInfo=sessionStorage.getItem('editLHKProjectInfo');
  420. if(editLHKProjectInfo){
  421. this.LHKaccountInfo.push(editLHKProjectInfo);
  422. }
  423. },
  424. }
  425. </script>
  426. <style lang="scss">
  427. .newPlan{
  428. .ant-btn-danger {
  429. background-color: #ff4d4f !important;
  430. }
  431. }
  432. .ant-tooltip-inner,
  433. .ant-tooltip,
  434. .ant-tooltip-arrow::before {
  435. background-color: #fff;
  436. color: #333;
  437. }
  438. .ant-tooltip-inner {
  439. span {
  440. display: block;
  441. }
  442. }
  443. .ant-tooltip {
  444. max-width: 450px;
  445. }
  446. .newPlan {
  447. .ant-radio-button-wrapper {
  448. min-width: 80px;
  449. text-align: center;
  450. }
  451. .ant-form-item {
  452. -webkit-box-sizing: border-box;
  453. box-sizing: border-box;
  454. margin: 0;
  455. padding: 0;
  456. color: rgba(0, 0, 0, 0.65);
  457. font-size: 14px;
  458. font-variant: tabular-nums;
  459. line-height: 1.5;
  460. list-style: none;
  461. -webkit-font-feature-settings: 'tnum';
  462. font-feature-settings: 'tnum';
  463. vertical-align: top;
  464. }
  465. .directedBody {
  466. .ant-form-item {
  467. margin-bottom: 20px;
  468. }
  469. }
  470. }
  471. </style>
  472. <style lang="scss" scoped>
  473. .newPlan {
  474. font-family: PingFangSC-Regular, tahoma, arial, 'Hiragino Sans GB', 'Microsoft yahei', sans-serif;
  475. color: #333;
  476. ul,
  477. li {
  478. margin: 0;
  479. padding: 0;
  480. }
  481. .moduler {
  482. background: #fff;
  483. margin-bottom: 16px;
  484. position: relative;
  485. padding: 32px 24px 48px 32px;
  486. border-radius: 4px;
  487. box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.05);
  488. .moduler-title {
  489. display: flex;
  490. align-items: center;
  491. font-size: 22px;
  492. margin-bottom: 20px;
  493. }
  494. .row-item {
  495. display: flex;
  496. justify-content: flex-start;
  497. align-items: center;
  498. margin-bottom: 32px;
  499. }
  500. .row-item:last-of-type {
  501. margin-bottom: 0;
  502. }
  503. .row-item .hint-item {
  504. width: 24px;
  505. min-width: 24px;
  506. align-self: flex-start;
  507. line-height: 20px;
  508. height: 20px;
  509. margin-top: 5px;
  510. }
  511. .row-item .label-item {
  512. position: relative;
  513. align-items: flex-start;
  514. align-self: flex-start;
  515. line-height: 20px;
  516. height: 20px;
  517. margin-top: 7px;
  518. width: 80px;
  519. min-width: 80px;
  520. .text-item {
  521. font-size: 14px;
  522. width: 60px;
  523. }
  524. }
  525. .row-item .required-item {
  526. width: 4px;
  527. height: 4px;
  528. border-radius: 2px;
  529. background: #f45858;
  530. position: absolute;
  531. right: 10px;
  532. top: 50%;
  533. transform: translateY(-50%);
  534. }
  535. .row-item .input-item {
  536. min-width: 480px;
  537. position: relative;
  538. // height: 35px;
  539. .tip {
  540. font-size: 12px;
  541. color: tomato;
  542. }
  543. }
  544. .adName{
  545. display: flex;
  546. .nameList{
  547. width: 90%;
  548. }
  549. .item{
  550. display: inline-block;
  551. width: 30%;
  552. margin-left: 15px;
  553. margin-bottom: 10px;
  554. }
  555. }
  556. }
  557. .opt {
  558. text-align: right;
  559. }
  560. }
  561. </style>