Files
art-design-uniapp/pages/stock/stock_list.vue
T
2026-02-06 14:39:37 +08:00

315 lines
6.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="home-page">
<z-paging ref="paging" :auto="false" v-model="contList" @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 filteredList"
:key="index"
@click="handleCardClick(item)"
>
<!-- 状态标签(右上角旋转丝带) -->
<view class="status-ribbon" :class="'ribbon-' + item.status">
<text class="ribbon-text">{{ getStatusText(item.status) }}</text>
</view>
<!-- 卡片内容 -->
<view class="card-content">
<view class="card-title">备货单编号:{{ item.itemName }}</view>
<view class="card-info">
<text class="info-item">阿里订单号/PI号: {{ item.applicant }}</text>
<text class="info-item">客户名称: Alicia</text>
<text class="info-item">客户来源: 广交会</text>
<text class="info-item">业务员: 测试</text>
<text class="info-item">时间: {{ item.borrowTime }}</text>
<text class="info-item">补充: {{ item.companyName }}</text>
</view>
<!-- 操作按钮 -->
<view class="card-actions" >
<view class="action-btn" @click="handleAction(item)">
查看审批
</view>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script>
export default {
data() {
return {
currentTab: 0,
tabList: ['全部', '审批中', '已通过', '未通过'],
borrowList: [
{
id: 1,
itemName: 'HSAT-JN00010',
applicant: 'VCS280726JN2',
borrowTime: '2024-11-06 09:41:18',
companyName: '合塑',
status: 'returned' // returned, notReturned, pendingReview
},
{
id: 2,
itemName: 'HSAT-JN00010',
applicant: 'VCS280726JN2',
borrowTime: '2024-11-06 09:41:18',
companyName: '合塑',
status: 'notReturned'
},
{
id: 3,
itemName: 'HSAT-JN00010',
applicant: 'VCS280726JN2',
borrowTime: '2024-11-06 09:41:18',
companyName: '合塑',
status: 'pendingReview'
}
]
}
},
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
},
getStatusText(status) {
const statusMap = {
'returned': '已归还',
'notReturned': '未归还',
'pendingReview': '待复核'
}
return statusMap[status] || ''
},
getActionText(status) {
const actionMap = {
'notReturned': '立即归还',
'pendingReview': '立即复核'
}
return actionMap[status] || ''
},
handleCardClick(item) {
uni.navigateTo({
url: '/pages/borrow/borrow_detils?id=' + item.id
});
},
handleAction(item) {
if (item.status === 'notReturned') {
// 归还操作
uni.navigateTo({
url: '/pages/borrow/return'
});
// uni.showModal({
// title: '提示',
// content: '确定要归还该物品吗?',
// success: (res) => {
// if (res.confirm) {
// uni.showToast({
// title: '归还成功',
// icon: 'success'
// })
// // 这里可以调用API更新状态
// }
// }
// })
} else if (item.status === 'pendingReview') {
// 复核操作
uni.navigateTo({
url: '/pages/borrow/review'
});
}
}
}
}
</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-returned {
background: #08A400; // 绿色
}
.ribbon-notReturned {
background: #BD0000; // 红色
}
.ribbon-pendingReview {
background: #3471FF; // 蓝色
}
.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;
}
.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-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>