-
Notifications
You must be signed in to change notification settings - Fork 0
/
Detail.vue
898 lines (835 loc) · 32.4 KB
/
Detail.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
<template>
<div>
<div ref="offerDetailWraper" id="offerDetailWraper">
<div id="breadcrumb_container">
<ul class="breadcrumb">
<li><router-link to="./">Home</router-link></li>
<li><router-link to="./p_offers">Offers</router-link></li>
<li>Offer Management</li>
</ul>
</div>
<div class="toTop hide-normal" id="toTop"><a href="#" title=""><i class="fa fa-angle-up" aria-hidden="true"></i></a>
</div>
<alert-pop :alertPop="alertPop" :hideAlertPop="hideAlertPop" :alertMsg="alertMsg" :alertType="alertType"></alert-pop>
<nav id="myScrollspy" class="navbar navbar-default" :style="!visible ? {top:0}: ''">
<ul class="nav navbar-nav pull-left">
<li :class="{active:activeMenu == 'submodule_offer'}" @click="scrollTo('submodule_offer')">Offer</li>
<li :class="{active:activeMenu == 'submodule_kpi_setting'}" @click="scrollTo('submodule_kpi_setting')" v-if="renderOffer">KPI Setting</li>
<li :class="{active:activeMenu == 'submodule_payment'}" @click="scrollTo('submodule_payment')">Payment</li>
<li :class="{active:activeMenu == 'submodule_basic'}" @click="scrollTo('submodule_basic')">Basic</li>
<li :class="{active:activeMenu == 'submodule_landing_page'}" @click="scrollTo('submodule_landing_page')" v-if="renderOffer && offerInfo && offerInfo.unique_key && offerInfo.unique_key.unique_key && offerInfo.advertiser_id">Landing Page</li>
<li :class="{active:activeMenu == 'submodule_aff_access'}" @click="scrollTo('submodule_aff_access')">Affiliate Access</li>
<li :class="{active:activeMenu == 'submodule_app_access'}" @click="scrollTo('submodule_app_access')">App Access</li>
<li :class="{active:activeMenu == 'submodule_blend_traffic'}" @click="scrollTo('submodule_blend_traffic')" v-if="userInfo.is_allow_blend_ops && renderOffer">Blend Traffic</li>
<li :class="{active:activeMenu == 'submodule_tracking'}" @click="scrollTo('submodule_tracking')">Tracking</li>
<li :class="{active:activeMenu == 'submodule_targeting'}" @click="scrollTo('submodule_targeting')">Targeting</li>
<li :class="{active:activeMenu == 'submodule_creativeCertificate'}" @click="scrollTo('submodule_creativeCertificate')">Certificate</li>
<li :class="{active:activeMenu == 'submodule_creativeFiles'}" @click="scrollTo('submodule_creativeFiles')">Creative Files</li>
</ul>
</nav>
<div id="scroll">
<div v-scrollWatch="{name:'submodule_offer',offset:0,callback:spyDomChange}" id="submodule_offer">
<submodule_offer
:renderOffer="submodule_offer"
:sourceAdv="sourceAdv"
:offerInfo="offerInfo"
:showAlert="showAlert"
:setOfferEditAuth="setOfferEditAuth"
:updateOfferInfo="updateOfferInfo"
></submodule_offer>
</div>
<div v-scrollWatch="{name:'submodule_kpi_setting',offset:0,callback:spyDomChange}" id="submodule_kpi_setting">
<submodule_kpi_setting
v-if="renderOffer"
:renderOffer="renderOffer"
:offerInfo="offerInfo"
:ocpaData="ocpaData"
:showAlert="showAlert"
:setOfferEditAuth="setOfferEditAuth"
:offerKpiSettingEvents = "offerKpiSettingData.events">
</submodule_kpi_setting>
</div>
<div v-scrollWatch="{name:'submodule_payment',offset:0,callback:spyDomChange}" id="submodule_payment">
<submodule_payment
:updateOfferInfo="updateOfferInfo"
:renderOffer="submodule_payment"
:activeUser="activeUsers"
:appAccessInfo="appAccessInfo"
:offerInfo="offerInfo"
:showAlert="showAlert"
:affAccessInfo="affAccessInfo"
:payoutAndCapsInfo="publisherPayoutAndCapsInfo"
:appPayoutInfo="publisherAppPayoutAndCapsInfo"
:GBP_CURRENCY="GBP_CURRENCY"
:EUR_CURRENCY="EUR_CURRENCY"
:getPayoutAndCapsByOfferId="getPayoutAndCapsByOfferId"
:userInfo="userInfo"
:getAppPayoutAndCaps="getAppPayoutAndCaps"
:setOfferEditAuth="setOfferEditAuth"
:editCancel="editCancel"
></submodule_payment>
</div>
<div v-scrollWatch="{name:'submodule_basic',offset:0,callback:spyDomChange}" id="submodule_basic">
<submodule_basic
:updateOfferInfo="updateOfferInfo"
:renderOffer="submodule_basic"
:ocpaData="ocpaData"
:userInfo="userInfo"
:activeUser="activeUsers"
:sourceCat="sourceCat"
:offerInfo="offerInfo"
:showAlert="showAlert"
:currentTrackLink="currentTrackLink"
:sourceTraffics="sourceTraffics"
:sourceConversionFlow="sourceConversionFlow"
:offerExpirationAction="offerExpirationAction"
:setOfferEditAuth="setOfferEditAuth"
:integratedSource = "offerKpiSettingData.source"
:isIntegrated = "offerKpiSettingData.is_integrated"
:fetchOcpaInfo = 'fetchOcpaInfo'
:editCancel="editCancel"
></submodule_basic>
</div>
<div v-scrollWatch="{name:'submodule_landing_page',offset:0,callback:spyDomChange}" id="submodule_landing_page">
<submodule_landing_page
v-if="renderOffer && offerInfo.unique_key && offerInfo.unique_key.unique_key && offerInfo.advertiser_id"
:renderOffer="renderOffer"
:showAlert="showAlert"
:offerInfo="offerInfo"
:setOfferEditAuth="setOfferEditAuth"
></submodule_landing_page>
</div>
<div v-scrollWatch="{name:'submodule_aff_access',offset:0,callback:spyDomChange}" id="submodule_aff_access">
<submodule_aff_access
:refresh_aff_access="refresh_aff_access"
:renderOffer="renderOffer"
:showAlert="showAlert"
:offerInfo="offerInfo"
:setOfferEditAuth="setOfferEditAuth"
></submodule_aff_access>
</div>
<div v-scrollWatch="{name:'submodule_app_access',offset:0,callback:spyDomChange}" id="submodule_app_access">
<submodule_app_access
:onAppAccessChanged="onAppAccessChanged"
:refresh_app_access="refresh_app_access"
:renderOffer="renderOffer"
:affAccessInfo="activeUsers"
:showAlert="showAlert"
:setOfferEditAuth="setOfferEditAuth"
></submodule_app_access>
</div>
<div v-scrollWatch="{name:'submodule_blend_traffic',offset:0,callback:spyDomChange}" id="submodule_blend_traffic">
<submodule_blend_traffic
v-show="userInfo.is_allow_blend_ops && renderOffer"
:offerInfo="offerInfo"
:showAlert="showAlert"
:renderOffer="renderOffer"
:affAccessInfo="affAccessInfo"
:appAccessInfo="appAccessInfo"
:ocpaData="ocpaData"
:setOfferEditAuth="setOfferEditAuth"
:offerKpiSettingEvents = "offerKpiSettingData.events"
></submodule_blend_traffic>
</div>
<div v-scrollWatch="{name:'submodule_tracking',offset:0,callback:spyDomChange}" id="submodule_tracking">
<submodule_tracking
:renderOffer="renderOffer"
:offerInfo="offerInfo"
:affAccessInfo="affAccessInfo"
:sourceAdv="sourceAdv"
:showAlert="showAlert"
:setOfferEditAuth="setOfferEditAuth"
:updateOfferInfo="updateOfferInfo"
></submodule_tracking>
</div>
<div v-scrollWatch="{name:'submodule_targeting',offset:0,callback:spyDomChange}" id="submodule_targeting">
<submodule_targeting
:renderOffer="submodule_targeting"
:parseCombinedModel="parseCombinedModel"
:sourcePlatform="sourcePlatform"
:sourceDeviceOS="sourceDeviceOS"
:sourceStates="sourceStates"
:sourceDeviceModels="sourceDeviceModels"
:deviceModels="deviceModels"
:offerInfo="offerInfo"
:showAlert="showAlert"
:userInfo="userInfo"
:geoTargeting="geoTargeting"
:platformTargeting="platformTargeting"
:Carriers="Carriers"
:setOfferEditAuth="setOfferEditAuth"
></submodule_targeting>
</div>
<div v-scrollWatch="{name:'submodule_creativeCertificate',offset:0,callback:spyDomChange}" id="submodule_creativeCertificate">
<submodule_creativeCertificate
:showAlert="showAlert"
:renderOffer="renderOffer"
:setOfferEditAuth="setOfferEditAuth"
></submodule_creativeCertificate>
</div>
<div v-scrollWatch="{name:'submodule_creativeFiles',offset:0,callback:spyDomChange}" id="submodule_creativeFiles">
<submodule_creativeFiles
:showAlert="showAlert"
:renderOffer="renderOffer"
:setOfferEditAuth="setOfferEditAuth"
></submodule_creativeFiles>
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from "vue"
import { mapGetters, mapActions } from 'vuex'
import {setReadOnlyFactory, setReadOnly} from '@/util/offerDetail'
import commonDataAPI from '@/api/commonData'
import offerAPI from '@/api/offer'
import mixin_alert_msg from '@/mixins/alert_msg'
import mixin_switch from '@/mixins/switch'
import submodule_offer from "./Detail/Offer.vue"
import submodule_payment from "./Detail/Payment.vue"
import submodule_basic from "./Detail/Basic.vue"
import submodule_targeting from "./Detail/Targeting.vue"
import submodule_pyament from "./Detail/Payment.vue"
import submodule_app_access from "./Detail/App_Access.vue"
import submodule_tracking from './Detail/Tracking.vue'
import submodule_aff_access from './Detail/Affiliate_Access.vue'
import submodule_landing_page from './Detail/Landing_Page.vue'
import submodule_blend_traffic from './Detail/Blend_Traffic.vue'
import scrollWatch from "vue-scrollwatch"
const submodule_creativeFiles = () => import(
/* webpackChunkName: "submodule_creativeFiles" */ './Detail/Creative_Files.vue'
);
const AlertPop = () => import(
/* webpackChunkName: "AlertPop" */ '@/components/common/alert-pop/'
);
const submodule_kpi_setting = () => import(
/* webpackChunkName: "submodule_kpi_setting" */ './Detail/KPI_Setting.vue'
);
const submodule_creativeCertificate = () => import(
/* webpackChunkName: "submodule_creativeCertificate" */ './Detail/Creative_Certificate.vue'
);
Vue.use(scrollWatch)
export default {
data () {
return {
activeMenu: '',
visible:true,
alertMsg:"",
alertType:"info",
alertPop:"hide",
sourceAdv:"",
sourceCat:"",
sourcePlatform:"",
sourceDeviceOS:"",
sourceCounries:"",
sourceDeviceModels:'',
sourceStates:'',
sourceTraffics:'',
renderOffer:false,
currentTrackLink:{},
GBP_CURRENCY:"1.6418",
EUR_CURRENCY:"1.3669",
payoutAndCapsInfo:[],
appPayoutInfo:[],
deviceModels:"",
geoTargeting:'',
platformTargeting:'',
Carriers:'',
id:this.$route.query.id,
sourceAdvIdent:[{"id":"","text":"empty"},{"id":"googleAdvId","text":"gaid"},{"id":"idfa","text":"idfa"}],
affAccessParam: {offer_id:this.$route.query.id},
appAccessParam: {offer_id:this.$route.query.id},
activeUsers:[],
sourceConversionFlow:"",
offerExpirationAction:{},
offerKpiSettingData: {
events: [],
source: null
},
submodule_targeting:false,
submodule_offer:false,
submodule_basic:false,
submodule_payment:false,
initcarriers:'',
map:{
submodule_targeting:{
sourcePlatform:'',
Carriers:'',
sourceStates:'',
sourceDeviceOS:'',
sourceDeviceModels:'',
deviceModels:'',
geoTargeting:'',
platformTargeting:''
},
submodule_offer:{
sourceAdv:'',
offerInfo:''
},
submodule_basic:{
offerInfo:'',
sourceAdv:'',
sourceTraffics:'',
sourceCat:'',
sourceConversionFlow:'',
},
submodule_payment:{
offerInfo:'',
appPayoutInfo:'',
payoutAndCapsInfo:'',
}
}
}
},
mixins: [mixin_alert_msg,mixin_switch],
components: {AlertPop, submodule_creativeFiles, submodule_creativeCertificate, submodule_offer, submodule_payment, submodule_basic, submodule_targeting, submodule_app_access, submodule_tracking, submodule_aff_access, submodule_landing_page, submodule_kpi_setting,submodule_blend_traffic},
watch:{
'map.submodule_targeting': {
handler:function (val,oldVal){
this.checkIfStartRender('submodule_targeting')
},
deep:true
},
'map.submodule_offer': {
handler:function (val,oldVal){
this.checkIfStartRender('submodule_offer')
},
deep:true
},
'map.submodule_basic': {
handler:function (val,oldVal){
this.checkIfStartRender('submodule_basic')
},
deep:true
},
'map.submodule_payment': {
handler:function (val,oldVal){
this.checkIfStartRender('submodule_payment')
},
deep:true
},
},
methods: {
...mapActions([
'getOfferInfo',
'getAffAccess',
'getActiveUser',
'getAppAccess',
'getOCPAInfo',
'fetchAppPayoutAndCaps',
'fetchPayoutAndCaps'
]),
updateOfferInfo(query) {
var update = {}
_.map(query, function(v,k){
if (k != 'method' && k != 'id') {
if(k === "is_dynamic_revenue") v = v
update[''+k] = v;
}
if (k == 'is_quality' ) {
update.is_quality_rating = v;
}
})
this.$store.dispatch('setOfferInfo', update)
},
checkIfStartRender(module) {
let vm = this
var passed = Object.keys(vm.map[module]).every((element, index) => {
return vm.map[module][element]
});
vm[module] = passed
},
initActiveUser() {
let activeUser = this.activeUser || []
this.activeUsers = activeUser.map(function(c_obj) {
var pm = c_obj.pm ? (' - ' + c_obj.pm) :'';
var text = c_obj.id + ' - ' + (c_obj.firstName || '') + ' ' + (c_obj.lastName || '') + pm;
var name = (c_obj.firstName || '') + ' ' + (c_obj.lastName|| '');
return { id: c_obj.id, name: name, text:text};
})
},
onAppAccessChanged(){
},
hideAlertPop:function() {
this.alertPop = "hide"
},
getPayoutAndCapsByOfferId:function(newData) {
let that = this
if (newData && Object.prototype.toString.call(newData) === '[object Array]') {
that.$store.dispatch('payoutAndCapsInfoUpdate', newData)
} else {
that.fetchPayoutAndCaps({id:that.$route.query.id, cb:function(data){
that.callAPIAndSetFlag('payoutAndCapsInfo')
}})
}
},
getAppPayoutAndCaps:function(newData){
let that = this
if (newData && Object.prototype.toString.call(newData) === '[object Array]') {
that.$store.dispatch('AppPayoutAndCapsUpdate', newData)
} else {
that.fetchAppPayoutAndCaps({id:that.$route.query.id, cb:function(data){
that.callAPIAndSetFlag('appPayoutInfo')
}})
}
},
setOfferEditAuth(dom){
if(this.offerInfo.is_writeable === 0 || this.userInfo.role_id === "14"){
setReadOnly($(dom).find(".editable"), 500)
setReadOnlyFactory(['button', 'switch', 'checkbox', 'select', 'text', ' textarea'],$(dom))
}
},
BindRebackUrl(){
let that = this
$('[data-type="ReBack"]').each(function(){
let label = $(this).attr("data-value")
$(this).click(function(){
let url = "./reback_log?id="+ that.$route.query.id+"&label=" + label + "&modul=offer"
that.$router.push(url)
})
})
},
getDeviceModels(){
let that = this
var data = that.offerInfo
if (data['device_model']) {
if (_.isEmpty(data['device_model'][0])) {
return 'all'
} else {
var device_model = that.parseCombinedModel(data['device_model'])
device_model = device_model.join(",")
return device_model
}
} else {
return 'all'
}
},
parseCombinedModel(new_value) {
new_value = _.uniq(new_value)
var obj = {};
new_value.map(function(val, index) {
var split_elm = val.split(/\s/)
var key = split_elm[0]
var append_val = split_elm.splice(1, split_elm.length).join(" ")
if (obj[key]) {
obj[key].push(val)
} else {
obj[key] = [val]
}
})
var arr_val = []
_.map(obj, function(val, index) {
if (val.length > 300) {
var appendText = index + "(" + val.length + " models)"
arr_val.push(appendText)
if (!window['Large_Device_Model_Selected']) {
window['Large_Device_Model_Selected'] = {}
}
window['Large_Device_Model_Selected'][md5(appendText)] = val
} else {
arr_val = arr_val.concat(val)
}
})
return arr_val;
},
getDevices(devices){
let that = this
var data = that.offerInfo
var data_source = that.getDeviceModels()
devices.unshift({
id: 'all',
device: 'All'
});
var source = devices.map(function(c_obj) {
if (c_obj.id == 'all') return {
id: 'all',
text: 'All',
locked: true
};
return {
id: c_obj,
text: c_obj
};
})
if (!_.isEmpty(data_source) && data_source !== "all") {
data_source = data_source.split(",")
data_source.map(function(each) {
source.push({
id: each,
text: each
})
})
}
that.sourceDeviceModels = source
that.callAPIAndSetFlag('sourceDeviceModels')
},
getGeoTargeting() {
var data = this.offerInfo
if (data['country']) {
if (_.isEmpty(data['country'][0])) {
return 'all'
} else {
return data['country']
}
} else {
return 'all'
}
},
getPlatformTargeting() {
let that = this
var data = that.offerInfo
if (data['device_names']) {
if (_.isEmpty(data['device_names'][0])) {
return 'all'
} else {
return data['device_names']
}
} else {
return 'all'
}
},
getCarriers(carriers) {
let that = this
var data = that.offerInfo
if (data['carrier_names']) {
if (_.isEmpty(data['carrier_names'][0])) {
return 'all'
} else {
let carrier_ids = []
_.each(data['carrier_names'], function(val){
var obj = _.find(carriers, {carrier:val})
if(obj) {
carrier_ids.push(obj.id)
}
})
return carrier_ids
}
} else if(!_.isEmpty(data['carriers'])) {
return data['carriers']
} else {
return 'all'
}
},
getConverionFlow(data){
let arr = []
let that = this
_.map(data, function(val, key) {
if(val[that.offerInfo.offer_type] === '1') {
arr.push({id:val.id, text:val.name})
}
})
return arr
},
spyDomChange(node) {
if (this.activeMenu != node.name)
this.activeMenu = node.name
},
scrollTo(name){
document.querySelector("#" + name).scrollIntoView({block: "start",behavior:"instant"})
},
handleScroll() {
let scrollTop = $(window).scrollTop();
if (scrollTop >= 200) {
this.visible = false
} else {
this.visible = true
}
},
fetchOcpaInfo() {
console.log(this.ocpaData)
let that = this
let ocpaParam = {offer_id:this.id, alliance_id: 2}
this.getOCPAInfo({ocpaParam, cb: function(data){
that.$store.dispatch('setOCPAInfo', {kpis:[]})
}})
},
judgeAndFetchMoreFromAPI() {
let that = this
let affAccessParam = that.affAccessParam
if (!this.offerInfo.is_import_offer) {
this.getAffAccess({affAccessParam, cb: function(data){
}})
}
let deviceModelsAndGeoTargeting = async () => {
that.deviceModels = await that.getDeviceModels()
that.geoTargeting = await that.getGeoTargeting()
that.callAPIAndSetFlag('deviceModels')
that.callAPIAndSetFlag('geoTargeting')
}
deviceModelsAndGeoTargeting()
/*
*Carriers
*submodule_targeting使用
*/
commonDataAPI.getCarriers(function(carriers) {
let getCarriers = async () => {
let initcarriers = carriers
that.Carriers = await that.getCarriers(initcarriers)
that.callAPIAndSetFlag('Carriers')
}
getCarriers()
})
commonDataAPI.getDeviceBrandTargeting(function(devices) {
that.getDevices(devices)
})
commonDataAPI.getConversionFlow(function(data) {
let getConverionFlow = async () => {
that.sourceConversionFlow = await that.getConverionFlow(data)
that.callAPIAndSetFlag('sourceConversionFlow')
}
getConverionFlow()
})
/*
*sourcePlatform
*submodule_targeting使用
*/
commonDataAPI.getPlatforms(function(platforms) {
var saved_devices = that.getPlatformTargeting() || []
var new_saved_devices = []
platforms.unshift({
id: 'all',
device: 'All'
});
that.sourcePlatform = platforms.map(function(c_obj) {
if (c_obj.id == 'all') return {
id: 'all',
text: 'All',
locked: true
};
if(saved_devices.indexOf(c_obj.id.toString()) !== -1){
new_saved_devices.push(c_obj.device_names)
}
return { id: c_obj.device_names, text: c_obj.device_names };
})
new_saved_devices = new_saved_devices.length > 0 ? new_saved_devices:saved_devices
that.platformTargeting = new_saved_devices
that.callAPIAndSetFlag('sourcePlatform')
that.callAPIAndSetFlag('platformTargeting')
})
},
callAPIAndSetFlag(tag) {
let vm = this
Object.keys(this.map).forEach((ele, index) => {
if (Object.keys(vm.map[ele]).includes(tag)) {
vm.map[ele][tag] = true
return
}
})
}
},
computed: {
...mapGetters({
offerInfo:"offerInfo",
affAccessInfo:'affAccessInfo',
activeUser:'getActiveUserInfo',
refresh_app_access:"refresh_app_access",
refresh_aff_access:"refresh_aff_access",
userInfo:"userInfo",
appAccessInfo:"appAccessInfo",
ocpaData:"ocpaData",
publisherPayoutAndCapsInfo:"payoutAndCapsInfo",
publisherAppPayoutAndCapsInfo:"AppPayoutAndCaps"
}),
},
created () {
let that = this
var appAccessParam = that.appAccessParam
var ocpaParam = {offer_id:that.id, alliance_id: 2}
/*
*多个模块公用的offerInfo
*offerInfo获取到就可以渲染offer模块
*/
that.getOfferInfo({id: that.$route.query.id, cb: function(data, error){
that.submodule_kpi_setting = true
that.submodule_payment = true
that.submodule_landing_page = true
that.submodule_aff_access = true
that.submodule_app_access = true
that.callAPIAndSetFlag('offerInfo')
that.$nextTick(function(){
that.renderOffer = true
that.BindRebackUrl()
that.judgeAndFetchMoreFromAPI()
})
}})
/*
*sourceAdv
*submodule_offer和submodule_tracking公用
*/
commonDataAPI.getAdvertisers(function(advertisers) {
that.sourceAdv = advertisers.map(function(c_obj) {
return { id: c_obj.id, text: c_obj.name };
})
that.callAPIAndSetFlag('sourceAdv')
})
/*ocpaData
*submodule_kpi_setting、submodule_basic、submodule_blend_traffic公用
*/
that.getOCPAInfo({ocpaParam, cb: function(data){
}})
/*
*sourceTraffics
*submodule_basic使用
*/
commonDataAPI.getTraffics(function(traffics) {
that.sourceTraffics = traffics
that.callAPIAndSetFlag('sourceTraffics')
})
/*
*sourceCat
*submodule_basic
*/
commonDataAPI.getCategories(function(categories) {
that.sourceCat = categories.map(function(c_obj) {
return { id: c_obj.id, text: c_obj.name };
})
that.callAPIAndSetFlag('sourceCat')
})
/*
*activeUsers
* submodule_payment submodule_basic submodule_app_access公用
*/
that.getActiveUser({ cb: function(data){
that.initActiveUser()
}})
/*
*currentTrackLink
*submodule_basic使用
*/
offerAPI.getCurrentTrackLink({}, function(data){
that.currentTrackLink = data.data
})
/*
*EUR_CURRENCY
*submodule_payment使用
*/
offerAPI.getExchangeRateFromEURToUSD({}, function(data){
that.EUR_CURRENCY = data
})
/*
*GBP_CURRENCY
*submodule_payment使用
*/
offerAPI.getExchangeRateFromGBPToUSD({}, function(data){
that.GBP_CURRENCY = data
})
/*
*offerExpirationAction
*submodule_basic使用
*/
offerAPI.getExpirationAction({id:that.$route.query.id}, function(data){
that.offerExpirationAction = data || {}
})
/*
*sourceStates
*submodule_targeting使用
*/
commonDataAPI.getGeoStateList(function(states) {
that.sourceStates = states
that.callAPIAndSetFlag('sourceStates')
})
/*
*sourceDeviceOS
*submodule_targeting
*/
commonDataAPI.getDeviceOsTargeting(function(device_os) {
device_os.unshift({
id: 'all',
device: 'All'
});
that.sourceDeviceOS = device_os.map(function(c_obj) {
if (c_obj.id == 'all') return {
id: 'all',
text: 'All',
locked: true
};
return { id: c_obj.name, text: c_obj.name };
})
that.callAPIAndSetFlag('sourceDeviceOS')
})
offerAPI.getOfferKpiSetting({id:that.$route.query.id}, data => {
if(data) {
this.offerKpiSettingData = data
}
})
// offerAPI.getOfferKpiSetting({id:that.$route.query.id}, (data) => {
// this.offerKpiSettingData = data || {}
// ep.emit("offerKpiSetting", data || {})
// })
that.getAppAccess({appAccessParam, cb: function(data){
}})
/*
*appPayoutInfo,payoutAndCapsInfo
*submodule_payment使用
*/
that.getPayoutAndCapsByOfferId()
that.getAppPayoutAndCaps()
},
mounted () {
window.show_confirm = true;
$(document).ready(function() {
$(document).scroll(function(e) {
if ($("body").scrollTop() < 200) {
$("#toTop").fadeOut();
} else {
$("#toTop").fadeIn();
}
})
})
window.addEventListener('scroll', this.handleScroll)
console.log(this.offerInfo)
console.log(this.ocpaData)
},
destroyed () {
window.removeEventListener('scroll', this.handleScroll)
},
}
</script>
<style scoped>
#myScrollspy{
margin-left: -150px;
padding: 10px 0 10px 10px;
width:140px;
font-size:14px;
position: fixed;
background:#fff;
}
#myScrollspy li {
padding-left: 10px;
font-size: 14px;
color: #666;
width: 100%;
margin-bottom: 5px;
cursor: pointer;
padding-top: 10px !important;
padding-bottom: 10px !important;
}
#myScrollspy li.active {
background-color: #e7e7e7;
}
#offerDetailWraper{
position:relative;
margin-left: 150px;
}
.toTop {
position: fixed;
z-index: 111111;
right: 25px;
bottom: 100px;
background: rgb(152, 152, 152);
width: 50px;
height: 50px;
text-align: center;
border-radius: 4px;
}
.toTop a {
display: block;
width: 100%;
height: 100%;
}
.toTop .fa {
font-size: 40px;
color: #fff;
}
</style>