feat: 合并访客登记功能

main
wx-jincw 3 weeks ago
parent 75e88dc3ca
commit 715920c256

@ -262,3 +262,32 @@ export function bindingWx(data) {
export function unbindWx(data) {
return request.post('unbindWx', data, { useAdminUrl: true });
}
// ===== 访客登记模块 =====
// 访客登记 - 新增
export function api_addVisit(data) {
return request.post(
'autogencode/dcvisitbook/save',
data,
{ useAdminUrl: true }
);
}
// 访客登记 - 记录列表
export function api_visitRecordList(params) {
return request.get(
'autogencode/dcvisitbook/list',
params,
{ useAdminUrl: true }
);
}
// 访客登记 - 详情/凭证信息
export function api_visitInfo(id) {
return request.get(
'autogencode/dcvisitbook/info/' + id,
{},
{ useAdminUrl: true }
);
}

@ -360,6 +360,34 @@
"navigationStyle": "custom"
// #endif
}
},
{
"path": "visitor_register/index",
"style": {
"navigationBarTitleText": "访客登记",
"navigationStyle": "custom"
}
},
{
"path": "visitor_records/index",
"style": {
"navigationBarTitleText": "访问记录",
"navigationStyle": "custom"
}
},
{
"path": "visitor_user/index",
"style": {
"navigationBarTitleText": "访客个人中心",
"navigationStyle": "custom"
}
},
{
"path": "visitor_credential/index",
"style": {
"navigationBarTitleText": "访问凭证",
"navigationStyle": "custom"
}
}
]
},

