support tablet
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="page-layout navbar sales-order-record-list">
|
||||
<div class="tui-page-layout tui-navbar sales-order-record-list">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
@@ -7,150 +7,164 @@
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<main v-can="pageAccess" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
:refresh-timeout="30000"
|
||||
@refresh="reload"
|
||||
@scrolltolower="loadMore"
|
||||
>
|
||||
<div class="filters glass">
|
||||
<t-input
|
||||
class="customer"
|
||||
v-model.trim="customerSearchKeyword"
|
||||
borderless
|
||||
placeholder="输入客户编码或姓名"
|
||||
@enter="applyCustomerSearch"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<div class="actions">
|
||||
<t-button
|
||||
v-if="customerId"
|
||||
shape="circle"
|
||||
theme="danger"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
aria-label="清除客户选择"
|
||||
@click.stop="clearCustomer"
|
||||
>
|
||||
<t-icon name="close" size="1rem" />
|
||||
</t-button>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
content="选择客户"
|
||||
@click.stop="customerSelectorVisible = true"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</t-input>
|
||||
<t-dropdown-menu class="menus">
|
||||
<t-dropdown-item
|
||||
v-model="dateFilterType"
|
||||
:label="dateFilterLabel"
|
||||
:options="dateOptions"
|
||||
@change="selectDateFilter"
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-if="!isSelfReceiveOnly"
|
||||
v-model="operationType"
|
||||
:label="operationFilterLabel"
|
||||
:options="operationOptions"
|
||||
@change="selectOperation"
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="status"
|
||||
label="状态"
|
||||
:options="statusOptions"
|
||||
@change="selectStatus"
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
</div>
|
||||
<t-cell-group v-if="isCustomDate" class="date-summary" theme="card">
|
||||
<t-cell
|
||||
title="开始时间"
|
||||
:note="dateRange[0] || '-'"
|
||||
arrow
|
||||
@click="openStartTime"
|
||||
/>
|
||||
<t-cell
|
||||
title="结束时间"
|
||||
:note="dateRange[1] || '-'"
|
||||
arrow
|
||||
@click="openEndTime"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card">
|
||||
<t-cell
|
||||
class="item"
|
||||
v-for="item in recordList"
|
||||
:key="item.id"
|
||||
arrow
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
@click="toDetail(item)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<t-image
|
||||
v-if="getCustomerPhotoURL(item.customer, 64)"
|
||||
:src="getCustomerPhotoURL(item.customer, 64)"
|
||||
:alt="getCustomerText(item)"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
<master-detail-page
|
||||
v-can="pageAccess"
|
||||
class="list"
|
||||
:split="isWide"
|
||||
:selected="!!selectedId"
|
||||
:direction="paneDirection"
|
||||
>
|
||||
<template #master>
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
:refresh-timeout="30000"
|
||||
@refresh="reload"
|
||||
@scrolltolower="loadMore"
|
||||
>
|
||||
<div class="filters glass">
|
||||
<t-input
|
||||
class="customer"
|
||||
v-model.trim="customerSearchKeyword"
|
||||
borderless
|
||||
placeholder="输入客户编码或姓名"
|
||||
@enter="applyCustomerSearch"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<div class="actions">
|
||||
<t-button
|
||||
v-if="customerId"
|
||||
shape="circle"
|
||||
theme="danger"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
aria-label="清除客户选择"
|
||||
@click.stop="clearCustomer"
|
||||
>
|
||||
<t-icon name="close" size="1rem" />
|
||||
</t-button>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
content="选择客户"
|
||||
@click.stop="customerSelectorVisible = true"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</t-input>
|
||||
<t-dropdown-menu class="menus">
|
||||
<t-dropdown-item
|
||||
v-model="dateFilterType"
|
||||
:label="dateFilterLabel"
|
||||
:options="dateOptions"
|
||||
@change="selectDateFilter"
|
||||
/>
|
||||
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="title">
|
||||
<span class="customer clip-text" v-text="getCustomerText(item)" />
|
||||
<span class="type" :class="getOperationClass(item.operationType)" v-text="getFundOperationText(item.operationType)" />
|
||||
<t-tag
|
||||
size="small"
|
||||
:content="getRecordStatusText(item)"
|
||||
variant="light-outline"
|
||||
:theme="getRecordStatusTheme(item)"
|
||||
<t-dropdown-item
|
||||
v-if="!isSelfReceiveOnly"
|
||||
v-model="operationType"
|
||||
:label="operationFilterLabel"
|
||||
:options="operationOptions"
|
||||
@change="selectOperation"
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="status"
|
||||
label="状态"
|
||||
:options="statusOptions"
|
||||
@change="selectStatus"
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
</div>
|
||||
<t-cell-group v-if="isCustomDate" class="date-summary" theme="card">
|
||||
<t-cell
|
||||
title="开始时间"
|
||||
:note="dateRange[0] || '-'"
|
||||
arrow
|
||||
@click="openStartTime"
|
||||
/>
|
||||
<t-cell
|
||||
title="结束时间"
|
||||
:note="dateRange[1] || '-'"
|
||||
arrow
|
||||
@click="openEndTime"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card">
|
||||
<t-cell
|
||||
class="item"
|
||||
v-for="item in recordList"
|
||||
:key="item.id"
|
||||
arrow
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
@click="toDetail(item)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<t-image
|
||||
v-if="getCustomerPhotoURL(item.customer, 64)"
|
||||
:src="getCustomerPhotoURL(item.customer, 64)"
|
||||
:alt="getCustomerText(item)"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="description">
|
||||
<div class="operator">
|
||||
<div class="field">
|
||||
<span class="label">发起人</span>
|
||||
<span class="text-bold" v-text="getOperatorText(item)" />
|
||||
</div>
|
||||
<div v-if="item.verifier" class="field">
|
||||
<span class="label">核销人</span>
|
||||
<span class="text-bold" v-text="getVerifierText(item)" />
|
||||
</div>
|
||||
<time-label :timestamp="item.occurredAt" underline />
|
||||
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="title">
|
||||
<span class="customer clip-text" v-text="getCustomerText(item)" />
|
||||
<span class="type" :class="getOperationClass(item.operationType)" v-text="getFundOperationText(item.operationType)" />
|
||||
<t-tag
|
||||
size="small"
|
||||
:content="getRecordStatusText(item)"
|
||||
variant="light-outline"
|
||||
:theme="getRecordStatusTheme(item)"
|
||||
/>
|
||||
</div>
|
||||
<div class="amounts">
|
||||
<div class="order-amount">
|
||||
<span class="label">订单总价</span>
|
||||
<span>¥</span>
|
||||
<span v-text="formatPackageAmount(item.salesOrderAmount)" />
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="description">
|
||||
<div class="operator">
|
||||
<div class="field">
|
||||
<span class="label">发起人</span>
|
||||
<span class="text-bold" v-text="getOperatorText(item)" />
|
||||
</div>
|
||||
<div v-if="item.verifier" class="field">
|
||||
<span class="label">核销人</span>
|
||||
<span class="text-bold" v-text="getVerifierText(item)" />
|
||||
</div>
|
||||
<time-label :timestamp="item.occurredAt" underline />
|
||||
</div>
|
||||
<div class="unpaid-amount">
|
||||
<span class="label">剩余待收</span>
|
||||
<span>¥</span>
|
||||
<span v-text="formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)" />
|
||||
</div>
|
||||
<div class="record-amount">
|
||||
<span class="label">流水金额</span>
|
||||
<span class="red">¥</span>
|
||||
<span class="value red" v-text="formatPackageAmount(item.amount)" />
|
||||
<div class="amounts">
|
||||
<div class="order-amount">
|
||||
<span class="label">订单总价</span>
|
||||
<span>¥</span>
|
||||
<span v-text="formatPackageAmount(item.salesOrderAmount)" />
|
||||
</div>
|
||||
<div class="unpaid-amount">
|
||||
<span class="label">剩余待收</span>
|
||||
<span>¥</span>
|
||||
<span v-text="formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)" />
|
||||
</div>
|
||||
<div class="record-amount">
|
||||
<span class="label">流水金额</span>
|
||||
<span class="red">¥</span>
|
||||
<span class="value red" v-text="formatPackageAmount(item.amount)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<center-tips v-else :content="loading ? '正在加载资金流水' : '暂无资金流水'" />
|
||||
<center-tips :content="loadStateText" />
|
||||
</t-pull-down-refresh>
|
||||
</main>
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<center-tips v-else :content="loading ? '正在加载资金流水' : '暂无资金流水'" />
|
||||
<center-tips :content="loadStateText" />
|
||||
</t-pull-down-refresh>
|
||||
</template>
|
||||
<template #detail>
|
||||
<fund-record-detail
|
||||
:key="`detail-${selectedId}`"
|
||||
:record-id="selectedId"
|
||||
/>
|
||||
</template>
|
||||
</master-detail-page>
|
||||
<customer-selector
|
||||
v-model="customerId"
|
||||
v-model:visible="customerSelectorVisible"
|
||||
@@ -184,7 +198,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
|
||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
|
||||
import { TimeLabel, Time } from "timi-web";
|
||||
import { useUserStore } from "timi-web-api";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
@@ -206,6 +222,12 @@ defineOptions({ name: "FundRecordList" });
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
// 选中项、切换方向、关闭逻辑、转屏、query 同步都在这里;资金流水没有内联编辑视图
|
||||
const { selectedId, paneDirection, isWide, openDetail } = useMasterDetailPane({
|
||||
path: "/management/fund-records",
|
||||
detail: id => `/management/fund-records/${id}`
|
||||
});
|
||||
const userStore = useUserStore();
|
||||
const recordList = ref<FundRecord[]>([]);
|
||||
const operationType = ref(route.query.operationType === "RECEIVE" ? "RECEIVE" : "ALL");
|
||||
@@ -487,23 +509,7 @@ function getRecordStatusTheme(item: FundRecord): "success" | "warning" | "danger
|
||||
}
|
||||
|
||||
async function toDetail(item: FundRecord): Promise<void> {
|
||||
if (item.id) {
|
||||
await router.push({
|
||||
path: `/management/fund-records/${item.id}`,
|
||||
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getCurrentRouteDepth(): number {
|
||||
const transitionDepth = Array.isArray(route.query.transitionDepth)
|
||||
? route.query.transitionDepth[0]
|
||||
: route.query.transitionDepth;
|
||||
const depth = Number(transitionDepth);
|
||||
if (transitionDepth && Number.isInteger(depth) && 0 <= depth && depth <= 20) {
|
||||
return depth;
|
||||
}
|
||||
return Number(route.meta.depth ?? 0);
|
||||
openDetail(item.id || "");
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -522,7 +528,7 @@ onMounted(async () => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.sales-order-record-list {
|
||||
padding: var(--app-nav-height) 0 1rem;
|
||||
padding: var(--tui-nav-height) 0 1rem;
|
||||
|
||||
|
||||
.item {
|
||||
|
||||
Reference in New Issue
Block a user