refactor(web): simplify yeeke returns and sync-runs pages per review (#337)
Drop the page headings and descriptions on both pages; remove the manual sync / view sync-runs buttons and the tracking-no and item/variation filters from the returns page; place manual sync right-aligned after reset on the sync-runs page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
This commit is contained in:
@@ -2,20 +2,6 @@
|
||||
<BasicLayout>
|
||||
<template #wrapper>
|
||||
<el-card class="page-card" shadow="never">
|
||||
<div class="page-heading">
|
||||
<div><h1>yeeke 退货包裹</h1><p>只读查看 yeeke 退货包裹与商品明细;详细同步历史见「yeeke 同步记录」。</p></div>
|
||||
<div class="heading-actions">
|
||||
<el-button
|
||||
v-if="canSync"
|
||||
type="primary"
|
||||
:loading="manualSyncStarting"
|
||||
:disabled="manualSyncStarting"
|
||||
@click="startManualSync"
|
||||
>手动同步</el-button>
|
||||
<el-button @click="goToSyncRuns">查看同步记录</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-alert v-if="summaryError" :title="summaryError" type="warning" show-icon :closable="false" class="notice" />
|
||||
<div v-else class="summary-bar" aria-live="polite">
|
||||
<span>最后成功同步:<strong>{{ formatTime(summary.lastSuccessAt) }}</strong></span>
|
||||
@@ -25,12 +11,7 @@
|
||||
|
||||
<el-form :model="query" :inline="true" class="search-form" @submit.prevent="search">
|
||||
<el-form-item label="订单号"><el-input v-model="query.orderSn" clearable placeholder="订单号" style="width:150px" /></el-form-item>
|
||||
<el-form-item label="退货物流单号"><el-input v-model="query.trackingNo" clearable placeholder="物流单号" style="width:150px" /></el-form-item>
|
||||
<el-form-item label="店铺"><el-input v-model="query.shop" clearable placeholder="店铺ID或名称" style="width:130px" /></el-form-item>
|
||||
<el-form-item label="商品ID/规格ID">
|
||||
<el-input v-model="query.itemId" clearable placeholder="商品ID" style="width:110px" />
|
||||
<el-input v-model="query.variationId" clearable placeholder="规格ID" style="width:110px;margin-left:6px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="认领状态">
|
||||
<el-select v-model="query.claimStatus" clearable placeholder="全部" style="width:130px">
|
||||
<el-option v-for="item in claimStatusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
@@ -96,17 +77,16 @@
|
||||
|
||||
<script>
|
||||
import { Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listYeekeReturnPackages, getYeekeReturnPackage, listYeekeSyncRuns, triggerYeekeSync } from '@/api/goauto/yeeke-returns'
|
||||
import { listYeekeReturnPackages, getYeekeReturnPackage, listYeekeSyncRuns } from '@/api/goauto/yeeke-returns'
|
||||
|
||||
export default {
|
||||
name: 'GoAutoYeekeReturns',
|
||||
setup() { return { Search, RefreshLeft } },
|
||||
data() {
|
||||
return {
|
||||
loading: false, loadError: '', items: [], total: 0, createTimeRange: null, manualSyncStarting: false,
|
||||
loading: false, loadError: '', items: [], total: 0, createTimeRange: null,
|
||||
summary: { lastSuccessAt: '', lastRun: null }, summaryError: '',
|
||||
query: { page: 1, pageSize: 20, orderSn: '', trackingNo: '', shop: '', itemId: '', variationId: '', claimStatus: '', createTimeFrom: '', createTimeTo: '' },
|
||||
query: { page: 1, pageSize: 20, orderSn: '', shop: '', claimStatus: '', createTimeFrom: '', createTimeTo: '' },
|
||||
detail: { open: false, loading: false, item: null },
|
||||
claimStatusOptions: [
|
||||
{ label: '未知(原样展示)', value: 'unknown' },
|
||||
@@ -116,9 +96,6 @@ export default {
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
canSync() { return (this.$store.getters.roles || []).some(role => role === 'admin' || role === 'purchaser') }
|
||||
},
|
||||
created() { this.load(); this.loadSummary() },
|
||||
methods: {
|
||||
claimStatusMeta(status) { return { pending: { label: '待认领', type: 'info' }, claimed: { label: '已认领', type: 'success' }, rejected: { label: '已拒绝', type: 'danger' }}[status] || { label: status || '—', type: 'info' } },
|
||||
@@ -156,7 +133,7 @@ export default {
|
||||
},
|
||||
reset() {
|
||||
this.createTimeRange = null
|
||||
this.query = { page: 1, pageSize: 20, orderSn: '', trackingNo: '', shop: '', itemId: '', variationId: '', claimStatus: '', createTimeFrom: '', createTimeTo: '' }
|
||||
this.query = { page: 1, pageSize: 20, orderSn: '', shop: '', claimStatus: '', createTimeFrom: '', createTimeTo: '' }
|
||||
this.load()
|
||||
},
|
||||
async openDetail(id) {
|
||||
@@ -167,21 +144,6 @@ export default {
|
||||
} finally {
|
||||
this.detail.loading = false
|
||||
}
|
||||
},
|
||||
goToSyncRuns() { this.$router.push({ path: '/yeeke-sync-runs/index' }) },
|
||||
async startManualSync() {
|
||||
if (!this.canSync || this.manualSyncStarting) return
|
||||
this.manualSyncStarting = true
|
||||
try {
|
||||
await triggerYeekeSync()
|
||||
ElMessage.success('已开始同步')
|
||||
await this.loadSummary()
|
||||
await this.load()
|
||||
} catch (error) {
|
||||
ElMessage.error(error?.response?.data?.message || error?.message || '同步启动失败')
|
||||
} finally {
|
||||
this.manualSyncStarting = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,6 @@
|
||||
<BasicLayout>
|
||||
<template #wrapper>
|
||||
<el-card class="page-card" shadow="never">
|
||||
<div class="page-heading">
|
||||
<div><h1>yeeke 同步记录</h1><p>查看每次 yeeke 退货包裹同步的触发方式、状态和统计;不展示凭据、token 或完整响应。</p></div>
|
||||
<el-button
|
||||
v-if="canSync"
|
||||
type="primary"
|
||||
:loading="manualSyncStarting"
|
||||
:disabled="manualSyncStarting"
|
||||
@click="startManualSync"
|
||||
>手动同步</el-button>
|
||||
</div>
|
||||
|
||||
<el-form :model="query" :inline="true" class="search-form" @submit.prevent="search">
|
||||
<el-form-item label="触发方式">
|
||||
<el-select v-model="query.trigger" clearable placeholder="全部" style="width:120px">
|
||||
@@ -27,6 +16,15 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间"><el-date-picker v-model="startedRange" type="daterange" value-format="YYYY-MM-DD" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" /></el-form-item>
|
||||
<el-form-item><el-button type="primary" :icon="Search" @click="search">查询</el-button><el-button :icon="RefreshLeft" @click="reset">重置</el-button></el-form-item>
|
||||
<el-form-item class="sync-action">
|
||||
<el-button
|
||||
v-if="canSync"
|
||||
type="primary"
|
||||
:loading="manualSyncStarting"
|
||||
:disabled="manualSyncStarting"
|
||||
@click="startManualSync"
|
||||
>手动同步</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-alert v-if="loadError" :title="loadError" type="error" show-icon :closable="false" class="notice"><template #default><el-button link type="primary" @click="load">重新加载</el-button></template></el-alert>
|
||||
@@ -121,6 +119,8 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-card{min-height:calc(100vh - 124px)}
|
||||
.sync-action{margin-left:auto}
|
||||
.search-form{display:flex;flex-wrap:wrap;align-items:center}
|
||||
.page-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}
|
||||
.page-heading h1{margin:0 0 6px;font-size:24px;color:#1f2937}
|
||||
.page-heading p{margin:0;color:#606266;line-height:1.5}
|
||||
|
||||
Reference in New Issue
Block a user