Ver Fonte

用户列表添加ios筛选

wangzhiqiang há 1 mês atrás
pai
commit
6712832a20
3 ficheiros alterados com 112 adições e 22 exclusões
  1. 18 0
      src/api/userModule.js
  2. 8 1
      src/components/from/index.vue
  3. 86 21
      src/views/main/userModule/userList.vue

+ 18 - 0
src/api/userModule.js

@@ -91,3 +91,21 @@ export function batchDeblock(data) {
     })
 }
 
+// 获取IOS渠道列表
+export function appUserGetDitchList(data) {
+    return request({
+        url: '/agent-service/appUser/getDitchList',
+        method: 'post',
+        data
+    })
+}
+
+// 获取IOS用户列表
+export function getUserForIosList(data) {
+    return request({
+        url: '/agent-service/appUser/getUserForIosList',
+        method: 'post',
+        data
+    })
+}
+

+ 8 - 1
src/components/from/index.vue

@@ -14,7 +14,7 @@
             @clear="form[item.prop] = ''" class="fixed-width-input"></el-input>
           <el-select v-else-if="item.type === 'select'" v-model="form[item.prop]" :placeholder="item.placeholder || '请选择'"
             filterable :clearable="item.clearable === false ? false : true" @clear="form[item.prop] = ''"
-            class="fixed-width-select">
+            class="fixed-width-select" @change="handleSelect(form[item.prop], item)">
             <el-option v-for="option in item.options" :key="option.value" :label="option.label"
               :value="option.value"></el-option>
           </el-select>
@@ -121,6 +121,12 @@ export default {
       emit('addForm')
     }
 
+    function handleSelect(e,item) {
+      // console.log('e :===>>', e);
+      // console.log('e :===>>', item);
+      emit('formChangeSelect',item,e)
+    }
+
     onBeforeMount(() => {
       initFormDefaults()
     })
@@ -135,6 +141,7 @@ export default {
       resetForm,
       handleEnter,
       addForm,
+      handleSelect,
     };
   },
 };

+ 86 - 21
src/views/main/userModule/userList.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="layout-container">
     <!-- 菜单栏 -->
-    <From :form-items="dynamicFormItems" @formSubmitted="handleFormSubmitted" @formReset="handleFormReset" />
+    <From :form-items="dynamicFormItems" @formSubmitted="handleFormSubmitted" @formReset="handleFormReset"
+      @formChangeSelect="handleFormChange" />
 
     <div class="btn">
       <el-button type="" v-if="formSearch.appIds && selectData.length > 0" @click="clearSelection">取消全选</el-button>
@@ -124,12 +125,12 @@
       </el-form>
     </Layer>
 
-    <el-dialog v-model="ecpmLayer.show" :title="`查看用户《${ecpmData.nickName}》的ECPM`" :width="ecpmLayer.width" align-center center
-       :fullscreen="isFullscreen">
+    <el-dialog v-model="ecpmLayer.show" :title="`查看用户《${ecpmData.nickName}》的ECPM`" :width="ecpmLayer.width" align-center
+      center :fullscreen="isFullscreen">
       <el-icon class=" full-icon" @click="isFullscreen = !isFullscreen">
         <FullScreen />
       </el-icon>
-      <EcpmDialog v-if="ecpmLayer.show" v-model:isFullscreen="isFullscreen" :ecpmData="ecpmData"   />
+      <EcpmDialog v-if="ecpmLayer.show" v-model:isFullscreen="isFullscreen" :ecpmData="ecpmData" />
     </el-dialog>
 
     <!-- 审核备注 -->
@@ -151,7 +152,7 @@
 </template>
 
 <script setup>
-import { onBeforeMount, ref, reactive, nextTick } from "vue";
+import { onBeforeMount, ref, reactive, nextTick, watch } from "vue";
 import From from "@/components/from/index.vue";
 import Table from "@/components/table/index.vue";
 import Layer from '@/components/layer/index.vue'
@@ -159,7 +160,7 @@ import { FullScreen } from '@element-plus/icons'
 import { ElMessage, ElLoading } from 'element-plus'
 import {
   getUserList, riskBannedUser, riskLockUser, appUserEcpm, getRevenueByTime,
-  batchAudit, batchBanned, batchDeblock
+  batchAudit, batchBanned, batchDeblock, appUserGetDitchList, getUserForIosList
 } from '@/api/userModule.js'
 import { ditchList } from '@/api/outBagModule.js'
 import { appList } from "@/api/formworkErection.js";
@@ -191,6 +192,7 @@ const formSearch = ref({
   appIds: undefined, //所属应用
   registryTimeBegin: getTodayRangeLocal(),// 注册时间
   registryTimeEnd: undefined,// 注册时间
+  appType: undefined,
   page: 1,// 当前页码
   limit: 20,// 当前页数量(查询量)
 });
@@ -218,6 +220,21 @@ const settingData = async () => {
         type: 'input',
         needEnterEvent: true
       },
