1
This commit is contained in:
@@ -45,7 +45,10 @@
|
|||||||
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
<el-button type="warning" size="small" icon="el-icon-download" @click="handleExport" v-hasPermi="['system:jdorder:export']">导出</el-button>
|
<el-button type="warning" size="small" icon="el-icon-download" @click="handleExport" v-hasPermi="['system:jdorder:export']">导出</el-button>
|
||||||
<el-button type="success" size="small" icon="el-icon-setting" @click="showAutoWriteConfig = true" title="配置H-TF订单自动写入腾讯文档">H-TF自动写入配置</el-button>
|
<el-button type="success" size="small" icon="el-icon-setting" @click="showAutoWriteConfig = true" title="配置H-TF订单自动写入腾讯文档">H-TF自动写入配置</el-button>
|
||||||
<el-button type="info" size="small" icon="el-icon-user" @click="handleTestUserInfo" title="测试腾讯文档用户信息接口">测试用户信息</el-button>
|
<el-button type="primary" size="small" icon="el-icon-refresh-right" @click="handleBatchSyncLogistics" :loading="batchSyncLoading" title="批量同步物流链接到腾讯文档">
|
||||||
|
<i class="el-icon-refresh-right" v-if="!batchSyncLoading"></i>
|
||||||
|
批量同步物流
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
@@ -155,11 +158,8 @@
|
|||||||
<el-table-column label="完成时间" prop="finishTime" width="160">
|
<el-table-column label="完成时间" prop="finishTime" width="160">
|
||||||
<template slot-scope="scope">{{ parseTime(scope.row.finishTime) }}</template>
|
<template slot-scope="scope">{{ parseTime(scope.row.finishTime) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" width="240">
|
<el-table-column label="操作" fixed="right" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="mini" style="color: #409EFF;" @click="handleSyncLogistics(scope.row)">
|
|
||||||
同步物流
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
@@ -404,6 +404,8 @@ export default {
|
|||||||
tokenStatusChecked: false,
|
tokenStatusChecked: false,
|
||||||
// H-TF订单自动写入配置
|
// H-TF订单自动写入配置
|
||||||
showAutoWriteConfig: false,
|
showAutoWriteConfig: false,
|
||||||
|
// 批量同步loading状态
|
||||||
|
batchSyncLoading: false,
|
||||||
// 获取物流信息对话框
|
// 获取物流信息对话框
|
||||||
fetchLogisticsDialogVisible: false,
|
fetchLogisticsDialogVisible: false,
|
||||||
fetchLogisticsLoading: false,
|
fetchLogisticsLoading: false,
|
||||||
@@ -655,8 +657,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 同步物流到腾讯文档 */
|
/** 批量同步物流到腾讯文档 */
|
||||||
async handleSyncLogistics(row) {
|
async handleBatchSyncLogistics() {
|
||||||
try {
|
try {
|
||||||
// 先检查配置是否完整
|
// 先检查配置是否完整
|
||||||
const configRes = await getAutoWriteConfig()
|
const configRes = await getAutoWriteConfig()
|
||||||
@@ -669,25 +671,57 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认同步
|
const config = configRes.data
|
||||||
await this.$confirm(
|
|
||||||
`将从配置的腾讯文档中搜索并填充物流链接,是否继续?\n\n` +
|
|
||||||
`文档: ${configRes.data.fileId}\n` +
|
|
||||||
`工作表: ${configRes.data.sheetId}\n` +
|
|
||||||
`数据起始行: ${configRes.data.startRow}`,
|
|
||||||
'同步物流确认',
|
|
||||||
{ type: 'info' }
|
|
||||||
)
|
|
||||||
|
|
||||||
this.syncLogisticsLoading = true
|
// 构建确认消息
|
||||||
// 直接同步,不需要打开对话框
|
let confirmMsg = '批量同步将从腾讯文档中搜索订单并填充物流链接\n\n'
|
||||||
await this.handleSyncLogisticsSubmit()
|
confirmMsg += `文档: ${config.fileId}\n`
|
||||||
|
confirmMsg += `工作表: ${config.sheetId}\n`
|
||||||
|
confirmMsg += `表头行: ${config.headerRow}\n`
|
||||||
|
confirmMsg += `数据起始行: ${config.startRow}\n`
|
||||||
|
|
||||||
|
if (config.currentProgress) {
|
||||||
|
confirmMsg += `\n当前进度: 第 ${config.currentProgress} 行\n`
|
||||||
|
confirmMsg += config.progressHint + '\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
confirmMsg += `\n防重推送: ${config.skipPushedOrders ? '已启用(跳过已推送订单)' : '已禁用'}\n`
|
||||||
|
confirmMsg += '\n⚠️ 注意:\n'
|
||||||
|
confirmMsg += '- 系统会自动跳过已有物流链接的行\n'
|
||||||
|
confirmMsg += '- 系统会自动跳过已标记为"已推送"的订单\n'
|
||||||
|
confirmMsg += '- 所有操作都会记录到操作日志\n'
|
||||||
|
|
||||||
|
// 确认同步
|
||||||
|
await this.$confirm(confirmMsg, '批量同步物流确认', {
|
||||||
|
type: 'info',
|
||||||
|
confirmButtonText: '开始同步',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
})
|
||||||
|
|
||||||
|
this.batchSyncLoading = true
|
||||||
|
|
||||||
|
// 调用批量同步API
|
||||||
|
const res = await fillLogisticsByOrderNo({})
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
const data = res.data || {}
|
||||||
|
this.$notify({
|
||||||
|
title: '批量同步完成',
|
||||||
|
message: `✓ 成功填充: ${data.filledCount || 0} 条\n⊙ 跳过: ${data.skippedCount || 0} 条\n✗ 错误: ${data.errorCount || 0} 条\n\n${data.message || ''}`,
|
||||||
|
type: 'success',
|
||||||
|
duration: 10000,
|
||||||
|
dangerouslyUseHTMLString: false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg || '同步失败')
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e !== 'cancel') {
|
if (e !== 'cancel') {
|
||||||
this.$message.error('操作失败:' + (e.message || '未知错误'))
|
this.$message.error('操作失败:' + (e.message || '未知错误'))
|
||||||
|
console.error('批量同步失败', e)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.syncLogisticsLoading = false
|
this.batchSyncLoading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user