<template>
	<view>
		<view class="u-p-40" style="background-color: #ffffff;">
			<view class="header u-border-bottom"
				style="display: flex;flex-direction: column;justify-content: space-between;align-items: center;padding-bottom: 80rpx;">
				<view>
					<u-image width="100rpx" height="100rpx" src="./imgs/gaosu.jpg" shape="circle"></u-image>
				</view>
				<view style="font-size:17px;margin-top: 20rpx;margin-bottom: 26rpx;color: #000000;">{{target}}</view>
				<view style="font-size: 28px;color: #000000;font-weight: bold;">{{tradeValue}}</view>
			</view>
			<view class="center u-p-t-20">
				<view>
					<u-field class="field-class" v-model="tradeStatus" label="当前状态" :label-width="160"
						:field-style="fieldStyle" :border-bottom="false" :clearable="false" placeholder=" "></u-field>
				</view>
				<view class="u-p-r-18">
					<u-field class="field-class" v-model="goodName" label="商品" :label-width="160"
						:field-style="fieldStyle" :border-bottom="false" :clearable="false"
						placeholder=" "></u-field>
				</view>
				<view>
					<u-field class="field-class" v-model="company" label="收单机构" :label-width="160"
						:field-style="fieldStyle" :border-bottom="false" :clearable="false" placeholder=" "></u-field>
				</view>
				<view>
					<u-field class="field-class" v-model="settleCompany" label="清算机构" :label-width="160"
						:field-style="fieldStyle" :border-bottom="false" :clearable="false" placeholder=" "></u-field>
				</view>
				<view>
					<u-field class="field-class" v-model="paytime" label="支付时间" :label-width="160"
						:field-style="fieldStyle" :border-bottom="false" :clearable="false" placeholder=" "></u-field>
				</view>
				<view>
					<u-field class="field-class" v-model="payway" label="支付方式" :label-width="160"
						:field-style="fieldStyle" :border-bottom="false" :clearable="false" placeholder=" "></u-field>
				</view>
				<view class="u-m-t-16">
					<u-field class="field-class" v-model="tradeDesc" label="支付说明" :label-width="160"
						:field-style="fieldTextareaStyle" type="textarea"  :border-bottom="false" :clearable="false" 
						placeholder=" "></u-field>
				</view>
				<view style="margin-top: -20rpx;">
					<view>
						<u-field class="field-class" v-model="tradeCode" label="交易单号" :label-width="160"
							:field-style="fieldStyle" :border-bottom="false" :clearable="false" placeholder=" "></u-field>
					</view>
					<view class="u-p-r-30">
						<u-field class="field-class" v-model="shanghu" label="商户单号" :label-width="160"
							:field-style="fieldStyle"  :border-bottom="false" :clearable="false"
							placeholder=" "></u-field>
					</view>
				</view>
				<view class="u-text-center u-m-t-20 u-m-b-30">
					<view class="u-flex u-row-center u-col-center">
						<view>
							<u-image src="./imgs/tiao-code.jpg" height="150rpx"  width="480rpx" mode="aspectFill"></u-image>
						</view>
					</view>
					<view>
						<text>{{shanghuCode}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="u-m-t-20 u-p-40" style="background-color: #ffffff;font-size: 30rpx;">
			<view style="padding-bottom: 30rpx;">
				<text>账单服务</text>
			</view>
			<view class="u-flex u-row-between u-col-center u-p-t-30 u-border-top">
				<view>
					<u-icon size="32" name="question-circle" color="#818ba4" label="对订单有疑惑" label-color="#818ba4"
						margin-left="12" top="4" label-size="30" label-pos="right"></u-icon>
				</view>
				<view class="">
					<u-icon size="32" name="coupon" color="#818ba4" label="开发票" label-color="#818ba4" margin-left="12"
						label-size="30" label-pos="right"></u-icon>
				</view>
				<view style="width: 30rpx;"> </view>
			</view>
			<view class="u-flex u-row-between u-col-center u-p-t-30 ">
				<view class="">
					<u-icon size="32" name="order" color="#818ba4" label="在此商户的交易" label-color="#818ba4"
						margin-left="12" label-size="30" label-pos="right"></u-icon>
				</view>
			</view>
		</view>
		<!-- position: absolute;bottom: 50rpx; -->
		<view style="width: 100%;text-align:center;padding:50rpx;color:#909399;">
			<text>本服务由财付通提供</text>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			recordData:{
				required:true,
				type:Object,
				default:function(){
					return null
				}
			}	
		},
		data() {
			return {
				fieldStyle: {
					color: '#000000',
					padding: '0rpx',
					margin: '0rpx',
					height: '70rpx',
				},
				fieldTextareaStyle: {
					width:'400rpx',
					color: '#000000',
					padding: '0rpx',
					margin: '0rpx',
					height: '70rpx',
					marginBottom:'0rpx',
				},
				tradeStatus: '支付成功',
				paytime: '2022年9月30日20:01:29',
				goodName: '高速通行费',
				company: '辽宁省高速公路运营管理有限责任公司',
				settleCompany: '财付通支付科技有限公司',
				payway: '交通银行储蓄卡(7961)',
				tradeDesc: '优先支付方式零钱扣款失败，已自动更换支付方式完成支付',
				tradeCode: '4200067662202209303339833402',
				shanghu:'可在支持的商户扫码退款',
				shanghuCode: '893226056885035008',
				tradeValue: '-40.00',
				target: '辽宁高速'
			};
		},
		mounted(){
			console.log("辽宁高速数据",this.recordData);
			this.tradeValue="-"+Number(this.recordData.tradeValue).toFixed(2);
			this.paytime=this.formatTimeStr(this.recordData.createTime);
			if(this.recordData.tradeValue==61){
				this.paytime="2023年9月29日 22:09:10";
				this.shanghuCode="893226056885031992";
				this.tradeCode="4200067662202209303259866205";
			}
		},
		methods:{
			formatTimeStr:function(timeStr){
				timeStr=timeStr.replace(/-/g,"/");
				let cdate=new Date(timeStr);
				let year=cdate.getFullYear();
				let yearStr=year+"年";
				let month= cdate.getMonth()+1;
				let day=cdate.getDate();
				let hour= cdate.getHours();
				let min=cdate.getMinutes();
				let s=cdate.getSeconds();
				let monthStr=month+"月";
				let dayStr=day+"日";
				let hourStr=hour+":";
				let minStr=min+":";
				let sStr=s;
				if(hour<10){
					hourStr="0"+hour+":";
				}
				if(min<10){
					minStr="0"+min+":";
				}
				if(s<10){
					sStr="0"+s;
				}
				let formatStr=yearStr+monthStr+dayStr+" "+hourStr+minStr+sStr;
				return formatStr;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.field-class {
		color: #909399 !important;
		font-size: 28rpx !important;
		margin: 0rpx !important;
		padding: 0rpx !important;
	}
</style>