Compare commits

...

2 Commits

Author SHA1 Message Date
van
19de22f1ed 1 2026-06-10 17:18:38 +08:00
van
42aeb7b232 1 2026-06-10 17:18:34 +08:00
3 changed files with 69 additions and 7 deletions

View File

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

View File

@@ -21,6 +21,7 @@
<img
:src="item.shopLogo || defaultLogo"
class="shopinfo-logo"
referrerpolicy="no-referrer"
@error="onLogoError"
>
<div class="shopinfo-name">{{ item.shopName }}</div>
@@ -43,10 +44,11 @@
</div>
<div class="info-body">
<img
v-if="item.skuImageUrl"
v-if="item.skuImageUrl && !item._imgFailed"
:src="item.skuImageUrl"
class="info-img"
@error="onImageError"
referrerpolicy="no-referrer"
@error="onImageError(item, $event)"
>
<div v-else class="info-img-placeholder">🖼</div>
<div class="info-cell">
@@ -126,8 +128,21 @@ export default {
onLogoError(e) {
e.target.src = this.defaultLogo
},
onImageError(e) {
e.target.style.display = 'none'
onImageError(item, e) {
const tryCount = item._imgTry || 0
const fallbacks = item.skuId
? [
`https://img14.360buyimg.com/n5/s450x450_${item.skuId}.jpg`,
`https://img10.360buyimg.com/n1/s450x450_${item.skuId}.jpg`,
`https://img14.360buyimg.com/n1/s240x240_${item.skuId}.jpg`
]
: []
if (tryCount < fallbacks.length) {
this.$set(item, '_imgTry', tryCount + 1)
e.target.src = fallbacks[tryCount]
return
}
this.$set(item, '_imgFailed', true)
}
}
}

View File

@@ -150,6 +150,16 @@
<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-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>
</el-row>
</div>
@@ -330,7 +340,7 @@
</template>
<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 { mapGetters } from 'vuex'
import * as echarts from 'echarts'
@@ -351,6 +361,7 @@ export default {
return {
// 遮罩层
loading: true,
backfillLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -428,7 +439,8 @@ export default {
{ 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: '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
}, `京粉订单数据_${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() {
this.showStatistics = !this.showStatistics;