xia 4 éve
szülő
commit
f82ed4442c

+ 1 - 0
.env.development

@@ -2,4 +2,5 @@ NODE_ENV = development
 VUE_APP_BASE_URL = '/'
 VUE_APP_PUB_URL = '/'
 PROXY_API_URL = 'https://t-promoter.58duke.com/'
+
 MAIN_API_URL = 'https://t-promoter.58duke.com/'

+ 12 - 1
src/api/index.ts

@@ -75,10 +75,11 @@ export const getAdPushList = (
     email: string;
     account_name: string;
     account_id: string;
+    advertiser_id: string;
     page: number;
   }> = { page: 1 }
 ): AxiosPromise<IList<ADpushSimple>> => {
-  return axios("/ad/accounts", { params: query });
+  return axios("/ad/userAdAdvertisers", { params: query });
 };
 
 /**
@@ -447,4 +448,14 @@ export const setBackMinimum = (data: {
   back_min_price: number | string;
 }) => {
   return axios.post("/setAdAdvertiserBackMinPrice", data);
+};
+
+/* 修改广告状态
+ * @param null
+ */
+export const statusAdChange = (data: {
+  advertiser_id: string | number;
+  is_enable: string | number
+}) => {
+  return axios("/ad/updateAdvertiserStatus", { params: data });
 };

+ 12 - 3
src/views/_pageOptions/table-put.ts

