Files
art-design-uniapp/pages/approval/borrow_approval.vue
T

345 lines
7.2 KiB
Vue
Raw Normal View History

2026-02-06 14:39:37 +08:00
<template>
<view class="home-page">
<z-paging ref="paging" v-model="borrowList" @query="queryList" empty-view-text="暂无数据!">
<template #top>
<uni-nav-bar leftText=" " :fixed="true" leftIcon="back" :border="false" @clickLeft="leftClick" color="#fff" backgroundColor="rgb(48, 116, 247)" :statusBar="true" title="审批列表"></uni-nav-bar>
<!-- Tab栏 -->
<view class="tab-bar">
<view
class="tab-item"
:class="{ 'tab-item-active': currentTab === index }"
v-for="(tab, index) in tabList"
:key="index"
@click="switchTab(index)"
>
<text class="tab-text">{{ tab }}</text>
<view v-if="currentTab === index" class="tab-underline"></view>
</view>
</view>
</template>
<!-- 列表内容 -->
<view class="list-container">
<view
class="borrow-card"
v-for="(item, index) in borrowList"
:key="index"
>
<!-- 状态标签(右上角旋转丝带) -->
<view class="status-ribbon" :class="'ribbon-' + item.status">
<text class="ribbon-text">{{ getStatusText(item.status) }}</text>
</view>
<!-- 卡片内容 -->
<view class="card-content" @click="handleCardClick(item)">
<view class="card-title">
<uni-tag :text="item1.item_name_snap" size="mini" type="primary" v-for="(item1, index) in item.item" :key="index"/>
</view>
<view class="card-info">
<text class="info-item">申请人: {{ item.applicant_name }}</text>
<text class="info-item">借用时间: {{ item.use_start_date || '-' }} ~ {{ item.use_end_date || '-' }}</text>
</view>
<view class="action-btns">
<!-- <text class="info-item">公司名称: {{ item.companyName }}</text> -->
<text class="info-item"></text>
<!-- 操作按钮 -->
<view class="card-actions" v-if="item.status !== 'returned'">
<button
class="action-btn"
:class="'btn-' + item.status"
v-if="item.status==10"
@click.stop="handleAction(item)"
>
{{ getActionText(item.status) }}
</button>
</view>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
currentTab: 0,
tabList: ['全部', '待审核', '已通过', '未通过'],
borrowList: []
}
},
computed: {
filteredList() {
if (this.currentTab === 0) {
return this.borrowList
} else if (this.currentTab === 1) {
return this.borrowList.filter(item => item.status === 'returned')
} else if (this.currentTab === 2) {
return this.borrowList.filter(item => item.status === 'notReturned')
} else if (this.currentTab === 3) {
return this.borrowList.filter(item => item.status === 'pendingReview')
}
return []
}
},
methods: {
leftClick(){
uni.navigateBack({})
},
switchTab(index) {
this.currentTab = index
// 重置分页并重新加载数据
if (this.$refs.paging) {
this.$refs.paging.reload()
}
},
queryList(pageNo, pageSize, from) {
this.loading = true;
var that = this;
const params = {
current:pageNo,
size:10,
status: this.currentTab === 0 ? '' : (this.currentTab === 1 ? '10' : (this.currentTab === 2 ? '12' : '13'))
};
request({
url:'mobile/inv/requisition/list',
method:'get',
data: params
}).then(res => {
if(res.data.code ==200){
var datas = res.data.data.records;
this.$refs.paging.complete(datas);
}else{
}
uni.stopPullDownRefresh();
//
})
},
getStatusText(status) {
const statusMap = {
'12': '待归还',
'13': '拒绝',
'14': '申请归还',
'15': '归还审核中',
'16': '部分归还',
'17': '已归还',
'18': '归还拒绝',
'11': '审批中',
'10': '待审核',
'19': '损耗品'
}
return statusMap[status] || ''
},
getActionText(status) {
const actionMap = {
'12': '待归还',
'13': '拒绝',
'14': '申请归还',
'15': '归还审核中',
'16': '部分归还',
'17': '已归还',
'18': '归还拒绝',
'11': '审批中',
'10': '去审核',
'19': '损耗品'
}
return actionMap[status] || ''
},
handleCardClick(item) {
uni.navigateTo({
url: '/pages/approval/borrow_approval_detail?id=' + item.id
});
},
handleAction(item) {
uni.navigateTo({
url: '/pages/approval/borrow_approval_detils?id='+item.id
});
}
}
}
</script>
<style lang="scss">
.home-page {
min-height: 100vh;
background: rgb(244, 246, 248);
}
.content-wrapper {
}
// Tab栏样式
.tab-bar {
display: flex;
background: #F4F6F8;
}
.tab-item {
flex: 1;
position: relative;
padding: 24rpx 0;
text-align: center;
}
.tab-text {
font-size: 28rpx;
color: #666;
}
.tab-item-active .tab-text {
color: #3074F7;
font-weight: 500;
}
.tab-underline {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 60rpx;
height: 4rpx;
background: #3074F7;
border-radius: 2rpx;
}
// 列表容器
.list-container {
padding: 24rpx 28rpx;
}
// 借用卡片
.borrow-card {
position: relative;
background: #fff;
border-radius: 12rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
overflow: hidden;
}
// 状态标签(旋转丝带效果)
.status-ribbon {
position: absolute;
top: -4px;
right: -32px;
width: 100px;
height: 47px;
background: #08A400;
transform: rotate(45deg);
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.15);
}
.ribbon-notReturned {
background: #BD0000; // 红色
}
.ribbon-10 {
background: #3471FF; // 蓝色
}
.ribbon-11 {
background: #FA8C16;
}
.ribbon-12 {
background: #722ED1;
}
.ribbon-13 {
background: #F5222D;
}
.ribbon-14 {
background: #13C2C2;
}
.ribbon-15 {
background: #FAAD14;
}
.ribbon-16 {
background: #52C41A;
}
.ribbon-17 {
background: #389E0D;
}
.ribbon-18 {
background: #A8071A;
}
.ribbon-19 {
background: #8C8C8C;
}
.ribbon-text {
color: #fff;
font-size: 20rpx;
font-weight: 500;
transform: rotate(0deg);
transform-origin: center;
display: block;
text-align: center;
margin-top: 16rpx;
white-space: nowrap;
letter-spacing: 1rpx;
}
// 卡片内容
.card-content {
padding: 28rpx;
}
.card-title {
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-bottom: 24rpx;
display: flex;
gap: 10px;
}
.card-info {
display: flex;
flex-direction: column;
gap: 12rpx;
margin-bottom: 24rpx;
}
.info-item {
font-size: 26rpx;
color: #666;
line-height: 1.6;
}
// 操作按钮
.card-actions {
display: flex;
justify-content: flex-end;
}
.action-btns{
display: flex;
justify-content: space-between;
align-items: center;
}
.action-btn {
padding: 14rpx 40rpx;
background: #3074F7;
color: #fff;
border-radius: 8rpx;
font-size: 26rpx;
border: none;
line-height: 1;
&::after {
border: none;
}
}
.btn-notReturned {
background: #3074F7;
}
.btn-pendingReview {
background: #3074F7;
}
</style>