You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crmeb/app/pages/supply_chain/stock/detail.vue

215 lines
4.5 KiB

<template>
<view class="detail-page">
<view class="content">
<view class="header">
<view class="back-btn" @click="goBack">
<text class="iconfont icon-xiangzuo"></text>
<text>返回</text>
</view>
<view class="title">库存变化明细</view>
</view>
<!-- 明细列表 -->
<view class="detail-section">
<view class="detail-list" v-if="detailItems.length > 0">
<view class="detail-item" v-for="(item, index) in detailItems" :key="index">
<view class="item-header">
<text class="item-date">{{ formatDate(item.stockDate) }}</text>
<text class="item-bill">{{ item.billNumber }}</text>
</view>
<view class="item-body">
<view class="info-item">
<text class="label">仓库名称</text>
<text class="value">{{ item.stockName }}</text>
</view>
<view class="info-item">
<text class="label">供应商</text>
<text class="value">{{ item.custName }}</text>
</view>
<view class="info-item">
<text class="label">商品名称</text>
<text class="value">{{ item.cargoName }}</text>
</view>
<view class="info-item">
<text class="label">商品编号</text>
<text class="value">{{ item.hsCode }}</text>
</view>
<view class="info-item">
<text class="label">商品数量</text>
<text class="value">{{ item.cargoWt }}</text>
</view>
<view class="info-item">
<text class="label">商品价值</text>
<text class="value">{{ item.cargoValue }}</text>
</view>
</view>
</view>
</view>
<view class="empty-list" v-else>
<text>暂无明细数据</text>
</view>
</view>
</view>
</view>
</template>
<script>
import { getStockDetail } from '@/api/stock';
export default {
data() {
return {
detailItems: [],
loading: false,
cargoId: '',
custId: '',
queryParams: {
pageNum: 1,
pageSize: 10,
cargoId: null,
custId: null
}
};
},
onLoad(options) {
if (options.cargoId && options.custId) {
this.cargoId = options.cargoId;
this.custId = options.custId;
this.queryParams.cargoId = options.cargoId;
this.queryParams.custId = options.custId;
this.getDetailList();
}
},
methods: {
// 格式化日期
formatDate(timestamp) {
if (!timestamp) return '';
const date = new Date(timestamp);
return date.toISOString().split('T')[0];
},
// 获取明细列表
getDetailList() {
this.loading = true;
// 调用API
getStockDetail(this.queryParams).then((res) => {
this.detailItems = res.data.list || [];
this.loading = false;
}).catch((err) => {
console.error('获取明细列表失败:', err);
this.loading = false;
});
},
// 返回上一页
goBack() {
uni.navigateBack();
}
}
};
</script>
<style lang="scss">
.detail-page {
.content {
.header {
display: flex;
align-items: center;
padding: 30rpx;
background-color: #fff;
border-bottom: 1rpx solid #eee;
.back-btn {
display: flex;
align-items: center;
padding: 10rpx;
.iconfont {
font-size: 28rpx;
color: #333;
margin-right: 10rpx;
}
text {
font-size: 24rpx;
color: #333;
}
}
.title {
flex: 1;
font-size: 28rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-right: 60rpx;
}
}
.detail-section {
padding: 30rpx;
.detail-list {
.detail-item {
background-color: #fff;
border-radius: 10rpx;
padding: 20rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
.item-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 15rpx;
padding-bottom: 15rpx;
border-bottom: 1rpx solid #eee;
.item-date {
font-size: 24rpx;
color: #333;
font-weight: 600;
}
.item-bill {
font-size: 22rpx;
color: #666;
}
}
.item-body {
.info-item {
display: flex;
margin-bottom: 10rpx;
.label {
width: 140rpx;
font-size: 24rpx;
color: #666;
}
.value {
flex: 1;
font-size: 24rpx;
color: #333;
}
}
}
}
}
.empty-list {
display: flex;
align-items: center;
justify-content: center;
height: 200rpx;
background-color: #f5f5f5;
border-radius: 10rpx;
text {
font-size: 24rpx;
color: #999;
}
}
}
}
}
</style>