@ -0,0 +1,97 @@
<template>
<view>
<view class="cus-header" :style="{ marginTop: safeTop + 'px' }">
<text class="title">{{ title }}</text>
<view class="header-buttons">
<view class="back-btn" @click="handleBack" v-if="showBack">
<text class="back-icon"></text>
</view>
<slot name="right"></slot>
</view>
</view>
<view :style="{ marginTop: safeTop + 'px', height: '40px' }"></view>
</view>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
showBack: {
type: Boolean,
default: true
}
},
data() {
return {
safeTop: 30
};
},
mounted() {
const info = uni.getWindowInfo();
this.safeTop = Math.max(info.safeAreaInsets.top, 30);
},
methods: {
handleBack() {
this.$emit('back');
}
}
};
</script>
<style lang="scss" scoped>
.cus-header {
position: fixed;
top: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
align-items: center;
z-index: 10;
}
.cus-header .title {
font-size: 52rpx;
font-weight: bold;
color: #fff;
margin-bottom: 16rpx;
text-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.2);
}
.header-buttons {
position: absolute;
top: 0;
left: 20rpx;
display: flex;
align-items: center;
gap: 20rpx;
}
.back-btn {
width: 80rpx;
height: 80rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(10rpx);
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.back-btn:active {
transform: scale(0.9);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
}
.back-icon {
font-size: 40rpx;
color: #fff;
font-weight: bold;
}
</style>

@ -0,0 +1,274 @@
<template>
<view class="container">
<!-- 顶部装饰条 -->
<view class="top-decoration"></view>
<CustomHeader title="访问凭证" @back="handleBack" />
<view class="credential-card">
<text class="card-title">访客二维码</text>
<text class="card-subtitle">请向工作人员出示此二维码</text>
<view class="qr-code-container">
<image :src="qrCodeUrl" class="qr-code" mode="aspectFit" @click="previewQrCode"></image>
<text class="qr-tip">凭此码可快速通行</text>
</view>
<view class="visitor-info">
<view class="info-item">
<text class="info-label">访客姓名</text>
<text class="info-value">{{ visitorName }}</text>
</view>
<view class="info-item">
<text class="info-label">联系电话</text>
<text class="info-value">{{ visitorPhone }}</text>
</view>
<view class="info-item">
<text class="info-label">车牌号</text>
<text class="info-value">{{ visitorPlate }}</text>
</view>
</view>
<view class="validity-info">
<text class="validity-label">有效期限</text>
<text class="validity-value">{{ validityTime }}</text>
</view>
<view class="status-badge">
<text class="status-text">{{ credentialStatus }}</text>
</view>
</view>
<view class="tips">
<text class="tips-title">使用提示</text>
<view class="tips-list">
<text class="tip-item"> 请妥善保管您的访问凭证</text>
<text class="tip-item"> 凭证仅限本人使用不得转借</text>
<text class="tip-item"> 凭证过期后需重新申请</text>
<text class="tip-item"> 如有疑问请联系工作人员</text>
</view>
</view>
<!-- 底部装饰 -->
<view class="bottom-decoration"></view>
</view>
</template>
<script>
import CustomHeader from '../components/CustomHeader.vue';
export default {
components: { CustomHeader },
data() {
return {
openid: '',
qrCodeUrl: '',
visitorName: '访客用户',
visitorPhone: '138****1234',
visitorPlate: '京A12345',
validityTime: '2026-01-03 00:00 - 2026-01-04 23:59',
credentialStatus: '有效'
};
},
onLoad(options) {
this.openid = options.openid || '';
this.qrCodeUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=visitor_openid_' + this.openid;
},
mounted() {
// 访
setTimeout(() => {
this.visitorName = '访客_' + this.openid.slice(-4);
}, 500);
},
methods: {
handleBack() {
uni.navigateBack();
},
previewQrCode() {
if (!this.qrCodeUrl) return;
uni.previewImage({
urls: [this.qrCodeUrl],
current: this.qrCodeUrl
});
},
refreshQrCode() {
this.qrCodeUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=visitor_openid_' + this.openid + '_' + Date.now();
uni.showToast({ title: '二维码已刷新', icon: 'success' });
}
}
};
</script>
<style lang="scss" scoped>
.container {
min-height: 100vh;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
padding: 20rpx;
position: relative;
overflow: hidden;
}
.top-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 10rpx;
background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
}
.credential-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 24rpx;
padding: 50rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10rpx);
position: relative;
z-index: 1;
margin-bottom: 40rpx;
margin-top: 12rpx;
}
.card-title {
font-size: 44rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 12rpx;
}
.card-subtitle {
font-size: 28rpx;
color: #666;
text-align: center;
display: block;
margin-bottom: 50rpx;
}
.qr-code-container {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 50rpx;
}
.qr-code {
width: 300rpx;
height: 300rpx;
background-color: #fff;
padding: 20rpx;
border-radius: 16rpx;
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.1);
margin-bottom: 20rpx;
}
.qr-tip {
font-size: 28rpx;
color: #3a5da6;
font-weight: 500;
}
.visitor-info {
background: rgba(58, 93, 166, 0.05);
border-radius: 16rpx;
padding: 30rpx;
margin-bottom: 30rpx;
}
.info-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15rpx 0;
border-bottom: 1rpx solid rgba(58, 93, 166, 0.1);
}
.info-item:last-child {
border-bottom: none;
}
.info-label {
font-size: 32rpx;
color: #666;
}
.info-value {
font-size: 32rpx;
color: #333;
font-weight: 500;
}
.validity-info {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
margin-bottom: 30rpx;
}
.validity-label {
font-size: 32rpx;
color: #666;
}
.validity-value {
font-size: 32rpx;
color: #ff6b6b;
font-weight: 500;
}
.status-badge {
background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
border-radius: 50rpx;
padding: 15rpx 40rpx;
text-align: center;
margin: 0 auto;
width: fit-content;
}
.status-text {
color: #fff;
font-size: 32rpx;
font-weight: bold;
}
.tips {
background: rgba(255, 255, 255, 0.95);
border-radius: 24rpx;
padding: 40rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10rpx);
position: relative;
z-index: 1;
}
.tips-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
display: block;
}
.tips-list {
display: flex;
flex-direction: column;
gap: 15rpx;
}
.tip-item {
font-size: 28rpx;
color: #666;
line-height: 44rpx;
}
.bottom-decoration {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 200rpx;
background: linear-gradient(180deg, transparent, rgba(42, 82, 152, 0.2));
opacity: 0.6;
}
</style>

