<!-- 确认装车 -->
<template>
	<view class="content">
		<view class="content2">
			<view class="level2-title">基本信息</view>
			<view class='row-between'>
				<view class="row-left-text">订单编号</view>
				<view class="row-right-text">CY20220210666666</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">货主</view>
				<view class="row-right-text">张山</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">货主单位</view>
				<view class="row-right-text">辽宁省营口市鲅鱼圈区蝴蝶泉路116号</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">发货地</view>
				<view class="row-right-text place">黑龙江中天昊元贸易有限公司</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">卸货地</view>
				<view class="row-right-text place">黑龙江省齐齐哈尔市梅里斯达斡尔族区
					杜尔门沁达斡尔乡53农场</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">货名</view>
				<view class="row-right-text">玉米</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">运费</view>
				<view class="row-right-text">100元/车</view>
			</view>

		</view>
		<view class="content2">
			<view class="level2-title">卸车信息</view>
			<view class='row-between'>
				<view class="row-left-text">车牌号</view>
				<view class="row-right-text">辽H111111</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">卸车日期</view>
				<view class="row-right-text">2022-02-11</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">合计应付运费（元）</view>
				<view class="row-right-text">输入合计应付运费</view>
			</view>
			<view class='row-between'>
				<view class="row-left-text">定位</view>
				<view class="row-right-text place">去授权</view>
				<!-- <view class="row-right-text place">刷新</view> -->
			</view>
			<view class='s-flex'>
				<view class="row-left-text">上传卸车照片（1-3张）</view>
				<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="3"
					:size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
					@on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
			</view>
		</view>
		<view class="bottom-btn">
			<view class="store">暂存</view>
			<view class="submit">提交</view>
		</view>


	</view>
</template>

<script>
	import upload from '@/components/upload.vue';
	export default {
		components: {
			upload
		},
		data() {
			return {
				detailData: {
					addressUrl: ''
				},
				action: this.$helper.ossUploadUrl,
				maxSize: 50 * 1024 * 1024, //限制文件大小 50M
				isAdd: true,
				isShowAlert: false,
				alertContent: '',
				alertTitle: '',
			}
		},
		onLoad(options) {
			console.log(options)
		},
		methods: {
			alertBtn() {
				// uni.navigateTo({
				// 	url: '/pages/public/login'
				// })
			},
			cancelClick() {
				this.isShowAlert = false
			},
			getImgUrl(res) {
				this.detailData.addressUrl = res
				console.log(res)
				console.log('------------res-----------')
			},
			onError(error) {
				alert(error)
				console.log('------------error-----------')
				console.log(error)
			},
			onRemove(index) {},
			filterFileType(index, lists) {
				if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
					lists.splice(index, 1);
					// 当前文件不支持
					uni.showModal({
						title: '暂不支持当前图片类型',
						showCancel: false
					});
				} else {
					this.isAdd = false;
				}
			},
			onProgress(e) {
				console.log(e)
			},
			submit(type) {
				console.log(type)
				let params = {
					type: 'success',
					title: '成功主题(带图标)',
					message: "庄生晓梦迷蝴蝶",
					iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
				}
				if (type == 0) {

				} else {
					this.alertContent = '确定提交装车信息？'
					this.alertTitle = '提示'
					this.isShowAlert = true
				}
				// this.$refs.uToast.show({
				// 	...params,
				// 	complete() {
				// 		params.url && uni.navigateTo({
				// 			url: params.url
				// 		})
				// 	}
				// })
			},
			confirmClick() {
				console.log('提交')
			}
		},
	}
</script>

<style scoped lang="scss">
	.content {
		.row-left-text {
			color: #333333;
		}
	}

	.level2-title {
		margin: 0 0 20rpx 0;
	}

	.content1,
	.content2 {
		background: white;
		margin: 20rpx;
		border-radius: 20rpx;
		padding: 20rpx;

		.place {
			width: 80%;
			text-align: right;
		}
	}
	.upload{
		
	}
	.bottom-btn{
		display: flex;
		justify-content: space-around;
		margin-bottom: 50rpx;
		background: #FFFFFF;
		padding: 40rpx 0;
	}
	.store{
		padding: 20rpx 30rpx;
		color:#2772FB;
		width: 40%;
		background: #EEF4FF;
		border-radius: 40rpx;
		font-size: 36rpx;
		text-align: center;
	}
	.submit{
		font-size: 36rpx;
		padding: 20rpx 30rpx;
		color: white;
		width: 40%;
		background:#2772FB ;
		border-radius: 40rpx;
			text-align: center;
	}
</style>
