|
@@ -2,7 +2,7 @@
|
|
<div class="page-wrap page-wrap-put-books">
|
|
<div class="page-wrap page-wrap-put-books">
|
|
<tool-bar
|
|
<tool-bar
|
|
:text="['advertiser_id', 'campaign_id']"
|
|
:text="['advertiser_id', 'campaign_id']"
|
|
- :label="['账户名称/ID', '广告组名称/ID']"
|
|
|
|
|
|
+ :label="['广告主名称/ID', '广告组名称/ID']"
|
|
:defaultVal="defaultToolvalue"
|
|
:defaultVal="defaultToolvalue"
|
|
v-model:loading="inSearching"
|
|
v-model:loading="inSearching"
|
|
@confirm="onSearch"
|
|
@confirm="onSearch"
|
|
@@ -13,6 +13,7 @@
|
|
v-model:value="pickered"
|
|
v-model:value="pickered"
|
|
:ranges="rangePick"
|
|
:ranges="rangePick"
|
|
format="YYYY/MM/DD"
|
|
format="YYYY/MM/DD"
|
|
|
|
+ @change="changeTime"
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
</tool-bar>
|
|
</tool-bar>
|
|
@@ -43,7 +44,14 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
-import { defineComponent, reactive, toRefs, ref, onMounted } from "vue";
|
|
|
|
|
|
+import {
|
|
|
|
+ defineComponent,
|
|
|
|
+ reactive,
|
|
|
|
+ toRefs,
|
|
|
|
+ ref,
|
|
|
|
+ onMounted,
|
|
|
|
+ computed,
|
|
|
|
+} from "vue";
|
|
import { picker } from "@/helper/config/range";
|
|
import { picker } from "@/helper/config/range";
|
|
import ToolBar from "@/components/tool-bar/index.vue";
|
|
import ToolBar from "@/components/tool-bar/index.vue";
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
@@ -51,7 +59,7 @@ import { AdgroupCloumn } from "../_pageOptions/table-put";
|
|
import useApp from "@/hooks/useApp";
|
|
import useApp from "@/hooks/useApp";
|
|
import { getAdgroupList, setGroupStatus, ALLadGroupData } from "@/api";
|
|
import { getAdgroupList, setGroupStatus, ALLadGroupData } from "@/api";
|
|
import usePagination from "@/hooks/usePagination";
|
|
import usePagination from "@/hooks/usePagination";
|
|
-
|
|
|
|
|
|
+import { MutationType } from "@/store/modules/app/_type";
|
|
import { AdGroupData, PageOptions, GroupDatas } from "@/types/api";
|
|
import { AdGroupData, PageOptions, GroupDatas } from "@/types/api";
|
|
|
|
|
|
const Adgroup = defineComponent({
|
|
const Adgroup = defineComponent({
|
|
@@ -60,7 +68,7 @@ const Adgroup = defineComponent({
|
|
},
|
|
},
|
|
setup() {
|
|
setup() {
|
|
let { loading, meta, tablePageOptions } = usePagination();
|
|
let { loading, meta, tablePageOptions } = usePagination();
|
|
- const { router, route } = useApp();
|
|
|
|
|
|
+ const { router, route, store } = useApp();
|
|
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
inSearching: false,
|
|
inSearching: false,
|
|
@@ -69,12 +77,18 @@ const Adgroup = defineComponent({
|
|
list: ref<any[]>([]),
|
|
list: ref<any[]>([]),
|
|
rangePick: picker,
|
|
rangePick: picker,
|
|
cost_order: 0,
|
|
cost_order: 0,
|
|
|
|
+ convert_order:0,
|
|
|
|
+ convert_cost_order:0,
|
|
showTable: false,
|
|
showTable: false,
|
|
scrollY: 600,
|
|
scrollY: 600,
|
|
- pickered: [moment().subtract(30, "d"), moment()],
|
|
|
|
|
|
+ pickered: computed(() =>
|
|
|
|
+ store.getters.selectTime.length > 0
|
|
|
|
+ ? [moment(store.getters.selectTime[0]),moment(store.getters.selectTime[1])]
|
|
|
|
+ : [moment().subtract(30, "d"), moment()]
|
|
|
|
+ ),
|
|
columns: ref<any[]>([]),
|
|
columns: ref<any[]>([]),
|
|
fields: {},
|
|
fields: {},
|
|
- tableLoading:false,
|
|
|
|
|
|
+ tableLoading: false,
|
|
defaultToolvalue: {},
|
|
defaultToolvalue: {},
|
|
});
|
|
});
|
|
if (route.query && route.query.advertiser_id) {
|
|
if (route.query && route.query.advertiser_id) {
|
|
@@ -115,7 +129,7 @@ const Adgroup = defineComponent({
|
|
campaign_id: query?.campaign_id,
|
|
campaign_id: query?.campaign_id,
|
|
page: query?.current ?? 1,
|
|
page: query?.current ?? 1,
|
|
},
|
|
},
|
|
- state.cost_order ? { cost_order: state.cost_order } : {}
|
|
|
|
|
|
+ { cost_order: state.cost_order,convert_order:state.convert_order, convert_cost_order:state.convert_cost_order }
|
|
);
|
|
);
|
|
const { data } = await getAdgroupList(datas);
|
|
const { data } = await getAdgroupList(datas);
|
|
const { data: totals } = await ALLadGroupData(datas);
|
|
const { data: totals } = await ALLadGroupData(datas);
|
|
@@ -125,7 +139,7 @@ const Adgroup = defineComponent({
|
|
item.is_enable = !!item.is_enable;
|
|
item.is_enable = !!item.is_enable;
|
|
return item;
|
|
return item;
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ let sortList = ['cost','convert','convert_cost']
|
|
let mainCloumn = AdgroupCloumn.map((r) => {
|
|
let mainCloumn = AdgroupCloumn.map((r) => {
|
|
if (r.dataIndex != "check" && r.dataIndex !== "campaign_name") {
|
|
if (r.dataIndex != "check" && r.dataIndex !== "campaign_name") {
|
|
r.children = [
|
|
r.children = [
|
|
@@ -133,7 +147,8 @@ const Adgroup = defineComponent({
|
|
title: totals[r.dataIndex],
|
|
title: totals[r.dataIndex],
|
|
dataIndex: r.dataIndex,
|
|
dataIndex: r.dataIndex,
|
|
width: r.width,
|
|
width: r.width,
|
|
- sorter: r.dataIndex == "cost" ? true : false,
|
|
|
|
|
|
+ sorter: sortList.includes(r.dataIndex) ? true : false,
|
|
|
|
+ sortDirections: ['descend', 'ascend',false],
|
|
ellipsis: true,
|
|
ellipsis: true,
|
|
},
|
|
},
|
|
];
|
|
];
|
|
@@ -153,6 +168,9 @@ const Adgroup = defineComponent({
|
|
};
|
|
};
|
|
|
|
|
|
const setSateSwitch = (val: string, name: string) => {
|
|
const setSateSwitch = (val: string, name: string) => {
|
|
|
|
+ state.cost_order = 0;
|
|
|
|
+ state.convert_order = 0;
|
|
|
|
+ state.convert_cost_order = 0;
|
|
switch (val) {
|
|
switch (val) {
|
|
case "ascend":
|
|
case "ascend":
|
|
(state as any)[name] = 2;
|
|
(state as any)[name] = 2;
|
|
@@ -170,10 +188,15 @@ const Adgroup = defineComponent({
|
|
filters: any,
|
|
filters: any,
|
|
sorter: any
|
|
sorter: any
|
|
) => {
|
|
) => {
|
|
- console.log(sorter)
|
|
|
|
if (sorter.columnKey == "cost") {
|
|
if (sorter.columnKey == "cost") {
|
|
setSateSwitch(sorter.order, "cost_order");
|
|
setSateSwitch(sorter.order, "cost_order");
|
|
}
|
|
}
|
|
|
|
+ if(sorter.columnKey == "convert"){
|
|
|
|
+ setSateSwitch(sorter.order, "convert_order");
|
|
|
|
+ }
|
|
|
|
+ if(sorter.columnKey == "convert_cost"){
|
|
|
|
+ setSateSwitch(sorter.order, "convert_cost_order");
|
|
|
|
+ }
|
|
const { current, pageSize, total } = pagination;
|
|
const { current, pageSize, total } = pagination;
|
|
let data = Object.assign({ current, ...state.fields });
|
|
let data = Object.assign({ current, ...state.fields });
|
|
getData(data);
|
|
getData(data);
|
|
@@ -187,7 +210,7 @@ const Adgroup = defineComponent({
|
|
});
|
|
});
|
|
const goAdlgroup = (id: string, campaign_id: string) => {
|
|
const goAdlgroup = (id: string, campaign_id: string) => {
|
|
let begin_date, end_date;
|
|
let begin_date, end_date;
|
|
- if(state.pickered){
|
|
|
|
|
|
+ if (state.pickered) {
|
|
let [begin_dates, end_dates] = state.pickered;
|
|
let [begin_dates, end_dates] = state.pickered;
|
|
if (begin_dates && end_dates) {
|
|
if (begin_dates && end_dates) {
|
|
begin_date = moment(begin_dates).format("YYYY-MM-DD");
|
|
begin_date = moment(begin_dates).format("YYYY-MM-DD");
|
|
@@ -196,9 +219,15 @@ const Adgroup = defineComponent({
|
|
}
|
|
}
|
|
router.push({
|
|
router.push({
|
|
path: "/put/datas/ad-plan",
|
|
path: "/put/datas/ad-plan",
|
|
- query: { campaign_id,begin_date,end_date },
|
|
|
|
|
|
+ query: { campaign_id, begin_date, end_date },
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+ const changeTime = (monent: any, string: string[]) => {
|
|
|
|
+ console.log(string)
|
|
|
|
+ store.commit(MutationType.setSelectTime, string);
|
|
|
|
+ };
|
|
|
|
+
|
|
return {
|
|
return {
|
|
...toRefs(state),
|
|
...toRefs(state),
|
|
loading,
|
|
loading,
|
|
@@ -206,6 +235,7 @@ const Adgroup = defineComponent({
|
|
onSearch,
|
|
onSearch,
|
|
handleTableChange,
|
|
handleTableChange,
|
|
goAdlgroup,
|
|
goAdlgroup,
|
|
|
|
+ changeTime,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|