zhangwencui
2026-04-30 fa403c58d2bea76a7131ea9dbb1d60247ea9ca77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<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>