<template>
|
<view class="sales-account">
|
<PageHeader title="采购退货详情" @back="goBack" />
|
<view class="ledger-list" v-if="loaded">
|
<view class="ledger-item">
|
<view class="item-header">
|
<view class="item-left">
|
<view class="document-icon">
|
<up-icon name="file-text" size="16" color="#ffffff"></up-icon>
|
</view>
|
<text class="item-id">{{ detail.no || "-" }}</text>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">退货方式</text>
|
<text class="detail-value">{{ getReturnTypeLabel(detail.returnType) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">供应商名称</text>
|
<text class="detail-value">{{ detail.supplierName || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">项目阶段</text>
|
<text class="detail-value">{{ getProjectPhaseLabel(detail.projectPhase) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">关联单号</text>
|
<text class="detail-value">{{ detail.purchaseContractNumber || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">制作日期</text>
|
<text class="detail-value">{{ detail.preparedAt || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">制单人</text>
|
<text class="detail-value">{{ detail.preparedUserName || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">退料人</text>
|
<text class="detail-value">{{ detail.returnUserName || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">整单折扣额</text>
|
<text class="detail-value">{{ formatAmount(detail.totalDiscountAmount) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">整单折扣率</text>
|
<text class="detail-value">{{ detail.totalDiscountRate ?? "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">成交金额</text>
|
<text class="detail-value highlight">{{ formatAmount(detail.totalAmount) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">备注</text>
|
<text class="detail-value">{{ detail.remark || "-" }}</text>
|
</view>
|
</view>
|
</view>
|
|
<view class="section-title">
|
<text class="section-text">产品列表</text>
|
</view>
|
|
<view v-if="products.length === 0" class="no-data">
|
<text>暂无产品数据</text>
|
</view>
|
<view v-else>
|
<view v-for="(p, idx) in products" :key="idx" class="ledger-item">
|
<view class="item-header">
|
<view class="item-left">
|
<view class="document-icon">
|
<up-icon name="file-text" size="16" color="#ffffff"></up-icon>
|
</view>
|
<text class="item-id">产品 {{ idx + 1 }}</text>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">产品大类</text>
|
<text class="detail-value">{{ p.productCategory || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">规格型号</text>
|
<text class="detail-value">{{ p.specificationModel || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">单位</text>
|
<text class="detail-value">{{ p.unit || "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">数量</text>
|
<text class="detail-value">{{ p.quantity ?? "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">退货数量</text>
|
<text class="detail-value highlight">{{ p.returnQuantity ?? "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">税率(%)</text>
|
<text class="detail-value">{{ p.taxRate ?? "-" }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">含税单价(元)</text>
|
<text class="detail-value">{{ formatAmount(p.taxInclusiveUnitPrice) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">含税总价(元)</text>
|
<text class="detail-value">{{ formatAmount(p.taxInclusiveTotalPrice) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">是否质检</text>
|
<text class="detail-value">{{ p.isChecked ? "是" : "否" }}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref } from "vue";
|
import { onLoad } from "@dcloudio/uni-app";
|
import { getPurchaseReturnOrderDetail } from "@/api/procurementManagement/purchaseReturnOrder";
|
|
const id = ref(undefined);
|
const loaded = ref(false);
|
const detail = ref({});
|
const products = ref([]);
|
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
|
const getReturnTypeLabel = value => {
|
if (String(value) === "0") return "退货退款";
|
if (String(value) === "1") return "拒收";
|
return "-";
|
};
|
|
const getProjectPhaseLabel = value => {
|
const map = {
|
0: "立项",
|
1: "设计",
|
2: "采购",
|
3: "生产",
|
4: "出货",
|
};
|
const key = String(value);
|
return map[key] || "-";
|
};
|
|
const formatAmount = value => {
|
if (value === null || value === undefined || value === "") return "-";
|
const num = Number(value);
|
if (Number.isNaN(num)) return "-";
|
return num.toFixed(2);
|
};
|
|
const loadDetail = () => {
|
if (!id.value) return;
|
uni.showLoading({ title: "加载中...", mask: true });
|
getPurchaseReturnOrderDetail(id.value)
|
.then(res => {
|
const payload = res?.data || {};
|
detail.value = payload;
|
const rows = payload.purchaseReturnOrderProductsDetailVoList || [];
|
products.value = rows.map(i => ({ ...i, ...(i.salesLedgerProduct || {}) }));
|
loaded.value = true;
|
})
|
.catch(() => {
|
uni.showToast({ title: "获取详情失败", icon: "error" });
|
})
|
.finally(() => {
|
uni.hideLoading();
|
});
|
};
|
|
onLoad(options => {
|
if (options?.id) id.value = options.id;
|
loadDetail();
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "@/styles/procurement-common.scss";
|
|
.section-title {
|
padding: 0 20px;
|
margin: 12px 0 8px 0;
|
}
|
|
.section-text {
|
font-size: 14px;
|
color: #333;
|
font-weight: 600;
|
}
|
</style>
|