<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>标准报价单详情 - 服务价格标准化管理系统</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background: #f5f7fa;
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        .header {
            background: white;
            padding: 20px 30px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header h1 {
            color: #333;
            font-size: 24px;
            font-weight: 600;
        }

        .header-actions {
            display: flex;
            gap: 10px;
        }

        .card {
            background: white;
            border-radius: 8px;
            padding: 30px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }

        .card-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
            margin-bottom: 25px;
            padding-bottom: 12px;
            border-bottom: 2px solid #409eff;
        }

        .quote-header {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            margin-bottom: 30px;
        }

        .quote-info-item {
            margin-bottom: 15px;
        }

        .quote-info-label {
            font-size: 14px;
            color: #909399;
            margin-bottom: 5px;
        }

        .quote-info-value {
            font-size: 16px;
            color: #333;
            font-weight: 500;
        }

        .quote-no {
            font-size: 20px;
            color: #409eff;
            font-weight: 600;
        }

        .detail-section {
            margin-bottom: 30px;
        }

        .detail-section-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
            margin-bottom: 15px;
            padding-bottom: 8px;
            border-bottom: 1px solid #e4e7ed;
        }

        .detail-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }

        .detail-table th,
        .detail-table td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #e4e7ed;
        }

        .detail-table th {
            background: #f5f7fa;
            font-weight: 600;
            color: #333;
        }

        .detail-table tr:last-child td {
            border-bottom: none;
        }

        .summary-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        .summary-table td {
            padding: 12px;
            text-align: right;
        }

        .summary-table td:first-child {
            text-align: left;
            font-weight: 600;
            color: #333;
        }

        .total-row {
            font-weight: 600;
            font-size: 18px;
            color: #409eff;
            border-top: 2px solid #409eff;
        }

        .total-row td {
            padding-top: 15px;
            padding-bottom: 15px;
        }

        .quote-footer {
            background: #f5f7fa;
            padding: 20px;
            border-radius: 6px;
            margin-top: 30px;
        }

        .quote-footer-item {
            margin-bottom: 10px;
            font-size: 14px;
            color: #606266;
        }

        .quote-footer-item:last-child {
            margin-bottom: 0;
        }

        .quote-footer-label {
            font-weight: 600;
            color: #333;
        }

        .btn {
            padding: 10px 24px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s;
            font-weight: 500;
        }

        .btn-primary {
            background: #409eff;
            color: white;
        }

        .btn-primary:hover {
            background: #66b1ff;
        }

        .btn-success {
            background: #67c23a;
            color: white;
        }

        .btn-success:hover {
            background: #85ce61;
        }

        .btn-default {
            background: #f5f7fa;
            color: #606266;
            border: 1px solid #dcdfe6;
        }

        .btn-default:hover {
            background: #ecf5ff;
            color: #409eff;
            border-color: #409eff;
        }

        .status-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 500;
        }

        .status-badge.active {
            background: #f0f9ff;
            color: #67c23a;
            border: 1px solid #67c23a;
        }

        @media print {
            body {
                background: white;
                padding: 0;
            }
            .header-actions {
                display: none;
            }
            .card {
                box-shadow: none;
            }
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="container">
            <div class="header">
                <div class="header-top">
                    <h1>标准报价单详情</h1>
                    <div class="header-actions">
                        <button class="btn btn-success" @click="handleExport">导出</button>
                        <button class="btn btn-primary" @click="handlePrint">打印</button>
                        <button class="btn btn-default" @click="handleBack">返回</button>
                    </div>
                </div>
            </div>

            <div class="card">
                <!-- 报价单头部信息 -->
                <div class="quote-header">
                    <div>
                        <div class="quote-info-item">
                            <div class="quote-info-label">报价单编号</div>
                            <div class="quote-info-value quote-no">{{ quoteInfo.quoteNo }}</div>
                        </div>
                        <div class="quote-info-item">
                            <div class="quote-info-label">客户名称</div>
                            <div class="quote-info-value">{{ quoteInfo.customerName }}</div>
                        </div>
                        <div class="quote-info-item">
                            <div class="quote-info-label">服务内容</div>
                            <div class="quote-info-value">{{ quoteInfo.serviceDescription }}</div>
                        </div>
                    </div>
                    <div>
                        <div class="quote-info-item">
                            <div class="quote-info-label">报价日期</div>
                            <div class="quote-info-value">{{ quoteInfo.quoteDate }}</div>
                        </div>
                        <div class="quote-info-item">
                            <div class="quote-info-label">报价有效期</div>
                            <div class="quote-info-value">{{ quoteInfo.validUntil }}</div>
                        </div>
                        <div class="quote-info-item">
                            <div class="quote-info-label">状态</div>
                            <div class="quote-info-value">
                                <span class="status-badge active">{{ quoteInfo.status }}</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 人工费用明细 -->
                <div class="detail-section" v-if="laborDetails.length > 0">
                    <div class="detail-section-title">人工费用明细</div>
                    <table class="detail-table">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>服务类型</th>
                                <th>技术等级</th>
                                <th>计费方式</th>
                                <th>数量</th>
                                <th>单价</th>
                                <th>小计</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="(item, index) in laborDetails" :key="index">
                                <td>{{ index + 1 }}</td>
                                <td>{{ item.serviceType }}</td>
                                <td>{{ item.techLevel }}</td>
                                <td>{{ item.billingMethod }}</td>
                                <td>{{ item.quantity }} {{ item.billingMethod === '按小时' ? '小时' : '次' }}</td>
                                <td>¥{{ item.price }}/{{ item.billingMethod === '按小时' ? '小时' : '次' }}</td>
                                <td>¥{{ (item.price * item.quantity).toFixed(2) }}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <!-- 零件费用明细 -->
                <div class="detail-section" v-if="partDetails.length > 0">
                    <div class="detail-section-title">零件费用明细</div>
                    <table class="detail-table">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>零件名称</th>
                                <th>型号规格</th>
                                <th>数量</th>
                                <th>单价</th>
                                <th>小计</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="(item, index) in partDetails" :key="index">
                                <td>{{ index + 1 }}</td>
                                <td>{{ item.partName }}</td>
                                <td>{{ item.specification }}</td>
                                <td>{{ item.quantity }}</td>
                                <td>¥{{ item.price }}</td>
                                <td>¥{{ (item.price * item.quantity).toFixed(2) }}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <!-- 费用汇总 -->
                <div class="detail-section">
                    <div class="detail-section-title">费用汇总</div>
                    <table class="summary-table">
                        <tbody>
                            <tr v-if="laborSubtotal > 0">
                                <td>人工费用小计：</td>
                                <td>¥{{ laborSubtotal.toFixed(2) }}</td>
                            </tr>
                            <tr v-if="partSubtotal > 0">
                                <td>零件费用小计：</td>
                                <td>¥{{ partSubtotal.toFixed(2) }}</td>
                            </tr>
                            <tr class="total-row">
                                <td>总计（含税）：</td>
                                <td>¥{{ totalAmount.toFixed(2) }}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <!-- 报价依据 -->
                <div class="quote-footer">
                    <div class="quote-footer-item">
                        <span class="quote-footer-label">报价依据：</span>
                        服务价格白皮书 {{ quoteInfo.whitebookVersion }}
                    </div>
                    <div class="quote-footer-item">
                        <span class="quote-footer-label">适用规则：</span>
                        {{ quoteInfo.ruleName }}
                    </div>
                    <div class="quote-footer-item">
                        <span class="quote-footer-label">服务场景：</span>
                        {{ quoteInfo.scenario }}（质保期外）
                    </div>
                    <div class="quote-footer-item">
                        <span class="quote-footer-label">备注：</span>
                        {{ quoteInfo.remark || '无' }}
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        const { createApp } = Vue;

        createApp({
            data() {
                // 从URL获取报价单编号
                const urlParams = new URLSearchParams(window.location.search);
                const quoteNo = urlParams.get('quoteNo') || 'QT' + new Date().getTime();

                // 模拟报价单数据（实际应从后端获取）
                return {
                    quoteInfo: {
                        quoteNo: quoteNo,
                        customerName: '示例客户有限公司',
                        serviceDescription: '服务器故障维修服务，包括硬件检测、故障排查、零件更换等',
                        quoteDate: new Date().toLocaleDateString('zh-CN'),
                        validUntil: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toLocaleDateString('zh-CN'),
                        status: '有效',
                        whitebookVersion: 'V1.0',
                        ruleName: '停机服务标准报价规则',
                        scenario: '停机',
                        remark: '本报价单有效期30天，最终价格以实际服务为准。'
                    },
                    laborDetails: [
                        {
                            serviceType: '上门',
                            techLevel: '普通',
                            billingMethod: '按小时',
                            price: 150,
                            quantity: 2
                        },
                        {
                            serviceType: '上门',
                            techLevel: '高级',
                            billingMethod: '按小时',
                            price: 250,
                            quantity: 1
                        }
                    ],
                    partDetails: [
                        {
                            partName: '服务器硬盘',
                            specification: '2TB SATA',
                            price: 800,
                            quantity: 1
                        },
                        {
                            partName: '内存条',
                            specification: '16GB DDR4',
                            price: 600,
                            quantity: 2
                        }
                    ]
                }
            },
            computed: {
                laborSubtotal() {
                    return this.laborDetails.reduce((sum, item) => sum + (item.price * item.quantity), 0);
                },
                partSubtotal() {
                    return this.partDetails.reduce((sum, item) => sum + (item.price * item.quantity), 0);
                },
                totalAmount() {
                    return this.laborSubtotal + this.partSubtotal;
                }
            },
            methods: {
                handleExport() {
                    alert('导出功能（占位）\n将导出为PDF或Excel格式');
                },
                handlePrint() {
                    window.print();
                },
                handleBack() {
                    window.location.href = '8-标准报价单生成页.html';
                }
            }
        }).mount('#app');
    </script>
</body>
</html>

