兼容接入商品固定价格字段
This commit is contained in:
@@ -16,11 +16,13 @@ export interface Listing {
|
||||
asset_summary?: Record<string, unknown>
|
||||
screenshot_urls: string[]
|
||||
cover_url: string
|
||||
price: number
|
||||
price_hourly: number
|
||||
price_daily: number
|
||||
price_weekly: number
|
||||
deposit_amount: number
|
||||
is_accelerated_sale?: boolean
|
||||
in_transaction: boolean
|
||||
status: string
|
||||
review_status: string
|
||||
review_reason: string
|
||||
@@ -38,6 +40,7 @@ export interface ListingPayload {
|
||||
haf_coin_amount: number
|
||||
asset_summary?: Record<string, unknown>
|
||||
screenshot_urls: string[]
|
||||
price: number
|
||||
price_hourly: number
|
||||
price_daily: number
|
||||
price_weekly: number
|
||||
|
||||
@@ -58,7 +58,7 @@ function money(value: number) {
|
||||
}
|
||||
|
||||
function listingPrice(row: Listing) {
|
||||
return money(row.price_daily || row.price_hourly)
|
||||
return money(row.price || row.price_daily || row.price_hourly)
|
||||
}
|
||||
|
||||
function extractObjectKey(url: string) {
|
||||
|
||||
@@ -63,7 +63,7 @@ function openEvidence(row: Listing) {
|
||||
}
|
||||
|
||||
function listingPrice(row: Listing) {
|
||||
return `¥${Number(row.price_daily || row.price_hourly || 0).toFixed(2)}`
|
||||
return `¥${Number(row.price || row.price_daily || row.price_hourly || 0).toFixed(2)}`
|
||||
}
|
||||
|
||||
function extractObjectKey(url: string) {
|
||||
|
||||
@@ -43,7 +43,7 @@ function money(value: number) {
|
||||
}
|
||||
|
||||
function listingPrice(row: Listing) {
|
||||
return money(row.price_daily || row.price_hourly)
|
||||
return money(row.price || row.price_daily || row.price_hourly)
|
||||
}
|
||||
|
||||
function ownerName(row: Listing) {
|
||||
|
||||
@@ -439,6 +439,7 @@ async function handleSubmit() {
|
||||
haf_coin_amount: coinMAmount.value * 1000000,
|
||||
asset_summary: buildAssetSummary(),
|
||||
screenshot_urls: screenshotUrls.value,
|
||||
price: dailyPrice,
|
||||
price_hourly: hourlyPrice,
|
||||
price_daily: dailyPrice,
|
||||
price_weekly: roundMoney(dailyPrice * 7),
|
||||
|
||||
@@ -45,7 +45,7 @@ function readError(error: unknown, fallback: string) {
|
||||
}
|
||||
|
||||
function listingPrice(item: Listing) {
|
||||
return Number(item.price_daily || item.price_hourly || 0).toFixed(2);
|
||||
return Number(item.price || item.price_daily || item.price_hourly || 0).toFixed(2);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -104,10 +104,11 @@ function listingPrice(item: Listing) {
|
||||
type="warning"
|
||||
size="large"
|
||||
:loading="ordering"
|
||||
:disabled="listing.in_transaction"
|
||||
class="full-control"
|
||||
@click="handleCreateOrder"
|
||||
>
|
||||
立即下单
|
||||
{{ listing.in_transaction ? "交易中" : "立即下单" }}
|
||||
</el-button>
|
||||
</el-form>
|
||||
</aside>
|
||||
|
||||
@@ -17,18 +17,17 @@ const form = reactive({
|
||||
login_platform: 'QQ',
|
||||
rank_level: '',
|
||||
haf_coin_amount: 0,
|
||||
price_hourly: 5,
|
||||
price_daily: 50,
|
||||
price_weekly: 300,
|
||||
price: 50,
|
||||
deposit_amount: 100,
|
||||
})
|
||||
|
||||
async function handleSubmit() {
|
||||
loading.value = true
|
||||
try {
|
||||
const price = Number(form.price_daily || 0)
|
||||
const price = Number(form.price || 0)
|
||||
const listing = await createListing({
|
||||
...form,
|
||||
price,
|
||||
price_hourly: Math.max(Math.round((price / 24) * 100) / 100, 0.01),
|
||||
price_daily: price,
|
||||
price_weekly: Math.round(price * 7 * 100) / 100,
|
||||
@@ -125,7 +124,7 @@ function readError(error: unknown, fallback: string) {
|
||||
<el-input-number v-model="form.haf_coin_amount" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格">
|
||||
<el-input-number v-model="form.price_daily" :min="0" />
|
||||
<el-input-number v-model="form.price" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="押金">
|
||||
<el-input-number v-model="form.deposit_amount" :min="0" />
|
||||
|
||||
@@ -45,7 +45,7 @@ function readSellerPrice(row: Listing) {
|
||||
const price = Number((breakdown as Record<string, unknown>).seller_total_price)
|
||||
if (Number.isFinite(price) && price > 0) return price
|
||||
}
|
||||
return Number(row.price_daily || row.price_hourly || 0)
|
||||
return Number(row.price || row.price_daily || row.price_hourly || 0)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user