257 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			257 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						||
	<view>
 | 
						||
		<u-navbar :title="tit" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' back-icon-color="#fff"
 | 
						||
			height='50'></u-navbar>
 | 
						||
			<view class="cont">  
 | 
						||
				
 | 
						||
				<view class="tip">注意:请下载保存收款码,不要截图保存</view>
 | 
						||
				     <view class="icon">
 | 
						||
				     	<view class="list_box">
 | 
						||
				     		<view class="lt">
 | 
						||
				     			<view class="tit">
 | 
						||
				     				上传二维码
 | 
						||
				     			</view>
 | 
						||
				     			<view class="wz">
 | 
						||
				     				必须清晰、方正、易于辨识
 | 
						||
				     			</view>
 | 
						||
				     		</view>
 | 
						||
				     		<view class="imgbox">
 | 
						||
				     			<view @click="getImage">
 | 
						||
				     				<image v-if="imglist == 'null'"
 | 
						||
				     					src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode="aspectFit">
 | 
						||
				     				</image>
 | 
						||
				     				<image v-else :src="imglist" style="width: 400rpx;" mode="aspectFit"></image>
 | 
						||
				     			</view>
 | 
						||
				     		</view>
 | 
						||
				     	</view>
 | 
						||
				     </view>
 | 
						||
				<view class="btn" @click="band()">
 | 
						||
					确认上传
 | 
						||
				</view>
 | 
						||
			</view>
 | 
						||
			<view v-if="btnmsk" style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .1;z-index: 999;"></view>
 | 
						||
	</view>
 | 
						||
</template>
 | 
						||
 | 
						||
<script>
 | 
						||
	export default {
 | 
						||
		data() {
 | 
						||
			return {
 | 
						||
				btnmsk:false,
 | 
						||
				bgc: {
 | 
						||
					backgroundColor: "#48893B",
 | 
						||
				},
 | 
						||
				name:'',
 | 
						||
				idnum:'',
 | 
						||
				cardnum:'',
 | 
						||
				tit:'二维码收款',
 | 
						||
				stause:false,
 | 
						||
				imglist: '',
 | 
						||
				token: '',
 | 
						||
				userImgs: '',
 | 
						||
				imgflag: true,
 | 
						||
				accountId:'',
 | 
						||
				flag:true,
 | 
						||
				domain:'',
 | 
						||
				userWithdrawChannelId:''
 | 
						||
			}
 | 
						||
		},
 | 
						||
		onLoad(option) {
 | 
						||
			console.log(option);
 | 
						||
			if(option.collectionCode){
 | 
						||
				this.imglist = option.collectionCode
 | 
						||
				this.userWithdrawChannelId = option.userWithdrawChannelId
 | 
						||
			}
 | 
						||
			this.userWithdrawChannelId = option.userWithdrawChannelId
 | 
						||
			console.log(this.imglist);
 | 
						||
			this.getQiniuToken()
 | 
						||
		},
 | 
						||
		methods: {
 | 
						||
			band(){
 | 
						||
				this.btnmsk = false
 | 
						||
				let data = {
 | 
						||
					collectionCode:this.imglist,
 | 
						||
					userWithdrawChannelId:this.userWithdrawChannelId
 | 
						||
				}
 | 
						||
				this.$u.post("app/user/uploadPaymentCode",data).then((res) => {
 | 
						||
					if (res.code == 200) {
 | 
						||
						uni.showToast({
 | 
						||
						  title: res.msg,
 | 
						||
						  icon: 'success',
 | 
						||
						  duration: 1000
 | 
						||
						})
 | 
						||
						setTimeout(()=>{
 | 
						||
							this.btnmsk = false
 | 
						||
							uni.navigateBack()
 | 
						||
						},1000)
 | 
						||
					}else{
 | 
						||
						uni.showToast({
 | 
						||
						  title: res.msg,
 | 
						||
						  icon: 'none',
 | 
						||
						  duration: 2000
 | 
						||
						})
 | 
						||
						this.btnmsk = false
 | 
						||
					}
 | 
						||
				})
 | 
						||
			},
 | 
						||
			getQiniuToken() {
 | 
						||
				this.$u.get("/common/qiniu/uploadInfo").then((res) => {
 | 
						||
					if (res.code == 200) {
 | 
						||
						this.token = res.token
 | 
						||
						this.domain = res.domain
 | 
						||
					}
 | 
						||
				})
 | 
						||
			},
 | 
						||
			getImage() {
 | 
						||
				let _this = this
 | 
						||
				let math = 'static/' + _this.$u.guid(20)
 | 
						||
				uni.chooseImage({
 | 
						||
					count: 1,
 | 
						||
					type: 'all',
 | 
						||
					success(res) {
 | 
						||
						const tempFilePaths = res.tempFiles
 | 
						||
						wx.uploadFile({
 | 
						||
							url: 'https://up-z2.qiniup.com',
 | 
						||
							name: 'file',
 | 
						||
							filePath: tempFilePaths[0].path,
 | 
						||
							formData: {
 | 
						||
								token: _this.token, //后端返回的token
 | 
						||
								key: 'smartmeter/img/' + math
 | 
						||
							},
 | 
						||
							success: function(res) {
 | 
						||
								let str = JSON.parse(res.data)
 | 
						||
								console.log(res);
 | 
						||
								_this.userImgs = _this.domain + '/' + str.key
 | 
						||
								console.log(_this.userImgs);
 | 
						||
								_this.imglist = _this.userImgs
 | 
						||
								_this.imgflag = false
 | 
						||
							}
 | 
						||
						})
 | 
						||
					}
 | 
						||
				})
 | 
						||
			},
 | 
						||
			
 | 
						||
		}
 | 
						||
	}
 | 
						||