@ -0,0 +1,299 @@
<template>
<view class="container">
<z-paging ref="paging" v-model="list" @query="queryList">
<template #top>
<!-- 自定义导航栏 -->
<CustomHeader title="访问记录" @back="handleBack" />
<!-- 顶部装饰条 -->
<view class="top-decoration"></view>
<!-- 搜索框 -->
<view class="search-wrapper">
<view class="search-input-wrapper">
<text class="search-icon">🔍</text>
<input
v-model="searchKeyword"
class="search-input"
placeholder="搜索访问记录..."
@input="handleSearch"
/>
</view>
</view>
</template>
<!-- 访问记录列表 -->
<view class="records-list">
<view
v-for="record in list"
:key="record.id"
class="record-item"
>
<view class="record-header">
<text class="record-date">{{ record.date }}</text>
<view class="record-status" :class="record.status">
<text class="status-text">{{ record.statusText }}</text>
</view>
</view>
<view class="record-content">
<view class="record-info">
<text class="info-label">车牌号:</text>
<text class="info-value">{{ record.plateNumber }}</text>
</view>
<view class="record-info">
<text class="info-label">来访事由:</text>
<text class="info-value">{{ record.reason }}</text>
</view>
<view class="record-info">
<text class="info-label">拜访对象:</text>
<text class="info-value">{{ record.visitPerson }}</text>
</view>
<view class="record-info">
<text class="info-label">登记时间:</text>
<text class="info-value">{{ record.registerTime }}</text>
</view>
<view class="record-info" v-if="record.entryTime">
<text class="info-label">入场时间:</text>
<text class="info-value">{{ record.entryTime }}</text>
</view>
<view class="record-info" v-if="record.exitTime">
<text class="info-label">出场时间:</text>
<text class="info-value">{{ record.exitTime }}</text>
</view>
</view>
</view>
<!-- 无记录提示 -->
<view v-if="list.length === 0" class="no-records">
<text class="no-records-text">暂无访问记录</text>
</view>
</view>
</z-paging>
</view>
</template>
<script>
import CustomHeader from '../components/CustomHeader.vue';
export default {
components: { CustomHeader },
data() {
return {
openid: '',
searchKeyword: '',
list: [],
//
records: [
{
id: 1,
date: '2024-06-15',
plateNumber: '粤B12345',
reason: '商务洽谈',
visitPerson: '张三',
registerTime: '10:30',
entryTime: '10:35',
exitTime: '12:45',
status: 'completed',
statusText: '已完成'
},
{
id: 2,
date: '2024-06-14',
plateNumber: '粤B12345',
reason: '技术支持',
visitPerson: '李四',
registerTime: '14:20',
entryTime: '14:25',
exitTime: null,
status: 'in-progress',
statusText: '进行中'
},
{
id: 3,
date: '2024-06-13',
plateNumber: '粤B12345',
reason: '会议讨论',
visitPerson: '王五',
registerTime: '09:15',
entryTime: '09:20',
exitTime: '11:30',
status: 'completed',
statusText: '已完成'
}
]
};
},
onLoad(options) {
this.openid = options.openid || '';
if (this.openid) {
console.log('获取到的openid:', this.openid);
}
},
methods: {
queryList(pageNo, pageSize) {
//
this.$refs.paging.complete(this.records);
},
handleSearch() {
console.log('搜索关键词:', this.searchKeyword);
},
handleBack() {
uni.navigateBack();
}
}
};
</script>
<style lang="scss" scoped>
.container {
min-height: 100vh;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
padding: 20rpx;
position: relative;
overflow: hidden;
}
.top-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 10rpx;
background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
}
.search-wrapper {
margin: 30rpx;
}
.search-input-wrapper {
display: flex;
align-items: center;
background: #f8f9fa;
border-radius: 16rpx;
border: 2rpx solid transparent;
transition: all 0.3s ease;
}
.search-input-wrapper:focus-within {
border-color: #2a5298;
background: #fff;
box-shadow: 0 0 0 6rpx rgba(42, 82, 152, 0.1);
}
.search-icon {
width: 80rpx;
height: 92rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 40rpx;
color: #2a5298;
}
.search-input {
flex: 1;
height: 92rpx;
border: none;
background: transparent;
padding: 0 24rpx;
font-size: 32rpx;
color: #333;
box-sizing: border-box;
}
.search-input::placeholder {
color: #999;
}
.records-list {
padding: 0 30rpx;
}
.record-item {
background: #f8f9fa;
border-radius: 16rpx;
padding: 30rpx;
margin-bottom: 30rpx;
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
}
.record-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.record-date {
font-size: 30rpx;
font-weight: 600;
color: #333;
}
.record-status {
padding: 8rpx 20rpx;
border-radius: 20rpx;
font-size: 24rpx;
font-weight: 600;
}
.record-status.in-progress {
background: rgba(42, 82, 152, 0.2);
color: #2a5298;
}
.record-status.completed {
background: rgba(76, 205, 196, 0.2);
color: #27ae60;
}
.status-text {
font-size: 26rpx;
}
.record-content {
border-top: 2rpx solid #e9ecef;
padding-top: 20rpx;
}
.record-info {
display: flex;
margin-bottom: 16rpx;
align-items: flex-start;
}
.info-label {
width: 120rpx;
font-size: 28rpx;
font-weight: 600;
color: #666;
margin-right: 20rpx;
}
.info-value {
flex: 1;
font-size: 28rpx;
color: #333;
word-break: break-all;
}
.no-records {
text-align: center;
padding: 100rpx 0;
color: #999;
}
.no-records-text {
font-size: 32rpx;
}
.bottom-decoration {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 200rpx;
background: linear-gradient(180deg, transparent, rgba(42, 82, 152, 0.2));
opacity: 0.6;
}
</style>

