From af7fa041da9f063ca49f1f1126ec01616f14cd85 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 28 八月 2025 14:04:17 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_JLMY' into dev_JLMY
---
src/views/sales/components/PurchaseReturnViewDialog.vue | 324 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 324 insertions(+), 0 deletions(-)
diff --git a/src/views/sales/components/PurchaseReturnViewDialog.vue b/src/views/sales/components/PurchaseReturnViewDialog.vue
new file mode 100644
index 0000000..529b682
--- /dev/null
+++ b/src/views/sales/components/PurchaseReturnViewDialog.vue
@@ -0,0 +1,324 @@
+<template>
+ <el-dialog
+ :model-value="dialogViewVisible"
+ @update:model-value="$emit('update:dialogViewVisible', $event)"
+ :title="title"
+ width="900px"
+ :close-on-click-modal="false"
+ >
+ <div class="view-container">
+ <!-- 鍩烘湰淇℃伅 -->
+ <el-card class="info-card" shadow="never">
+ <template #header>
+ <div class="card-header">
+ <span>鍩烘湰淇℃伅</span>
+ </div>
+ </template>
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="閫�璐у崟鍙�">
+ {{ form.returnNo || '-' }}
+ </el-descriptions-item>
+ <el-descriptions-item label="渚涘簲鍟�">
+ {{ form.supplierName || '-' }}
+ </el-descriptions-item>
+ <el-descriptions-item label="鍗曟嵁鏃ユ湡">
+ {{ form.returnDate || '-' }}
+ </el-descriptions-item>
+ <el-descriptions-item label="鎿嶄綔鍛�">
+ {{ form.operatorName || '-' }}
+ </el-descriptions-item>
+ <el-descriptions-item label="閫�璐у師鍥�">
+ {{ form.returnReason || '-' }}
+ </el-descriptions-item>
+ <el-descriptions-item label="鐘舵��">
+ <el-tag :type="getStatusType(form.status)">
+ {{ getStatusText(form.status) }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="閫�璐ф暟閲�">
+ {{ form.returnQuantity || 0 }} 鍚�
+ </el-descriptions-item>
+ <el-descriptions-item label="閫�璐ч噾棰�">
+ {{ form.returnAmount || 0 }} 鍏�
+ </el-descriptions-item>
+ <el-descriptions-item label="鍒涘缓鏃堕棿" :span="2">
+ {{ form.createTime || '-' }}
+ </el-descriptions-item>
+ <el-descriptions-item label="澶囨敞" :span="2">
+ {{ form.remark || '-' }}
+ </el-descriptions-item>
+ </el-descriptions>
+ </el-card>
+
+ <!-- 閫�璐у晢鍝佹槑缁� -->
+ <el-card class="info-card" shadow="never">
+ <template #header>
+ <div class="card-header">
+ <span>閫�璐у晢鍝佹槑缁�</span>
+ </div>
+ </template>
+ <el-table :data="form.returnItems || []" border style="width: 100%">
+ <el-table-column label="搴忓彿" type="index" width="60" />
+ <el-table-column label="鍟嗗搧鍚嶇О" prop="coalName" width="150" />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specification" width="150" />
+ <el-table-column label="鏁伴噺" prop="quantity" width="100">
+ <template #default="scope">
+ {{ scope.row.quantity || 0 }} 鍚�
+ </template>
+ </el-table-column>
+ <el-table-column label="鍗曚环" prop="unitPrice" width="120">
+ <template #default="scope">
+ {{ scope.row.unitPrice || 0 }} 鍏�/鍚�
+ </template>
+ </el-table-column>
+ <el-table-column label="灏忚" width="120">
+ <template #default="scope">
+ {{ ((scope.row.quantity || 0) * (scope.row.unitPrice || 0)).toFixed(2) }} 鍏�
+ </template>
+ </el-table-column>
+ </el-table>
+ <div class="table-summary">
+ <span class="summary-item">
+ 鎬绘暟閲忥細<strong>{{ getTotalQuantity() }} 鍚�</strong>
+ </span>
+ <span class="summary-item">
+ 鎬婚噾棰濓細<strong>{{ getTotalAmount() }} 鍏�</strong>
+ </span>
+ </div>
+ </el-card>
+
+ <!-- 瀹℃壒娴佺▼ -->
+ <el-card class="info-card" shadow="never">
+ <template #header>
+ <div class="card-header">
+ <span>瀹℃壒娴佺▼</span>
+ </div>
+ </template>
+ <el-timeline>
+ <el-timeline-item
+ v-for="(activity, index) in approvalFlow"
+ :key="index"
+ :timestamp="activity.timestamp"
+ :type="activity.type"
+ >
+ <h4>{{ activity.title }}</h4>
+ <p>{{ activity.content }}</p>
+ <p v-if="activity.operator">鎿嶄綔浜猴細{{ activity.operator }}</p>
+ </el-timeline-item>
+ </el-timeline>
+ </el-card>
+ </div>
+
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="handleClose">鍏抽棴</el-button>
+ </div>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import { computed } from "vue";
+
+// Props
+const props = defineProps({
+ dialogViewVisible: {
+ type: Boolean,
+ default: false
+ },
+ form: {
+ type: Object,
+ default: () => ({})
+ },
+ title: {
+ type: String,
+ default: "閫�璐у崟璇︽儏"
+ }
+});
+
+// Emits
+const emit = defineEmits(['update:dialogViewVisible']);
+
+// 鑾峰彇鐘舵�佺被鍨�
+const getStatusType = (status) => {
+ const statusMap = {
+ draft: "",
+ pending: "warning",
+ approved: "success",
+ rejected: "danger",
+ completed: "info"
+ };
+ return statusMap[status] || "";
+};
+
+// 鑾峰彇鐘舵�佹枃鏈�
+const getStatusText = (status) => {
+ const statusMap = {
+ draft: "鑽夌",
+ pending: "寰呭鏍�",
+ approved: "宸插鏍�",
+ rejected: "宸叉嫆缁�",
+ completed: "宸插畬鎴�"
+ };
+ return statusMap[status] || status;
+};
+
+// 璁$畻鎬绘暟閲�
+const getTotalQuantity = () => {
+ if (!props.form.returnItems || props.form.returnItems.length === 0) {
+ return 0;
+ }
+ return props.form.returnItems.reduce((total, item) => total + (item.quantity || 0), 0);
+};
+
+// 璁$畻鎬婚噾棰�
+const getTotalAmount = () => {
+ if (!props.form.returnItems || props.form.returnItems.length === 0) {
+ return 0;
+ }
+ return props.form.returnItems.reduce((total, item) => {
+ return total + ((item.quantity || 0) * (item.unitPrice || 0));
+ }, 0).toFixed(2);
+};
+
+// 瀹℃壒娴佺▼鏁版嵁
+const approvalFlow = computed(() => {
+ const flow = [];
+
+ // 鍒涘缓
+ flow.push({
+ title: "鍒涘缓閫�璐у崟",
+ content: "閫�璐у崟宸插垱寤猴紝绛夊緟鎻愪氦瀹℃牳",
+ timestamp: props.form.createTime || new Date().toLocaleString(),
+ operator: props.form.operatorName || "绯荤粺",
+ type: "primary"
+ });
+
+ // 鏍规嵁鐘舵�佹坊鍔犲鎵规祦绋�
+ if (props.form.status === "pending") {
+ flow.push({
+ title: "鎻愪氦瀹℃牳",
+ content: "閫�璐у崟宸叉彁浜わ紝绛夊緟瀹℃牳",
+ timestamp: new Date().toLocaleString(),
+ operator: props.form.operatorName || "绯荤粺",
+ type: "warning"
+ });
+ } else if (props.form.status === "approved") {
+ flow.push({
+ title: "鎻愪氦瀹℃牳",
+ content: "閫�璐у崟宸叉彁浜わ紝绛夊緟瀹℃牳",
+ timestamp: new Date().toLocaleString(),
+ operator: props.form.operatorName || "绯荤粺",
+ type: "warning"
+ });
+ flow.push({
+ title: "瀹℃牳閫氳繃",
+ content: "閫�璐у崟瀹℃牳閫氳繃",
+ timestamp: new Date().toLocaleString(),
+ operator: "瀹℃牳鍛�",
+ type: "success"
+ });
+ } else if (props.form.status === "rejected") {
+ flow.push({
+ title: "鎻愪氦瀹℃牳",
+ content: "閫�璐у崟宸叉彁浜わ紝绛夊緟瀹℃牳",
+ timestamp: new Date().toLocaleString(),
+ operator: props.form.operatorName || "绯荤粺",
+ type: "warning"
+ });
+ flow.push({
+ title: "瀹℃牳鎷掔粷",
+ content: "閫�璐у崟瀹℃牳琚嫆缁�",
+ timestamp: new Date().toLocaleString(),
+ operator: "瀹℃牳鍛�",
+ type: "danger"
+ });
+ } else if (props.form.status === "completed") {
+ flow.push({
+ title: "鎻愪氦瀹℃牳",
+ content: "閫�璐у崟宸叉彁浜わ紝绛夊緟瀹℃牳",
+ timestamp: new Date().toLocaleString(),
+ operator: props.form.operatorName || "绯荤粺",
+ type: "warning"
+ });
+ flow.push({
+ title: "瀹℃牳閫氳繃",
+ content: "閫�璐у崟瀹℃牳閫氳繃",
+ timestamp: new Date().toLocaleString(),
+ operator: "瀹℃牳鍛�",
+ type: "success"
+ });
+ flow.push({
+ title: "閫�璐у畬鎴�",
+ content: "閫�璐ф祦绋嬪凡瀹屾垚",
+ timestamp: new Date().toLocaleString(),
+ operator: "绯荤粺",
+ type: "info"
+ });
+ }
+
+ return flow;
+});
+
+// 鍏抽棴瀵硅瘽妗�
+const handleClose = () => {
+ emit('update:dialogViewVisible', false);
+};
+</script>
+
+<style scoped>
+.view-container {
+ padding: 0;
+}
+
+.info-card {
+ margin-bottom: 20px;
+}
+
+.info-card:last-child {
+ margin-bottom: 0;
+}
+
+.card-header {
+ font-weight: bold;
+ font-size: 16px;
+}
+
+.table-summary {
+ margin-top: 15px;
+ text-align: right;
+ padding: 10px;
+ background-color: #f5f7fa;
+ border-radius: 4px;
+}
+
+.summary-item {
+ margin-left: 20px;
+ font-size: 14px;
+}
+
+.summary-item strong {
+ color: #409eff;
+ font-size: 16px;
+}
+
+.dialog-footer {
+ text-align: right;
+}
+
+.el-timeline {
+ padding: 20px;
+}
+
+.el-timeline-item h4 {
+ margin: 0 0 8px 0;
+ font-size: 14px;
+ color: #303133;
+}
+
+.el-timeline-item p {
+ margin: 4px 0;
+ font-size: 12px;
+ color: #606266;
+}
+</style>
--
Gitblit v1.9.3