diff --git a/frontend/src/views/Prices.vue b/frontend/src/views/Prices.vue
index 9fe6a8c..1b7d848 100644
--- a/frontend/src/views/Prices.vue
+++ b/frontend/src/views/Prices.vue
@@ -7,6 +7,11 @@
价格列表
@@ -38,7 +43,12 @@
-
+
+
@@ -49,7 +59,7 @@
-
+
{{ getBillingType(row.billing_type) }}
@@ -59,7 +69,7 @@
-
+
@@ -76,7 +86,7 @@
-
+
{{ row.currency }}
@@ -86,52 +96,69 @@
-
+
- {{ row.input_price }}
-
- 待审核: {{ row.temp_input_price }}
+ {{ row.input_price === 0 ? '免费' : row.input_price }}
+
+ 待审核: {{ row.temp_input_price === 0 ? '免费' : row.temp_input_price }}
-
+
- {{ row.output_price }}
-
- 待审核: {{ row.temp_output_price }}
+ {{ row.output_price === 0 ? '免费' : row.output_price }}
+
+ 待审核: {{ row.temp_output_price === 0 ? '免费' : row.temp_output_price }}
-
+
- {{ calculateRate(row.input_price, row.currency) }}
+ {{ row.input_price === 0 ? '免费' : calculateRate(row.input_price, row.currency) }}
-
+
- {{ calculateRate(row.output_price, row.currency) }}
+ {{ row.output_price === 0 ? '免费' : calculateRate(row.output_price, row.currency) }}
-
+
-
- {{ row.price_source }}
-
- 待审核: {{ row.temp_price_source }}
-
-
+ {{ row.created_by }}
-
+
- {{ getStatus(row.status) }}
+
+
+ 详情
+
+
+
+
价格来源:
+
+ {{ row.price_source }}
+
+ 待审核: {{ row.temp_price_source }}
+
+
+
+
+ 状态:
+ {{ getStatus(row.status) }}
+
+
+
-
@@ -610,7 +637,16 @@ const handleImport = () => {
const lines = importText.value.trim().split('\n')
const newRows = lines.map(line => {
- const [model, billingType, providerName, currency, inputPrice, outputPrice] = line.trim().split(/\s+/)
+ // 使用正则表达式匹配,考虑引号内的内容作为整体
+ const matches = line.trim().match(/("[^"]+"|[^\s]+)/g)
+ if (!matches || matches.length < 6) {
+ ElMessage.warning(`行格式不正确:${line}`)
+ return null
+ }
+
+ const [model, billingType, providerNameRaw, currency, inputPrice, outputPrice] = matches
+ // 去除可能存在的引号
+ const providerName = providerNameRaw.replace(/^"|"$/g, '')
// 查找模型厂商ID
const provider = providers.value.find(p => p.name === providerName)
@@ -636,7 +672,7 @@ const handleImport = () => {
}
return {
- model,
+ model: model.replace(/^"|"$/g, ''),
billing_type,
channel_type: provider.id.toString(),
currency: currencyCode,
@@ -654,6 +690,51 @@ const handleImport = () => {
}
}
+const selectedPrices = ref([])
+
+const handlePriceSelectionChange = (selection) => {
+ selectedPrices.value = selection
+}
+
+const batchUpdateStatus = async (status) => {
+ if (!selectedPrices.value.length) {
+ ElMessage.warning('请先选择要审核的价格')
+ return
+ }
+
+ // 过滤出待审核的价格
+ const pendingPrices = selectedPrices.value.filter(price => price.status === 'pending')
+ if (!pendingPrices.length) {
+ ElMessage.warning('选中的价格中没有待审核的项目')
+ return
+ }
+
+ try {
+ // 确认操作
+ await ElMessageBox.confirm(
+ `确定要${status === 'approved' ? '通过' : '拒绝'}选中的 ${pendingPrices.length} 条待审核价格吗?`,
+ '提示',
+ {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: status === 'approved' ? 'success' : 'warning'
+ }
+ )
+
+ // 批量更新状态
+ for (const price of pendingPrices) {
+ await axios.put(`/api/prices/${price.id}/status`, { status })
+ }
+
+ await loadPrices()
+ ElMessage.success('批量审核成功')
+ } catch (error) {
+ if (error === 'cancel') return
+ console.error('Failed to batch update status:', error)
+ ElMessage.error('批量审核失败')
+ }
+}
+
onMounted(async () => {
await loadPrices()
try {
@@ -791,4 +872,35 @@ onMounted(async () => {
justify-content: flex-end;
margin-top: 8px;
}
+
+.price-detail {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+}
+
+.detail-item {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+
+.detail-label {
+ color: #909399;
+ font-size: 13px;
+}
+
+.detail-value {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+
+.creator-name {
+ display: inline-block;
+ width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
\ No newline at end of file
diff --git a/frontend/src/views/Providers.vue b/frontend/src/views/Providers.vue
index 7957dd8..1ab3ee3 100644
--- a/frontend/src/views/Providers.vue
+++ b/frontend/src/views/Providers.vue
@@ -9,13 +9,13 @@
-
+
{{ row.name }}
-
+