<template>
	<view class="page">
		<!-- 记录列表 -->
		<view class="record-list">
			<view class="good-item">
				<view class="img">
					<u-image width="100%" height="100%" border-radius="10" :src="record.cereBasicInformationShop&&record.cereBasicInformationShop.displayMainImage?$img + record.cereBasicInformationShop.displayMainImage:record.cereBasicInformationVenue&&record.cereBasicInformationVenue.displayImage?$img + record.cereBasicInformationVenue.displayImage:record.cereAdvertisingInformation&&record.cereAdvertisingInformation.locationDiagram?$img + record.cereAdvertisingInformation.locationDiagram:''"></u-image>
				</view>
				<view class="info">
					<view class="title">{{
						record.cereBasicInformationShop&&record.cereBasicInformationShop.shopName?record.cereBasicInformationShop.shopName:record.cereBasicInformationVenue&&record.cereBasicInformationVenue.venueName?record.cereBasicInformationVenue.venueName:record.cereAdvertisingInformation&&record.cereAdvertisingInformation.advertisingName?record.cereAdvertisingInformation.advertisingName:''}}</view>
					<!-- <view class="info-item" style="margin-bottom: 30rpx;">
						<u-tag text="标签标签" type="success" size="mini"/>
						<u-tag text="标签标签" type="success" size="mini"/>
					</view> -->
					<view class="info-item" style="margin-bottom: 24rpx;" v-if="!record.advertisingSpaceType">
						<u-image :showLoading="true"  :src="$imgUrl('/location-icon.png')"  width="20rpx" height="20rpx"></u-image>
						<text>{{
							record.cereBasicInformationShop&&record.cereBasicInformationShop.detailedLocation?record.cereBasicInformationShop.detailedLocation:record.cereBasicInformationVenue&&record.cereBasicInformationVenue.detailedLocation?record.cereBasicInformationVenue.detailedLocation:''
							}}</text>
					</view>
					<view class="info-item" style="margin-bottom: 24rpx;" v-if="record.advertisingSpaceType">
						<text style="padding-right: 20rpx;">广告位类型：</text>
						<text>{{record.advertisingSpaceType?record.advertisingSpaceType:''
							}}</text>
					</view>
					<view class="info-item">
						<text style="padding-right: 20rpx;" >租金：<span>￥{{moban[0].rentalPrice}}/{{moban[0].leaseTerm}}</span></text>
						<text v-if="!record.advertisingSpaceType">面积：<span>81/m²</span></text>
					</view>
				</view>
			</view>
		</view>
		<view class="msglist">
			<!-- 租赁详情 -->
			<view class="form-item">
				<view class="label">申请时间</view>
				<text>{{record.applicationTime}}</text>
			</view>
			<view class="form-item">
				<view class="label">申请状态</view>
				<text> {{record.auditStatus =='1'?'待审核':record.auditStatus =='2'?'待签约':record.auditStatus =='3'?'已驳回':record.auditStatus =='4'?'已签约':'已终止'}}</text>
			</view>
			<view class="form-item" v-if="!record.advertisingSpaceType">
				<view class="label">经营用途</view>
				<text>{{record.businessPurpose}}</text>
			</view>
			<view class="form-item" v-if="record.advertisingSpaceType">
				<view class="label">投放时段</view>
				<text>{{record.scheduleTime}}</text>
			</view>
			<view class="form-item" v-if="record.advertisingSpaceType">
				<view class="label">链接</view>
				<text>{{record.redirectUrl}}</text>
			</view>
			<view class="form-item" v-if="record.advertisingSpaceType">
				<view class="label">广告标题</view>
				<text>{{record.adTitle}}</text>
			</view>
			<view class="form-item" v-if="!record.advertisingSpaceType">
				<view class="label">意向租期</view>
				<text>{{record.intendedLeaseTerm}}</text>
			</view>
			<view class="form-item" v-if="!record.advertisingSpaceType">
				<view class="label">经营主体</view>
				<text>{{record.entityName}}</text>
			</view>
			<!-- 广告显示 -->
			<view class="form-item" label-top v-if="record.advertisingSpaceType">
				<view class="label">广告图片</view>
				<view class="img">
					<u-image width="304rpx" height="182rpx"   :src="$img + record.coverImage" ></u-image>
				</view>
			</view>
		</view>
		<view class="msglist">
			<view class="form-item">
				<view class="label">经营者姓名</view>
				<text>{{shopMsg.name}}</text>
			</view>
			<view class="form-item">
				<view class="label">证件类型</view>
				<text>{{shopMsg.idCardType}}</text>
			</view>
			<view class="form-item">
				<view class="label">身份证号码</view>
				<text>{{shopMsg.idCardNumber}}</text>
			</view>
			<!-- <view class="form-item">
				<view class="label">身份证有效期</view>
				<text>{{record.idValidStart || record.idCardValidStart}}至 {{record.idValidEnd || record.idCardValidEnd}}</text>
			</view> -->
			<view class="form-item" label-top>
				<view class="label">身份证照片</view>
				<view class="deom-box">
					<view class="img-deom">
						<u-image width="304rpx" height="182rpx"  :src="$img+shopMsg.idCardFrontImage"></u-image>
					</view>
					<view class="img-deom">
						<u-image width="304rpx" height="182rpx"  :src="$img+shopMsg.idCardBackImage"></u-image>
					</view>
				</view>
			</view>
			<!-- <view class="form-item" label-top>
				<view class="label">企业授权书</view>
				<view class="img">
					<u-image width="304rpx" height="182rpx" :src="record.enterpriseAuthorization" ></u-image>
				</view>
			</view> -->
		</view>
		
		<!-- <view class="footbtn" v-if="record.auditStatus == '2'">
			<view class="info-total">
				<view >租期：<span v-if="!record.advertisingSpaceType">2年</span> <span v-if="record.advertisingSpaceType">2/天</span></view>
				<view >租金：<span v-if="!record.advertisingSpaceType">1067/月</span> <span v-if="record.advertisingSpaceType">150/天</span></view>
				<view>合计：<span>元</span></view>
			</view>
			<view class="footer-btn">
				<u-button type="primary" shape="circle">查看合同</u-button>
				<u-button type="success" shape="circle" @click="Zhicheck()">立即支付</u-button>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				record:{},
				shopMsg:{},
				moban:[]
			}
		},
		 onLoad(options) {
		    const item = JSON.parse(decodeURIComponent(options.item));
		    console.log('Received item:', item);
			this.record = item
			let objst = {
			  pageNumber: 0,
			  pageSize: 10,
			  checkState: "2",
			   phone:item.applicant
			}
			let paesize = {
				pageNumber: 0,
				pageSize: 10,
				resourcesId: ''
			}
			if(item.cereAdvertisingInformation.id){
				paesize.resourcesId = `gg${item.cereAdvertisingInformation.id}`
			}else if(item.cereBasicInformationShop.id){
				paesize.resourcesId = `sp${item.cereBasicInformationShop.id}`
			}else{
				paesize.resourcesId = `cd${item.cereBasicInformationVenue.id}`
			}
			this.$http.sendRequest('/cerePlatformMerchant/queryByPage', 'POST', objst,1).then(res => {
							this.shopMsg = res.data.data.content[0]
							
			})
			this.$http.sendRequest('/cereResourceStrategy/queryByResources', 'POST', paesize,1).then(res => {
				this.moban = res.data.data
			})
		  },
		methods: {
			Zhicheck(){
				let payList ={
					additional: "附加交易授权",
					backUrl: "",
					channelId: "",
					expireTime: 1800,
					finishUrl: "",
					latitude: "1",
					longitude: "1",
					orderNo: "",
					payId: "",
					payMerData: [
						{
							amount: 100,
							body: "租赁信息",
						}
					],
					payType: "Online",
					returnUrl: "",
					showBtn: "1",
					siteId: "",
					toApp: "0",
					totalAmount: 100,
					uid: "1693617316237021185",
					universalLink: ""
				}
				  const randomNumber = Math.floor(Math.random() * 10000); // 生成一个0到9999之间的随机数
				      const timestamp = new Date().getTime(); // 获取当前时间的时间戳
				      payList.orderNo = `${randomNumber}${timestamp}`
							
				payList.uid =uni.getStorageSync('shopId')
				this.$http.sendRequest('/aggregationPayment/createOrder', 'POST', payList,1).then(res => {
								uni.showModal({
									title: res.data.message,
									showCancel:false,
									success:ress => {
										uni.switchTab({
											url: '/pages/my/my'
										})
									}
								})
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import 'accepting.scss';
</style> 
