Sfoglia il codice sorgente

素材数据总览

ith5 5 mesi fa
parent
commit
369ad1ca8d

+ 56 - 0
src/components/author-select/index.vue

@@ -0,0 +1,56 @@
+<template>
+  <a-select
+    @change="onUpdate"
+    :model-value="modelValue"
+    :options="authorOptions"
+    placeholder="请选择作者"
+    allow-search
+    :max-tag-count="1"
+    :multiple="multiple"
+    allow-clear />
+</template>
+<script setup>
+import { ref, onMounted, defineProps, defineEmits } from 'vue'
+import commonApi from '@/views/v1/api/common'
+
+const authorOptions = ref([])
+
+const props = defineProps({
+  modelValue: {
+    type: [String, Number, Array],
+    default: '',
+  },
+  multiple: {
+    type: Boolean,
+    default: false,
+  },
+})
+
+const emit = defineEmits(['update:modelValue'])
+const onUpdate = (val) => {
+  emit('update:modelValue', val)
+}
+
+// 获取后台归属人列表
+const getDesignAuthOptions = async () => {
+  const res = await commonApi.getDesignAuthOptions()
+  if (res.code == 200) {
+    authorOptions.value = authorOptions.value.concat(
+      [
+        {
+          label: '全部',
+          value: '-1',
+        },
+        {
+          value: '0',
+          label: '未分配',
+        },
+      ],
+      res.data
+    )
+  }
+}
+onMounted(() => {
+  getDesignAuthOptions()
+})
+</script>

+ 15 - 15
src/views/v1/api/advert/common.js

@@ -1,4 +1,4 @@
-import { request } from "@/utils/request.js";
+import { request } from '@/utils/request.js'
 
 /**
  * 公共接口 API接口
@@ -10,10 +10,10 @@ export default {
    */
   getMediaOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getMediaOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getMediaOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -22,10 +22,10 @@ export default {
    */
   getAgentOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getAgentOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getAgentOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -34,9 +34,9 @@ export default {
    */
   getAuthOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getAuthOptions",
-      method: "get",
-      params,
-    });
-  },
-};
+      url: '/v1/common/getAuthOptions',
+      method: 'get',
+      params
+    })
+  }
+}

+ 63 - 42
src/views/v1/api/common.js

