This commit is contained in:
van
2026-10-08 00:01:12 +08:00
parent a3686cf160
commit e6caaa40f0
2 changed files with 109 additions and 1 deletions
+20
View File
@@ -273,6 +273,26 @@ export function importGroupRebateExcelBatch(formData) {
return postGroupRebateMultipart('/system/jdorder/importGroupRebateExcelBatch', formData) return postGroupRebateMultipart('/system/jdorder/importGroupRebateExcelBatch', formData)
} }
/** 上传旧返现表,按订单号匹配后下载新表头 Excel */
export function convertRebateExcel(formData) {
return axios.post(process.env.VUE_APP_BASE_API + '/system/jdorder/convertRebateExcel', formData, {
headers: { Authorization: 'Bearer ' + getToken() },
responseType: 'blob',
transformRequest: [
(data, headers) => {
if (data instanceof FormData) {
if (headers && typeof headers.delete === 'function') {
headers.delete('Content-Type')
} else if (headers) {
delete headers['Content-Type']
}
}
return data
}
]
})
}
// 手动获取物流信息(用于调试) // 手动获取物流信息(用于调试)
export function fetchLogisticsManually(data) { export function fetchLogisticsManually(data) {
return request({ return request({
+89 -1
View File
@@ -200,6 +200,7 @@
<el-button v-if="!isMobile" class="jd-tb-muted" plain size="small" icon="el-icon-scissors" :loading="modelShopMigrateLoading" @click="handleMigrateModelShop" title="按已配置店铺选项,将型号末尾前缀拆到「型号店铺」字段">拆分型号店铺</el-button> <el-button v-if="!isMobile" class="jd-tb-muted" plain size="small" icon="el-icon-scissors" :loading="modelShopMigrateLoading" @click="handleMigrateModelShop" title="按已配置店铺选项,将型号末尾前缀拆到「型号店铺」字段">拆分型号店铺</el-button>
<el-button class="jd-tb-muted" plain size="small" icon="el-icon-check" @click="handleBatchMarkRebateReceived" :loading="batchMarkLoading" title="批量将赔付金额大于0的订单标记为后返到账(仅执行一次)">批量标记后返到账</el-button> <el-button class="jd-tb-muted" plain size="small" icon="el-icon-check" @click="handleBatchMarkRebateReceived" :loading="batchMarkLoading" title="批量将赔付金额大于0的订单标记为后返到账(仅执行一次)">批量标记后返到账</el-button>
<el-button v-if="!isMobile" type="primary" plain size="small" icon="el-icon-upload2" @click="rebateImportDialogVisible = true" title="可一次选多个 Excel,提交后由后台依次导入;详情见后返上传记录">导入后返表</el-button> <el-button v-if="!isMobile" type="primary" plain size="small" icon="el-icon-upload2" @click="rebateImportDialogVisible = true" title="可一次选多个 Excel,提交后由后台依次导入;详情见后返上传记录">导入后返表</el-button>
<el-button v-if="!isMobile" class="jd-tb-muted" plain size="small" icon="el-icon-document" @click="rebateConvertDialogVisible = true" title="上传旧返现表,按单号匹配订单后下载新表头">转换返现表</el-button>
<el-button v-if="!isMobile" class="jd-tb-muted" plain size="small" icon="el-icon-folder-opened" @click="openRebateUploadRecordDialog" title="查看历史上传的后返表原件并可重新下载">后返上传记录</el-button> <el-button v-if="!isMobile" class="jd-tb-muted" plain size="small" icon="el-icon-folder-opened" @click="openRebateUploadRecordDialog" title="查看历史上传的后返表原件并可重新下载">后返上传记录</el-button>
<!-- <el-button class="jd-tb-muted" plain size="small" icon="el-icon-sort" @click="handleReverseSyncThirdPartyOrderNo" :loading="reverseSyncLoading" title="从腾讯文档第850行开始,通过物流链接反向匹配订单,将腾讯文档的单号列值写入到订单的第三方单号字段">反向同步第三方单号</el-button> --> <!-- <el-button class="jd-tb-muted" plain size="small" icon="el-icon-sort" @click="handleReverseSyncThirdPartyOrderNo" :loading="reverseSyncLoading" title="从腾讯文档第850行开始,通过物流链接反向匹配订单,将腾讯文档的单号列值写入到订单的第三方单号字段">反向同步第三方单号</el-button> -->
<el-button v-if="!isMobile" type="primary" plain size="small" icon="el-icon-document-copy" @click="handleBatchCopyExcelText" :disabled="selectedRows.length === 0" title="批量复制选中订单的录单格式(Excel可粘贴)">批量复制录单格式</el-button> <el-button v-if="!isMobile" type="primary" plain size="small" icon="el-icon-document-copy" @click="handleBatchCopyExcelText" :disabled="selectedRows.length === 0" title="批量复制选中订单的录单格式(Excel可粘贴)">批量复制录单格式</el-button>
@@ -1362,6 +1363,40 @@
</el-form> </el-form>
</el-dialog> </el-dialog>
<!-- 旧返现表转新表头 -->
<el-dialog
title="转换返现表(旧表头 → 新表头)"
:visible.sync="rebateConvertDialogVisible"
width="560px"
append-to-body
@closed="onRebateConvertDialogClosed"
>
<p style="color: #909399; font-size: 13px; margin: 0 0 8px; line-height: 1.6;">
上传旧表(日期、单号、型号、总共返现),按单号匹配系统订单后下载新表。
</p>
<p style="color: #606266; font-size: 13px; margin: 0 0 12px; line-height: 1.7;">
数量取京粉订单件数,没有则按 1。实付价用订单付款金额。后返金额优先用表里的「总共返现」,没有再用订单后返金额。成本价 = 实付价 − 后返金额 + 额外成本。未匹配的行会在「匹配结果」列标出。
</p>
<el-upload
ref="rebateConvertUploader"
drag
:show-file-list="true"
:limit="1"
:auto-upload="false"
accept=".xlsx,.xls"
:disabled="rebateConvertLoading"
:on-exceed="onRebateConvertExceed"
>
<i class="el-icon-upload" />
<div class="el-upload__text">拖到此处,或<em>点击选择</em></div>
<div slot="tip" class="el-upload__tip">只处理第一个工作表</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="rebateConvertDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="rebateConvertLoading" @click="submitRebateConvert">转换并下载</el-button>
</div>
</el-dialog>
<!-- 后返表上传记录(含重新下载) --> <!-- 后返表上传记录(含重新下载) -->
<el-dialog <el-dialog
title="后返表上传记录" title="后返表上传记录"
@@ -1416,7 +1451,7 @@
</template> </template>
<script> <script>
import { listJDOrders, getJDOrder, updateJDOrder, normalizeJDOrderPutPayload, delJDOrder, fetchLogisticsManually, batchMarkRebateReceived, generateExcelText, importGroupRebateExcelBatch, listGroupRebateExcelUploads, deleteGroupRebateUpload, recalcProfitBatch, syncAutoProfitBatch, listQuickRecordShopOptions, migrateModelShopSplit } from '@/api/system/jdorder' import { listJDOrders, getJDOrder, updateJDOrder, normalizeJDOrderPutPayload, delJDOrder, fetchLogisticsManually, batchMarkRebateReceived, generateExcelText, importGroupRebateExcelBatch, convertRebateExcel, listGroupRebateExcelUploads, deleteGroupRebateUpload, recalcProfitBatch, syncAutoProfitBatch, listQuickRecordShopOptions, migrateModelShopSplit } from '@/api/system/jdorder'
import { fillLogisticsByOrderNo, getTokenStatus, getTencentDocAuthUrl, testUserInfo, getAutoWriteConfig, reverseSyncThirdPartyOrderNo } from '@/api/jarvis/tendoc' import { fillLogisticsByOrderNo, getTokenStatus, getTencentDocAuthUrl, testUserInfo, getAutoWriteConfig, reverseSyncThirdPartyOrderNo } from '@/api/jarvis/tendoc'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import ListLayout from '@/components/ListLayout' import ListLayout from '@/components/ListLayout'
@@ -1486,6 +1521,8 @@ export default {
rebateImportDialogVisible: false, rebateImportDialogVisible: false,
rebateImportTitle: '', rebateImportTitle: '',
rebateImportLoading: false, rebateImportLoading: false,
rebateConvertDialogVisible: false,
rebateConvertLoading: false,
rebateUploadRecordDialogVisible: false, rebateUploadRecordDialogVisible: false,
rebateUploadLoading: false, rebateUploadLoading: false,
rebateUploadList: [], rebateUploadList: [],
@@ -2161,6 +2198,57 @@ export default {
onRebateExcelExceed() { onRebateExcelExceed() {
this.$message.warning('单次最多选择 30 个文件') this.$message.warning('单次最多选择 30 个文件')
}, },
onRebateConvertDialogClosed() {
this.$nextTick(() => {
const u = this.$refs.rebateConvertUploader
if (u && typeof u.clearFiles === 'function') {
u.clearFiles()
}
})
},
onRebateConvertExceed() {
this.$message.warning('一次只转换一个文件')
},
submitRebateConvert() {
const u = this.$refs.rebateConvertUploader
const uploadFiles = (u && u.uploadFiles) ? u.uploadFiles : []
const file = uploadFiles.map((f) => f.raw).find(Boolean)
if (!file) {
this.$message.warning('请先选择 Excel 文件')
return
}
const formData = new FormData()
formData.append('file', file)
this.rebateConvertLoading = true
convertRebateExcel(formData)
.then(async (res) => {
const blob = res.data
const type = (blob && blob.type) || ''
if (type.indexOf('json') >= 0) {
const text = await blob.text()
let msg = '转换失败'
try {
const json = JSON.parse(text)
msg = json.msg || msg
} catch (e) { /* 保留默认文案 */ }
this.$message.error(msg)
return
}
const encodedName = res.headers['download-filename']
const filename = encodedName ? decodeURIComponent(encodedName) : '返现表-新表头.xlsx'
this.$download.saveAs(blob, filename)
const encodedSummary = res.headers['x-convert-summary']
const summary = encodedSummary ? decodeURIComponent(encodedSummary) : '已生成新表'
this.$message.success(summary)
this.rebateConvertDialogVisible = false
})
.catch((e) => {
this.$message.error((e && e.message) || '转换失败')
})
.finally(() => {
this.rebateConvertLoading = false
})
},
submitRebateExcelBatch() { submitRebateExcelBatch() {
const u = this.$refs.rebateExcelUploader const u = this.$refs.rebateExcelUploader
const uploadFiles = (u && u.uploadFiles) ? u.uploadFiles : [] const uploadFiles = (u && u.uploadFiles) ? u.uploadFiles : []