@ -0,0 +1,185 @@
<template>
<view class="input-component">
<view v-if="label" class="label-wrapper">
<text class="label">{{ label }}</text>
<text v-if="required" class="required">*</text>
</view>
<view class="input-wrapper" :class="{ 'textarea-wrapper': textarea }">
<view v-if="icon" class="input-icon" :class="{ 'textarea-icon': textarea }">{{ icon }}</view>
<input
v-if="!textarea"
v-model="inputValue"
class="input"
:type="type"
:placeholder="placeholder"
:placeholder-class="'placeholder'"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
/>
<textarea
v-else
v-model="inputValue"
class="textarea"
:placeholder="placeholder"
:placeholder-class="'placeholder'"
:rows="rows"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
></textarea>
</view>
</view>
</template>
<script>
export default {
props: {
value: {
type: String,
default: ''
},
label: {
type: String,
default: ''
},
required: {
type: Boolean,
default: false
},
icon: {
type: String,
default: ''
},
textarea: {
type: Boolean,
default: false
},
type: {
type: String,
default: 'text'
},
placeholder: {
type: String,
default: ''
},
rows: {
type: Number,
default: 3
}
},
data() {
return {
inputValue: this.value
};
},
watch: {
value(newVal) {
if (newVal !== this.inputValue) {
this.inputValue = newVal;
}
}
},
methods: {
handleInput(event) {
this.$emit('input', this.inputValue);
},
handleFocus(event) {
this.$emit('focus', event);
},
handleBlur(event) {
this.$emit('blur', event);
}
}
};
</script>
<style lang="scss" scoped>
.input-component {
margin-bottom: 50rpx;
position: relative;
}
.label-wrapper {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.label {
font-size: 34rpx;
font-weight: 600;
color: #333;
}
.required {
color: #ff6b6b;
margin-left: 8rpx;
font-size: 36rpx;
}
.input-wrapper {
display: flex;
align-items: center;
background: #f8f9fa;
border-radius: 16rpx;
border: 2rpx solid transparent;
transition: all 0.3s ease;
}
.input-wrapper.textarea-wrapper {
align-items: flex-start;
}
.input-wrapper:focus-within {
border-color: #2a5298;
background: #fff;
box-shadow: 0 0 0 6rpx rgba(42, 82, 152, 0.1);
}
.input-icon {
width: 80rpx;
min-height: 92rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 40rpx;
color: #2a5298;
}
.input-icon.textarea-icon {
align-items: flex-start;
padding-top: 24rpx;
}
.input {
flex: 1;
height: 92rpx;
border: none;
background: transparent;
padding: 0 24rpx;
font-size: 32rpx;
color: #333;
box-sizing: border-box;
}
.input::placeholder {
color: #999;
}
.textarea {
flex: 1;
border: none;
background: transparent;
padding: 24rpx;
font-size: 32rpx;
color: #333;
box-sizing: border-box;
resize: none;
line-height: 1.6;
}
.textarea::placeholder {
color: #999;
}
</style>

@ -0,0 +1,514 @@
<template>
<view class="container">
<!-- 顶部装饰条 -->
<view class="top-decoration"></view>
<view class="header">
<image src="/static/logo.png" class="logo" mode="aspectFit"></image>
<text class="title">访客登记</text>
<text class="subtitle">请填写以下信息进行登记</text>
<view class="header-buttons">
<view class="user-center-btn" @click="handleGoHome">
<text class="user-icon">🏠</text>
<text class="user-text">首页</text>
</view>
<view class="user-center-btn" @click="handleUserCenter">
<text class="user-icon">👤</text>
<text class="user-text">我的</text>
</view>
</view>
</view>
<view class="form-card">
<!-- 访客姓名 -->
<VisitorInput
v-model="form.visitorName"
label="姓名"
required
icon="👤"
placeholder="请输入您的姓名"
/>
<!-- 访客手机号 -->
<VisitorInput
v-model="form.visitorPhone"
label="手机号"
required
icon="📱"
type="number"
placeholder="请输入您的手机号"
/>
<!-- 车牌号码 -->
<VisitorInput
v-model="form.licensePlateNumber"
label="车牌号码"
required
icon="🚙"
placeholder="请输入车牌号"
/>
<!-- 受访人所在部门 -->
<VisitorInput
v-model="form.memberOrg"
label="受访人所在部门"
required
icon="🏢"
placeholder="请输入受访人所在部门"
/>
<!-- 受访人姓名 -->
<VisitorInput
v-model="form.memberName"
label="被访人姓名"
required
icon="👥"
placeholder="请输入受访人姓名"
/>
<!-- 受访人手机号 -->
<VisitorInput
v-model="form.memberPhone"
label="被访人手机号"
required
icon="📱"
type="number"
placeholder="请输入受访人手机号"
/>
<!-- 来访事由 -->
<VisitorInput
v-model="form.reason"
label="来访事由"
required
icon="📝"
textarea
rows="2"
placeholder="请输入来访事由"
/>
<!-- 预约日期 -->
<view class="form-item">
<text class="form-label required">预约日期</text>
<picker mode="date" :value="form.visitDate" :start="minDate" :end="maxDate" @change="handleDateChange">
<view class="date-picker-btn">
<text>{{ form.visitDate || '请选择预约日期' }}</text>
</view>
</picker>
</view>
<!-- 预约时间区间 -->
<view class="form-item">
<text class="form-label required">选择区间</text>
<view class="time-range">
<picker mode="time" :value="form.startTime" @change="handleStartTimeChange">
<view class="date-picker-btn time-btn">
<text>{{ form.startTime || '开始时间' }}</text>
</view>
</picker>
<text class="time-separator"></text>
<picker mode="time" :value="form.endTime" @change="handleEndTimeChange">
<view class="date-picker-btn time-btn">
<text>{{ form.endTime || '结束时间' }}</text>
</view>
</picker>
</view>
</view>
<button class="submit-btn" @click="handleSubmit" :disabled="!isFormValid">
<text class="btn-text">提交登记</text>
</button>
<!-- 查看访问记录按钮 -->
<button class="records-btn" @click="handleViewRecords">
<text class="btn-text">查看访问记录</text>
</button>
</view>
<!-- 底部装饰 -->
<view class="bottom-decoration"></view>
</view>
</template>
<script>
import { api_addVisit } from '@/api/property.js';
import VisitorInput from './components/VisitorInput.vue';
export default {
components: { VisitorInput },
data() {
const today = new Date();
const minDate = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`;
return {
minDate,
maxDate: '2050-12-31',
form: {
visitorName: '',
visitorPhone: '',
memberName: '',
memberPhone: '',
memberOrg: '',
reason: '',
visitDate: '',
startTime: '',
endTime: '',
visitStartTime: null,
visitEndTime: null,
licensePlateNumber: '',
openId: ''
}
};
},
computed: {
isFormValid() {
return this.form.visitorName &&
/^1[3-9]\d{9}$/.test(this.form.visitorPhone) &&
this.form.memberName &&
/^1[3-9]\d{9}$/.test(this.form.memberPhone) &&
this.form.memberOrg &&
this.form.reason &&
this.form.visitStartTime &&
this.form.visitEndTime &&
this.form.visitStartTime < this.form.visitEndTime &&
this.form.licensePlateNumber;
}
},
methods: {
handleDateChange(e) {
this.form.visitDate = e.detail.value;
this.updateVisitTime();
},
handleStartTimeChange(e) {
this.form.startTime = e.detail.value;
this.updateVisitTime();
},
handleEndTimeChange(e) {
this.form.endTime = e.detail.value;
this.updateVisitTime();
},
updateVisitTime() {
if (!this.form.visitDate || !this.form.startTime || !this.form.endTime) return;
this.form.visitStartTime = `${this.form.visitDate} ${this.form.startTime}:00`;
this.form.visitEndTime = `${this.form.visitDate} ${this.form.endTime}:59`;
},
async getWechatAuth() {
try {
uni.showLoading({ title: '正在获取授权...' });
const { code } = await uni.login();
// code openId
this.form.openId = 'mock_open_id_' + Date.now();
uni.hideLoading();
return true;
} catch (error) {
uni.hideLoading();
uni.showToast({ title: '获取授权失败,请重试', icon: 'none' });
console.error('微信授权失败:', error);
return false;
}
},
async handleSubmit() {
const authSuccess = await this.getWechatAuth();
if (!authSuccess) return;
try {
uni.showLoading({ title: '正在提交...' });
await api_addVisit({ ...this.form });
uni.hideLoading();
uni.showToast({ title: '登记成功', icon: 'success' });
//
const openId = this.form.openId;
this.form = {
visitorName: '',
visitorPhone: '',
memberName: '',
memberPhone: '',
memberOrg: '',
reason: '',
visitDate: '',
startTime: '',
endTime: '',
visitStartTime: null,
visitEndTime: null,
licensePlateNumber: '',
openId
};
} catch (error) {
uni.hideLoading();
uni.showToast({ title: '提交失败,请重试', icon: 'none' });
console.error('提交失败:', error);
}
},
handleViewRecords() {
uni.navigateTo({
url: `/pages/supply_chain/visitor_records/index?openid=${this.form.openId}`
});
},
handleUserCenter() {
uni.navigateTo({
url: `/pages/supply_chain/visitor_user/index?openid=${this.form.openId}`
});
},
handleGoHome() {
uni.reLaunch({
url: '/pages/index/index'
});
}
}
};
</script>
<style lang="scss">
.container {
min-height: 100vh;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
padding: 20rpx;
position: relative;
overflow: hidden;
}
.top-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 10rpx;
background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 60rpx;
margin-bottom: 60rpx;
position: relative;
z-index: 1;
}
.header-buttons {
position: absolute;
bottom: 18rpx;
left: 20rpx;
right: 20rpx;
display: flex;
justify-content: space-between;
}
.user-center-btn {
width: 98rpx;
height: 98rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
backdrop-filter: blur(10rpx);
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.user-center-btn:active {
transform: scale(0.9);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
}
.user-icon {
font-size: 40rpx;
}
.user-text {
font-size: 24rpx;
font-weight: 300;
color: rgba(255, 255, 255, 0.6);
line-height: 24rpx;
}
.logo {
width: 180rpx;
height: 180rpx;
margin-bottom: 30rpx;
border-radius: 50%;
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.15);
background-color: rgba(255, 255, 255, 0.9);
padding: 20rpx;
}
.title {
font-size: 52rpx;
font-weight: bold;
color: #fff;
margin-bottom: 16rpx;
text-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.2);
}
.subtitle {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
font-weight: 300;
}
.form-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 24rpx;
padding: 50rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10rpx);
position: relative;
z-index: 1;
}
.form-item {
margin-bottom: 40rpx;
display: flex;
flex-direction: column;
}
.form-label {
font-size: 32rpx;
color: #333;
margin-bottom: 16rpx;
font-weight: 500;
}
.form-label.required::after {
content: '*';
color: #ff6b6b;
margin-left: 8rpx;
}
.date-picker-btn {
width: 100%;
height: 96rpx;
background-color: #f5f5f5;
border-radius: 16rpx;
display: flex;
align-items: center;
padding: 0 32rpx;
box-sizing: border-box;
font-size: 32rpx;
color: #666;
border: 2rpx solid #e0e0e0;
transition: all 0.3s ease;
}
.date-picker-btn:active {
background-color: #e0e0e0;
border-color: #ccc;
}
.time-range {
display: flex;
align-items: center;
gap: 16rpx;
}
.time-btn {
flex: 1;
}
.time-separator {
font-size: 28rpx;
color: #999;
}
.submit-btn {
width: 100%;
height: 104rpx;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
color: #fff;
font-size: 38rpx;
font-weight: 600;
border-radius: 52rpx;
margin-top: 30rpx;
border: none;
box-shadow: 0 12rpx 30rpx rgba(42, 82, 152, 0.4);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.submit-btn:active {
transform: translateY(4rpx);
box-shadow: 0 8rpx 20rpx rgba(102, 126, 234, 0.3);
}
.submit-btn:disabled {
background: linear-gradient(135deg, #c0c4cc 0%, #a0a0a0 100%);
box-shadow: 0 8rpx 20rpx rgba(192, 196, 204, 0.3);
transform: none;
}
.records-btn {
width: 100%;
height: 104rpx;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
color: #fff;
font-size: 38rpx;
font-weight: 600;
border-radius: 52rpx;
margin-top: 30rpx;
border: 2rpx solid #3a5da6;
box-shadow: 0 6rpx 20rpx rgba(58, 93, 166, 0.2);
transition: all 0.3s ease;
}
.records-btn:active {
transform: translateY(4rpx);
box-shadow: 0 4rpx 15rpx rgba(42, 82, 152, 0.3);
}
.btn-text {
position: relative;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
color: #fff;
height: 104rpx;
}
.bottom-decoration {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 200rpx;
background: linear-gradient(180deg, transparent, rgba(42, 82, 152, 0.2));
opacity: 0.6;
}
.container::before {
content: '';
position: absolute;
top: 20%;
right: 10%;
width: 200rpx;
height: 200rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
border-radius: 50%;
animation: float 6s ease-in-out infinite;
}
.container::after {
content: '';
position: absolute;
bottom: 30%;
left: 5%;
width: 150rpx;
height: 150rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
border-radius: 50%;
animation: float 8s ease-in-out infinite reverse;
}
@keyframes float {
0%, 100% {
transform: translateY(0rpx) scale(1);
}
50% {
transform: translateY(-30rpx) scale(1.1);
}
}
</style>

@ -0,0 +1,212 @@
<template>
<view class="container">
<!-- 顶部装饰条 -->
<view class="top-decoration"></view>
<CustomHeader title="个人中心" @back="handleBack" />
<view class="user-info-card">
<view class="user-avatar">
<text class="avatar-icon">👤</text>
</view>
<text class="user-name">{{ userName }}</text>
<text class="wechat-status">
<text class="status-icon">{{ isWechatBound ? '✓' : '!' }}</text>
{{ isWechatBound ? '微信已绑定' : '微信未绑定' }}
</text>
</view>
<view class="menu-list">
<view class="menu-item" @click="handleVisitRecords">
<text class="menu-icon">📋</text>
<text class="menu-text">访问记录</text>
<text class="menu-arrow"></text>
</view>
<view class="menu-item" @click="handleAccessCredential">
<text class="menu-icon">🎫</text>
<text class="menu-text">访问凭证</text>
<text class="menu-arrow"></text>
</view>
<view class="menu-item" @click="handleWechatBind">
<text class="menu-icon">🔗</text>
<text class="menu-text">微信绑定</text>
<text class="menu-arrow"></text>
</view>
</view>
<!-- 底部装饰 -->
<view class="bottom-decoration"></view>
</view>
</template>
<script>
import CustomHeader from '../components/CustomHeader.vue';
export default {
components: { CustomHeader },
data() {
return {
openid: '',
userName: '访客用户',
isWechatBound: true
};
},
onLoad(options) {
this.openid = options.openid || '';
},
mounted() {
//
setTimeout(() => {
this.userName = '访客_' + this.openid.slice(-4);
}, 500);
},
methods: {
handleBack() {
uni.navigateBack();
},
handleVisitRecords() {
uni.navigateTo({
url: `/pages/supply_chain/visitor_records/index?openid=${this.openid}`
});
},
handleAccessCredential() {
uni.navigateTo({
url: `/pages/supply_chain/visitor_credential/index?openid=${this.openid}`
});
},
handleWechatBind() {
if (this.isWechatBound) {
uni.showToast({ title: '微信已绑定', icon: 'success' });
} else {
uni.showToast({ title: '微信绑定功能开发中', icon: 'none' });
}
}
}
};
</script>
<style lang="scss" scoped>
.container {
min-height: 100vh;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
padding: 20rpx;
position: relative;
overflow: hidden;
}
.top-decoration {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 10rpx;
background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
}
.user-info-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 24rpx;
padding: 50rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10rpx);
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 40rpx;
margin-top: 12rpx;
}
.user-avatar {
width: 160rpx;
height: 160rpx;
background: linear-gradient(135deg, #3a5da6 0%, #4a72c2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
box-shadow: 0 12rpx 30rpx rgba(58, 93, 166, 0.4);
}
.avatar-icon {
font-size: 80rpx;
}
.user-name {
font-size: 44rpx;
font-weight: bold;
color: #333;
margin-bottom: 16rpx;
}
.wechat-status {
font-size: 32rpx;
color: #666;
display: flex;
align-items: center;
gap: 10rpx;
}
.status-icon {
font-size: 32rpx;
color: #4caf50;
font-weight: bold;
}
.menu-list {
background: rgba(255, 255, 255, 0.95);
border-radius: 24rpx;
padding: 20rpx;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10rpx);
position: relative;
z-index: 1;
}
.menu-item {
display: flex;
align-items: center;
padding: 40rpx 30rpx;
border-bottom: 1rpx solid rgba(58, 93, 166, 0.1);
transition: all 0.3s ease;
}
.menu-item:last-child {
border-bottom: none;
}
.menu-item:active {
background: rgba(58, 93, 166, 0.05);
border-radius: 16rpx;
}
.menu-icon {
font-size: 44rpx;
margin-right: 30rpx;
}
.menu-text {
flex: 1;
font-size: 36rpx;
color: #333;
}
.menu-arrow {
font-size: 32rpx;
color: #999;
}
.bottom-decoration {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 200rpx;
background: linear-gradient(180deg, transparent, rgba(42, 82, 152, 0.2));
opacity: 0.6;
}
</style>
Loading…
Cancel
Save