修改首页内容

This commit is contained in:
zhouyanli
2026-11-13 09:37:34 +08:00
parent 5c9aca27e8
commit 0180cba283
13 changed files with 472 additions and 133 deletions

View File

@@ -1,33 +1,74 @@
<template>
<view class="page">
<credit-header title="信用免押金" :show-badge="true" curved></credit-header>
<credit-header title="信用免押金" curved></credit-header>
<view class="brand-card">
<image class="brand-logo" :src="brandLogo" mode="aspectFit"></image>
<!-- 商品信息:承接页要让用户和审核方都看清楚「租的是什么」 -->
<view class="product-card">
<image class="product-img" :src="itemImage || brandLogo" mode="aspectFill"></image>
<view class="product-info">
<view class="product-name">{{ itemName }}</view>
<view class="product-desc">{{ itemDesc }}</view>
<view class="product-price">
<text class="price-symbol">¥</text>
<text class="price-num">{{ rentPrice }}</text>
<text class="price-unit">/{{ rentPeriod }}</text>
</view>
</view>
</view>
<view class="brand-name">{{ brandName }}</view>
<view class="info-section">
<rental-info :item-name="itemName" :deposit-amount="depositAmount" credit-free></rental-info>
</view>
<!-- 免押说明:明确写出本服务使用了哪项信用能力 -->
<view class="section">
<view class="section-title">免押说明</view>
<view class="section-text">
本服务为线上实物租赁,使用{{ creditBrand }}免押能力:{{ creditBrand }}评估通过后,可免交 {{ depositAmount }} 元押金租用「{{ itemName }}」,
商品以快递方式发出,{{ delivery.rentStart }}。评估未通过时,需支付押金后租用;租期结束寄回商品、租约结束后,免押服务随之解除。
</view>
</view>
<!-- 服务流程 -->
<view class="section">
<view class="section-title">服务流程</view>
<view class="step-list">
<view v-for="(step, index) in steps" :key="index" class="step-item">
<view class="step-index">{{ index + 1 }}</view>
<view class="step-body">
<view class="step-title">{{ step.title }}</view>
<view class="step-desc">{{ step.desc }}</view>
</view>
</view>
</view>
</view>
<!-- 租赁与归还规则 -->
<view class="section">
<view class="section-title">租赁与归还</view>
<view v-if="serviceProvider" class="section-text">服务提供方:{{ serviceProvider }}</view>
<view class="rule-list">
<view v-for="(rule, index) in rules" :key="index" class="rule-item">
<text class="rule-dot"></text>
<text class="rule-text">{{ rule }}</text>
</view>
</view>
</view>
<view class="agreement" @tap="toggleAgree">
<view class="checkbox" :class="{ checked: agreed }">
<view v-if="agreed" class="checkbox-check"></view>
</view>
<view class="agreement-text">
我已阅读并同意
<text class="agreement-link" @tap.stop="openAgreement">《芝麻信用协议及授权条款》</text>
<text class="agreement-link" @tap.stop="openAgreement">《信用服务授权条款》</text>
</view>
</view>
<view class="tip">注:请记得归还物品哦,以免对你的信用产生影响</view>
<view class="bottom-bar">
<button class="btn-primary" :disabled="submitting" @tap="handleContinue">
{{ submitting ? '处理中...' : '继续' }}
</button>
<button class="btn-primary" @tap="handleContinue">继续</button>
</view>
</view>
</template>
@@ -35,16 +76,36 @@
<script setup>
import { ref } from 'vue'
import config from '@/config'
import { createCreditOrder, syncOrderStatus } from '@/api/order'
import { authorizeCreditBorrow } from '@/utils/zhima'
const brandName = config.brandName
const brandLogo = config.brandLogo
const itemImage = config.itemImage
const itemName = config.itemName
const itemDesc = config.itemDesc
const rentPrice = config.rentPrice
const rentPeriod = config.rentPeriod
const depositAmount = config.depositAmount
const creditBrand = config.creditBrand
const serviceProvider = config.serviceProvider
const delivery = config.delivery
const steps = [
{ title: '提交租赁申请', desc: '填写收货信息并提交订单,同意租赁规则与信用授权条款' },
{ title: '信用评估授权', desc: `跳转支付宝信用免押页,授权${creditBrand}完成信用评估` },
{ title: '免押成功下单', desc: '评估通过即免交押金,订单生效后安排发货' },
{ title: '收货并使用', desc: `${delivery.shipTime},${delivery.rentStart}` },
{ title: '寄回结束租约', desc: '租期结束前按寄回指引寄回商品,验收通过后租约结束,免押自动解除' }
]
const rules = [
`按 ${rentPrice} 元/${rentPeriod} 计收租金,实际金额以订单页为准`,
`押金 ${depositAmount} 元:信用评估通过可免交,未通过需支付,归还验收后退还`,
`运费:${delivery.shipFee};${delivery.shipTime},${delivery.rentStart}`,
'租期结束前请按寄回指引寄回商品,人为损坏或配件缺失按租赁规则处理',
'逾期未寄回将按租赁规则收取费用,并可能影响你的信用记录'
]
const agreed = ref(false)
const submitting = ref(false)
function toggleAgree() {
agreed.value = !agreed.value
@@ -54,38 +115,13 @@
uni.navigateTo({ url: config.agreements.credit })
}
async function handleContinue() {
if (submitting.value) return
// 线上下单需要收货信息,下一步在收货信息页填写并提交
function handleContinue() {
if (!agreed.value) {
uni.showToast({ title: '请先阅读并同意协议', icon: 'none' })
return
}
submitting.value = true
try {
// 1. 服务端创建免押订单,同时向芝麻创建信用借还订单
uni.showLoading({ title: '创建订单中', mask: true })
const order = await createCreditOrder({
itemName,
depositAmount
})
// 2. 拉起支付宝原生授权页
uni.hideLoading()
await authorizeCreditBorrow(order)
// 3. 以服务端订单状态为准:真实环境靠芝麻异步通知回写
uni.showLoading({ title: '确认免押中', mask: true })
await syncOrderStatus(order.orderId)
uni.hideLoading()
uni.redirectTo({ url: `/pages/result/result?orderId=${order.orderId}` })
} catch (error) {
uni.hideLoading()
uni.showToast({ title: error.message || '免押开通失败,请重试', icon: 'none' })
} finally {
submitting.value = false
}
uni.navigateTo({ url: '/pages/address/address' })
}
</script>
@@ -96,36 +132,167 @@
background: #ffffff;
}
/* 卡片压在蓝色头部与白色内容交界处,对应截图里的悬浮效果 */
.brand-card {
/* 商品卡片压在蓝色头部与白色内容交界处,对应截图里的悬浮效果 */
.product-card {
position: relative;
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
width: 200rpx;
height: 200rpx;
margin: -120rpx auto 0;
border-radius: 32rpx;
margin: -120rpx 40rpx 0;
overflow: hidden;
border-radius: 24rpx;
background: #ffffff;
box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.12);
}
.brand-logo {
width: 140rpx;
height: 140rpx;
.product-img {
display: block;
width: 100%;
/* 商品实拍图为横版(约 1.9:1),满版展示才能看清项圈全貌 */
height: 340rpx;
background: #f7f8fa;
}
.brand-name {
margin-top: 32rpx;
text-align: center;
font-size: 36rpx;
.product-info {
padding: 24rpx;
}
.product-name {
font-size: 32rpx;
font-weight: 600;
color: #1a1a1a;
}
.product-desc {
margin-top: 12rpx;
font-size: 24rpx;
line-height: 1.5;
color: #888888;
}
.product-price {
display: flex;
align-items: baseline;
margin-top: 16rpx;
color: #1e6bff;
}
.price-symbol {
font-size: 24rpx;
}
.price-num {
font-size: 38rpx;
font-weight: 700;
}
.price-unit {
margin-left: 4rpx;
font-size: 24rpx;
color: #999999;
}
.info-section {
margin-top: 72rpx;
margin-top: 40rpx;
}
.section {
margin: 48rpx 40rpx 0;
}
.section-title {
display: flex;
align-items: center;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
}
.section-title::before {
content: '';
width: 6rpx;
height: 28rpx;
margin-right: 12rpx;
border-radius: 6rpx;
background: #1e6bff;
}
.section-text {
margin-top: 16rpx;
font-size: 26rpx;
line-height: 1.7;
color: #555555;
}
.step-list {
margin-top: 24rpx;
}
.step-item {
display: flex;
margin-bottom: 24rpx;
}
.step-item:last-child {
margin-bottom: 0;
}
.step-index {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
border-radius: 50%;
background: rgba(30, 107, 255, 0.1);
font-size: 24rpx;
font-weight: 600;
color: #1e6bff;
}
.step-body {
flex: 1;
}
.step-title {
font-size: 28rpx;
color: #1a1a1a;
}
.step-desc {
margin-top: 6rpx;
font-size: 24rpx;
line-height: 1.5;
color: #999999;
}
.rule-list {
margin-top: 16rpx;
}
.rule-item {
display: flex;
margin-top: 14rpx;
}
.rule-item:first-child {
margin-top: 0;
}
.rule-dot {
flex-shrink: 0;
width: 8rpx;
height: 8rpx;
margin: 16rpx 14rpx 0 4rpx;
border-radius: 50%;
background: #c9cdd4;
}
.rule-text {
flex: 1;
font-size: 26rpx;
line-height: 1.6;
color: #555555;
}
.agreement {