fix: BepUsdt请求体amount改为float64数字类型,修复订单表格宽度

This commit is contained in:
2026-05-28 00:12:18 +08:00
parent 632fff3b49
commit cd24e88f60
3 changed files with 32 additions and 15 deletions
+19 -2
View File
@@ -25,6 +25,15 @@ func NewPaymentHandler() *PaymentHandler {
return &PaymentHandler{}
}
type BepUsdtCreateRequest struct {
TradeType string `json:"trade_type,omitempty"`
OrderID string `json:"order_id"`
Amount float64 `json:"amount"`
NotifyURL string `json:"notify_url"`
RedirectURL string `json:"redirect_url,omitempty"`
Signature string `json:"signature"`
}
func (h *PaymentHandler) CreatePayment(c *gin.Context) {
userID := c.GetUint("user_id")
orderID, _ := strconv.Atoi(c.Param("id"))
@@ -78,12 +87,20 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
}
signature := signBepUsdt(params, apiToken)
params["signature"] = signature
log.Printf("[BepUsdt] signature params: %v", params)
log.Printf("[BepUsdt] signature: %s, token: %s", signature, apiToken)
body, _ := json.Marshal(params)
reqBody := BepUsdtCreateRequest{
TradeType: tradeType,
OrderID: strconv.Itoa(int(order.ID)),
Amount: order.TotalAmount,
NotifyURL: notifyURL,
RedirectURL: redirectURL,
Signature: signature,
}
body, _ := json.Marshal(reqBody)
log.Printf("[BepUsdt] request body: %s", string(body))
req, err := http.NewRequest("POST", apiURL+"/api/v1/order/create-transaction", strings.NewReader(string(body)))
+7 -7
View File
@@ -5,15 +5,15 @@
</div>
<div class="table-card">
<el-table :data="paginatedOrders" style="width: 100%">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="user.username" label="用户" min-width="120" />
<el-table-column prop="total_amount" label="金额" width="100"><template #default="{ row }">¥{{ row.total_amount }}</template></el-table-column>
<el-table-column prop="status" label="状态" width="120"><template #default="{ row }"><el-tag>{{ statusText(row.status) }}</el-tag></template></el-table-column>
<el-table-column prop="refund_status" label="退款" width="100"><template #default="{ row }"><el-tag v-if="row.refund_status" type="warning">{{ row.refund_status }}</el-tag></template></el-table-column>
<el-table-column label="创建时间" width="180">
<el-table-column prop="id" label="ID" width="70" />
<el-table-column prop="user.username" label="用户" min-width="100" />
<el-table-column prop="total_amount" label="金额" min-width="100"><template #default="{ row }">¥{{ row.total_amount }}</template></el-table-column>
<el-table-column prop="status" label="状态" min-width="100"><template #default="{ row }"><el-tag>{{ statusText(row.status) }}</el-tag></template></el-table-column>
<el-table-column prop="refund_status" label="退款" min-width="80"><template #default="{ row }"><el-tag v-if="row.refund_status" type="warning">{{ row.refund_status }}</el-tag></template></el-table-column>
<el-table-column label="创建时间" min-width="160">
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
</el-table-column>
<el-table-column label="操作" width="150">
<el-table-column label="操作" width="150" fixed="right">
<template #default="{ row }">
<el-button v-if="row.refund_status === 'pending'" link type="primary" size="small" @click="processRefund(row.id, 'approved')">批准</el-button>
<el-button v-if="row.refund_status === 'pending'" link type="danger" size="small" @click="processRefund(row.id, 'rejected')">拒绝</el-button>
+6 -6
View File
@@ -2,20 +2,20 @@
<div class="orders-page">
<BackNav />
<div class="table-card">
<el-table :data="orders">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="total_amount" :label="$t('order.totalAmount')" width="120">
<el-table :data="orders" style="width: 100%">
<el-table-column prop="id" label="ID" width="70" />
<el-table-column prop="total_amount" :label="$t('order.totalAmount')" min-width="100">
<template #default="{ row }">¥{{ row.total_amount }}</template>
</el-table-column>
<el-table-column prop="status" :label="$t('order.status')" width="120">
<el-table-column prop="status" :label="$t('order.status')" min-width="100">
<template #default="{ row }">
<el-tag :type="statusType(row.status)">{{ statusText(row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" width="180">
<el-table-column label="创建时间" min-width="160">
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
</el-table-column>
<el-table-column label="操作" width="200">
<el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="$router.push(`/orders/${row.id}`)">查看</el-button>
<el-button v-if="row.status === 'pending_payment'" link type="success" size="small" @click="goPay(row)">去支付</el-button>