|
|
- <template>
- <view class="content">
- <navbar title="意见反馈" leftClick @leftClick="$utils.navigateBack" />
- <view class="form-container">
- <!-- 申请类型 -->
- <view class="form-item">
- <view class="label">申请类型</view>
- <view class="select-value" @click="selectApplicationType">
- <text v-if="!applicationInfo.type" class="placeholder">请选择申请类型</text>
- <text v-else>{{ applicationInfo.type }}</text>
- <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
- </view>
- </view>
-
- <!-- 车牌号 -->
- <view class="form-item">
- <view class="label">车牌号</view>
- <input
- v-model="applicationInfo.plateNumber"
- placeholder="请输入车牌号"
- class="input"
- maxlength="8"
- />
- </view>
-
- <!-- 车辆类型 -->
- <view class="form-item" @click="selectCarType">
- <view class="label">车辆类型</view>
- <view class="select-value">
- <text v-if="!applicationInfo.carType" class="placeholder">请选择车辆类型</text>
- <text v-else>{{ applicationInfo.carType }}</text>
- <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
- </view>
- </view>
-
- <!-- 轴数 -->
- <view class="form-item" @click="selectAxleCount">
- <view class="label">轴数</view>
- <view class="select-value">
- <text v-if="!applicationInfo.axleCount" class="placeholder">请选择轴数</text>
- <text v-else>{{ applicationInfo.axleCount }}</text>
- <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
- </view>
- </view>
-
- <!-- 载重量 -->
- <view class="form-item">
- <view class="label">载重量(吨)</view>
- <input
- v-model="applicationInfo.loadCapacity"
- placeholder="请输入载重量"
- class="input"
- type="number"
- />
- </view>
-
- <!-- 联系人 -->
- <view class="form-item">
- <view class="label">联系人</view>
- <input
- v-model="applicationInfo.contactName"
- placeholder="请输入联系人姓名"
- class="input"
- />
- </view>
-
- <!-- 联系电话 -->
- <view class="form-item">
- <view class="label">联系电话</view>
- <input
- v-model="applicationInfo.contactPhone"
- placeholder="请输入联系电话"
- class="input"
- type="number"
- maxlength="11"
- />
- </view>
-
- <!-- 所在地区 -->
- <view class="form-item">
- <view class="label">所在地区</view>
- <view class="address-input" @click="selectLocation">
- <text v-if="!applicationInfo.location" class="placeholder">请选择所在地区</text>
- <text v-else>{{ applicationInfo.location }}</text>
- <uv-icon name="map-pin" size="20" color="#007AFF"></uv-icon>
- </view>
- </view>
-
- <!-- 车辆照片 -->
- <view class="form-item">
- <view class="label">车辆照片</view>
- <view class="upload-container">
- <view v-for="(image, index) in applicationInfo.images" :key="index" class="image-item">
- <image :src="image" mode="aspectFill" class="uploaded-image" @click="previewImage(index)"></image>
- <view class="delete-btn" @click="deleteImage(index)">
- <uv-icon name="close" size="16" color="#fff"></uv-icon>
- </view>
- </view>
- <view v-if="applicationInfo.images.length < 3" class="upload-btn" @click="uploadImage">
- <uv-icon name="plus" size="32" color="#999"></uv-icon>
- <text>上传照片</text>
- </view>
- </view>
- <view class="upload-tip">最多上传3张照片</view>
- </view>
-
- <!-- 相关证件 -->
- <view class="form-item">
- <view class="label">相关证件</view>
- <view class="upload-container">
- <view v-for="(doc, index) in applicationInfo.documents" :key="index" class="image-item">
- <image :src="doc" mode="aspectFill" class="uploaded-image" @click="previewDocument(index)"></image>
- <view class="delete-btn" @click="deleteDocument(index)">
- <uv-icon name="close" size="16" color="#fff"></uv-icon>
- </view>
- </view>
- <view v-if="applicationInfo.documents.length < 5" class="upload-btn" @click="uploadDocument">
- <uv-icon name="plus" size="32" color="#999"></uv-icon>
- <text>上传证件</text>
- </view>
- </view>
- <view class="upload-tip">请上传行驶证、营运证等相关证件,最多5张</view>
- </view>
-
- <!-- 申请说明 -->
- <view class="form-item">
- <view class="label">申请说明</view>
- <textarea
- v-model="applicationInfo.description"
- placeholder="请简述申请理由和相关说明"
- class="textarea"
- maxlength="200"
- ></textarea>
- </view>
- </view>
-
- <!-- 底部按钮 -->
- <view class="bottom-buttons">
- <button class="btn-save" @click="saveApplication">{{ isEdit ? '保存' : '提交申请' }}</button>
- </view>
- </view>
- </template>
-
- <script>
- import navbar from '@/components/base/navbar.vue'
-
- export default {
- components: {
- navbar
- },
- name: 'BaseYuan',
- data() {
- return {
- isEdit: false,
- applicationId: '',
- applicationInfo: {
- type: '',
- plateNumber: '',
- carType: '',
- axleCount: '',
- loadCapacity: '',
- contactName: '',
- contactPhone: '',
- location: '',
- images: [],
- documents: [],
- description: ''
- }
- }
- },
- onLoad(options) {
- if (options.mode === 'edit' && options.id) {
- this.isEdit = true;
- this.applicationId = options.id;
- this.loadApplicationInfo();
- }
- uni.setNavigationBarTitle({
- title: this.isEdit ? '编辑申请' : '新增申请'
- });
- },
- methods: {
- loadApplicationInfo() {
- // 模拟加载申请信息
- this.applicationInfo = {
- type: '车辆入驻申请',
- plateNumber: '湘A12345',
- carType: '泵车',
- axleCount: '4轴',
- loadCapacity: '25',
- contactName: '张师傅',
- contactPhone: '13800138000',
- location: '长沙市雨花区',
- images: ['/static/re/ide1.png'],
- documents: ['/static/re/ide2.png'],
- description: '申请车辆入驻平台,提供专业代驾服务'
- };
- },
- selectApplicationType() {
- uni.showActionSheet({
- itemList: ['车辆入驻申请', '司机认证申请', '企业入驻申请'],
- success: (res) => {
- const types = ['车辆入驻申请', '司机认证申请', '企业入驻申请'];
- this.applicationInfo.type = types[res.tapIndex];
- }
- });
- },
- selectCarType() {
- uni.showActionSheet({
- itemList: ['泵车', '搅拌车', '车载泵'],
- success: (res) => {
- const types = ['泵车', '搅拌车', '车载泵'];
- this.applicationInfo.carType = types[res.tapIndex];
- }
- });
- },
- selectAxleCount() {
- uni.showActionSheet({
- itemList: ['2轴', '3轴', '4轴', '5轴', '6轴'],
- success: (res) => {
- const axles = ['2轴', '3轴', '4轴', '5轴', '6轴'];
- this.applicationInfo.axleCount = axles[res.tapIndex];
- }
- });
- },
- selectLocation() {
- uni.chooseLocation({
- success: (res) => {
- this.applicationInfo.location = res.address;
- }
- });
- },
- uploadImage() {
- uni.chooseImage({
- count: 3 - this.applicationInfo.images.length,
- sizeType: ['compressed'],
- sourceType: ['camera', 'album'],
- success: (res) => {
- this.applicationInfo.images.push(...res.tempFilePaths);
- }
- });
- },
- uploadDocument() {
- uni.chooseImage({
- count: 5 - this.applicationInfo.documents.length,
- sizeType: ['compressed'],
- sourceType: ['camera', 'album'],
- success: (res) => {
- this.applicationInfo.documents.push(...res.tempFilePaths);
- }
- });
- },
- previewImage(index) {
- uni.previewImage({
- current: index,
- urls: this.applicationInfo.images
- });
- },
- previewDocument(index) {
- uni.previewImage({
- current: index,
- urls: this.applicationInfo.documents
- });
- },
- deleteImage(index) {
- this.applicationInfo.images.splice(index, 1);
- },
- deleteDocument(index) {
- this.applicationInfo.documents.splice(index, 1);
- },
- saveApplication() {
- // 表单验证
- if (!this.applicationInfo.type) {
- uni.showToast({ title: '请选择申请类型', icon: 'none' });
- return;
- }
- if (!this.applicationInfo.plateNumber) {
- uni.showToast({ title: '请输入车牌号', icon: 'none' });
- return;
- }
- if (!this.applicationInfo.carType) {
- uni.showToast({ title: '请选择车辆类型', icon: 'none' });
- return;
- }
- if (!this.applicationInfo.contactName) {
- uni.showToast({ title: '请输入联系人', icon: 'none' });
- return;
- }
- if (!this.applicationInfo.contactPhone) {
- uni.showToast({ title: '请输入联系电话', icon: 'none' });
- return;
- }
-
- uni.showToast({
- title: this.isEdit ? '保存成功' : '申请提交成功',
- icon: 'success'
- });
-
- setTimeout(() => {
- uni.navigateBack();
- }, 1500);
- }
- }
- }
- </script>
-
- <style scoped lang="scss">
- .content {
- padding: 20rpx;
- min-height: 100vh;
- background-color: #f5f5f5;
- padding-bottom: 120rpx;
- }
-
- .form-container {
- background-color: #fff;
- border-radius: 10rpx;
- padding: 30rpx;
- }
-
- .form-item {
- margin-bottom: 40rpx;
-
- &:last-child {
- margin-bottom: 0;
- }
- }
-
- .label {
- font-size: 28rpx;
- color: #333;
- margin-bottom: 20rpx;
- font-weight: 500;
- }
-
- .input {
- width: 100%;
- height: 80rpx;
- padding: 0 20rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- font-size: 28rpx;
- box-sizing: border-box;
- }
-
- .textarea {
- width: 100%;
- height: 120rpx;
- padding: 20rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- font-size: 28rpx;
- box-sizing: border-box;
- resize: none;
- }
-
- .select-value {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 80rpx;
- padding: 0 20rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- font-size: 28rpx;
- }
-
- .address-input {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 80rpx;
- padding: 0 20rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- font-size: 28rpx;
- }
-
- .placeholder {
- color: #999;
- }
-
- .upload-container {
- display: flex;
- flex-wrap: wrap;
- gap: 20rpx;
- }
-
- .image-item {
- position: relative;
- width: 200rpx;
- height: 200rpx;
- }
-
- .uploaded-image {
- width: 100%;
- height: 100%;
- border-radius: 8rpx;
- }
-
- .delete-btn {
- position: absolute;
- top: -10rpx;
- right: -10rpx;
- width: 40rpx;
- height: 40rpx;
- background-color: #ff3b30;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .upload-btn {
- width: 200rpx;
- height: 200rpx;
- border: 2rpx dashed #ccc;
- border-radius: 8rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 10rpx;
- color: #999;
- font-size: 24rpx;
- }
-
- .upload-tip {
- font-size: 24rpx;
- color: #999;
- margin-top: 10rpx;
- }
-
- .bottom-buttons {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- padding: 20rpx;
- background-color: #fff;
- border-top: 1rpx solid #f0f0f0;
- padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
- }
-
- .btn-save {
- width: 100%;
- height: 80rpx;
- line-height: 80rpx;
- background-color: #007AFF;
- color: #fff;
- border-radius: 40rpx;
- font-size: 32rpx;
- border: none;
- }
- </style>
|