同步货品

This commit is contained in:
zhonghua.li
2026-06-09 22:38:07 +08:00
parent 25741c6636
commit 3ddfc1c0ff
3 changed files with 52 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ export function syncLbOrderRowFromThird(data) {
})
}
/** 按购买时间区间、租户 id 按日汇总生成 sum_data */
/** 按购买时间区间、租户 id 生成汇总dataType: sum_data 汇总天数据 / day_stat 人天统计 */
export function generateLbOrderRowDailySum(data) {
return request({
url: '/lbOrderRow/generate-daily-sum',

View File

@@ -12,6 +12,7 @@
<el-select v-model="queryParams.dataType" clearable placeholder="请选择数据类型" style="width: 140px">
<el-option label="明细" value="detail_data" />
<el-option label="汇总" value="sum_data" />
<el-option label="人天统计" value="day_stat" />
</el-select>
</el-form-item>
<el-form-item label="状态">
@@ -60,8 +61,9 @@
<el-table-column label="卖家姓名" prop="sellerName" min-width="100" show-overflow-tooltip />
<el-table-column label="卖家电话" prop="sellerPhone" min-width="110" show-overflow-tooltip />
<el-table-column label="总金额" prop="totalMoney" min-width="100" show-overflow-tooltip />
<el-table-column label="当天未寄卖单数" prop="todayUnresellCount" min-width="130" align="center" />
<el-table-column label="当天交易单数" prop="todayOrderCount" min-width="120" align="center" />
<el-table-column label="平均金额" prop="avgAmt" min-width="100" show-overflow-tooltip />
<el-table-column label="当天未寄卖单数" prop="todayUnresellCount" min-width="130" align="center" />
<el-table-column label="是否寄卖" min-width="100" align="center">
<template slot-scope="scope">
{{ formatIsResellLabel(scope.row) }}
@@ -263,6 +265,12 @@
<el-form-item label="租户ID" prop="tenantId">
<el-input v-model="dailySumForm.tenantId" clearable placeholder="请输入租户ID" />
</el-form-item>
<el-form-item label="统计类型" prop="dataType">
<el-select v-model="dailySumForm.dataType" placeholder="请选择统计类型" style="width: 100%">
<el-option label="汇总天数据" value="sum_data" />
<el-option label="人天统计" value="day_stat" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dailySumDialogVisible = false">取消</el-button>
@@ -410,7 +418,8 @@ export default {
dailySumSubmitLoading: false,
dailySumForm: {
buyTimeRange: null,
tenantId: ''
tenantId: '',
dataType: 'sum_data'
},
dailySumFormRules: {
buyTimeRange: [
@@ -418,6 +427,9 @@ export default {
],
tenantId: [
{ required: true, message: '请填写租户ID', trigger: 'blur' }
],
dataType: [
{ required: true, message: '请选择统计类型', trigger: 'change' }
]
},
dingTalkConfirmDialogVisible: false,
@@ -768,7 +780,8 @@ export default {
openDailySumDialog() {
this.dailySumForm = {
buyTimeRange: null,
tenantId: this.getTenantIdFromBusinessHeaders()
tenantId: this.getTenantIdFromBusinessHeaders(),
dataType: 'sum_data'
}
this.dailySumDialogVisible = true
this.$nextTick(() => {
@@ -778,7 +791,8 @@ export default {
resetDailySumForm() {
this.dailySumForm = {
buyTimeRange: null,
tenantId: ''
tenantId: '',
dataType: 'sum_data'
}
this.$refs.dailySumFormRef && this.$refs.dailySumFormRef.resetFields()
},
@@ -798,7 +812,8 @@ export default {
const payload = {
buyTimeStart: range[0],
buyTimeEnd: range[1],
tenantId
tenantId,
dataType: this.dailySumForm.dataType
}
this.dailySumSubmitLoading = true
generateLbOrderRowDailySum(payload)

View File

@@ -55,6 +55,15 @@
<el-card class="action-container" shadow="never">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
<el-button
type="warning"
icon="el-icon-refresh"
:loading="syncLoading"
style="margin-left: 12px"
@click="handleSyncFromHxr"
>
同步货品
</el-button>
<el-button
type="danger"
icon="el-icon-shopping-cart-full"
@@ -286,6 +295,7 @@ import {
rushBuyLbBuyAccount,
updateLbBuyAccount
} from '@/api/lb-buy-account'
import { syncLbGoodsFromHxr } from '@/api/lb-goods'
import { getAllTenantList } from '@/api/tenant'
import { getBusinessHeaders } from '@/utils/business-headers'
@@ -320,6 +330,7 @@ export default {
return {
loading: false,
submitLoading: false,
syncLoading: false,
rushBuyLoading: false,
tenantLoading: false,
list: [],
@@ -388,6 +399,26 @@ export default {
handleSelectionChange(selection) {
this.multipleSelection = selection
},
handleSyncFromHxr() {
const tenantId = (this.queryParams.tenantId || '').trim() || this.getTenantIdFromBusinessHeaders()
if (!tenantId) {
this.$message.error('未获取到租户ID请先选择租户或配置业务请求头中的租户')
return
}
this.syncLoading = true
syncLbGoodsFromHxr({ tenantId })
.then((res) => {
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
if (!isSuccess) {
this.$message.error((res && res.message) || '同步货品失败')
return
}
this.$message.success((res && res.message) || '同步货品成功')
})
.finally(() => {
this.syncLoading = false
})
},
handleRushBuy() {
if (!this.multipleSelection.length) {
this.$message.warning('请先勾选要抢单的账号')