Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3934ce4542 | |||
| 9675aacdb0 | |||
| 70aecaa82d |
@ -3,7 +3,7 @@ AWS_SECRET_ACCESS_KEY=BQjaaHNm5skCN/3k3r/uNdEG9xb49are+hv5fajK
|
|||||||
AWS_DEFAULT_REGION=us-east-1
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
|
||||||
# MySQL数据库配置
|
# MySQL数据库配置
|
||||||
MYSQL_HOST=47.76.209.7
|
MYSQL_HOST=163.123.183.106
|
||||||
MYSQL_USER=aws_price
|
MYSQL_USER=aws_price
|
||||||
MYSQL_PASSWORD=123456
|
MYSQL_PASSWORD=YCwjLmHM5dZtwHEw
|
||||||
MYSQL_DATABASE=aws_price
|
MYSQL_DATABASE=aws_price
|
||||||
@ -7,7 +7,7 @@
|
|||||||
<el-menu mode="horizontal" router :default-active="'/awsSearch'" class="menu" background-color="#3498db" text-color="#fff" active-text-color="#ffd04b">
|
<el-menu mode="horizontal" router :default-active="'/awsSearch'" class="menu" background-color="#3498db" text-color="#fff" active-text-color="#ffd04b">
|
||||||
<!-- <el-menu-item index="/"><i class="el-icon-s-finance"></i> 价格计算器</el-menu-item> -->
|
<!-- <el-menu-item index="/"><i class="el-icon-s-finance"></i> 价格计算器</el-menu-item> -->
|
||||||
<el-menu-item index="/awsSearch"><i class="el-icon-search"></i>AWS报价</el-menu-item>
|
<el-menu-item index="/awsSearch"><i class="el-icon-search"></i>AWS报价</el-menu-item>
|
||||||
<!-- <el-menu-item index="/awsSearchDiscount"><i class="el-icon-search"></i>AWS折扣</el-menu-item> -->
|
<el-menu-item index="/awsSearchDiscount"><i class="el-icon-search"></i>AWS折扣</el-menu-item>
|
||||||
<!-- <el-menu-item index="/compare"><i class="el-icon-data-analysis"></i> 价格对比</el-menu-item> -->
|
<!-- <el-menu-item index="/compare"><i class="el-icon-data-analysis"></i> 价格对比</el-menu-item> -->
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -361,25 +361,41 @@
|
|||||||
|
|
||||||
<el-table-column label="官方月付全额" width="120" align="center">
|
<el-table-column label="官方月付全额" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="price-value">${{ scope.row.total_monthly_price.toFixed(2) }}</span>
|
<div class="price-breakdown-text">
|
||||||
|
<div>实例: ${{ (Number(scope.row.monthly_price) || 0).toFixed(2) }}</div>
|
||||||
|
<div>磁盘: ${{ (Number(scope.row.disk_monthly_price) || 0).toFixed(2) }}</div>
|
||||||
|
<div class="price-value highlight">共计: ${{ getOfficialMonthlyPrice(scope.row).toFixed(2) }}</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="月付优惠价" width="120" align="center">
|
<el-table-column label="月付优惠价" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="price-value highlight">${{ (scope.row.total_monthly_price * form.monthly_discount).toFixed(2) }}</span>
|
<div class="price-breakdown-text">
|
||||||
|
<div>实例: ${{ (scope.row.monthly_price * form.monthly_discount).toFixed(2) }}</div>
|
||||||
|
<div>磁盘: ${{ scope.row.disk_monthly_price.toFixed(2) }}</div>
|
||||||
|
<div class="price-value highlight">共计: ${{ getDiscountedMonthlyPrice(scope.row).toFixed(2) }}</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="官方年付全额" width="120" align="center">
|
<el-table-column label="官方年付全额" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="price-value">${{ (scope.row.total_monthly_price * 12).toFixed(2) }}</span>
|
<div class="price-breakdown-text">
|
||||||
|
<div>实例: ${{ ((Number(scope.row.monthly_price) || 0) * 12).toFixed(2) }}</div>
|
||||||
|
<div>磁盘: ${{ ((Number(scope.row.disk_monthly_price) || 0) * 12).toFixed(2) }}</div>
|
||||||
|
<div class="price-value highlight">共计: ${{ getOfficialYearlyPrice(scope.row).toFixed(2) }}</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="年付优惠价" width="120" align="center">
|
<el-table-column label="年付优惠价" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="price-value highlight">${{ (scope.row.total_monthly_price * 12 * form.yearly_discount).toFixed(2) }}</span>
|
<div class="price-breakdown-text">
|
||||||
|
<div>实例: ${{ (scope.row.monthly_price * 12 * form.yearly_discount).toFixed(2) }}</div>
|
||||||
|
<div>磁盘: ${{ (scope.row.disk_monthly_price * 12).toFixed(2) }}</div>
|
||||||
|
<div class="price-value highlight">共计: ${{ getDiscountedYearlyPrice(scope.row).toFixed(2) }}</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@ -401,8 +417,8 @@
|
|||||||
<div class="note-title">说明事项:</div>
|
<div class="note-title">说明事项:</div>
|
||||||
<div class="note-items">
|
<div class="note-items">
|
||||||
<div class="note-item">1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB</div>
|
<div class="note-item">1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB</div>
|
||||||
<div class="note-item">2. 月付按官网价 {{ formatDiscount(form.monthly_discount) }} 折</div>
|
<div class="note-item">2. 月付(仅实例部分)按官网价 {{ formatDiscount(form.monthly_discount) }} 折,磁盘不参与优惠</div>
|
||||||
<div class="note-item">3. 年付按官网价 {{ formatDiscount(form.yearly_discount) }} 折</div>
|
<div class="note-item">3. 年付(仅实例部分)按官网价 {{ formatDiscount(form.yearly_discount) }} 折,磁盘不参与优惠</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -605,10 +621,32 @@
|
|||||||
|
|
||||||
// 创建数据行
|
// 创建数据行
|
||||||
const dataRows = this.comparisonList.map(instance => {
|
const dataRows = this.comparisonList.map(instance => {
|
||||||
const officialMonthlyPrice = instance.total_monthly_price
|
const officialMonthlyPrice = this.getOfficialMonthlyPrice(instance)
|
||||||
const discountedMonthlyPrice = officialMonthlyPrice * this.form.monthly_discount
|
const officialYearlyPrice = this.getOfficialYearlyPrice(instance)
|
||||||
const officialYearlyPrice = officialMonthlyPrice * 12
|
const discountedMonthlyPrice = this.getDiscountedMonthlyPrice(instance)
|
||||||
const discountedYearlyPrice = officialYearlyPrice * this.form.yearly_discount
|
const discountedYearlyPrice = this.getDiscountedYearlyPrice(instance)
|
||||||
|
const instanceMonthlyPrice = Number(instance.monthly_price) || 0
|
||||||
|
const diskMonthlyPrice = Number(instance.disk_monthly_price) || 0
|
||||||
|
const officialMonthlyDetail = [
|
||||||
|
`实例: $${instanceMonthlyPrice.toFixed(2)}`,
|
||||||
|
`磁盘: $${diskMonthlyPrice.toFixed(2)}`,
|
||||||
|
`共计: $${officialMonthlyPrice.toFixed(2)}`
|
||||||
|
].join('\n')
|
||||||
|
const discountedMonthlyDetail = [
|
||||||
|
`实例: $${(instanceMonthlyPrice * Number(this.form.monthly_discount || 0)).toFixed(2)}`,
|
||||||
|
`磁盘: $${diskMonthlyPrice.toFixed(2)}`,
|
||||||
|
`共计: $${discountedMonthlyPrice.toFixed(2)}`
|
||||||
|
].join('\n')
|
||||||
|
const officialYearlyDetail = [
|
||||||
|
`实例: $${(instanceMonthlyPrice * 12).toFixed(2)}`,
|
||||||
|
`磁盘: $${(diskMonthlyPrice * 12).toFixed(2)}`,
|
||||||
|
`共计: $${officialYearlyPrice.toFixed(2)}`
|
||||||
|
].join('\n')
|
||||||
|
const discountedYearlyDetail = [
|
||||||
|
`实例: $${(instanceMonthlyPrice * 12 * Number(this.form.yearly_discount || 0)).toFixed(2)}`,
|
||||||
|
`磁盘: $${(diskMonthlyPrice * 12).toFixed(2)}`,
|
||||||
|
`共计: $${discountedYearlyPrice.toFixed(2)}`
|
||||||
|
].join('\n')
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'EC2',
|
'EC2',
|
||||||
@ -616,10 +654,10 @@
|
|||||||
`${instance.disk_gb}G GP3`,
|
`${instance.disk_gb}G GP3`,
|
||||||
this.formatOS(instance.operating_system),
|
this.formatOS(instance.operating_system),
|
||||||
this.getRegionName(instance.region),
|
this.getRegionName(instance.region),
|
||||||
officialMonthlyPrice.toFixed(2),
|
officialMonthlyDetail,
|
||||||
discountedMonthlyPrice.toFixed(2),
|
discountedMonthlyDetail,
|
||||||
officialYearlyPrice.toFixed(2),
|
officialYearlyDetail,
|
||||||
discountedYearlyPrice.toFixed(2)
|
discountedYearlyDetail
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -628,8 +666,8 @@
|
|||||||
emptyRow,
|
emptyRow,
|
||||||
['说明事项:'],
|
['说明事项:'],
|
||||||
['1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB'],
|
['1. 以上价格仅包服务器和磁盘的费用, 以上价格仅包服务器和磁盘的费用, 公共带宽流量按官网价格 均价$0.12USD/GB'],
|
||||||
[`2. 月付按官网价 ${this.formatDiscount(this.form.monthly_discount)} 折`],
|
[`2. 月付(仅实例部分)按官网价 ${this.formatDiscount(this.form.monthly_discount)} 折,磁盘不参与优惠`],
|
||||||
[`3. 年付按官网价 ${this.formatDiscount(this.form.yearly_discount)} 折`]
|
[`3. 年付(仅实例部分)按官网价 ${this.formatDiscount(this.form.yearly_discount)} 折,磁盘不参与优惠`]
|
||||||
]
|
]
|
||||||
|
|
||||||
// 合并所有行
|
// 合并所有行
|
||||||
@ -656,6 +694,9 @@
|
|||||||
const rowHeights = Array(allRows.length).fill({ hpt: 25 })
|
const rowHeights = Array(allRows.length).fill({ hpt: 25 })
|
||||||
rowHeights[0] = { hpt: 35 } // 标题行
|
rowHeights[0] = { hpt: 35 } // 标题行
|
||||||
rowHeights[4] = { hpt: 30 } // 表头行
|
rowHeights[4] = { hpt: 30 } // 表头行
|
||||||
|
for (let i = 0; i < dataRows.length; i++) {
|
||||||
|
rowHeights[4 + 1 + i] = { hpt: 55 }
|
||||||
|
}
|
||||||
ws['!rows'] = rowHeights
|
ws['!rows'] = rowHeights
|
||||||
|
|
||||||
// 设置单元格合并
|
// 设置单元格合并
|
||||||
@ -736,12 +777,21 @@
|
|||||||
ws[cellRef].s.alignment = { horizontal: 'center', vertical: 'center' }
|
ws[cellRef].s.alignment = { horizontal: 'center', vertical: 'center' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 说明事项行左对齐并自动换行
|
||||||
|
for (let r = noteStartRow; r < noteStartRow + 5; r++) {
|
||||||
|
for (let c = 0; c < 9; c++) {
|
||||||
|
const cellRef = XLSX.utils.encode_cell({ r, c })
|
||||||
|
if (!ws[cellRef]) ws[cellRef] = { v: '', t: 's' }
|
||||||
|
if (!ws[cellRef].s) ws[cellRef].s = {}
|
||||||
|
ws[cellRef].s.alignment = { horizontal: 'left', vertical: 'center', wrapText: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 设置价格列样式
|
// 设置价格列样式
|
||||||
const priceColsStyle = {
|
const priceColsStyle = {
|
||||||
numFmt: '0.00',
|
|
||||||
font: { color: { rgb: '1F7B69' } },
|
font: { color: { rgb: '1F7B69' } },
|
||||||
alignment: { horizontal: 'center', vertical: 'center' },
|
alignment: { horizontal: 'left', vertical: 'center', wrapText: true },
|
||||||
border: {
|
border: {
|
||||||
top: { style: 'thin' },
|
top: { style: 'thin' },
|
||||||
bottom: { style: 'thin' },
|
bottom: { style: 'thin' },
|
||||||
@ -808,6 +858,26 @@
|
|||||||
if (os === 'Windows') return 'Windows'
|
if (os === 'Windows') return 'Windows'
|
||||||
return os
|
return os
|
||||||
},
|
},
|
||||||
|
getOfficialMonthlyPrice(instance) {
|
||||||
|
const instancePrice = Number(instance.monthly_price) || 0
|
||||||
|
const diskPrice = Number(instance.disk_monthly_price) || 0
|
||||||
|
return instancePrice + diskPrice
|
||||||
|
},
|
||||||
|
getOfficialYearlyPrice(instance) {
|
||||||
|
return this.getOfficialMonthlyPrice(instance) * 12
|
||||||
|
},
|
||||||
|
getDiscountedMonthlyPrice(instance) {
|
||||||
|
const instancePrice = Number(instance.monthly_price) || 0
|
||||||
|
const diskPrice = Number(instance.disk_monthly_price) || 0
|
||||||
|
const discount = Number(this.form.monthly_discount) || 0
|
||||||
|
return instancePrice * discount + diskPrice
|
||||||
|
},
|
||||||
|
getDiscountedYearlyPrice(instance) {
|
||||||
|
const instancePrice = Number(instance.monthly_price) || 0
|
||||||
|
const diskPrice = Number(instance.disk_monthly_price) || 0
|
||||||
|
const discount = Number(this.form.yearly_discount) || 0
|
||||||
|
return instancePrice * 12 * discount + diskPrice * 12
|
||||||
|
},
|
||||||
// 计算打折后的价格
|
// 计算打折后的价格
|
||||||
calculateDiscountedPrice(originalPrice, discount) {
|
calculateDiscountedPrice(originalPrice, discount) {
|
||||||
return originalPrice * discount;
|
return originalPrice * discount;
|
||||||
@ -956,14 +1026,22 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-value.highlight {
|
.price-value.highlight {
|
||||||
color: #2ecc71;
|
color: #2ecc71;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-results {
|
.price-breakdown-text {
|
||||||
padding: 40px 0;
|
display: flex;
|
||||||
}
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-results {
|
||||||
|
padding: 40px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.selected-instance {
|
.selected-instance {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
@ -1180,4 +1258,4 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user