1
This commit is contained in:
@@ -1,15 +1,33 @@
|
||||
<template>
|
||||
<div class="app-container" v-loading="loading">
|
||||
<!-- 查询条件 -->
|
||||
<!-- 查询条件(始终展示,避免找不到京粉账号筛选) -->
|
||||
<el-card class="filter-card">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" size="small" v-show="showSearch" label-width="88px">
|
||||
<el-form-item label="京粉账号" prop="unionId">
|
||||
<el-select v-model="queryParams.unionId" placeholder="全部京东联盟账号" clearable filterable style="width: 220px">
|
||||
<div slot="header" class="filter-card-header">
|
||||
<span class="filter-card-title">筛选条件</span>
|
||||
<right-toolbar :search="false" @queryTable="getStatistics" />
|
||||
</div>
|
||||
<el-alert
|
||||
v-if="adminUnionNotice"
|
||||
:title="adminUnionNotice"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="admin-alert"
|
||||
/>
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" size="small" label-width="88px">
|
||||
<el-form-item label="京粉账号" prop="unionId" class="union-form-item">
|
||||
<el-select
|
||||
v-model="queryParams.unionId"
|
||||
placeholder="选择京粉 / 联盟账号(与「订单列表」页同一数据源)"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 280px"
|
||||
>
|
||||
<el-option
|
||||
v-for="admin in adminList"
|
||||
:key="admin.value || admin.id"
|
||||
:key="String(admin.value || admin.id)"
|
||||
:label="admin.label || (admin.name + ' (' + admin.wxid + ')')"
|
||||
:value="admin.value || admin.id"
|
||||
:value="admin.value != null ? admin.value : admin.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -134,7 +152,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
showSearch: true,
|
||||
/** 京粉下拉的独立加载状态(避免 validCode 接口失败拖垮 admin 列表) */
|
||||
_adminListLoaded: false,
|
||||
_adminListError: false,
|
||||
queryParams: {
|
||||
beginTime: null,
|
||||
endTime: null,
|
||||
@@ -199,6 +219,16 @@ export default {
|
||||
hint: 'actualFee 汇总'
|
||||
}
|
||||
]
|
||||
},
|
||||
/** 下拉无数据或加载失败时的说明(用户误以为「没有京粉筛选」) */
|
||||
adminUnionNotice() {
|
||||
if (this._adminListError) {
|
||||
return '京粉账号列表接口异常,下拉暂无选项。请刷新或检查接口 /jarvis/superadmin/select/adminUnionId 与权限。'
|
||||
}
|
||||
if (this._adminListLoaded && (!this.adminList || this.adminList.length === 0)) {
|
||||
return '未配置任何京粉账号选项:请先到「超级管理员」维护 unionId,或确认当前账号有拉取下拉数据的权限。'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -216,21 +246,29 @@ export default {
|
||||
this._disposeCharts()
|
||||
},
|
||||
methods: {
|
||||
bootstrap() {
|
||||
Promise.all([
|
||||
getValidCodeSelectData().then(res => {
|
||||
this.validCodeOptions = res.data || []
|
||||
}),
|
||||
getAdminSelectData().then(res => {
|
||||
this.adminList = res.data || res || []
|
||||
})
|
||||
])
|
||||
.catch(() => {
|
||||
this.$message.error('加载筛选项失败')
|
||||
})
|
||||
.finally(() => {
|
||||
this.getStatistics()
|
||||
})
|
||||
async bootstrap() {
|
||||
this._adminListError = false
|
||||
try {
|
||||
const res = await getValidCodeSelectData()
|
||||
this.validCodeOptions = (res && res.data) ? res.data : []
|
||||
} catch (e) {
|
||||
this.validCodeOptions = []
|
||||
this.$message.error('订单状态下拉加载失败')
|
||||
}
|
||||
try {
|
||||
const res = await getAdminSelectData()
|
||||
this.adminList = (res && (res.data || res.rows)) ? (res.data || res.rows) : (res || [])
|
||||
if (!Array.isArray(this.adminList)) {
|
||||
this.adminList = []
|
||||
}
|
||||
} catch (e) {
|
||||
this._adminListError = true
|
||||
this.adminList = []
|
||||
this.$message.error('京粉账号下拉加载失败')
|
||||
} finally {
|
||||
this._adminListLoaded = true
|
||||
}
|
||||
this.getStatistics()
|
||||
},
|
||||
_disposeCharts() {
|
||||
if (this._statusChart) {
|
||||
@@ -248,6 +286,9 @@ export default {
|
||||
if (params.skuId === '' || params.skuId === undefined) {
|
||||
params.skuId = null
|
||||
}
|
||||
if (params.unionId === '' || params.unionId === undefined) {
|
||||
params.unionId = null
|
||||
}
|
||||
getOrderStatistics(params)
|
||||
.then(response => {
|
||||
this.statistics = Object.assign(
|
||||
@@ -406,6 +447,27 @@ export default {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.filter-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.filter-card-title {
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.admin-alert {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.union-form-item {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.summary-row {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user