Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<first-menu>
<menu-item href="." code="index">我的流量包</menu-item>
<span class="disabled item">|</span>
<menu-item href=".buy" code="buy">购买流量包</menu-item>
</first-menu>

View File

@@ -0,0 +1,52 @@
{$layout}
{$template "menu"}
<form class="ui form">
<csrf-token></csrf-token>
<input type="hidden" name="packageId" :value="packageId"/>
<input type="hidden" name="regionId" :value="regionId"/>
<input type="hidden" name="periodId" :value="periodId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">选择流量包规格 *</td>
<td>
<span v-if="packages.length > 0"><a v-for="p in packages" class="ui label basic" :class="{blue: p.id == packageId}" @click.prevent="selectPackage(p.id)">{{p.size}}{{p.unit.toUpperCase().replace(/(.)B/, "$1iB")}}</a></span>
<span v-else="" class="red">没有流量包可供选择</span>
</td>
</tr>
<tr>
<td>选择区域 *</td>
<td>
<span v-if="regions.length > 0"><a v-for="region in regions" class="ui label basic" :class="{blue: region.id == regionId && hasRegionPrice(region.id), disabled: !hasRegionPrice(region.id)}" @click.prevent="selectRegion(region.id)">{{region.name}}</a></span>
<span v-else="" class="red">没有区域可供选择</span>
</td>
</tr>
<tr>
<td>选择有效期 *</td>
<td>
<span v-if="periods.length > 0"><a v-for="period in periods" class="ui label basic" :class="{blue: period.id == periodId && hasPeriodPrice(period.id), disabled: !hasPeriodPrice(period.id)}" @click.prevent="selectPeriod(period.id)">{{period.count}}{{period.unitName}}</a></span>
<span v-else="" class="red">没有有效期可供选择</span>
</td>
</tr>
<tr>
<td>流量包数量 *</td>
<td>
<div class="ui input">
<select class="ui dropdown" name="count" v-model="count" @change="changeCount">
<option v-for="i in 20" :value="i">{{i}}</option>
</select>
</div>
</td>
</tr>
<tr>
<td>价格</td>
<td>
<span v-if="amount == 0" class="disabled">没有找到对应价格</span>
<span v-if="amount > 0">{{amount}}元</span>
</td>
</tr>
</table>
<button class="ui button primary" :class="{disabled: amount <= 0}" type="button" @click.prevent="goNext()">下一步</button>
</form>

View File

@@ -0,0 +1,76 @@
Tea.context(function () {
this.packageId = 0
this.regionId = 0
this.periodId = 0
this.amount = -1
this.count = 1
this.selectPackage = function (packageId) {
this.packageId = packageId
this.regionId = 0
this.periodId = 0
this.reloadPrice()
}
this.selectRegion = function (regionId) {
this.regionId = regionId
this.periodId = 0
this.reloadPrice()
}
this.selectPeriod = function (periodId) {
this.periodId = periodId
this.reloadPrice()
}
this.changeCount = function () {
this.reloadPrice()
}
var requestId = 0
this.reloadPrice = function () {
var newRequestId = (++requestId)
this.$post(".price")
.params({
packageId: this.packageId,
regionId: this.regionId,
periodId: this.periodId,
count: this.count
})
.success(function (resp) {
if (newRequestId == requestId) {
this.amount = resp.data.amount
}
})
}
this.hasRegionPrice = function (regionId) {
if (this.packageId <= 0) {
return false
}
for (let k in this.prices) {
if (k.startsWith(this.packageId + "@" + regionId + "@")) {
return true
}
}
return false
}
this.hasPeriodPrice = function (periodId) {
if (this.packageId <= 0 || this.regionId <= 0) {
return false
}
for (let k in this.prices) {
if (k == this.packageId + "@" + this.regionId + "@" + periodId) {
return true
}
}
return false
}
this.goNext = function () {
if (this.packageId > 0 && this.regionId > 0 && this.periodId > 0 && this.count > 0) {
window.location = "/servers/packages/confirm?packageId=" + this.packageId + "&regionId=" + this.regionId + "&periodId=" + this.periodId + "&count=" + this.count
}
}
})

View File

@@ -0,0 +1,30 @@
{$layout}
{$template "menu"}
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="packageId" :value="packageId"/>
<input type="hidden" name="regionId" :value="regionId"/>
<input type="hidden" name="periodId" :value="periodId"/>
<input type="hidden" name="count" :value="count"/>
<table class="ui table definition selectable">
<tr>
<td class="title">流量包</td>
<td>[{{packageName}} / {{regionName}} / {{periodName}}] x {{count}}</td>
</tr>
<tr>
<td>价格</td>
<td>¥{{amount}}元</td>
</tr>
<tr>
<td>支付方式</td>
<td>
<pay-method-selector></pay-method-selector>
</td>
</tr>
</table>
<submit-btn>确定购买</submit-btn> &nbsp; <a href="/servers/packages/buy" @click.prevent="goBack()">上一步</a>
</form>

View File

@@ -0,0 +1,23 @@
Tea.context(function () {
this.goBack = function () {
window.history.back()
}
this.success = function (resp) {
if (resp.data.success) {
teaweb.success("流量包购买成功", function () {
window.location = "/servers/packages"
})
return
}
if (resp.data.orderCode.length > 0) {
window.location = "/finance/pay?code=" + resp.data.orderCode + "&from=" + window.escape(window.location.toString()) + "&returnURL=/servers/packages"
}
}
this.methodCode = "@balance"
this.changePayMethod = function (methodCode) {
this.methodCode = methodCode
}
})

View File

@@ -0,0 +1,53 @@
{$layout}
{$template "menu"}
<second-menu>
<menu-item href="/servers/packages" :class="{active: type == ''}">可用流量包</menu-item>
<menu-item href="/servers/packages?type=all" :class="{active: type == 'all'}">所有流量包</menu-item>
</second-menu>
<p class="comment" v-if="userPackages.length == 0">
<span v-if="type == ''">暂时还没有可用的流量包。</span>
<span v-if="type == 'all'">暂时还没有流量包。</span>
</p>
<div v-if="userPackages.length > 0">
<div class="margin"></div>
<table class="ui table selectable celled">
<thead>
<tr>
<th>流量包</th>
<th style="width: 7em">区域</th>
<th style="width: 7em">有效期</th>
<th style="width: 7em">开始日期</th>
<th style="width: 7em">结束日期</th>
<th style="width: 7em">已用流量</th>
<th style="width: 7em">剩余流量</th>
<th style="width: 12em">购买时间</th>
</tr>
</thead>
<tr v-for="up in userPackages">
<td>
<span v-if="up.package != null">{{up.package.size}}{{up.package.unit.toUpperCase().replace(/(.)B/, "$1iB")}}</span>
<span v-else class="disabled">[已删除]</span>
<div v-if="up.isUsedAll || up.isExpired">
<span v-if="up.isUsedAll" class="small red">已用尽</span>
<span v-else-if="up.isExpired" class="small red">已过期</span>
</div>
</td>
<td>
<span v-if="up.region != null">{{up.region.name}}</span>
<span v-else="" class="disabled">[已删除]</span>
</td>
<td>{{up.periodCount}}{{up.periodUnitName}}</td>
<td>{{up.dayFrom}}</td>
<td>{{up.dayTo}}</td>
<td><span :class="{disabled: up.usedSize == '0B'}">{{up.usedSize}}</span></td>
<td><span :class="{disabled: up.availableSize == '0B'}">{{up.availableSize}}</span></td>
<td>{{up.createdTime}}</td>
</tr>
</table>
<page-box></page-box>
</div>