zhangwencui
2 天以前 f670b79094c95d791fc43c8fc8b5858ebf8426dc
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<!--
  协同审批 / 业务单据详情
  approveType 5=采购 6=报价 7=发货,单据号取表单「审批事由」字段承载的编号
-->
<template>
  <view class="business-detail">
    <!-- 报价审批详情 -->
    <view v-if="isQuotationApproval"
          class="business-detail-block">
      <u-divider text="报价详情"
                 text-size="28rpx"
                 color="#2979ff"></u-divider>
      <u-skeleton :loading="quotationLoading"
                  rows="3"
                  animated>
        <view v-if="!currentQuotation || !currentQuotation.quotationNo"
              class="business-detail-empty">
          未查询到对应报价详情
        </view>
        <view v-else>
          <u-cell-group :border="false">
            <u-cell title="报价单号"
                    :value="currentQuotation.quotationNo"></u-cell>
            <u-cell title="客户名称"
                    :value="currentQuotation.customer"></u-cell>
            <u-cell title="业务员"
                    :value="currentQuotation.salesperson"></u-cell>
            <u-cell title="报价日期"
                    :value="currentQuotation.quotationDate"></u-cell>
            <u-cell title="有效期至"
                    :value="currentQuotation.validDate"></u-cell>
            <u-cell title="付款方式"
                    :value="currentQuotation.paymentMethod"></u-cell>
            <u-cell title="报价总额">
              <template #value>
                <text class="business-detail-amount">
                  ¥{{ Number(currentQuotation.totalAmount ?? 0).toFixed(2) }}
                </text>
              </template>
            </u-cell>
          </u-cell-group>
          <view class="business-detail-products">
            <view class="business-detail-subtitle">产品明细</view>
            <view v-for="(item, index) in (currentQuotation.products || [])"
                  :key="index"
                  class="business-detail-item">
              <view class="business-detail-item-head">
                <text class="business-detail-item-name">{{ item.product }}</text>
                <text class="business-detail-amount">¥{{ Number(item.unitPrice ?? 0).toFixed(2) }}</text>
              </view>
              <view class="business-detail-item-desc">
                规格: {{ item.specification }} | 单位: {{ item.unit }}
              </view>
            </view>
          </view>
          <view v-if="currentQuotation.remark"
                class="business-detail-remark">
            <view class="business-detail-subtitle">备注</view>
            <view class="business-detail-remark-text">{{ currentQuotation.remark }}</view>
          </view>
        </view>
      </u-skeleton>
    </view>
 
    <!-- 采购审批详情 -->
    <view v-if="isPurchaseApproval"
          class="business-detail-block">
      <u-divider text="采购详情"
                 text-size="28rpx"
                 color="#2979ff"></u-divider>
      <u-skeleton :loading="purchaseLoading"
                  rows="3"
                  animated>
        <view v-if="!currentPurchase || !currentPurchase.purchaseContractNumber"
              class="business-detail-empty">
          未查询到对应采购详情
        </view>
        <view v-else>
          <u-cell-group :border="false">
            <u-cell title="采购合同号"
                    :value="currentPurchase.purchaseContractNumber"></u-cell>
            <u-cell title="供应商名称"
                    :value="currentPurchase.supplierName"></u-cell>
            <u-cell title="项目名称"
                    :value="currentPurchase.projectName"></u-cell>
            <u-cell title="销售合同号"
                    :value="currentPurchase.salesContractNo"></u-cell>
            <u-cell title="签订日期"
                    :value="currentPurchase.executionDate"></u-cell>
            <u-cell title="录入日期"
                    :value="currentPurchase.entryDate"></u-cell>
            <u-cell title="付款方式"
                    :value="currentPurchase.paymentMethod"></u-cell>
            <u-cell title="合同金额">
              <template #value>
                <text class="business-detail-amount">
                  ¥{{ Number(currentPurchase.contractAmount ?? 0).toFixed(2) }}
                </text>
              </template>
            </u-cell>
          </u-cell-group>
          <view class="business-detail-products">
            <view class="business-detail-subtitle">产品明细</view>
            <view v-for="(item, index) in (currentPurchase.productData || [])"
                  :key="index"
                  class="business-detail-item">
              <view class="business-detail-item-head">
                <text class="business-detail-item-name">{{ item.productCategory }}</text>
                <text class="business-detail-amount">¥{{ Number(item.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</text>
              </view>
              <view class="business-detail-item-desc">
                规格: {{ item.specificationModel }} | 数量: {{ item.quantity }} {{ item.unit }}
              </view>
              <view class="business-detail-item-extra">
                含税单价: ¥{{ Number(item.taxInclusiveUnitPrice ?? 0).toFixed(2) }}
              </view>
            </view>
          </view>
        </view>
      </u-skeleton>
    </view>
 
    <!-- 发货审批详情 -->
    <view v-if="isDeliveryApproval"
          class="business-detail-block">
      <u-divider text="发货详情"
                 text-size="28rpx"
                 color="#2979ff"></u-divider>
      <u-skeleton :loading="deliveryLoading"
                  rows="3"
                  animated>
        <view v-if="!currentDelivery || !currentDelivery.shippingInfo"
              class="business-detail-empty">
          未查询到对应发货详情
        </view>
        <view v-else>
          <u-cell-group :border="false">
            <u-cell title="销售订单"
                    :value="currentDelivery.shippingInfo.salesContractNo || '--'"></u-cell>
            <u-cell title="发货订单号"
                    :value="currentDelivery.shippingInfo.shippingNo || '--'"></u-cell>
            <u-cell title="客户名称"
                    :value="currentDelivery.shippingInfo.customerName || '--'"></u-cell>
            <u-cell title="发货类型"
                    :value="currentDelivery.shippingInfo.type || '--'"></u-cell>
            <u-cell title="发货日期"
                    :value="currentDelivery.shippingInfo.shippingDate || '--'"></u-cell>
            <u-cell title="审核状态"
                    :value="currentDelivery.shippingInfo.status || '--'"></u-cell>
            <u-cell title="发货车牌号"
                    :value="currentDelivery.shippingInfo.shippingCarNumber || '--'"></u-cell>
            <u-cell title="快递公司"
                    :value="currentDelivery.shippingInfo.expressCompany || '--'"></u-cell>
            <u-cell title="快递单号"
                    :value="currentDelivery.shippingInfo.expressNumber || '--'"></u-cell>
          </u-cell-group>
          <view class="business-detail-products">
            <view class="business-detail-subtitle">产品明细</view>
            <view v-for="(item, index) in deliveryProductList"
                  :key="index"
                  class="business-detail-item">
              <view class="business-detail-item-head">
                <text class="business-detail-item-name">{{ item.productName }}</text>
                <text class="business-detail-count">数量: {{ item.deliveryQuantity }}</text>
              </view>
              <view class="business-detail-item-desc">
                规格: {{ item.specificationModel }}
              </view>
              <view v-if="item.batchNo"
                    class="business-detail-item-extra">
                批号: {{ item.batchNo }}
              </view>
            </view>
          </view>
          <view v-if="currentDelivery.shippingInfo.storageBlobVOs && currentDelivery.shippingInfo.storageBlobVOs.length"
                class="business-detail-remark">
            <view class="business-detail-subtitle">发货图片</view>
            <CommonUpload :model-value="currentDelivery.shippingInfo.storageBlobVOs"
                          disabled />
          </view>
        </view>
      </u-skeleton>
    </view>
  </view>
</template>
 
<script setup>
  import { computed, ref, watch } from "vue";
  import CommonUpload from "@/components/CommonUpload.vue";
  import { getDeliveryDetailByShippingNo } from "@/api/collaborativeApproval/approvalProcess";
  import { getQuotationList } from "@/api/salesManagement/salesQuotation";
  import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger";
 
  const props = defineProps({
    /** 审批类型:5 采购 / 6 报价 / 7 发货 */
    approveType: { type: [Number, String], default: 0 },
    /** 业务单据编号(表单「审批事由」承载) */
    businessNo: { type: String, default: "" },
  });
 
  const type = computed(() => Number(props.approveType));
  const isQuotationApproval = computed(() => type.value === 6);
  const isPurchaseApproval = computed(() => type.value === 5);
  const isDeliveryApproval = computed(() => type.value === 7);
 
  const quotationLoading = ref(false);
  const currentQuotation = ref({});
  const purchaseLoading = ref(false);
  const currentPurchase = ref({});
  const deliveryLoading = ref(false);
  const currentDelivery = ref({});
  const deliveryProductList = ref([]);
 
  const fetchDetailData = async () => {
    const no = (props.businessNo || "").trim();
    if (!no) return;
 
    if (isQuotationApproval.value) {
      quotationLoading.value = true;
      getQuotationList({ quotationNo: no })
        .then(res => {
          const records = res?.data?.records || [];
          currentQuotation.value = records[0] || {};
        })
        .catch(() => {
          currentQuotation.value = {};
        })
        .finally(() => {
          quotationLoading.value = false;
        });
      return;
    }
 
    if (isPurchaseApproval.value) {
      purchaseLoading.value = true;
      getPurchaseByCode({ purchaseContractNumber: no })
        .then(res => {
          currentPurchase.value = res?.data || res || {};
        })
        .catch(() => {
          currentPurchase.value = {};
        })
        .finally(() => {
          purchaseLoading.value = false;
        });
      return;
    }
 
    if (isDeliveryApproval.value) {
      deliveryLoading.value = true;
      currentDelivery.value = {};
      deliveryProductList.value = [];
      getDeliveryDetailByShippingNo({ shippingNo: no })
        .then(res => {
          const detailData = res?.data || res || {};
          currentDelivery.value = detailData;
          deliveryProductList.value =
            detailData.shippingProductDetailDtoList || [];
        })
        .catch(() => {
          currentDelivery.value = {};
          deliveryProductList.value = [];
        })
        .finally(() => {
          deliveryLoading.value = false;
        });
    }
  };
 
  watch(
    () => [props.approveType, props.businessNo],
    () => {
      currentQuotation.value = {};
      currentPurchase.value = {};
      currentDelivery.value = {};
      deliveryProductList.value = [];
      fetchDetailData();
    },
    { immediate: true }
  );
</script>
 
<style scoped lang="scss">
  .business-detail-block {
    margin: 20rpx 0;
  }
 
  .business-detail-empty {
    padding: 40rpx;
    text-align: center;
    color: #999;
  }
 
  .business-detail-amount {
    font-size: 32rpx;
    color: #e6a23c;
    font-weight: bold;
  }
 
  .business-detail-count {
    color: #2979ff;
  }
 
  .business-detail-products {
    margin-top: 20rpx;
    padding: 0 30rpx;
  }
 
  .business-detail-subtitle {
    font-size: 28rpx;
    font-weight: bold;
    margin-bottom: 10rpx;
  }
 
  .business-detail-item {
    background: #f8f8f8;
    border-radius: 8rpx;
    padding: 20rpx;
    margin-bottom: 10rpx;
  }
 
  .business-detail-item-head {
    display: flex;
    justify-content: space-between;
  }
 
  .business-detail-item-name {
    font-weight: bold;
  }
 
  .business-detail-item-desc {
    font-size: 24rpx;
    color: #666;
    margin-top: 10rpx;
  }
 
  .business-detail-item-extra {
    font-size: 24rpx;
    color: #999;
    margin-top: 4rpx;
  }
 
  .business-detail-remark {
    margin-top: 20rpx;
    padding: 0 30rpx;
  }
 
  .business-detail-remark-text {
    font-size: 26rpx;
    color: #666;
    margin-top: 10rpx;
  }
</style>