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

View File

@@ -253,9 +253,16 @@ export default {
console.log('isScheduled:', res.data.isScheduled)
console.log('remainingSeconds:', res.data.remainingSeconds)
console.log('scheduledTime:', res.data.scheduledTime)
this.pushStatus = res.data
// 重要:使用解构赋值,确保 remainingSeconds 被正确赋值
this.pushStatus = {
...res.data,
remainingSeconds: parseInt(res.data.remainingSeconds) || 0
}
this.updateCountdownDisplay()
console.log('倒计时显示:', this.countdownDisplay)
console.log('pushStatus.remainingSeconds 已更新为:', this.pushStatus.remainingSeconds)
} else {
console.error('API返回错误:', res)
}
@@ -334,6 +341,10 @@ export default {
startCountdown() {
this.stopCountdown()
// 立即更新一次显示
this.updateCountdownDisplay()
this.countdownTimer = setInterval(() => {
if (this.pushStatus.remainingSeconds > 0) {
this.pushStatus.remainingSeconds--
@@ -382,7 +393,23 @@ export default {
formatDateTime(dateTime) {
if (!dateTime) return '-'
return this.$moment(dateTime).format('YYYY-MM-DD HH:mm:ss')
try {
// 处理多种时间格式
const date = new Date(dateTime)
if (isNaN(date.getTime())) return dateTime
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
} catch (e) {
console.error('格式化时间失败:', e, dateTime)
return dateTime
}
},
formatDuration(ms) {