</script>
 | 
						||
 | 
						||
<style lang="scss" >
 | 
						||
	/deep/ .u-title{
 | 
						||
		padding-bottom: 22rpx;
 | 
						||
	}
 | 
						||
	/deep/ .u-icon__icon{
 | 
						||
		padding-bottom: 22rpx;
 | 
						||
	}
 | 
						||
	page{
 | 
						||
		background: #F7FAFE;
 | 
						||
	}
 | 
						||
	.icon {
 | 
						||
		display: flex;
 | 
						||
		flex-wrap: wrap;
 | 
						||
		align-items: center;
 | 
						||
		margin-top: 40rpx;
 | 
						||
		width: 680rpx;
 | 
						||
	
 | 
						||
		.list_box {
 | 
						||
			width: 100%;
 | 
						||
			// display: flex;
 | 
						||
			// justify-content: space-between;
 | 
						||
			// padding-right: 45rpx;
 | 
						||
	
 | 
						||
			.lt {
 | 
						||
				// padding-top: 40rpx;
 | 
						||
	
 | 
						||
				.tit {
 | 
						||
					font-size: 32rpx;
 | 
						||
					color: #3D3D3D;
 | 
						||
				}
 | 
						||
	
 | 
						||
				.wz {
 | 
						||
					font-size: 26rpx;
 | 
						||
					color: #3D3D3D;
 | 
						||
					margin-top: 20rpx;
 | 
						||
				}
 | 
						||
			}
 | 
						||
	
 | 
						||
			.imgbox {
 | 
						||
				width: 100%;
 | 
						||
	            height: 600rpx;
 | 
						||
				margin-top: 30rpx;
 | 
						||
				background-color: #ccc;
 | 
						||
				image {
 | 
						||
					width: 200rpx;
 | 
						||
					height: 400rpx;
 | 
						||
				}
 | 
						||
			}
 | 
						||
		}
 | 
						||
	}
 | 
						||
	
 | 
						||
.cont{
 | 
						||
	display: flex;
 | 
						||
	// justify-content: center;
 | 
						||
	flex-wrap: wrap;
 | 
						||
	margin: 0 auto;
 | 
						||
	width: 594rpx;
 | 
						||
	.tip{
 | 
						||
		margin-top: 62rpx;
 | 
						||
		font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
 | 
						||
		font-weight: 400;
 | 
						||
		font-size: 24rpx;
 | 
						||
		color: #FF8D1A;
 | 
						||
		line-height: 36rpx;
 | 
						||
	}
 | 
						||
	.input_box{
 | 
						||
		margin-top: 66rpx;
 | 
						||
		width: 594rpx;
 | 
						||
		display: flex;
 | 
						||
		flex-wrap: nowrap;
 | 
						||
		align-items: center;
 | 
						||
		.text{
 | 
						||
			width: 30%;
 | 
						||
			// margin-right: 102rpx;
 | 
						||
			font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
 | 
						||
			font-weight: 400;
 | 
						||
			font-size: 24rpx;
 | 
						||
			color: #262B37;
 | 
						||
		}
 | 
						||
		.ipt{
 | 
						||
			width: 70%;
 | 
						||
			.u-input::placeholder {
 | 
						||
			    font-size: 20px;
 | 
						||
			    color: red;
 | 
						||
			}
 | 
						||
		}
 | 
						||
		.yzmbtn{
 | 
						||
			margin-left: 50rpx;
 | 
						||
			display: flex;
 | 
						||
			align-items: center;
 | 
						||
			justify-content: center;
 | 
						||
			width: 150rpx;
 | 
						||
			height: 50rpx;
 | 
						||
			background: #8EA9E4;
 | 
						||
			border-radius: 10rpx 10rpx 10rpx 10rpx;
 | 
						||
			
 | 
						||
			font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
 | 
						||
			font-weight: 400;
 | 
						||
			font-size: 20rpx;
 | 
						||
			color: #FFFFFF;
 | 
						||
		}
 | 
						||
	}
 | 
						||
	.btn{
 | 
						||
		display: flex;
 | 
						||
		align-items: center;
 | 
						||
		justify-content: center;
 | 
						||
		margin-top: 218rpx;
 | 
						||
		width: 590rpx;
 | 
						||
		height: 84rpx;
 | 
						||
		background: #48893B;
 | 
						||
		border-radius: 40rpx;
 | 
						||
		font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
 | 
						||
		font-weight: 400;
 | 
						||
		font-size: 36rpx;
 | 
						||
		color: #FFFFFF;
 | 
						||
		
 | 
						||
	}
 | 
						||
}
 | 
						||
</style>
 |