我的车位,我的车辆
This commit is contained in:
@@ -5,6 +5,10 @@ import request, {
|
|||||||
putMethod
|
putMethod
|
||||||
} from "./request.js"
|
} from "./request.js"
|
||||||
|
|
||||||
|
// 字典
|
||||||
|
export const getSystemDictData = (data) => {
|
||||||
|
return get('/system/dict/data/list', data)
|
||||||
|
}
|
||||||
|
|
||||||
// =======公告列表========
|
// =======公告列表========
|
||||||
export const getResidentNoticeList = (data) => {
|
export const getResidentNoticeList = (data) => {
|
||||||
@@ -88,3 +92,61 @@ export const upDateMyHouse = (data) => {
|
|||||||
export const uploadFileUploadImage = (data) => {
|
export const uploadFileUploadImage = (data) => {
|
||||||
return post(`/api/resident/file/uploadImage`, data)
|
return post(`/api/resident/file/uploadImage`, data)
|
||||||
}
|
}
|
||||||
|
// 添加车辆
|
||||||
|
export const postCar = (data) => {
|
||||||
|
return post(`/api/resident/car`, data)
|
||||||
|
}
|
||||||
|
// 修改车辆
|
||||||
|
export const putCar = (data) => {
|
||||||
|
return putMethod(`/api/resident/car`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取车辆列表
|
||||||
|
export const getMyCarList = (data) => {
|
||||||
|
return get(`/api/resident/car/myList`, data)
|
||||||
|
}
|
||||||
|
// 获取车位列表
|
||||||
|
export const getCarList = (data) => {
|
||||||
|
return get(`/api/resident/car/list`, data)
|
||||||
|
}
|
||||||
|
// 获取车辆详细信息
|
||||||
|
export const getCarDetail = (data) => {
|
||||||
|
return get(`/api/resident/car/${data.id}`, data)
|
||||||
|
}
|
||||||
|
// 删除车辆信息
|
||||||
|
export const deleteCar = (data) => {
|
||||||
|
return deleteMethod(`/api/resident/car/${data.carId}`, data)
|
||||||
|
}
|
||||||
|
// 获取用户车位绑定列表
|
||||||
|
export const getUserParkingSpaceList = (data) => {
|
||||||
|
return get(`/api/resident/car/parking/list`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取区域列表
|
||||||
|
export const getResidentCarAreaManageAreaListByVillageId = (data) => {
|
||||||
|
return get(`/ResidentCarAreaManage/areaListByVillageId`, data)
|
||||||
|
}
|
||||||
|
// 根据区域id获得车位列表
|
||||||
|
export const getResidentCarAreaManageParkingListByAreaId = (data) => {
|
||||||
|
return get(`/ResidentCarAreaManage/parkingListByAreaId`, data)
|
||||||
|
}
|
||||||
|
// 绑定车位
|
||||||
|
export const postCarBind = (data) => {
|
||||||
|
return post(`/api/resident/car/bind`, data)
|
||||||
|
}
|
||||||
|
// 获取用户下车位绑定信息
|
||||||
|
// export const getCarList = (data) => {
|
||||||
|
// return get(`/api/resident/car/list`, data)
|
||||||
|
// }
|
||||||
|
// 删除车位
|
||||||
|
export const deleteParking = (data) => {
|
||||||
|
return deleteMethod(`/ResidentCarAreaManage/parking/${data.parkingId}`, data)
|
||||||
|
}
|
||||||
|
// 车位详情
|
||||||
|
export const getParkingDetail = (data) => {
|
||||||
|
return get(`/api/resident/car/parking/detail/${data.id}`, data)
|
||||||
|
}
|
||||||
|
// 解绑车辆
|
||||||
|
export const rebindCar = (data) => {
|
||||||
|
return post(`/ResidentCarAreaManage/rebind`, data)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// 服务器地址(与 request.js 保持一致)
|
// 服务器地址(与 request.js 保持一致)
|
||||||
const baseUrl = 'http://192.168.0.224:8080';
|
const baseUrl = 'http://192.168.0.239:8080';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片上传 Hook
|
* 图片上传 Hook
|
||||||
@@ -7,7 +7,7 @@ const baseUrl = 'http://192.168.0.224:8080';
|
|||||||
* 解决编辑回显后重新上传的问题
|
* 解决编辑回显后重新上传的问题
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref } from 'vue'
|
import { reactive } from 'vue'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} options 配置
|
* @param {Object} options 配置
|
||||||
@@ -21,14 +21,17 @@ export function useImageUpload(options = {}) {
|
|||||||
fileKey = 'file'
|
fileKey = 'file'
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
// 当前显示的图片(前端展示用,支持 base64/blob URL/网络URL)
|
// 使用 reactive 对象存储所有状态
|
||||||
const previewUrl = ref('')
|
const state = reactive({
|
||||||
// 服务器返回的 URL(提交时使用)
|
// 当前显示的图片(前端展示用,支持 base64/blob URL/网络URL)
|
||||||
const serverUrl = ref('')
|
previewUrl: '',
|
||||||
// 临时的文件路径(重新上传时用)
|
// 服务器返回的 URL(提交时使用)
|
||||||
const tempFilePath = ref(null)
|
serverUrl: '',
|
||||||
// 上传状态
|
// 临时的文件路径(重新上传时用)
|
||||||
const uploading = ref(false)
|
tempFilePath: null,
|
||||||
|
// 上传状态
|
||||||
|
uploading: false
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置回显图片(编辑时从后端获取)
|
* 设置回显图片(编辑时从后端获取)
|
||||||
@@ -36,9 +39,11 @@ export function useImageUpload(options = {}) {
|
|||||||
*/
|
*/
|
||||||
const setPreviewUrl = (url) => {
|
const setPreviewUrl = (url) => {
|
||||||
if (url) {
|
if (url) {
|
||||||
previewUrl.value = url
|
// 确保 url 是字符串
|
||||||
serverUrl.value = url
|
const urlStr = typeof url === 'string' ? url : (url?.url || String(url))
|
||||||
tempFilePath.value = null // 重置临时文件,表示没有重新上传
|
state.previewUrl = urlStr
|
||||||
|
state.serverUrl = urlStr
|
||||||
|
state.tempFilePath = null // 重置临时文件,表示没有重新上传
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,14 +58,20 @@ export function useImageUpload(options = {}) {
|
|||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
sourceType: ['camera', 'album'],
|
sourceType: ['camera', 'album'],
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const path = res.tempFilePaths[0]
|
const path = res.tempFilePaths?.[0]
|
||||||
|
if (!path) {
|
||||||
|
reject(new Error('选择图片失败'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 确保 path 是字符串
|
||||||
|
const pathStr = typeof path === 'string' ? path : String(path)
|
||||||
// 设置预览
|
// 设置预览
|
||||||
previewUrl.value = path
|
state.previewUrl = pathStr
|
||||||
// 记录临时文件路径
|
// 记录临时文件路径
|
||||||
tempFilePath.value = path
|
state.tempFilePath = pathStr
|
||||||
// 置空服务器URL,等实际上传后再获取
|
// 置空服务器URL,等实际上传后再获取
|
||||||
serverUrl.value = ''
|
state.serverUrl = ''
|
||||||
resolve(path)
|
resolve(pathStr)
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
reject(err)
|
reject(err)
|
||||||
@@ -71,25 +82,32 @@ export function useImageUpload(options = {}) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传图片到服务器
|
* 上传图片到服务器
|
||||||
* @returns {Promise<string>} 返回服务器上的URL
|
* @returns {Promise<Object>} 返回 { url: string }
|
||||||
*/
|
*/
|
||||||
const uploadImage = () => {
|
const uploadImage = () => {
|
||||||
// 如果没有新选择临时文件,直接返回已有的服务器URL
|
// 如果没有新选择临时文件,直接返回已有的服务器URL
|
||||||
if (!tempFilePath.value) {
|
if (!state.tempFilePath) {
|
||||||
return Promise.resolve(serverUrl.value)
|
return Promise.resolve({ url: state.serverUrl })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果已经有服务器URL且没有重新选择,也直接返回
|
// 如果已经有服务器URL且没有重新选择,也直接返回
|
||||||
if (serverUrl.value && !tempFilePath.value) {
|
if (state.serverUrl && !state.tempFilePath) {
|
||||||
return Promise.resolve(serverUrl.value)
|
return Promise.resolve({ url: state.serverUrl })
|
||||||
}
|
}
|
||||||
|
|
||||||
uploading.value = true
|
state.uploading = true
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
// 确保 filePath 是字符串
|
||||||
|
const filePath = state.tempFilePath
|
||||||
|
if (!filePath || typeof filePath !== 'string') {
|
||||||
|
state.uploading = false
|
||||||
|
reject(new Error('文件路径无效'))
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: baseUrl + uploadUrl,
|
url: baseUrl + uploadUrl,
|
||||||
filePath: tempFilePath.value,
|
filePath: filePath,
|
||||||
name: fileKey,
|
name: fileKey,
|
||||||
header: {
|
header: {
|
||||||
'Authorization': 'Bearer ' + (uni.getStorageSync('token') || ''),
|
'Authorization': 'Bearer ' + (uni.getStorageSync('token') || ''),
|
||||||
@@ -101,10 +119,10 @@ export function useImageUpload(options = {}) {
|
|||||||
if (data.code === 200 && data.data) {
|
if (data.code === 200 && data.data) {
|
||||||
// 更新服务器URL(确保存的是字符串)
|
// 更新服务器URL(确保存的是字符串)
|
||||||
const url = typeof data.data === 'string' ? data.data : (data.data?.url || '')
|
const url = typeof data.data === 'string' ? data.data : (data.data?.url || '')
|
||||||
serverUrl.value = url
|
state.serverUrl = url
|
||||||
// 清空临时文件
|
// 清空临时文件
|
||||||
tempFilePath.value = null
|
state.tempFilePath = null
|
||||||
resolve(url)
|
resolve({ url })
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: data.msg || '上传失败',
|
title: data.msg || '上传失败',
|
||||||
@@ -128,7 +146,7 @@ export function useImageUpload(options = {}) {
|
|||||||
reject(err)
|
reject(err)
|
||||||
},
|
},
|
||||||
complete: () => {
|
complete: () => {
|
||||||
uploading.value = false
|
state.uploading = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -138,36 +156,35 @@ export function useImageUpload(options = {}) {
|
|||||||
* 获取最终可提交的URL
|
* 获取最终可提交的URL
|
||||||
* 如果有新上传的图片,先上传再返回URL
|
* 如果有新上传的图片,先上传再返回URL
|
||||||
* 如果没有新上传,直接返回已有的服务器URL
|
* 如果没有新上传,直接返回已有的服务器URL
|
||||||
* @returns {Promise<string>}
|
* @returns {Promise<Object>}
|
||||||
*/
|
*/
|
||||||
const getSubmitUrl = async () => {
|
const getSubmitUrl = async () => {
|
||||||
// 如果重新选择了新图片,先上传
|
// 如果重新选择了新图片,先上传
|
||||||
if (tempFilePath.value) {
|
if (state.tempFilePath) {
|
||||||
return await uploadImage()
|
return await uploadImage()
|
||||||
}
|
}
|
||||||
// 否则返回已有的服务器URL
|
// 否则返回已有的服务器URL
|
||||||
return serverUrl.value
|
return { url: state.serverUrl }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置状态
|
* 重置状态
|
||||||
*/
|
*/
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
previewUrl.value = ''
|
state.previewUrl = ''
|
||||||
serverUrl.value = ''
|
state.serverUrl = ''
|
||||||
tempFilePath.value = null
|
state.tempFilePath = null
|
||||||
uploading.value = false
|
state.uploading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 返回 reactive state 和方法
|
||||||
|
// state 作为 reactive 对象,在模板中通过 idCardFrontUpload.state.previewUrl 访问
|
||||||
return {
|
return {
|
||||||
previewUrl, // 前端展示用
|
state,
|
||||||
serverUrl, // 提交时使用的URL
|
setPreviewUrl,
|
||||||
tempFilePath, // 临时文件路径
|
chooseImage,
|
||||||
uploading, // 上传中状态
|
uploadImage,
|
||||||
setPreviewUrl, // 设置回显图片(编辑时用)
|
getSubmitUrl,
|
||||||
chooseImage, // 选择图片(预览用,不上传)
|
reset
|
||||||
uploadImage, // 上传到服务器
|
|
||||||
getSubmitUrl, // 获取最终可提交的URL(自动处理上传)
|
|
||||||
reset // 重置
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,289 +1,318 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar :title="type+'车辆'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent"
|
<uni-nav-bar :title="type + '车辆'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent"
|
||||||
:border="false">
|
:border="false">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
<!-- 表单区域 -->
|
|
||||||
<view class="form-container">
|
<view class="form-container">
|
||||||
<!-- 车牌号 -->
|
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="item-label">车牌号</view>
|
<view class="item-label">车牌号</view>
|
||||||
<input class="item-input" v-model="formData.plateNo" placeholder="请输入"
|
<input class="item-input" v-model="formData.carNum" placeholder="请输入"
|
||||||
placeholder-class="input-placeholder" @blur="inputChange('车牌号')" />
|
placeholder-class="input-placeholder" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="form-item">
|
||||||
<!-- 车辆品牌选择 -->
|
<text class="item-label">车辆品牌</text>
|
||||||
<view class="form-item" @click="selectItem('车辆品牌')">
|
<input class="item-input" v-model="formData.carBrand" placeholder="请输入"
|
||||||
|
placeholder-class="input-placeholder" />
|
||||||
|
</view>
|
||||||
|
<!-- <view class="form-item" @click="selectItem('车辆品牌')">
|
||||||
<text class="item-label">车辆品牌</text>
|
<text class="item-label">车辆品牌</text>
|
||||||
<text class="item-placeholder"
|
<text class="item-placeholder"
|
||||||
:class="{selected:formData.carBrandName}">{{ formData.carBrandName || '请选择' }}</text>
|
:class="{selected: formData.carBrand}">{{ formData.carBrand || '请选择' }}</text>
|
||||||
<text class="item-arrow"></text>
|
<text class="item-arrow"></text>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<!-- 车辆型号 -->
|
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="item-label">车辆型号</view>
|
<view class="item-label">车辆型号</view>
|
||||||
<input class="item-input" v-model="formData.model" placeholder="请输入"
|
<input class="item-input" v-model="formData.carModel" placeholder="请输入"
|
||||||
placeholder-class="input-placeholder" @blur="inputChange('车辆型号')" />
|
placeholder-class="input-placeholder" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 车辆颜色 -->
|
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="item-label">车辆颜色</view>
|
<view class="item-label">车辆颜色</view>
|
||||||
<input class="item-input" v-model="formData.color" placeholder="请输入"
|
<input class="item-input" v-model="formData.carColor" placeholder="请输入"
|
||||||
placeholder-class="input-placeholder" @blur="inputChange('车辆颜色')" />
|
placeholder-class="input-placeholder" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 车辆图片上传 -->
|
|
||||||
<view class="form-item upload-item">
|
<view class="form-item upload-item">
|
||||||
<view class="item-label">车辆图片</view>
|
<view class="item-label">车辆图片</view>
|
||||||
<view class="upload-box" @click="chooseImage">
|
<view class="upload-box" @click="chooseImage">
|
||||||
<!-- 未上传:显示加号+文字 -->
|
<view v-if="!carImageUpload.state.previewUrl" class="upload-tip">
|
||||||
<view v-if="!formData.carImg" class="upload-tip">
|
|
||||||
<text class="plus-icon">+</text>
|
<text class="plus-icon">+</text>
|
||||||
<text class="upload-text">上传照片</text>
|
<text class="upload-text">上传照片</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 已上传:显示图片 -->
|
<image v-else :src="carImageUpload.state.previewUrl" class="car-image" mode="aspectFill" />
|
||||||
<image v-else :src="formData.carImg" class="car-image" mode="aspectFill" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部下一步按钮 -->
|
|
||||||
<view class="bottom-btn-wrap">
|
<view class="bottom-btn-wrap">
|
||||||
<button class="next-btn" @click="saveCar">保存</button>
|
<button class="next-btn" @click="saveCar">保存</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh,
|
||||||
|
onLoad,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
postCar,
|
||||||
|
putCar,
|
||||||
|
getCarDetail,
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
import {
|
||||||
|
useImageUpload
|
||||||
|
} from '/pageSubPack/api/useImageUpload.js'
|
||||||
|
|
||||||
},
|
const statusBarHeight = ref(20)
|
||||||
|
const id = ref(undefined)
|
||||||
|
const type = ref('')
|
||||||
|
const formData = ref({
|
||||||
|
// carNum: uni.getStorageSync('carNum'),
|
||||||
|
// carBrand: uni.getStorageSync('carBrand'),
|
||||||
|
// carModel: uni.getStorageSync('carModel'),
|
||||||
|
// carColor: uni.getStorageSync('carColor'),
|
||||||
|
// carImageUrl: uni.getStorageSync('carImageUrl'),
|
||||||
|
// carBrandId: uni.getStorageSync('carBrandId')
|
||||||
|
carNum: '',
|
||||||
|
carBrand: '',
|
||||||
|
carModel: '',
|
||||||
|
carColor: '',
|
||||||
|
carImageUrl: '',
|
||||||
|
carBrandId: ''
|
||||||
|
})
|
||||||
|
onLoad((option) => {
|
||||||
|
if (uni.getStorageSync('operationType') == 'update') {
|
||||||
|
if (option.id) {
|
||||||
|
id.value = option.id
|
||||||
|
uni.setStorageSync('parkingSpaceId', option.id)
|
||||||
|
loadCarDetail()
|
||||||
|
} else {
|
||||||
|
id.value = uni.getStorageSync('parkingSpaceId')
|
||||||
|
}
|
||||||
|
type.value = '修改'
|
||||||
|
} else if (uni.getStorageSync('operationType') == 'add') {
|
||||||
|
id.value = undefined
|
||||||
|
type.value = '添加'
|
||||||
|
}
|
||||||
|
|
||||||
computed: {
|
})
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
const loadCarDetail = async () => {
|
||||||
|
// 防重复请求
|
||||||
|
try {
|
||||||
|
const res = await getCarDetail({
|
||||||
|
id: id.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = res.data
|
||||||
|
formData.value.carNum = data.carNum
|
||||||
|
// uni.setStorageSync('carNum', data.carNum)
|
||||||
|
formData.value.carBrand = data.carBrand
|
||||||
|
// uni.setStorageSync('carBrand', data.carBrand)
|
||||||
|
formData.value.carModel = data.carModel
|
||||||
|
// uni.setStorageSync('carModel', data.carModel)
|
||||||
|
formData.value.carColor = data.carColor
|
||||||
|
// uni.setStorageSync('carColor', data.carColor)
|
||||||
|
formData.value.carImageUrl = data.carImageUrl
|
||||||
|
// uni.setStorageSync('carImageUrl', data.carImageUrl)
|
||||||
|
formData.value.carBrandId = data.carBrandId
|
||||||
|
// uni.setStorageSync('carBrandId', data.carBrandId)
|
||||||
|
|
||||||
|
// 使用 hook 设置回显图片
|
||||||
|
carImageUpload.setPreviewUrl(data.carImageUrl?.url || data.carImageUrl || '')
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
uni.showToast({
|
||||||
|
title: `${err}`,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
console.error('列表接口报错:', err)
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
const carImageUpload = useImageUpload({
|
||||||
|
uploadUrl: '/api/resident/file/uploadImage'
|
||||||
|
})
|
||||||
|
|
||||||
created() {
|
const inputChange = (typeStr) => {
|
||||||
|
if (typeStr == '车牌号') {
|
||||||
|
uni.setStorageSync('carNum', formData.value.carNum)
|
||||||
|
} else if (typeStr == '车辆型号') {
|
||||||
|
uni.setStorageSync('carModel', formData.value.carModel)
|
||||||
|
} else if (typeStr == '车辆品牌') {
|
||||||
|
uni.setStorageSync('brand', formData.value.brand)
|
||||||
|
} else if (typeStr == '车辆颜色') {
|
||||||
|
uni.setStorageSync('carColor', formData.value.carColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
const chooseImage = async () => {
|
||||||
onShow() {
|
try {
|
||||||
|
await carImageUpload.chooseImage()
|
||||||
|
} catch (err) {
|
||||||
|
// 用户取消选择
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
const saveCar = async () => {
|
||||||
onLoad(option) {
|
if (!formData.value.carNum) {
|
||||||
if (uni.getStorageSync('operationType') == 'update') {
|
return uni.showToast({
|
||||||
this.id = option.id;
|
title: "请输入车牌号",
|
||||||
this.type = '修改';
|
icon: "none"
|
||||||
//根据id获取回显数据
|
})
|
||||||
this.formData.plateNo = '京A88888';
|
}
|
||||||
this.formData.carBrandName = '宝马';
|
if (!formData.value.carBrand) {
|
||||||
this.formData.model = 'X5';
|
return uni.showToast({
|
||||||
this.formData.color = '白色';
|
title: "请输入车辆品牌",
|
||||||
this.formData.carImg = 'http://47.104.199.163:9090/images/propertyImgs/carImg.png';
|
icon: "none"
|
||||||
this.formData.carBrandId = '1';
|
})
|
||||||
|
}
|
||||||
|
if (!formData.value.carModel) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: "请输入车辆型号",
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!formData.value.carColor) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: "请输入车辆颜色",
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
} else if (uni.getStorageSync('operationType') == 'add') {
|
uni.showLoading({
|
||||||
this.id = undefined;
|
title: '提交中...',
|
||||||
this.type = '添加';
|
mask: true
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
let carImageUrl = ''
|
||||||
|
|
||||||
|
// 编辑模式
|
||||||
|
if (id.value) {
|
||||||
|
if (carImageUpload.state.tempFilePath) {
|
||||||
|
carImageUrl = await carImageUpload.uploadImage()
|
||||||
|
} else {
|
||||||
|
carImageUrl = carImageUpload.state.serverUrl || carImageUpload.state.previewUrl || ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 新增模式:必须上传
|
||||||
|
carImageUrl = await carImageUpload.uploadImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
submitCarData(carImageUrl)
|
||||||
|
} catch (err) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || '上传失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onUnload() {},
|
const submitCarData = (carImageUrl) => {
|
||||||
mounted() {},
|
// 处理 carImageUrl 可能是对象 { url: string } 的情况
|
||||||
data() {
|
const imageUrl = typeof carImageUrl === 'object' ? carImageUrl.url : carImageUrl
|
||||||
return {
|
const params = {
|
||||||
/* 设定状态栏默认高度 */
|
carNum: formData.value.carNum,
|
||||||
statusBarHeight: 20,
|
carBrand: formData.value.carBrand,
|
||||||
id: undefined,
|
// carBrandId: formData.value.carBrandId,
|
||||||
type: '',
|
carModel: formData.value.carModel,
|
||||||
// 表单数据
|
carColor: formData.value.carColor,
|
||||||
formData: {
|
carImageUrl: imageUrl,
|
||||||
plateNo: uni.getStorageSync('plateNo'),
|
residentId: uni.getStorageSync('userId')
|
||||||
carBrandName: uni.getStorageSync('carBrandName'),
|
|
||||||
model: uni.getStorageSync('model'),
|
|
||||||
color: uni.getStorageSync('color'),
|
}
|
||||||
carImg: uni.getStorageSync('carImg') // 车辆图片路径
|
// 编辑模式下添加 id
|
||||||
|
if (id.value) {
|
||||||
|
params.id = id.value
|
||||||
|
putCar(params).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
goBack()
|
||||||
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg || '提交失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
},
|
}else{
|
||||||
|
postCar(params).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
methods: {
|
if (res.code === 200) {
|
||||||
inputChange(type) {
|
uni.showToast({
|
||||||
if (type == '车牌号') {
|
title: '提交成功',
|
||||||
|
icon: 'success'
|
||||||
uni.setStorageSync('plateNo', this.formData.plateNo)
|
})
|
||||||
} else if (type == '车辆型号') {
|
setTimeout(() => {
|
||||||
uni.setStorageSync('model', this.formData.model)
|
goBack()
|
||||||
} else if (type == '车辆颜色') {
|
}, 1500)
|
||||||
uni.setStorageSync('color', this.formData.color)
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg || '提交失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
},
|
|
||||||
// 选择图片(上传照片)
|
|
||||||
chooseImage() {
|
|
||||||
uni.chooseImage({
|
|
||||||
count: 1, // 只选1张
|
|
||||||
sizeType: ["original", "compressed"],
|
|
||||||
sourceType: ["album", "camera"], // 相册/相机
|
|
||||||
success: (res) => {
|
|
||||||
// 赋值图片路径
|
|
||||||
uni.setStorageSync('carImg', res.tempFilePaths[0]);
|
|
||||||
this.formData.carImg = res.tempFilePaths[0];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 保存车辆信息
|
|
||||||
saveCar() {
|
|
||||||
// 表单校验
|
|
||||||
if (!this.formData.plateNo) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: "请输入车牌号",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!this.formData.carBrandName) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: "请输入车辆品牌",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!this.formData.model) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: "请输入车辆型号",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!this.formData.color) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: "请输入车辆颜色",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认提交',
|
|
||||||
content: '保存后进入审核',
|
|
||||||
success: (res) => {
|
|
||||||
|
|
||||||
uni.showLoading({
|
|
||||||
title: '提交中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '提交成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
setTimeout(() => {
|
|
||||||
// 提交成功后跳转列表页
|
|
||||||
uni.hideLoading();
|
|
||||||
this.goBack();
|
|
||||||
}, 2500);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 选择项点击事件(可替换为picker/弹窗选择)
|
|
||||||
selectItem(type) {
|
|
||||||
if (type === '车辆品牌') {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/selectCarBrand',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
goBack() {
|
|
||||||
|
|
||||||
uni.removeStorageSync('plateNo');
|
|
||||||
uni.removeStorageSync('carBrandName');
|
|
||||||
uni.removeStorageSync('model');
|
|
||||||
uni.removeStorageSync('color');
|
|
||||||
uni.removeStorageSync('carImg');
|
|
||||||
uni.removeStorageSync('carBrandId');
|
|
||||||
uni.removeStorageSync('checkType');
|
|
||||||
// if (uni.getStorageSync('operationType') == 'update') {
|
|
||||||
// uni.redirectTo({
|
|
||||||
// url: '/pageSubPack/my/houseDetail?id=' + this.id,
|
|
||||||
// success: res => {},
|
|
||||||
// fail: () => {},
|
|
||||||
// complete: () => {}
|
|
||||||
// });
|
|
||||||
// } else if (uni.getStorageSync('operationType') == 'add') {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/myCarIndex',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
// }
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectItem = (typeStr) => {
|
||||||
|
if (typeStr === '车辆品牌') {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/selectCarBrand'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.removeStorageSync('carNum')
|
||||||
|
uni.removeStorageSync('carBrand')
|
||||||
|
uni.removeStorageSync('carModel')
|
||||||
|
uni.removeStorageSync('carColor')
|
||||||
|
uni.removeStorageSync('carImageUrl')
|
||||||
|
uni.removeStorageSync('carBrandId')
|
||||||
|
uni.removeStorageSync('checkType')
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/myCarIndex'
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 全局样式:去掉switch的×号,保证开关纯净 */
|
|
||||||
.my-switch::before {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-switch {
|
|
||||||
background-color: #e5e5e5 !important;
|
|
||||||
border: none !important;
|
|
||||||
width: 90rpx !important;
|
|
||||||
height: 48rpx !important;
|
|
||||||
border-radius: 50rpx !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-switch[checked="true"] {
|
|
||||||
background-color: #1677ff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-switch::after {
|
|
||||||
width: 44rpx !important;
|
|
||||||
height: 44rpx !important;
|
|
||||||
border-radius: 50% !important;
|
|
||||||
margin: 2rpx !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.status-bar {
|
.status-bar {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
@@ -294,7 +323,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,66 +334,10 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 步骤条 */
|
|
||||||
.step-bar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40rpx 30rpx 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-circle {
|
|
||||||
width: 80rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #ccc;
|
|
||||||
color: #fff;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 28rpx;
|
|
||||||
margin-bottom: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-item.active .step-circle {
|
|
||||||
background-color: #1677ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-item.active .step-text {
|
|
||||||
color: #1677ff;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-line {
|
|
||||||
width: 150rpx;
|
|
||||||
height: 4rpx;
|
|
||||||
background-color: #ccc;
|
|
||||||
margin: 0 20rpx;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单容器 */
|
|
||||||
.form-container {
|
.form-container {
|
||||||
padding: 0 0px;
|
padding: 0 0px;
|
||||||
/* height: calc(100vh - 240rpx); */
|
|
||||||
/* overflow-y: scroll; */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 表单项 */
|
|
||||||
.form-item {
|
.form-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -392,24 +364,17 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.item-arrow {
|
.item-arrow {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width:10rpx;
|
width: 10rpx;
|
||||||
height:10rpx;
|
height: 10rpx;
|
||||||
border-top: 2rpx solid #999;
|
border-top: 2rpx solid #999;
|
||||||
border-right: 2rpx solid #999;
|
border-right: 2rpx solid #999;
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
margin-right:10rpx;
|
margin-right: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 开关项 */
|
|
||||||
.switch-item {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 底部按钮 */
|
|
||||||
.bottom-btn-wrap {
|
.bottom-btn-wrap {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -427,174 +392,7 @@
|
|||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
<style>
|
|
||||||
/* 注意:这里不能加 scoped!必须写全局样式 */
|
|
||||||
|
|
||||||
/* 隐藏 switch 关闭状态的 × 号 */
|
|
||||||
.no-cross-switch::before {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-cross-switch {
|
|
||||||
transform: scale(0.85);
|
|
||||||
border-radius: 50rpx !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-cross-switch>>>.uni-switch-input-checked {
|
|
||||||
background-color: #007aff !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style scoped>
|
|
||||||
/* 表单项 —— 和你页面保持一致 */
|
|
||||||
.form-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 30rpx 0;
|
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #000;
|
|
||||||
width: 90px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
flex: 1;
|
|
||||||
text-align: left;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999;
|
|
||||||
margin-right: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 遮罩 */
|
|
||||||
.mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 底部弹出框 */
|
|
||||||
.popup {
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 20rpx 20rpx 0 0;
|
|
||||||
z-index: 100;
|
|
||||||
max-height: 60vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-header {
|
|
||||||
padding: 30rpx;
|
|
||||||
text-align: center;
|
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close {
|
|
||||||
position: absolute;
|
|
||||||
right: 30rpx;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
font-size: 36rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 选项列表 */
|
|
||||||
.list {
|
|
||||||
padding: 0 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
|
||||||
padding: 30rpx 0;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 28rpx;
|
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style scoped>
|
|
||||||
/* 表单 */
|
|
||||||
|
|
||||||
|
|
||||||
.form-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 28rpx 0;
|
|
||||||
border-bottom: 1rpx solid #f2f2f2;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
width: 180rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 28rpx;
|
|
||||||
text-align: left;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ph {
|
|
||||||
color: #999 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow-item::after {
|
|
||||||
content: '>';
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
color: #ccc;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
flex: 1;
|
|
||||||
text-align: left;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999;
|
|
||||||
padding-right: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-input {
|
|
||||||
flex: 1;
|
|
||||||
height: 40rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-placeholder {
|
|
||||||
color: #999 !important;
|
|
||||||
font-size: 28rpx !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===================== 图片上传区域 ===================== */
|
|
||||||
.upload-item {
|
.upload-item {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
padding-top: 40rpx;
|
padding-top: 40rpx;
|
||||||
@@ -639,100 +437,18 @@
|
|||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 弹窗遮罩 */
|
.item-input {
|
||||||
.mask {
|
flex: 1;
|
||||||
position: fixed;
|
height: 40rpx;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup {
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 20rpx 20rpx 0 0;
|
|
||||||
z-index: 100;
|
|
||||||
max-height: 60vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-header {
|
|
||||||
padding: 30rpx;
|
|
||||||
text-align: center;
|
|
||||||
border-bottom: 1rpx solid #eee;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close {
|
|
||||||
position: absolute;
|
|
||||||
right: 30rpx;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
font-size: 36rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-list {
|
|
||||||
padding: 0 30rpx;
|
|
||||||
max-height: 40vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
|
||||||
padding: 30rpx 0;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
color: #333;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
.input-placeholder {
|
||||||
.toast-mask {
|
color: #999 !important;
|
||||||
position: fixed;
|
font-size: 28rpx !important;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
<!-- 身份证人像面 -->
|
<!-- 身份证人像面 -->
|
||||||
<view class="upload-item" @click="chooseIdCard('front')">
|
<view class="upload-item" @click="chooseIdCard('front')">
|
||||||
<!-- 已上传 → 显示图片 -->
|
<!-- 已上传 → 显示图片 -->
|
||||||
<image :src="idCardFrontUpload.previewUrl || frontSideOfIDcardSrc"
|
<image :src="idCardFrontUpload.state.previewUrl || frontSideOfIDcardSrc"
|
||||||
class="preview-img" mode="aspectFit">
|
class="preview-img" mode="aspectFit">
|
||||||
</image>
|
</image>
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
|
|
||||||
<!-- 身份证国徽面 -->
|
<!-- 身份证国徽面 -->
|
||||||
<view class="upload-item" @click="chooseIdCard('back')">
|
<view class="upload-item" @click="chooseIdCard('back')">
|
||||||
<image :src="idCardBackUpload.previewUrl || backSideOfIDcardSrc" class="preview-img"
|
<image :src="idCardBackUpload.state.previewUrl || backSideOfIDcardSrc" class="preview-img"
|
||||||
mode="aspectFit">
|
mode="aspectFit">
|
||||||
</image>
|
</image>
|
||||||
|
|
||||||
@@ -639,11 +639,11 @@
|
|||||||
title: '请输入6位验证码',
|
title: '请输入6位验证码',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
if (!idCardFrontUpload.previewUrl) return uni.showToast({
|
if (!idCardFrontUpload.state.previewUrl) return uni.showToast({
|
||||||
title: '请上传身份证人像面',
|
title: '请上传身份证人像面',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
if (!idCardBackUpload.previewUrl) return uni.showToast({
|
if (!idCardBackUpload.state.previewUrl) return uni.showToast({
|
||||||
title: '请上传身份证国徽面',
|
title: '请上传身份证国徽面',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
@@ -672,16 +672,16 @@
|
|||||||
// 编辑模式
|
// 编辑模式
|
||||||
if (houseId.value) {
|
if (houseId.value) {
|
||||||
// 如果重新选择了图片,需要上传
|
// 如果重新选择了图片,需要上传
|
||||||
if (idCardFrontUpload.tempFilePath) {
|
if (idCardFrontUpload.state.tempFilePath) {
|
||||||
cardImageFrontUrl = await idCardFrontUpload.uploadImage()
|
cardImageFrontUrl = await idCardFrontUpload.uploadImage()
|
||||||
} else {
|
} else {
|
||||||
const frontUrl = idCardFrontUpload.serverUrl || idCardFrontUpload.previewUrl
|
const frontUrl = idCardFrontUpload.state.serverUrl || idCardFrontUpload.state.previewUrl
|
||||||
cardImageFrontUrl = typeof frontUrl === 'string' ? frontUrl : ''
|
cardImageFrontUrl = typeof frontUrl === 'string' ? frontUrl : ''
|
||||||
}
|
}
|
||||||
if (idCardBackUpload.tempFilePath) {
|
if (idCardBackUpload.state.tempFilePath) {
|
||||||
cardImageBackUrl = await idCardBackUpload.uploadImage()
|
cardImageBackUrl = await idCardBackUpload.uploadImage()
|
||||||
} else {
|
} else {
|
||||||
const backUrl = idCardBackUpload.serverUrl || idCardBackUpload.previewUrl
|
const backUrl = idCardBackUpload.state.serverUrl || idCardBackUpload.state.previewUrl
|
||||||
cardImageBackUrl = typeof backUrl === 'string' ? backUrl : ''
|
cardImageBackUrl = typeof backUrl === 'string' ? backUrl : ''
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,192 +1,218 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="绑定车辆" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
<uni-nav-bar title="绑定车辆" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<scroll-view class="page" scroll-y>
|
<scroll-view class="page" scroll-y>
|
||||||
<view v-if="carList.length === 0" class="empty-state">
|
<view v-if="carList.length === 0" class="empty-state">
|
||||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||||
<text class="empty-text">
|
<text class="empty-text">暂无数据</text>
|
||||||
{{ '暂无数据'}}
|
|
||||||
</text>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="car-item" v-for="(item, index) in carList" :key="index" @click="handleItemClick(item,index)"
|
<view class="car-item" v-for="(item, index) in carList" :key="index" @click="handleItemClick(item, index)"
|
||||||
:class="{ checked: selectedIndex === index }">
|
:class="{ checked: selectedIndex === index }">
|
||||||
<!-- 左侧圆形占位 -->
|
<image :src="item.carImageUrl" mode="aspectFill" class="car-avatar"
|
||||||
<image :src="item.imgSrc" mode="aspectFill" class="car-avatar" @error="item.imgSrc = defaultCarImg" />
|
@error="item.carImageUrl = defaultCarImg" />
|
||||||
<!-- 中间车辆信息 -->
|
|
||||||
<view class="car-info">
|
<view class="car-info">
|
||||||
<view class="car-plate">{{ item.plate }}</view>
|
<view class="car-plate">{{ item.carNum }}</view>
|
||||||
<view class="car-model">{{ item.model }}·{{ item.color }}</view>
|
<view class="car-model">{{ item.carBrand }}·{{ item.carColor }}</view>
|
||||||
</view>
|
<view class="car-bindParkingSpace">{{ item.bindParkingSpace }}</view>
|
||||||
|
|
||||||
<!-- 右侧状态标签 -->
|
|
||||||
<view class="status-tag" :class="{ bound: item.status === '已绑定', unbound: item.status === '未绑定' }">
|
|
||||||
{{ item.status }}
|
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <view class="status-tag"
|
||||||
|
:class="{ underReview: item.certificationStatus === '审核中', unbound: item.certificationStatus === '未绑定', bounded: item.certificationStatus === ''}">
|
||||||
|
{{ item.certificationStatus }}
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部确定绑定按钮 -->
|
|
||||||
<view class="bottom-btn">
|
<view class="bottom-btn">
|
||||||
<button class="confirm-btn" @click="confirmBind">确定绑定</button>
|
<button class="confirm-btn" @click="confirmBind">确定绑定</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted,
|
||||||
|
|
||||||
},
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
getMyCarList,
|
||||||
|
postCarBind
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
|
||||||
computed: {
|
const statusBarHeight = ref(20)
|
||||||
|
const defaultCarImg = "http://47.104.199.163:9090/images/propertyImgs/defaultCarImg.png"
|
||||||
|
const selectedId = ref('')
|
||||||
|
const selectedName = ref('')
|
||||||
|
const selectedIndex = ref(-1)
|
||||||
|
const carList = ref([])
|
||||||
|
|
||||||
|
const loadingMore = ref(false)
|
||||||
|
const noMoreData = ref(false)
|
||||||
|
|
||||||
},
|
const pageNum = ref(1)
|
||||||
|
const pageSize = ref(10)
|
||||||
|
// ==================== 获取列表数据 ====================
|
||||||
|
const getList = async () => {
|
||||||
|
// 防重复请求
|
||||||
|
|
||||||
created() {
|
if (loadingMore.value || noMoreData.value) return
|
||||||
|
|
||||||
},
|
loadingMore.value = true
|
||||||
onShow() {
|
try {
|
||||||
|
const res = await getMyCarList({
|
||||||
},
|
pageNum: pageNum.value,
|
||||||
onUnload() {
|
pageSize: pageSize.value,
|
||||||
|
residentId: uni.getStorageSync('userId')
|
||||||
},
|
})
|
||||||
mounted() {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
defaultCarImg: "http://47.104.199.163:9090/images/propertyImgs/defaultCarImg.png",
|
|
||||||
searchKey: "",
|
|
||||||
selectedId: '',
|
|
||||||
selectedName: '',
|
|
||||||
selectedIndex: -1, // 当前选中的索引
|
|
||||||
|
|
||||||
// 模拟车辆数据
|
|
||||||
carList: [{
|
|
||||||
id: '1',
|
|
||||||
imgSrc: 'http://47.104.199.163:9090/images/propertyImgs/carImg.png',
|
|
||||||
plate: "京A88888",
|
|
||||||
model: "宝马X5",
|
|
||||||
color: "白色",
|
|
||||||
status: "已绑定"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
imgSrc: 'https://错误地址2.png',
|
|
||||||
plate: "京A88888",
|
|
||||||
model: "宝马X5",
|
|
||||||
color: "白色",
|
|
||||||
status: "未绑定"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
imgSrc: 'https://错误地址3.png',
|
|
||||||
plate: "京A88888",
|
|
||||||
model: "宝马X5",
|
|
||||||
color: "白色",
|
|
||||||
status: "未绑定"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
const data = res
|
||||||
|
const newList = data.rows || []
|
||||||
|
|
||||||
|
// 第一页 → 覆盖数据
|
||||||
|
if (pageNum.value === 1) {
|
||||||
|
carList.value = newList
|
||||||
|
} else {
|
||||||
|
// 后续页 → 追加数据
|
||||||
|
carList.value = [...carList.value, ...newList]
|
||||||
}
|
}
|
||||||
},
|
// 判断是否没有更多数据
|
||||||
|
if (newList.length < pageSize.value) {
|
||||||
|
noMoreData.value = true
|
||||||
|
} else {
|
||||||
|
pageNum.value++
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '加载失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
console.error('列表接口报错:', err)
|
||||||
|
} finally {
|
||||||
|
loadingMore.value = false
|
||||||
|
uni.stopPullDownRefresh() // 关闭下拉刷新
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 上拉加载更多(页面生命周期) ====================
|
||||||
|
onReachBottom(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
// ==================== 下拉刷新 ====================
|
||||||
|
const refresh = () => {
|
||||||
|
// 重置所有状态
|
||||||
|
pageNum = 1
|
||||||
|
pageSize = 10
|
||||||
|
noMoreData = false
|
||||||
|
carList = []
|
||||||
|
loadingMore = false
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
refresh()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 页面加载时请求第一页
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
const handleItemClick = (item, index) => {
|
||||||
|
selectedIndex.value = index
|
||||||
|
selectedId.value = item.id
|
||||||
|
selectedName.value = item.carNum
|
||||||
|
}
|
||||||
|
|
||||||
// 选择绑定车辆
|
const confirmBind = () => {
|
||||||
handleItemClick(item, index) {
|
if (selectedIndex.value === -1) {
|
||||||
this.selectedIndex = index;
|
return uni.showToast({
|
||||||
this.selectedId = item.id;
|
title: "请先选择绑定车辆",
|
||||||
this.selectedName = item.plate;
|
icon: "none"
|
||||||
},
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 确定绑定
|
uni.showModal({
|
||||||
confirmBind() {
|
title: "确认选择",
|
||||||
if (this.selectedIndex === -1) {
|
content: `确定绑定该车辆吗?`,
|
||||||
return uni.showToast({
|
success: (res) => {
|
||||||
title: "请先选择绑定车辆",
|
if (res.confirm) {
|
||||||
icon: "none",
|
uni.showLoading({
|
||||||
});
|
title: '绑定中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
uni.setStorageSync('bindCarId', selectedId.value)
|
||||||
|
uni.setStorageSync('bindCarName', selectedName.value)
|
||||||
|
goBack()
|
||||||
|
}, 1500)
|
||||||
|
// postCarBind({
|
||||||
|
// carId: selectedId.value
|
||||||
|
// }).then(bindRes => {
|
||||||
|
// uni.hideLoading()
|
||||||
|
// if (bindRes.code === 200) {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '绑定成功',
|
||||||
|
// icon: 'success'
|
||||||
|
// })
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.setStorageSync('bindCarId', selectedId.value)
|
||||||
|
// uni.setStorageSync('bindCarName', selectedName.value)
|
||||||
|
// goBack()
|
||||||
|
// }, 1500)
|
||||||
|
// } else {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: bindRes.msg || '绑定失败',
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
uni.showModal({
|
const goBack = () => {
|
||||||
title: "确认选择",
|
uni.redirectTo({
|
||||||
content: `确定绑定该车辆吗?`,
|
url: '/pageSubPack/my/addParkingSpace'
|
||||||
success: (res) => {
|
})
|
||||||
if (res.confirm) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '绑定中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '绑定成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
setTimeout(() => {
|
|
||||||
// 提交成功后跳转列表页
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.setStorageSync('bindCarId', this.selectedId);
|
|
||||||
uni.setStorageSync('bindCarName', this.selectedName);
|
|
||||||
this.goBack();
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
goBack() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addParkingSpace',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// height: 100vh;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.status-bar {
|
||||||
|
width: 100vw;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
.contentStyle {
|
.contentStyle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
/* background-color: #fff; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
@@ -196,7 +222,6 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 空状态 */
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -213,96 +238,10 @@
|
|||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 底部按钮 */
|
|
||||||
.bottom-btn {
|
.bottom-btn {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 通用输入框样式 */
|
|
||||||
.input-item {
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-placeholder {
|
|
||||||
color: #999;
|
|
||||||
font-size: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 确定按钮 */
|
|
||||||
.submit-btn {
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
line-height: 88rpx;
|
|
||||||
background-color: #1677ff;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
border: none;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
|
||||||
.toast-mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style scoped>
|
|
||||||
/* 页面整体 */
|
|
||||||
|
|
||||||
/* ====================== 列表容器 ====================== */
|
|
||||||
.list-container {
|
|
||||||
/* flex: 1; */
|
|
||||||
padding: 40rpx;
|
|
||||||
min-height: calc(100vh - 105px);
|
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ====================== 绑定车辆卡片 ====================== */
|
|
||||||
/* 单个车辆项 */
|
|
||||||
.car-item {
|
.car-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -316,11 +255,9 @@
|
|||||||
|
|
||||||
.car-item.checked {
|
.car-item.checked {
|
||||||
background: #f4f7ff;
|
background: #f4f7ff;
|
||||||
/* 浅蓝色背景 */
|
|
||||||
border-color: #1677ff;
|
border-color: #1677ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 左侧圆形头像占位 */
|
|
||||||
.car-avatar {
|
.car-avatar {
|
||||||
width: 100rpx;
|
width: 100rpx;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
@@ -330,34 +267,57 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 中间信息区域 */
|
|
||||||
.car-info {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 车牌号 */
|
|
||||||
.car-plate {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #000;
|
|
||||||
line-height: 1.4;
|
|
||||||
margin-bottom: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 车型+颜色 */
|
|
||||||
.car-model {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666;
|
|
||||||
line-height: 1.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 状态标签 */
|
|
||||||
.status-tag {
|
.status-tag {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
padding: 6rpx14rpx;
|
padding: 6rpx 14rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
flex-shrink: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 30rpx;
|
||||||
|
top: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag.unbound {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag.bounded {
|
||||||
|
color: #2F77FD;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag.underReview {
|
||||||
|
color: #FF8F40;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag.unpass {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-plate {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000;
|
||||||
|
line-height: 1.4;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-model {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag {
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding: 6rpx 14rpx;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -366,22 +326,14 @@
|
|||||||
top: 30rpx;
|
top: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 未绑定状态(浅绿色背景+绿色文字) */
|
|
||||||
.status-tag.unbound {
|
.status-tag.unbound {
|
||||||
/* background-color: #e6f7e6; */
|
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 已绑定状态(可扩展,比如蓝色) */
|
|
||||||
.status-tag.bound {
|
.status-tag.bound {
|
||||||
/* background-color: #e6f0ff; */
|
|
||||||
color: #1677ff;
|
color: #1677ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ====================== 底部按钮 ====================== */
|
|
||||||
|
|
||||||
|
|
||||||
.confirm-btn {
|
.confirm-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
@@ -392,9 +344,4 @@
|
|||||||
border: none;
|
border: none;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-bar {
|
|
||||||
width: 100vw;
|
|
||||||
height: 46px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<!-- 小区名称 -->
|
<!-- 小区名称 -->
|
||||||
<view class="community-name">
|
<view class="community-name">
|
||||||
<text class="title-line"></text>
|
<text class="title-line"></text>
|
||||||
<text class="title-text">{{ item.community }}</text>
|
<text class="title-text">{{ item.villageName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 选中对勾 -->
|
<!-- 选中对勾 -->
|
||||||
<view class="check-icon" :class="{ checked: selectedIndex === index }"></view>
|
<view class="check-icon" :class="{ checked: selectedIndex === index }"></view>
|
||||||
@@ -66,162 +66,164 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted,
|
||||||
|
computed
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh,
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
getVillageList
|
||||||
|
} from '/pageSubPack/api/apiSub.js'
|
||||||
|
|
||||||
|
/* 设定状态栏默认高度 */
|
||||||
|
const statusBarHeight = 20
|
||||||
|
const searchKey = ref("")
|
||||||
|
const selectedId = ref('')
|
||||||
|
const selectedName = ref('')
|
||||||
|
const selectedIndex = ref(-1)
|
||||||
|
|
||||||
|
/* 搜索状态 */
|
||||||
|
const onSearch = () => {
|
||||||
|
// 实时过滤,computed 自动处理
|
||||||
|
}
|
||||||
|
onLoad(() => {
|
||||||
|
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
/* 房屋状态颜色映射 */
|
||||||
|
const statusColor = {
|
||||||
|
自住: "#409EFF",
|
||||||
|
闲置: "#67C23A",
|
||||||
|
租赁: "#E6A23C",
|
||||||
|
其他: "#909399",
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 模拟房屋数据 */
|
||||||
|
const communityList = ref([{
|
||||||
|
id: 1,
|
||||||
|
villageName: "北境碧桂园小区(别墅)",
|
||||||
|
roomNo: "2号楼2层",
|
||||||
|
owner: "张三",
|
||||||
|
status: "自住",
|
||||||
},
|
},
|
||||||
computed: {
|
{
|
||||||
// 过滤后的列表(搜索功能)
|
id: 1,
|
||||||
filteredList() {
|
villageName: "北境碧桂园小区(别墅)",
|
||||||
this.selectedIndex = -1
|
roomNo: "2号楼1层",
|
||||||
if (!this.searchKey.trim()) {
|
owner: "张三",
|
||||||
return this.houseList
|
status: "闲置",
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
/* 过滤后的列表(搜索功能) */
|
||||||
|
const filteredList = computed(() => {
|
||||||
|
selectedIndex.value = -1
|
||||||
|
if (!searchKey.value.trim()) {
|
||||||
|
return communityList.value
|
||||||
|
}
|
||||||
|
return communityList.value.filter(item =>
|
||||||
|
item.villageName.includes(searchKey.value.trim())
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
/* 选择房屋 */
|
||||||
|
const selectHouse = (item, index) => {
|
||||||
|
selectedIndex.value = index
|
||||||
|
selectedId.value = item.id
|
||||||
|
selectedName.value = item.villageName + item.roomNo
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确定绑定 */
|
||||||
|
const confirmBind = () => {
|
||||||
|
if (selectedIndex.value === -1) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: "请先选择房屋",
|
||||||
|
icon: "none",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
title: "确认选择",
|
||||||
|
content: `确定绑定 ${selectedName.value} 吗?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '绑定中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
setTimeout(() => {
|
||||||
|
// 提交成功后跳转列表页
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.setStorageSync('bindHouseId', selectedId.value)
|
||||||
|
uni.setStorageSync('bindHouseName', selectedName.value)
|
||||||
|
uni.setStorageSync('checkType', '停车场')
|
||||||
|
uni.removeStorageSync('paringLotId')
|
||||||
|
uni.removeStorageSync('paringLotName')
|
||||||
|
uni.removeStorageSync('parkingSpaceId')
|
||||||
|
uni.removeStorageSync('parkingSpaceName')
|
||||||
|
goNext()
|
||||||
|
}, 2500)
|
||||||
}
|
}
|
||||||
return this.houseList.filter(item =>
|
|
||||||
item.community.includes(this.searchKey.trim())
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
|
||||||
|
|
||||||
},
|
try {
|
||||||
|
const res = await getVillageList({
|
||||||
|
|
||||||
|
})
|
||||||
|
console.log(res);
|
||||||
|
const data = res
|
||||||
|
communityList.value = data.data || []
|
||||||
|
|
||||||
created() {
|
} catch (err) {
|
||||||
|
uni.showToast({
|
||||||
},
|
title: '加载失败',
|
||||||
onShow() {
|
icon: 'none'
|
||||||
|
})
|
||||||
},
|
console.error('列表接口报错:', err)
|
||||||
onUnload() {
|
} finally {
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
searchKey: "",
|
|
||||||
selectedId: '',
|
|
||||||
selectedName: '',
|
|
||||||
selectedIndex: -1, // 当前选中的索引
|
|
||||||
// 房屋状态颜色映射
|
|
||||||
statusColor: {
|
|
||||||
自住: "#409EFF",
|
|
||||||
闲置: "#67C23A",
|
|
||||||
租赁: "#E6A23C",
|
|
||||||
其他: "#909399",
|
|
||||||
},
|
|
||||||
// 模拟房屋数据
|
|
||||||
houseList: [{
|
|
||||||
id: 1,
|
|
||||||
community: "北境碧桂园小区(别墅)",
|
|
||||||
roomNo: "2号楼2层",
|
|
||||||
owner: "张三",
|
|
||||||
status: "自住",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
community: "北境碧桂园小区(别墅)",
|
|
||||||
roomNo: "2号楼1层",
|
|
||||||
owner: "张三",
|
|
||||||
status: "闲置",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
// 搜索输入事件
|
|
||||||
onSearch() {
|
|
||||||
// 实时过滤,computed 自动处理
|
|
||||||
},
|
|
||||||
|
|
||||||
// 选择房屋
|
|
||||||
selectHouse(item, index) {
|
|
||||||
this.selectedIndex = index;
|
|
||||||
this.selectedId = item.id;
|
|
||||||
this.selectedName = item.community + item.roomNo;
|
|
||||||
},
|
|
||||||
|
|
||||||
// 确定绑定
|
|
||||||
confirmBind() {
|
|
||||||
if (this.selectedIndex === -1) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: "请先选择房屋",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showModal({
|
|
||||||
title: "确认选择",
|
|
||||||
content: `确定绑定 ${this.selectedName} 吗?`,
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '绑定中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '绑定成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
setTimeout(() => {
|
|
||||||
// 提交成功后跳转列表页
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.setStorageSync('bindHouseId', this.selectedId);
|
|
||||||
uni.setStorageSync('bindHouseName', this.selectedName);
|
|
||||||
uni.setStorageSync('checkType', '停车场');
|
|
||||||
uni.removeStorageSync('paringLotId');
|
|
||||||
uni.removeStorageSync('paringLotName');
|
|
||||||
uni.removeStorageSync('parkingSpaceId');
|
|
||||||
uni.removeStorageSync('parkingSpaceName');
|
|
||||||
this.goNext();
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
goNext() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/selectParingLot',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
goBack() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addParkingSpace',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const goNext = () => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/selectParingLot',
|
||||||
|
success: res => {},
|
||||||
|
fail: () => {},
|
||||||
|
complete: () => {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addParkingSpace',
|
||||||
|
success: res => {},
|
||||||
|
fail: () => {},
|
||||||
|
complete: () => {}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// height: 100vh;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -230,8 +232,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
/* background-color: #fff; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
@@ -246,8 +246,6 @@
|
|||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 通用输入框样式 */
|
/* 通用输入框样式 */
|
||||||
.input-item {
|
.input-item {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
@@ -272,55 +270,6 @@
|
|||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
|
||||||
.toast-mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style scoped>
|
|
||||||
/* 页面整体 */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================== 搜索框样式(1:1还原) ====================== */
|
|
||||||
/* 搜索框 */
|
/* 搜索框 */
|
||||||
.search-box {
|
.search-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -350,8 +299,9 @@
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================== 列表容器 ====================== */
|
/* 列表容器 */
|
||||||
.list-container {}
|
.list-container {}
|
||||||
|
|
||||||
/* 空状态 */
|
/* 空状态 */
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -369,7 +319,7 @@
|
|||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================== 房屋卡片 ====================== */
|
/* 房屋卡片 */
|
||||||
.house-card {
|
.house-card {
|
||||||
border: 1rpx solid #e5e5e5;
|
border: 1rpx solid #e5e5e5;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
@@ -418,21 +368,19 @@
|
|||||||
.info-label {
|
.info-label {
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
/* font-weight: 600; */
|
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-value {
|
.info-value {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
/* font-weight: 600; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-text {
|
.status-text {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================== 选中对勾 ====================== */
|
/* 选中对勾 */
|
||||||
.check-icon {
|
.check-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 20rpx;
|
right: 20rpx;
|
||||||
@@ -442,7 +390,6 @@
|
|||||||
height: 52rpx;
|
height: 52rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 2rpx solid #ccc;
|
border: 2rpx solid #ccc;
|
||||||
/* background-color: #ccc; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.check-icon::after {
|
.check-icon::after {
|
||||||
@@ -473,14 +420,6 @@
|
|||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-line {
|
|
||||||
width: 8rpx;
|
|
||||||
height: 36rpx;
|
|
||||||
background-color: #007AFF;
|
|
||||||
margin-right: 12rpx;
|
|
||||||
border-radius: 4rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-bar {
|
.status-bar {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="车辆详情" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
<uni-nav-bar title="车辆详情" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
<!-- 车辆信息 -->
|
|
||||||
<view class="info-card">
|
<view class="info-card">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
<view class="title-line"></view>
|
<view class="title-line"></view>
|
||||||
@@ -13,152 +12,140 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">车牌号</text>
|
<text class="info-label">车牌号</text>
|
||||||
<text class="info-value">{{form.plateNo}}</text>
|
<text class="info-value">{{ form.carNum }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">车辆品牌</text>
|
<text class="info-label">车辆品牌</text>
|
||||||
<text class="info-value">{{form.carBrandName}}</text>
|
<text class="info-value">{{ form.carBrand }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">车辆型号</text>
|
<text class="info-label">车辆型号</text>
|
||||||
<text class="info-value">{{form.model}}</text>
|
<text class="info-value">{{ form.carModel }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">车身颜色</text>
|
<text class="info-label">车身颜色</text>
|
||||||
<text class="info-value">{{form.color}}</text>
|
<text class="info-value">{{ form.carColor }}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 车辆图片区-->
|
|
||||||
<view class="photo-row">
|
<view class="photo-row">
|
||||||
<text class="info-label" style="width: 200rpx;">车辆图片</text>
|
<text class="info-label" style="width: 200rpx;">车辆图片</text>
|
||||||
<view class="photo-list">
|
<view class="photo-list">
|
||||||
<image class="photo-item" :src="form.carImg"></image>
|
<image class="photo-item" :src="form.carImageUrl"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部操作按钮 -->
|
<view class="bottom-btn-wrap">
|
||||||
<view class="bottom-btn-wrap">
|
<button class="btn-modify" @click="clickUpdate">修改</button>
|
||||||
<!-- 仅认证失败显示修改按钮 -->
|
<button class="btn-delete" @click="onDelete">删除</button>
|
||||||
<button class="btn-modify" @click="clickUpdate()">
|
</view>
|
||||||
修改
|
|
||||||
</button>
|
|
||||||
<button class="btn-delete" @click="onDelete">
|
|
||||||
删除
|
|
||||||
</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh,
|
||||||
|
onLoad,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
getCarDetail,
|
||||||
|
deleteCar
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
|
||||||
},
|
const statusBarHeight = ref(20)
|
||||||
|
const currentStatus = ref('')
|
||||||
|
const id = ref(undefined)
|
||||||
|
const form = ref({
|
||||||
|
plateNo: '',
|
||||||
|
carBrandName: '',
|
||||||
|
model: '',
|
||||||
|
color: '',
|
||||||
|
carImg: ''
|
||||||
|
})
|
||||||
|
onLoad((options) => {
|
||||||
|
console.log(options);
|
||||||
|
id.value = options.id
|
||||||
|
currentStatus.value = options.status
|
||||||
|
loadCarDetail(options.id)
|
||||||
|
|
||||||
computed: {
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
onLoad(option) {
|
|
||||||
this.id = option.id;
|
|
||||||
this.currentStatus = option.status;
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
currentStatus: '',
|
|
||||||
// 可通过页面传参动态修改状态:success / pending / fail
|
|
||||||
id: undefined,
|
|
||||||
form: {
|
|
||||||
plateNo: '北境碧桂园小区小区',
|
|
||||||
carBrandName: '101栋2单元402',
|
|
||||||
model: '张三',
|
|
||||||
color: '租赁',
|
|
||||||
carImg: 'http://47.104.199.163:9090/images/propertyImgs/carImg.png',
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
const loadCarDetail = async () => {
|
||||||
},
|
// 防重复请求
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await getCarDetail({
|
||||||
|
id: id.value
|
||||||
|
})
|
||||||
|
|
||||||
methods: {
|
const data = res.data
|
||||||
// 修改按钮事件(仅认证失败显示)
|
form.value = data
|
||||||
clickUpdate() {
|
console.log(form.value);
|
||||||
uni.setStorageSync('operationType', 'update')
|
} catch (err) {
|
||||||
uni.redirectTo({
|
uni.showToast({
|
||||||
url: '/pageSubPack/my/addCar?id=' + this.id,
|
title: `${err}`,
|
||||||
success: res => {},
|
icon: 'none'
|
||||||
fail: () => {},
|
})
|
||||||
complete: () => {}
|
console.error('列表接口报错:', err)
|
||||||
});
|
} finally {
|
||||||
},
|
|
||||||
|
|
||||||
// 删除按钮事件
|
}
|
||||||
onDelete() {
|
}
|
||||||
uni.showModal({
|
const clickUpdate = () => {
|
||||||
title: "确认删除",
|
uni.setStorageSync('operationType', 'update')
|
||||||
content: "确认删除此车辆信息吗?",
|
uni.redirectTo({
|
||||||
success: (res) => {
|
url: '/pageSubPack/my/addCar?id=' + id.value
|
||||||
if (res.confirm) {
|
})
|
||||||
|
}
|
||||||
|
|
||||||
uni.showLoading({
|
const onDelete = () => {
|
||||||
title: '删除中...',
|
uni.showModal({
|
||||||
mask: true
|
title: "确认删除",
|
||||||
});
|
content: "确认删除此车辆信息吗?",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
deleteCar({
|
||||||
|
carId: id.value
|
||||||
|
}).then(deleteRes => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (deleteRes.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.showToast({
|
goBack()
|
||||||
title: '删除成功',
|
}, 1500)
|
||||||
icon: 'success'
|
} else {
|
||||||
});
|
uni.showToast({
|
||||||
}, 1000);
|
title: deleteRes.msg || '删除失败',
|
||||||
setTimeout(() => {
|
icon: 'none'
|
||||||
// 提交成功后跳转列表页
|
})
|
||||||
uni.hideLoading();
|
|
||||||
this.goBack();
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
});
|
}
|
||||||
},
|
}
|
||||||
goBack() {
|
})
|
||||||
uni.redirectTo({
|
}
|
||||||
url: '/pageSubPack/my/myCarIndex',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/myCarIndex'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
@@ -166,11 +153,15 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.status-bar {
|
||||||
|
width: 100vw;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
.contentStyle {
|
.contentStyle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,126 +172,6 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 顶部状态区 */
|
|
||||||
.status-header {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
padding: 40rpx 30rpx 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-icon {
|
|
||||||
width: 80rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-success {
|
|
||||||
background-color: #e6f7ee;
|
|
||||||
border: 4rpx solid #00b42a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-pending {
|
|
||||||
background-color: #e6f0ff;
|
|
||||||
border: 4rpx solid #1677ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-fail {
|
|
||||||
background-color: #ffe7e7;
|
|
||||||
border: 4rpx solid #f53f3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-text {
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-success .icon-text {
|
|
||||||
color: #00b42a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-pending .icon-text {
|
|
||||||
color: #1677ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-fail .icon-text {
|
|
||||||
color: #f53f3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-title {
|
|
||||||
font-size: 30rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 步骤条 */
|
|
||||||
.step-bar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 0 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
position: relative;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-circle {
|
|
||||||
width: 40rpx;
|
|
||||||
height: 40rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #1677ff;
|
|
||||||
color: #fff;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 24rpx;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-item.active .step-circle {
|
|
||||||
background-color: #1677ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-item:not(.active) .step-circle {
|
|
||||||
background-color: #e5e5e5;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-text {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #666;
|
|
||||||
margin-top: 10rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-line {
|
|
||||||
position: absolute;
|
|
||||||
top: 20rpx;
|
|
||||||
left: 50%;
|
|
||||||
width: 100%;
|
|
||||||
height: 4rpx;
|
|
||||||
background-color: #e5e5e5;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-line.active {
|
|
||||||
background-color: #1677ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 信息卡片 */
|
|
||||||
.info-card {
|
.info-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
@@ -329,10 +200,6 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-row:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
.info-label {
|
||||||
width: 180rpx;
|
width: 180rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
@@ -345,12 +212,6 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-tag {
|
|
||||||
color: #ff7d00;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 身份证照片区 */
|
|
||||||
.photo-row {
|
.photo-row {
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -366,18 +227,14 @@
|
|||||||
|
|
||||||
.photo-item {
|
.photo-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
/* height: 170px; */
|
|
||||||
background-color: #f0f4ff;
|
background-color: #f0f4ff;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 底部按钮区 */
|
|
||||||
.bottom-btn-wrap {
|
.bottom-btn-wrap {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
|
|
||||||
/* background-color: #fff; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-modify {
|
.btn-modify {
|
||||||
@@ -401,57 +258,4 @@
|
|||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-delete.delete-only {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
|
||||||
.toast-mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-bar {
|
|
||||||
width: 100vw;
|
|
||||||
height: 46px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -4,161 +4,149 @@
|
|||||||
<uni-nav-bar title="我的车辆" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
<uni-nav-bar title="我的车辆" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
<!-- 我的车辆列表 -->
|
|
||||||
<view v-if="carList.length === 0" class="empty-state">
|
<view v-if="carList.length === 0" class="empty-state">
|
||||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||||
<text class="empty-text">
|
<text class="empty-text">暂无数据</text>
|
||||||
{{ '暂无数据'}}
|
|
||||||
</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="car-item" v-for="(item, index) in carList" :key="index" @click="handleItemClick(item,index)">
|
<view class="car-item" v-for="(item, index) in carList" :key="index" @click="handleItemClick(item, index)">
|
||||||
<!-- 左侧圆形占位 -->
|
<image :src="item.carImageUrl" mode="aspectFill" class="car-avatar"
|
||||||
<image :src="item.imgSrc" mode="aspectFill" class="car-avatar" @error="item.imgSrc = defaultCarImg" />
|
@error="item.carImageUrl = defaultCarImg" />
|
||||||
<!-- 中间车辆信息 -->
|
|
||||||
<view class="car-info">
|
<view class="car-info">
|
||||||
<view>
|
<view>
|
||||||
<view class="car-plate">{{ item.plate }}</view>
|
<view class="car-plate">{{ item.carNum }}</view>
|
||||||
<view class="car-model">{{ item.model }}·{{ item.color }}</view>
|
<view class="car-model">{{ item.carBrand }}·{{ item.carColor }}</view>
|
||||||
</view>
|
|
||||||
<view class="car-bindParkingSpace">{{ item.bindParkingSpace }}
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="car-bindParkingSpace">{{ item.bindParkingSpace }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- certificationStatus -->
|
||||||
<!-- 右侧状态标签 -->
|
|
||||||
<view class="status-tag"
|
<view class="status-tag"
|
||||||
:class="{ underReview: item.status === '审核中', unbound: item.status === '未绑定',bounded: item.status === '已绑定' }">
|
:class="{ underReview: item.certificationStatus === '审核中', unbound: item.certificationStatus === '未绑定', bounded: item.certificationStatus === ''}">
|
||||||
{{ item.status }}
|
{{ item.certificationStatus }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部添加车辆按钮 -->
|
|
||||||
<view class="bottom-btn">
|
<view class="bottom-btn">
|
||||||
<button class="confirm-btn" @click="addCar">添加车辆</button>
|
<button class="confirm-btn" @click="addCar">添加车辆</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
getMyCarList
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
const statusBarHeight = ref(20)
|
||||||
|
const defaultCarImg = "http://47.104.199.163:9090/images/propertyImgs/defaultCarImg.png"
|
||||||
|
const carList = ref([])
|
||||||
|
const loadingMore = ref(false)
|
||||||
|
const noMoreData = ref(false)
|
||||||
|
|
||||||
},
|
const pageNum = ref(1)
|
||||||
|
const pageSize = ref(10)
|
||||||
|
|
||||||
computed: {
|
// ==================== 上拉加载更多(页面生命周期) ====================
|
||||||
|
onReachBottom(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
// ==================== 下拉刷新 ====================
|
||||||
|
const refresh = () => {
|
||||||
|
// 重置所有状态
|
||||||
|
pageNum = 1
|
||||||
|
pageSize = 10
|
||||||
|
noMoreData = false
|
||||||
|
houseList = []
|
||||||
|
loadingMore = false
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
refresh()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 页面加载时请求第一页
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
const getList = async () => {
|
||||||
|
// 防重复请求
|
||||||
|
if (loadingMore.value || noMoreData.value) return
|
||||||
|
loadingMore.value = true
|
||||||
|
try {
|
||||||
|
const res = await getMyCarList({
|
||||||
|
pageNum: pageNum.value,
|
||||||
|
pageSize: pageSize.value,
|
||||||
|
residentId: uni.getStorageSync('userId')
|
||||||
|
})
|
||||||
|
|
||||||
},
|
const data = res
|
||||||
created() {
|
const newList = data.rows || []
|
||||||
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
onUnload() {
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
defaultCarImg: "http://47.104.199.163:9090/images/propertyImgs/defaultCarImg.png",
|
|
||||||
searchKey: "",
|
|
||||||
selectedId: '',
|
|
||||||
selectedName: '',
|
|
||||||
selectedIndex: -1, // 当前选中的索引
|
|
||||||
|
|
||||||
// 模拟车辆数据
|
|
||||||
carList: [
|
|
||||||
{
|
|
||||||
id: '1',
|
|
||||||
imgSrc: 'http://47.104.199.163:9090/images/propertyImgs/carImg.png',
|
|
||||||
plate: "京A88888",
|
|
||||||
model: "宝马X5",
|
|
||||||
color: "白色",
|
|
||||||
status: "未绑定",
|
|
||||||
bindParkingSpace: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
imgSrc: 'https://错误地址2.png',
|
|
||||||
plate: "京A88888",
|
|
||||||
model: "宝马X5",
|
|
||||||
color: "白色",
|
|
||||||
status: "已绑定",
|
|
||||||
bindParkingSpace: "北境碧桂园小区小区地下停车场B2A区202",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
imgSrc: 'https://错误地址3.png',
|
|
||||||
plate: "京A88888",
|
|
||||||
model: "宝马X5",
|
|
||||||
color: "白色",
|
|
||||||
status: "审核中",
|
|
||||||
bindParkingSpace: "",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
// 第一页 → 覆盖数据
|
||||||
|
if (pageNum.value === 1) {
|
||||||
|
carList.value = newList
|
||||||
|
} else {
|
||||||
|
// 后续页 → 追加数据
|
||||||
|
carList.value = [...carList.value, ...newList]
|
||||||
}
|
}
|
||||||
},
|
// 判断是否没有更多数据
|
||||||
methods: {
|
if (newList.length < pageSize.value) {
|
||||||
// 选择我的车辆
|
noMoreData.value = true
|
||||||
handleItemClick(item, index) {
|
} else {
|
||||||
uni.setStorageSync('operationType', 'update');
|
pageNum.value++
|
||||||
uni.redirectTo({
|
}
|
||||||
url: '/pageSubPack/my/carDetail?id=' + item.id + '&status=' + item.status,
|
} catch (err) {
|
||||||
success: res => {},
|
uni.showToast({
|
||||||
fail: () => {},
|
title: '加载失败',
|
||||||
complete: () => {}
|
icon: 'none'
|
||||||
});
|
})
|
||||||
|
console.error('列表接口报错:', err)
|
||||||
},
|
} finally {
|
||||||
|
loadingMore.value = false
|
||||||
// 添加车辆
|
uni.stopPullDownRefresh() // 关闭下拉刷新
|
||||||
addCar() {
|
}
|
||||||
uni.setStorageSync('operationType', 'add');
|
}
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addCar',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
},
|
const getStatusText = (status) => {
|
||||||
goBack() {
|
if (status === 0) return '未绑定'
|
||||||
uni.switchTab({
|
if (status === 1) return '已绑定'
|
||||||
url: '/pages/myIndex/myIndex',
|
if (status === 2) return '审核中'
|
||||||
success: res => {},
|
return '未绑定'
|
||||||
fail: () => {},
|
}
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
const handleItemClick = (item, index) => {
|
||||||
|
uni.setStorageSync('operationType', 'update')
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/carDetail?id=' + item.id + '&status=' + item.status
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const addCar = () => {
|
||||||
|
uni.setStorageSync('operationType', 'add')
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addCar'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/myIndex/myIndex'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #F3F8FD;
|
background: #F3F8FD;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// height: 100vh;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -167,7 +155,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,9 +165,6 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 空状态 */
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -197,95 +181,10 @@
|
|||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 底部按钮 */
|
|
||||||
.bottom-btn {
|
.bottom-btn {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 表单容器 */
|
|
||||||
.form-container {
|
|
||||||
padding: 60rpx 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 通用输入框样式 */
|
|
||||||
.input-item {
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-placeholder {
|
|
||||||
color: #999;
|
|
||||||
font-size: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 确定按钮 */
|
|
||||||
.submit-btn {
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
line-height: 88rpx;
|
|
||||||
background-color: #1677ff;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
border: none;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
|
||||||
.toast-mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style scoped>
|
|
||||||
/* 页面整体 */
|
|
||||||
|
|
||||||
/* ====================== 列表容器 ====================== */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================== 我的车辆卡片 ====================== */
|
|
||||||
/* 单个车辆项 */
|
|
||||||
.car-item {
|
.car-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -298,13 +197,6 @@
|
|||||||
width: calc(100% - 44rpx);
|
width: calc(100% - 44rpx);
|
||||||
}
|
}
|
||||||
|
|
||||||
.car-item.checked {
|
|
||||||
background: #f4f7ff;
|
|
||||||
/* 浅蓝色背景 */
|
|
||||||
border-color: #1677ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 左侧圆形头像占位 */
|
|
||||||
.car-avatar {
|
.car-avatar {
|
||||||
width: 100rpx;
|
width: 100rpx;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
@@ -314,7 +206,6 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 中间信息区域 */
|
|
||||||
.car-info {
|
.car-info {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -322,7 +213,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 车牌号 */
|
|
||||||
.car-plate {
|
.car-plate {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -331,7 +221,6 @@
|
|||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 车型+颜色 */
|
|
||||||
.car-model {
|
.car-model {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
@@ -342,18 +231,14 @@
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
/* 强制不换行 */
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* 超出部分隐藏 */
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
/* 超出显示省略号 */
|
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 状态标签 */
|
|
||||||
.status-tag {
|
.status-tag {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
padding: 6rpx14rpx;
|
padding: 6rpx 14rpx;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -362,26 +247,21 @@
|
|||||||
top: 30rpx;
|
top: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 未绑定状态 */
|
|
||||||
.status-tag.unbound {
|
.status-tag.unbound {
|
||||||
/* background-color: #e6f7e6; */
|
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 已绑定状态) */
|
|
||||||
.status-tag.bounded {
|
.status-tag.bounded {
|
||||||
color: #2F77FD;
|
color: #2F77FD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 审核中 */
|
|
||||||
.status-tag.underReview {
|
.status-tag.underReview {
|
||||||
/* background-color: #F8DDBD; */
|
|
||||||
color: #FF8F40;
|
color: #FF8F40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-tag.unpass {
|
||||||
/* ====================== 底部按钮 ====================== */
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
.confirm-btn {
|
.confirm-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -1,181 +1,172 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="我的车位" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
<uni-nav-bar title="我的车位" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
<view v-if="parkingSpaceList.length === 0" class="empty-state">
|
<view v-if="parkingSpaceList.length === 0" class="empty-state">
|
||||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||||
<text class="empty-text">
|
<text class="empty-text">暂无数据</text>
|
||||||
{{ '暂无数据'}}
|
|
||||||
</text>
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 车位列表 v-for 渲染 -->
|
|
||||||
<view class="parkingSpace-list">
|
<view class="parkingSpace-list">
|
||||||
<view class="parkingSpace-card" v-for="(item, index) in parkingSpaceList" :key="index"
|
<view class="parkingSpace-card" v-for="(item, index) in parkingSpaceList" :key="index"
|
||||||
@click="tapParkingSpace(item)">
|
@click="tapParkingSpace(item)">
|
||||||
<!-- 标题 + 状态 -->
|
|
||||||
<view class="card-header">
|
<view class="card-header">
|
||||||
<view class="title-box">
|
<view class="title-box">
|
||||||
<text class="parkingSpace-name">{{ item.parkingSpaceName }}</text>
|
<text class="parkingSpace-name">{{ item.villageName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="status-tag" :class="item.statusClass">{{ item.statusText }}</text>
|
<text class="status-tag"
|
||||||
|
:class="item.checkStatus=='0'?'pending':item.checkStatus=='1'?'success':item.checkStatus=='2'?'fail':''">{{ item.checkStatus=='0'?'未认证':item.checkStatus=='1'?'认证成功':item.checkStatus=='2'?'认证失败':'' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 车位信息 -->
|
|
||||||
<view class="card-body">
|
<view class="card-body">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="line">
|
<view class="line">
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="label">车位楼层</text>
|
<text class="label">车位楼层</text>
|
||||||
<view class="value-box">
|
<view class="value-box">
|
||||||
<text class="value">{{ item.floorNo }}</text>
|
<text class="value">{{ item.areaName }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line">
|
<view class="line">
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="label">车位编号</text>
|
<text class="label">车位编号</text>
|
||||||
<text class="value">{{ item.parkingSpaceNumber }}</text>
|
<text class="value">{{ item.parkingCode }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line">
|
<view class="line">
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="label">车位状态</text>
|
<text class="label">车位状态</text>
|
||||||
<text class="value">{{ item.parkingSpaceStatus }}</text>
|
<text class="value">{{ item.parkingStatus }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line">
|
<view class="line">
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="label">绑定车辆</text>
|
<text class="label">绑定车辆</text>
|
||||||
<text class="value">{{ item.bindCarNum }}</text>
|
<text class="value">{{ item.carNum }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<image src="http://47.104.199.163:9090/images/propertyImgs/myParkingSpace.png"
|
<image :src="item.carImageUrl?item.carImageUrl:'http://47.104.199.163:9090/images/propertyImgs/myParkingSpace.png'"
|
||||||
class="imgItem" mode="widthFix">
|
class="imgItem" mode="widthFix"></image>
|
||||||
</image>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<!-- 底部添加按钮 -->
|
|
||||||
<view class="bottom-btn">
|
<view class="bottom-btn">
|
||||||
<button class="add-btn" @click="addParkingSpace">添加车位</button>
|
<button class="add-btn" @click="addParkingSpace">添加车位</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
getCarList
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
|
||||||
},
|
const statusBarHeight = ref(20)
|
||||||
|
const parkingSpaceList = ref([])
|
||||||
|
|
||||||
computed: {
|
// ==================== 上拉加载更多(页面生命周期) ====================
|
||||||
|
onReachBottom(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
// ==================== 下拉刷新 ====================
|
||||||
|
const refresh = () => {
|
||||||
|
// 重置所有状态
|
||||||
|
pageNum = 1
|
||||||
|
pageSize = 10
|
||||||
|
noMoreData = false
|
||||||
|
parkingSpaceList = []
|
||||||
|
loadingMore = false
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
refresh()
|
||||||
|
})
|
||||||
|
|
||||||
},
|
// 页面加载时请求第一页
|
||||||
created() {
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
},
|
const loadingMore = ref(false)
|
||||||
onShow() {
|
const noMoreData = ref(false)
|
||||||
|
|
||||||
},
|
const pageNum = ref(1)
|
||||||
onUnload() {
|
const pageSize = ref(10)
|
||||||
// 页面卸载时清除定时器
|
// ==================== 获取列表数据 ====================
|
||||||
if (this.timer) clearInterval(this.timer)
|
const getList = async () => {
|
||||||
},
|
// 防重复请求
|
||||||
mounted() {},
|
if (loadingMore.value || noMoreData.value) return
|
||||||
data() {
|
loadingMore.value = true
|
||||||
return {
|
try {
|
||||||
/* 设定状态栏默认高度 */
|
const res = await getCarList({
|
||||||
statusBarHeight: 20,
|
pageNum: pageNum.value,
|
||||||
parkingSpaceList: [{
|
pageSize: pageSize.value,
|
||||||
id: 1,
|
residentId: uni.getStorageSync('userId')
|
||||||
parkingSpaceName: "北境碧桂园小区地下停车场",
|
})
|
||||||
floorNo: "B2",
|
|
||||||
parkingSpaceNumber: "202",
|
|
||||||
parkingSpaceStatus: "租赁",
|
|
||||||
bindCarNum: '京A88888',
|
|
||||||
statusText: "认证成功",
|
|
||||||
statusClass: "success",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
parkingSpaceName: "北境碧桂园小区停车场",
|
|
||||||
floorNo: "B2",
|
|
||||||
parkingSpaceNumber: "202",
|
|
||||||
parkingSpaceStatus: "自用",
|
|
||||||
bindCarNum: '京A88888',
|
|
||||||
statusText: "认证中",
|
|
||||||
statusClass: "pending",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
parkingSpaceName: "北境碧桂园小区停车场",
|
|
||||||
floorNo: "2号楼1层",
|
|
||||||
floorNo: "B2",
|
|
||||||
parkingSpaceNumber: "202",
|
|
||||||
parkingSpaceStatus: "闲置",
|
|
||||||
bindCarNum: '京A88888',
|
|
||||||
statusText: "认证失败",
|
|
||||||
statusClass: "fail",
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
|
const data = res
|
||||||
|
const newList = data.rows || []
|
||||||
|
|
||||||
|
// 第一页 → 覆盖数据
|
||||||
|
if (pageNum.value === 1) {
|
||||||
|
parkingSpaceList.value = newList
|
||||||
|
} else {
|
||||||
|
// 后续页 → 追加数据
|
||||||
|
parkingSpaceList.value = [...parkingSpaceList.value, ...newList]
|
||||||
}
|
}
|
||||||
},
|
// 判断是否没有更多数据
|
||||||
|
if (newList.length < pageSize.value) {
|
||||||
|
noMoreData.value = true
|
||||||
|
} else {
|
||||||
|
pageNum.value++
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '加载失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
console.error('列表接口报错:', err)
|
||||||
|
} finally {
|
||||||
|
loadingMore.value = false
|
||||||
|
uni.stopPullDownRefresh() // 关闭下拉刷新
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tapParkingSpace = (item) => {
|
||||||
|
console.log(item);
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/parkingSpaceDetail?id=' + item.parkingId + '&statusClass=' + item.checkStatus
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
methods: {
|
const addParkingSpace = () => {
|
||||||
tapParkingSpace(item) {
|
uni.setStorageSync('operationType', 'add')
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pageSubPack/my/parkingSpaceDetail?id=' + item.id + '&statusClass=' + item.statusClass,
|
url: '/pageSubPack/my/addParkingSpace'
|
||||||
success: res => {},
|
})
|
||||||
fail: () => {},
|
}
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
addParkingSpace() {
|
|
||||||
uni.setStorageSync('operationType', 'add');
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addParkingSpace',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
goBack() {
|
|
||||||
uni.switchTab({
|
|
||||||
url: '/pages/myIndex/myIndex',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/myIndex/myIndex'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #F9F9F9;
|
background: #F9F9F9;
|
||||||
@@ -183,11 +174,15 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.status-bar {
|
||||||
|
width: 100vw;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
.contentStyle {
|
.contentStyle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +193,6 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 空状态 */
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -215,14 +209,10 @@
|
|||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 底部按钮 */
|
|
||||||
.bottom-btn {
|
.bottom-btn {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 列表 */
|
|
||||||
.parkingSpace-list {}
|
|
||||||
|
|
||||||
.parkingSpace-card {
|
.parkingSpace-card {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
@@ -230,10 +220,8 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 头部 */
|
|
||||||
.card-header {
|
.card-header {
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
/* border-bottom: 1rpx solid #f0f0f0; */
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -251,12 +239,8 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 状态标签 */
|
|
||||||
.status-tag {
|
.status-tag {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
padding: 4rpx 16rpx;
|
padding: 4rpx 16rpx;
|
||||||
@@ -280,7 +264,6 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 内容行 */
|
|
||||||
.card-body {
|
.card-body {
|
||||||
padding: 0rpx 30rpx 30rpx 30rpx;
|
padding: 0rpx 30rpx 30rpx 30rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -292,16 +275,11 @@
|
|||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
@@ -316,19 +294,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
|
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.set-default {
|
|
||||||
color: #007aff;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.add-btn {
|
.add-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
@@ -349,9 +318,4 @@
|
|||||||
.imgItem {
|
.imgItem {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-bar {
|
|
||||||
width: 100vw;
|
|
||||||
height: 46px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -1,20 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="车位详情" left-icon="left" @clickLeft="goBack" :border="false" backgroundColor="transparent">
|
<uni-nav-bar title="车位详情" left-icon="left" @clickLeft="goBack" :border="false" backgroundColor="transparent">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
|
|
||||||
<scroll-view class="page" scroll-y="true">
|
<scroll-view class="page" scroll-y="true">
|
||||||
|
|
||||||
<!-- 顶部状态区 -->
|
|
||||||
<view class="status-header">
|
<view class="status-header">
|
||||||
<view class="status-icon" :class="statusConfig.iconClass">
|
<view class="status-icon" :class="statusConfig.iconClass">
|
||||||
<text class="icon-text">{{ statusConfig.iconText }}</text>
|
<text class="icon-text">{{ statusConfig.iconText }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="status-title">{{ statusConfig.title }}</text>
|
<text class="status-title">{{ statusConfig.title }}</text>
|
||||||
|
|
||||||
<!-- 步骤条 -->
|
|
||||||
<view class="step-bar">
|
<view class="step-bar">
|
||||||
<view class="step-item" v-for="(step, index) in stepList" :key="index"
|
<view class="step-item" v-for="(step, index) in stepList" :key="index"
|
||||||
:class="{ active: index < currentStep, done: index < currentStep - 1 }">
|
:class="{ active: index < currentStep, done: index < currentStep - 1 }">
|
||||||
@@ -26,7 +21,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 房屋信息 -->
|
|
||||||
<view class="info-card">
|
<view class="info-card">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
<view class="title-line"></view>
|
<view class="title-line"></view>
|
||||||
@@ -34,197 +28,242 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">小区</text>
|
<text class="info-label">小区</text>
|
||||||
<text class="info-value">{{form.community}}</text>
|
<text class="info-value">{{ form.villageName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">停车场</text>
|
<text class="info-label">停车场</text>
|
||||||
<text class="info-value">{{form.parkingSpace}}</text>
|
<text class="info-value">{{ form.areaName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">车位编号</text>
|
<text class="info-label">车位编号</text>
|
||||||
<text class="info-value">{{form.parkingSpaceNum}}</text>
|
<text class="info-value">{{ form.parkingCode }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">车位状态</text>
|
<text class="info-label">车位状态</text>
|
||||||
<text class="info-value"
|
<text class="info-value"
|
||||||
:style="{color: form.status === '自用' ? '#FF8F40' : form.status === '租赁' ? '#00aa00' : '#999' }">{{form.status}}</text>
|
:style="{color: form.parkingStatus === '0' ? '#00aa00' : form.parkingStatus === '1' ? '#FF8F40' : '#999' }">{{ form.parkingStatus === '0' ? '闲置' : form.parkingStatus === '1' ? '自用' : '租赁' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 车辆信息 -->
|
<view class="info-card" v-if="form.carId">
|
||||||
<view class="info-card">
|
<view class="card-title">
|
||||||
|
<view class="title-line"></view>
|
||||||
|
车辆信息
|
||||||
|
<text class="unbind" @click="clickUnbind">取消绑定</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-row">
|
||||||
|
<text class="info-label">车牌号</text>
|
||||||
|
<text class="info-value">{{ form.carNum }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-row">
|
||||||
|
<text class="info-label">车辆品牌</text>
|
||||||
|
<text class="info-value">{{ form.carBrand }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-row">
|
||||||
|
<text class="info-label">车辆型号</text>
|
||||||
|
<text class="info-value">{{ form.carModel }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-row">
|
||||||
|
<text class="info-label">车辆颜色</text>
|
||||||
|
<text class="info-value">{{ form.carColor }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="empty-card" v-if="!form.carId">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
<view class="title-line"></view>
|
<view class="title-line"></view>
|
||||||
车辆信息
|
车辆信息
|
||||||
</view>
|
</view>
|
||||||
<text class="unbind" @click="clickUnbind(item.id)">取消绑定</text>
|
<view class="empty-state">
|
||||||
<view class="info-row">
|
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||||
<text class="info-label">车牌号</text>
|
<text class="empty-text">暂无绑定车辆</text>
|
||||||
<text class="info-value">{{form.carNum}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
|
||||||
<text class="info-label">车辆品牌</text>
|
|
||||||
<text class="info-value">{{form.carBrand}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="info-row">
|
|
||||||
<text class="info-label">车辆型号</text>
|
|
||||||
<text class="info-value">{{form.carModel}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="info-row">
|
|
||||||
<text class="info-label">车辆颜色</text>
|
|
||||||
<text class="info-value">{{form.carColor}}</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部操作按钮 -->
|
|
||||||
<view class="bottom-btn-wrap">
|
<view class="bottom-btn-wrap">
|
||||||
<!-- 仅认证失败显示修改按钮 -->
|
<button class="btn-modify" @click="onModify">修改</button>
|
||||||
<button class="btn-modify" @click="onModify">
|
<button class="btn-delete" :class="{ 'delete-only': currentStatus !== 'fail' }"
|
||||||
修改
|
@click="onDelete">删除</button>
|
||||||
</button>
|
|
||||||
<button class="btn-delete" :class="{ 'delete-only': currentStatus !== 'fail' }" @click="onDelete">
|
|
||||||
删除
|
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
computed,
|
||||||
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onPullDownRefresh,
|
||||||
|
onLoad,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
getUserParkingSpaceList,
|
||||||
|
rebindCar,
|
||||||
|
deleteParking,
|
||||||
|
getParkingDetail
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
|
||||||
|
const statusBarHeight = ref(20)
|
||||||
|
const id = ref(undefined)
|
||||||
|
const currentStatus = ref('')
|
||||||
|
// parkingId
|
||||||
|
const form = ref({
|
||||||
|
community: "",
|
||||||
|
parkingSpace: "",
|
||||||
|
parkingSpaceNum: "",
|
||||||
|
status: '',
|
||||||
|
carNum: "",
|
||||||
|
carBrand: "",
|
||||||
|
carModel: "",
|
||||||
|
carColor: "",
|
||||||
|
carId:''
|
||||||
|
})
|
||||||
|
const stepList = ["车位信息", "物业审核", "认证成功"]
|
||||||
|
const statusMap = {
|
||||||
|
success: {
|
||||||
|
title: "车位认证成功",
|
||||||
|
iconClass: "icon-success",
|
||||||
|
iconText: "✓",
|
||||||
|
currentStep: 3
|
||||||
},
|
},
|
||||||
computed: {
|
pending: {
|
||||||
// 动态计算当前状态配置
|
title: "车位审核中,请耐心等待",
|
||||||
statusConfig() {
|
iconClass: "icon-pending",
|
||||||
return this.statusMap[this.currentStatus];
|
iconText: "⏳",
|
||||||
},
|
currentStep: 2
|
||||||
// 动态计算当前步骤
|
|
||||||
currentStep() {
|
|
||||||
return this.statusConfig.currentStep;
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
fail: {
|
||||||
created() {
|
title: "车位认证失败,请重新提交",
|
||||||
|
iconClass: "icon-fail",
|
||||||
|
iconText: "✕",
|
||||||
|
currentStep: 2
|
||||||
},
|
},
|
||||||
onShow() {
|
}
|
||||||
|
|
||||||
},
|
const statusConfig = computed(() => statusMap[currentStatus.value] || statusMap.pending)
|
||||||
onLoad(option) {
|
const currentStep = computed(() => statusConfig.value.currentStep)
|
||||||
this.id = option.id;
|
onLoad((option) => {
|
||||||
this.currentStatus = option.statusClass;
|
console.log(option);
|
||||||
// this.currentStatus = 'success';
|
id.value = option.id
|
||||||
|
currentStatus.value = option.statusClass == '0' ? 'pending' : option.statusClass == '1' ?
|
||||||
|
'success' : option.statusClass == '2' ? 'fail' : ''
|
||||||
|
loadParkingSpaceDetail()
|
||||||
|
|
||||||
},
|
})
|
||||||
mounted() {},
|
onMounted(() => {
|
||||||
data() {
|
|
||||||
return {
|
})
|
||||||
/* 设定状态栏默认高度 */
|
const loadParkingSpaceDetail = async () => {
|
||||||
statusBarHeight: 20,
|
// 防重复请求
|
||||||
// 可通过页面传参动态修改状态:success / pending / fail
|
|
||||||
id: undefined,
|
try {
|
||||||
form: {
|
const res = await getParkingDetail({
|
||||||
community: "北境碧桂园小区小区",
|
id: id.value
|
||||||
parkingSpace: "地下停车场",
|
})
|
||||||
parkingSpaceNum: "02",
|
|
||||||
status: '自用',
|
const data = res.data
|
||||||
carNum: "京A88888",
|
form.value = data
|
||||||
carBrand: "宝马",
|
console.log(form.value);
|
||||||
carModel: "X5",
|
} catch (err) {
|
||||||
carColor: "白色",
|
uni.showToast({
|
||||||
},
|
title: `${err}`,
|
||||||
currentStatus: "",
|
icon: 'none'
|
||||||
stepList: ["车位信息", "物业审核", "认证成功"],
|
})
|
||||||
// 状态配置表
|
console.error('列表接口报错:', err)
|
||||||
statusMap: {
|
} finally {
|
||||||
success: {
|
|
||||||
title: "车位认证成功",
|
}
|
||||||
iconClass: "icon-success",
|
}
|
||||||
iconText: "✓",
|
|
||||||
currentStep: 3,
|
|
||||||
},
|
|
||||||
pending: {
|
|
||||||
title: "车位审核中,请耐心等待",
|
|
||||||
iconClass: "icon-pending",
|
|
||||||
iconText: "⏳",
|
|
||||||
currentStep: 2,
|
|
||||||
},
|
|
||||||
fail: {
|
|
||||||
title: "车位认证失败,请重新提交",
|
|
||||||
iconClass: "icon-fail",
|
|
||||||
iconText: "✕",
|
|
||||||
currentStep: 2,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
const clickUnbind = () => {
|
||||||
},
|
uni.showModal({
|
||||||
|
title: "确认取消绑定",
|
||||||
|
content: "确认取消绑定该车辆吗?",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '解绑中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
rebindCar({
|
||||||
|
parkingId: id.value,
|
||||||
|
residentId:uni.getStorageSync('userId'),
|
||||||
|
carId:'',
|
||||||
|
|
||||||
|
}).then(unbindRes => {
|
||||||
methods: {
|
uni.hideLoading()
|
||||||
clickUnbind(id) {
|
if (unbindRes.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
},
|
title: '解绑成功',
|
||||||
// 修改按钮事件(仅认证失败显示)
|
icon: 'success'
|
||||||
onModify() {
|
})
|
||||||
uni.setStorageSync('operationType', 'update');
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addParkingSpace?id=' + this.id + '&sourcePage=' + 'addParkingSpace',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 删除按钮事件
|
|
||||||
onDelete() {
|
|
||||||
uni.showModal({
|
|
||||||
title: "确认删除",
|
|
||||||
content: "确认删除此车位信息吗?",
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '删除中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.showToast({
|
goBack()
|
||||||
title: '删除成功',
|
}, 1500)
|
||||||
icon: 'success'
|
} else {
|
||||||
});
|
uni.showToast({
|
||||||
}, 1000);
|
title: unbindRes.msg || '解绑失败',
|
||||||
setTimeout(() => {
|
icon: 'none'
|
||||||
// 提交成功后跳转列表页
|
})
|
||||||
uni.hideLoading();
|
|
||||||
this.goBack();
|
|
||||||
}, 2500);
|
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
});
|
}
|
||||||
},
|
}
|
||||||
goBack() {
|
})
|
||||||
uni.redirectTo({
|
}
|
||||||
url: '/pageSubPack/my/myParkingSpaceIndex',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
const onModify = () => {
|
||||||
|
uni.setStorageSync('operationType', 'update')
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addParkingSpace?id=' + id.value + '&sourcePage=addParkingSpace'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const onDelete = () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: "确认删除",
|
||||||
|
content: "确认删除此车位信息吗?",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
deleteParking({
|
||||||
|
parkingId: id.value
|
||||||
|
}).then(deleteRes => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (deleteRes.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
goBack()
|
||||||
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: deleteRes.msg || '删除失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/myParkingSpaceIndex'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
@@ -232,11 +271,15 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.status-bar {
|
||||||
|
width: 100vw;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
.contentStyle {
|
.contentStyle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,9 +290,6 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 顶部状态区 */
|
|
||||||
.status-header {
|
.status-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -282,18 +322,6 @@
|
|||||||
.icon-text {
|
.icon-text {
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-success .icon-text {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-pending .icon-text {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-fail .icon-text {
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +332,6 @@
|
|||||||
margin-bottom: 40rpx;
|
margin-bottom: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 步骤条 */
|
|
||||||
.step-bar {
|
.step-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -364,9 +391,7 @@
|
|||||||
background-color: #1677ff;
|
background-color: #1677ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 信息卡片 */
|
|
||||||
.info-card {
|
.info-card {
|
||||||
/* margin: 0 30rpx 30rpx; */
|
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
border: 1rpx solid #f0f0f0;
|
border: 1rpx solid #f0f0f0;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
@@ -374,6 +399,30 @@
|
|||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty-card {
|
||||||
|
padding: 20rpx;
|
||||||
|
border: 1rpx solid #f0f0f0;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 70rpx 0;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -397,10 +446,6 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-row:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
.info-label {
|
||||||
width: 180rpx;
|
width: 180rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
@@ -411,35 +456,18 @@
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-tag {
|
.unbind {
|
||||||
color: #ff7d00;
|
color: #1677ff;
|
||||||
font-weight: 500;
|
font-size: 28rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: auto;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 身份证照片区 */
|
|
||||||
.photo-row {
|
|
||||||
margin-top: 30rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20rpx;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-item {
|
|
||||||
width: 100%;
|
|
||||||
height: 170px;
|
|
||||||
background-color: #f0f4ff;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 底部按钮区 */
|
|
||||||
.bottom-btn-wrap {
|
.bottom-btn-wrap {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -471,53 +499,4 @@
|
|||||||
.btn-delete.delete-only {
|
.btn-delete.delete-only {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
|
||||||
.toast-mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-bar {
|
|
||||||
width: 100vw;
|
|
||||||
height: 46px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -33,93 +33,141 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted,
|
||||||
|
|
||||||
},
|
} from 'vue'
|
||||||
computed: {
|
import {
|
||||||
// 过滤后的列表(搜索功能)
|
onReachBottom,
|
||||||
filteredList() {
|
onPullDownRefresh
|
||||||
if (!this.searchKey.trim()) {
|
} from '@dcloudio/uni-app'
|
||||||
return this.carBrandList
|
import {
|
||||||
}
|
getSystemDictData
|
||||||
return this.carBrandList.filter(item =>
|
} from '/pageSubPack/api/apiSub.js'
|
||||||
item.name.includes(this.searchKey.trim())
|
|
||||||
)
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
},
|
/* 设定状态栏默认高度 */
|
||||||
|
const statusBarHeight = ref(20)
|
||||||
|
const searchKey = ref('')
|
||||||
|
const carBrandList = ref()
|
||||||
|
const loadingMore = ref(false)
|
||||||
|
const noMoreData = ref(false)
|
||||||
|
|
||||||
created() {
|
const pageNum = ref(1)
|
||||||
|
const pageSize = ref(10)
|
||||||
|
// ==================== 获取列表数据 ====================
|
||||||
|
const getList = async () => {
|
||||||
|
// 防重复请求
|
||||||
|
|
||||||
},
|
if (loadingMore.value || noMoreData.value) return
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
loadingMore.value = true
|
||||||
onUnload() {
|
try {
|
||||||
|
const res = await getSystemDictData({
|
||||||
|
pageNum: pageNum.value,
|
||||||
|
pageSize: pageSize.value,
|
||||||
|
dictType: 'user_car_brand'
|
||||||
|
})
|
||||||
|
|
||||||
},
|
const data = res
|
||||||
onLoad(option) {
|
const newList = data.rows || []
|
||||||
|
|
||||||
},
|
// 第一页 → 覆盖数据
|
||||||
mounted() {},
|
if (pageNum.value === 1) {
|
||||||
data() {
|
carBrandList.value = newList
|
||||||
return {
|
} else {
|
||||||
/* 设定状态栏默认高度 */
|
// 后续页 → 追加数据
|
||||||
statusBarHeight: 20,
|
carBrandList.value = [...carBrandList.value, ...newList]
|
||||||
searchKey: '',
|
|
||||||
carBrandList: [{
|
|
||||||
id: 1,
|
|
||||||
name: '宝马'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '奥迪'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
// 判断是否没有更多数据
|
||||||
|
if (newList.length < pageSize.value) {
|
||||||
|
noMoreData.value = true
|
||||||
methods: {
|
} else {
|
||||||
// 搜索输入事件
|
pageNum.value++
|
||||||
onSearch() {
|
}
|
||||||
// 实时过滤,computed 自动处理
|
} catch (err) {
|
||||||
},
|
uni.showToast({
|
||||||
|
title: '加载失败',
|
||||||
// 选择小区
|
icon: 'none'
|
||||||
selectCarBrand(item) {
|
})
|
||||||
uni.setStorageSync('carBrandId', item.id);
|
console.error('列表接口报错:', err)
|
||||||
uni.setStorageSync('carBrandName', item.name);
|
} finally {
|
||||||
|
loadingMore.value = false
|
||||||
uni.redirectTo({
|
uni.stopPullDownRefresh() // 关闭下拉刷新
|
||||||
url: '/pageSubPack/my/addCar',
|
}
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
goBackAdd() {
|
|
||||||
uni.removeStorageSync('carBrandId');
|
|
||||||
uni.removeStorageSync('carBrandName');
|
|
||||||
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addCar',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 上拉加载更多(页面生命周期) ====================
|
||||||
|
onReachBottom(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
// ==================== 下拉刷新 ====================
|
||||||
|
const refresh = () => {
|
||||||
|
// 重置所有状态
|
||||||
|
pageNum = 1
|
||||||
|
pageSize = 10
|
||||||
|
noMoreData = false
|
||||||
|
carBrandList = []
|
||||||
|
loadingMore = false
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
refresh()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 页面加载时请求第一页
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 过滤后的列表(搜索功能)
|
||||||
|
const filteredList = computed(() => {
|
||||||
|
if (!searchKey.value.trim()) {
|
||||||
|
return carBrandList.value
|
||||||
|
}
|
||||||
|
return carBrandList.value.filter(item =>
|
||||||
|
item.name.includes(searchKey.value.trim())
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 搜索输入事件
|
||||||
|
const onSearch = () => {
|
||||||
|
// 实时过滤,computed 自动处理
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择小区
|
||||||
|
const selectCarBrand = (item) => {
|
||||||
|
uni.setStorageSync('carBrandId', item.id);
|
||||||
|
uni.setStorageSync('carBrandName', item.name);
|
||||||
|
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addCar',
|
||||||
|
success: res => {},
|
||||||
|
fail: () => {},
|
||||||
|
complete: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const goBackAdd = () => {
|
||||||
|
uni.removeStorageSync('carBrandId');
|
||||||
|
uni.removeStorageSync('carBrandName');
|
||||||
|
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addCar',
|
||||||
|
success: res => {},
|
||||||
|
fail: () => {},
|
||||||
|
complete: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow(() => {})
|
||||||
|
|
||||||
|
onUnload(() => {})
|
||||||
|
|
||||||
|
onMounted(() => {})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
|
|||||||
@@ -1,254 +1,166 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar :title="'选择'+checkType" left-icon="left" @clickLeft="goBackAdd" backgroundColor="transparent"
|
<uni-nav-bar :title="'选择' + checkType" left-icon="left" @clickLeft="goBackAdd" backgroundColor="transparent"
|
||||||
:border="false">
|
:border="false">
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
<scroll-view class="page" scroll-y>
|
<scroll-view class="page" scroll-y>
|
||||||
<!-- 停车场网格列表 -->
|
|
||||||
|
|
||||||
<view class="parkingLot-grid">
|
|
||||||
<view v-if="dataList.length === 0" class="empty-state">
|
<view v-if="dataList.length === 0" class="empty-state">
|
||||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||||
<text class="empty-text">
|
<text class="empty-text">暂无数据</text>
|
||||||
{{ '暂无数据'}}
|
|
||||||
</text>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="parkingLot-grid">
|
||||||
<view class="parkingLot-item"
|
<view class="parkingLot-item"
|
||||||
:class="{ active:(checkType=='停车场'&& selectedParkingLot === item.id)||(checkType=='车位编号'&& selectedParkingSpace === item.id)}"
|
:class="{ active: (checkType == '停车场' && selectedParkingLot === item.id) || (checkType == '车位编号' && selectedParkingSpace === item.id) }"
|
||||||
v-for="(item, index) in dataList" :key="index" @click="selectedParking(item)">
|
v-for="(item, index) in dataList" :key="index" @click="selectedParking(item)">
|
||||||
<text class="parkingLot-text">{{ item.name }}</text>
|
<text class="parkingLot-text">{{ item.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import {
|
||||||
onReady: function(e) {},
|
ref,
|
||||||
components: {
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
getResidentCarAreaManageAreaListByVillageId,
|
||||||
|
getResidentCarAreaManageParkingListByAreaId
|
||||||
|
} from '@/pageSubPack/api/apiSub.js'
|
||||||
|
|
||||||
},
|
const statusBarHeight = ref(20)
|
||||||
|
const checkType = ref('')
|
||||||
|
const dataList = ref([])
|
||||||
|
const selectedParkingLot = ref(uni.getStorageSync('parkingLotId'))
|
||||||
|
const selectedParkingSpace = ref(uni.getStorageSync('parkingSpaceId'))
|
||||||
|
|
||||||
computed: {
|
onMounted(() => {
|
||||||
|
checkType.value = uni.getStorageSync('checkType')
|
||||||
|
if (checkType.value == '停车场') {
|
||||||
},
|
loadAreaList()
|
||||||
created() {
|
} else if (checkType.value == '车位编号') {
|
||||||
|
loadParkingList()
|
||||||
},
|
}
|
||||||
onShow() {
|
})
|
||||||
|
|
||||||
},
|
|
||||||
onUnload() {},
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
if (this.checkType == '停车场') {
|
|
||||||
this.dataList = this.parkingLotList
|
|
||||||
|
|
||||||
} else if (this.checkType == '车位编号') {
|
|
||||||
this.dataList = this.parkingSpaceList
|
|
||||||
|
|
||||||
|
const loadAreaList = () => {
|
||||||
|
let communityId = uni.getStorageSync('communityId')
|
||||||
|
if (!communityId) return
|
||||||
|
getResidentCarAreaManageAreaListByVillageId({
|
||||||
|
villageId: communityId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
dataList.value = (res.rows || []).map(item => {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
name: item.name || item.areaName || ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
uni.showToast({
|
||||||
|
title: `${res.msg}`,
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
data() {
|
}
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
checkType: uni.getStorageSync('checkType'),
|
|
||||||
dataList: [],
|
|
||||||
// 停车场列表(可动态生成/接口返回)
|
|
||||||
parkingLotList: [{
|
|
||||||
id: 1,
|
|
||||||
name: '地上停车场'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '地下停车场'
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
parkingSpaceList: [{
|
|
||||||
id: 13,
|
|
||||||
name: '01'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 14,
|
|
||||||
name: '02'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 15,
|
|
||||||
name: '03'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 16,
|
|
||||||
name: '04'
|
|
||||||
}, {
|
|
||||||
id: 17,
|
|
||||||
name: '05'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 18,
|
|
||||||
name: '06'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 19,
|
|
||||||
name: '07'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 20,
|
|
||||||
name: '08'
|
|
||||||
}, {
|
|
||||||
id: 21,
|
|
||||||
name: '09'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 22,
|
|
||||||
name: '10'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 23,
|
|
||||||
name: '11'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 24,
|
|
||||||
name: '12'
|
|
||||||
}, {
|
|
||||||
id: 25,
|
|
||||||
name: '13'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 26,
|
|
||||||
name: '14'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 27,
|
|
||||||
name: '15'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 28,
|
|
||||||
name: '16'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 29,
|
|
||||||
name: '17'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 30,
|
|
||||||
name: '18'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 31,
|
|
||||||
name: '19'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 32,
|
|
||||||
name: '20'
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
// 选中的停车场
|
|
||||||
selectedParkingLot: uni.getStorageSync('parkingLotId'),
|
|
||||||
// 选中的车位编号
|
|
||||||
selectedParkingSpace: uni.getStorageSync('parkingSpaceId'),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const loadParkingList = () => {
|
||||||
|
let parkingLotId = uni.getStorageSync('parkingLotId')
|
||||||
|
if (!parkingLotId) return
|
||||||
|
getResidentCarAreaManageParkingListByAreaId({
|
||||||
|
areaId: parkingLotId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
dataList.value = (res.rows || []).map(item => {
|
||||||
|
console.log(item);
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
name: item.name || item.parkingCode || ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
uni.showToast({
|
||||||
|
title: `${res.msg}`,
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
methods: {
|
}
|
||||||
selectedParking(item) {
|
|
||||||
if (this.checkType == '停车场') {
|
|
||||||
this.selectedParkingLot = item.id
|
|
||||||
} else if (this.checkType == '车位编号') {
|
|
||||||
this.selectedParkingSpace = item.id
|
|
||||||
|
|
||||||
}
|
const selectedParking = (item) => {
|
||||||
let modalContent = '确认选择此' + this.checkType + '吗?'
|
if (checkType.value == '停车场') {
|
||||||
uni.showModal({
|
selectedParkingLot.value = item.id
|
||||||
title: "确认选择",
|
} else if (checkType.value == '车位编号') {
|
||||||
content: modalContent,
|
selectedParkingSpace.value = item.id
|
||||||
success: (res) => {
|
}
|
||||||
if (res.confirm) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '选择中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '选择成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
if (this.checkType == '停车场') {
|
|
||||||
uni.setStorageSync('parkingLotId', item.id);
|
|
||||||
uni.setStorageSync('parkingLotName', item.name);
|
|
||||||
uni.removeStorageSync('parkingSpaceId');
|
|
||||||
uni.removeStorageSync('parkingSpaceName');
|
|
||||||
uni.setStorageSync('checkType', '车位编号');
|
|
||||||
} else if (this.checkType == '车位编号') {
|
|
||||||
uni.setStorageSync('parkingSpaceId', item.id);
|
|
||||||
uni.setStorageSync('parkingSpaceName', item.name);
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
setTimeout(() => {
|
|
||||||
// 提交成功后跳转列表页
|
|
||||||
uni.hideLoading();
|
|
||||||
this.goFreash()
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
title: "确认选择",
|
||||||
|
content: '确认选择此' + checkType.value + '吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '选择中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '选择成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
console.log(checkType.value);
|
||||||
|
|
||||||
|
if (checkType.value == '停车场') {
|
||||||
|
uni.setStorageSync('parkingLotId', item.id)
|
||||||
|
uni.setStorageSync('parkingLotName', item.name)
|
||||||
|
uni.removeStorageSync('parkingSpaceId')
|
||||||
|
uni.removeStorageSync('parkingSpaceName')
|
||||||
|
uni.setStorageSync('checkType', '车位编号')
|
||||||
|
} else if (checkType.value == '车位编号') {
|
||||||
|
console.log(item.id);
|
||||||
|
uni.setStorageSync('parkingSpaceId', item.id)
|
||||||
|
uni.setStorageSync('parkingSpaceName', item.name)
|
||||||
}
|
}
|
||||||
},
|
}, 1000)
|
||||||
});
|
setTimeout(() => {
|
||||||
|
uni.hideLoading()
|
||||||
},
|
goFreash()
|
||||||
goFreash() {
|
}, 2500)
|
||||||
if (this.checkType != '车位编号') {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/selectParingLot',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/addParkingSpace',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
goBackAdd() {
|
|
||||||
if (this.checkType == '停车场') {
|
|
||||||
uni.removeStorageSync('parkingLotId');
|
|
||||||
uni.removeStorageSync('parkingLotName');
|
|
||||||
} else if (this.checkType == '车位编号') {
|
|
||||||
uni.removeStorageSync('parkingSpaceId');
|
|
||||||
uni.removeStorageSync('parkingSpaceName');
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
uni.redirectTo({
|
const goFreash = () => {
|
||||||
url: '/pageSubPack/my/addParkingSpace',
|
if (checkType.value != '车位编号') {
|
||||||
success: res => {},
|
uni.redirectTo({
|
||||||
fail: () => {},
|
url: '/pageSubPack/my/selectParingLot'
|
||||||
complete: () => {}
|
})
|
||||||
});
|
} else {
|
||||||
},
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addParkingSpace'
|
||||||
},
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const goBackAdd = () => {
|
||||||
|
if (checkType.value == '停车场') {
|
||||||
|
uni.removeStorageSync('parkingLotId')
|
||||||
|
uni.removeStorageSync('parkingLotName')
|
||||||
|
} else if (checkType.value == '车位编号') {
|
||||||
|
uni.removeStorageSync('parkingSpaceId')
|
||||||
|
uni.removeStorageSync('parkingSpaceName')
|
||||||
|
}
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/addParkingSpace'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
|
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
|
||||||
@@ -258,12 +170,15 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.status-bar {
|
||||||
|
width: 100vw;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
.contentStyle {
|
.contentStyle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
|
||||||
/* background-color: #fff; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
@@ -273,21 +188,13 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 底部按钮 */
|
|
||||||
.bottom-btn {
|
|
||||||
padding: 20rpx 30rpx 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 网格布局:3列 */
|
|
||||||
.parkingLot-grid {
|
.parkingLot-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
gap: 30rpx;
|
gap: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 空状态 */
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -304,7 +211,6 @@
|
|||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 停车场按钮 */
|
|
||||||
.parkingLot-item {
|
.parkingLot-item {
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -317,7 +223,6 @@
|
|||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 选中状态 */
|
|
||||||
.parkingLot-item.active {
|
.parkingLot-item.active {
|
||||||
background-color: #1677ff;
|
background-color: #1677ff;
|
||||||
border-color: #1677ff;
|
border-color: #1677ff;
|
||||||
@@ -327,59 +232,9 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 停车场文字 */
|
|
||||||
.parkingLot-text {
|
.parkingLot-text {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 成功提示弹窗 */
|
|
||||||
.toast-mask {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: transparent;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-content {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 40rpx 60rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #1677ff;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toast-text {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-bar {
|
|
||||||
width: 100vw;
|
|
||||||
height: 46px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
uni.removeStorageSync('parkingLotName');
|
uni.removeStorageSync('parkingLotName');
|
||||||
uni.removeStorageSync('parkingSpaceId');
|
uni.removeStorageSync('parkingSpaceId');
|
||||||
uni.removeStorageSync('parkingSpaceName');
|
uni.removeStorageSync('parkingSpaceName');
|
||||||
|
console.log(sourcePage.value);
|
||||||
if (sourcePage.value == 'addHouse') {
|
if (sourcePage.value == 'addHouse') {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pageSubPack/my/selectBuilding',
|
url: '/pageSubPack/my/selectBuilding',
|
||||||
@@ -132,8 +132,10 @@
|
|||||||
complete: () => {}
|
complete: () => {}
|
||||||
});
|
});
|
||||||
} else if (sourcePage.value == 'addParkingSpace') {
|
} else if (sourcePage.value == 'addParkingSpace') {
|
||||||
|
uni.setStorageSync('checkType', '停车场')
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pageSubPack/my/bindHouse',
|
// url: '/pageSubPack/my/bindHouse',
|
||||||
|
url: '/pageSubPack/my/selectParingLot',
|
||||||
success: res => {},
|
success: res => {},
|
||||||
fail: () => {},
|
fail: () => {},
|
||||||
complete: () => {}
|
complete: () => {}
|
||||||
|
|||||||
Reference in New Issue
Block a user