<style scoped lang="scss">
	.brandInformation{
		width: 100%;
		.slot-btn{
			width: 220rpx;
			height: 220rpx;
			background: #F5F5F5;
			border-radius: 17rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.slot-btn .image{
			width: 54rpx;
			height: auto;
		}
		#myVideo2{
			width: 150px; height: 200px;
		}
		.bottom-border{
			border-bottom: 3rpx #DADCE6 solid;
			margin-top: 10px;
			.bottom-border_r{
				height: 42px;
				display: flex;
				align-items: center;
			}
			.con6 {
				display: flex;
				flex-wrap: wrap;
			
				.goodsTypeImg {
					width: 278rpx;
					height: 144rpx;
					background-color: #232323;
					opacity: 0.6;
					border-radius: 18rpx;
					margin-bottom: 30rpx;
				}
			}
			.u-action-sheet-item {
				display: flex;
				line-height: 1;
				justify-content: center;
				align-items: center;
				font-size: 14px;
				padding: 34rpx 0;
				
			}
			 .pubox{
				width: 100%;
				
			}
			 .pubox-top{
				width: 100%;
				height: 45px;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 14px;
				color: #111;
			}
			.u-gab {
				height: 12rpx;
				background-color: rgb(234, 234, 236);
			}
			.u-actionsheet-cancel {
				color: $u-main-color;
			}
			
		}
		.butBox2 {
			margin: 10rpx auto;
			width: 300rpx;
			height: 80rpx;
			background-color: #F70027;
			box-shadow: 0rpx 4rpx 40rpx 0rpx rgba(249, 54, 85, 0.58);
			border-radius: 20rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 28rpx;
			font-weight: bold;
			color: #FFFFFF;
		
			.next {
				width: 100%;
				height: auto;
			}
		}
	}
</style>

