修改首页内容

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

@@ -45,7 +45,9 @@ export async function createCreditOrder(payload) {
creditBorrowOrderId: `ZM${now}`,
itemName: payload.itemName,
depositAmount: payload.depositAmount,
// CREDIT=信用免押,PAID=现场付押金
// 收货信息:线上租赁由快递发货
address: payload.address || null,
// CREDIT=信用免押,PAID=支付押金
depositMode: 'CREDIT',
// PENDING=授权中,ACTIVE=免押生效,RELEASED=已解除
status: 'PENDING',

View File

@@ -6,10 +6,6 @@
<view class="back-arrow"></view>
</view>
</view>
<view v-if="showBadge" class="zm-badge">
<view class="zm-logo"><text class="zm-logo-text">芝</text></view>
<text class="zm-text">芝麻信用</text>
</view>
<view class="hero-title">
<text class="hero-slash">///</text>
<text class="hero-text">{{ title }}</text>
@@ -27,11 +23,6 @@
type: String,
default: ''
},
// 是否显示「芝麻信用」标识(押金页不显示)
showBadge: {
type: Boolean,
default: false
},
showBack: {
type: Boolean,
default: true
@@ -49,7 +40,7 @@
onMounted(() => {
statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight || 0
// 支付宝端用透明原生导航栏自带的返回按钮(pages.json 里 navigationBarTextStyle 已设为白色),
// 支付宝端用透明原生导航栏自带的返回按钮(pages.json 里 navigationBarTextStyle 已设为白色)
// 这里不再画第二个箭头;其他端没有原生导航栏,自己画。
// #ifdef MP-ALIPAY
canBack.value = false
@@ -104,35 +95,6 @@
transform: rotate(45deg);
}
.zm-badge {
display: flex;
align-items: center;
justify-content: center;
margin-top: 8rpx;
}
.zm-logo {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #ffffff;
}
.zm-logo-text {
font-size: 22rpx;
font-weight: 600;
color: #1e6bff;
}
.zm-text {
margin-left: 12rpx;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.95);
}
.hero-title {
display: flex;
align-items: center;

View File

@@ -8,12 +8,34 @@
const config = {
// 品牌信息
brandName: '宠物智能项圈',
brandLogo: '/static/logo.png',
brandLogo: '/static/app_icon.png',
// 租赁物品与押金,仅用于页面展示,真实金额以服务端下单结果为准
// 租赁商品与押金,仅用于页面展示,真实金额以服务端下单结果为准
itemName: '宠物智能项圈',
// 商品实拍图:芝麻审核要求承接页展示真实商品内容
itemImage: '/static/xiangquan.png',
// 商品卖点,按实际产品填写
itemDesc: '智能定位 · 健康监测 · 防水防丢,适合日常佩戴',
// 租金与租期
rentPrice: 69,
rentPeriod: '月',
depositAmount: 69,
// 线上实物租赁:商品以快递方式发出,租期结束后寄回
delivery: {
// 发货时效
shipTime: '下单后 48 小时内发货',
// 运费说明
shipFee: '全国包邮',
// 计租起点
rentStart: '签收后开始计算租期'
},
// 免押能力所属信用服务品牌,用于承接页的免押说明文案
creditBrand: '芝麻信用',
// 服务提供方(公司/门店名称),留空则不展示
serviceProvider: '',
// 服务端接口
apiBaseUrl: 'https://api.example.com',
// 服务端未就绪时用本地 mock 跑通前端流程,联调时改成 false
@@ -27,7 +49,7 @@ const config = {
downloadUrl: ''
},
// 协议页面(当前是本地占位页,正式文本请替换为芝麻信用官方协议地址)
// 协议页面(如换成芝麻信用官方协议地址,直接替换这里的路径即可)
agreements: {
credit: '/pages/agreement/agreement'
}

View File

@@ -58,7 +58,7 @@
},
"mp-alipay" : {
/* 在支付宝开放平台创建小程序后,把 appid 填到这里 */
"appid" : "",
"appid" : "2021007112698339",
"usingComponents" : true
},
"mp-baidu" : {

View File

@@ -33,10 +33,16 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/address/address",
"style": {
"navigationBarTitleText": "收货信息"
}
},
{
"path": "pages/agreement/agreement",
"style": {
"navigationBarTitleText": "芝麻信用协议及授权条款"
"navigationBarTitleText": "信用服务授权条款"
}
}
],

149
pages/address/address.vue Normal file
View File

@@ -0,0 +1,149 @@
<template>
<view class="page">
<view class="form">
<view class="form-item">
<text class="label">收货人</text>
<input class="input" v-model="form.name" maxlength="20" placeholder="请输入收货人姓名" />
</view>
<view class="form-item">
<text class="label">手机号</text>
<input class="input" v-model="form.phone" type="number" maxlength="11" placeholder="请输入手机号" />
</view>
<view class="form-item">
<text class="label">所在地区</text>
<input class="input" v-model="form.region" maxlength="30" placeholder="省 / 市 / 区" />
</view>
<view class="form-item last">
<text class="label">详细地址</text>
<input class="input" v-model="form.detail" maxlength="60" placeholder="街道、门牌号等" />
</view>
</view>
<view class="tip">
商品将通过快递寄送,请确保收货信息准确。租期自签收后开始计算,租期结束前需按指引寄回。
</view>
<view class="bottom-bar">
<button class="btn-primary" :disabled="submitting" @tap="handleSubmit">
{{ submitting ? '处理中...' : '提交并申请免押' }}
</button>
</view>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import config from '@/config'
import { createCreditOrder, syncOrderStatus } from '@/api/order'
import { authorizeCreditBorrow } from '@/utils/zhima'
const ADDRESS_KEY = 'rental_address'
// 记住上次填写的收货信息,减少重复输入
const saved = uni.getStorageSync(ADDRESS_KEY) || {}
const form = reactive({
name: saved.name || '',
phone: saved.phone || '',
region: saved.region || '',
detail: saved.detail || ''
})
const submitting = ref(false)
function validate() {
if (!form.name.trim()) return '请填写收货人'
if (!/^1[3-9]\d{9}$/.test(form.phone.trim())) return '请填写正确的手机号'
if (!form.region.trim()) return '请填写所在地区'
if (!form.detail.trim()) return '请填写详细地址'
return ''
}
async function handleSubmit() {
if (submitting.value) return
const message = validate()
if (message) {
uni.showToast({ title: message, icon: 'none' })
return
}
const address = {
name: form.name.trim(),
phone: form.phone.trim(),
region: form.region.trim(),
detail: form.detail.trim()
}
submitting.value = true
try {
uni.setStorageSync(ADDRESS_KEY, address)
// 1. 服务端创建免押订单,同时向芝麻创建信用借还订单
uni.showLoading({ title: '创建订单中', mask: true })
const order = await createCreditOrder({
itemName: config.itemName,
depositAmount: config.depositAmount,
address
})
// 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
}
}
</script>
<style>
.page {
min-height: 100vh;
padding-bottom: 220rpx;
background: #ffffff;
}
.form {
padding: 0 40rpx;
}
.form-item {
display: flex;
align-items: center;
height: 112rpx;
border-bottom: 1rpx solid #eeeeee;
}
.form-item.last {
border-bottom: none;
}
.label {
flex-shrink: 0;
width: 160rpx;
font-size: 28rpx;
color: #333333;
}
.input {
flex: 1;
font-size: 28rpx;
color: #1a1a1a;
}
.tip {
margin: 32rpx 40rpx 0;
font-size: 24rpx;
line-height: 1.6;
color: #999999;
}
</style>

View File

@@ -1,36 +1,78 @@
<template>
<view class="agreement-page">
<view class="title">芝麻信用协议及授权条款</view>
<view class="update">更新日期:2026-10-27</view>
<view class="title">信用服务授权条款</view>
<view class="update">更新日期:2026-11-11</view>
<view class="section">
<view class="section-title">一、授权范围</view>
<view class="section-title">一、服务说明</view>
<view class="paragraph">
用户同意本小程序在办理宠物智能项圈租赁免押时,向芝麻信用查询用户的信用评估结果,
用于判断是否免除押金。用户可随时在支付宝「芝麻信用 - 我的 - 信用管理」中查看或解除授权。
本小程序提供线上实物租赁服务,出租商品为「{{ itemName }}」。用户在租赁时选择信用免押方式,
经信用评估通过后可免交 {{ depositAmount }} 元押金;评估未通过时,按租赁规则支付押金后办理租赁。
商品由服务提供方以快递方式送达,租期结束前由用户按指引寄回。
</view>
</view>
<view class="section">
<view class="section-title">二、免押与履约</view>
<view class="section-title">二、信用评估授权</view>
<view class="paragraph">
免押租赁期间,用户应按约定时间归还设备并保证设备完好。逾期未归还或设备损坏的,
按门店租赁规则处理,并可能影响用户的芝麻信用记录。
用户同意本小程序在办理本次免押时,向{{ creditBrand }}查询用户的信用评估结果,仅用于判断是否免除本次押金。
用户可随时在支付宝「芝麻信用 - 我的 - 信用管理」中查看或解除授权;解除授权后,本次免押服务将不再有效。
</view>
</view>
<view class="section">
<view class="section-title">三、信息使用</view>
<view class="section-title">三、免押与押金</view>
<view class="paragraph">
本小程序仅将信用评估结果用于本次免押判断,不会用于与租赁无关的用途,
相关信息的存储与保护遵循法律法规及芝麻信用平台规则。
免押金额为 {{ depositAmount }} 元,仅免除本次租赁押金,不免除租金及用户应履行的其他义务。
以押金方式办理的用户,在商品验收无损归还后按租赁规则退还押金。
</view>
</view>
<view class="placeholder">注:以上为占位文本,正式上线前需替换为经法务/芝麻信用确认的协议全文。</view>
<view class="section">
<view class="section-title">四、租赁与归还</view>
<view class="paragraph">
商品签收后开始计算租期。用户应按订单约定的租期使用商品,并在租期届满前按小程序内归还指引寄回。
归还时商品应保持可正常使用状态,因人为损坏、丢失或配件缺失造成的损失,按租赁规则处理。
</view>
</view>
<view class="section">
<view class="section-title">五、逾期与违约</view>
<view class="paragraph">
逾期未归还的,按租赁规则收取相应费用;经催告仍未归还或存在其他违约行为的,服务提供方可依法维权,
相关违约记录可能影响用户的信用记录。
</view>
</view>
<view class="section">
<view class="section-title">六、信息使用与保护</view>
<view class="paragraph">
本小程序仅将信用评估结果用于本次免押判断,不会用于与本次租赁无关的用途。
用户信息的收集、存储与使用遵循法律法规及{{ creditBrand }}平台规则,
未经用户同意不会向无关第三方提供。
</view>
</view>
<view class="section">
<view class="section-title">七、其他</view>
<view class="paragraph">
本条款由{{ provider }}提供并解释。条款内容如有变更,将在小程序内公示;
用户继续使用服务即视为接受变更后的条款。如对条款有疑问,可通过小程序内客服入口联系我们。
</view>
</view>
</view>
</template>
<script setup>
import config from '@/config'
const itemName = config.itemName
const depositAmount = config.depositAmount
const creditBrand = config.creditBrand
// 服务提供方未配置时用中性表述,正式上线前请在 config 中填写公司全称
const provider = config.serviceProvider || '服务提供方'
</script>
<style>
.agreement-page {
padding: 40rpx;
@@ -65,14 +107,4 @@
line-height: 1.8;
color: #555555;
}
.placeholder {
margin-top: 60rpx;
padding: 24rpx;
border-radius: 12rpx;
background: #f5f7fa;
font-size: 24rpx;
line-height: 1.6;
color: #999999;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view class="page">
<credit-header title="押金" :show-badge="false"></credit-header>
<credit-header title="押金"></credit-header>
<view v-if="order" class="info-section">
<rental-info
@@ -45,7 +45,7 @@
if (!order.value || releasing.value) return
uni.showModal({
title: '解除信用授权',
content: '解除后本次免押将不再有效,押金按门店规则处理,确认继续?',
content: '解除后本次免押将不再有效,押金按租赁规则处理,确认继续?',
confirmText: '确认解除',
confirmColor: '#1E6BFF',
success: (res) => {

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 {

View File

@@ -1,6 +1,6 @@
<template>
<view class="page">
<credit-header title="信用免押金" :show-badge="true"></credit-header>
<credit-header title="信用免押金"></credit-header>
<view class="result">
<view class="success-icon">
@@ -12,7 +12,7 @@
</view>
<view class="bottom-bar">
<button class="btn-primary" @tap="goAddDevice">前往添加设备</button>
<button class="btn-primary" @tap="handleDone">知道了</button>
</view>
</view>
</template>
@@ -21,7 +21,6 @@
import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { getOrder } from '@/api/order'
import { openPetApp } from '@/utils/pet-app'
const orderId = ref('')
const confirmed = ref(false)
@@ -57,9 +56,9 @@
}
}
// 添加设备在宠物 App 内完成,小程序只做交接
function goAddDevice() {
openPetApp()
// 免押流程到此结束,回到首页
function handleDone() {
uni.reLaunch({ url: '/pages/index/index' })
}
</script>

BIN
static/app_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
static/xiangquan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB