feat:添加订单销售统计
This commit is contained in:
1 parent
2c0490327a
commit
00f2b94b6a
3 files changed
+184
-1
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 订单销售统计查询参数
|
||||
export interface GetSalesStatisticsReqVO {
|
||||
pageNo?: number // 页码,从 1 开始
|
||||
pageSize?: number // 每页条数
|
||||
deviceId?: string // 设备IMEI
|
||||
barCode?: string // 物料编码
|
||||
spuName?: string // 商品名称
|
||||
createTime?: string[] // 创建时间范围
|
||||
}
|
||||
|
||||
// 订单销售统计响应接口
|
||||
export interface GetSalesStatisticsRes {
|
||||
list: {
|
||||
deviceId: string // 设备IMEI
|
||||
barCode: string // 物料编码
|
||||
spuName: string // 商品名称
|
||||
orderCount: number // 销售数量
|
||||
}[]
|
||||
total: number // 总量
|
||||
}
|
||||
|
||||
// 订单销售统计 API
|
||||
export const OrderSalesStatisticsApi = {
|
||||
// 获取订单销售统计数据
|
||||
getSalesStatistics: async (params: GetSalesStatisticsReqVO) => {
|
||||
return await request.get<GetSalesStatisticsRes>({
|
||||
url: '/trade/order/sales-statistics',
|
||||
params
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
import { SummaryApi, SummaryVO } from '@/api/product/summary'
|
||||
|
||||
/** 商品汇总 表单 */
|
||||
defineOptions({ name: 'SummaryForm' })
|
||||
defineOptions({ name: 'SummaryForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="设备IMEI" prop="deviceId">
|
||||
<el-input
|
||||
v-model="queryParams.deviceId"
|
||||
placeholder="请输入设备IMEI"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="barCode">
|
||||
<el-input
|
||||
v-model="queryParams.barCode"
|
||||
placeholder="请输入物料编码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="spuName">
|
||||
<el-input
|
||||
v-model="queryParams.spuName"
|
||||
placeholder="请输入商品名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="datetimerange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon icon="ep:search" class="mr-5px" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" class="mr-5px" />
|
||||
重置
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['trade:order:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" />
|
||||
导出
|
||||
</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" stripe>
|
||||
<el-table-column label="设备IMEI" align="center" prop="deviceId" min-width="120" />
|
||||
<el-table-column label="物料编码" align="center" prop="barCode" min-width="120" />
|
||||
<el-table-column label="商品名称" align="center" prop="spuName" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="销售数量" align="center" prop="orderCount" min-width="100">
|
||||
<template #default="scope">
|
||||
<el-tag type="success">{{ scope.row.orderCount }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { OrderSalesStatisticsApi } from '@/api/mall/trade/order/salesStatistics'
|
||||
import { GetSalesStatisticsReqVO } from '@/api/mall/trade/order/salesStatistics'
|
||||
import download from '@/utils/download'
|
||||
|
||||
/** 订单销售统计 */
|
||||
defineOptions({ name: 'OrderSalesStatistics' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
// const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<any[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive<GetSalesStatisticsReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
createTime: ['2025-01-01 00:00:00', '2026-01-01 23:59:59'],
|
||||
deviceId: undefined,
|
||||
barCode: undefined,
|
||||
spuName: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await OrderSalesStatisticsApi.getSalesStatistics(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
Reference in new issue
Block a user