Kaynağa Gözat

feat: 租户级定价体系 — 语音接口租户定价 + 流量定价 + AI外呼复合定价页面

云联一号 3 gün önce
ebeveyn
işleme
297e0f0fd0

+ 44 - 0
src/api/admin/trafficPricing.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询租户流量定价列表
+export function listTrafficPricing(query) {
+  return request({
+    url: '/admin/traffic-pricing/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询流量定价详情
+export function getTrafficPricing(id) {
+  return request({
+    url: '/admin/traffic-pricing/' + id,
+    method: 'get'
+  })
+}
+
+// 新增流量定价
+export function addTrafficPricing(data) {
+  return request({
+    url: '/admin/traffic-pricing',
+    method: 'post',
+    data: data
+  })
+}
+
+// 更新流量定价
+export function updateTrafficPricing(data) {
+  return request({
+    url: '/admin/traffic-pricing',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除流量定价
+export function delTrafficPricing(id) {
+  return request({
+    url: '/admin/traffic-pricing/' + id,
+    method: 'delete'
+  })
+}

+ 20 - 0
src/api/company/companyVoiceApi.js

@@ -101,4 +101,24 @@ export function getTenantCount(apiId) {
     url: '/admin/voice-api/tenantCount/' + apiId,
     url: '/admin/voice-api/tenantCount/' + apiId,
     method: 'get'
     method: 'get'
   })
   })
+}
+
+// ========== 租户定价管理 ==========
+
+// 查询租户-接口定价列表(分页)
+export function listVoiceApiTenant(query) {
+  return request({
+    url: '/admin/voice-api/tenant/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 更新租户定价
+export function updateTenantPricing(data) {
+  return request({
+    url: '/admin/voice-api/tenant/update',
+    method: 'put',
+    data: data
+  })
 }
 }

+ 257 - 0
src/views/admin/trafficPricing/index.vue

@@ -0,0 +1,257 @@
+<template>
+  <div class="app-container">
+    <el-card shadow="never" class="mb16 filter-card">
+      <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
+        <el-form-item label="租户" prop="tenantId">
+          <el-select v-model="queryParams.tenantId" placeholder="选择租户" clearable filterable remote
+            reserve-keyword :remote-method="searchCompanies" :loading="companySearchLoading" style="width:200px">
+            <el-option v-for="c in companyOptions" :key="c.companyId" :label="c.companyName" :value="c.companyId" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="服务类型" prop="serviceType">
+          <el-select v-model="queryParams.serviceType" placeholder="请选择" clearable style="width:140px">
+            <el-option label="课程流量" :value="2" />
+            <el-option label="直播流量" :value="3" />
+            <el-option label="AI TOKEN" :value="4" />
+            <el-option label="AI外呼附加费" :value="7" />
+            <el-option label="微助手" :value="8" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-select v-model="queryParams.status" placeholder="请选择" clearable size="small">
+            <el-option label="启用" :value="1" />
+            <el-option label="禁用" :value="0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['platform:trafficPricing:add']">新增定价</el-button>
+      </el-col>
+    </el-row>
+
+    <el-table v-loading="loading" :data="dataList" border size="small" style="width:100%">
+      <el-table-column label="租户" align="center" prop="tenantName" min-width="120" show-overflow-tooltip />
+      <el-table-column label="服务类型" align="center" prop="serviceTypeName" min-width="100" />
+      <el-table-column label="租户售价(元/GB)" align="center" prop="price" min-width="130">
+        <template slot-scope="scope">
+          <span>{{ scope.row.price != null ? scope.row.price : '未定价(使用全局)' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="成本价(元/GB)" align="center" prop="costPrice" min-width="130">
+        <template slot-scope="scope">
+          <span>{{ scope.row.costPrice != null ? scope.row.costPrice : '-' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="全局参考售价" align="center" prop="globalPrice" min-width="120">
+        <template slot-scope="scope">
+          <span>{{ scope.row.globalPrice != null ? scope.row.globalPrice + ' 元/GB' : '-' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="全局参考成本" align="center" prop="globalCost" min-width="120">
+        <template slot-scope="scope">
+          <span>{{ scope.row.globalCost != null ? scope.row.globalCost + ' 元/GB' : '-' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status" min-width="70">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.status === 1" type="success" size="mini">启用</el-tag>
+          <el-tag v-else type="danger" size="mini">禁用</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" prop="remark" min-width="150" show-overflow-tooltip />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['platform:trafficPricing:edit']">编辑</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" style="color:#f56c6c" @click="handleDelete(scope.row)"
+            v-hasPermi="['platform:trafficPricing:remove']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="550px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="140px" size="small">
+        <el-form-item label="租户" prop="tenantId">
+          <el-select v-model="form.tenantId" placeholder="选择租户" filterable remote clearable
+            reserve-keyword :remote-method="searchCompanies" :loading="companySearchLoading"
+            style="width:100%" :disabled="isEdit">
+            <el-option v-for="c in companyOptions" :key="c.companyId" :label="c.companyName" :value="c.companyId" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="服务类型" prop="serviceType">
+          <el-select v-model="form.serviceType" placeholder="请选择服务类型" style="width:100%" :disabled="isEdit">
+            <el-option label="课程流量" :value="2" />
+            <el-option label="直播流量" :value="3" />
+            <el-option label="AI TOKEN" :value="4" />
+            <el-option label="AI外呼附加费" :value="7" />
+            <el-option label="微助手" :value="8" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="售价(元/GB)" prop="price">
+          <el-input-number v-model="form.price" :precision="4" :min="0" :step="0.01" style="width:100%" />
+        </el-form-item>
+        <el-form-item label="成本价(元/GB)">
+          <el-input-number v-model="form.costPrice" :precision="4" :min="0" :step="0.01" style="width:100%" />
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-switch v-model="form.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="禁用" />
+        </el-form-item>
+        <el-form-item label="备注">
+          <el-input v-model="form.remark" type="textarea" :rows="2" placeholder="定价说明" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm" :loading="submitting">确 定</el-button>
+        <el-button @click="dialogVisible = false">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listTrafficPricing, getTrafficPricing, addTrafficPricing, updateTrafficPricing, delTrafficPricing } from '@/api/admin/trafficPricing'
+import { listAllCompanies } from '@/api/admin/sysCompany'
+
+export default {
+  name: 'AdminTrafficPricing',
+  data() {
+    return {
+      loading: true,
+      submitting: false,
+      total: 0,
+      dataList: [],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        tenantId: null,
+        serviceType: null,
+        status: null
+      },
+      // 租户搜索
+      companyOptions: [],
+      companySearchLoading: false,
+      // 弹窗
+      dialogVisible: false,
+      dialogTitle: '',
+      isEdit: false,
+      form: {},
+      rules: {
+        tenantId: [{ required: true, message: '请选择租户', trigger: 'change' }],
+        serviceType: [{ required: true, message: '请选择服务类型', trigger: 'change' }]
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    getList() {
+      this.loading = true
+      listTrafficPricing(this.queryParams).then(response => {
+        this.dataList = response.rows || []
+        this.total = response.total || 0
+        this.loading = false
+      }).catch(() => { this.loading = false })
+    },
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    searchCompanies(query) {
+      if (query.length < 1) { this.companyOptions = []; return }
+      this.companySearchLoading = true
+      listAllCompanies({ companyName: query, pageNum: 1, pageSize: 20 }).then(response => {
+        this.companyOptions = (response.rows || []).map(c => ({
+          companyId: c.companyId || c.id,
+          companyName: c.companyName || c.tenantName
+        }))
+      }).finally(() => { this.companySearchLoading = false })
+    },
+    resetFormData() {
+      this.form = {
+        id: undefined,
+        tenantId: null,
+        serviceType: null,
+        price: null,
+        costPrice: null,
+        status: 1,
+        remark: ''
+      }
+    },
+    handleAdd() {
+      this.isEdit = false
+      this.resetFormData()
+      this.dialogTitle = '新增流量定价'
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        if (this.$refs.form) this.$refs.form.clearValidate()
+      })
+    },
+    handleUpdate(row) {
+      this.isEdit = true
+      this.dialogTitle = '编辑流量定价'
+      this.form = {
+        id: row.id,
+        tenantId: row.tenantId,
+        serviceType: row.serviceType,
+        price: row.price,
+        costPrice: row.costPrice,
+        status: row.status,
+        remark: row.remark
+      }
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        if (this.$refs.form) this.$refs.form.clearValidate()
+      })
+    },
+    submitForm() {
+      this.$refs.form.validate(valid => {
+        if (!valid) return
+        this.submitting = true
+        if (this.isEdit) {
+          updateTrafficPricing(this.form).then(() => {
+            this.$message.success('修改成功')
+            this.dialogVisible = false
+            this.getList()
+          }).finally(() => { this.submitting = false })
+        } else {
+          addTrafficPricing(this.form).then(() => {
+            this.$message.success('新增成功')
+            this.dialogVisible = false
+            this.getList()
+          }).finally(() => { this.submitting = false })
+        }
+      })
+    },
+    handleDelete(row) {
+      this.$confirm('确认删除该租户流量定价?', '提示', { type: 'warning' }).then(() => {
+        delTrafficPricing(row.id).then(() => {
+          this.$message.success('删除成功')
+          this.getList()
+        })
+      }).catch(() => {})
+    }
+  }
+}
+</script>
+
+<style scoped>
+.mb16 { margin-bottom: 16px; }
+.mb8 { margin-bottom: 8px; }
+.filter-card { padding-bottom: 0; }
+</style>

+ 27 - 0
src/views/admin/voiceApi/index.vue

@@ -45,6 +45,17 @@
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column label="接口名称" align="center" prop="apiName" min-width="130" show-overflow-tooltip />
       <el-table-column label="接口名称" align="center" prop="apiName" min-width="130" show-overflow-tooltip />
+      <el-table-column label="服务商" align="center" prop="provider" min-width="100">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.provider === 'card'" type="warning">手机卡</el-tag>
+          <el-tag v-else type="primary">平台</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="成本价(元/分钟)" align="center" prop="costPrice" min-width="120">
+        <template slot-scope="scope">
+          <span>{{ scope.row.costPrice != null ? scope.row.costPrice : '-' }}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="已分配租户" align="center" min-width="100">
       <el-table-column label="已分配租户" align="center" min-width="100">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <el-button type="text" @click="handleViewTenants(scope.row)">{{ scope.row.tenantCount || 0 }}个租户</el-button>
           <el-button type="text" @click="handleViewTenants(scope.row)">{{ scope.row.tenantCount || 0 }}个租户</el-button>
@@ -103,6 +114,15 @@
             <el-input v-model="apiForm.apiJsonObj.dialogUrl" placeholder="请输入话术跳转地址" />
             <el-input v-model="apiForm.apiJsonObj.dialogUrl" placeholder="请输入话术跳转地址" />
           </el-form-item>
           </el-form-item>
         </template>
         </template>
+        <el-form-item label="服务商" prop="provider">
+          <el-select v-model="apiForm.provider" placeholder="请选择服务商" clearable size="small" style="width:100%">
+            <el-option label="平台外呼" value="platform" />
+            <el-option label="手机卡外呼" value="card" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="成本价(元/分钟)" prop="costPrice">
+          <el-input-number v-model="apiForm.costPrice" :precision="4" :min="0" :step="0.01" placeholder="成本价" style="width:100%" />
+        </el-form-item>
         <el-form-item label="状态" prop="status">
         <el-form-item label="状态" prop="status">
           <el-radio-group v-model="apiForm.status">
           <el-radio-group v-model="apiForm.status">
             <el-radio label="1">启用</el-radio>
             <el-radio label="1">启用</el-radio>
@@ -187,6 +207,7 @@ export default {
         pageSize: 10,
         pageSize: 10,
         apiName: null,
         apiName: null,
         apiType: null,
         apiType: null,
+        provider: null,
         status: null
         status: null
       },
       },
       apiTypeMap: { '0': 'SIP', '1': '网关', '2': 'API' },
       apiTypeMap: { '0': 'SIP', '1': '网关', '2': 'API' },
@@ -198,7 +219,9 @@ export default {
         apiId: null,
         apiId: null,
         apiName: null,
         apiName: null,
         apiType: '1',
         apiType: '1',
+        provider: 'platform',
         apiJsonObj: {},
         apiJsonObj: {},
+        costPrice: null,
         status: '1',
         status: '1',
         remark: null
         remark: null
       },
       },
@@ -268,7 +291,9 @@ export default {
           apiId: data.apiId,
           apiId: data.apiId,
           apiName: data.apiName,
           apiName: data.apiName,
           apiType: String(data.apiType),
           apiType: String(data.apiType),
+          provider: data.provider || 'platform',
           apiJsonObj: data.apiJson ? JSON.parse(data.apiJson) : {},
           apiJsonObj: data.apiJson ? JSON.parse(data.apiJson) : {},
+          costPrice: data.costPrice,
           status: String(data.status),
           status: String(data.status),
           remark: data.remark
           remark: data.remark
         }
         }
@@ -281,7 +306,9 @@ export default {
         apiId: null,
         apiId: null,
         apiName: null,
         apiName: null,
         apiType: '1',
         apiType: '1',
+        provider: 'platform',
         apiJsonObj: {},
         apiJsonObj: {},
+        costPrice: null,
         status: '1',
         status: '1',
         remark: null
         remark: null
       }
       }

+ 236 - 0
src/views/admin/voiceApiTenant/index.vue

@@ -0,0 +1,236 @@
+<template>
+  <div class="app-container">
+    <el-card shadow="never" class="mb16 filter-card">
+      <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
+        <el-form-item label="租户" prop="companyId">
+          <el-select v-model="queryParams.companyId" placeholder="选择租户" clearable filterable remote
+            reserve-keyword :remote-method="searchCompanies" :loading="companySearchLoading" style="width:200px">
+            <el-option v-for="c in companyOptions" :key="c.companyId" :label="c.companyName" :value="c.companyId" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="接口" prop="apiId">
+          <el-select v-model="queryParams.apiId" placeholder="选择接口" clearable filterable style="width:180px">
+            <el-option v-for="a in apiOptions" :key="a.apiId" :label="a.apiName" :value="a.apiId" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-select v-model="queryParams.status" placeholder="请选择" clearable size="small">
+            <el-option label="启用" :value="1" />
+            <el-option label="禁用" :value="0" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <el-table v-loading="loading" :data="dataList" border size="small" style="width:100%">
+      <el-table-column label="租户" align="center" prop="companyName" min-width="120" show-overflow-tooltip />
+      <el-table-column label="接口名称" align="center" prop="apiName" min-width="120" show-overflow-tooltip />
+      <el-table-column label="服务商" align="center" prop="provider" min-width="80">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.provider === 'card'" type="warning" size="mini">手机卡</el-tag>
+          <el-tag v-else type="primary" size="mini">平台</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="接口类型" align="center" prop="apiType" min-width="70">
+        <template slot-scope="scope">
+          <span>{{ apiTypeMap[scope.row.apiType] || scope.row.apiType }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="成本价" align="center" prop="costPrice" min-width="90">
+        <template slot-scope="scope">
+          <span>{{ scope.row.costPrice != null ? scope.row.costPrice + ' 元/分钟' : '-' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="售价(元/分钟)" align="center" prop="price" min-width="120">
+        <template slot-scope="scope">
+          <span>{{ scope.row.price != null ? scope.row.price : '未定价' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="优先级" align="center" prop="priority" min-width="70">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.isPrimary === 1 ? 'success' : 'info'" size="mini">{{ scope.row.priority || '-' }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="主线路" align="center" prop="isPrimary" min-width="70">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.isPrimary === 1" type="success" size="mini">是</el-tag>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="手动选择" align="center" prop="allowManual" min-width="80">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.allowManual === 1" type="warning" size="mini">允许</el-tag>
+          <span v-else>否</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status" min-width="70">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.status === 1" type="success" size="mini">启用</el-tag>
+          <el-tag v-else type="danger" size="mini">禁用</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEditPricing(scope.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="getList" />
+
+    <!-- 定价编辑弹窗 -->
+    <el-dialog title="编辑租户定价" :visible.sync="pricingOpen" width="500px" append-to-body>
+      <el-form ref="pricingForm" :model="pricingForm" label-width="140px" size="small">
+        <el-form-item label="租户">
+          <el-input :value="pricingForm.companyName" disabled />
+        </el-form-item>
+        <el-form-item label="接口">
+          <el-input :value="pricingForm.apiName" disabled />
+        </el-form-item>
+        <el-form-item label="成本价(元/分钟)">
+          <el-input :value="pricingForm.costPrice != null ? pricingForm.costPrice : '-'" disabled />
+        </el-form-item>
+        <el-form-item label="售价(元/分钟)" prop="price">
+          <el-input-number v-model="pricingForm.price" :precision="4" :min="0" :step="0.01" style="width:100%" />
+        </el-form-item>
+        <el-form-item label="优先级" prop="priority">
+          <el-input-number v-model="pricingForm.priority" :min="1" :max="99" :step="1" style="width:100%" />
+        </el-form-item>
+        <el-form-item label="主线路">
+          <el-switch v-model="pricingForm.isPrimary" :active-value="1" :inactive-value="0" active-text="是" inactive-text="否" />
+        </el-form-item>
+        <el-form-item label="允许手动选择">
+          <el-switch v-model="pricingForm.allowManual" :active-value="1" :inactive-value="0" active-text="允许" inactive-text="禁止" />
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-switch v-model="pricingForm.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="禁用" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitPricing" :loading="pricingSubmitting">保 存</el-button>
+        <el-button @click="pricingOpen = false">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listVoiceApiTenant, updateTenantPricing, getVoiceApiList } from '@/api/company/companyVoiceApi'
+import { listAllCompanies } from '@/api/admin/sysCompany'
+
+export default {
+  name: 'AdminVoiceApiTenant',
+  data() {
+    return {
+      loading: true,
+      total: 0,
+      dataList: [],
+      apiTypeMap: { '0': 'SIP', '1': '网关', '2': 'API' },
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        companyId: null,
+        apiId: null,
+        status: null
+      },
+      // 租户搜索
+      companyOptions: [],
+      companySearchLoading: false,
+      // 接口列表
+      apiOptions: [],
+      // 定价编辑
+      pricingOpen: false,
+      pricingSubmitting: false,
+      pricingForm: {
+        id: null,
+        companyName: '',
+        apiName: '',
+        costPrice: null,
+        price: null,
+        priority: 1,
+        isPrimary: 0,
+        allowManual: 0,
+        status: 1
+      }
+    }
+  },
+  created() {
+    this.getList()
+    this.loadApiOptions()
+  },
+  methods: {
+    getList() {
+      this.loading = true
+      listVoiceApiTenant(this.queryParams).then(response => {
+        this.dataList = response.rows || []
+        this.total = response.total || 0
+        this.loading = false
+      }).catch(() => { this.loading = false })
+    },
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    loadApiOptions() {
+      getVoiceApiList().then(response => {
+        this.apiOptions = response.rows || response.data || []
+      }).catch(() => {})
+    },
+    searchCompanies(query) {
+      if (query.length < 1) { this.companyOptions = []; return }
+      this.companySearchLoading = true
+      listAllCompanies({ companyName: query, pageNum: 1, pageSize: 20 }).then(response => {
+        this.companyOptions = (response.rows || []).map(c => ({
+          companyId: c.companyId || c.id,
+          companyName: c.companyName || c.tenantName
+        }))
+      }).finally(() => { this.companySearchLoading = false })
+    },
+    handleEditPricing(row) {
+      this.pricingForm = {
+        id: row.id,
+        companyName: row.companyName,
+        apiName: row.apiName,
+        costPrice: row.costPrice,
+        price: row.price,
+        priority: row.priority || 1,
+        isPrimary: row.isPrimary || 0,
+        allowManual: row.allowManual || 0,
+        status: row.status
+      }
+      this.pricingOpen = true
+      this.$nextTick(() => {
+        if (this.$refs.pricingForm) this.$refs.pricingForm.clearValidate()
+      })
+    },
+    submitPricing() {
+      this.pricingSubmitting = true
+      updateTenantPricing({
+        id: this.pricingForm.id,
+        price: this.pricingForm.price,
+        priority: this.pricingForm.priority,
+        isPrimary: this.pricingForm.isPrimary,
+        allowManual: this.pricingForm.allowManual,
+        status: this.pricingForm.status
+      }).then(() => {
+        this.$message.success('定价保存成功')
+        this.pricingOpen = false
+        this.getList()
+      }).finally(() => { this.pricingSubmitting = false })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.mb16 { margin-bottom: 16px; }
+.filter-card { padding-bottom: 0; }
+</style>