This commit is contained in:
2025-11-07 15:35:26 +08:00
parent 80def4201c
commit d02c9ac4cf
2 changed files with 40 additions and 17 deletions

View File

@@ -60,8 +60,8 @@
</el-table-column>
<el-table-column label="商品类型" width="80">
<template slot-scope="scope">
<el-tag :type="(scope.row.owner === 'g' || scope.row.owner === 'G') ? 'success' : 'warning'">
{{ (scope.row.owner === 'g' || scope.row.owner === 'G') ? '自营' : 'POP' }}
<el-tag :type="(scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? 'success' : 'warning'">
{{ (scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? '自营' : 'POP' }}
</el-tag>
</template>
</el-table-column>
@@ -88,14 +88,14 @@
</el-table-column>
<el-table-column label="佣金比例" width="100">
<template slot-scope="scope">
<span v-if="scope.row.commissionShare">{{ scope.row.commissionShare }}%</span>
<span v-if="scope.row.commissionShare || scope.row.commission">{{ (scope.row.commissionShare || scope.row.commission) }}%</span>
<span v-else style="color: #909399;">-</span>
</template>
</el-table-column>
<el-table-column label="佣金金额" width="120">
<template slot-scope="scope">
<span v-if="scope.row.commission">
¥{{ formatPrice(scope.row.commission) }}
¥{{ formatCommissionAmount(scope.row.commission, scope.row.price) }}
</span>
<span v-else style="color: #909399;">-</span>
</template>
@@ -126,8 +126,8 @@
</el-table-column>
<el-table-column label="类型" width="80">
<template slot-scope="scope">
<el-tag :type="(scope.row.owner === 'g' || scope.row.owner === 'G') ? 'success' : 'warning'">
{{ (scope.row.owner === 'g' || scope.row.owner === 'G') ? '自营' : 'POP' }}
<el-tag :type="(scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? 'success' : 'warning'">
{{ (scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? '自营' : 'POP' }}
</el-tag>
</template>
</el-table-column>
@@ -413,9 +413,8 @@ export default {
this.form.selectedProduct = product
this.form.queryResult = product
this.form.skuName = product.skuName || product.title || product.productName || product.cleanSkuName || ''
const ownerValue = product.owner || 'g'
// owner: 'g'/'G' = 自营, 'p'/'pop' = POP
this.form.owner = (ownerValue === 'g' || ownerValue === 'G') ? 'g' : 'pop'
const ownerValue = product.owner || (product.popId ? 'pop' : 'g') || 'g'
this.form.owner = ownerValue === 'p' ? 'pop' : (ownerValue === 'pop' ? 'pop' : 'g')
this.$modal.msgSuccess('已选择商品:' + this.form.skuName + '' + (this.form.owner === 'g' ? '自营' : 'POP') + '')
},
@@ -492,9 +491,8 @@ export default {
this.form.selectedProduct = selectedProduct
this.form.queryResult = selectedProduct
this.form.skuName = selectedProduct.skuName || selectedProduct.title || selectedProduct.productName || selectedProduct.cleanSkuName || ''
const ownerValue = selectedProduct.owner || 'g'
// owner: 'g'/'G' = 自营, 'p'/'pop' = POP
this.form.owner = (ownerValue === 'g' || ownerValue === 'G') ? 'g' : 'pop'
const ownerValue = selectedProduct.owner || (selectedProduct.popId ? 'pop' : 'g') || 'g'
this.form.owner = ownerValue === 'p' ? 'pop' : (ownerValue === 'pop' ? 'pop' : 'g')
// 调用批量创建和替换
await this.handleReplace()
@@ -511,10 +509,8 @@ export default {
return Number(price).toFixed(2)
},
/** 格式化佣金金额已废弃commission字段本身就是佣金金额不需要计算 */
/** 格式化佣金金额 */
formatCommissionAmount(commission, price) {
// 已废弃commission 字段已经是佣金金额(如 86.67),不是百分比
// 直接使用 formatPrice(scope.row.commission) 即可
if (!commission || !price) return '0.00'
// commission可能是百分比字符串或数值
let commissionPercent = 0