订单记录部门查询

This commit is contained in:
weiwei committed 2025-07-22 11:26:37 +08:00
1 parent 916bb2e466
commit d0fee85f00
1 file changed
+311 -252
+311 -252
View File
@@ -1,228 +1,288 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
<el-form-item style="width: 300px" label="用户" prop="userIds">
<select-user v-model="state.queryForm.userIds" />
</el-form-item>
<el-form-item style="width: 300px" label="商户类型" prop="merchantType">
<dict-select v-model="state.queryForm.merchantType" dict-code="merchant_type" />
</el-form-item>
<el-form-item style="width: 300px" label="商户" prop="mchIds">
<select-mch v-model="state.queryForm.mchIds" :apiParams="{ parentIsNull: false }" />
</el-form-item>
<el-form-item style="width: 300px" label="设备类型" prop="hardTypeCode">
<dict-select v-model="state.queryForm.hardTypeCode" dict-code="hard_type" />
</el-form-item>
<el-form-item style="width: 300px" label="用户部门" prop="deptId">
<select-dept v-model="state.queryForm.deptId" />
</el-form-item>
<el-form-item style="width: 300px" label="用餐时间段" prop="hourType">
<dict-select v-model="state.queryForm.hourType" dict-code="daily_menu" />
</el-form-item>
<el-form-item style="width: 300px" label="订单状态" prop="orderStatus">
<dict-select v-model="state.queryForm.orderStatus" dict-code="hard_order_status" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
}}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
</el-form-item>
</el-row>
</el-form>
<div class="flex justify-between items-center">
<el-tabs class="flex-1" v-if="tabList && tabList.length" v-model="activeName" @tab-click="handleClick">
<div v-for="v in tabList" :key="v.value">
<el-tab-pane :label="v.label" :name="v.value">
<div></div>
</el-tab-pane>
<DraggableDepTree
ref="draggableDepTreeRef"
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
<el-form-item style="width: 300px" label="用户" prop="userIds">
<select-user v-model="state.queryForm.userIds" />
</el-form-item>
<el-form-item style="width: 300px" label="商户类型" prop="merchantType">
<dict-select v-model="state.queryForm.merchantType" dict-code="merchant_type" />
</el-form-item>
<el-form-item style="width: 300px" label="商户" prop="mchIds">
<select-mch v-model="state.queryForm.mchIds" :apiParams="{ parentIsNull: false }" />
</el-form-item>
<el-form-item style="width: 300px" label="设备类型" prop="hardTypeCode">
<dict-select v-model="state.queryForm.hardTypeCode" dict-code="hard_type" />
</el-form-item>
<el-form-item style="width: 300px" label="用户部门" prop="deptId">
<select-dept v-model="state.queryForm.deptId" />
</el-form-item>
<el-form-item style="width: 300px" label="用餐时间段" prop="hourType">
<dict-select v-model="state.queryForm.hourType" dict-code="daily_menu" />
</el-form-item>
<el-form-item style="width: 300px" label="订单状态" prop="orderStatus">
<dict-select v-model="state.queryForm.orderStatus" dict-code="hard_order_status" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
</el-form-item>
</el-row>
</el-form>
<div class="flex justify-between items-center">
<el-tabs class="flex-1" v-if="tabList && tabList.length" v-model="activeName" @tab-click="handleClick">
<div v-for="v in tabList" :key="v.value">
<el-tab-pane :label="v.label" :name="v.value">
<div></div>
</el-tab-pane>
</div>
</el-tabs>
<right-toolbar
v-model:showSearch="showSearch"
:export="'sys_audit_export'"
@exportExcel="exportExcel"
class="ml10"
style="float: right; margin-right: 20px"
@queryTable="getDataList"
/>
</div>
</el-tabs>
<right-toolbar v-model:showSearch="showSearch" :export="'sys_audit_export'" @exportExcel="exportExcel"
class="ml10" style="float: right; margin-right: 20px" @queryTable="getDataList" />
</div>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle" :show-summary="false" :summary-method="getSummaries">
<el-table-column type="selection" width="60" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column width="200" label="用户">
<template #default="{ row }">
<div v-if="row.userId && row.userId != -1" class="flex flex-row items-center justify-center">
<preview-image width="50px" height="50px" :src="row.userAvatar" />
<div
class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
</div>
<div v-else>
<span>未知用户</span>
</div>
</template>
</el-table-column>
<el-table-column width="200px" label="商品">
<template #default="{ row }">
<div class="desc">
<span>商品</span>
<el-tooltip :content="row.productDesc" placement="top-start">
<span class="text-line">{{ row.productDesc }}</span>
</el-tooltip>
</div>
<div class="status" v-if="row.hourType">
<span>用餐时间段</span>
<span>
<dict-tag :options="daily_menu" :value="row.hourType" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="设备信息">
<template #default="{ row }">
<div class="status">
<span>商户</span>
<span>
{{ row.merchantName }}
</span>
</div>
<div class="status">
<span>设备名</span>
<span>
{{ row.hardName }}
</span>
</div>
<div class="status">
<span>设备类型</span>
<span>
<dict-tag :options="hard_type" :value="row.hardType" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="订单信息">
<template #default="{ row }">
<div class="status">
<span>订单类型</span>
<span>
<dict-tag :options="hard_order_type" :value="row.orderType" />
</span>
</div>
<div class="status">
<span>支付方式</span>
<span>
<dict-tag :options="hard_pay_type" :value="row.payType" />
</span>
</div>
<div class="status">
<span>订单状态</span>
<span>
<dict-tag :options="hard_order_status" :value="row.orderStatus" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="200px" prop="paymentInformation" label="付款信息">
<template #default="{ row }">
<div class="status">
<span>商品总价</span>
<span class="color-success">
{{ displayPrice(row.totalPrice, "元", 2) }}
</span>
</div>
<div class="status">
<span>额外支付</span>
<span class="color-danger">
{{ displayPrice(row.extraPrice, "元", 2) }}
</span>
</div>
<div class="status">
<span>实际支付</span>
<span class="color-primary">
{{ displayPrice(row.payPrice, "元", 2) }}
</span>
</div>
</template>
</el-table-column>
<el-table-column width="270px" label="退款信息">
<template #default="{ row }">
<div v-if="row.payRefundId">
<div class="status">
<span>退款金额</span>
<span class="color-success">
{{ displayPrice(row.refundPrice, "元", 2) }}
</span>
</div>
<div class="status">
<span>退款状态</span>
<span class="color-success">
<dict-tag :options="hard_refund_status" :value="row.refundStatus" />
</span>
</div>
<div class="status">
<span>退款时间</span>
<span>
{{ row.refundTime }}
</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="支付时间" align="center" prop="payTime" width="250px">
<template #default="{ row }">
<div class="status">
<span>创建时间</span>
<span>{{ row.createTime }} </span>
</div>
<div class="status">
<span>支付时间</span>
<span>{{ row.payTime }} </span>
</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="200">
<template #default="{ row }">
<div class="grid grid-cols-2 justify-evenly">
<el-button v-if="row.orderType !== '5'" icon="Printer" text type="primary"
@click="print(row)" v-auth="'hard_hardInvoice_admin_print'">
打印发票
</el-button>
<el-button v-if="row.orderType !== '5'" icon="ShoppingCartFull" text type="primary"
@click="shopCarDialogRef.openDialog(row.id)">
购物车
</el-button>
<el-button icon="Money" link type="primary" v-if="row.userId && row.userId != '-1'"
@click="transactionListRef.openDialog(row.walletId)">
钱包明细
</el-button>
<el-button icon="InfoFilled" link type="primary"
v-auth="'wallet_walletTransaction_update_balance'" @click="doRefund(row)">
订单详情
</el-button>
<el-button v-if="false" icon="edit-pen" text type="primary"
v-auth="'hard_hardwareOrder_edit'" @click="formDialogRef.openDialog(row.id)">
编辑
</el-button>
<el-button
v-if="!row.payRefundId && row.orderType !== '5' && !['5', '6', '8'].includes(row.payType)"
icon="stamp" text type="primary" v-auth="'hard_hardAfterSale_adminRefund'"
@click="adminRefundDailogRef.openDialog(row.id)">
退款
</el-button>
<el-button v-if="false" icon="delete" text type="primary" v-auth="'hard_hardwareOrder_del'"
@click="handleDelete([row.id])">
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
:show-summary="false"
:summary-method="getSummaries"
>
<el-table-column type="selection" width="60" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column width="200" label="用户">
<template #default="{ row }">
<div v-if="row.userId && row.userId != -1" class="flex flex-row items-center justify-center">
<preview-image width="50px" height="50px" :src="row.userAvatar" />
<div class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
</div>
<div v-else>
<span>未知用户</span>
</div>
</template>
</el-table-column>
<el-table-column width="200px" label="商品">
<template #default="{ row }">
<div class="desc">
<span>商品</span>
<el-tooltip :content="row.productDesc" placement="top-start">
<span class="text-line">{{ row.productDesc }}</span>
</el-tooltip>
</div>
<div class="status" v-if="row.hourType">
<span>用餐时间段</span>
<span>
<dict-tag :options="daily_menu" :value="row.hourType" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="设备信息">
<template #default="{ row }">
<div class="status">
<span>商户</span>
<span>
{{ row.merchantName }}
</span>
</div>
<div class="status">
<span>设备名</span>
<span>
{{ row.hardName }}
</span>
</div>
<div class="status">
<span>设备类型</span>
<span>
<dict-tag :options="hard_type" :value="row.hardType" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="订单信息">
<template #default="{ row }">
<div class="status">
<span>订单类型</span>
<span>
<dict-tag :options="hard_order_type" :value="row.orderType" />
</span>
</div>
<div class="status">
<span>支付方式</span>
<span>
<dict-tag :options="hard_pay_type" :value="row.payType" />
</span>
</div>
<div class="status">
<span>订单状态</span>
<span>
<dict-tag :options="hard_order_status" :value="row.orderStatus" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="200px" prop="paymentInformation" label="付款信息">
<template #default="{ row }">
<div class="status">
<span>商品总价</span>
<span class="color-success">
{{ displayPrice(row.totalPrice, "元", 2) }}
</span>
</div>
<div class="status">
<span>额外支付</span>
<span class="color-danger">
{{ displayPrice(row.extraPrice, "元", 2) }}
</span>
</div>
<div class="status">
<span>实际支付</span>
<span class="color-primary">
{{ displayPrice(row.payPrice, "元", 2) }}
</span>
</div>
</template>
</el-table-column>
<el-table-column width="270px" label="退款信息">
<template #default="{ row }">
<div v-if="row.payRefundId">
<div class="status">
<span>退款金额</span>
<span class="color-success">
{{ displayPrice(row.refundPrice, "元", 2) }}
</span>
</div>
<div class="status">
<span>退款状态</span>
<span class="color-success">
<dict-tag :options="hard_refund_status" :value="row.refundStatus" />
</span>
</div>
<div class="status">
<span>退款时间</span>
<span>
{{ row.refundTime }}
</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="支付时间" align="center" prop="payTime" width="250px">
<template #default="{ row }">
<div class="status">
<span>创建时间</span>
<span>{{ row.createTime }} </span>
</div>
<div class="status">
<span>支付时间</span>
<span>{{ row.payTime }} </span>
</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="200">
<template #default="{ row }">
<div class="grid grid-cols-2 justify-evenly">
<el-button
v-if="row.orderType !== '5'"
icon="Printer"
text
type="primary"
@click="print(row)"
v-auth="'hard_hardInvoice_admin_print'"
>
打印发票
</el-button>
<el-button
v-if="row.orderType !== '5'"
icon="ShoppingCartFull"
text
type="primary"
@click="shopCarDialogRef.openDialog(row.id)"
>
购物车
</el-button>
<el-button
icon="Money"
link
type="primary"
v-if="row.userId && row.userId != '-1'"
@click="transactionListRef.openDialog(row.walletId)"
>
钱包明细
</el-button>
<el-button
icon="InfoFilled"
link
type="primary"
v-auth="'wallet_walletTransaction_update_balance'"
@click="doRefund(row)"
>
订单详情
</el-button>
<el-button
v-if="false"
icon="edit-pen"
text
type="primary"
v-auth="'hard_hardwareOrder_edit'"
@click="formDialogRef.openDialog(row.id)"
>
编辑
</el-button>
<el-button
v-if="!row.payRefundId && row.orderType !== '5' && !['5', '6', '8'].includes(row.payType)"
icon="stamp"
text
type="primary"
v-auth="'hard_hardAfterSale_adminRefund'"
@click="adminRefundDailogRef.openDialog(row.id)"
>
退款
</el-button>
<el-button
v-if="false"
icon="delete"
text
type="primary"
v-auth="'hard_hardwareOrder_del'"
@click="handleDelete([row.id])"
>
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</template>
</DraggableDepTree>
</div>
<!-- 编辑、新增 -->
@@ -326,11 +386,10 @@ const print = async (row: any) => {
}
}
// 树节点选择时
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = !isDeepTree
getDataList()
}
@@ -378,36 +437,36 @@ const getSummaries = (param: SummaryMethodProps) => {
}
if (column.property === "paymentInformation") {
const priceVNode: VNode[] & string[] = []
;[
{ column: "totalPrice", columnName: "商品总价", color: "#67C260" },
{ column: "extraPrice", columnName: "额外支付", color: "#F56E9B" },
{ column: "payPrice", columnName: "实际支付", color: "#355CF6" },
].forEach(({ column, columnName, color }: any, index: number) => {
const values = data.map((item) => Number(item[column]))
if (!values.every((value) => Number.isNaN(value))) {
priceVNode.push(
h("div", {}, [
h("span", { style: { marginRight: "40px", minWidth: "60px", fontWeight: "bold" } }, [columnName]),
h("span", { style: { color, minWidth: "50px", flex: 1 } }, [
displayPrice(
values.reduce((prev, curr) => {
const value = Number(curr)
if (!Number.isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0),
"元",
2,
),
]),
;[
{ column: "totalPrice", columnName: "商品总价", color: "#67C260" },
{ column: "extraPrice", columnName: "额外支付", color: "#F56E9B" },
{ column: "payPrice", columnName: "实际支付", color: "#355CF6" },
].forEach(({ column, columnName, color }: any, index: number) => {
const values = data.map((item) => Number(item[column]))
if (!values.every((value) => Number.isNaN(value))) {
priceVNode.push(
h("div", {}, [
h("span", { style: { marginRight: "40px", minWidth: "60px", fontWeight: "bold" } }, [columnName]),
h("span", { style: { color, minWidth: "50px", flex: 1 } }, [
displayPrice(
values.reduce((prev, curr) => {
const value = Number(curr)
if (!Number.isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0),
"元",
2,
),
]),
)
} else {
priceVNode.push("NaN")
}
})
]),
)
} else {
priceVNode.push("NaN")
}
})
sums[index] = h("div", { style: {} }, [...priceVNode])
} else {
sums[index] = ""