@@ -50,15 +50,18 @@ export const TableColumnOfPutBooks = [
 
 export const TableColumnOfPutAdAccount = [
   {
-    title: "邮箱",
-    dataIndex: "email",
-    key: "email",
+    title: "广告主名称",
+    dataIndex: "advertiser_name",
+    key: "advertiser_name",
+    width:200,
+    ellipsis: true,
   },
   {
     title: "账户ID",
     dataIndex: "account_id",
     key: "account_id",
     ellipsis: true,
+    slots: { customRender: "email" },
   },
   {
     title: "用户名",
@@ -82,6 +85,12 @@ export const TableColumnOfPutAdAccount = [
     dataIndex: "status",
     key: "status",
   },
+  {
+    title: "是否同步",
+    key: "operator",
+    slots: { customRender: "operator" },
+    width: 100,
+  }
 ];
 
 export const TableColumnOfPutData = [

+ 0 - 1
src/views/account/account.vue

@@ -125,7 +125,6 @@ const Account = defineComponent({
       this.$message.success("复制成功");
     },
     onCellChange(record: any, dataIndex: string, value: string) {
-      console.log(record)
       setChannelRate({rate:value,channel_id:record.channel_id}).then(res=>{
         this.$message.success("修改回传比例成功!");
       })

+ 1 - 0
src/views/put/ad-group.vue

@@ -170,6 +170,7 @@ const Adgroup = defineComponent({
       filters: any,
       sorter: any
     ) => {
+      console.log(sorter)
       if (sorter.columnKey == "cost") {
         setSateSwitch(sorter.order, "cost_order");
       }

+ 1 - 1
src/views/put/ad_datas.vue

@@ -24,7 +24,7 @@ const PutDataIndex = defineComponent({
       defaultKey:route.name
     })
     const changeTab = (key:string) => {
-      console.log(context)
+
       router.replace({name:key})
     };
     onBeforeRouteUpdate((to) => {

+ 32 - 10
src/views/put/put-ad-account.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="page-wrap page-wrap-put-books">
     <tool-bar
-      :text="['email', 'account_id', 'account_name']"
-      :label="['邮箱', '账户名/ID', '用户名']"
+      :text="['email', 'account_id', 'account_name','advertiser_id']"
+      :label="['邮箱', '账户名/ID', '用户名','广告主ID']"
       v-model:loading="inSearching"
       @confirm="onSearch"
     >
@@ -22,6 +22,16 @@
       :scroll="{y: 600 }"
       rowKey="id"
     >
+    <template #operator="{ text, record }">
+          <a-switch
+            v-model:checked="record.is_enable"
+            @change="switchMethod(record)"
+          />
+        </template>
+    <template #email="{ text, record }">
+      <p>账户ID{{record.account_id}}</p>
+      <p>邮箱:{{record.email}}</p>
+    </template>
     </a-table>
   </div>
 </template>
@@ -31,10 +41,10 @@ import { defineComponent, reactive, toRefs, ref } from "vue";
 import ToolBar from "@/components/tool-bar/index.vue";
 import { TableColumnOfPutAdAccount } from "../_pageOptions/table-put";
 import usePagination from "@/hooks/usePagination";
-import { getAdPushList, getAdauth } from "@/api";
+import { getAdPushList, getAdauth,statusAdChange } from "@/api";
 import { ADpushSimple, PageOptions } from "@/types/api";
 import useDebounceFn from "@/hooks/useDebounceFn";
-
+import { message } from "ant-design-vue";
 const PutAdAccount = defineComponent({
   components: {
     ToolBar,
@@ -54,24 +64,36 @@ const PutAdAccount = defineComponent({
     });
     const onSearch = async (fields: Record<string, string>) => {
       try {
-        const { email, account_name, account_id } = fields;
-        console.log(account_name, account_id);
+        const { email, account_name, account_id,advertiser_id } = fields;
         const { data } = await getAdPushList({
           email,
           account_name,
           account_id,
+          advertiser_id,
           page: 1,
         });
-        state.list = data.list;
+        let clist = data.list.map((r:any)=>{
+          r.is_enable == 0? r.is_enable =false : r.is_enable = true;
+          return r;
+        })
+        state.list = clist;
         meta.value = data.meta;
       } catch (e) {
         console.log(e);
       } finally {
-        console.log(state.inSearching);
+
         state.inSearching = false;
       }
     };
-
+   const switchMethod = (record:any) =>{
+     let data = {
+        advertiser_id: record.advertiser_id,
+        is_enable: Number(!record.is_enable),
+      };
+      statusAdChange(data).then((res) => {
+        message.success('修改成功!')
+      });
+   }
     const handleTableChange = (pagination: PageOptions) => {
       const { current, pageSize, total } = pagination;
       getAdPushList({ page: current }).then((res) => {
@@ -79,7 +101,7 @@ const PutAdAccount = defineComponent({
         meta.value = res.data.meta;
       });
     };
-    return { ...toRefs(state), onSearch, handleTableChange};
+    return { ...toRefs(state), onSearch, handleTableChange,switchMethod};
   },
   methods:{
     async handleClick(){

+ 9 - 6
src/views/put/put-ad-plan.vue

@@ -375,7 +375,7 @@ const PutAdPlan = defineComponent({
       rangePick: picker,
     });
 
-    if (route.query && route.query.advertiser_id) {
+    if (route.query && route.query.campaign_id) {
       state.defaultToolvalue = {
         campaign_id: route.query.campaign_id,
       };
@@ -464,6 +464,7 @@ const PutAdPlan = defineComponent({
         }
         return r;
       });
+     state.showTable = true;
       state.columns = columns;
       state.list = newList;
       meta.value = data.meta;
@@ -522,7 +523,6 @@ const PutAdPlan = defineComponent({
           }
           if (item.name == "budget") {
             lolumnItem.slots = { customRender: item.name };
-            console.log(lolumnItem)
           }
           if (extendList.includes(item.name)) {
             state.innerClomuns.push(lolumnItem);
@@ -572,18 +572,22 @@ const PutAdPlan = defineComponent({
       filters: any,
       sorter: any
     ) => {
+      console.log(sorter)
       if (sorter.columnKey == "cost") {
         setSateSwitch(sorter.order, "cost_order");
       }
       const { current, pageSize, total } = pagination;
-      getData({ page: current });
+      getData({ campaign_id: route.query?.campaign_id ?? "",page: current });
     };
 
     onMounted(() => {
-      getData({
+      setTimeout(()=>{
+        getData({
         campaign_id: route.query?.campaign_id ?? "",
         current: 1,
       });
+      },200)
+      
     });
 
     return { ...toRefs(state), handleTableChange, onSearch, switchDate };
@@ -592,7 +596,7 @@ const PutAdPlan = defineComponent({
     let winHeight =
       document.documentElement.clientHeight || document.body.clientHeight;
     this.scrollY = winHeight - 352;
-    this.showTable = true;
+    
   },
   methods: {
     moment,
@@ -642,7 +646,6 @@ const PutAdPlan = defineComponent({
       });
     },
     getregister(record: any) {
-      console.log(record);
       this.register.ad_lid = record.id;
       this.register.back_platform = record.delivery_platform;
       this.registerVisable = true;

+ 0 - 1
src/views/put/put-book.vue

@@ -197,7 +197,6 @@ const PutBooks = defineComponent({
 
     const onBookLoaded = async (query?: { current: number }) => {
       try {
-        console.log(query);
         loading.value = true;
         const { official_name, book_name } = state;
         const { data } = await getDeliveryBookList({