<template>
	<view class="apply-wrap flex flex_column" v-if="form" >
		<view class="title flex align_center justify_center">
			<u-icon :name="form.auditStatus == 'PASS'?'icon_complete':(form.auditStatus == 'WAIT'?'wait':'icon_cancel')" custom-prefix="iscm-icon" size="40"></u-icon>
			<text style="margin-left: 0.5rem;">{{form.auditStatusDictValue}}</text>
		</view>
		<view class="login-form">
			<u-form :model="form" label-width="180rpx" :error-type="['toast']" ref="uForm">
				<u-form-item label="门头照片">
					<u-image v-if="form.storeImage" :src="form.storeImage" width="200" height="150"></u-image>
					<text v-else>未上传</text>
				</u-form-item>
				<u-form-item label="营业执照">
					<u-image v-if="form.licenseImage" :src="form.licenseImage" width="200" height="150"></u-image>
					<text v-else>未上传</text>
				</u-form-item>
				<u-form-item label="门店名称">
					<view style="word-break: break-all;line-height: normal;">
						{{form.storeName||'--'}}
					</view>
				</u-form-item>
				<u-form-item label="所在地区">
					<view style="word-break: break-all;line-height: normal;">
						{{form.label||'--'}}
					</view>
				</u-form-item>
				<u-form-item label="详细地址">
					<view style="word-break: break-all;line-height: normal;">{{form.addrDetail||'--'}}</view>
				</u-form-item>
				<u-form-item label="联系人姓名">
					<view style="word-break: break-all;line-height: normal;">
					{{form.contactName||'--'}}
					</view>
				</u-form-item>
				<u-form-item label="联系人手机">
					{{form.contactPhone||'--'}}
				</u-form-item>
				<u-form-item label="关联客户" v-if="form.auditStatus == 'PASS'">
					<view style="word-break: break-all;line-height: normal;">
						{{form.customerName||'--'}}
					</view>
				</u-form-item>
				<u-form-item label="结算方式" v-if="form.auditStatus == 'PASS'">
					{{form.settleTypeDictValue||'--'}}
				</u-form-item>
				<u-form-item label="授信金额" v-if="form.auditStatus == 'PASS'&&form.settleType == 'CREDIT'">
					{{form.creditLimit||'--'}}
				</u-form-item>
			</u-form>
		</view>
	</view>
</template>

<script>
	import { xprhStoreApplyDetail } from '@/api/approveStore'
	export default{
		data(){
			return{
				loading: false,
				theme: '',
				form: {
					storeName: '', // 门店名称
					contactPhone: '', //  联系手机
					contactName: '', //  联系人
					addrProvince: undefined, //  省
					addrProvinceName: '',
					addrCity: undefined, // 市
					addrCityName: '',
					addrDistrict: undefined, // 区
					addrDistrictName: '',
					addrDetail: '', //  详细地址
					storeImage: '', // 门头照片
					licenseImage: '', // 营业执照
					settleType: undefined, //  结算方式
					settleTypeDictValue: undefined,
					customerSn: undefined, //  关联客户
					customerName: undefined,
					creditLimit: '', //  授信额度
					delearSn: undefined,
					applySn: undefined,
					auditStatus: undefined // 审核状态
				},
				rules: {},
				areaIdArr: [],  //  省市区id数组
				labelArr: [],
			}
		},
		onLoad(options) {
			const _this = this
			this.applySn = options.sn
			this.getDetail()
		},
		methods: {
			//  获取详细
			getDetail () {
			  xprhStoreApplyDetail({ sn: this.applySn }).then(res => {
				  console.log(res)
			    if (res.status == 200) {
			      this.form = Object.assign(this.form, res.data)
				  this.form.addrDetail = this.form.addrDetail || '--'
				  if(this.form.addrProvinceName&&this.form.addrCityName&&this.form.addrDistrictName){
				  	this.labelArr = [this.form.addrProvinceName,this.form.addrCityName,this.form.addrDistrictName]
				  	this.areaIdArr = [this.form.addrProvince,this.form.addrCity,this.form.addrDistrict]
				  	this.form.label = this.labelArr.join('-')
				  }else{
					this.labelArr = []
					this.areaIdArr = []
					this.form.label = '--'
				  }
			    }  
			  })
			},
		}
	}
</script>
<style scoped lang="scss">
	.apply-wrap{
		width:100%;
		height: 100vh;
		background-color: #fff;
		.title{
			text-align: center;
			font-size: 1.2rem;
			border-bottom: 0.5rem solid #f8f8f8;
			padding: 0.5rem;
		}
		.login-form{
			padding: 0.7rem 1.5rem;
			flex-grow: 1;
			overflow: auto;
		}
	}
</style>
