1
This commit is contained in:
@@ -163,6 +163,44 @@
|
|||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 刷新物流:结果弹窗(与京东订单页一致,用 append-to-body 避免被表格区裁剪) -->
|
||||||
|
<el-dialog
|
||||||
|
title="刷新物流结果"
|
||||||
|
:visible.sync="refreshLogisticsDialogVisible"
|
||||||
|
width="640px"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@closed="onRefreshLogisticsDialogClosed"
|
||||||
|
>
|
||||||
|
<div v-loading="refreshLogisticsLoading">
|
||||||
|
<p v-if="refreshLogisticsOrderNo" class="goofish-rl-order">闲鱼订单号:<code>{{ refreshLogisticsOrderNo }}</code></p>
|
||||||
|
<el-alert
|
||||||
|
v-if="refreshLogisticsError"
|
||||||
|
:title="refreshLogisticsError"
|
||||||
|
type="error"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 12px;"
|
||||||
|
/>
|
||||||
|
<template v-else-if="!refreshLogisticsLoading && refreshLogisticsAfter">
|
||||||
|
<el-alert
|
||||||
|
:title="refreshLogisticsHasDiff ? '已拉取详情并合并字段,下列有变化' : '已拉取详情,运单/快递等展示字段与刷新前一致'"
|
||||||
|
:type="refreshLogisticsHasDiff ? 'success' : 'info'"
|
||||||
|
:closable="false"
|
||||||
|
style="margin-bottom: 12px;"
|
||||||
|
/>
|
||||||
|
<el-table :data="refreshLogisticsCompareRows" size="small" border stripe>
|
||||||
|
<el-table-column prop="label" label="字段" width="120" />
|
||||||
|
<el-table-column prop="before" label="刷新前" min-width="160" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="after" label="刷新后" min-width="160" show-overflow-tooltip />
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="refreshLogisticsDialogVisible = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog title="订单详情 JSON(含开放平台原始返回)" :visible.sync="jsonOpen" width="900px" append-to-body>
|
<el-dialog title="订单详情 JSON(含开放平台原始返回)" :visible.sync="jsonOpen" width="900px" append-to-body>
|
||||||
<el-tabs v-model="jsonTab" @tab-click="onJsonTabClick">
|
<el-tabs v-model="jsonTab" @tab-click="onJsonTabClick">
|
||||||
<el-tab-pane label="摘要" name="sum">
|
<el-tab-pane label="摘要" name="sum">
|
||||||
@@ -243,7 +281,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listGoofishOrder, listGoofishOrderEventLogs, pullAllGoofishOrders, pullAllGoofishOrdersFull, pullGoofishOrdersFull, refreshGoofishDetail, retryGoofishShip } from '@/api/jarvis/goofish'
|
import { listGoofishOrder, listGoofishOrderEventLogs, pullAllGoofishOrders, pullAllGoofishOrdersFull, pullGoofishOrdersFull, refreshGoofishDetail, retryGoofishShip, getGoofishOrder } from '@/api/jarvis/goofish'
|
||||||
import { parseTime } from '@/utils/ruoyi'
|
import { parseTime } from '@/utils/ruoyi'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -276,13 +314,52 @@ export default {
|
|||||||
jsonTab: 'sum',
|
jsonTab: 'sum',
|
||||||
jsonRow: {},
|
jsonRow: {},
|
||||||
eventLogs: [],
|
eventLogs: [],
|
||||||
eventLogsLoading: false
|
eventLogsLoading: false,
|
||||||
|
/** 刷新物流结果弹窗 */
|
||||||
|
refreshLogisticsDialogVisible: false,
|
||||||
|
refreshLogisticsLoading: false,
|
||||||
|
refreshLogisticsOrderNo: '',
|
||||||
|
refreshLogisticsBefore: null,
|
||||||
|
refreshLogisticsAfter: null,
|
||||||
|
refreshLogisticsError: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
refreshLogisticsCompareRows() {
|
||||||
|
const b = this.refreshLogisticsBefore
|
||||||
|
const a = this.refreshLogisticsAfter
|
||||||
|
if (!a && !b) return []
|
||||||
|
const cell = (row, key, fmt) => {
|
||||||
|
if (fmt) {
|
||||||
|
return fmt(row) || '—'
|
||||||
|
}
|
||||||
|
if (!row || row[key] == null || row[key] === '') return '—'
|
||||||
|
return String(row[key])
|
||||||
|
}
|
||||||
|
const rows = [
|
||||||
|
{ label: '平台运单', before: cell(b, 'detailWaybillNo'), after: cell(a, 'detailWaybillNo') },
|
||||||
|
{ label: '快递编码', before: cell(b, 'detailExpressCode'), after: cell(a, 'detailExpressCode') },
|
||||||
|
{ label: '快递名称', before: cell(b, 'detailExpressName'), after: cell(a, 'detailExpressName') },
|
||||||
|
{ label: '本地运单', before: cell(b, 'localWaybillNo'), after: cell(a, 'localWaybillNo') },
|
||||||
|
{ label: '订单状态', before: cell(b, null, r => this.orderStatusLabel(r && r.orderStatus)), after: cell(a, null, r => this.orderStatusLabel(r && r.orderStatus)) },
|
||||||
|
{ label: '发货展示', before: cell(b, null, r => this.shipDisplayLabel(r)), after: cell(a, null, r => this.shipDisplayLabel(r)) }
|
||||||
|
]
|
||||||
|
return rows
|
||||||
|
},
|
||||||
|
refreshLogisticsHasDiff() {
|
||||||
|
return this.refreshLogisticsCompareRows.some(r => r.before !== r.after)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onRefreshLogisticsDialogClosed() {
|
||||||
|
this.refreshLogisticsBefore = null
|
||||||
|
this.refreshLogisticsAfter = null
|
||||||
|
this.refreshLogisticsError = ''
|
||||||
|
this.refreshLogisticsOrderNo = ''
|
||||||
|
},
|
||||||
orderStatusLabel(s) {
|
orderStatusLabel(s) {
|
||||||
const o = this.orderStatusOptions.find(x => x.v === s)
|
const o = this.orderStatusOptions.find(x => x.v === s)
|
||||||
return o ? o.l : (s == null ? '-' : String(s))
|
return o ? o.l : (s == null ? '-' : String(s))
|
||||||
@@ -569,17 +646,33 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
},
|
},
|
||||||
/** 与「刷新详情」同源接口:向闲管家拉取订单详情并合并运单号、快递公司等到列表字段 */
|
/** 与「刷新详情」同源:拉闲管家详情并合并运单/快递;弹窗展示刷新前后对比 */
|
||||||
handleRefreshLogistics(row) {
|
handleRefreshLogistics(row) {
|
||||||
if (!row || !row.id) return
|
if (!row || !row.id) return
|
||||||
const ld = this.$loading({ lock: true, text: '正在从闲管家同步运单与快递信息…' })
|
this.refreshLogisticsDialogVisible = true
|
||||||
|
this.refreshLogisticsLoading = true
|
||||||
|
this.refreshLogisticsError = ''
|
||||||
|
this.refreshLogisticsAfter = null
|
||||||
|
this.refreshLogisticsOrderNo = row.orderNo || ''
|
||||||
|
this.refreshLogisticsBefore = { ...row }
|
||||||
refreshGoofishDetail(row.id)
|
refreshGoofishDetail(row.id)
|
||||||
.then(() => {
|
.then(() => getGoofishOrder(row.id))
|
||||||
this.$modal.msgSuccess('已更新运单与快递信息')
|
.then(res => {
|
||||||
|
this.refreshLogisticsAfter = res && res.data ? { ...res.data } : null
|
||||||
|
if (!this.refreshLogisticsAfter) {
|
||||||
|
this.refreshLogisticsError = '刷新成功但未拿到订单详情,请稍后重试或看列表是否已更新'
|
||||||
|
} else {
|
||||||
|
this.$modal.msgSuccess('已更新运单与快递信息')
|
||||||
|
}
|
||||||
this.getList()
|
this.getList()
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(e => {
|
||||||
.finally(() => { ld.close() })
|
const msg = (e && e.response && e.response.data && e.response.data.msg) || (e && e.message) || '请求失败,请检查网络或后台日志'
|
||||||
|
this.refreshLogisticsError = String(msg)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.refreshLogisticsLoading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handleRetryShip(row) {
|
handleRetryShip(row) {
|
||||||
retryGoofishShip(row.id).then(() => {
|
retryGoofishShip(row.id).then(() => {
|
||||||
@@ -610,6 +703,17 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.goofish-rl-order {
|
||||||
|
margin: 0 0 12px 0;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
.goofish-rl-order code {
|
||||||
|
background: #f4f4f5;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
.event-log-hint {
|
.event-log-hint {
|
||||||
margin: 0 0 8px 0;
|
margin: 0 0 8px 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -873,11 +873,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</list-layout>
|
</list-layout>
|
||||||
|
|
||||||
<!-- 获取物流信息对话框 -->
|
<!-- 获取物流信息对话框(挂到 body,避免被 ListLayout overflow/层叠上下文裁切导致「只见消息不见窗」) -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="刷新物流信息"
|
title="刷新物流信息"
|
||||||
:visible.sync="fetchLogisticsDialogVisible"
|
:visible.sync="fetchLogisticsDialogVisible"
|
||||||
width="800px"
|
width="800px"
|
||||||
|
append-to-body
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<div v-loading="fetchLogisticsLoading">
|
<div v-loading="fetchLogisticsLoading">
|
||||||
@@ -2316,18 +2317,24 @@ export default {
|
|||||||
|
|
||||||
/** 手动获取物流信息 */
|
/** 手动获取物流信息 */
|
||||||
async handleFetchLogistics(row) {
|
async handleFetchLogistics(row) {
|
||||||
|
if (!row || !row.id) {
|
||||||
|
|
||||||
// 检查物流链接
|
|
||||||
if (!row.logisticsLink || !row.logisticsLink.trim()) {
|
|
||||||
this.$message.warning('该订单暂无物流链接')
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fetchLogisticsDialogVisible = true
|
this.fetchLogisticsDialogVisible = true
|
||||||
this.fetchLogisticsLoading = true
|
this.fetchLogisticsLoading = true
|
||||||
this.fetchLogisticsResult = null
|
this.fetchLogisticsResult = null
|
||||||
|
|
||||||
|
if (!row.logisticsLink || !row.logisticsLink.trim()) {
|
||||||
|
this.fetchLogisticsLoading = false
|
||||||
|
this.fetchLogisticsResult = {
|
||||||
|
success: false,
|
||||||
|
error: '该订单暂无物流链接,无法调用扫描服务。请先补充物流链接后再试。',
|
||||||
|
orderId: row.id,
|
||||||
|
orderNo: row.orderId
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetchLogisticsManually({ orderId: row.id })
|
const res = await fetchLogisticsManually({ orderId: row.id })
|
||||||
|
|
||||||
@@ -2340,14 +2347,18 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.fetchLogisticsResult = {
|
this.fetchLogisticsResult = {
|
||||||
success: false,
|
success: false,
|
||||||
error: res.msg || '获取失败'
|
error: res.msg || '获取失败',
|
||||||
|
orderId: row.id,
|
||||||
|
orderNo: row.orderId
|
||||||
}
|
}
|
||||||
this.$message.error(res.msg || '获取物流信息失败')
|
this.$message.error(res.msg || '获取物流信息失败')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.fetchLogisticsResult = {
|
this.fetchLogisticsResult = {
|
||||||
success: false,
|
success: false,
|
||||||
error: e.message || '请求异常'
|
error: e.message || '请求异常',
|
||||||
|
orderId: row.id,
|
||||||
|
orderNo: row.orderId
|
||||||
}
|
}
|
||||||
this.$message.error('获取物流信息失败: ' + (e.message || '未知错误'))
|
this.$message.error('获取物流信息失败: ' + (e.message || '未知错误'))
|
||||||
console.error('获取物流信息失败', e)
|
console.error('获取物流信息失败', e)
|
||||||
|
|||||||
Reference in New Issue
Block a user