|
|
@@ -55,11 +55,9 @@
|
|
|
@change="handleStatusChange(s.row)" v-hasPermi="['admin:proxy:edit']" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="220" class-name="small-padding fixed-width">
|
|
|
+ <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-price-tag" @click="openPriceConfig(s.row)">价格配置</el-button>
|
|
|
- <el-button size="mini" type="text" icon="el-icon-connection" @click="openTenantRel(s.row)">关联租户</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>
|
|
|
@@ -68,85 +66,6 @@
|
|
|
<pagination v-show="proxyTotal>0" :total="proxyTotal" :page.sync="proxyQuery.pageNum" :limit.sync="proxyQuery.pageSize" @pagination="loadProxyList" />
|
|
|
</el-tab-pane>
|
|
|
|
|
|
- <!-- ==================== Tab 2:服务价格配置(允许先选代理) ==================== -->
|
|
|
- <el-tab-pane label="服务价格配置" name="priceConfig">
|
|
|
- <el-form :inline="true" size="small" class="mb8">
|
|
|
- <el-form-item label="选择代理">
|
|
|
- <el-select v-model="priceProxyId" placeholder="请选择代理" clearable filterable @change="loadPriceConfig">
|
|
|
- <el-option v-for="p in enabledProxyList" :key="p.proxyId" :label="p.proxyName" :value="p.proxyId" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="priceProxyId">
|
|
|
- <el-button type="primary" icon="el-icon-edit" size="mini" @click="priceEditing = true">批量编辑</el-button>
|
|
|
- <el-button type="success" icon="el-icon-check" size="mini" @click="submitPriceConfig" v-if="priceEditing">保存</el-button>
|
|
|
- <el-button size="mini" @click="cancelEditPrice" v-if="priceEditing">取消</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <template v-if="priceProxyId">
|
|
|
- <el-table border :data="priceConfigList">
|
|
|
- <el-table-column label="服务类型" prop="serviceTypeName" />
|
|
|
- <el-table-column label="收费单位" prop="feeUnit" width="80" align="center" />
|
|
|
- <el-table-column label="平台成本价" align="center" width="140">
|
|
|
- <template slot-scope="s">
|
|
|
- <el-input v-if="priceEditing" v-model="s.row.platformCost" size="small" type="number" style="width:100px" />
|
|
|
- <span v-else>¥{{ s.row.platformCost || 0 }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="租户售价" align="center" width="140">
|
|
|
- <template slot-scope="s">
|
|
|
- <el-input v-if="priceEditing" v-model="s.row.tenantPrice" size="small" type="number" style="width:100px" />
|
|
|
- <span v-else>¥{{ s.row.tenantPrice || 0 }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="分成比例(%)" align="center" width="130">
|
|
|
- <template slot-scope="s">
|
|
|
- <el-input v-if="priceEditing" v-model="s.row.proxyRatio" size="small" type="number" style="width:80px" />
|
|
|
- <span v-else>{{ s.row.proxyRatio || 0 }}%</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </template>
|
|
|
- <el-empty v-else description="请先选择一个代理查看价格配置" :image-size="80" />
|
|
|
- </el-tab-pane>
|
|
|
-
|
|
|
- <!-- ==================== Tab 3:代理-租户关联 ==================== -->
|
|
|
- <el-tab-pane label="代理-租户关联" name="tenantRel">
|
|
|
- <el-form :inline="true" size="small" class="mb8">
|
|
|
- <el-form-item label="选择代理">
|
|
|
- <el-select v-model="relProxyId" placeholder="请选择代理" clearable filterable @change="loadTenantRelList">
|
|
|
- <el-option v-for="p in enabledProxyList" :key="p.proxyId" :label="p.proxyName" :value="p.proxyId" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="relProxyId">
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="bindDialogVisible = true">绑定租户</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <template v-if="relProxyId">
|
|
|
- <el-table border :data="tenantRelList">
|
|
|
- <el-table-column label="租户ID" prop="tenantId" width="80" align="center" />
|
|
|
- <el-table-column label="租户名称" prop="tenantName" />
|
|
|
- <el-table-column label="分账比例" align="center">
|
|
|
- <template slot-scope="s">{{ s.row.profitShareRatio || 0 }}%</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="绑定时间" align="center" prop="bindTime" />
|
|
|
- <el-table-column label="状态" align="center" prop="status">
|
|
|
- <template slot-scope="s">
|
|
|
- <el-tag v-if="s.row.status === 1" type="success">启用</el-tag>
|
|
|
- <el-tag v-else type="danger">禁用</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="120">
|
|
|
- <template slot-scope="s">
|
|
|
- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleUnbindTenant(s.row)" v-hasPermi="['proxy:tenantRel:unbind']">解绑</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </template>
|
|
|
- <el-empty v-else description="请先选择一个代理查看关联租户" :image-size="80" />
|
|
|
- </el-tab-pane>
|
|
|
-
|
|
|
</el-tabs>
|
|
|
|
|
|
<!-- ==================== 代理编辑弹窗 ==================== -->
|
|
|
@@ -189,29 +108,12 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- ==================== 绑定租户弹窗 ==================== -->
|
|
|
- <el-dialog title="绑定租户到代理" :visible.sync="bindDialogVisible" width="450px" append-to-body>
|
|
|
- <el-form ref="bindForm" :model="bindForm" :rules="bindRules" label-width="100px">
|
|
|
- <el-form-item label="租户ID" prop="tenantId">
|
|
|
- <el-input-number v-model="bindForm.tenantId" :min="1" placeholder="请输入租户ID" style="width:100%" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="分账比例(%)" prop="profitShareRatio">
|
|
|
- <el-input-number v-model="bindForm.profitShareRatio" :min="0" :max="100" :precision="2" style="width:100%" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer">
|
|
|
- <el-button @click="bindDialogVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitBindForm">确 定</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- listProxy, getProxy, addProxy, updateProxy, delProxy, changeProxyStatus, allEnabledProxies,
|
|
|
- getServicePriceByProxy, batchUpdateServicePrice, initDefaultPriceConfig,
|
|
|
- getTenantsByProxy, bindTenant, unbindTenant
|
|
|
+ listProxy, getProxy, addProxy, updateProxy, delProxy, changeProxyStatus
|
|
|
} from '@/api/admin/proxy'
|
|
|
|
|
|
import InlineTenantSelector from "@/components/InlineTenantSelector"
|
|
|
@@ -241,31 +143,15 @@ export default {
|
|
|
contactMobile: [{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确手机号', trigger: 'blur' }]
|
|
|
},
|
|
|
|
|
|
- // ======== 价格配置 ========
|
|
|
- enabledProxyList: [],
|
|
|
- priceProxyId: null,
|
|
|
- priceConfigList: [],
|
|
|
- priceEditing: false,
|
|
|
+ // ======== 价格配置(已移除) ========
|
|
|
|
|
|
- // ======== 租户关联 ========
|
|
|
- relProxyId: null,
|
|
|
- tenantRelList: [],
|
|
|
- bindDialogVisible: false,
|
|
|
- bindForm: { tenantId: null, profitShareRatio: 0 },
|
|
|
- bindRules: {
|
|
|
- tenantId: [{ required: true, message: '请输入租户ID', trigger: 'blur' }]
|
|
|
- }
|
|
|
+ // ======== 租户关联(已移除) ========
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.loadProxyList()
|
|
|
- this.loadEnabledProxies()
|
|
|
},
|
|
|
methods: {
|
|
|
- handleTabClick() {
|
|
|
- if (this.activeTab === 'priceConfig') this.loadEnabledProxies()
|
|
|
- if (this.activeTab === 'tenantRel') this.loadEnabledProxies()
|
|
|
- },
|
|
|
|
|
|
/** 租户选择器变更 / 搜索查询 */
|
|
|
handleQuery() {
|
|
|
@@ -310,12 +196,6 @@ export default {
|
|
|
this.$message.success(this.proxyForm.proxyId ? '修改成功' : '新增成功')
|
|
|
this.proxyDialogVisible = false
|
|
|
this.loadProxyList()
|
|
|
- this.loadEnabledProxies()
|
|
|
- // 新增代理后自动初始化价格配置
|
|
|
- const newProxyId = this.proxyForm.proxyId
|
|
|
- if (newProxyId) {
|
|
|
- initDefaultPriceConfig(newProxyId, this.proxyForm.proxyName)
|
|
|
- }
|
|
|
}).finally(() => { this.proxySubmitting = false })
|
|
|
})
|
|
|
},
|
|
|
@@ -332,65 +212,6 @@ export default {
|
|
|
delProxy(row.proxyId).then(() => {
|
|
|
this.$message.success('删除成功')
|
|
|
this.loadProxyList()
|
|
|
- this.loadEnabledProxies()
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // ======== 价格配置 ========
|
|
|
- loadEnabledProxies() {
|
|
|
- allEnabledProxies().then(r => { this.enabledProxyList = r.data || [] })
|
|
|
- },
|
|
|
- loadPriceConfig(proxyId) {
|
|
|
- const id = proxyId || this.priceProxyId
|
|
|
- if (!id) { this.priceConfigList = []; return }
|
|
|
- getServicePriceByProxy(id).then(r => { this.priceConfigList = r.data || [] })
|
|
|
- },
|
|
|
- openPriceConfig(row) {
|
|
|
- this.activeTab = 'priceConfig'
|
|
|
- this.priceProxyId = row.proxyId
|
|
|
- this.loadPriceConfig(row.proxyId)
|
|
|
- this.loadEnabledProxies()
|
|
|
- },
|
|
|
- cancelEditPrice() {
|
|
|
- this.priceEditing = false
|
|
|
- this.loadPriceConfig()
|
|
|
- },
|
|
|
- submitPriceConfig() {
|
|
|
- batchUpdateServicePrice(this.priceConfigList).then(() => {
|
|
|
- this.$message.success('保存成功')
|
|
|
- this.priceEditing = false
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // ======== 租户关联 ========
|
|
|
- loadTenantRelList(id) {
|
|
|
- const proxyId = id || this.relProxyId
|
|
|
- if (!proxyId) { this.tenantRelList = []; return }
|
|
|
- getTenantsByProxy(proxyId).then(r => { this.tenantRelList = r.data || [] })
|
|
|
- },
|
|
|
- openTenantRel(row) {
|
|
|
- this.activeTab = 'tenantRel'
|
|
|
- this.relProxyId = row.proxyId
|
|
|
- this.loadTenantRelList(row.proxyId)
|
|
|
- this.loadEnabledProxies()
|
|
|
- },
|
|
|
- submitBindForm() {
|
|
|
- this.$refs['bindForm'].validate(valid => {
|
|
|
- if (!valid) return
|
|
|
- bindTenant(this.relProxyId, this.bindForm.tenantId, this.bindForm.profitShareRatio).then(() => {
|
|
|
- this.$message.success('绑定成功')
|
|
|
- this.bindDialogVisible = false
|
|
|
- this.loadTenantRelList()
|
|
|
- this.bindForm = { tenantId: null, profitShareRatio: 0 }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- handleUnbindTenant(row) {
|
|
|
- this.$confirm(`确认解绑租户 "${row.tenantName || row.tenantId}"?`, '提示', { type: 'warning' }).then(() => {
|
|
|
- unbindTenant(row.tenantId).then(() => {
|
|
|
- this.$message.success('解绑成功')
|
|
|
- this.loadTenantRelList()
|
|
|
})
|
|
|
})
|
|
|
},
|