删掉租期相关错误东西
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
||||
getListingSubtitle,
|
||||
getListingTitle,
|
||||
getLoginMethod,
|
||||
getRentDays,
|
||||
getServerRegion,
|
||||
readAssetNumber,
|
||||
readAssetString,
|
||||
@@ -29,14 +28,12 @@ const router = useRouter();
|
||||
const session = useSessionStore();
|
||||
const loading = ref(false);
|
||||
const ordering = ref(false);
|
||||
const rentHours = ref(1);
|
||||
const listing = ref<Listing | null>(null);
|
||||
|
||||
onMounted(async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
listing.value = await fetchListing(String(route.params.id));
|
||||
rentHours.value = Math.max(listing.value.min_rent_hours || 1, 1);
|
||||
} catch {
|
||||
showToast({ message: "加载失败", icon: "warning-o" });
|
||||
} finally {
|
||||
@@ -44,10 +41,9 @@ onMounted(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
/* 预计租金 */
|
||||
const totalRent = computed(() => {
|
||||
const orderTotal = computed(() => {
|
||||
if (!listing.value) return "0.00";
|
||||
return (listing.value.price_hourly * rentHours.value).toFixed(2);
|
||||
return getListingDisplayPrice(listing.value).toFixed(2);
|
||||
});
|
||||
|
||||
const detailMetrics = computed(() => {
|
||||
@@ -136,7 +132,7 @@ async function handleCreateOrder() {
|
||||
|
||||
ordering.value = true;
|
||||
try {
|
||||
const order = await createOrder(listing.value.id, rentHours.value);
|
||||
await createOrder(listing.value.id);
|
||||
showToast({ message: "订单已创建,账号已锁定", icon: "passed" });
|
||||
await router.push(`/m/orders`);
|
||||
} catch (error) {
|
||||
@@ -255,10 +251,6 @@ function isNavActive(path: string) {
|
||||
<span class="info-label">M单价</span>
|
||||
<span class="info-text">{{ formatRatio(listing) }}</span>
|
||||
</div>
|
||||
<div class="info-line">
|
||||
<span class="info-label">租期</span>
|
||||
<span class="info-text">{{ getRentDays(listing) }}天</span>
|
||||
</div>
|
||||
<div class="info-line">
|
||||
<span class="info-label">常用登录地</span>
|
||||
<span class="info-text">{{ assetRegions(listing).join("、") || "--" }}</span>
|
||||
@@ -316,26 +308,9 @@ function isNavActive(path: string) {
|
||||
<!-- 底部下单栏(固定) -->
|
||||
<div class="order-bar">
|
||||
<div class="order-bar-left">
|
||||
<div class="rent-control">
|
||||
<button
|
||||
class="rent-btn"
|
||||
:disabled="rentHours <= listing.min_rent_hours"
|
||||
@click="rentHours--"
|
||||
>
|
||||
−
|
||||
</button>
|
||||
<span class="rent-value">{{ rentHours }}小时</span>
|
||||
<button
|
||||
class="rent-btn"
|
||||
:disabled="rentHours >= listing.max_rent_hours"
|
||||
@click="rentHours++"
|
||||
>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
<div class="order-price">
|
||||
<span class="price-label">租金</span>
|
||||
<span class="price-amount">¥{{ totalRent }}</span>
|
||||
<span class="price-label">价格</span>
|
||||
<span class="price-amount">¥{{ orderTotal }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<van-button
|
||||
@@ -528,7 +503,7 @@ function isNavActive(path: string) {
|
||||
color: #ff5f00;
|
||||
}
|
||||
|
||||
/* ========== 租期信息 ========== */
|
||||
/* ========== 账号资料 ========== */
|
||||
.info-line {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -676,38 +651,6 @@ function isNavActive(path: string) {
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.rent-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.rent-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
background: #f5f7fa;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rent-btn:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.rent-value {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
min-width: 48px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.order-price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
|
||||
Reference in New Issue
Block a user