<template>
	<view v-if="data" >
		<view v-show="!showPopupBottom">
			<view class="content-title">商户新增门店申请</view>
			<p class="box-top">
				<view class="item-title">日期：<text style="color:#333;font-size:24rpx;">{{data.OPERATE_DATE}}</text></view>
				<text style="color:#F27B4C;font-size:24rpx;">{{stateEmun[data.PERMISSIONAPPLY_STATE]}}</text>
			</p> 
			<BaseDetail :baseData="data"/>
			<view class="card">
				<view class="title-row">
					<view class="title">
						<view>申请门店权限</view>
					</view>
				</view>
				<view class="row">
						<!-- 服务区 -->
						<image src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAiCAYAAAA3WXuFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTkxNUE3MkRDNURDMTFFQzlBOEFDQUQwNEEzNEE3MjAiIHhtcE1NO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+5Kf3DpIqR450vTTLB1F6FUKeYZ3A0rqJVFG3PMkfNgndr74ZCC5w1F63rFr6Z/ke1HwjHjZ2vVbnCJVO1+cB66F1pQiRZyOeqt/Oe7eV6rXXI2ygnnRscLJahIZckAaIP58Nqb4xLpApUxzuYq6xdE0B6TJLeYnfCtRaLa1K9hl8rzLWi8iV2XYWeW+ddVyP3O2UG3rCFVfrRD0GPVUMUqvsIUe07QIFUJ5/6qGKMiPxIUCfpfBP0SYADhDaNPYUPNhAAAAABJRU5ErkJggg==" mode="aspectFit" style="height: 36rpx;width:64rpx" />
					<view class="desc">
						{{data.SERVERPART_NAME ||'-'}}
					</view>
				</view>
				<view class="row"> <!-- 门店 -->	
					<image src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAiCAYAAAA3WXuFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwL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Xtsz8di7X9Bk6HuqHqFdQr6PudVQS2b6vVPgtp1tehQ2BurrQXDdeQDvBYPsruQr8FZPYtn9u2m/QzfxbKn6H0T1I8nkw2QSru/KPFI9iLuslcgD9tsE1QyVnlH+A3DhWQB/BC59zmfEGSyRGNnGQ7UQ7H5WKxyBfGWbtS3kvfxJyVtwfdTLpy7hR9A85mEPE+2idtSlADsDXCNPu6tylm3jIOl98lwdN+QbTDcW1dX3LvFpC/hGtB0oxdQnxeryA+oamKYD3D6PZNhIgb31H8VtYf6dG55on3hq81xwZPqwy4OSTox4FpZYgzDlynC8s3SyCDfDf1e9RcxDyjWEBRf3F/dj11pqtXkpIn0nY/o7Oo/BSLwwtGwN3PRZmTC/kYjKZs2LMs26DFahxKAbztD0FCG6sAUPnWUutnprzaD+F+R4EdMHY3zS6CPFxXn1CbHyOE1qNFLhc6RRD/GUKEGJ8tiJnfrNh2Go5ewndF5j1J8jCBG4Gc0mtY/lVFJg/bBI7krxQtscape5DwmYDK28xlAyYKOlUlYjY3wL1g+CQoI6h1q6thd7KgY0dxVUQPelEpzk+mVPudBnfP2HjeKUX+O9h87MRubKH+M4l/8VDN9DBRcxdw6KEbM7fbth8MRJXAQwPNw5Qdb8cHC/BI9s0Tg4DEOntVDrW3lifh/S+DAHM3qm44rojj3vjPi/I3C0xTsc1G6EY9A2PbN1UvQ+np3ANqDIgbxwfjLcTuHZs5djDKOmvjnGWHgD4n3wocrqWpjBzbqQtpogxtWoPSOoDKDdM6vki+ousbK8Ldea/HzOAJlj+E2AAkKJgt+Zq9g4AAAAASUVORK5CYII=" mode="aspectFit" style="height: 36rpx;width:64rpx;" />
					<view class="desc">
						{{data.APPLYSHOP_NAME||'-'}}
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title-row">
					<view class="title">
						<view>商户资料详情</view>
					</view>
				</view>
				<view class="row">
					<view class="title">
						身份证号
					</view>
					<view class="desc">
						{{data.USER_IDCARD||'-'}}
					</view>
				</view>
				<view class="row"  v-if="personImges && personImges.length>0">
					<view class="title">
						身份证照
					</view>
					<view class="desc" >
						<image src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABSCAMAAADEi7K1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAHCUExURUdwTFKb5IW8/4W8/1ag4lWe21WZ3YS8/1eg5Feh5IW8/4O6/4W6/4W8/4S8/////4W8/4S8/4W8/4W8/4O9/4S8/4W8/1Cf34W8/4e9/4W8/4S8/4W7/4W5/4W8/4S7/1Wf34W9/4W8/4W8/4e//4S9/4a7/4a7/5K2/4W8/4W8/4a8/4W4/6qq/4W8/02Z5oW8/1yl52Wp7FWi4IW8/////1Ke4LPV//D3/8Le/+nz/2ir7Vuk5rvZ/4zA/+Xx/4a9/4i+//7+//3+/4/C/6rQ/9Xo/93s/+rz/5LD//r8/5bF/4e9/+bx/+Du/+/2//X6/9Pn/5DC/57K/8jh//v9//n8/8zj/22u8Pz9//j7/3i098ni/5zJ/5/K/5rH/8nh/4u///b6/4G5/I3A/2qs7tDl/+v0/6HL/1uj5W+v8c7k/83k/8/k/6LM/+z1/6XN/+Hv/+31/9Tn/7DU/4q//12k52Cm6Xm1+LfY/8bf/5PE//L4/1Oe4HKx9LHU/9rr/5HD/6vR/2Kn6mut79bp/6fP/67S/9jp/3y2+a/T/8Ld/9/u/63S/4/B/8Pe/9/t/5nH/+jy//T5/7DT/9nq/6g8kSsAAAA0dFJOUwAc8ZjvFQ+g6N/eJUP5nAH3bsWfI1faEMJG1onbLME8GMT4RSQ6pnwH7MN2GQO2Cv22uCHmQd0iAAACIElEQVRYw+3Y+VPTQBQH8GBVqBZBBG/k8kRRxJeAgpC2FAoW0BZBvDhUQDkUlENBReS+Bf1/3TTSNpltunm7P3TGfn96M7vzmWQ2u9l5kqTF5TiZDawpv31LipfcC2ArNc7DcaRLB8AmpcSxjtqVCEW3sooAQVGtEkBRNOsYkqJYR7CU4jxlojLRlJJxyEgBnjJbPJTJ4qKMFh9lsBDUpEK3ENRPxWAVclBvDJRyMA1PTSt0C0HBW7qFoZ4pVAtDwROqhaLg3VeKhaNgdcps3cFSAK++LVTHpgJPmZOeopKG+rRRZZ33/Q/YqBE5cToGWSifzJK2AAO1yETJowxUCxv1nYG692+u9/nml674VKUN6jOp18RQblKrzUKoIKl7vUKohgCow2JeUG5rGJAFUdbhpVqHRFF1tfBIDOV/TT6PjyKo8XptWF3hp6qa9HH3HC81Gznt3I0IyhMtH3ZHZ0yM2aZamxr3y6cvYqfct0uRpVfX9Qdrfgk8FJFIlvpI+fgD8FC6BDBTJ3t9wEPtS2TBOpeBh2qptfp72qH89SCKspZsUZB01A6ZF7KmtENrnoHa1nZc+12L/NG25w8GamuP5WjvYboU/dpNCHnaVcZbX+h3pWV8wdS1NkX919QJTCuMnnOYBh09xzFtQ3rypTOCpLOSlJUjhspDNX5puRxu8BQIsG5e1ftOF09zQtlXyiJdOpfjfDHWuVZ6/UYY+Qv6cKIzp0aufwAAAABJRU5ErkJggg==" mode="aspectFit" style="height: 42rpx;width:37rpx;"  @click="priviewImages(1)" />
						
					</view>
				</view>
				<view class="row">
					<view class="title">
						经营商户
					</view>
					<view class="desc">
						{{data.BUSINESSMAN_NAME||'-'}}
					</view>
				</view>
				<view class="row" v-if="shopImges && shopImges.length>0">
					<view class="title">
						营业执照
					</view>
					<view class="desc">
						<image src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABSCAMAAADEi7K1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAHCUExURUdwTFKb5IW8/4W8/1ag4lWe21WZ3YS8/1eg5Feh5IW8/4O6/4W6/4W8/4S8/////4W8/4S8/4W8/4W8/4O9/4S8/4W8/1Cf34W8/4e9/4W8/4S8/4W7/4W5/4W8/4S7/1Wf34W9/4W8/4W8/4e//4S9/4a7/4a7/5K2/4W8/4W8/4a8/4W4/6qq/4W8/02Z5oW8/1yl52Wp7FWi4IW8/////1Ke4LPV//D3/8Le/+nz/2ir7Vuk5rv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ZbX+h3pWV8wdS1NkX919QJTCuMnnOYBh09xzFtQ3rypTOCpLOSlJUjhspDNX5puRxu8BQIsG5e1ftOF09zQtlXyiJdOpfjfDHWuVZ6/UYY+Qv6cKIzp0aufwAAAABJRU5ErkJggg==" mode="aspectFit" style="height: 42rpx;width:37rpx;" @click="priviewImages(2)" />
					</view>
				</view>
			</view>
			<view class="card">
				<view class="row jc-between" style="padding-top: 0;">
					<view  style="color: #2f93e7;">审批意见</view>	
					<text v-if="data.APPOVED_DATE" style="color:#878F94">{{$util.cutDate( data.APPOVED_DATE,'YYYY/MM/DD hh:ss')}}</text>
				</view>
				<view class="approved-reason">
					<view class="desc">
						<textarea 
						 :value="approvalReason"
						 placeholder="请输入" 
						 placeholder-style="color:#969EA4;line-height:2;padding-top:10rpx;"
						  auto-height
						 @blur="changeReason"
						 v-if="data.PERMISSIONAPPLY_STATE===2000"
						 auto-focus
						 ></textarea>
						<template v-else>
							{{data.APPOVED_NAME}}:{{data.APPOVED_INFO||''}}
						</template>
					</view>
				</view>
				<view class="button-box" v-if="data.PERMISSIONAPPLY_STATE===2000">
					<span @tap="cancelApproval"><image src="@/static/images/bh-btn.png" mode="aspectFit"></image>否决</span>
					<span @click="showPopupBottom=true"><image src="@/static/images/sh-btn.png" mode="aspectFit"></image>授权门店</span>
				</view>
			</view>
		</view>

		<view v-if="data.PERMISSIONAPPLY_STATE===9000">
			<view class="card">
				<view class="title-row">
					已授权门店
				</view>
				<view class="" v-if="approvalList && approvalList.length">
					<view class="select-item" v-for="item in approvalList" :key="item.value">
						<view>{{item.label}}</view>
					</view>
				</view>
			</view>
		</view>
		<view  v-show="showPopupBottom">
			<!-- <view class="" style="text-align: left;padding-left: 28rpx;line-height: 3.4;">
				请选择需要授权的门店
			</view> -->
			<view class="uni-flex jc-between"  style="padding:24rpx 28rpx;line-height: 3.4;">
				<view class="title">门店授权</view>
				<view> 
					<span v-if="selectShopids.length">
						已选
						<span style="color: #007AFF;">{{selectShopids.length}}</span>
						家门店
					</span>
				</view>
			</view>
			
			<ShopList :data="shops" @changeValues="changeValues"/>
			<view class="button-box" >
				<span @click="showPopupBottom=false" ><image src="@/static/images/cy-btn.png" mode="aspectFit"></image> 返回</span>
				<span @click="savaShops"><image src="@/static/images/sh-btn.png" mode="aspectFit"></image>确认授权</span>
			</view>
		</view> 
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	import ShopList from'./SelectShopList.vue'
	import UniPopup from '@/components/uni-popup.vue'
	import BaseDetail from './baseDetail.vue'
	export default {
		props: {
			data: {
				type: Object,
				
			},
			businessId: {
				type: String,
				required: true
			},
			approvalData:{ // 审核通过时，被授权的门店数据 
				type: Object,
				required: false
			},
			imagsList:{ // 附件信息
				type: Array,
				required: false
			}
		},
		components:{
			ShopList,
			UniPopup,
			BaseDetail
		},
		computed: {
			...mapState({
				user: (state)=>{ return state.userData}
			}),
			approvalList () {
				
				return this.approvalData	&& this.approvalData.NewList ? this.approvalData.NewList.map(n=>n.node) : []
			},
			personImges(){
				const imags =  this.approvalData && this.approvalData.PictureList ? this.approvalData.PictureList.filter(m=>m.ImageType==3000||m.ImageType==4000) :[]
				return imags.map(n=>n.ImageUrl)
			},
			shopImges (){
				const imags =  this.approvalData && this.approvalData.PictureList ? this.approvalData.PictureList.filter(m=>m.ImageType==1000) :[]
				return imags.map(n=>n.ImageUrl)
			}
		},
		data() {
			return {
				showPopupBottom: false,
				shops:[],
				selectShopids:[],
				approvalReason: '',
				isloading:false,
				stateEmun: {2000:"办理中",3000:"未通过",9000:"已通过"}
			}
		},
		methods: {
			changeReason(event){
				this.approvalReason = event.detail.value
			},
			hidePopup(){
				this.showPopupBottom = false
			},
			priviewImages(type){ // 1 身份证正反面 2 营业执照
				uni.previewImage(type===1 ? {urls: this.personImges} : {urls: this.shopImges})
			},
			changeValues(values){
				let list = [] // this.selectShopids
				let _this =this
				if(values.length){
					_this.shops.forEach(n=>{
						const index = values.includes(n.value)
						if(index){
							list.push({
								PERMISSIONAPPLY_ID: this.data.PERMISSIONAPPLY_ID,
								SERVERPART_NAME: this.data.SERVERPART_NAME ,
								SERVERPART_ID: this.data.SERVERPART_ID,
								SERVERPARTSHOP_NAME: n.label,
								SERVERPARTSHOP_ID: n.value,
								PERMISSIONAPPLY_TYPE: 4000,
								PERMISSIONAPPLYDETAIL_TYPE:2000,
								OPERATE_DATE: new Date()
							})
						}
					})
				}
				this.selectShopids=list
				// this.hidePopup()
			},
			getShops(data) {
				let _this = this
				this.$request.$webGet('/EShangApiMain/BaseInfo/GetServerpartShopDDL',{
					ProvinceCode: data.OWNERUNIT_ID,
					ServerpartId: data.SERVERPART_ID
				}).then(res=>{
					if(res.Result_Code!==100) return 
					_this.shops = res.Result_Data.List
				})
			},
			savaShops() {
				let _this = this
				if(!this.selectShopids.length){
					uni.showToast({ title: '请选择需要授权的门店' ,icon:'none'})
					return 
				}
				if(_this.isloading) return
				uni.showLoading({
					title:'正在提交'
				})
				_this.isloading = true
				const permissionApplyModel = {
					...this.data,
					APPOVED_NAME: this.user.Membership_Name,
					APPOVED_INFO: this.approvalReason ||'通过',
					APPOVED_ID: this.user.UserId,
					PERMISSIONAPPLY_STATE: 9000,
					APPOVED_DATE: new Date()
				}
				this.$request.$webPost('/EShangApiMain/BusinessProcess/ApprovedMerchantApply',{
					PermissionApplyModel: permissionApplyModel,
					PermissionApplyDetailList: this.selectShopids
				}).then(res=>{
					uni.hideLoading()
					_this.isloading=false
					if(res.Result_Code!==100) {
						uni.showModal({
							title: '温馨提示',
							content: res.Result_Desc
						})
						return
					}
					uni.showModal({
						title: '温馨提示',
						content: res.Result_Desc,
						showCancel:false,
						success: function (res) {
							if (res.confirm) {
								_this.$util.toNextRoute('reLaunch', "/pages/authorityApproval/index")
								} 
							}
					})
				})
			},
			cancelApproval(){
				let _this = this
				if(!this.approvalReason){
					uni.showToast({ title: '请填写否决意见' ,icon:'none'})
					return 
				}
				if(_this.isloading) return
				uni.showLoading({
					title:'正在提交'
				})
				_this.isloading=true
				const permissionApplyModel = {
					...this.data,
					 APPOVED_NAME:this.user.Membership_Name,
					 APPOVED_INFO: this.approvalReason,
					 APPOVED_ID: this.user.UserId,
					  PERMISSIONAPPLY_STATE: 3000,
					  APPOVED_DATE:new Date()
				  }
				this.$request.$webPost('/EShangApiMain/BusinessProcess/RejectPermissionApply',{
					PermissionApplyModel: permissionApplyModel
				}).then(res=>{
					uni.hideLoading()
					_this.isloading=false
					if(res.Result_Code!==100) {
						uni.showModal({
							title: '温馨提示',
							content: res.Result_Desc
						})
						return
					}
					uni.showModal({
						title: '温馨提示',
						content: res.Result_Desc,
						showCancel:false,
						success: function (res) {
							if (res.confirm) {
							// _this.$emit('refresh')
								_this.$util.toNextRoute('reLaunch', "/pages/authorityApproval/index")
								} 
							}
					})
					
				})
			}
		},
	
	}
