feat:部分项目中心
This commit is contained in:
191
src/pages/project-center/payment/index.scss
Normal file
191
src/pages/project-center/payment/index.scss
Normal 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;
|
||||
}
|
||||
164
src/pages/project-center/payment/index.vue
Normal file
164
src/pages/project-center/payment/index.vue
Normal 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>
|
||||
Reference in New Issue
Block a user