toponym.vue 7.8 KB
<template>
	<view class="page">

		<view class="content">
			<view class="top-box" @click="gopath('/pages/toponym/toponymlist')">
				<view>上报历史</view>
				<view class="top-box-img"><image src="../../static/right2.png"></image></view>
			</view>
			<view class="titleall-left"><view class="titleall-left-line"></view>我要上报</view>
			<view class="message-list">
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">地名</view>
							<view>
								<input v-model="from.addressName" placeholder="请输入" style="text-align: right;"/>
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">申请人姓名</view>
							<view>
								<input v-model="from.applicationName" placeholder="请输入" style="text-align: right;"/>
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">申请人电话</view>
							<view>
								<input v-model="from.applicationPhone" placeholder="请输入" style="text-align: right;"/>
							</view>
						</view>
					</view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="serve">
							<view class="serve-title">详细地址</view>
							<view @tap="open">
								<input v-model="from.address"  placeholder="请输入" style="text-align: right;"/>
							</view>
						</view>
					</view>
				</view>
			</view>
			
	
			
			<view class="page-footer">
			  <view class="footer-buy">
			    <view class="cart-add" @click="mapdoorplatesuccess">
					<image src="../../static/btn5.png"></image>
			      <text>立即上报</text>
			    </view>
			  </view>
			</view>
			
		</view>
		</view>
	</view>
</template>

<script>
	import service from '@/service/service.js'
	import BASE_URL from "@/common/config.js"
	export default {
		data() {
			return {
				BASE_URL,
				fileList:[],
				OrderType: 0,
				nvConfig:{
					title:"",
					bgColor:"#ffffff",
					color:"#000000",
					fixedAssist:{
						hide:true,
					},
				},
				from:{
					address: "",
					addressName: "",
					applicationName: "",
					applicationPhone: "",
					auditStatus: "正在审核",
					createdUser:uni.getStorageSync('USERS_KEY').userId,
					map: "",

				},
				array: ['办公楼', '居民楼'],
			};
		},
		onPageScroll(e) {this.$refs.nv.pageScroll(e)},
		computed:{
			pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}
		},
		onLoad(params) {
			this.OrderType = params.type;
		},
		methods:{
			gopath(e) {
				uni.navigateTo({
					url:e
				})
			},
			async afterRead(event) {
				for (let i = 0; i < event.file.length; i++) {
					var res = await this.uploadImg(event.file[i].url)
					res = JSON.parse(res)
					this.fileList.push({
						name:res.newFileName,
						fileId:res.newFileName,
						url: this.IMG_URL + res.fileName
					})
				}
			},
			uploadImg(url) {
				return new Promise((r, e) => {
					uni.uploadFile({
						url: this.BASE_URL + "/common/upload",
						filePath: url,
						name: "file",
						success: (d) => r(d)
					})
				})
			},
			deletePic(event) {
				this.fileList.splice(event.index, 1)
			},
			bindPickerChange: function(e) {
				console.log('picker发送选择改变,携带值为', e)
				this.from.buildType = e.detail.value
			},
			mapdoorplatesuccess(){
				console.log(this.from)
				this.API.addressApplication(this.from).then(res=>{
					console.log(res);
					if(res.code == 200) {
						uni.showToast({
							icon: 'success',
							title: "提交成功",
						})
						setTimeout(() => {
							uni.redirectTo({
								url: '/pages/mapdoorplatesuccess/mapdoorplatesuccess',
							})
						}, 800)

					}
				})
				
			},
			open() {
				let that = this
				// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
				wx.chooseLocation({
					success: function(res) {
						console.log(res);
						that.from.map = res.longitude+','+res.latitude
						that.from.address = res.address
					},
					fail(err) {
						console.log(err)
					}
				});
			},
		}
	}
</script>

<style scoped lang="scss">
	.listBox{
		position: relative;
		z-index: 1;
	}
	.content {
		width: 100%;
		padding-bottom:120rpx;
	}
	.titleall-left {
			font-size: 32rpx;
			font-weight: bold;
			display: flex;
			align-items: center;
			margin: 30rpx;
			.titleall-left-line {
				width: 16rpx;
				height: 36rpx;
				border-radius: 100rpx;
				background-color: #5D76F4;
				margin-right: 20rpx;
			}
		}
	.top-box {
		display: flex;
		justify-content: space-between;
		margin: 30rpx;
		font-size: 30rpx;
		font-weight: bold;
		background-color: #fff;
		border-radius: 20rpx;
		padding: 30rpx;
		.top-box-img {
			image {
				width: 40rpx;
				height: 40rpx;
			}
		}
	}
	.titleall-box {
		display: flex;
		justify-content: space-between;
		padding: 40rpx 20rpx 20rpx 0;
		.titleall-left {
			font-size: 32rpx;
			font-weight: bold;
			display: flex;
			align-items: center;
			.titleall-left-line {
				width: 14rpx;
				height: 36rpx;
				border-radius: 0 10rpx 10rpx 0;
				background-color: #667FFF;
				box-shadow: 0 0 10rpx 5rpx #d1d9ff;
				margin-right: 20rpx;
			}
			text {
				font-size: 28rpx;
				color: #999999;
			}
		}
	}
	.message-list{
		background-color: #FFFFFF;
		border-radius: 20rpx;
		font-size: 26rpx;
		margin: 25rpx;
		padding: 20rpx 0;
	.info-box {
		padding: 0 40rpx;
		border-radius: 20rpx;
		// margin-bottom: 30rpx;
		.info-box-list {
			display: flex;
			align-items: center;
			border-bottom: 2rpx solid #ececec;
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			.width100 {
				width: 100% !important;
			}
			.info-box-width {
				width: 50%;
				font-size: 30rpx;
				font-weight: bold;
				.info-box-small {
					font-size: 26rpx;
					color: #a8a8a8;
					font-weight: 500;
					margin-top: 10rpx;
				}
				.info-box-list-img {
					margin-top: 30rpx;
					image {
						width: 180rpx;
						height: 180rpx;
						border-radius: 20rpx;
					}
				}
				.input-text {
					font-size: 30rpx;
				}
				.inputtext{
				    color: #3d3d3d;
				}
				.textarea {
					background-color: #F7F7F7;
					border-radius: 20rpx;
					width: 100%;
					margin-top: 20rpx;
					padding: 20rpx;
					font-size: 28rpx;
					font-weight: normal;
					min-height: 80rpx;
				}
			}
			.serve {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				.serve-title {
					font-size: 30rpx;
					color: #909090;
				}
				.serve-right {
					font-size: 30rpx;
					font-weight: bold;
					display: flex;
					align-items: center;
					justify-content: flex-end;
					text {
						color: #FC4444;
					}
					image {
						width: 20rpx;
						height: 20rpx;
						margin-left: 10rpx;
					}
				}
			}
		}
		.info-box-list:last-child {
			border-bottom: 0;
		}
	}
	}
	/* 底部 */
	.page-footer{
		margin: 30rpx;
		display: flex;
		height: 100rpx;
		.footer-buy{
			height: 100%;
			width: 100%;
			.cart-add{
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 60rpx;
				image {
					position: absolute;
					z-index: 0;
					width: 95%;
					height: 83rpx;
					box-shadow: 5rpx 10rpx 20rpx 0 #b7c8ff;
					border-radius: 100rpx;
				}
				text{
					font-size: 30rpx;
					font-weight: bold;
					color: #fff;
					position: absolute;
					z-index: 1;
				}
			}
		}
	}
</style>