feat:部分项目中心

This commit is contained in:
李伊帆
2026-09-14 17:09:25 +08:00
parent f5d634bbaf
commit 2c7a115dd7
131 changed files with 7476 additions and 4589 deletions

View File

@@ -0,0 +1,328 @@
@import '@/styles/variables.scss';
.after-sales-apply {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.after-sales-apply__navbar {
position: relative;
z-index: 30;
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 12rpx;
background: $color-bg-page;
}
.after-sales-apply__back {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
}
.after-sales-apply__back-icon {
width: 40rpx;
height: 40rpx;
}
.after-sales-apply__navbar-title {
font-size: 34rpx;
font-weight: 600;
color: $color-text-primary;
}
.after-sales-apply__navbar-placeholder {
width: 64rpx;
height: 64rpx;
}
.after-sales-apply__scroll {
flex: 1;
height: 0;
padding: 20rpx 24rpx;
box-sizing: border-box;
}
.after-sales-apply__card {
padding: 28rpx 24rpx;
margin-bottom: 20rpx;
background: $color-bg-page;
border-radius: 20rpx;
&--dropdown {
position: relative;
z-index: 20;
overflow: visible;
}
}
.after-sales-apply__field {
margin-bottom: 28rpx;
&:last-child {
margin-bottom: 0;
}
}
.after-sales-apply__label-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
}
.after-sales-apply__label {
display: block;
margin-bottom: 16rpx;
font-size: 28rpx;
font-weight: 500;
color: $color-text-primary;
&--inline {
display: inline;
margin-bottom: 0;
}
}
.after-sales-apply__required {
color: #ff4d4f;
}
.after-sales-apply__hint {
font-size: 24rpx;
color: $color-text-secondary;
}
.after-sales-apply__input {
width: 100%;
font-size: 28rpx;
color: $color-text-primary;
&--box {
height: 80rpx;
padding: 0 24rpx;
background: $color-bg-page;
border: 1rpx solid #e8eaef;
border-radius: 12rpx;
box-sizing: border-box;
}
}
.after-sales-apply__placeholder {
color: $color-text-placeholder;
}
.after-sales-apply__select-wrap {
position: relative;
z-index: 20;
}
.after-sales-apply__select {
display: flex;
align-items: center;
height: 80rpx;
padding: 0 24rpx;
background: $color-bg-page;
border: 1rpx solid #e8eaef;
border-radius: 12rpx;
}
.after-sales-apply__select-text {
flex: 1;
font-size: 28rpx;
color: $color-text-primary;
&--placeholder {
color: $color-text-placeholder;
}
}
.after-sales-apply__select-arrow {
flex-shrink: 0;
margin-left: 12rpx;
font-size: 24rpx;
color: $color-text-secondary;
transition: transform 0.2s ease;
&--open {
transform: rotate(180deg);
}
}
.after-sales-apply__dropdown {
position: absolute;
top: calc(100% + 8rpx);
right: 0;
left: 0;
z-index: 21;
overflow: hidden;
background: $color-bg-page;
border: 1rpx solid #e8eaef;
border-radius: 12rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
}
.after-sales-apply__dropdown-item {
padding: 24rpx;
font-size: 28rpx;
color: $color-text-primary;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
&--active {
color: $color-primary;
background: $color-primary-light;
}
}
.after-sales-apply__dropdown-mask {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
background: transparent;
}
.after-sales-apply__textarea-wrap {
position: relative;
padding: 20rpx 24rpx 48rpx;
background: $color-bg-page;
border: 1rpx solid #e8eaef;
border-radius: 12rpx;
}
.after-sales-apply__textarea {
width: 100%;
min-height: 180rpx;
font-size: 28rpx;
line-height: 1.6;
color: $color-text-primary;
&--remark {
min-height: 140rpx;
padding: 20rpx 24rpx;
background: $color-bg-page;
border: 1rpx solid #e8eaef;
border-radius: 12rpx;
box-sizing: border-box;
}
}
.after-sales-apply__counter {
position: absolute;
right: 24rpx;
bottom: 16rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.after-sales-apply__attachment-row {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
padding: 10rpx 10rpx 0 0;
}
.after-sales-apply__attachment-item {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 160rpx;
padding: 20rpx 16rpx;
background: $color-bg-section;
border-radius: 12rpx;
}
.after-sales-apply__attachment-remove {
position: absolute;
top: -10rpx;
right: -10rpx;
width: 32rpx;
height: 32rpx;
}
.after-sales-apply__attachment-remove-icon {
width: 32rpx;
height: 32rpx;
}
.after-sales-apply__attachment-icon {
width: 64rpx;
height: 64rpx;
}
.after-sales-apply__attachment-name {
margin-top: 12rpx;
font-size: 22rpx;
color: $color-text-primary;
text-align: center;
word-break: break-all;
}
.after-sales-apply__attachment-add {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 160rpx;
height: 160rpx;
background: #f8f9fb;
border: 1rpx dashed #d8dde6;
border-radius: 12rpx;
}
.after-sales-apply__attachment-add-icon {
font-size: 40rpx;
line-height: 1;
color: $color-text-secondary;
}
.after-sales-apply__attachment-add-text {
margin-top: 8rpx;
font-size: 20rpx;
color: $color-text-secondary;
}
.after-sales-apply__footer {
display: flex;
gap: 20rpx;
flex-shrink: 0;
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
background: $color-bg-page;
border-top: 1rpx solid #f0f0f0;
}
.after-sales-apply__footer-btn {
display: flex;
align-items: center;
justify-content: center;
height: 88rpx;
font-size: 30rpx;
border-radius: 12rpx;
&--outline {
flex: 0.8;
color: $color-primary;
background: $color-bg-page;
border: 1rpx solid $color-primary;
}
&--primary {
flex: 1.2;
font-weight: 600;
color: #ffffff;
background: $color-primary;
}
}

View File

@@ -0,0 +1,316 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { BUSINESS_TYPE_OPTIONS } from '@/constants/business-types'
import { getProjectDetail } from '@/constants/project-detail'
import deleteIcon from '@/static/icons/X.png'
import pdfIcon from '@/static/icons/PDF.png'
import pngIcon from '@/static/icons/PNG.png'
import { navigateBackWithFallback } from '@/utils/navigate-back'
import { navigateToResultPage } from '@/utils/navigate-result'
const projectId = ref('1')
const fallbackUrl = ref('/pages/project-center/index')
const businessType = ref('')
const businessTypeDropdownVisible = ref(false)
const businessTypeOptions = BUSINESS_TYPE_OPTIONS
const projectName = ref('')
const description = ref('')
const userName = ref('王永志')
const userPhone = ref('186****9618')
const remark = ref('')
const attachments = ref([
{ id: '1', name: '需求文档.pdf', icon: pdfIcon },
{ id: '2', name: '系统....pdf', icon: pdfIcon },
{ id: '3', name: '参考图.png', icon: pngIcon },
])
const descLength = computed(() => description.value.length)
onLoad((options) => {
const id = options?.id ? decodeURIComponent(String(options.id)) : '1'
projectId.value = id
fallbackUrl.value = `/pages/project-center/detail/index?id=${encodeURIComponent(id)}`
const detail = getProjectDetail(id)
if (detail) {
projectName.value = detail.title
if (BUSINESS_TYPE_OPTIONS.includes(detail.category))
businessType.value = detail.category
}
})
function handleBack() {
closeBusinessTypeDropdown()
navigateBackWithFallback(fallbackUrl.value)
}
function toggleBusinessTypeDropdown() {
businessTypeDropdownVisible.value = !businessTypeDropdownVisible.value
}
function closeBusinessTypeDropdown() {
businessTypeDropdownVisible.value = false
}
function handleSelectBusinessType(option: string) {
businessType.value = option
closeBusinessTypeDropdown()
}
function handleRemoveAttachment(id: string) {
attachments.value = attachments.value.filter(item => item.id !== id)
}
function handleAddAttachment() {
uni.showToast({ title: '附件上传开发中', icon: 'none' })
}
function handleReset() {
description.value = ''
remark.value = ''
businessType.value = ''
const detail = getProjectDetail(projectId.value)
if (detail) {
projectName.value = detail.title
if (BUSINESS_TYPE_OPTIONS.includes(detail.category))
businessType.value = detail.category
}
}
function handleSubmit() {
if (!businessType.value) {
uni.showToast({ title: '请选择业务类型', icon: 'none' })
return
}
if (!projectName.value.trim()) {
uni.showToast({ title: '项目名称不能为空', icon: 'none' })
return
}
if (!description.value.trim()) {
uni.showToast({ title: '请填写核心需求描述', icon: 'none' })
return
}
navigateToResultPage('afterSalesSuccess', { id: projectId.value })
}
</script>
<template>
<view class="after-sales-apply">
<view class="after-sales-apply__navbar">
<view
class="after-sales-apply__back"
@tap="handleBack"
>
<image
class="after-sales-apply__back-icon"
src="/static/icons/icon-back.svg"
mode="aspectFit"
/>
</view>
<text class="after-sales-apply__navbar-title">
申请售后
</text>
<view class="after-sales-apply__navbar-placeholder" />
</view>
<scroll-view
class="after-sales-apply__scroll"
scroll-y
:show-scrollbar="false"
>
<view class="after-sales-apply__card after-sales-apply__card--dropdown">
<view class="after-sales-apply__field">
<text class="after-sales-apply__label">
业务类型<text class="after-sales-apply__required">
*
</text>
</text>
<view class="after-sales-apply__select-wrap">
<view
class="after-sales-apply__select"
@tap.stop="toggleBusinessTypeDropdown"
>
<text
class="after-sales-apply__select-text"
:class="{ 'after-sales-apply__select-text--placeholder': !businessType }"
>
{{ businessType || '选择下方推荐的服务或手动输入服务名称' }}
</text>
<text
class="after-sales-apply__select-arrow"
:class="{ 'after-sales-apply__select-arrow--open': businessTypeDropdownVisible }"
>
▾
</text>
</view>
<view
v-if="businessTypeDropdownVisible"
class="after-sales-apply__dropdown"
@tap.stop
>
<view
v-for="option in businessTypeOptions"
:key="option"
class="after-sales-apply__dropdown-item"
:class="{ 'after-sales-apply__dropdown-item--active': businessType === option }"
@tap="handleSelectBusinessType(option)"
>
{{ option }}
</view>
</view>
</view>
</view>
</view>
<view class="after-sales-apply__card">
<view class="after-sales-apply__field">
<text class="after-sales-apply__label">
项目名称<text class="after-sales-apply__required">
*
</text>
</text>
<input
v-model="projectName"
class="after-sales-apply__input after-sales-apply__input--box"
placeholder="项目名称不能为空"
placeholder-class="after-sales-apply__placeholder"
>
</view>
<view class="after-sales-apply__field">
<text class="after-sales-apply__label">
核心需求描述<text class="after-sales-apply__required">
*
</text>
</text>
<view class="after-sales-apply__textarea-wrap">
<textarea
v-model="description"
class="after-sales-apply__textarea"
placeholder="请详细描述您的问题..."
placeholder-class="after-sales-apply__placeholder"
:maxlength="500"
/>
<text class="after-sales-apply__counter">
{{ descLength }}/500字
</text>
</view>
</view>
<view class="after-sales-apply__field">
<text class="after-sales-apply__label">
用户名称
</text>
<input
v-model="userName"
class="after-sales-apply__input after-sales-apply__input--box"
placeholder="请输入用户名称"
placeholder-class="after-sales-apply__placeholder"
>
</view>
<view class="after-sales-apply__field">
<text class="after-sales-apply__label">
用户手机号
</text>
<input
v-model="userPhone"
class="after-sales-apply__input after-sales-apply__input--box"
placeholder="请输入用户手机号"
placeholder-class="after-sales-apply__placeholder"
>
</view>
<view class="after-sales-apply__field">
<view class="after-sales-apply__label-row">
<text class="after-sales-apply__label after-sales-apply__label--inline">
附件上传
</text>
<text class="after-sales-apply__hint">
支持图片/文档/压缩包
</text>
</view>
<view class="after-sales-apply__attachment-row">
<view
v-for="file in attachments"
:key="file.id"
class="after-sales-apply__attachment-item"
>
<view
class="after-sales-apply__attachment-remove"
@tap="handleRemoveAttachment(file.id)"
>
<image
class="after-sales-apply__attachment-remove-icon"
:src="deleteIcon"
mode="aspectFit"
/>
</view>
<image
class="after-sales-apply__attachment-icon"
:src="file.icon"
mode="aspectFit"
/>
<text class="after-sales-apply__attachment-name">
{{ file.name }}
</text>
</view>
<view
class="after-sales-apply__attachment-add"
@tap="handleAddAttachment"
>
<text class="after-sales-apply__attachment-add-icon">
+
</text>
<text class="after-sales-apply__attachment-add-text">
添加附件
</text>
</view>
</view>
</view>
</view>
<view class="after-sales-apply__card">
<view class="after-sales-apply__field">
<text class="after-sales-apply__label">
补充备注
</text>
<textarea
v-model="remark"
class="after-sales-apply__textarea after-sales-apply__textarea--remark"
placeholder="其他需要说明的事项..."
placeholder-class="after-sales-apply__placeholder"
/>
</view>
</view>
</scroll-view>
<view
v-if="businessTypeDropdownVisible"
class="after-sales-apply__dropdown-mask"
@tap="closeBusinessTypeDropdown"
/>
<view class="after-sales-apply__footer">
<view
class="after-sales-apply__footer-btn after-sales-apply__footer-btn--primary"
@tap="handleReset"
>
重置
</view>
<view
class="after-sales-apply__footer-btn after-sales-apply__footer-btn--primary"
@tap="handleSubmit"
>
立即提报
</view>
</view>
</view>
</template>
<style scoped lang="scss">
@import './index.scss';
</style>

View File

@@ -0,0 +1,148 @@
@import '@/styles/variables.scss';
.bill-detail {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.bill-detail__navbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
background: $color-bg-page;
}
.bill-detail__back {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
}
.bill-detail__back-icon {
width: 40rpx;
height: 40rpx;
}
.bill-detail__navbar-title {
font-size: 34rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-detail__navbar-placeholder {
width: 64rpx;
height: 64rpx;
}
.bill-detail__scroll {
flex: 1;
height: 0;
}
.bill-detail__content {
padding: 24rpx 24rpx calc(32rpx + env(safe-area-inset-bottom));
}
.bill-detail__hero {
display: flex;
flex-direction: column;
align-items: center;
padding: 24rpx 0 40rpx;
}
.bill-detail__icon {
width: 120rpx;
height: 120rpx;
}
.bill-detail__status {
margin-top: 28rpx;
font-size: 36rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-detail__amount {
margin-top: 16rpx;
font-size: 26rpx;
color: $color-text-secondary;
}
.bill-detail__card {
padding: 28rpx 24rpx;
margin-bottom: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
&:last-child {
margin-bottom: 0;
}
}
.bill-detail__card-title {
display: block;
margin-bottom: 24rpx;
font-size: 30rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-detail__info-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-top: 20rpx;
&:first-of-type {
margin-top: 0;
}
}
.bill-detail__info-label {
flex-shrink: 0;
font-size: 26rpx;
color: $color-text-secondary;
}
.bill-detail__info-value {
flex: 1;
margin-left: 24rpx;
font-size: 26rpx;
color: $color-text-primary;
text-align: right;
word-break: break-all;
}
.bill-detail__order-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.bill-detail__order-title {
flex: 1;
padding-right: 16rpx;
font-size: 28rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-detail__order-amount {
flex-shrink: 0;
font-size: 28rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-detail__order-meta {
display: block;
margin-top: 12rpx;
font-size: 22rpx;
color: $color-text-secondary;
}

View File

@@ -0,0 +1,140 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getBill } from '@/constants/bill-list'
import successIcon from '@/static/icons/icon-register-success.png'
import type { BillItem } from '@/types/bill'
import { navigateBackWithFallback } from '@/utils/navigate-back'
type PaymentMethod = 'wechat' | 'alipay'
const bill = ref<BillItem | null>(null)
const paymentMethod = ref<PaymentMethod>('wechat')
const paymentMethodLabel = computed(() =>
paymentMethod.value === 'wechat' ? '微信支付' : '支付宝',
)
const paymentTime = computed(() => bill.value?.paidAt || '2026-01-21 15:00:00')
onLoad((options) => {
const projectId = options?.projectId ? decodeURIComponent(String(options.projectId)) : '1'
const planId = options?.planId ? decodeURIComponent(String(options.planId)) : '1'
const method = options?.method ? decodeURIComponent(String(options.method)) : 'wechat'
paymentMethod.value = method === 'alipay' ? 'alipay' : 'wechat'
bill.value = getBill(projectId, planId)
if (!bill.value) {
uni.showToast({ title: '账单不存在', icon: 'none' })
setTimeout(() => uni.navigateBack(), 1500)
}
})
function handleBack() {
navigateBackWithFallback('/pages/project-center/bill-list/index')
}
function formatAmount(amount: number) {
return `¥ ${amount}`
}
</script>
<template>
<view
v-if="bill"
class="bill-detail"
>
<view class="bill-detail__navbar">
<view
class="bill-detail__back"
@tap="handleBack"
>
<image
class="bill-detail__back-icon"
src="/static/icons/icon-back.svg"
mode="aspectFit"
/>
</view>
<text class="bill-detail__navbar-title">
账单明细
</text>
<view class="bill-detail__navbar-placeholder" />
</view>
<scroll-view
class="bill-detail__scroll"
scroll-y
:show-scrollbar="false"
>
<view class="bill-detail__content">
<view class="bill-detail__hero">
<image
class="bill-detail__icon"
:src="successIcon"
mode="aspectFit"
/>
<text class="bill-detail__status">
已支付
</text>
<text class="bill-detail__amount">
付款金额:{{ formatAmount(bill.amount) }}
</text>
</view>
<view class="bill-detail__card">
<text class="bill-detail__card-title">
支付信息
</text>
<view class="bill-detail__info-row">
<text class="bill-detail__info-label">
支付方式
</text>
<text class="bill-detail__info-value">
{{ paymentMethodLabel }}
</text>
</view>
<view class="bill-detail__info-row">
<text class="bill-detail__info-label">
支付时间
</text>
<text class="bill-detail__info-value">
{{ paymentTime }}
</text>
</view>
<view class="bill-detail__info-row">
<text class="bill-detail__info-label">
交易流水号
</text>
<text class="bill-detail__info-value">
{{ bill.transactionNo }}
</text>
</view>
</view>
<view class="bill-detail__card">
<text class="bill-detail__card-title">
已支付订单
</text>
<view class="bill-detail__order-row">
<text class="bill-detail__order-title">
{{ bill.title }} {{ bill.ratio }}
</text>
<text class="bill-detail__order-amount">
{{ formatAmount(bill.amount) }}
</text>
</view>
<text class="bill-detail__order-meta">
账单号:{{ bill.billNo }}
</text>
<text class="bill-detail__order-meta">
关联项目:{{ bill.relatedProject }}
</text>
</view>
</view>
</scroll-view>
</view>
</template>
<style scoped lang="scss">
@import './index.scss';
</style>

View File

@@ -0,0 +1,185 @@
@import '@/styles/variables.scss';
.bill-list {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.bill-list__navbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
background: $color-bg-page;
}
.bill-list__back {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
}
.bill-list__back-icon {
width: 40rpx;
height: 40rpx;
}
.bill-list__navbar-title {
font-size: 34rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-list__navbar-placeholder {
width: 64rpx;
height: 64rpx;
}
.bill-list__scroll {
flex: 1;
height: 0;
}
.bill-list__content {
padding: 24rpx 24rpx calc(32rpx + env(safe-area-inset-bottom));
}
.bill-list__summary {
display: flex;
padding: 28rpx 16rpx;
background: $color-bg-page;
border-radius: 20rpx;
}
.bill-list__summary-item {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
}
.bill-list__summary-value {
font-size: 32rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-list__summary-label {
margin-top: 8rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.bill-list__search {
display: flex;
align-items: center;
height: 72rpx;
margin-top: 24rpx;
padding: 0 24rpx;
background: $color-bg-page;
border-radius: 36rpx;
}
.bill-list__search-icon {
flex-shrink: 0;
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
}
.bill-list__search-input {
flex: 1;
font-size: 26rpx;
color: $color-text-primary;
}
.bill-list__search-placeholder {
color: $color-text-placeholder;
}
.bill-list__card {
padding: 28rpx 24rpx;
margin-top: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
}
.bill-list__card-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.bill-list__card-title {
flex: 1;
padding-right: 16rpx;
font-size: 28rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-list__tag {
flex-shrink: 0;
padding: 4rpx 12rpx;
font-size: 20rpx;
border-radius: 6rpx;
&--paid {
color: #ffffff;
background: $color-primary;
}
&--pending {
color: #ffffff;
background: #ff9a3d;
}
&--not_due {
color: $color-primary;
background: $color-primary-light;
}
}
.bill-list__card-body {
display: flex;
align-items: flex-end;
justify-content: space-between;
margin-top: 20rpx;
}
.bill-list__card-meta {
flex: 1;
min-width: 0;
padding-right: 16rpx;
}
.bill-list__card-row {
display: block;
font-size: 22rpx;
line-height: 1.6;
color: #666666;
}
.bill-list__card-amount {
flex-shrink: 0;
font-size: 32rpx;
font-weight: 600;
color: $color-text-primary;
}
.bill-list__pay-btn {
display: flex;
align-items: center;
justify-content: center;
height: 80rpx;
margin-top: 24rpx;
font-size: 28rpx;
color: #ffffff;
background: $color-primary;
border-radius: 12rpx;
}

View File

@@ -0,0 +1,176 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { BILL_LIST, BILL_LIST_SUMMARY } from '@/constants/bill-list'
import { PAYMENT_PLAN_STATUS_LABEL } from '@/constants/project-detail'
import type { BillItem } from '@/types/bill'
import type { PaymentPlanStatus } from '@/types/project-detail'
import { navigateBackWithFallback } from '@/utils/navigate-back'
const keyword = ref('')
const billList = ref(BILL_LIST.map(item => ({ ...item })))
const filteredBills = computed(() => {
const text = keyword.value.trim()
if (!text)
return billList.value
return billList.value.filter(item =>
item.title.includes(text)
|| item.billNo.includes(text)
|| item.relatedProject.includes(text)
|| item.transactionNo.includes(text),
)
})
function handleBack() {
navigateBackWithFallback('/pages/project-center/index')
}
function paymentStatusClass(status: PaymentPlanStatus) {
return `bill-list__tag--${status}`
}
function formatAmount(amount: number) {
return `¥ ${amount}`
}
function handleBillTap(item: BillItem) {
if (item.status === 'pending') {
uni.navigateTo({
url: `/pages/project-center/payment/index?projectId=${encodeURIComponent(item.projectId)}&planId=${encodeURIComponent(item.id)}`,
})
return
}
if (item.status === 'paid') {
uni.navigateTo({
url: `/pages/project-center/bill-detail/index?projectId=${encodeURIComponent(item.projectId)}&planId=${encodeURIComponent(item.id)}&method=${encodeURIComponent(item.paidMethod || 'wechat')}`,
})
}
}
function handlePayNow(item: BillItem) {
uni.navigateTo({
url: `/pages/project-center/payment/index?projectId=${encodeURIComponent(item.projectId)}&planId=${encodeURIComponent(item.id)}`,
})
}
</script>
<template>
<view class="bill-list">
<view class="bill-list__navbar">
<view
class="bill-list__back"
@tap="handleBack"
>
<image
class="bill-list__back-icon"
src="/static/icons/icon-back.svg"
mode="aspectFit"
/>
</view>
<text class="bill-list__navbar-title">
账单明细
</text>
<view class="bill-list__navbar-placeholder" />
</view>
<scroll-view
class="bill-list__scroll"
scroll-y
:show-scrollbar="false"
>
<view class="bill-list__content">
<view class="bill-list__summary">
<view class="bill-list__summary-item">
<text class="bill-list__summary-value">
{{ BILL_LIST_SUMMARY.totalCount }}
</text>
<text class="bill-list__summary-label">
总笔数
</text>
</view>
<view class="bill-list__summary-item">
<text class="bill-list__summary-value">
¥ {{ BILL_LIST_SUMMARY.totalAmount }}
</text>
<text class="bill-list__summary-label">
总金额
</text>
</view>
<view class="bill-list__summary-item">
<text class="bill-list__summary-value">
{{ BILL_LIST_SUMMARY.pendingCount }}
</text>
<text class="bill-list__summary-label">
待支付
</text>
</view>
</view>
<view class="bill-list__search">
<image
class="bill-list__search-icon"
src="/static/icons/icon-search.svg"
mode="aspectFit"
/>
<input
v-model="keyword"
class="bill-list__search-input"
placeholder="搜索案例标题、描述、标签..."
placeholder-class="bill-list__search-placeholder"
>
</view>
<view
v-for="item in filteredBills"
:key="`${item.projectId}-${item.id}`"
class="bill-list__card"
@tap="handleBillTap(item)"
>
<view class="bill-list__card-header">
<text class="bill-list__card-title">
{{ item.title }} {{ item.ratio }}
</text>
<text
class="bill-list__tag"
:class="paymentStatusClass(item.status)"
>
{{ PAYMENT_PLAN_STATUS_LABEL[item.status] }}
</text>
</view>
<view class="bill-list__card-body">
<view class="bill-list__card-meta">
<text
v-if="item.status === 'paid'"
class="bill-list__card-row"
>
交易流水号:{{ item.transactionNo }}
</text>
<text class="bill-list__card-row">
账单号:{{ item.billNo }}
</text>
<text class="bill-list__card-row">
关联项目:{{ item.relatedProject }}
</text>
</view>
<text class="bill-list__card-amount">
{{ formatAmount(item.amount) }}
</text>
</view>
<view
v-if="item.status === 'pending'"
class="bill-list__pay-btn"
@tap.stop="handlePayNow(item)"
>
立即支付
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<style scoped lang="scss">
@import './index.scss';
</style>

View File

@@ -0,0 +1,104 @@
@import '@/styles/variables.scss';
.project-center-card {
padding: 28rpx 24rpx;
margin-bottom: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
margin-top: 20rpx;
}
.project-center-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.project-center-card__title {
flex: 1;
padding-right: 16rpx;
font-size: 32rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-center-card__status {
flex-shrink: 0;
font-size: 24rpx;
color: $color-text-secondary;
}
.project-center-card__meta {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.project-center-card__tag {
flex-shrink: 0;
padding: 4rpx 12rpx;
font-size: 20rpx;
color: $color-primary;
background: $color-primary-light;
border-radius: 6rpx;
}
.project-center-card__no {
flex: 1;
min-width: 0;
margin-left: 12rpx;
font-size: 22rpx;
color: #666666;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.project-center-card__progress {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.project-center-card__progress-bar {
flex: 1;
height: 12rpx;
overflow: hidden;
background: #eef2ff;
border-radius: 6rpx;
}
.project-center-card__progress-fill {
height: 100%;
background: $color-primary;
border-radius: 6rpx;
}
.project-center-card__progress-value {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 24rpx;
color: #666666;
}
.project-center-card__footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
&--simple {
justify-content: flex-end;
margin-top: 24rpx;
}
}
.project-center-card__time {
font-size: 22rpx;
color: #666666;
}
.project-center-card__detail {
font-size: 24rpx;
color: #666666;
}

View File

@@ -66,108 +66,5 @@ const emit = defineEmits<{
</template>
<style scoped lang="scss">
@import '@/styles/variables.scss';
.project-center-card {
padding: 28rpx 24rpx;
margin-bottom: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
margin-top: 20rpx;
}
.project-center-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.project-center-card__title {
flex: 1;
padding-right: 16rpx;
font-size: 32rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-center-card__status {
flex-shrink: 0;
font-size: 24rpx;
color: $color-text-secondary;
}
.project-center-card__meta {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.project-center-card__tag {
flex-shrink: 0;
padding: 4rpx 12rpx;
font-size: 20rpx;
color: $color-primary;
background: $color-primary-light;
border-radius: 6rpx;
}
.project-center-card__no {
flex: 1;
min-width: 0;
margin-left: 12rpx;
font-size: 22rpx;
color: #666666;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.project-center-card__progress {
display: flex;
align-items: center;
margin-top: 24rpx;
}
.project-center-card__progress-bar {
flex: 1;
height: 12rpx;
overflow: hidden;
background: #eef2ff;
border-radius: 6rpx;
}
.project-center-card__progress-fill {
height: 100%;
background: $color-primary;
border-radius: 6rpx;
}
.project-center-card__progress-value {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 24rpx;
color: #666666;
}
.project-center-card__footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
&--simple {
justify-content: flex-end;
margin-top: 24rpx;
}
}
.project-center-card__time {
font-size: 22rpx;
color: #666666;
}
.project-center-card__detail {
font-size: 24rpx;
color: #666666;
}
@import './ProjectCenterCard.scss';
</style>

View File

@@ -0,0 +1,605 @@
@import '@/styles/variables.scss';
.project-detail {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.project-detail__navbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
background: $color-bg-page;
}
.project-detail__back {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
}
.project-detail__back-icon {
width: 40rpx;
height: 40rpx;
}
.project-detail__navbar-title {
font-size: 34rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__navbar-placeholder {
width: 64rpx;
height: 64rpx;
}
.project-detail__scroll {
flex: 1;
height: 0;
}
.project-detail__content {
padding: 24rpx 24rpx calc(32rpx + env(safe-area-inset-bottom));
}
.project-detail__hero {
position: relative;
overflow: hidden;
border-radius: 20rpx;
}
.project-detail__hero-bg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
width: 100%;
height: 100%;
}
.project-detail__hero-inner {
position: relative;
z-index: 1;
padding: 28rpx 24rpx;
}
.project-detail__hero-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.project-detail__tag {
padding: 4rpx 12rpx;
font-size: 20rpx;
color: $color-primary;
background: $color-primary-light;
border-radius: 6rpx;
}
.project-detail__hero-status {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.project-detail__status {
font-size: 24rpx;
color: $color-text-secondary;
}
.project-detail__progress-text {
margin-top: 4rpx;
font-size: 24rpx;
color: $color-text-secondary;
}
.project-detail__title {
display: block;
margin-top: 20rpx;
font-size: 32rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__no {
display: block;
margin-top: 16rpx;
font-size: 22rpx;
color: #666666;
}
.project-detail__tabs {
display: flex;
margin-top: 24rpx;
}
.project-detail__tab {
flex: 1;
padding-bottom: 12rpx;
font-size: 28rpx;
text-align: center;
color: $color-text-secondary;
&--active {
font-weight: 600;
color: $color-text-primary;
border-bottom: 4rpx solid $color-primary;
}
}
.project-detail__panel {
margin-top: 24rpx;
padding: 28rpx 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
}
.project-detail__panel-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__dev-progress {
padding-bottom: 8rpx;
}
.project-detail__overall {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 24rpx;
}
.project-detail__overall-label {
font-size: 26rpx;
color: $color-text-secondary;
}
.project-detail__overall-value {
font-size: 28rpx;
font-weight: 600;
color: $color-primary;
}
.project-detail__slider {
margin-top: 20rpx;
}
.project-detail__slider-track {
position: relative;
height: 8rpx;
background: #e8eaef;
border-radius: 4rpx;
}
.project-detail__slider-fill {
position: absolute;
top: 0;
left: 0;
height: 100%;
background: $color-primary;
border-radius: 4rpx;
}
.project-detail__slider-thumb {
position: absolute;
top: 50%;
width: 24rpx;
height: 24rpx;
margin-left: -12rpx;
background: $color-bg-page;
border: 4rpx solid $color-primary;
border-radius: 50%;
transform: translateY(-50%);
}
.project-detail__dates {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-detail__timeline {
margin-top: 32rpx;
padding-top: 8rpx;
}
.project-detail__timeline-heading {
display: block;
margin-bottom: 24rpx;
}
.project-detail__timeline-item {
display: flex;
min-height: 96rpx;
}
.project-detail__timeline-left {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 48rpx;
margin-right: 20rpx;
}
.project-detail__timeline-dot {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
&--done {
background: $color-primary;
}
&--active {
background: $color-primary;
}
&--pending {
background: $color-bg-page;
border: 2rpx solid #d8dde6;
}
}
.project-detail__timeline-check {
font-size: 22rpx;
color: #ffffff;
}
.project-detail__timeline-index {
font-size: 22rpx;
color: #ffffff;
.project-detail__timeline-dot--pending & {
color: $color-text-secondary;
}
}
.project-detail__timeline-line {
flex: 1;
width: 2rpx;
min-height: 40rpx;
margin-top: 8rpx;
background: #e8eaef;
&--done {
background: $color-primary;
}
}
.project-detail__timeline-body {
flex: 1;
padding-bottom: 28rpx;
}
.project-detail__timeline-title {
display: block;
font-size: 28rpx;
color: $color-text-primary;
}
.project-detail__timeline-time,
.project-detail__timeline-status {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-detail__timeline-status--active {
color: $color-primary;
}
.project-detail__team {
margin-top: 32rpx;
padding-top: 28rpx;
border-top: 1rpx solid #f0f0f0;
}
.project-detail__team-scroll {
margin-top: 24rpx;
white-space: nowrap;
}
.project-detail__team-inner {
display: inline-flex;
gap: 32rpx;
}
.project-detail__member {
display: flex;
flex-direction: column;
align-items: center;
width: 140rpx;
}
.project-detail__avatar {
display: flex;
align-items: center;
justify-content: center;
width: 96rpx;
height: 96rpx;
font-size: 28rpx;
color: #ffffff;
background: $color-primary;
border-radius: 50%;
}
.project-detail__member-name {
margin-top: 12rpx;
font-size: 26rpx;
color: $color-text-primary;
}
.project-detail__member-role {
margin-top: 6rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-detail__files {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
padding: 10rpx 10rpx 0 0;
}
.project-detail__file {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 160rpx;
padding: 20rpx 16rpx;
background: $color-bg-section;
border-radius: 12rpx;
}
.project-detail__file-remove {
position: absolute;
top: -10rpx;
right: -10rpx;
width: 32rpx;
height: 32rpx;
}
.project-detail__file-remove-icon {
width: 32rpx;
height: 32rpx;
}
.project-detail__file-icon {
width: 64rpx;
height: 64rpx;
}
.project-detail__file-name {
margin-top: 12rpx;
font-size: 22rpx;
color: $color-text-primary;
text-align: center;
word-break: break-all;
}
.project-detail__panel--section {
margin-top: 24rpx;
}
.project-detail__finance,
.project-detail__aftersales {
margin-top: 24rpx;
}
.project-detail__payment-card {
padding: 28rpx 24rpx;
margin-bottom: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
}
.project-detail__payment-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.project-detail__payment-title {
flex: 1;
padding-right: 16rpx;
font-size: 28rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__payment-tag {
flex-shrink: 0;
padding: 4rpx 12rpx;
font-size: 20rpx;
border-radius: 6rpx;
&--paid,
&--pending {
color: #ffffff;
background: $color-primary;
}
&--not_due {
color: $color-primary;
background: $color-primary-light;
}
}
.project-detail__payment-body {
display: flex;
align-items: flex-end;
justify-content: space-between;
margin-top: 20rpx;
}
.project-detail__payment-meta {
flex: 1;
min-width: 0;
padding-right: 16rpx;
}
.project-detail__payment-row {
display: block;
font-size: 22rpx;
line-height: 1.6;
color: #666666;
}
.project-detail__payment-amount {
flex-shrink: 0;
font-size: 36rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__payment-btn {
display: flex;
align-items: center;
justify-content: center;
height: 80rpx;
margin-top: 24rpx;
font-size: 28rpx;
color: #ffffff;
background: $color-primary;
border-radius: 12rpx;
}
.project-detail__aftersales-banner {
display: flex;
align-items: center;
padding: 24rpx;
margin-bottom: 24rpx;
background: #FF7D29;
border-radius: 20rpx;
}
.project-detail__aftersales-banner-icon {
display: flex;
align-items: center;
justify-content: center;
width: 72rpx;
height: 72rpx;
margin-right: 20rpx;
border-radius: 50%;
}
.project-detail__aftersales-banner-icon-img {
width: 59.16rpx;
height: 59.16rpx;
}
.project-detail__aftersales-banner-text {
flex: 1;
min-width: 0;
}
.project-detail__aftersales-banner-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: #ffffff;
}
.project-detail__aftersales-banner-desc {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
line-height: 1.5;
color: rgba(255, 255, 255, 0.92);
}
.project-detail__info-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-top: 24rpx;
}
.project-detail__info-label {
flex-shrink: 0;
font-size: 26rpx;
color: #333333;
font-weight: 500;
}
.project-detail__info-value {
flex: 1;
margin-left: 24rpx;
font-size: 26rpx;
color: #999999;
text-align: right;
}
.project-detail__files--with-add {
align-items: flex-start;
}
.project-detail__file-add {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 160rpx;
height: 160rpx;
background: $color-bg-section;
border: 1rpx dashed #d8dde6;
border-radius: 12rpx;
}
.project-detail__file-add-icon {
font-size: 40rpx;
line-height: 1;
color: $color-text-secondary;
}
.project-detail__file-add-text {
margin-top: 8rpx;
font-size: 20rpx;
color: $color-text-secondary;
}
.project-detail__aftersales-actions {
margin-top: 32rpx;
}
.project-detail__btn {
display: flex;
align-items: center;
justify-content: center;
height: 88rpx;
font-size: 30rpx;
border-radius: 12rpx;
&--primary {
color: #ffffff;
background: $color-primary;
}
&--outline {
margin-top: 20rpx;
color: $color-text-primary;
background: $color-bg-page;
border: 1rpx solid #e8eaef;
}
}

View File

@@ -1,7 +1,9 @@
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getProjectDetail } from '@/constants/project-detail'
import { getProjectDetail, PAYMENT_PLAN_STATUS_LABEL } from '@/constants/project-detail'
import type { PaymentPlanStatus } from '@/types/project-detail'
import afterSalesIcon from '@/static/icons/售后.png'
import cardBg from '@/static/icons/new-card.png'
import deleteIcon from '@/static/icons/X.png'
import type { ProjectDetail, ProjectDetailTab } from '@/types/project-detail'
@@ -20,8 +22,12 @@ const tabs: Array<{ key: ProjectDetailTab, label: string }> = [
onLoad((options) => {
const rawId = options?.id
const id = rawId ? decodeURIComponent(String(rawId)) : '1'
const tab = options?.tab ? decodeURIComponent(String(options.tab)) : ''
detail.value = getProjectDetail(id)
if (tab === 'aftersales' || tab === 'progress' || tab === 'files' || tab === 'finance')
activeTab.value = tab
if (!detail.value) {
uni.showToast({ title: '项目不存在', icon: 'none' })
setTimeout(() => uni.navigateBack(), 1500)
@@ -35,6 +41,40 @@ function handleBack() {
function handleSelectTab(key: ProjectDetailTab) {
activeTab.value = key
}
function paymentStatusClass(status: PaymentPlanStatus) {
return `project-detail__payment-tag--${status}`
}
function formatAmount(amount: number) {
return `¥ ${amount}`
}
function handlePayNow(planId: string) {
if (!detail.value)
return
uni.navigateTo({
url: `/pages/project-center/payment/index?projectId=${encodeURIComponent(detail.value.id)}&planId=${encodeURIComponent(planId)}`,
})
}
function handleApplyAfterSales() {
if (!detail.value)
return
uni.navigateTo({
url: `/pages/project-center/after-sales-apply/index?id=${encodeURIComponent(detail.value.id)}`,
})
}
function handleCancelAfterSales() {
uni.showToast({ title: '取消售后功能开发中', icon: 'none' })
}
function handleAddAfterSalesAttachment() {
uni.showToast({ title: '添加附件功能开发中', icon: 'none' })
}
</script>
<template>
@@ -97,23 +137,17 @@ function handleSelectTab(key: ProjectDetailTab) {
</view>
</view>
<scroll-view
class="project-detail__tabs"
scroll-x
:show-scrollbar="false"
>
<view class="project-detail__tabs-inner">
<text
v-for="tab in tabs"
:key="tab.key"
class="project-detail__tab"
:class="{ 'project-detail__tab--active': activeTab === tab.key }"
@tap="handleSelectTab(tab.key)"
>
{{ tab.label }}
</text>
<view class="project-detail__tabs">
<view
v-for="tab in tabs"
:key="tab.key"
class="project-detail__tab"
:class="{ 'project-detail__tab--active': activeTab === tab.key }"
@tap="handleSelectTab(tab.key)"
>
{{ tab.label }}
</view>
</scroll-view>
</view>
<view
v-if="activeTab === 'progress'"
@@ -268,20 +302,209 @@ function handleSelectTab(key: ProjectDetailTab) {
<view
v-else-if="activeTab === 'finance'"
class="project-detail__panel"
class="project-detail__finance"
>
<text class="project-detail__paragraph">
{{ detail.financeSummary }}
</text>
<view
v-for="plan in detail.paymentPlans"
:key="plan.id"
class="project-detail__payment-card"
>
<view class="project-detail__payment-header">
<text class="project-detail__payment-title">
{{ plan.title }} {{ plan.ratio }}
</text>
<text
class="project-detail__payment-tag"
:class="paymentStatusClass(plan.status)"
>
{{ PAYMENT_PLAN_STATUS_LABEL[plan.status] }}
</text>
</view>
<view class="project-detail__payment-body">
<view class="project-detail__payment-meta">
<text class="project-detail__payment-row">
交易流水号:{{ plan.transactionNo }}
</text>
<text class="project-detail__payment-row">
账单号:{{ plan.billNo }}
</text>
<text class="project-detail__payment-row">
关联项目:{{ plan.relatedProject }}
</text>
</view>
<text class="project-detail__payment-amount">
{{ formatAmount(plan.amount) }}
</text>
</view>
<view
v-if="plan.status === 'pending'"
class="project-detail__payment-btn"
@tap="handlePayNow(plan.id)"
>
立即支付
</view>
</view>
<view class="project-detail__panel project-detail__panel--section">
<text class="project-detail__panel-title">
付款计划
</text>
<view class="project-detail__files">
<view
v-for="file in detail.paymentPlanFiles"
:key="file.id"
class="project-detail__file"
>
<view class="project-detail__file-remove">
<image
class="project-detail__file-remove-icon"
:src="deleteIcon"
mode="aspectFit"
/>
</view>
<image
class="project-detail__file-icon"
:src="file.icon"
mode="aspectFit"
/>
<text class="project-detail__file-name">
{{ file.name }}
</text>
</view>
</view>
</view>
<view class="project-detail__panel project-detail__panel--section">
<text class="project-detail__panel-title">
合同文件
</text>
<view class="project-detail__files">
<view
v-for="file in detail.contractFiles"
:key="file.id"
class="project-detail__file"
>
<view class="project-detail__file-remove">
<image
class="project-detail__file-remove-icon"
:src="deleteIcon"
mode="aspectFit"
/>
</view>
<image
class="project-detail__file-icon"
:src="file.icon"
mode="aspectFit"
/>
<text class="project-detail__file-name">
{{ file.name }}
</text>
</view>
</view>
</view>
</view>
<view
v-else
class="project-detail__panel"
class="project-detail__aftersales"
>
<text class="project-detail__paragraph">
{{ detail.afterSalesSummary }}
</text>
<view
v-if="detail.afterSales.processing"
class="project-detail__aftersales-banner"
>
<view class="project-detail__aftersales-banner-icon">
<image
class="project-detail__aftersales-banner-icon-img"
:src="afterSalesIcon"
mode="aspectFit"
/>
</view>
<view class="project-detail__aftersales-banner-text">
<text class="project-detail__aftersales-banner-title">
{{ detail.afterSales.bannerTitle }}
</text>
<text class="project-detail__aftersales-banner-desc">
{{ detail.afterSales.bannerDesc }}
</text>
</view>
</view>
<view class="project-detail__panel">
<text class="project-detail__panel-title">
售后信息
</text>
<view class="project-detail__info-row">
<text class="project-detail__info-label">
售后类型
</text>
<text class="project-detail__info-value">
{{ detail.afterSales.type }}
</text>
</view>
<view class="project-detail__info-row">
<text class="project-detail__info-label">
问题描述
</text>
<text class="project-detail__info-value">
{{ detail.afterSales.description }}
</text>
</view>
</view>
<view class="project-detail__panel project-detail__panel--section">
<text class="project-detail__panel-title">
附件
</text>
<view class="project-detail__files project-detail__files--with-add">
<view
v-for="file in detail.afterSales.attachments"
:key="file.id"
class="project-detail__file"
>
<view class="project-detail__file-remove">
<image
class="project-detail__file-remove-icon"
:src="deleteIcon"
mode="aspectFit"
/>
</view>
<image
class="project-detail__file-icon"
:src="file.icon"
mode="aspectFit"
/>
<text class="project-detail__file-name">
{{ file.name }}
</text>
</view>
<view
class="project-detail__file-add"
@tap="handleAddAfterSalesAttachment"
>
<text class="project-detail__file-add-icon">
+
</text>
<text class="project-detail__file-add-text">
添加附件
</text>
</view>
</view>
</view>
<view class="project-detail__aftersales-actions">
<view
class="project-detail__btn project-detail__btn--primary"
@tap="handleApplyAfterSales"
>
申请售后
</view>
<view
class="project-detail__btn project-detail__btn--outline"
@tap="handleCancelAfterSales"
>
取消售后
</view>
</view>
</view>
</view>
</scroll-view>
@@ -289,415 +512,5 @@ function handleSelectTab(key: ProjectDetailTab) {
</template>
<style scoped lang="scss">
@import '@/styles/variables.scss';
.project-detail {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.project-detail__navbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
background: $color-bg-page;
}
.project-detail__back {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
}
.project-detail__back-icon {
width: 40rpx;
height: 40rpx;
}
.project-detail__navbar-title {
font-size: 34rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__navbar-placeholder {
width: 64rpx;
height: 64rpx;
}
.project-detail__scroll {
flex: 1;
height: 0;
}
.project-detail__content {
padding: 24rpx 24rpx calc(32rpx + env(safe-area-inset-bottom));
}
.project-detail__hero {
position: relative;
overflow: hidden;
border-radius: 20rpx;
}
.project-detail__hero-bg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
width: 100%;
height: 100%;
}
.project-detail__hero-inner {
position: relative;
z-index: 1;
padding: 28rpx 24rpx;
}
.project-detail__hero-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.project-detail__tag {
padding: 4rpx 12rpx;
font-size: 20rpx;
color: $color-primary;
background: $color-primary-light;
border-radius: 6rpx;
}
.project-detail__hero-status {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.project-detail__status {
font-size: 24rpx;
color: $color-text-secondary;
}
.project-detail__progress-text {
margin-top: 4rpx;
font-size: 24rpx;
color: $color-text-secondary;
}
.project-detail__title {
display: block;
margin-top: 20rpx;
font-size: 32rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__no {
display: block;
margin-top: 16rpx;
font-size: 22rpx;
color: #666666;
}
.project-detail__tabs {
margin-top: 24rpx;
white-space: nowrap;
}
.project-detail__tabs-inner {
display: inline-flex;
gap: 32rpx;
padding: 0 4rpx;
}
.project-detail__tab {
flex-shrink: 0;
padding-bottom: 12rpx;
font-size: 28rpx;
color: $color-text-secondary;
&--active {
font-weight: 600;
color: $color-text-primary;
border-bottom: 4rpx solid $color-primary;
}
}
.project-detail__panel {
margin-top: 24rpx;
padding: 28rpx 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
}
.project-detail__panel-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-detail__dev-progress {
padding-bottom: 8rpx;
}
.project-detail__overall {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 24rpx;
}
.project-detail__overall-label {
font-size: 26rpx;
color: $color-text-secondary;
}
.project-detail__overall-value {
font-size: 28rpx;
font-weight: 600;
color: $color-primary;
}
.project-detail__slider {
margin-top: 20rpx;
}
.project-detail__slider-track {
position: relative;
height: 8rpx;
background: #e8eaef;
border-radius: 4rpx;
}
.project-detail__slider-fill {
position: absolute;
top: 0;
left: 0;
height: 100%;
background: $color-primary;
border-radius: 4rpx;
}
.project-detail__slider-thumb {
position: absolute;
top: 50%;
width: 24rpx;
height: 24rpx;
margin-left: -12rpx;
background: $color-bg-page;
border: 4rpx solid $color-primary;
border-radius: 50%;
transform: translateY(-50%);
}
.project-detail__dates {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-detail__timeline {
margin-top: 32rpx;
padding-top: 8rpx;
}
.project-detail__timeline-heading {
display: block;
margin-bottom: 24rpx;
}
.project-detail__timeline-item {
display: flex;
min-height: 96rpx;
}
.project-detail__timeline-left {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 48rpx;
margin-right: 20rpx;
}
.project-detail__timeline-dot {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
&--done {
background: $color-primary;
}
&--active {
background: $color-primary;
}
&--pending {
background: $color-bg-page;
border: 2rpx solid #d8dde6;
}
}
.project-detail__timeline-check {
font-size: 22rpx;
color: #ffffff;
}
.project-detail__timeline-index {
font-size: 22rpx;
color: #ffffff;
.project-detail__timeline-dot--pending & {
color: $color-text-secondary;
}
}
.project-detail__timeline-line {
flex: 1;
width: 2rpx;
min-height: 40rpx;
margin-top: 8rpx;
background: #e8eaef;
&--done {
background: $color-primary;
}
}
.project-detail__timeline-body {
flex: 1;
padding-bottom: 28rpx;
}
.project-detail__timeline-title {
display: block;
font-size: 28rpx;
color: $color-text-primary;
}
.project-detail__timeline-time,
.project-detail__timeline-status {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-detail__timeline-status--active {
color: $color-primary;
}
.project-detail__team {
margin-top: 32rpx;
padding-top: 28rpx;
border-top: 1rpx solid #f0f0f0;
}
.project-detail__team-scroll {
margin-top: 24rpx;
white-space: nowrap;
}
.project-detail__team-inner {
display: inline-flex;
gap: 32rpx;
}
.project-detail__member {
display: flex;
flex-direction: column;
align-items: center;
width: 140rpx;
}
.project-detail__avatar {
display: flex;
align-items: center;
justify-content: center;
width: 96rpx;
height: 96rpx;
font-size: 28rpx;
color: #ffffff;
background: $color-primary;
border-radius: 50%;
}
.project-detail__member-name {
margin-top: 12rpx;
font-size: 26rpx;
color: $color-text-primary;
}
.project-detail__member-role {
margin-top: 6rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-detail__files {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
padding: 10rpx 10rpx 0 0;
}
.project-detail__file {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 160rpx;
padding: 20rpx 16rpx;
background: $color-bg-section;
border-radius: 12rpx;
}
.project-detail__file-remove {
position: absolute;
top: -10rpx;
right: -10rpx;
width: 32rpx;
height: 32rpx;
}
.project-detail__file-remove-icon {
width: 32rpx;
height: 32rpx;
}
.project-detail__file-icon {
width: 64rpx;
height: 64rpx;
}
.project-detail__file-name {
margin-top: 12rpx;
font-size: 22rpx;
color: $color-text-primary;
text-align: center;
word-break: break-all;
}
.project-detail__paragraph {
display: block;
font-size: 28rpx;
line-height: 1.8;
color: $color-text-primary;
}
@import './index.scss';
</style>

View File

@@ -0,0 +1,111 @@
@import '@/styles/variables.scss';
.project-center {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
background: $color-bg-section;
}
.project-center__header {
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 60rpx) 24rpx 0;
background: $color-bg-page;
}
.project-center__title {
display: block;
font-size: 36rpx;
font-weight: 600;
color: $color-text-primary;
text-align: center;
}
.project-center__search {
display: flex;
align-items: center;
height: 72rpx;
margin-top: 24rpx;
padding: 0 24rpx;
background: $color-bg-section;
border-radius: 36rpx;
}
.project-center__search-icon {
flex-shrink: 0;
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
}
.project-center__search-input {
flex: 1;
font-size: 26rpx;
color: $color-text-primary;
}
.project-center__search-placeholder {
color: $color-text-placeholder;
}
.project-center__tabs {
margin-top: 24rpx;
white-space: nowrap;
}
.project-center__tabs-inner {
display: inline-flex;
gap: 32rpx;
padding-right: 24rpx;
}
.project-center__tab {
flex-shrink: 0;
padding-bottom: 12rpx;
font-size: 28rpx;
color: $color-text-secondary;
&--active {
font-weight: 600;
color: $color-text-primary;
border-bottom: 4rpx solid $color-primary;
}
}
.project-center__toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0 24rpx;
}
.project-center__count {
font-size: 24rpx;
color: $color-text-secondary;
}
.project-center__filter {
display: flex;
align-items: center;
}
.project-center__filter-icon {
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.project-center__filter-text {
font-size: 26rpx;
color: #666666;
}
.project-center__scroll {
flex: 1;
min-height: 0;
}
.project-center__list {
padding: 0 24rpx calc(140rpx + env(safe-area-inset-bottom));
}

View File

@@ -145,115 +145,5 @@ function handleViewDetail(id: string) {
</template>
<style scoped lang="scss">
@import '@/styles/variables.scss';
.project-center {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
background: $color-bg-section;
}
.project-center__header {
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 60rpx) 24rpx 0;
background: $color-bg-page;
}
.project-center__title {
display: block;
font-size: 36rpx;
font-weight: 600;
color: $color-text-primary;
text-align: center;
}
.project-center__search {
display: flex;
align-items: center;
height: 72rpx;
margin-top: 24rpx;
padding: 0 24rpx;
background: $color-bg-section;
border-radius: 36rpx;
}
.project-center__search-icon {
flex-shrink: 0;
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
}
.project-center__search-input {
flex: 1;
font-size: 26rpx;
color: $color-text-primary;
}
.project-center__search-placeholder {
color: $color-text-placeholder;
}
.project-center__tabs {
margin-top: 24rpx;
white-space: nowrap;
}
.project-center__tabs-inner {
display: inline-flex;
gap: 32rpx;
padding-right: 24rpx;
}
.project-center__tab {
flex-shrink: 0;
padding-bottom: 12rpx;
font-size: 28rpx;
color: $color-text-secondary;
&--active {
font-weight: 600;
color: $color-text-primary;
border-bottom: 4rpx solid $color-primary;
}
}
.project-center__toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0 24rpx;
}
.project-center__count {
font-size: 24rpx;
color: $color-text-secondary;
}
.project-center__filter {
display: flex;
align-items: center;
}
.project-center__filter-icon {
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.project-center__filter-text {
font-size: 26rpx;
color: #666666;
}
.project-center__scroll {
flex: 1;
min-height: 0;
}
.project-center__list {
padding: 0 24rpx calc(140rpx + env(safe-area-inset-bottom));
}
@import './index.scss';
</style>

View File

@@ -0,0 +1,136 @@
@import '@/styles/variables.scss';
.payment-success {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.payment-success__scroll {
flex: 1;
height: 0;
}
.payment-success__content {
padding: calc(var(--status-bar-height, 44px) + 48rpx) 24rpx calc(140rpx + env(safe-area-inset-bottom));
}
.payment-success__hero {
display: flex;
flex-direction: column;
align-items: center;
padding: 24rpx 0 40rpx;
}
.payment-success__icon {
width: 209.92rpx;
height: 209.92rpx;
}
.payment-success__title {
margin-top: 28rpx;
font-size: 36rpx;
font-weight: 600;
color: $color-text-primary;
}
.payment-success__subtitle {
margin-top: 16rpx;
font-size: 26rpx;
color: $color-text-secondary;
}
.payment-success__card {
padding: 28rpx 24rpx;
margin-bottom: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
&:last-child {
margin-bottom: 0;
}
}
.payment-success__card-title {
display: block;
margin-bottom: 24rpx;
font-size: 30rpx;
font-weight: 600;
color: $color-text-primary;
}
.payment-success__info-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-top: 20rpx;
&:first-of-type {
margin-top: 0;
}
}
.payment-success__info-label {
flex-shrink: 0;
font-size: 26rpx;
color: $color-text-secondary;
}
.payment-success__info-value {
flex: 1;
margin-left: 24rpx;
font-size: 26rpx;
color: $color-text-primary;
text-align: right;
word-break: break-all;
}
.payment-success__order-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.payment-success__order-title {
flex: 1;
padding-right: 16rpx;
font-size: 28rpx;
font-weight: 600;
color: $color-text-primary;
}
.payment-success__order-amount {
flex-shrink: 0;
font-size: 28rpx;
font-weight: 600;
color: $color-text-primary;
}
.payment-success__order-meta {
display: block;
margin-top: 12rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.payment-success__footer {
display: flex;
gap: 20rpx;
flex-shrink: 0;
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
background: $color-bg-page;
border-top: 1rpx solid #f0f0f0;
}
.payment-success__btn {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
height: 88rpx;
font-size: 28rpx;
color: #ffffff;
background: $color-primary;
border-radius: 12rpx;
}

View File

@@ -0,0 +1,147 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getPaymentPlan } from '@/constants/project-detail'
import successIcon from '@/static/icons/icon-register-success.png'
import type { PaymentPlanItem } from '@/types/project-detail'
type PaymentMethod = 'wechat' | 'alipay'
const plan = ref<PaymentPlanItem | null>(null)
const projectId = ref('1')
const planId = ref('2')
const paymentMethod = ref<PaymentMethod>('wechat')
const paymentTime = ref('2026-01-21 15:00:00')
const transactionNo = ref('T20260819153035678K2M001')
const paymentMethodLabel = computed(() =>
paymentMethod.value === 'wechat' ? '微信支付' : '支付宝',
)
onLoad((options) => {
projectId.value = options?.projectId ? decodeURIComponent(String(options.projectId)) : '1'
planId.value = options?.planId ? decodeURIComponent(String(options.planId)) : '2'
const method = options?.method ? decodeURIComponent(String(options.method)) : 'wechat'
paymentMethod.value = method === 'alipay' ? 'alipay' : 'wechat'
plan.value = getPaymentPlan(projectId.value, planId.value)
if (!plan.value) {
uni.showToast({ title: '订单不存在', icon: 'none' })
setTimeout(() => {
uni.redirectTo({ url: '/pages/project-center/index' })
}, 1500)
}
})
function formatAmount(amount: number) {
return `¥ ${amount}`
}
function handleBackToList() {
uni.redirectTo({ url: '/pages/project-center/bill-list/index' })
}
function handleViewDetail() {
uni.redirectTo({
url: `/pages/project-center/bill-detail/index?projectId=${encodeURIComponent(projectId.value)}&planId=${encodeURIComponent(planId.value)}&method=${encodeURIComponent(paymentMethod.value)}`,
})
}
</script>
<template>
<view
v-if="plan"
class="payment-success"
>
<scroll-view
class="payment-success__scroll"
scroll-y
:show-scrollbar="false"
>
<view class="payment-success__content">
<view class="payment-success__hero">
<image
class="payment-success__icon"
:src="successIcon"
mode="aspectFit"
/>
<text class="payment-success__title">
支付成功
</text>
<text class="payment-success__subtitle">
共1个订单,付款金额:{{ formatAmount(plan.amount) }}
</text>
</view>
<view class="payment-success__card">
<text class="payment-success__card-title">
支付信息
</text>
<view class="payment-success__info-row">
<text class="payment-success__info-label">
支付方式
</text>
<text class="payment-success__info-value">
{{ paymentMethodLabel }}
</text>
</view>
<view class="payment-success__info-row">
<text class="payment-success__info-label">
支付时间
</text>
<text class="payment-success__info-value">
{{ paymentTime }}
</text>
</view>
<view class="payment-success__info-row">
<text class="payment-success__info-label">
交易流水号
</text>
<text class="payment-success__info-value">
{{ transactionNo }}
</text>
</view>
</view>
<view class="payment-success__card">
<text class="payment-success__card-title">
已支付订单
</text>
<view class="payment-success__order-row">
<text class="payment-success__order-title">
{{ plan.title }} {{ plan.ratio }}
</text>
<text class="payment-success__order-amount">
{{ formatAmount(plan.amount) }}
</text>
</view>
<text class="payment-success__order-meta">
账单号:{{ plan.billNo }}
</text>
<text class="payment-success__order-meta">
关联项目:{{ plan.relatedProject }}
</text>
</view>
</view>
</scroll-view>
<view class="payment-success__footer">
<view
class="payment-success__btn"
@tap="handleBackToList"
>
返回订单列表
</view>
<view
class="payment-success__btn"
@tap="handleViewDetail"
>
查看订单详情
</view>
</view>
</view>
</template>
<style scoped lang="scss">
@import './index.scss';
</style>

View File

@@ -0,0 +1,191 @@
@import '@/styles/variables.scss';
.project-payment {
display: flex;
flex-direction: column;
min-height: 100vh;
background: $color-bg-section;
}
.project-payment__navbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
background: $color-bg-page;
}
.project-payment__back {
display: flex;
align-items: center;
justify-content: center;
width: 64rpx;
height: 64rpx;
}
.project-payment__back-icon {
width: 40rpx;
height: 40rpx;
}
.project-payment__navbar-title {
font-size: 34rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-payment__navbar-placeholder {
width: 64rpx;
height: 64rpx;
}
.project-payment__scroll {
flex: 1;
height: 0;
}
.project-payment__content {
padding: 24rpx 24rpx calc(140rpx + env(safe-area-inset-bottom));
}
.project-payment__card {
margin-bottom: 24rpx;
background: $color-bg-page;
border-radius: 20rpx;
&:last-child {
margin-bottom: 0;
}
}
.project-payment__card-inner {
padding: 28rpx 24rpx;
}
.project-payment__card-title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $color-text-primary;
}
.project-payment__order-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-top: 24rpx;
}
.project-payment__order-title {
flex: 1;
padding-right: 16rpx;
font-size: 28rpx;
color: $color-text-primary;
}
.project-payment__order-amount {
flex-shrink: 0;
font-size: 28rpx;
color: $color-text-primary;
}
.project-payment__order-meta {
display: block;
margin-top: 12rpx;
font-size: 22rpx;
color: $color-text-secondary;
}
.project-payment__order-divider {
height: 1rpx;
margin-top: 24rpx;
background: #f0f0f0;
}
.project-payment__order-summary {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 24rpx;
}
.project-payment__order-summary-label {
font-size: 26rpx;
color: $color-text-primary;
}
.project-payment__order-summary-amount {
font-size: 32rpx;
font-weight: 600;
color: #ff4d4f;
}
.project-payment__method {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 0;
&:first-of-type {
margin-top: 8rpx;
}
& + & {
border-top: 1rpx solid #f0f0f0;
}
}
.project-payment__method-left {
display: flex;
align-items: center;
}
.project-payment__method-icon {
width: 48rpx;
height: 48rpx;
}
.project-payment__method-label {
margin-left: 16rpx;
font-size: 28rpx;
color: $color-text-primary;
}
.project-payment__radio {
display: flex;
align-items: center;
justify-content: center;
width: 36rpx;
height: 36rpx;
border: 2rpx solid #d8dde6;
border-radius: 50%;
&--active {
background: $color-primary;
border-color: $color-primary;
}
}
.project-payment__radio-check {
font-size: 20rpx;
color: #ffffff;
}
.project-payment__footer {
flex-shrink: 0;
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
background: $color-bg-page;
border-top: 1rpx solid #f0f0f0;
}
.project-payment__confirm-btn {
display: flex;
align-items: center;
justify-content: center;
height: 88rpx;
font-size: 30rpx;
color: #ffffff;
background: $color-primary;
border-radius: 12rpx;
}

View File

@@ -0,0 +1,164 @@
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getPaymentPlan } from '@/constants/project-detail'
import alipayIcon from '@/static/icons/支付宝.png'
import wechatIcon from '@/static/icons/微信.png'
import type { PaymentPlanItem } from '@/types/project-detail'
import { navigateBackWithFallback } from '@/utils/navigate-back'
type PaymentMethod = 'wechat' | 'alipay'
const plan = ref<PaymentPlanItem | null>(null)
const projectId = ref('1')
const planId = ref('2')
const paymentMethod = ref<PaymentMethod>('wechat')
const fallbackUrl = ref('/pages/project-center/index')
const paymentMethods: Array<{ key: PaymentMethod, label: string, icon: string }> = [
{ key: 'wechat', label: '微信支付', icon: wechatIcon },
{ key: 'alipay', label: '支付宝', icon: alipayIcon },
]
onLoad((options) => {
projectId.value = options?.projectId ? decodeURIComponent(String(options.projectId)) : '1'
planId.value = options?.planId ? decodeURIComponent(String(options.planId)) : '2'
fallbackUrl.value = `/pages/project-center/detail/index?id=${encodeURIComponent(projectId.value)}`
plan.value = getPaymentPlan(projectId.value, planId.value)
if (!plan.value) {
uni.showToast({ title: '订单不存在', icon: 'none' })
setTimeout(() => uni.navigateBack(), 1500)
}
})
function handleBack() {
navigateBackWithFallback(fallbackUrl.value)
}
function handleSelectMethod(method: PaymentMethod) {
paymentMethod.value = method
}
function formatAmount(amount: number) {
return `¥ ${amount}`
}
function handleConfirmPay() {
uni.redirectTo({
url: `/pages/project-center/payment-success/index?projectId=${encodeURIComponent(projectId.value)}&planId=${encodeURIComponent(planId.value)}&method=${encodeURIComponent(paymentMethod.value)}`,
})
}
</script>
<template>
<view
v-if="plan"
class="project-payment"
>
<view class="project-payment__navbar">
<view
class="project-payment__back"
@tap="handleBack"
>
<image
class="project-payment__back-icon"
src="/static/icons/icon-back.svg"
mode="aspectFit"
/>
</view>
<text class="project-payment__navbar-title">
确认支付
</text>
<view class="project-payment__navbar-placeholder" />
</view>
<scroll-view
class="project-payment__scroll"
scroll-y
:show-scrollbar="false"
>
<view class="project-payment__content">
<view class="project-payment__card">
<view class="project-payment__card-inner">
<text class="project-payment__card-title">
订单明细
</text>
<view class="project-payment__order-row">
<text class="project-payment__order-title">
{{ plan.title }} {{ plan.ratio }}
</text>
<text class="project-payment__order-amount">
{{ formatAmount(plan.amount) }}
</text>
</view>
<text class="project-payment__order-meta">
账单号:{{ plan.billNo }}
</text>
<text class="project-payment__order-meta">
关联项目:{{ plan.relatedProject }}
</text>
<view class="project-payment__order-divider" />
<view class="project-payment__order-summary">
<text class="project-payment__order-summary-label">
已选 1笔订单,合计
</text>
<text class="project-payment__order-summary-amount">
{{ formatAmount(plan.amount) }}
</text>
</view>
</view>
</view>
<view class="project-payment__card">
<view class="project-payment__card-inner">
<text class="project-payment__card-title">
选择支付方式
</text>
<view
v-for="method in paymentMethods"
:key="method.key"
class="project-payment__method"
@tap="handleSelectMethod(method.key)"
>
<view class="project-payment__method-left">
<image
class="project-payment__method-icon"
:src="method.icon"
mode="aspectFit"
/>
<text class="project-payment__method-label">
{{ method.label }}
</text>
</view>
<view
class="project-payment__radio"
:class="{ 'project-payment__radio--active': paymentMethod === method.key }"
>
<text
v-if="paymentMethod === method.key"
class="project-payment__radio-check"
>
✓
</text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="project-payment__footer">
<view
class="project-payment__confirm-btn"
@tap="handleConfirmPay"
>
确认支付
</view>
</view>
</view>
</template>
<style scoped lang="scss">
@import './index.scss';
</style>