+      {
+        label: "应用类型",
+        prop: "appType",
+        type: "select",
+        options: [
+          {
+            label: "Android",
+            value: 1,
+          },
+          {
+            label: "IOS",
+            value: 2,
+          },
+        ],
+      },
       {
         label: '所属应用',
         prop: 'appIds',
@@ -247,36 +264,82 @@ const settingData = async () => {
   })
 }
 
+async function handleFormChange(item, e) {
+  console.log("实时表单数据:", item.prop, e)
+  if (item.prop === 'appType') {
+    // IOS
+    if (e === 2) {
+      dynamicFormItems.value[4] = {
+        label: '渠道来源',
+        prop: 'ditchId',
+        type: 'select',
+        clearable: false,
+        defaultVal: ditchOptionsIos.value[0].value,
+        options: ditchOptionsIos.value,
+      }
+      dynamicFormItems.value[3] = {}
+    } else {
+      dynamicFormItems.value[4] = {
+        label: '渠道来源',
+        prop: 'ditchId',
+        type: 'select',
+        // clearable: false,
+        defaultVal: ditchOptions.value[0].value,
+        options: ditchOptions.value,
+      }
+
+      dynamicFormItems.value[3] = {
+        label: '所属应用',
+        prop: 'appIds',
+        type: 'select',
+        clearable: false,
+        defaultVal: null,
+        options: appsOptions.value,
+      }
+    }
+
+  }
+}
+
 
 const firstApp = ref('')
-//渠道来源
+const ditchOptions = ref([])
+const ditchOptionsIos = ref([])
+const appsOptions = ref([])
+
+
+// 设置表单数据
 const getApiOptions = async () => {
   try {
     // 并发获取数据
-    const [{ data: ditchData }, { data: appData }] = await Promise.all([
+    const [{ data: ditchData }, { data: appData }, { data: iosDitch }] = await Promise.all([
       ditchList({ page: 1, limit: 9999 }),
-      appList({ page: 1, limit: 9999 })
+      appList({ page: 1, limit: 9999 }),
+      appUserGetDitchList({ page: 1, limit: 9999 })
     ])
-
-    const ditchOptions = ditchData.map(item => ({
+    ditchOptions.value = ditchData.map(item => ({
       label: item.ditchName,
       value: item.ditchId
     }))
 
-    const appsOptions = appData.map(item => ({
+    appsOptions.value = appData.map(item => ({
       label: item.appName,
       value: item.appId
     }))
 
+    ditchOptionsIos.value = iosDitch.map(item => ({
+      label: item.ditchName,
+      value: item.ditchId
+    }))
     // 赋值到表单项
-    dynamicFormItems.value[3].options = ditchOptions
-    dynamicFormItems.value[2].options = appsOptions
+    dynamicFormItems.value[4].options = ditchOptions.value
+    dynamicFormItems.value[3].options = appsOptions.value
 
-    // 如果有应用列表,默认选第一个
-    if (appsOptions.length > 0) {
+    //如果有应用列表,默认选第一个
+    if (appsOptions.value.length > 0) {
       // const firstApp = appsOptions[0].value
-      firstApp.value = appsOptions[0].value
-      dynamicFormItems.value[2].defaultVal = firstApp.value
+      firstApp.value = appsOptions.value[0].value
+      dynamicFormItems.value[3].defaultVal = firstApp.value
       formSearch.value.appIds = firstApp.value
     }
 
@@ -306,7 +369,7 @@ const getList = async (timeout = 5000) => {
           // getRevenueByTime({ ...param })
         ]) */
 
-        const listRes = await getUserList({ ...formSearch.value })
+        const listRes = formSearch.value.appType === 2 ? await getUserForIosList({ ...formSearch.value }) : await getUserList({ ...formSearch.value })
         // 列表当日总收益
         const totalEarnings = listRes.data.reduce((acc, cur) => acc + (cur.todayIncome || 0), 0)
 
@@ -334,14 +397,15 @@ const changeTableData = (type) => {
 
 // 搜索
 const handleFormSubmitted = (formData) => {
-  // console.log("接收到子组件传递的数据", formData);
+  console.log("接收到子组件传递的数据", formData);
   formSearch.value.page = page.pageNum;
   formSearch.value.limit = page.pageSize;
   formSearch.value.nickName = formData.nickName;
   formSearch.value.userId = formData.userId;
   formSearch.value.ditchId = formData.ditchId;
   formSearch.value.userStatus = formData.userStatus;
-  formSearch.value.appIds = formData.appIds;
+  formSearch.value.appType = formData.appType;
+  formSearch.value.appIds = formData.appType === 2 ? undefined : formData.appIds;
   formSearch.value.registryTimeBegin = convertUTCToBeijing(formData.registryTimeBegin, false) || undefined
   formSearch.value.registryTimeEnd = convertUTCToBeijing(formData.registryTimeEnd, false) || undefined
 
@@ -358,6 +422,7 @@ const handleFormReset = () => {
     appIds: undefined, //所属应用
     registryTimeBegin: getTodayRangeLocal(),// 注册时间
     registryTimeEnd: undefined,// 注册时间
+    appType: undefined,
     page: 1,// 当前页码
     limit: 20,// 当前页数量(查询量)
   };