seatonwan9
2025-08-19 ade0cb41b9850438e78e06bcdf2d6590c41d6bc1
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
<template>
  <div class="product-list-container">
    <div class="page-header">
      <div class="header-content">
        <h2>产品列表</h2>
        <p>测试产品价格查看组件功能</p>
      </div>
    </div>
 
    <el-card class="product-card" shadow="never">
      <template #header>
        <div class="card-header">
          <span>产品信息</span>
          <el-button type="primary" @click="handleAddProduct">添加产品</el-button>
        </div>
      </template>
 
      <el-table
        :data="productList"
        v-loading="loading"
        style="width: 100%"
        border
        stripe
      >
        <el-table-column prop="id" label="产品ID" width="120" />
        <el-table-column prop="name" label="产品名称" min-width="200" />
        <el-table-column prop="productType" label="产品类型" width="120" />
        <el-table-column prop="industry" label="行业领域" width="150" />
        <el-table-column prop="submitUnit" label="提报单位" width="150" />
        <el-table-column prop="shelfStatus" label="上架状态" width="100">
          <template #default="{ row }">
            <el-tag :type="getStatusType(row.shelfStatus)" size="small">
              {{ row.shelfStatus }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200" fixed="right">
          <template #default="{ row }">
            <el-button
              type="primary"
              size="small"
              @click="handlePriceManage(row)"
            >
              价格管理
            </el-button>
            <el-button
              type="success"
              size="small"
              @click="handleViewPricing(row)"
            >
              查看定价
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
 
    <!-- 产品价格查看弹窗 -->
    <ProductPriceViewer
      v-model="priceViewerVisible"
      :product-id="currentProductId"
      @order="handleOrder"
    />
  </div>
</template>
 
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import ProductPriceViewer from '@/views/productManage/productPriceViewer/index.vue'
 
interface ProductItem {
  id: string
  name: string
  productType: string
  industry: string
  submitUnit: string
  submitter: string
  projectUnit: string
  industryStage: string
  description: string
  shelfStatus: '待上架' | '已上架' | '已下架'
}
 
const router = useRouter()
const loading = ref(false)
const productList = ref<ProductItem[]>([])
 
// 价格查看弹窗相关
const priceViewerVisible = ref(false)
const currentProductId = ref('')
 
// 模拟产品数据
const mockProductList: ProductItem[] = [
  {
    id: '1',
    name: '数字化产品A',
    productType: '软件/平台',
    industry: '交通基础设施',
    submitUnit: '中交一公局',
    submitter: '张三',
    projectUnit: '某高速公路工程',
    industryStage: '应用阶段',
    description: '本产品定位为以建设期BIM数字资产作为数字底盘,结合项目运营维保需求的实时性、交互性、便捷性的三维可视化运维管理系统。系统提供项目数字化、智能化运维管理功能,能够解决建筑运行维护管理中的实际问题,实现信息快速整合与查询、信息有效共享与传递,提升项目综合管理与维护水平。',
    shelfStatus: '待上架'
  },
  {
    id: '2',
    name: '数字化产品B',
    productType: '硬件/传感',
    industry: '市政工程',
    submitUnit: '中交二航局',
    submitter: '李四',
    projectUnit: '智慧管廊项目',
    industryStage: '研发阶段',
    description: '面向城市管廊监测的传感设备与采集网关,支持边缘计算与远程运维。',
    shelfStatus: '已上架'
  },
  {
    id: '3',
    name: '数字化产品C',
    productType: '软件/平台',
    industry: '建筑工程',
    submitUnit: '中交三航局',
    submitter: '王五',
    projectUnit: '智慧建筑项目',
    industryStage: '应用阶段',
    description: '基于BIM技术的建筑工程管理平台,提供设计、施工、运维全生命周期管理。',
    shelfStatus: '已下架'
  },
  {
    id: '10004',
    name: '数字化产品D',
    productType: '硬件/传感',
    industry: '水利工程',
    submitUnit: '中交四航局',
    submitter: '赵六',
    projectUnit: '智慧水利项目',
    industryStage: '研发阶段',
    description: '水利工程监测设备与数据采集系统,支持实时监测和预警。',
    shelfStatus: '已上架'
  }
]
 
// 获取状态类型
const getStatusType = (status: string) => {
  switch (status) {
    case '已上架':
      return 'success'
    case '待上架':
      return 'warning'
    case '已下架':
      return 'danger'
    default:
      return 'info'
  }
}
 
// 加载产品列表
const loadProductList = async () => {
  loading.value = true
  try {
    // 模拟API调用
    await new Promise(resolve => setTimeout(resolve, 500))
    productList.value = mockProductList
  } catch (error) {
    console.error('加载产品列表失败:', error)
    ElMessage.error('加载产品列表失败')
  } finally {
    loading.value = false
  }
}
 
// 添加产品
const handleAddProduct = () => {
  ElMessage.info('添加产品功能开发中...')
}
 
// 价格管理
const handlePriceManage = (row: ProductItem) => {
  // 跳转到价格管理页面
  router.push({
    path: `/product/price/${row.id}`
  })
}
 
// 查看定价
const handleViewPricing = (row: ProductItem) => {
  currentProductId.value = row.id
  priceViewerVisible.value = true
}
 
// 处理订购
const handleOrder = (selectedItems: any[]) => {
  console.log('选中的价格项:', selectedItems)
  ElMessage.success(`已选择 ${selectedItems.length} 个价格项进行订购`)
}
 
onMounted(() => {
  loadProductList()
})
</script>
 
<style scoped lang="scss">
.product-list-container {
  padding: 20px;
 
  .page-header {
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 20px;
    color: white;
 
    .header-content {
      h2 {
        margin: 0 0 8px 0;
        font-size: 24px;
        font-weight: 600;
      }
 
      p {
        margin: 0;
        opacity: 0.9;
        font-size: 14px;
      }
    }
  }
 
  .product-card {
    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
 
      span {
        font-size: 16px;
        font-weight: 600;
        color: #303133;
      }
    }
  }
 
  :deep(.el-table) {
    .el-table__header {
      th {
        background-color: #f5f7fa;
        color: #303133;
        font-weight: 600;
      }
    }
 
    .el-table__row {
      &:hover {
        background-color: #f5f7fa;
      }
    }
  }
}
</style>