<template>
	<view class="brandInformation">
		<!-- <view class="bottom-border" v-if="datas.CompanyStatus==-1">
			<view class="label-text">关联品牌</view>
			<view class="bottom-border_r" style="padding: 10px 0;height: 42px;display: flex;" @click="disabled==false? gobrandsearch():''">
				<input type="text" v-model="glBrandName" :disabled="true" style="padding: 10px 0;width: 1px;flex:1" placeholder="请选择关联品牌"  placeholder-style="color:#CECECE;">
				<u-icon name="arrow" color="#A5A4AC" size="30" ></u-icon>
			</view>
		</view> -->
		<view class="bottom-border">
			<view class="label-text">品牌分类<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r" style="padding: 10px 0;height: 42px;display: flex;" @click="disabled || disabled3?'':showTypeStatus= true">
				<input type="text" v-model="BrandClassName" :disabled="true" style="padding: 10px 0;width: 1px;flex:1" placeholder="请选择品牌分类"  placeholder-style="color:#CECECE;">
				<u-icon name="arrow" color="#A5A4AC" size="30" ></u-icon>
			</view>
			<u-popup v-model="showTypeStatus" mode="bottom" >
				<view class="pubox" >
					<scroll-view scroll-y="true" style="max-height: calc(100vh * 0.7 - 65px) ;">
						<view >
							<view v-for="(x,y) in BrandClassList" :key="y" class="u-action-sheet-item u-border-bottom" @click="clickItem(x)" :style="{color:x.ID == model.BrandClassId?'#2979ff':'#111',}">
								{{x.ClassName}}
							</view>
						</view>
					</scroll-view>
					<view class="u-gab" ></view>
					<view  class="u-actionsheet-cancel u-action-sheet-item" hover-class="u-hover-class"
					 :hover-stay-time="150" @click="showTypeStatus=false">取消</view>
				</view>
			</u-popup>
		</view>
		
		<view class="bottom-border">
			<view class="label-text">品牌名<span style='color: #E54D42;' >*</span></view>
			<input type="text" v-model="model.BrandName" style="padding: 10px 0;" placeholder="请填写品牌名" :disabled="disabled|| disabled2?true:false"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">品牌全名 <span style='color: #E54D42;' >*</span></view>
			<input type="text" v-model="model.FullBrandName" style="padding: 10px 0;" placeholder="请填写品牌全名" :disabled="disabled||disabled2?true:false"  placeholder-style="color:#CECECE;">
		</view>
		<view class="label-text" style="margin-top:20px;margin-bottom: 30rpx;">
			<text>Logo</text>
			<span style='color: #E54D42;' >*</span>
		</view>
		<view @click="disabled?'':uploadcard()">
			<view slot="addBtn" class="slot-btn" v-if="model.Logo==''" > 
				<image class="image" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1616498310000_18.png" mode="widthFix"></image>
			</view>
			<view class="slot-btn" v-if="model.Logo!=''" @click="disabled?previewImage([model.Logo],1):''">
				<image style="width: 220rpx;height: 220rpx;"  :src="model.Logo" mode="aspectFill"></image>
			</view>
			
		</view>
		<view class="label-text" style="margin-top:20px;margin-bottom: 30rpx;">
			<text>介绍图</text>
			<span style='color: #E54D42;' >*</span>
			<text style="color:#999;font-weight: 400;">（最多9张,第一张为封面图）</text>
		</view>
		<view>
			<u-upload  :action="action" :max-count="9" :max-size="2*1024*1024" :deletable='!disabled' :file-list="fileList" @on-remove="onRemove1"  :custom-btn="true" @on-success="uploadSuccessHandler">
				<view slot="addBtn" class="slot-btn" v-if='disabled==false'> 
					<image class="image" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1616498310000_18.png" mode="widthFix"></image>
				</view>
			</u-upload>
		</view>
		<view class="label-text" style="margin-top:20px;margin-bottom: 30rpx;">
			<text>品牌视频</text>
		</view>
		<view style="margin-bottom: 30rpx;">
			<view style="width: 150px; height: 200px;position: relative;margin-right: 20px;" v-if="model.VideoUrl!=''">
				<video id="myVideo2" :src="model.VideoUrl" style="width: 150px; height: 200px;"
					:controls='controls'
					:show-center-play-btn='true'
					:show-fullscreen-btn='true' 
					 ></video>
					
				<!-- 	<view style="width: 100%;height: 100%;position: absolute;left: 0;top: 0;display: flex;align-items: center;justify-content: center;" @click="enlarge(model.VideoUrl)">
						<u-icon name="play-circle-o" :size="70" color="#FFF"></u-icon>
					</view> -->
					<view style="width: 50rpx;height: 50rpx;position: absolute;right: 10rpx;top:10rpx;
						border-radius: 25rpx;
						background: #F30329;
						display: flex;
						align-items: center;
						justify-content: center;
					" @tap.stop="model.VideoUrl=''"	
						v-if='!disabled'
					>
						<u-icon class="u-icon" name="cross" size="30" color="#ffffff"></u-icon>
					</view>
			</view>
			<view v-if="model.VideoUrl=='' ">
				<view slot="addBtn" class="slot-btn" @click="disabled?'': upvideo()">
					<image class="image" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/1616573063000_398.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
		
		<view class="bottom-border">
			<view class="label-text">店铺数量<span style='color: #E54D42;' >*</span></view>
			<input type="number" v-model="model.ShopNum" style="padding: 10px 0;" placeholder="请填写店铺数量" :disabled="disabled"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">开店意愿<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r " style="padding: 10px 0;height: 42px;display: flex;">
				<!-- <radio-group @change="radioChange2($event)" style="display: flex;">
					<label v-for="(item, index) in radiolist" :key="index" style="display: flex;margin-right: 10px;">
						<view style="transform:scale(0.7)">
							<radio :value="item.Id" :checked="item.Id == ShopWish" :disabled="disabled" color='#2979ff'/>
						</view>
						<view>{{item.name}}</view>
					</label>
				</radio-group> -->
				<u-rate
					:disabled="disabled"
					v-model="model.OpenShopWish"
					:current="model.OpenShopWish?model.OpenShopWish:'5'"
					:active-color="mainColor" inactive-color="#DDDDDD"
					active-icon="star"
					inactive-icon="star-o"
					size="40"
					@change='score'
				></u-rate>
			</view>
		</view>
		<view class="bottom-border">
			<view class="label-text">建筑面积(m²)<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r" style="padding: 10px 0;height: 42px;display: flex;">
				<input type="number" v-model="model.BuiltUpArea" style="width: 1px;flex: 1;" placeholder="请填写建筑面积" :disabled="disabled"  placeholder-style="color:#CECECE;">
				<span  style='margin: 0 10px;'>~</span>
				<input type="number" v-model="model.EndBuiltUpArea" style="width: 1px;flex: 1;" placeholder="请填写建筑面积" :disabled="disabled"  placeholder-style="color:#CECECE;">
			</view>
		</view>
		<view class="bottom-border">
			<view class="label-text">需求面积(m²)<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r" style="padding: 10px 0;height: 42px;display: flex;">
				<input type="number" v-model="model.AreaRequirement" style="width: 1px;flex: 1;" placeholder="请填写需求面积" :disabled="disabled"  placeholder-style="color:#CECECE;">
				<span style='margin: 0 10px;'>~</span>
				<input type="number" v-model="model.EndAreaRequirement" style="width: 1px;flex: 1;" placeholder="请填写需求面积" :disabled="disabled"  placeholder-style="color:#CECECE;">
			</view>
		</view>
		<view class="bottom-border">
			<view class="label-text">客群定位<span style='color: #E54D42;' >*</span></view>
			<input type="text" v-model="model.CustomerType" style="padding: 10px 0;" placeholder="请填写客群定位" :disabled="disabled"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">品牌定位<span style='color: #E54D42;' >*</span></view>
			<input type="text" v-model="model.BrandType" style="padding: 10px 0;" placeholder="请填写品牌定位" :disabled="disabled"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">拓店区域<span style='color: #E54D42;' >*</span></view>
			<input type="text" v-model="model.StoreExpansion" style="padding: 10px 0;" placeholder="请填写拓店区域" :disabled="disabled"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">商铺性质<span style='color: #E54D42;' >*</span></view>
			<view class="con6" style="margin-top: 20px;">
				<u-radio-group v-model="model.ProjectType">
					<u-radio v-for="(item1, index1) in goodsType" :key="index1" :name="item1.Id" shape="circle" :disabled="disabled">
						<image :src="goodsTypeImg[item1.Id]" mode="widthFix" class="goodsTypeImg"></image>
					</u-radio>
				</u-radio-group>
			</view>
		</view>
		<view class="bottom-border">
			<view class="label-text">店铺开口尺寸<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r " style="padding: 10px 0;height: 42px;display: flex;">
				 <radio-group @change="radioChange($event,'IsShopSize')" style="display: flex;">
					<label v-for="(item, index) in radiolist" :key="index" style="display: flex;margin-right: 10px;">
						<view style="transform:scale(0.7)">
							<radio :value="item.Id" :checked="item.Id == model.IsShopSize" color='#2979ff' :disabled="disabled"/>
						</view>
						<view>{{item.name}}</view>
					</label>
				</radio-group>
			</view>
			<input v-if='model.IsShopSize==1' type="text" v-model="model.ShopSize" :disabled="disabled" style="padding: 10px 0;" placeholder="店铺开口尺寸"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">燃气<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r " style="padding: 10px 0;height: 42px;display: flex;">
				 <radio-group @change="radioChange($event,'RanQi')" style="display: flex;">
					<label v-for="(item, index) in radiolist" :key="index" style="display: flex;margin-right: 10px;">
						<view style="transform:scale(0.7)">
							<radio :value="item.Id" :checked="item.Id == model.RanQi" color='#2979ff' :disabled="disabled"/>
						</view>
						<view>{{item.name}}</view>
					</label>
				</radio-group>
			</view>
			<input v-if='model.RanQi==1' type="text" v-model="model.RanQiBZ" :disabled="disabled" style="padding: 10px 0;" placeholder="燃气备注"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">排烟量<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r " style="padding: 10px 0;height: 42px;display: flex;">
				 <radio-group @change="radioChange($event,'PaiYan')" style="display: flex;">
					<label v-for="(item, index) in radiolist" :key="index" style="display: flex;margin-right: 10px;">
						<view style="transform:scale(0.7)">
							<radio :value="item.Id" :checked="item.Id == model.PaiYan" :disabled="disabled" color='#2979ff'/>
						</view>
						<view>{{item.name}}</view>
					</label>
				</radio-group>
			</view>
			<input v-if='model.PaiYan==1' type="text" v-model="model.PaiYanBZ" :disabled="disabled" style="padding: 10px 0;" placeholder="排烟量"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border">
			<view class="label-text">电量<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r " style="padding: 10px 0;height: 42px;display: flex;">
				 <radio-group @change="radioChange($event,'IsDianLiang')" style="display: flex;">
					<label v-for="(item, index) in radiolist" :key="index" style="display: flex;margin-right: 10px;">
						<view style="transform:scale(0.7)">
							<radio :value="item.Id" :checked="item.Id == model.IsDianLiang" :disabled="disabled" color='#2979ff'/>
						</view>
						<view>{{item.name}}</view>
					</label>
				</radio-group>
			</view>
			<input v-if='model.IsDianLiang==1' type="text" v-model="model.DianLiang" :disabled="disabled" style="padding: 10px 0;" placeholder="电量"  placeholder-style="color:#CECECE;">
		</view>
		<view class="bottom-border" v-for="(x,y) in brandList" :key='y'>
			<view class="label-text">{{x.name}}<span style='color: #E54D42;' >*</span></view>
			<view class="bottom-border_r " style="padding: 10px 0;height: 42px;display: flex;">
				 <radio-group @change="radioChange($event,x.field)" style="display: flex;">
					<label v-for="(item, index) in radiolist" :key="index" style="display: flex;margin-right: 10px;">
						<view style="transform:scale(0.7)">
							<radio :value="item.Id" :checked="item.Id == model[x.field]" :disabled="disabled" color='#2979ff'/>
						</view>
						<view>{{item.name}}</view>
					</label>
				</radio-group>
			</view>
		</view>
		
		<view style="margin-top: 30px;">
			<view class="butBox2" @click="brandSubmit" v-if='!disabled'>
				<text v-if='datas.CompanyStatus && datas.CompanyStatus==1'>确定修改</text>
				<text v-else>完成</text>
			</view>
			<view class="butBox2" @click="goback" v-else>
				<text >返回</text>
			</view>
		</view>
	</view>