@@ -1,4 +1,4 @@
-import { request } from "@/utils/request.js";
+import { request } from '@/utils/request.js'
 
 /**
  * 公共 API接口
@@ -10,10 +10,10 @@ export default {
    */
   getPackageOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getPackageOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getPackageOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -23,10 +23,10 @@ export default {
    */
   getGameOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getGameOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getGameOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -34,10 +34,10 @@ export default {
    */
   getGameOptionsApiNoAuth(params = {}) {
     return request({
-      url: "/v1/common/getGameOptionsNoAuth",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getGameOptionsNoAuth',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -45,10 +45,10 @@ export default {
    */
   getGameListTreeNoAuthApi(params = {}) {
     return request({
-      url: "/v1/common/getGameListTreeNoAuth",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getGameListTreeNoAuth',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -59,10 +59,10 @@ export default {
 
   getGameListTreeApi(params = {}) {
     return request({
-      url: "/v1/common/getGameListTree",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getGameListTree',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -70,10 +70,10 @@ export default {
    */
   getAgentSiteOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getAgentSiteOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getAgentSiteOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -82,10 +82,10 @@ export default {
    */
   getMediaOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getMediaOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getMediaOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -93,10 +93,10 @@ export default {
    */
   getPayChannelOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getPayChannelOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getPayChannelOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -104,10 +104,10 @@ export default {
    */
   getGameListOptionsApi(params = {}) {
     return request({
-      url: "/v1/common/getGameListOptions",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getGameListOptions',
+      method: 'get',
+      params
+    })
   },
 
   /**
@@ -115,9 +115,30 @@ export default {
    */
   getGameListOptionsByGroupApi(params = {}) {
     return request({
-      url: "/v1/common/getGameListOptionsByGroup",
-      method: "get",
-      params,
-    });
+      url: '/v1/common/getGameListOptionsByGroup',
+      method: 'get',
+      params
+    })
   },
-};
+  /**
+   * 获取后台归属人列表
+   * @returns
+   */
+  getAuthOptionsApi(params = {}) {
+    return request({
+      url: '/v1/common/getAuthOptions',
+      method: 'get',
+      params
+    })
+  },
+  /**
+   * 获取设计作者列表
+   */
+  getDesignAuthOptions(params = {}) {
+    return request({
+      url: '/v1/common/getDesignAuthOptions',
+      method: 'get',
+      params
+    })
+  }
+}

+ 18 - 0
src/views/v1/api/gameLog/material.js

@@ -0,0 +1,18 @@
+import { request } from '@/utils/request.js'
+
+/**
+ * 素材 API接口
+ */
+export default {
+  /**
+   * 数据列表
+   * @returns
+   */
+  getMaterialListApi(params = {}) {
+    return request({
+      url: '/v1/gameLog/Material/getMaterialList',
+      method: 'get',
+      params
+    })
+  }
+}

+ 188 - 0
src/views/v1/material/cost/index.vue

@@ -0,0 +1,188 @@
+<template>
+  <div class="ma-content-block">
+    <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
+      <!-- 搜索区 tableSearch -->
+      <template #tableSearch>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="游戏" field="game_id">
+            <game-select v-model="searchForm.game_id" multiple />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="注册日期" field="reg_date">
+            <a-range-picker class="w-full" v-model="searchForm.reg_date" :show-time="false" mode="date" />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="作者" field="author_id">
+            <author-select v-model="searchForm.author_id" />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="媒体" field="media_id">
+            <media-select v-model="searchForm.media_id" />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="消耗筛选" field="cost_type">
+            <a-select v-model="searchForm.cost_type" placeholder="请选择消耗筛选" :options="costTypeOptions" />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="素材名称" field="material_name">
+            <a-input v-model="searchForm.material_name" placeholder="请输入素材名称" allow-clear />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="素材ID" field="material_id">
+            <a-input v-model="searchForm.material_id" placeholder="请输入素材ID" allow-clear />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="投手" field="auth_id">
+            <auth-select v-model="searchForm.auth_id" multiple />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="归类" field="group">
+            <a-select v-model="searchForm.group" placeholder="请选择归类" :options="groupOptions" />
+          </a-form-item>
+        </a-col>
+      </template>
+
+      <!-- Table 自定义渲染 -->
+    </sa-table>
+  </div>
+</template>
+
+<script setup>
+import { onMounted, ref, reactive } from 'vue'
+import api from '@/views/v1/api/gameLog/material'
+import dayjs from 'dayjs'
+import GameSelect from '@/components/game-select/index.vue'
+import MediaSelect from '@/components/media-select/index.vue'
+import AuthorSelect from '@/components/author-select/index.vue'
+import AuthSelect from '@/components/auth-select/index.vue'
+
+// 引用定义
+const crudRef = ref()
+const costTypeOptions = ref([
+  {
+    value: 1,
+    label: '2000消耗以上(包括2000)',
+  },
+  {
+    value: 2,
+    label: '2000消耗以下',
+  },
+])
+const groupOptions = ref([
+  {
+    value: 1,
+    label: '按素材ID',
+  },
+  {
+    value: 2,
+    label: '按作者',
+  },
+  {
+    value: 3,
+    label: '按素材ID + 投手',
+  },
+])
+
+// 搜索表单
+const searchForm = ref({
+  game_id: '',
+  media_id: '',
+  auth_id: '',
+  agent_id: '',
+  site_id: '',
+  reg_date: [],
+  cost_type: '',
+  material_name: '',
+  material_id: '',
+  group: 1,
+})
+
+// SaTable 基础配置
+const options = reactive({
+  api: api.getMaterialListApi,
+  pk: 'id',
+  showSort: false,
+  operationColumn: false,
+  showSummary: true,
+  summary: [
+    {
+      action: 'totalRow',
+      dataIndex: 'cost',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'ad_show',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'click',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'ad_click_rate',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'active',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'register',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_cost',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'pay_amount',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'pay_cost',
+    },
+  ],
+})
+
+// SaTable 列配置
+const columns = reactive([
+  { title: '素材ID', dataIndex: 'material_id', width: 120 },
+  { title: '素材名称', dataIndex: 'material_name', width: 290 },
+  { title: '作者', dataIndex: 'author_id', width: 120 },
+  { title: '投手', dataIndex: 'auth_id', width: 120 },
+  { title: '消耗', dataIndex: 'cost', width: 120 },
+  { title: '展示数', dataIndex: 'ad_show', width: 120 },
+  { title: '点击数', dataIndex: 'click', width: 120 },
+  { title: '点击率', dataIndex: 'ad_click_rate', width: 120 },
+  { title: '激活数', dataIndex: 'active', width: 120 },
+  { title: '注册数', dataIndex: 'register', width: 120 },
+  { title: '注册成本', dataIndex: 'reg_cost', width: 120 },
+  { title: '付费数', dataIndex: 'pay_amount', width: 120 },
+  { title: '付费成本', dataIndex: 'pay_cost', width: 120 },
+])
+
+// 页面数据初始化
+const initPage = async () => {
+  searchForm.value.reg_date[0] = dayjs().subtract(8, 'day').format('YYYY-MM-DD')
+  searchForm.value.reg_date[1] = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+}
+
+// SaTable 数据请求
+const refresh = async () => {
+  crudRef.value?.refresh()
+}
+
+// 页面加载完成执行
+onMounted(async () => {
+  initPage()
+  refresh()
+})
+</script>