feat:个人中心完成
This commit is contained in:
178
src/pages/contract-center/index.vue
Normal file
178
src/pages/contract-center/index.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { CONTRACT_LIST, CONTRACT_TABS } from '@/constants/contract'
|
||||
import type { ContractItem, ContractTab } from '@/types/contract'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
|
||||
const keyword = ref('')
|
||||
const activeTab = ref<ContractTab>('all')
|
||||
const contractList = ref(CONTRACT_LIST.map(item => ({ ...item })))
|
||||
|
||||
const filteredContracts = computed(() => {
|
||||
const text = keyword.value.trim()
|
||||
|
||||
return contractList.value.filter((item) => {
|
||||
const matchTab = activeTab.value === 'all'
|
||||
|| (activeTab.value === 'pending' && item.signStatus === 'pending')
|
||||
|| (activeTab.value === 'signed' && item.signStatus === 'signed')
|
||||
const matchKeyword = !text
|
||||
|| item.title.includes(text)
|
||||
|| item.type.includes(text)
|
||||
|| item.contractNo.includes(text)
|
||||
|| item.relatedValue.includes(text)
|
||||
|
||||
return matchTab && matchKeyword
|
||||
})
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/personal-center/index')
|
||||
}
|
||||
|
||||
function badgeClass(type: ContractItem['badges'][number]['type']) {
|
||||
return `contract-center__badge--${type}`
|
||||
}
|
||||
|
||||
function handleViewDetail(item: ContractItem) {
|
||||
uni.showToast({ title: `查看${item.title}详情开发中`, icon: 'none' })
|
||||
}
|
||||
|
||||
function handlePreview(item: ContractItem) {
|
||||
uni.showToast({ title: `预览${item.contractNo}开发中`, icon: 'none' })
|
||||
}
|
||||
|
||||
function handleDownload(item: ContractItem) {
|
||||
uni.showToast({ title: `下载${item.contractNo}开发中`, icon: 'none' })
|
||||
}
|
||||
|
||||
function handleSign(item: ContractItem) {
|
||||
uni.showToast({ title: `签署${item.contractNo}开发中`, icon: 'none' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="contract-center">
|
||||
<view class="contract-center__header">
|
||||
<view
|
||||
class="contract-center__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="contract-center__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="contract-center__title">
|
||||
合同中心
|
||||
</text>
|
||||
<view class="contract-center__header-placeholder" />
|
||||
</view>
|
||||
|
||||
<view class="contract-center__toolbar">
|
||||
<view class="contract-center__search">
|
||||
<image
|
||||
class="contract-center__search-icon"
|
||||
src="/static/icons/icon-search.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="contract-center__search-input"
|
||||
placeholder="搜索项目标题、类型..."
|
||||
placeholder-class="contract-center__search-placeholder"
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="contract-center__tabs">
|
||||
<view
|
||||
v-for="tab in CONTRACT_TABS"
|
||||
:key="tab.value"
|
||||
class="contract-center__tab"
|
||||
:class="{ 'contract-center__tab--active': activeTab === tab.value }"
|
||||
@tap="activeTab = tab.value"
|
||||
>
|
||||
<text class="contract-center__tab-text">
|
||||
{{ tab.label }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="contract-center__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="contract-center__list">
|
||||
<view
|
||||
v-for="item in filteredContracts"
|
||||
:key="item.id"
|
||||
class="contract-center__card"
|
||||
>
|
||||
<view class="contract-center__card-top">
|
||||
<text class="contract-center__contract-no">
|
||||
合同编号: {{ item.contractNo }}
|
||||
</text>
|
||||
<view class="contract-center__badges">
|
||||
<text
|
||||
v-for="badge in item.badges"
|
||||
:key="badge.label"
|
||||
class="contract-center__badge"
|
||||
:class="badgeClass(badge.type)"
|
||||
>
|
||||
{{ badge.label }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="contract-center__title-row">
|
||||
<text class="contract-center__card-title">
|
||||
{{ item.title }}
|
||||
</text>
|
||||
<text
|
||||
class="contract-center__detail-link"
|
||||
@tap="handleViewDetail(item)"
|
||||
>
|
||||
查看详情
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<text class="contract-center__related">
|
||||
{{ item.relatedLabel }}: {{ item.relatedValue }}
|
||||
</text>
|
||||
|
||||
<view
|
||||
class="contract-center__actions"
|
||||
:class="{ 'contract-center__actions--single': !item.showDownload && !item.showSign }"
|
||||
>
|
||||
<view
|
||||
class="contract-center__action-btn contract-center__action-btn--outline"
|
||||
@tap="handlePreview(item)"
|
||||
>
|
||||
预览
|
||||
</view>
|
||||
<view
|
||||
v-if="item.showDownload"
|
||||
class="contract-center__action-btn contract-center__action-btn--outline"
|
||||
@tap="handleDownload(item)"
|
||||
>
|
||||
下载
|
||||
</view>
|
||||
<view
|
||||
v-if="item.showSign"
|
||||
class="contract-center__action-btn contract-center__action-btn--primary"
|
||||
@tap="handleSign(item)"
|
||||
>
|
||||
立即签署
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user