|
@@ -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(){
|