</script>

<style lang="stylus">
	@import url("/common/css/tenderingDetail.css");
	.card {
		background-color: #fff;
		border-radius: 12rpx;
		margin: 24rpx 24rpx 24rpx;
		padding: 24rpx;
		box-shadow: 0px 4px 12px 0px rgba(225,225,225,0.56); 
		
		.row,.title-row {
			display flex;
			align-items center
			line-height 2
			padding 24rpx 0
			.title {
				flex 5
				.tag {
					background-color #5BC898
					color #FFFFFF
					padding 0rpx 8rpx
					border-radius 6rpx
					font-size 24rpx
					display inline-block
				}
				font-size 26rpx
			}
			.desc {
				flex 19
				color #3C3C3C
				font-size 26rpx
				textarea {
					width auto
					height 50rpx
					padding-top 4rpx
					line-height 1.5
				}
			}
			&:last-child {
				border none
				padding-top: 0
			}
			
		}
		.row +.row {
			padding-top: 0
		}
		.title-row {
			border-bottom 1px solid #F1F1F1
			padding-top 0
		}
		.approved-reason {
			padding: 16rpx 24rpx;
			background: #F8F9FB;
			border-radius: 4rpx;
			min-height: 97rpx;
			line-height: 2;
		}
		.uni-icon-arrowright {
			color: #969EA4;
			font-size: 24rpx;
			margin-left 16rpx;
		}
		.select-item {
			background: #f6f9fe;
			border-radius: 12rpx;
			padding 24rpx
			margin-top 24rpx
			line-height 2
		}
	}
	.back-btn {
		width: 241rpx;
		height: 94rpx;
		border: 1rpx solid #b3b3b3;
		border-radius: 48rpx;
		line-height 94rpx
		color #7D7D7D
		text-align center
	}
	.confirm-btn {
		margin: 40rpx 0;
		width: 394rpx;
		height: 94rpx;
		background: #618ade;
		border-radius: 48rpx;
		line-height 96rpx
		color #FFFFFF
		text-align center
		margin-left 24rpx
	}
</style>
