<template>
|
<view class="production-order-source">
|
<PageHeader title="来源数据" @back="goBack" />
|
|
<view class="summary-card" v-if="summary">
|
<view class="summary-item">
|
<text class="label">产品名称</text>
|
<up-tag :text="summary.productName || '-'" type="primary" size="mini" />
|
</view>
|
<view class="summary-item">
|
<text class="label">规格型号</text>
|
<text class="value">{{ summary.model || '-' }}</text>
|
</view>
|
<view class="summary-item">
|
<text class="label">需求数量</text>
|
<text class="value highlight">{{ summary.quantity || 0 }}</text>
|
</view>
|
</view>
|
|
<scroll-view scroll-y class="source-list" v-if="sourceList.length > 0">
|
<view v-for="(item, index) in sourceList" :key="index" class="source-card">
|
<view class="card-header">
|
<text class="plan-no">计划号: {{ item.mpsNo || '-' }}</text>
|
<up-tag :text="item.source || '未知'" :type="item.source === '销售' ? 'primary' : 'warning'" size="mini" />
|
</view>
|
<view class="card-content">
|
<view class="info-row">
|
<text class="info-label">合同号</text>
|
<text class="info-value">{{ item.salesContractNo || '-' }}</text>
|
</view>
|
<view class="info-row">
|
<text class="info-label">客户名称</text>
|
<text class="info-value">{{ item.customerName || '-' }}</text>
|
</view>
|
<view class="info-row">
|
<text class="info-label">项目名称</text>
|
<text class="info-value">{{ item.projectName || '-' }}</text>
|
</view>
|
<view class="info-row">
|
<text class="info-label">需求数量</text>
|
<text class="info-value">{{ item.qtyRequired || 0 }} {{ item.unit || '' }}</text>
|
</view>
|
<view class="info-row">
|
<text class="info-label">需求日期</text>
|
<text class="info-value">{{ formatDate(item.requiredDate) }}</text>
|
</view>
|
</view>
|
</view>
|
</scroll-view>
|
|
<view v-else class="no-data">
|
<up-empty mode="data" text="暂无来源数据"></up-empty>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref, reactive, onMounted } from "vue";
|
import { onLoad } from '@dcloudio/uni-app';
|
import dayjs from "dayjs";
|
import { getProductOrderSource } from "@/api/productionManagement/productionOrder.js";
|
import PageHeader from "@/components/PageHeader.vue";
|
|
const summary = ref(null);
|
const sourceList = ref([]);
|
const loading = ref(false);
|
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
|
const formatDate = (date) => {
|
return date ? dayjs(date).format('YYYY-MM-DD') : '-';
|
};
|
|
onLoad((options) => {
|
if (options.id) {
|
summary.value = {
|
productName: decodeURIComponent(options.productName || ''),
|
model: decodeURIComponent(options.model || ''),
|
quantity: options.quantity || 0
|
};
|
fetchSource(options.id);
|
}
|
});
|
|
const fetchSource = (id) => {
|
loading.value = true;
|
getProductOrderSource(id).then(res => {
|
sourceList.value = res.data || [];
|
loading.value = false;
|
}).catch(() => {
|
loading.value = false;
|
uni.showToast({
|
title: '获取来源失败',
|
icon: 'error'
|
});
|
});
|
};
|
</script>
|
|
<style scoped lang="scss">
|
.production-order-source {
|
min-height: 100vh;
|
background: #f8f9fa;
|
display: flex;
|
flex-direction: column;
|
}
|
|
.summary-card {
|
background: #fff;
|
margin: 20rpx;
|
padding: 24rpx;
|
border-radius: 16rpx;
|
box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.05);
|
|
.summary-item {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
margin-bottom: 12rpx;
|
&:last-child { margin-bottom: 0; }
|
|
.label { font-size: 26rpx; color: #999; }
|
.value { font-size: 26rpx; color: #333; }
|
.highlight { color: #f56c6c; font-weight: bold; }
|
}
|
}
|
|
.source-list {
|
flex: 1;
|
height: 0;
|
padding: 0 20rpx;
|
}
|
|
.source-card {
|
background: #fff;
|
margin-bottom: 20rpx;
|
padding: 24rpx;
|
border-radius: 16rpx;
|
box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.03);
|
|
.card-header {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding-bottom: 16rpx;
|
border-bottom: 1rpx solid #f9f9f9;
|
margin-bottom: 16rpx;
|
|
.plan-no { font-size: 28rpx; font-weight: bold; color: #333; }
|
}
|
|
.info-row {
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 12rpx;
|
&:last-child { margin-bottom: 0; }
|
|
.info-label { font-size: 24rpx; color: #999; }
|
.info-value { font-size: 24rpx; color: #666; }
|
}
|
}
|
|
.no-data { padding-top: 100rpx; }
|
</style>
|