|
|
@@ -303,37 +303,37 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- ===== 模块定价弹窗 ===== -->
|
|
|
- <el-dialog :title="'模块定价 - ' + pricingDialog.tenantName" :visible.sync="pricingDialog.visible" width="800px" append-to-body destroy-on-close>
|
|
|
+ <el-dialog :title="'模块定价 - ' + pricingDialog.tenantName" :visible.sync="pricingDialog.visible" width="920px" append-to-body destroy-on-close>
|
|
|
<div v-loading="pricingDialog.loading">
|
|
|
- <el-table :data="pricingDialog.modules" border size="small" style="width:100%">
|
|
|
- <el-table-column label="模块" align="center" prop="moduleName" min-width="120" />
|
|
|
- <el-table-column label="全局售价" align="center" min-width="100">
|
|
|
+ <el-table :data="pricingDialog.modules" border size="small" :max-height="360" style="width:100%">
|
|
|
+ <el-table-column label="模块" align="left" prop="moduleName" min-width="150" />
|
|
|
+ <el-table-column label="全局售价(参考)" align="center" min-width="100">
|
|
|
<template slot-scope="scope">
|
|
|
<span style="color:#909399">{{ scope.row.globalPrice != null ? scope.row.globalPrice : '-' }}</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">
|
|
|
<span style="color:#909399">{{ scope.row.globalCost != null ? scope.row.globalCost : '-' }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="租户售价" align="center" min-width="130">
|
|
|
+ <el-table-column label="租户单价" align="center" min-width="155">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.price" :precision="4" :min="0" :step="0.01" size="small" style="width:150px" placeholder="跟随全局" />
|
|
|
+ <el-input-number v-model="scope.row.price" :precision="4" :min="0" :step="0.01" size="small" controls-position="right" style="width:135px" placeholder="0=跟随全局" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="成本价" align="center" min-width="130">
|
|
|
+ <el-table-column label="成本价" align="center" min-width="155">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.costPrice" :precision="4" :min="0" :step="0.01" size="small" style="width:150px" placeholder="跟随全局" />
|
|
|
+ <el-input-number v-model="scope.row.costPrice" :precision="4" :min="0" :step="0.01" size="small" controls-position="right" style="width:135px" placeholder="0=跟随全局" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="状态" align="center" min-width="80">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="禁" size="small" />
|
|
|
+ <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" size="small" active-color="#409EFF" inactive-color="#C0CCDA" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <div style="color:#909399;font-size:12px;margin-top:8px">* 租户售价/成本价留空或填0则使用全局定价</div>
|
|
|
+ <div style="color:#909399;font-size:12px;margin-top:8px">* 租户单价/成本价设为 0 表示跟随全局定价(不覆盖)</div>
|
|
|
</div>
|
|
|
<div slot="footer">
|
|
|
<el-button @click="pricingDialog.visible = false">取 消</el-button>
|
|
|
@@ -820,75 +820,8 @@ export default {
|
|
|
unit: c.feeUnit,
|
|
|
globalPrice: c.feeStandard,
|
|
|
globalCost: c.platformCost,
|
|
|
- price: existing ? existing.price : null,
|
|
|
- costPrice: existing ? existing.costPrice : null,
|
|
|
- status: existing ? existing.status : 1,
|
|
|
- id: existing ? existing.id : null
|
|
|
- }
|
|
|
- })
|
|
|
- this.pricingDialog.loading = false
|
|
|
- }).catch(() => {
|
|
|
- this.pricingDialog.loading = false
|
|
|
- this.$message.error('加载定价数据失败')
|
|
|
- })
|
|
|
- },
|
|
|
- /** 提交模块定价 */
|
|
|
- submitModulePricing() {
|
|
|
- this.pricingDialog.submitting = true
|
|
|
- const tenantId = this.pricingDialog.tenantId
|
|
|
- const promises = this.pricingDialog.modules.map(m => {
|
|
|
- const data = {
|
|
|
- tenantId: tenantId,
|
|
|
- serviceType: m.serviceType,
|
|
|
- price: m.price,
|
|
|
- costPrice: m.costPrice,
|
|
|
- status: m.status
|
|
|
- }
|
|
|
- if (m.id) {
|
|
|
- data.id = m.id
|
|
|
- return updateTrafficPricing(data)
|
|
|
- } else {
|
|
|
- return addTrafficPricing(data)
|
|
|
- }
|
|
|
- })
|
|
|
- Promise.all(promises).then(() => {
|
|
|
- this.$message.success('模块定价保存成功')
|
|
|
- this.pricingDialog.visible = false
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('部分定价保存失败,请重试')
|
|
|
- }).finally(() => {
|
|
|
- this.pricingDialog.submitting = false
|
|
|
- })
|
|
|
- },
|
|
|
- /** 模块定价 */
|
|
|
- handleModulePricing(row) {
|
|
|
- this.pricingDialog = {
|
|
|
- visible: true,
|
|
|
- tenantId: row.id,
|
|
|
- tenantName: row.tenantName,
|
|
|
- loading: true,
|
|
|
- submitting: false,
|
|
|
- modules: []
|
|
|
- }
|
|
|
- // 从收费配置API获取启用的模块列表(排除手拨外呼serviceType=6)
|
|
|
- Promise.all([
|
|
|
- listServiceCost(),
|
|
|
- listTrafficPricing({ tenantId: row.id, pageSize: 100 })
|
|
|
- ]).then(([costRes, pricingRes]) => {
|
|
|
- const costList = (costRes.data || []).filter(c => c.enabled === 1 && c.serviceType !== 6)
|
|
|
- const tenantPricings = pricingRes.rows || []
|
|
|
- const pricingMap = {}
|
|
|
- tenantPricings.forEach(p => { pricingMap[p.serviceType] = p })
|
|
|
- this.pricingDialog.modules = costList.map(c => {
|
|
|
- const existing = pricingMap[c.serviceType]
|
|
|
- return {
|
|
|
- serviceType: c.serviceType,
|
|
|
- moduleName: c.configName,
|
|
|
- unit: c.feeUnit,
|
|
|
- globalPrice: c.feeStandard,
|
|
|
- globalCost: c.platformCost,
|
|
|
- price: existing ? existing.price : null,
|
|
|
- costPrice: existing ? existing.costPrice : null,
|
|
|
+ price: (existing && existing.price != null && existing.price > 0) ? existing.price : 0,
|
|
|
+ costPrice: (existing && existing.costPrice != null && existing.costPrice > 0) ? existing.costPrice : 0,
|
|
|
status: existing ? existing.status : 1,
|
|
|
id: existing ? existing.id : null
|
|
|
}
|