Browse Source

又是一次修改提交

xia 4 years ago
parent
commit
f8e60ca067

+ 19 - 19
src/views/_pageOptions/table-put.ts

@@ -172,8 +172,8 @@ export const TableColumnOfPutLog = [
     key: "content_log",
     width: 500,
     slots: { customRender: "log" },
-  }
-]
+  },
+];
 
 export const TableMoreStat = [
   {
@@ -251,7 +251,7 @@ export const TableMoreStat = [
     dataIndex: "d30_recovery_rate",
     width: 100,
   },
-]
+];
 
 export const TableColumnOfMoreStat = [
   {
@@ -415,7 +415,7 @@ export const TableColumnOfPutAdPlan = [
     slots: {
       customRender: "ad_name",
     },
-    width: 180,
+    width: 230,
   },
 ];
 
@@ -527,7 +527,6 @@ export const ALLCloumnList = [
   },
 ];
 
-
 export const MatchList = [
   {
     title: "uid",
@@ -596,12 +595,12 @@ export const MatchList = [
       customRender: "report_recharge_num",
     },
   },
-   {
+  {
     title: "次留上报",
     dataIndex: "report_sactive_num",
     width: 100,
-  }, 
-]
+  },
+];
 
 export const AdgroupCloumn = [
   {
@@ -624,6 +623,7 @@ export const AdgroupCloumn = [
     title: "消耗",
     dataIndex: "cost",
     width: 100,
+    sorter: true,
   },
   {
     title: "转化成本",
@@ -665,7 +665,7 @@ export const AdgroupCloumn = [
     dataIndex: "avg_click_cost",
     width: 100,
   },
-]
+];
 
 export const AdCoundCloumn = [
   {
@@ -677,9 +677,18 @@ export const AdCoundCloumn = [
     },
   },
   {
+    title: "账户预算(最低1000元)",
+    dataIndex: "firle",
+    width: 180,
+    slots: {
+      customRender: "budget",
+    },
+  },
+  {
     title: "消耗",
     dataIndex: "cost",
     width: 100,
+    sorter: true,
   },
   {
     title: "转化成本",
@@ -711,13 +720,4 @@ export const AdCoundCloumn = [
     dataIndex: "convert_rate",
     width: 100,
   },
-  {
-    title: "账户预算(最低1000元)",
-    dataIndex: "firle",
-    width: 180,
-    slots: {
-      customRender: "budget",
-    },
-  },
-
-]
+];

+ 36 - 9
src/views/put/ad-countdata.vue

@@ -18,7 +18,7 @@
     <a-table
       :columns="columns"
       :data-source="list"
-      :scroll="{ x: true }"
+      :scroll="{ y: 800, x: 1000 }"
       @change="handleTableChange"
     >
       <template #info="{ text, record }">
@@ -77,6 +77,7 @@ const Adgroup = defineComponent({
       pickered: [moment().subtract(30, "d"), moment()],
       columns: AdCoundCloumn,
       fields: {},
+      cost_order: 0,
     });
 
     const onSearch = (fields: Record<string, string>) => {
@@ -99,13 +100,18 @@ const Adgroup = defineComponent({
           end_date = moment(end_dates).format("YYYY-MM-DD");
         }
 
-        const { data } = await getAdgroupData({
-          begin_date,
-          end_date,
-          advertiser_id: query?.advertiser_id,
-          account_id: query?.account_id,
-          page: query?.current ?? 1,
-        });
+        const { data } = await getAdgroupData(
+          Object.assign(
+            {
+              begin_date,
+              end_date,
+              advertiser_id: query?.advertiser_id,
+              account_id: query?.account_id,
+              page: query?.current ?? 1,
+            },
+            state.cost_order ? { cost_order: state.cost_order } : {}
+          )
+        );
         state.list = data.list;
         meta.value = data.meta;
       } catch (error) {
@@ -114,7 +120,28 @@ const Adgroup = defineComponent({
         state.inSearching = false;
       }
     };
-    const handleTableChange = (pagination: PageOptions) => {
+
+    const setSateSwitch = (val: string, name: string) => {
+      switch (val) {
+        case "ascend":
+          (state as any)[name] = 1;
+          break;
+        case "descend":
+          (state as any)[name] = 2;
+          break;
+        default:
+          (state as any)[name] = 0;
+      }
+    };
+
+    const handleTableChange = (
+      pagination: PageOptions,
+      filters: any,
+      sorter: any
+    ) => {
+      if (sorter.columnKey == "cost") {
+        setSateSwitch(sorter.order, "cost_order");
+      }
       const { current, pageSize, total } = pagination;
       let data = Object.assign({ current, ...state.fields });
       getData(data);

+ 47 - 16
src/views/put/ad-group.vue

@@ -19,11 +19,13 @@
     <a-table
       :columns="columns"
       :data-source="list"
-      :scroll="{ x: true,y:600 }"
+      :scroll="{ x: true }"
       @change="handleTableChange"
     >
-    <template #adgroup="{ text, record }">
-       <p @click="goAdlgroup(record.advertiser_id)"><a href="javascript:;">{{record.campaign_name}} </a></p>
+      <template #adgroup="{ text, record }">
+        <p @click="goAdlgroup(record.advertiser_id, record.campaign_id)">
+          <a href="javascript:;">{{ record.campaign_name }} </a>
+        </p>
       </template>
       <template #switch="{ text, record }">
         <a-switch
@@ -60,6 +62,7 @@ const Adgroup = defineComponent({
       inConfirm: false,
       list: ref<AdGroupData[]>([]),
       rangePick: picker,
+      cost_order: 0,
       pickered: [moment().subtract(30, "d"), moment()],
       columns: AdgroupCloumn,
       fields: {},
@@ -71,7 +74,7 @@ const Adgroup = defineComponent({
       };
       state.fields = {
         advertiser_id: route.query.advertiser_id as string,
-      }
+      };
     }
     const onSearch = (fields: Record<string, string>) => {
       const { advertiser_id, campaign_id } = fields;
@@ -92,14 +95,19 @@ const Adgroup = defineComponent({
           begin_date = moment(begin_dates).format("YYYY-MM-DD");
           end_date = moment(end_dates).format("YYYY-MM-DD");
         }
-
-        const { data } = await getAdgroupList({
-          begin_date,
-          end_date,
-          advertiser_id: query?.advertiser_id,
-          campaign_id: query?.campaign_id,
-          page: query?.current ?? 1,
-        });
+        console.log(state.cost_order);
+        const { data } = await getAdgroupList(
+          Object.assign(
+            {
+              begin_date,
+              end_date,
+              advertiser_id: query?.advertiser_id,
+              campaign_id: query?.campaign_id,
+              page: query?.current ?? 1,
+            },
+            state.cost_order ? { cost_order: state.cost_order } : {}
+          )
+        );
         let mewList = data.list.map((item) => {
           typeof item.is_enable;
           item.is_enable = !!item.is_enable;
@@ -113,7 +121,27 @@ const Adgroup = defineComponent({
         state.inSearching = false;
       }
     };
-    const handleTableChange = (pagination: PageOptions) => {
+    const setSateSwitch = (val: string, name: string) => {
+      switch (val) {
+        case "ascend":
+          (state as any)[name] = 1;
+          break;
+        case "descend":
+          (state as any)[name] = 2;
+          break;
+        default:
+          (state as any)[name] = 0;
+      }
+    };
+
+    const handleTableChange = (
+      pagination: PageOptions,
+      filters: any,
+      sorter: any
+    ) => {
+      if (sorter.columnKey == "cost") {
+        setSateSwitch(sorter.order, "cost_order");
+      }
       const { current, pageSize, total } = pagination;
       let data = Object.assign({ current, ...state.fields });
       getData(data);
@@ -126,8 +154,11 @@ const Adgroup = defineComponent({
       });
     });
 
-    const goAdlgroup = (id: string) => {
-      router.push({ path: "/put/datas/ad-plan", query: { advertiser_id: id } });
+    const goAdlgroup = (id: string, campaign_id: string) => {
+      router.push({
+        path: "/put/datas/ad-plan",
+        query: { advertiser_id: id, campaign_id },
+      });
     };
     return {
       ...toRefs(state),
@@ -135,7 +166,7 @@ const Adgroup = defineComponent({
       tablePageOptions,
       onSearch,
       handleTableChange,
-      goAdlgroup
+      goAdlgroup,
     };
   },
   methods: {

+ 4 - 6
src/views/put/put-ad-count.vue

@@ -60,7 +60,6 @@ const PutCount = defineComponent({
 
       
       let data = Object.assign(query,{ page});
-      console.log(data);
       getAdplanData(data).then((res) => {
         state.list = res.data.list;
         meta.value = res.data.meta;
@@ -77,11 +76,10 @@ const PutCount = defineComponent({
     getAdplanTable({field:props.field}).then((res) => {
       let columns: any[] = [];
       let fixedList = [
+        "account_name",
         "ad_name",
-        "pay_num",
-        "recharge_amount",
         "register_num",
-        "second_pay_num",
+        "paid_order_amount",
       ];
       res.data.map((item: { desc: string; name: string }) => {
         let lolumnItem: {
@@ -98,9 +96,9 @@ const PutCount = defineComponent({
         if (item.name == "ad_id") {
           lolumnItem.width = 200;
         }
-        /* if (fixedList.includes(item.name)) {
+        if (fixedList.includes(item.name)) {
           lolumnItem.fixed = "left";
-        } */
+        }
         columns.push(lolumnItem);
       });
       state.columns = [];

+ 24 - 8
src/views/put/put-ad-plan.vue

@@ -52,7 +52,7 @@
       :loading="loading.value"
       @change="handleTableChange"
       rowKey="id"
-      :scroll="{ x: true }"
+      :scroll="{ x: 1800,y:800 }"
     >
       <template #switch="{ text, record }">
         <a-switch
@@ -335,10 +335,12 @@ const PutAdPlan = defineComponent({
 
     if (route.query && route.query.advertiser_id) {
       state.defaultToolvalue = {
-        advertiser_id: route.query.advertiser_id as string,
+        advertiser_id: route.query.advertiser_id,
+        campaign_id: route.query.campaign_id,
       };
       state.fields = {
-        advertiser_id: route.query.advertiser_id as string,
+        advertiser_id: route.query.advertiser_id,
+        campaign_id: route.query.campaign_id,
       }
     }
 
@@ -420,7 +422,7 @@ const PutAdPlan = defineComponent({
         } = {
           title: item.desc,
           dataIndex: item.name,
-          width: 110,
+          width: 120,
         };
 
         if (item.name == "external_url") {
@@ -457,15 +459,28 @@ const PutAdPlan = defineComponent({
       });
     });
 
+    const setSateSwitch = (val: string, name: string) => {
+      switch (val) {
+        case "ascend":
+          (state as any)[name] = 1;
+          break;
+        case "descend":
+          (state as any)[name] = 2;
+          break;
+        default:
+          (state as any)[name] = 0;
+      }
+    };
+
+
+
     const handleTableChange = (
       pagination: PageOptions,
       filters: any,
       sorter: any
     ) => {
-      if (sorter.columnKey == "cost") {
-        sorter.order == "ascend"
-          ? (state.cost_order = 1)
-          : (state.cost_order = 2);
+       if (sorter.columnKey == "cost") {
+        setSateSwitch(sorter.order, "cost_order");
       }
       const { current, pageSize, total } = pagination;
       getData({ page: current });
@@ -475,6 +490,7 @@ const PutAdPlan = defineComponent({
     onMounted(() => {
       getData({
         advertiser_id: route.query?.advertiser_id ?? "",
+        campaign_id: route.query?.campaign_id ?? "",
         current: 1,
       });
     });

+ 11 - 18
src/views/put/put-data.vue

@@ -41,7 +41,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, reactive, toRefs, ref, onMounted,} from "vue";
+import { defineComponent, reactive, toRefs, ref, onMounted } from "vue";
 import { picker } from "@/helper/config/range";
 import ToolBar from "@/components/tool-bar/index.vue";
 import moment from "moment";
@@ -84,7 +84,7 @@ const PutData = defineComponent({
       show: false,
     });
 
-    const getList = (query:any) => {
+    const getList = (query: any) => {
       let [begin_dates, end_dates] = state.pickered;
       let start_time = moment(begin_dates).format("YYYY-MM-DD");
       let end_time = moment(end_dates).format("YYYY-MM-DD");
@@ -115,12 +115,7 @@ const PutData = defineComponent({
     const getCloums = () => {
       getDesignList({ day_num: state.filterNumber }).then((res) => {
         let columns: any[] = [];
-        let whiteList = [
-          "official_name",
-          "book_name",
-          "register_num",
-          "delivery_platform",
-        ];
+        let whiteList = ["official_name", "date", "book_name", "cost"];
         res.data.map((item: { desc: string; name: string }) => {
           let lolumnItem: {
             title: string;
@@ -133,9 +128,9 @@ const PutData = defineComponent({
             dataIndex: item.name,
             width: 120,
           };
-          /* if (whiteList.includes(item.name)) {
-          lolumnItem.fixed = "left";
-        } */
+          if (whiteList.includes(item.name)) {
+            lolumnItem.fixed = "left";
+          }
           columns.push(lolumnItem);
         });
         state.columns = columns;
@@ -143,20 +138,18 @@ const PutData = defineComponent({
     };
     getCloums();
 
-
-
     const handleTableChange = (pagination: PageOptions) => {
       const { current, pageSize, total } = pagination;
       let data = Object.assign(state.fields, {
         page: current,
         day_num: state.filterNumber,
       });
-      getList(data)
+      getList(data);
     };
-  onMounted(()=>{
-    getCloums();
-    getList({ page: 1, day_num: state.filterNumber });
-  });
+    onMounted(() => {
+      getCloums();
+      getList({ page: 1, day_num: state.filterNumber });
+    });
     return {
       ...toRefs(state),
       onSearch,