This commit is contained in:
van
2026-06-10 17:18:38 +08:00
parent 42aeb7b232
commit 19de22f1ed
2 changed files with 50 additions and 3 deletions

View File

@@ -59,3 +59,13 @@ export function getOrderStatistics(query) {
params: query params: query
}) })
} }
// 回填订单商品图、店铺名goodsInfo
export function backfillGoodsInfo(data) {
return request({
url: '/system/jdorder/orderRows/backfillGoodsInfo',
method: 'post',
data: data,
timeout: 300000
})
}

View File

@@ -150,6 +150,16 @@
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:orderrows:export']">导出</el-button> <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:orderrows:export']">导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-picture-outline"
size="mini"
:loading="backfillLoading"
@click="handleBackfillGoodsInfo"
>一键补全商品图</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
</div> </div>
@@ -330,7 +340,7 @@
</template> </template>
<script> <script>
import { listOrderrows, getOrderrows, delOrderrows, addOrderrows, updateOrderrows, getValidCodeSelectData } from "@/api/system/orderrows"; import { listOrderrows, getOrderrows, delOrderrows, addOrderrows, updateOrderrows, getValidCodeSelectData, backfillGoodsInfo } from "@/api/system/orderrows";
import { getAdminSelectData } from "@/api/system/superadmin"; import { getAdminSelectData } from "@/api/system/superadmin";
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import * as echarts from 'echarts' import * as echarts from 'echarts'
@@ -351,6 +361,7 @@ export default {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
backfillLoading: false,
// 选中数组 // 选中数组
ids: [], ids: [],
// 非单个禁用 // 非单个禁用
@@ -428,7 +439,8 @@ export default {
{ key: 'add', label: '新增', type: 'primary', icon: 'el-icon-plus', handler: () => this.handleAdd(), disabled: false }, { key: 'add', label: '新增', type: 'primary', icon: 'el-icon-plus', handler: () => this.handleAdd(), disabled: false },
{ key: 'update', label: '修改', type: 'success', icon: 'el-icon-edit', handler: () => this.handleUpdate(), disabled: this.single }, { key: 'update', label: '修改', type: 'success', icon: 'el-icon-edit', handler: () => this.handleUpdate(), disabled: this.single },
{ key: 'delete', label: '删除', type: 'danger', icon: 'el-icon-delete', handler: () => this.handleDelete(), disabled: this.multiple }, { key: 'delete', label: '删除', type: 'danger', icon: 'el-icon-delete', handler: () => this.handleDelete(), disabled: this.multiple },
{ key: 'export', label: '导出', type: 'warning', icon: 'el-icon-download', handler: () => this.handleExport(), disabled: false } { key: 'export', label: '导出', type: 'warning', icon: 'el-icon-download', handler: () => this.handleExport(), disabled: false },
{ key: 'backfill', label: '补全商品图', type: 'info', icon: 'el-icon-picture-outline', handler: () => this.handleBackfillGoodsInfo(), disabled: this.backfillLoading }
] ]
} }
}, },
@@ -839,6 +851,31 @@ export default {
...this.queryParams ...this.queryParams
}, `京粉订单数据_${new Date().getTime()}.xlsx`) }, `京粉订单数据_${new Date().getTime()}.xlsx`)
}, },
/** 一键补全商品图、店铺名 */
handleBackfillGoodsInfo() {
const orderId = this.queryParams.orderId && String(this.queryParams.orderId).trim()
const tip = orderId
? `将为订单号 ${orderId} 从京东补全商品图和店铺名,是否继续?`
: '将自动补全最近 100 条缺失商品图/店铺名的订单(可多次点击直到补完),是否继续?'
this.$modal.confirm(tip).then(() => {
this.backfillLoading = true
const payload = orderId ? { orderIds: orderId } : { missing: true, limit: 100 }
return backfillGoodsInfo(payload)
}).then(res => {
const data = (res && res.data) || {}
const updated = data.updated != null ? data.updated : 0
const skipped = data.skipped != null ? data.skipped : 0
const failed = data.failed != null ? data.failed : 0
if (failed > 0) {
this.$modal.msgWarning(`补全完成:成功 ${updated},跳过 ${skipped},失败 ${failed}`)
} else {
this.$modal.msgSuccess(`补全完成:成功 ${updated},跳过 ${skipped}`)
}
this.getList()
}).catch(() => {}).finally(() => {
this.backfillLoading = false
})
},
/** 切换统计显示 */ /** 切换统计显示 */
toggleStatistics() { toggleStatistics() {
this.showStatistics = !this.showStatistics; this.showStatistics = !this.showStatistics;