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>