修改计费逻辑

This commit is contained in:
wuweihua
2026-10-12 14:44:20 +08:00
parent 4d41b0fe12
commit a115926e9f
6 changed files with 39 additions and 44 deletions
+10 -5
View File
@@ -68,8 +68,8 @@
<el-form-item label="计费时间" prop="bizDate">
<el-date-picker
v-model="form.bizDate"
type="date"
value-format="YYYY-MM-DD"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="默认今天,用于筛选已生效的产品明细"
style="width: 100%"
/>
@@ -288,7 +288,7 @@ const historyColumns = [
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
{ label: '国家', prop: 'country', minWidth: 130, slot: 'country' },
{ label: '计费重量', prop: 'weight', align: 'center', width: 100, slot: 'weight' },
{ label: '计费日期', prop: 'bizDate', align: 'center', width: 120 },
{ label: '计费时间', prop: 'bizDate', align: 'center', width: 170, parseTime: true },
{ label: '计价来源', prop: 'matchSource', align: 'center', width: 140, slot: 'matchSource' },
{ label: '套餐', prop: 'priceSetName', minWidth: 120, showOverflowTooltip: true },
{ label: '产品价', prop: 'productAmount', align: 'right', width: 110 },
@@ -527,10 +527,15 @@ function formatRate(val) {
function formatDate(val) {
if (!val) return '-'
// 兼容后端 java.util.Date 转 ISO 字符串
const raw = String(val).replace('T', ' ')
if (/^\d{4}-\d{2}-\d{2}/.test(raw)) {
return raw.length >= 19 ? raw.slice(0, 19) : raw.slice(0, 10)
}
const d = new Date(val)
if (Number.isNaN(d.getTime())) return val
return d.toISOString().slice(0, 10)
const pad = (n) => String(n).padStart(2, '0')
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate())
+ ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds())
}
function sourceLabel(source) {