boss пре 4 дана
родитељ
комит
dbb41299e2

+ 0 - 48
src/api/admin/proxy.js

@@ -29,51 +29,3 @@ export function changeProxyStatus(proxyId, status) {
 export function allEnabledProxies() {
   return request({ url: '/admin/proxy/allEnabled', method: 'get' })
 }
-
-// ======== 代理服务价格配置 ========
-
-export function listServicePrice(query) {
-  return request({ url: '/proxy/servicePrice/list', method: 'get', params: query })
-}
-
-export function getServicePriceByProxy(proxyId) {
-  return request({ url: `/proxy/servicePrice/byProxy/${proxyId}`, method: 'get' })
-}
-
-export function addServicePrice(data) {
-  return request({ url: '/proxy/servicePrice', method: 'post', data })
-}
-
-export function updateServicePrice(data) {
-  return request({ url: '/proxy/servicePrice', method: 'put', data })
-}
-
-export function batchUpdateServicePrice(data) {
-  return request({ url: '/proxy/servicePrice/batch', method: 'put', data })
-}
-
-export function initDefaultPriceConfig(proxyId, proxyName) {
-  return request({ url: `/proxy/servicePrice/init/${proxyId}`, method: 'post', params: { proxyName } })
-}
-
-// ======== 代理-租户关联 ========
-
-export function listProxyTenantRel(query) {
-  return request({ url: '/proxy/tenantRel/list', method: 'get', params: query })
-}
-
-export function getTenantsByProxy(proxyId) {
-  return request({ url: `/proxy/tenantRel/byProxy/${proxyId}`, method: 'get' })
-}
-
-export function bindTenant(proxyId, tenantId, profitShareRatio) {
-  return request({ url: '/proxy/tenantRel/bind', method: 'post', params: { proxyId, tenantId, profitShareRatio } })
-}
-
-export function unbindTenant(tenantId) {
-  return request({ url: `/proxy/tenantRel/unbind/${tenantId}`, method: 'post' })
-}
-
-export function checkTenantBind(tenantId) {
-  return request({ url: `/proxy/tenantRel/checkBind/${tenantId}`, method: 'get' })
-}

+ 1 - 1
src/views/admin/menu.js

@@ -27,7 +27,7 @@ export default [
     path: '/admin/moduleUsage',
     component: () => import('@/views/admin/moduleUsage/index'),
     name: 'AdminModuleUsage',
-    meta: { title: '模用量统计', icon: 'el-icon-data-line', permission: ['admin:moduleUsage:list'] }
+    meta: { title: '模用量统计', icon: 'el-icon-data-line', permission: ['admin:moduleUsage:list'] }
   },
 
   // ==================== 消费/返佣/充值/提现 ====================

+ 10 - 3
src/views/admin/moduleUsage/index.vue

@@ -46,6 +46,10 @@
       <el-table-column label="工作流数" align="center" prop="workflowCount" width="85" />
       <el-table-column label="龙虾模板数" align="center" prop="lobsterTemplateCount" width="105" />
       <el-table-column label="龙虾任务数" align="center" prop="lobsterTaskCount" width="105" />
+      <!-- AI模型用量 -->
+      <el-table-column label="AI Token总量" align="center" prop="aiTokenTotal" width="110" />
+      <el-table-column label="AI外呼总量" align="center" prop="aiCallTotal" width="100" />
+      <el-table-column label="AI对话总量" align="center" prop="aiChatTotal" width="100" />
       <!-- 汇总 -->
       <el-table-column label="活跃模块数" align="center" prop="activeModuleCount" width="100">
         <template slot-scope="scope">
@@ -65,7 +69,7 @@
     <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
 
     <!-- 详情弹窗 -->
-    <el-dialog title="租户用量详情" :visible.sync="detailVisible" width="700px">
+    <el-dialog title="租户模型用量详情" :visible.sync="detailVisible" width="700px">
       <el-descriptions :column="3" border>
         <el-descriptions-item label="租户名称">{{ detail.tenantName }}</el-descriptions-item>
         <el-descriptions-item label="归属代理">{{ detail.proxyName || '-' }}</el-descriptions-item>
@@ -86,6 +90,9 @@
         <el-descriptions-item label="工作流数量">{{ detail.workflowCount || 0 }}</el-descriptions-item>
         <el-descriptions-item label="龙虾引擎模版数">{{ detail.lobsterTemplateCount || 0 }}</el-descriptions-item>
         <el-descriptions-item label="龙虾引擎任务数">{{ detail.lobsterTaskCount || 0 }}</el-descriptions-item>
+        <el-descriptions-item label="AI Token总量">{{ detail.aiTokenTotal || 0 }}</el-descriptions-item>
+        <el-descriptions-item label="AI外呼总量">{{ detail.aiCallTotal || 0 }}</el-descriptions-item>
+        <el-descriptions-item label="AI对话总量">{{ detail.aiChatTotal || 0 }}</el-descriptions-item>
         <el-descriptions-item label="活跃模块数">
           <el-tag type="success" size="small">{{ detail.activeModuleCount || 0 }}</el-tag>
         </el-descriptions-item>
@@ -99,7 +106,7 @@
 import { listModuleUsageSummary, getTenantDetail, refreshStatistics } from '@/api/admin/moduleUsage'
 
 export default {
-  name: 'AdminModuleUsage',
+  name: 'AdminModelUsage',
   data() {
     return {
       loading: false,
@@ -155,4 +162,4 @@ export default {
     }
   }
 }
-</script>
+</script>

+ 0 - 103
src/views/admin/proxy/feeConfig.vue

@@ -1,103 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-alert title="设置代理的分成比例,代理每日分佣 = 该代理下所有租户当日消费总额扣减平台成本后的总利润 × 代理分成比例" type="info" :closable="false" show-icon class="mb16" />
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button type="primary" icon="el-icon-edit" size="mini" @click="toggleEdit">
-          {{ editing ? '取消编辑' : '批量编辑' }}
-        </el-button>
-      </el-col>
-      <el-col :span="1.5" v-if="editing">
-        <el-button type="success" icon="el-icon-check" size="mini" @click="saveAll">保存全部</el-button>
-      </el-col>
-    </el-row>
-
-    <el-table border v-loading="loading" :data="proxyList" style="width:100%">
-      <el-table-column label="代理ID" prop="proxyId" width="80" align="center" />
-      <el-table-column label="代理名称" prop="proxyName" min-width="140" />
-      <el-table-column label="联系人" prop="contactName" width="100" />
-      <el-table-column label="联系电话" prop="contactMobile" width="130" />
-      <el-table-column label="余额" align="center" width="120">
-        <template slot-scope="s">
-          <span style="color:#1890ff;font-weight:bold">¥{{ (s.row.balance || 0).toFixed(2) }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="分成比例(%)" align="center" width="150">
-        <template slot-scope="s">
-          <el-input-number v-if="editing" v-model="s.row.profitShareRatio" :min="0" :max="100" :precision="2" size="small" style="width:100px" />
-          <span v-else style="color:#52c41a;font-weight:bold">{{ s.row.profitShareRatio || 0 }}%</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="发展客户数" align="center" width="100">
-        <template slot-scope="s">{{ s.row.tenantCount || 0 }}</template>
-      </el-table-column>
-      <el-table-column label="到期时间" align="center" prop="expireTime" width="120" />
-      <el-table-column label="状态" align="center" width="80">
-        <template slot-scope="s">
-          <el-tag v-if="s.row.status === 1" type="success" size="small">启用</el-tag>
-          <el-tag v-else type="danger" size="small">禁用</el-tag>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" width="100" align="center" v-if="editing">
-        <template slot-scope="s">
-          <el-button size="mini" type="text" icon="el-icon-check" @click="saveOne(s.row)">保存</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="loadList" />
-  </div>
-</template>
-
-<script>
-import { listProxy, updateProxy } from '@/api/admin/proxy'
-
-export default {
-  name: 'AdminProxyFeeConfig',
-  data() {
-    return {
-      loading: false,
-      editing: false,
-      proxyList: [],
-      total: 0,
-      queryParams: { pageNum: 1, pageSize: 20 }
-    }
-  },
-  created() {
-    this.loadList()
-  },
-  methods: {
-    toggleEdit() { this.editing = !this.editing },
-    loadList() {
-      this.loading = true
-      listProxy(this.queryParams).then(res => {
-        this.proxyList = res.rows || []
-        this.total = res.total || 0
-        this.loading = false
-      }).catch(() => { this.loading = false })
-    },
-    saveOne(row) {
-      updateProxy({ proxyId: row.proxyId, profitShareRatio: row.profitShareRatio }).then(() => {
-        this.$message.success(`${row.proxyName} 分成比例更新成功`)
-      })
-    },
-    saveAll() {
-      let count = 0
-      const promises = this.proxyList
-        .filter(p => p.proxyId)
-        .map(p => updateProxy({ proxyId: p.proxyId, profitShareRatio: p.profitShareRatio }).then(() => count++))
-      Promise.all(promises).then(() => {
-        this.$message.success(`批量保存成功,共更新 ${count} 个代理`)
-        this.editing = false
-        this.loadList()
-      })
-    }
-  }
-}
-</script>
-
-<style scoped>
-.mb16 { margin-bottom: 16px; }
-.mb8 { margin-bottom: 8px; }
-</style>

+ 61 - 73
src/views/admin/proxy/index.vue

@@ -1,72 +1,66 @@
 <template>
   <div class="app-container">
-    <el-tabs v-model="activeTab" type="card" @tab-click="handleTabClick">
-
-      <!-- ==================== Tab 1:代理列表 ==================== -->
-      <el-tab-pane label="代理管理" name="proxyList">
-        <el-form :model="proxyQuery" ref="proxyQueryForm" :inline="true" v-show="showSearch" label-width="80px">
-          <el-form-item label="代理名称" prop="proxyName">
-            <el-input v-model="proxyQuery.proxyName" placeholder="请输入代理名称" clearable size="small" @keyup.enter.native="loadProxyList" />
-          </el-form-item>
-          <el-form-item label="状态" prop="status">
-            <el-select v-model="proxyQuery.status" placeholder="请选择状态" clearable size="small">
-              <el-option label="启用" :value="1" />
-              <el-option label="禁用" :value="0" />
-            </el-select>
-          </el-form-item>
-          <el-form-item>
-            <inline-tenant-selector @change="handleQuery" />
+    <!-- ==================== 代理列表 ==================== -->
+    <el-form :model="proxyQuery" ref="proxyQueryForm" :inline="true" v-show="showSearch" label-width="80px">
+      <el-form-item label="代理名称" prop="proxyName">
+        <el-input v-model="proxyQuery.proxyName" placeholder="请输入代理名称" clearable size="small" @keyup.enter.native="loadProxyList" />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="proxyQuery.status" placeholder="请选择状态" clearable size="small">
+          <el-option label="启用" :value="1" />
+          <el-option label="禁用" :value="0" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <inline-tenant-selector @change="handleQuery" />
       <el-button type="primary" icon="el-icon-search" size="mini" @click="loadProxyList">搜索</el-button>
-            <el-button icon="el-icon-refresh" size="mini" @click="resetProxyQuery">重置</el-button>
-          </el-form-item>
-        </el-form>
-
-        <el-row :gutter="10" class="mb8">
-          <el-col :span="1.5">
-            <el-button type="primary" icon="el-icon-plus" size="mini" @click="openProxyDialog(null)" v-hasPermi="['admin:proxy:add']">新增</el-button>
-          </el-col>
-          <right-toolbar :showSearch.sync="showSearch" @queryTable="loadProxyList" />
-        </el-row>
-
-        <el-table border v-loading="proxyLoading" :data="proxyList" @selection-change="handleProxySelection">
-          <el-table-column type="selection" width="50" align="center" />
-          <el-table-column label="ID" prop="proxyId" width="60" align="center" />
-          <el-table-column label="代理名称" prop="proxyName" />
-          <el-table-column label="代理姓名" prop="contactName" />
-          <el-table-column label="代理联系方式" prop="contactMobile" />
-          <el-table-column label="余额" align="center">
-            <template slot-scope="s">¥{{ s.row.balance || 0 }}</template>
-          </el-table-column>
-          <el-table-column label="默认分佣比例" align="center" prop="profitShareRatio">
-            <template slot-scope="s">{{ s.row.profitShareRatio || 0 }}%</template>
-          </el-table-column>
-          <el-table-column label="到期时间" align="center" prop="expireTime" />
-          <el-table-column label="发展客户数" align="center" prop="tenantCount" />
-          <el-table-column label="累计分成总额" align="center" prop="totalCommission">
-            <template slot-scope="s">¥{{ s.row.totalCommission || 0 }}</template>
-          </el-table-column>
-          <el-table-column label="剩余未提现" align="center" prop="unwithdrawnAmount">
-            <template slot-scope="s">¥{{ s.row.unwithdrawnAmount || 0 }}</template>
-          </el-table-column>
-          <el-table-column label="状态" align="center" prop="status">
-            <template slot-scope="s">
-              <el-switch v-model="s.row.status" :active-value="1" :inactive-value="0"
-                active-text="启用" inactive-text="禁用"
-                @change="handleStatusChange(s.row)" v-hasPermi="['admin:proxy:edit']" />
-            </template>
-          </el-table-column>
-          <el-table-column label="操作" align="center" width="140" class-name="small-padding fixed-width">
-            <template slot-scope="s">
-              <el-button size="mini" type="text" icon="el-icon-edit" @click="openProxyDialog(s.row)" v-hasPermi="['admin:proxy:edit']">编辑</el-button>
-              <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteProxy(s.row)" v-hasPermi="['admin:proxy:remove']">删除</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-
-        <pagination v-show="proxyTotal>0" :total="proxyTotal" :page.sync="proxyQuery.pageNum" :limit.sync="proxyQuery.pageSize" @pagination="loadProxyList" />
-      </el-tab-pane>
-
-    </el-tabs>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetProxyQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="openProxyDialog(null)" v-hasPermi="['admin:proxy:add']">新增</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="loadProxyList" />
+    </el-row>
+
+    <el-table border v-loading="proxyLoading" :data="proxyList" @selection-change="handleProxySelection">
+      <el-table-column type="selection" width="50" align="center" />
+      <el-table-column label="ID" prop="proxyId" width="60" align="center" />
+      <el-table-column label="代理名称" prop="proxyName" />
+      <el-table-column label="代理姓名" prop="contactName" />
+      <el-table-column label="代理联系方式" prop="contactMobile" />
+      <el-table-column label="余额" align="center">
+        <template slot-scope="s">¥{{ s.row.balance || 0 }}</template>
+      </el-table-column>
+      <el-table-column label="默认分佣比例" align="center" prop="profitShareRatio">
+        <template slot-scope="s">{{ s.row.profitShareRatio || 0 }}%</template>
+      </el-table-column>
+      <el-table-column label="到期时间" align="center" prop="expireTime" />
+      <el-table-column label="发展客户数" align="center" prop="tenantCount" />
+      <el-table-column label="累计分成总额" align="center" prop="totalCommission">
+        <template slot-scope="s">¥{{ s.row.totalCommission || 0 }}</template>
+      </el-table-column>
+      <el-table-column label="剩余未提现" align="center" prop="unwithdrawnAmount">
+        <template slot-scope="s">¥{{ s.row.unwithdrawnAmount || 0 }}</template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="s">
+          <el-switch v-model="s.row.status" :active-value="1" :inactive-value="0"
+            active-text="启用" inactive-text="禁用"
+            @change="handleStatusChange(s.row)" v-hasPermi="['admin:proxy:edit']" />
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="140" class-name="small-padding fixed-width">
+        <template slot-scope="s">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="openProxyDialog(s.row)" v-hasPermi="['admin:proxy:edit']">编辑</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteProxy(s.row)" v-hasPermi="['admin:proxy:remove']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination v-show="proxyTotal>0" :total="proxyTotal" :page.sync="proxyQuery.pageNum" :limit.sync="proxyQuery.pageSize" @pagination="loadProxyList" />
 
     <!-- ==================== 代理编辑弹窗 ==================== -->
     <el-dialog :title="proxyFormTitle" :visible.sync="proxyDialogVisible" width="520px" append-to-body>
@@ -107,7 +101,6 @@
         <el-button type="primary" :loading="proxySubmitting" @click="submitProxyForm">确 定</el-button>
       </div>
     </el-dialog>
-
   </div>
 </template>
 
@@ -123,7 +116,6 @@ export default {
   components: { InlineTenantSelector },
   data() {
     return {
-      activeTab: 'proxyList',
       showSearch: true,
 
       // ======== 代理列表 ========
@@ -141,11 +133,7 @@ export default {
       proxyRules: {
         proxyName: [{ required: true, message: '请输入代理名称', trigger: 'blur' }],
         contactMobile: [{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确手机号', trigger: 'blur' }]
-      },
-
-      // ======== 价格配置(已移除) ========
-
-      // ======== 租户关联(已移除) ========
+      }
     }
   },
   created() {