Files
zkxw/mobile-h5/pages/demo/list.vue
2026-08-12 15:48:15 +08:00

101 lines
2.6 KiB
Vue

<template>
<view class="page-shell">
<view class="list-hero">
<van-nav-bar
title="业务列表"
left-arrow
:border="false"
@click-left="goHome"
>
<template #right>
<van-icon name="plus" size="20px" color="#fff" @click="goCreate" />
</template>
</van-nav-bar>
<view class="list-hero-copy">
<view class="eyebrow">WORKSPACE</view>
<view class="title">今日待办一览</view>
<view class="subline">
<text>当前展示</text>
<text class="em">{{ list.length }} 条</text>
<text v-if="keyword">· 已筛选</text>
</view>
</view>
<view class="list-search">
<van-search
v-model="keyword"
shape="round"
background="transparent"
placeholder="搜索单号 / 名称 / 负责人"
@update:model-value="onKeywordInput"
/>
</view>
</view>
<view class="list-filter-dock">
<view class="seg-tabs">
<view
v-for="(tab, idx) in tabs"
:key="tab.key"
class="seg-tab"
:class="{ active: listTab === idx }"
@click="listTab = idx"
>
<text class="lab">{{ tab.label }}</text>
<text class="count">{{ tabCount(idx) }}</text>
</view>
</view>
</view>
<view class="list-wrap">
<BizListCard
v-for="item in list"
:key="item.id"
:item="item"
@view="goDetail"
@action="goEdit"
/>
<van-empty v-if="!list.length" description="暂无数据" />
<view v-else class="list-end">已经到底了</view>
</view>
</view>
</template>
<script>
import BizListCard from '../../components/BizListCard.vue'
import { filterByTab, tabCount, LIST_TABS } from '../../utils/biz-mock.js'
export default {
components: { BizListCard },
data() {
return {
keyword: '',
listTab: 0,
tabs: LIST_TABS
}
},
computed: {
list() {
return filterByTab(this.listTab, this.keyword)
}
},
methods: {
tabCount,
onKeywordInput(v) {
this.keyword = v == null ? '' : String(v)
},
goHome() {
uni.reLaunch({ url: '/pages/index/index' })
},
goCreate() {
uni.navigateTo({ url: '/pages/demo/form?mode=create' })
},
goDetail(item) {
uni.navigateTo({ url: `/pages/demo/detail?id=${item.id}` })
},
goEdit(item) {
uni.navigateTo({ url: `/pages/demo/form?mode=edit&id=${item.id}` })
}
}
}
</script>