</template>

<script>
	
	export default{
		props: {
		    datas: {
		    	type: Object,
		    },
		},
		data(){
			return{
				mainColor:'',
				action: this.host2 + "/api/File/UploadTencent",
				fileList:[],
				controls:true,
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				model:{
					ID: 0,
					CompanyId:0,//认证Id
					ExistBrandId:0,//绑定已有的品牌Id
					Logo: "", //Logo
					BannerList: [], //品牌介绍图
					VideoUrl: "", //品牌视频
					FullBrandName: "", //品牌全名
					BrandName: "", //品牌名
					ShopNum: "", //店铺数量
					BuiltUpArea: 0, //建筑面积小
					EndBuiltUpArea: 0, //建筑面积大
					CustomerType: "", //客群定位
					BrandType: "", //品牌定位
					StoreExpansion: "", //扩店区域
					ProjectType: 0, //商铺性质
					AreaRequirement: 0, //
					EndAreaRequirement: 0, //
					Advertising: "", //广告
					Other: "", //其他
					ShopSize: 1, //店铺开口尺寸
					Plumbing: 1, //上下水
					Caliber: 1, //管径
					Sewage: 1, //排污
					RanQi: 1, //燃气
					DianLiang: "", //电量
					PaiYan: 1, //排烟量
					KongTiao: 1, //空调
					XinFeng: 1, //新风
					BrandClassId: '', //品牌分类Id
					RanQiBZ: "", //燃气备注
					IsDianLiang: 1, //电量（0-否1-有）
					PaiYanBZ: "", //排烟量备注
					ShopSize: "", //店铺开口尺寸
					IsShopSize: 1, //店铺开口尺寸（0-否1-有）
					OpenShopWish:5,//开店意愿
				},
				ShopWish:1,//开店意愿
				BrandClassName:'',
				showOpenTime:false,
				goodsType:[],//载体类型
				goodsTypeImg: {
					1: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/goodstype-baihuo.png",
					2: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/goodstype-shappingmall.png",
					3: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/goodstype-center.png",
					4: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/goodstype-other.png"
				},
				radiolist:[{Id:1,name:'是'},{Id:0,name:'否'},],
				brandList:[
					{name: "上下水",field: "Plumbing",},
					{name: "管径",field: "Caliber",},
					{name: "排污",field: "Sewage",},
					{name: "空调",field: "KongTiao",},
					{name: "新风",field: "XinFeng",},
				],
				BrandClassList:[],
				showTypeStatus:false,
				disabled:false,
				disabled2:false,
				disabled3:false,//控制分类不能修改
				glBrandName:'',
				
			}
		},
		onLoad(options){
			let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId : 1;
			this.action = this.host2 + '/api/File/UploadTencent?MallBaseId=' + MallBaseId
			this.mainColor = this.$uiConfig.mainColor;
			
		},
		created() {
			this.GetProjectTypeEnumList()//载体性质
			this.getbrandList()
			this.model.CompanyId = this.datas.CompanyId
			
			if(this.datas.CompanyStatus!=undefined && this.datas.IsComplete != undefined){//判断是否填写过了
				// this.model = this.datas.BrandModel
				this.model.CompanyId = this.datas.CompanyId
				let data = this.datas.BrandModel
				this.model.ID = data.ID?data.ID:0;
				this.model.ExistBrandId = data.ExistBrandId?data.ExistBrandId:0;
				this.model.Logo = data.Logo?data.Logo:'';
				this.model.BannerList = data.BannerList?data.BannerList:[];
				this.model.VideoUrl = data.VideoUrl?data.VideoUrl:'';
				this.model.FullBrandName = data.FullBrandName?data.FullBrandName:'';
				this.model.BrandName = data.BrandName?data.BrandName:'';
				this.model.ShopNum = data.ShopNum?data.ShopNum:'';
				this.model.BuiltUpArea = data.BuiltUpArea?data.BuiltUpArea:0;
				this.model.EndBuiltUpArea = data.EndBuiltUpArea?data.EndBuiltUpArea:0;
				this.model.CustomerType = data.CustomerType?data.CustomerType:'';
				this.model.BrandType = data.BrandType?data.BrandType:'';
				this.model.StoreExpansion = data.StoreExpansion?data.StoreExpansion:'';
				this.model.ProjectType = data.ProjectType?data.ProjectType:0;
				this.model.AreaRequirement = data.AreaRequirement?data.AreaRequirement:0;
				this.model.EndAreaRequirement = data.EndAreaRequirement?data.EndAreaRequirement:0;
				this.model.Advertising = data.Advertising?data.Advertising:'';
				this.model.Other = data.Other? data.Other:'';
				this.model.ShopSize = data.ShopSize?data.ShopSize:1;
				this.model.Plumbing = data.Plumbing?data.Plumbing:1;
				this.model.Caliber = data.Caliber?data.Caliber:1;
				this.model.Sewage = data.Sewage?data.Sewage:1;
				this.model.RanQi = data.RanQi?data.RanQi:1;
				this.model.DianLiang = data.DianLiang?data.DianLiang:'';
				this.model.PaiYan = data.PaiYan? data.PaiYan:1;
				this.model.KongTiao = data.KongTiao?data.KongTiao:1;
				this.model.XinFeng = data.XinFeng?data.XinFeng:1;
				this.model.BrandClassId = data.BrandClassId?data.BrandClassId:'';
				this.model.RanQiBZ = data.RanQiBZ?data.RanQiBZ:'';
				this.model.IsDianLiang = data.IsDianLiang? data.IsDianLiang:1;
				this.model.PaiYanBZ = data.PaiYanBZ?data.PaiYanBZ:'';
				this.model.ShopSize = data.ShopSize?data.ShopSize:'';
				this.model.IsShopSize = data.IsShopSize?data.IsShopSize:1;
				this.model.OpenShopWish = data.OpenShopWish?data.OpenShopWish:5;
				
				this.glBrandName = data.BrandName
				if(this.model.BannerList && this.model.BannerList.length>0){
					this.model.BannerList.forEach(x=>{
						let obj ={
							url:x
						}
						this.fileList.push(obj)
					})
				}else{
					this.model.BannerList = [];
					this.fileList= []
				}
				if(!this.model.Logo){
					this.model.Logo = ''
				}
				
				
				if(this.datas.CompanyStatus==0 &&  this.datas.IsComplete==1){//审核中
					this.disabled = true
					
				}
				if(this.datas.CompanyStatus==1){
					this.disabled2 = true
				}
				if(this.model.ExistBrandId>0){
					
					this.disabled2 = true
					this.disabled3 = true
				}
				this.BrandClassName = data.ClassName;
			}
			
			
			
		},
		methods:{
			GetProjectTypeEnumList(){
				let parms = {
					url: "/api/AppletTrade/GetProjectTypeEnumList",
				}
				this.request2(parms, (res) => {
					if (res.resultCode == 1) {
						this.goodsType = res.data
					}
				})
			},
			getbrandList(){
				this.request2({
						url: "/api/AppletTrade/GetBrandClassList",
						data: {},
					},
					(res) => {
						if (res.resultCode == 1) {
							this.BrandClassList =  res.data
							
						}
					}
				);
			},
			onRemove1(index) {
				this.model.BannerList.splice(index, 1);
			},
			uploadSuccessHandler(data, index, lists) {
				let r = JSON.parse(data);
				this.model.BannerList.push(r.data);
			},
			uploadcard(){
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], //从相册选择
					success: async(res) => {
						var tempFilePaths = res.tempFilePaths;
						uni.showLoading({
							title: '正在上传中...'
						})
						for (let temp of tempFilePaths) {
							// 图片上传服务器
							await uni.uploadFile({
								url: this.action,
								filePath: temp,
								name: 'file',
								formData: {
									user: 'test'
								},
								
								success: res => {
									let data = JSON.parse(res.data)
									// 上传完成后处理
									this.model.Logo = data.data
									uni.hideLoading()
								},
								
							});
						}
					}
				});
			},
			enlarge(file) {
				
				// 全屏
				this.videoContext = uni.createVideoContext('myVideo2');
				this.videoContext.requestFullScreen({
					direction:0
				})
				
				
			},
			videoControl(e){
				console.log(e)
				if(e.detail.fullScreen==false){
					this.videoContext.stop()
					// this.controls=false
				}else{
					this.videoContext.play()
					// this.controls=true
				}
			},
			upvideo() {
				let that = this
				uni.chooseVideo({
					count: 1,
					sourceType: ['camera', 'album'],
					success: function(res) {
						console.log(res)
						that.upFile(res.tempFilePath, 1)
						uni.showLoading({
							title: '上传中...'
						})
			
					},
					fail(err) {
						console.log(err, )
					}
				});
			},
			upFile(filePath, type) {
				
				
				let that = this
				uni.uploadFile({
					url: that.action,
					filePath: filePath,
					name: 'file',
					formData: {
						user: 'tesdt'
					},
					success: (uploadFileRes) => {
						uni.hideLoading()
						if (uploadFileRes.statusCode == 200) {
							let data = JSON.parse(uploadFileRes.data)
							that.model.VideoUrl=data.data
							
						}
			
					},
					fail: function(res) {
						console.log(res)
						wx.showToast({
							title: '上传失败!',
							icon: 'none',
							duration: 1000
						})
					}
				});
			},
			previewImage(imgs,i) {
				uni.previewImage({
					urls: imgs,
					current: i,
					longPressActions: {
						itemList: ["发送给朋友", "保存图片", "收藏"],
						success: function(data) {},
						fail: function(err) {
							console.log(err.errMsg);
						},
					},
				});
			},
			radioChange(e,name){
				this.model[name] = e.detail.value
			},
			radioChange2(e){
				this.ShopWish = e.detail.value
				if(this.ShopWish == 0){
					this.model.OpenShopWish = -1
				}else{
					this.model.OpenShopWish = 5
				}
			},
			clickItem(x) {//类型选择
				this.BrandClassName = x.ClassName;
				this.model.BrandClassId = x.ID;
				this.showTypeStatus=false
			},
			gobrandsearch(){//跳转到品牌搜索页面
				uni.navigateTo({
					url: '/pages/kotra/brandSearch?type=1' 
				})
			},
			brandchildren(Id){//主页面调取方法
				
				this.request2({
						url: "/api/AppletTrade/GetBrandDetailsForCompany",
						data: {ID:Id},
					},
					(res) => {
						if (res.resultCode == 1) {
							let data = res.data
							this.model.ExistBrandId = data.ID;
							this.model.Logo = data.Logo;
							this.model.BannerList = data.BannerList;
							this.model.VideoUrl = data.VideoUrl;
							this.model.FullBrandName = data.FullBrandName;
							this.model.BrandName = data.BrandName;
							this.model.ShopNum = data.ShopNum;
							this.model.BuiltUpArea = data.BuiltUpArea;
							this.model.EndBuiltUpArea = data.EndBuiltUpArea;
							this.model.CustomerType = data.CustomerType;
							this.model.BrandType = data.BrandType;
							this.model.StoreExpansion = data.StoreExpansion;
							this.model.ProjectType = data.ProjectType;
							this.model.AreaRequirement = data.AreaRequirement;
							this.model.EndAreaRequirement = data.EndAreaRequirement;
							this.model.Advertising = data.Advertising;
							this.model.Other = data.Other;
							this.model.ShopSize = data.ShopSize;
							this.model.Plumbing = data.Plumbing;
							this.model.Caliber = data.Caliber;
							this.model.Sewage = data.Sewage;
							this.model.RanQi = data.RanQi;
							this.model.DianLiang = data.DianLiang;
							this.model.PaiYan = data.PaiYan;
							this.model.KongTiao = data.KongTiao;
							this.model.XinFeng = data.XinFeng;
							this.model.BrandClassId = data.BrandClassId;
							this.model.RanQiBZ = data.RanQiBZ;
							this.model.IsDianLiang = data.IsDianLiang;
							this.model.PaiYanBZ = data.PaiYanBZ;
							this.model.ShopSize = data.ShopSize;
							this.model.IsShopSize = data.IsShopSize;
							this.model.OpenShopWish = data.OpenShopWish?data.OpenShopWish:5;
							
							this.glBrandName = data.BrandName
							this.disabled2 = true
							this.disabled3 = true
							if(this.model.BannerList.length>0){
								this.model.BannerList.forEach(x=>{
									let obj ={
										url:x
									}
									this.fileList.push(obj)
								})
							}
							this.BrandClassList.forEach(x=>{
								if(this.model.BrandClassId == x.ID){
									this.BrandClassName = x.ClassName;
								}
							})
						}
					}
				);
			},
			brandSubmit(){
				
				if(this.model.BrandClassId == ''){
					uni.showToast({title: '请选择品牌分类',icon: 'none',})
					return
				}
				if(this.model.FullBrandName == ''){
					uni.showToast({title: '请输入品牌全名',icon: 'none',})
					return
				}
				if(this.model.BrandName == ''){
					uni.showToast({title: '请输入品牌名',icon: 'none',})
					return
				}
				if(this.model.Logo == ''){
					uni.showToast({title: '请上传Logo',icon: 'none',})
					return
				}
				if(this.model.BannerList.length == 0){
					uni.showToast({title: '请上传品牌介绍图',icon: 'none',})
					return
				}
				if( this.model.ShopNum==''){
					this.model.ShopNum = 0
				
				}
				if(this.model.BuiltUpArea=='' ){//设为默认值
					this.model.BuiltUpArea = 0
				}
				if( this.model.EndBuiltUpArea==''){
					this.model.EndBuiltUpArea = 0
				}
				if(this.model.AreaRequirement=='' ){
					this.model.AreaRequirement = 0
				}
				if( this.model.EndAreaRequirement==''){
					this.model.EndAreaRequirement = 0
				}
				if(this.model.CustomerType=='' ){
					uni.showToast({title: '客群定位不能为空',icon: 'none',})
					return
				}
				if(this.model.BrandType=='' ){
					uni.showToast({title: '品牌定位不能为空',icon: 'none',})
					return
				}
				if(this.model.StoreExpansion=='' ){
					uni.showToast({title: '扩店区域不能为空',icon: 'none',})
					return
				}
				
				
				
				if(this.model.ProjectType == 0){
					uni.showToast({title: '请选择商铺性质',icon: 'none',})
					return
				}
				console.log(this.model,'保存')
				uni.showLoading({
					title:'提交中...'
				})
				
				let parms = {
					url: "/api/AppletTrade/SetBrandApplyFor",
					data: this.model
				}
				if(this.datas.CompanyStatus && this.datas.CompanyStatus==1){
					parms = {
						url: "/api/AppletTrade/SetBrandUpdate",
						data: this.model
					}
				}
				this.request2(parms, (res) => {//认证 - 保存品牌信息
					if (res.resultCode == 1) {
						uni.hideLoading()
						uni.showToast({title: res.message,icon: 'none',})
						setTimeout(()=>{
							uni.navigateBack()
						},1500)
					}
				})
			},
			goback(){
				uni.navigateBack()
			},
			score(e){
				this.model.OpenShopWish = e
			}
			
		}
	}
</script>
