<template>
	<view class="head">
		<u-navbar title="新增客户" :autoBack="true" leftIconSize="0" placeholder>
			<u-icon name="arrow-left" slot="left" color="#333333" size="24"></u-icon>
		</u-navbar>
		<view class="information">
			客户信息
		</view>

		<view class="Customer-information">
			<div class="df aic jcsb">
				<div class="name df aic">头像</div>
				<div class="df aic">
					<view class="" v-if="pic_path.length>0">
						<image class="ustomeimg" :src="$util.img(pic_path)" mode=""></image>
					</view>
					<view class="" v-else>
						去上传
					</view>
					<u-icon name="arrow-right" @click="pictureupload()"></u-icon>
				</div>
			</div>



			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">客户标签</div>
				<div class="Default-type df aic" @click="show1=true">
					<view class="" v-if="label_name.length>0">
						{{label_name}}
					</view>
					<view class="" v-else>
						请选择
					</view>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>


			<!-- <div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">备注</div>
				<div class="name-input"><input type="text" placeholder="请输入"></div>
			</div> -->
		</view>
		<view class="information mt">
			店铺信息
		</view>
		<view class="Customer-information">
			<div class="df aic jcsb">
				<div class="name df aic">店铺名称<span>*</span></div>
				<div class="name-input"><input style="text-align: right;" v-model="shop" type="text"
						placeholder="请输入店铺名称"></div>
			</div>
			<div class="xlsad"></div>

			<div class="df aic jcsb">
				<div class="name df aic">归属地区<span>*</span></div>
				<!-- Select -->
				<div class="Default-type df aic" @click="show4=true">
					<view class="" v-if="address.length>0">
						{{address}}
					</view>
					<view class="" v-else>
						未归属
					</view>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">店铺类型</div>
				<div class="Default-type df aic" @click="show=true">
					<view class="" v-if="StoreSel.length>0">
						{{StoreSel}}
					</view>
					<view class="" v-else>
						请选择
					</view>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">联系人<span>*</span></div>
				<div class="name-input"><input v-model="contactsadc" type="text" placeholder="请输入联系人"></div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">电话号码<span>*</span></div>
				<div class="name-input"><input v-model="StorePhone" type="text" placeholder="请输入电话号码"></div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">店铺地址<span>*</span></div>
				<div class="name-inputacund df aic" @click="Filladdress">
					<div>
						{{AddressDetails.address}}
					</div>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">电子邮箱</div>
				<div class="name-input"><input v-model="postbox" type="text" placeholder="请输入电子邮箱"></div>
			</div>
			<div class="xlsad"></div>



			<div class="df aic jcsb">
				<div class="name df aic">资料附件<span>*</span></div>
				<div class="Default-type df aic" @click="show7=true">
					<view class="" v-if="drugs_license.length>0">
						已上传
					</view>
					<view class="" v-else>
						去上传
					</view>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
		</view>
		<view class="information mt">
			账号信息
		</view>
		<view class="Customer-information">
			<div class="df aic jcsb">
				<div class="name df aic">账号登录<span>*</span></div>
				<div class="name-input"><input v-model="number" type="text" placeholder="请输入账号"></div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">登录密码<span>*</span></div>
				<div class="name-input"><input v-model="cipher" type="text" placeholder="请输入登录密码"></div>
			</div>
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">业务员<span>*</span></div>
				<div class="Default-type df aic" @click="show2=true">

					<view class="" v-if="group_name.length>0">
						{{group_name}}
					</view>
					<view class="" v-else>
						请选择
					</view>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<!-- <div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">客服<span>*</span></div>
				<div class="Default-type df aic">
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div> -->
			<div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">结算方式<span>*</span></div>
				<div class="Default-type df aic" @click="show3=true">
					<view class="" v-if="paymenname.length>0">
						{{paymenname}}
					</view>
					<view class="" v-else>
						现付
					</view>
					<u-icon name="arrow-right"></u-icon>
				</div>
			</div>
			<!-- <div class="xlsad"></div>
			<div class="df aic jcsb">
				<div class="name df aic">发送激活短信</div>
				<div class="">
					<u-switch activeColor="#21BBF3" v-model="value" @change="change"></u-switch>
				</div>
			</div> -->



		</view>
		<view class="information mt">
			用户验证码
		</view>

		<view class="Customer-information">
			<u--form labelPosition="left" :model="fromData" ref="fromData">

				<u-form-item label="手机号" prop="code" labelWidth="120rpx" borderBottom required>
					<u--input v-model="fromData.username" type="number" border="none" placeholder="请输入用户手机号"></u--input>
				</u-form-item>


				<u-form-item label="验证码" prop="code" labelWidth="120rpx" required>
					<u-input placeholder="请输入短信验证码" border="none" type="number" placeholderStyle="color:#BFBFBF"
						v-model="fromData.code">
						<div slot="suffix" :class="codeTime>=60?'input_right_btn_active':'input_right_btn'"
							@click="getCode">
							<div v-if="codeTime>=60">获取验证码</div>
							<div v-else class="codeTime">{{codeTime}}s</div>
						</div>
					</u-input>
				</u-form-item>

			</u--form>

		</view>



		<view class="btn df aic jcsa" @click="preserve">
			保存
		</view>

		<u-overlay :show="show" @click="show = false">
			<view class="connection-type" @tap.stop>

				<div v-for="(item,index) in radiolist1" :key="index">
					<div class="arr df aic jcsb" @click="time(index,item)">
						<div class="df aic">
							<text>{{item}}</text>
						</div>
						<image v-if="index==indexa" :src="$util.img(`/upload/weapp/user/gou.png`)" mode=""></image>
						<image v-else :src="$util.img(`/upload/weapp/user/un_gou.png`)" mode=""></image>
					</div>

				</div>

				<view class="df Type-confirmation">
					<div class="df aic jcsa btn1" @click="show = false">返回</div>
					<div class="df aic jcsa btn2" @click="StoreSelection">确定</div>
				</view>
			</view>

		</u-overlay>
		<u-overlay :show="show1" @click="show1 = false">
			<view class="connection-type" @tap.stop>
				<view class="connection-xia">
					<div class="Add-label">请选择需要添加的标签</div>
					<div class="add-name df fw">
						<div class="Add-for df aic jcsa" v-for="(item,index) in listpos" :key="index"
							@click="btn(index,item)">
							<div class=" df aic jcsa"
								:style="indexb==index?{color:'#21BBF3',background:'rgba(33,187,243,0.08)'}:''">
								{{item.label_name}}
							</div>
						</div>
					</div>
				</view>
				<view class="df Type-confirmation">
					<div class="df aic jcsa btn1" @click="show1=false">返回</div>
					<div class="df aic jcsa btn2" @click="label">确定</div>
				</view>
			</view>
		</u-overlay>
		<u-overlay :show="show2" @click="show2 = false">
			<view class="connection-type" @tap.stop>

				<div v-for="(item,index) in FileList" :key="index">
					<div class="arr df aic jcsb" @click="stryy(index)">
						<div class="df aic">
							<text>{{item.realname}}</text>
						</div>
						<image v-if="index==indexc" :src="$util.img(`/upload/weapp/user/gou.png`)" mode=""></image>
						<image v-else :src="$util.img(`/upload/weapp/user/un_gou.png`)" mode=""></image>
					</div>

				</div>

				<view class="df Type-confirmation">
					<div class="df aic jcsa btn1" @click="show2 = false">返回</div>
					<div class="df aic jcsa btn2" @click="salesperson">确定</div>
				</view>
			</view>

		</u-overlay>
		<u-overlay :show="show3" @click="show3 = false">
			<view class="connection-type" @tap.stop>
				<div v-for="(item,index) in way" :key="index">
					<div class="arr df aic jcsb" @click="four(index)">
						<div class="df aic">
							<text>{{item.name}}</text>
						</div>
						<image v-if="index==indexd" :src="$util.img(`/upload/weapp/user/gou.png`)" mode=""></image>
						<image v-else :src="$util.img(`/upload/weapp/user/un_gou.png`)" mode=""></image>
					</div>

				</div>

				<view class="df Type-confirmation">
					<div class="df aic jcsa btn1" @click="show3= false">返回</div>
					<div class="df aic jcsa btn2" @click="paymentmethod">确定</div>
				</view>
			</view>

		</u-overlay>
		<u-overlay :show="show7" @click="show7 = false">
			<view class="fujianshangchuan" @tap.stop>
				<u-navbar title="附件上传" leftIconSize="0" placeholder>
					<u-icon name="arrow-left" slot="left" color="#333333" size="24" @click="show7=false"></u-icon>
				</u-navbar>
				<view class="head">
					<!-- 资料附件 -->
					<view class="business">
						营业资质或医疗机构许可证<span style="color: red;">*</span>
					</view>
					<view class="upload">
						请上传营业执照
					</view>
					<view class="Business df fdc aic" @click="licensea">
						<view class="" v-if="licen.length>0">
							<image style="width: 718rpx;height: 332rpx;margin-top: 0;" :src="$util.img(licen)" mode="">
							</image>
						</view>
						<view class="df fdc aic" v-else>
							<image :src="$util.img(`/upload/weapp/pageSalesman/search.png`)" mode=""></image>
							<div class="Upload-pictures">上传图片</div>
							<div class="ask">文件大小不超过10M，支持JPG\PNG\JPEG格式</div>
						</view>
					</view>
					<view class="business-two">
						药品经营许可证<span style="color: red;">*</span>
					</view>
					<view class="upload">
						请上传药品经营许可证
					</view>
					<view class="Business df fdc aic" @click="drug">
						<view class="" v-if="dru.length>0">
							<image style="width: 718rpx;height: 332rpx;margin-top: 0;" :src="$util.img(dru)" mode="">
							</image>
						</view>
						<view class="df fdc aic" v-else>
							<image :src="$util.img(`/upload/weapp/pageSalesman/search.png`)" mode=""></image>
							<div class="Upload-pictures">上传图片</div>
							<div class="ask">文件大小不超过10M，支持JPG\PNG\JPEG格式</div>
						</view>
					</view>
					<view class="business-two">
						法人身份证<span style="color: red;">*</span>
					</view>
					<view class="upload">
						请上传法人身份证
						<span style="color: red;">*</span>
					</view>
					<view class="Business df fdc aic" @click="status">
						<!-- <view class="df aic" v-if="stat.length>=2">
							<image style="width: 359rpx;height: 332rpx;margin-top: 0;" :src="$util.img(stat[0])"
								mode=""></image>
							<image style="width: 359rpx;height: 332rpx;margin-top: 0;" :src="$util.img(stat[1])"
								mode=""></image>
						</view> -->
						<view class="df aic" v-if="stat.length>0">
							<image style="width: 718rpx;height: 332rpx;margin-top: 0;" :src="$util.img(stat)" mode="">
							</image>
						</view>
						<view class="df fdc aic" v-if="stat.length==0">
							<image :src="$util.img(`/upload/weapp/pageSalesman/search.png`)" mode=""></image>
							<div class="Upload-pictures">上传图片</div>
							<div class="ask">文件大小不超过10M，支持JPG\PNG\JPEG格式</div>
						</view>
					</view>
					<view class="business-two">
						法人委托书
					</view>
					<view class="upload">
						请上传法人委托书
					</view>
					<view class="Business df fdc aic" @click="attorney">
						<view class="df aic" v-if="attorn.length>=2">
							<image style="width: 359rpx;height: 332rpx;margin-top: 0;" :src="$util.img(attorn[0])"
								mode=""></image>
							<image style="width: 359rpx;height: 332rpx;margin-top: 0;" :src="$util.img(attorn[1])"
								mode=""></image>
						</view>
						<view class="df aic" v-if="attorn.length==1">
							<image style="width: 718rpx;height: 332rpx;margin-top: 0;" :src="$util.img(attorn[0])"
								mode=""></image>
						</view>
						<view class="df fdc aic" v-if="attorn.length==0">
							<image :src="$util.img(`/upload/weapp/pageSalesman/search.png`)" mode=""></image>
							<div class="Upload-pictures">上传图片</div>
							<div class="ask">文件大小不超过10M，支持JPG\PNG\JPEG格式</div>
						</view>
					</view>
					<view class="business-two">
						发票信息
					</view>
					<view class="upload">
						请上传发票信息
					</view>
					<view class="Business df fdc aic" @click="bill">
						<view class="" v-if="bil.length>0">
							<image style="width: 718rpx;height: 332rpx;margin-top: 0;" :src="$util.img(bil)" mode="">
							</image>
						</view>
						<view class="df fdc aic" v-else>
							<image :src="$util.img(`/upload/weapp/pageSalesman/search.png`)" mode=""></image>
							<div class="Upload-pictures">上传图片</div>
							<div class="ask">文件大小不超过10M，支持JPG\PNG\JPEG格式</div>
						</view>
					</view>
					<view class="business-two">
						店铺logo
					</view>
					<view class="upload">
						请上传店铺logo
					</view>
					<view class="Business df fdc aic" @click="logoBtn">
						<view class="" v-if="logo.length>0">
							<image style="width: 718rpx;height: 332rpx;margin-top: 0;" :src="$util.img(logo)" mode="">
							</image>
						</view>
						<view class="df fdc aic" v-else>
							<image :src="$util.img(`/upload/weapp/pageSalesman/search.png`)" mode=""></image>
							<div class="Upload-pictures">上传图片</div>
							<div class="ask">文件大小不超过10M，支持JPG\PNG\JPEG格式</div>
						</view>
					</view>
					<view class="df aic jcsa accomplish" @click="btnbiii">
						完成
					</view>
				</view>
			</view>
		</u-overlay>

		<u-picker @cancel="show4=false" closeOnClickOverlay @confirm="confirm" :show="show4"
			:columns="columns"></u-picker>
		<u-picker @cancel="show5=false" closeOnClickOverlay @confirm="confirmone" :show="show5"
			:columns="columnslist"></u-picker>

		<u-picker @cancel="show6=false" closeOnClickOverlay @confirm="confirmtwo" :show="show6"
			:columns="columnqu"></u-picker>




	</view>
</template>

<script>
	import eventBus from '@/common/js/bus.js'
	export default {
		data() {
			return {
				// 保存弹框

				codeTime: 60,
				tips: '',
				count_code: false,
				fromData: {
					username: '',
					key: '',
					code: ''
				},
				disabled1: false,

				licen: [],
				dru: [],
				stat: [],
				attorn: [],
				bil: [],
				logo: [],
				indexa: 0,
				indexb: 0,
				indexc: 0,
				indexd: 0,
				pic_path: '',
				value: false,
				show: false,
				show1: false,
				show2: false,
				show3: false,
				show4: false,
				show5: false,
				show6: false,
				show7: false,
				number: '',
				cipher: '',

				shop: '',
				contactsadc: '',
				columns: [],
				columnslist: [],
				columnqu: [],
				label_id: '',
				label_name: '',
				StorePhone: '',
				AddressDetails: {},
				postbox: '',
				license: "", //营业执照
				drugs_license: "", //药品经营许可证
				card_images: "", //法人身份证
				trust_book_images: "", //法人委托书
				invoice_images: "", //发票
				economize: '', //省id
				distinguish: '', //市的id
				jioauk: '', //区的id
				economizename: '', //省name
				distinguishme: '', //区name
				marketname: '', //市name
				address: '',
				StoreSel: '',
				paymenname: '',
				uid: '',
				group_name: '',
				paymensex: 1,
				way: [
					{ name: '现付', sex: 1 },
					{ name: '后付', sex: 2 }
				],
				listpos: [],
				FileList: [],
				radiolist1: [],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				radiovalue1: '默认类型',
				userInfo: uni.getStorageSync('userInfo'),
			};

		},
		onLoad() {
			// eventBus.$on('picture',(data)=>{
			// 	console.log(data,'传');
			// 	this.license=data.licen
			// 	this.drugs_license=data.dru
			// 	this.card_images=data.stat
			// 	this.trust_book_images=data.attorn
			// 	this.invoice_images=data.bil
			// })
			uni.$on('address', (data) => {
				console.log(data, 'data');
				this.AddressDetails = data
			})
		},
		onUnload() {
			// uni.$off('picture')
			uni.$off('address')
		},
		onShow() {

			this.$api.sendRequest({
				url: `/api/member/getStoreTypeList`,
				data: {},
				success: res => {
					console.log(res.data, '店铺类型');
					this.radiolist1 = res.data
				}
			})
			this.$api.sendRequest({
				url: `/api/salasman/labelList`,
				data: {},
				success: res => {
					console.log(res.data, 'resdata');
					this.listpos = res.data
				}
			})
			this.$api.sendRequest({
				url: `/api/salasman/getUserLists`,
				data: {},
				success: res => {
					this.FileList = res.data
					if (!this.FileList.length) {
						this.FileList.push(this.userInfo)
					}
					console.log(res.data, '业务员选项');
				}
			})
			this.$api.sendRequest({
				url: '/api/address/lists',
				data: {
					pid: 0
				},
				success: res => {
					this.list = res.data
					let a = []
					for (let i = 0; i < res.data.length; i++) {
						a.push(res.data[i].name)
					}
					this.columns = [a]

				}
			})
		},
		methods: {
			getCode() {
				if (this.count_code) return

				if (!this.fromData.username) {
					this.$util.showToast({
						title: '请输入用户手机号'
					});
					return
				}
				this.$api.sendRequest({
					url: '/api/register/mobileCode',
					data: {
						mobile: this.fromData.username
					},
					success: res => {
						this.fromData.key = res.data.key
						this.$util.showToast({
							title: '发送成功'
						});
						this.countDown();
						this.count_code = true;
					},
					fail: res => {

					}
				})
			},
			// 倒计时
			countDown() {
				let that = this
				this.interval = setInterval(() => {
					that.codeTime = that.codeTime - 1
					if (that.codeTime < 10) that.codeTime = '0' + that.codeTime
					if (that.codeTime <= 0) {
						clearInterval(that.interval)
						that.count_code = false;
						that.codeTime = 60;
					}
				}, 1000)
			},
			licensea(type, size = 1) {
				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {
					console.log(res);
					this.licen = res[0]
					// this.license=res[0]
				})
			},
			//药品许可证
			drug(type, size = 1) {
				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {
					console.log(res);
					this.dru = res[0]
					// this.drugs_license=res[0]
				})
			},
			//法人身份证
			status(type, size = 1) {
				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {

					this.stat = res[0];
					console.log(this.stat);
					// this.card_images.push(res[0])
				})
			},
			//法人委托书
			attorney(type, size = 1) {
				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {
					console.log(res);
					this.attorn.push(res[0])
					// this.trust_book_images.push(res[0])
				})
			},
			//发票信息
			bill(type, size = 1) {
				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {
					console.log(res);
					this.bil = res[0]
					// this.invoice_images=res[0]
				})
			},
			//店铺logo
			logoBtn(type, size = 1) {
				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {
					console.log(res);
					this.logo = res[0]
					// this.invoice_images=res[0]
				})
			},
			btnbiii() {
				if (this.licen.length == 0) {
					this.$util.showToast({
						title: '请上传营业执照'
					});
					return
				}
				if (this.dru.length == 0) {
					this.$util.showToast({
						title: '请上传药品经营许可证'
					});
					return
				}
				if (this.stat.length == 0) {
					this.$util.showToast({
						title: '请上传法人身份证'
					});
					return
				}
				if (this.stat.length == 0) {
					this.$util.showToast({
						title: '请上传法人身份证正反面'
					});
					return
				}
				this.$util.showToast({
					title: '附件上传成功'
				});
				this.license = this.licen
				this.drugs_license = this.dru
				this.card_images = this.stat
				this.trust_book_images = this.attorn
				this.invoice_images = this.bil

				this.show7 = false

			},

			salesperson() {
				// console.log(this.indexc);
				// console.log(this.FileList);
				this.group_name = this.FileList[this.indexc].realname
				// console.log(this.FileList[this.indexc].uid);
				this.uid = this.FileList[this.indexc].uid
				this.show2 = false
			},
			paymentmethod() {
				this.show3 = false
				this.paymenname = this.way[this.indexd].name
				this.paymensex = this.way[this.indexd].sex
			},
			label() {
				this.show1 = false
				this.label_id = this.listpos[this.indexb].label_id
				this.label_name = this.listpos[this.indexb].label_name
			},
			four(index) {
				this.indexd = index

			},
			stryy(index) {
				this.indexc = index
				console.log(11111111);
			},
			time(index) {
				this.indexa = index

			},
			StoreSelection() {

				this.StoreSel = this.radiolist1[this.indexa]
				this.show = false
			},
			change(e) {
				console.log('change', e);
			},
			groupChange(n) {
				console.log('groupChange', n);
			},
			radioChange(n) {
				console.log('radioChange', n);
			},
			btn(index, item) {
				console.log(item);
				this.indexb = index

			},
			means() {
				uni.navigateTo({
					url: '../means/means'
				})
			},
			Select() {
				this.show4 = true
				console.log(111);
				// uni.navigateTo({
				// 	url:'../Select-attribution/Select-attribution'
				// })
			},
			confirm(e) {
				this.economizename = e.value[0]

				let _this = this
				for (var i = 0; i < this.list.length; i++) {
					if (this.list[i].name == e.value[0]) {
						_this.economize = _this.list[i].id
					}
				}
				console.log(_this.economize);
				this.$api.sendRequest({
					url: '/api/address/lists',
					data: {
						pid: _this.economize
					},
					success: res => {
						console.log(res);
						let a = []
						this.columnslits = res.data
						// console.log(res.data,'daa');
						for (var i = 0; i < res.data.length; i++) {
							a.push(res.data[i].name)
						}
						_this.columnslist = [a]
						// console.log(_this.columnslist,'box');
						this.show5 = true
						this.show4 = false
					}
				})

			},
			confirmone(e) {
				this.marketname = e.value[0]
				let _this = this
				for (var i = 0; i < this.columnslits.length; i++) {

					if (_this.columnslits[i].name == e.value[0]) {
						_this.distinguish = _this.columnslits[i].id
					}

				}
				this.$api.sendRequest({
					url: '/api/address/lists',
					data: {
						pid: _this.distinguish
					},
					success: res => {
						let a = []
						this.distinguishname = res.data
						for (var i = 0; i < res.data.length; i++) {
							a.push(res.data[i].name)
						}
						this.columnqu = [a]
						this.show6 = true
						this.show5 = false
					}
				})
			},
			confirmtwo(e) {
				this.distinguishme = e.value[0]
				let _this = this
				for (var i = 0; i < this.distinguishname.length; i++) {
					if (_this.distinguishname[i].name == e.value[0]) {
						_this.jioauk = _this.distinguishname[i].id
					}
				}
				this.show6 = false
				this.address = this.economizename + '' + this.marketname + '' + this.distinguishme
				console.log(this.address);
			},
			pictureupload(type, size = 1) {

				this.$util.upload(size, {
					path: 'otherImage'
				}, res => {
					this.pic_path = res[0]
				})

			},
			Filladdress() {
				uni.navigateTo({
					url: '../Fill_address/Fill_address'
				})
			},
			preserve() {
				console.log({
					province_id: this.economize, //省id
					city_id: this.distinguish, //市的id
					district_id: this.jioauk, //区的id
					license: this.license,
					drugs_license: this.drugs_license,
					card_images: this.card_images,
					trust_book_images: this.trust_book_images,
					invoice_images: this.invoice_images,
					mobile: this.number,
					password: this.cipher,

					title: this.shop,
					label_id: this.label_id,
					label_name: this.label_name,
					pay_type: this.paymensex,
					uid: this.uid,

				});
				let shop = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
				let pos = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/
				// if(!this.label_name.length>0){
				// 	this.$util.showToast({
				// 		title: '请选择标签'
				// 	});
				// 	return
				// }
				console.log(this.pic_path);
				// if(!this.pic_path.length>0){
				// 	this.$util.showToast({
				// 		title: '请上传客户头像'
				// 	});
				// 	return

				// }
				// if(!this.label_name.length>0){
				// 	this.$util.showToast({
				// 		title: '请选择客户标签'
				// 	});
				// 	return
				// }


				if (!this.shop.length > 0) {
					this.$util.showToast({
						title: '请输入店铺名称'
					});
					return
				}
				if (!this.address.length > 0) {
					this.$util.showToast({
						title: '请选择归属地区'
					});
					return
				}

				// if(!this.StoreSel.length>0){
				// 	this.$util.showToast({
				// 		title: '请选择店铺类型'
				// 	});
				// 	return
				// }

				if (!this.contactsadc.length > 0) {
					this.$util.showToast({
						title: '请输入联系人'
					});
					return
				}
				if (!this.StorePhone.length > 0) {
					this.$util.showToast({
						title: '请填写手机号'
					});
					return
				}
				if (!shop.test(this.StorePhone)) {
					this.$util.showToast({
						title: '请填写正确的手机号码'
					});
					return
				}
				if (!this.AddressDetails.address) {
					this.$util.showToast({
						title: '请选择店铺地址'
					});
					return
				}
				// if(!this.postbox.length>0){
				// 		this.$util.showToast({
				// 			title: '请输入电子邮箱'
				// 		});
				// 		return
				// }
				// if(!pos.test(this.postbox)){
				// 	this.$util.showToast({
				// 		title: '请填写正确的电子邮箱'
				// 	});
				// 	return
				// }
				if (!this.drugs_license.length > 0) {
					this.$util.showToast({
						title: '请上传附件'
					});
					return
				}

				if (!this.number.length > 0) {
					this.$util.showToast({
						title: '请输入登录账号'
					});
					return
				}
				if (!this.cipher.length > 0) {
					this.$util.showToast({
						title: '请输入账号密码'
					});
					return
				}
				if (!this.group_name.length > 0) {
					this.$util.showToast({
						title: '请选择业务员'
					});
					return
				}
				if (!this.fromData.username.length > 0) {
					this.$util.showToast({
						title: '请输入用户手机号'
					});
					return
				}
				if (!this.fromData.code.length > 0) {
					this.$util.showToast({
						title: '请输入验证码'
					});
					return
				}
				this.$api.sendRequest({
					url: `/api/salasman/addMember`,
					header: {
						'Content-Type': 'application/json' //自定义请求头信息
					},
					data: {
						province_id: this.economize, //省id
						city_id: this.distinguish, //市的id
						district_id: this.jioauk, //区的id
						license: this.license,
						drugs_license: this.drugs_license,
						card_images: this.card_images,
						trust_book_images: this.trust_book_images,
						invoice_images: this.invoice_images,
						logo: this.logo,

						mobile: this.number,
						password: this.cipher,
						// invite_code:this.Invitation,
						title: this.shop,
						label_id: this.label_id,
						member_label_name: this.label_name,
						member_label: this.label_id,
						pay_type: this.paymensex,
						uid: this.uid,
						store_type: this.StoreSel, //店铺类型
						contacts: this.contactsadc,
						phone: this.StorePhone,
						email: this.postbox,
						address: this.AddressDetails.address,
						headimg: this.pic_path,
						//验证码
						key: this.fromData.key,
						code: this.fromData.code

					},
					success: res => {
						console.log(res, 'xinz');
						if (res.code == 0) {
							this.$util.showToast({
								title: '保存成功'
							});
						}
						setTimeout(() => {
							uni.navigateTo({
								url: `/page_salesman_customer/index/index`
							})
						}, 500)
					}
				})


			}
		}


	}
</script>

<style lang="scss">
	.fujianshangchuan {
		width: 100%;
		height: 100%;
		// margin-top: 180rpx;
		background-color: #fff;
		overflow-y: scroll;

		.head {
			padding: 20rpx 32rpx;

			.business {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				line-height: 40rpx;
			}

			.upload {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				line-height: 34rpx;
				margin-top: 8rpx;
			}

			.Business {
				width: 686rpx;
				height: 320rpx;
				background: #F6F6F6;
				border-radius: 16rpx;
				margin-top: 24rpx;

				image {
					width: 48rpx;
					height: 48rpx;
					margin-top: 88rpx;
				}

				.Upload-pictures {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #BFBFBF;
					line-height: 40rpx;
					margin-top: 16rpx;
				}

				.ask {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #BFBFBF;
					line-height: 34rpx;
					margin-top: 8rpx;
				}
			}

			.business-two {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				line-height: 40rpx;
				margin-top: 48rpx;
			}

			.accomplish {
				width: 690rpx;
				height: 80rpx;
				background: #21BBF3;
				border-radius: 40rpx;
				margin-top: 32rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 40rpx;
			}
		}

	}

	::v-deep {
		.u-radio {
			margin-bottom: 32rpx !important;
		}

		.u-radio__text {

			font-size: 28rpx !important;
			font-family: PingFangSC-Medium, PingFang SC !important;
			font-weight: 500 !important;
			color: #222222 !important;
			line-height: 40rpx !important;
		}
	}

	.ustomeimg {
		width: 50rpx;
		height: 50rpx;
		margin-right: 20rpx;
	}

	.head {
		padding: 24rpx;

		.information {
			font-size: 30rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #222222;
			line-height: 42rpx;
		}

		.mt {
			margin-top: 24rpx;
		}

		.btn {
			width: 690rpx;
			height: 80rpx;
			background: #21BBF3;
			border-radius: 40rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 40rpx;
			margin-top: 36rpx;
		}

		.Customer-information {
			width: 702rpx;

			background: #FFFFFF;
			border-radius: 24rpx;
			margin-top: 24rpx;
			padding: 32rpx;
			box-sizing: border-box;

			.name {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				line-height: 40rpx;

				span {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #F33B50;
					line-height: 40rpx;
				}
			}

			.name-input {
				width: 400rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				// color: #999999;
				line-height: 40rpx;
				text-align: right;
			}

			.name-inputacund {
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				// color: #999999;
				line-height: 40rpx;
				text-align: right;
			}

			.Default-type {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				line-height: 40rpx;
			}

			.xlsad {
				width: 641rpx;
				height: 1rpx;
				background: #E8E8E8;
				border-radius: 2rpx;
				margin: 30rpx 0;
			}

		}

		.connection-type {
			width: 596rpx;
			height: 88vh;
			background: #F8F6F6;
			border-radius: 2rpx;
			position: fixed;
			right: 0;
			bottom: 88rpx;

			.Add-label {
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #222222;
				line-height: 44rpx;
				margin: 32rpx 0 0 34rpx;
			}

			.add-name {
				padding: 0 32rpx;
				box-sizing: border-box;
				margin-top: 32rpx;

				div {
					width: 166rpx;
					height: 60rpx;
					background: #FFFFFF;
					border-radius: 12rpx;

					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #585858;
					line-height: 34rpx;

				}

				div:nth-child(2) {
					margin-left: 18rpx;
					margin-right: 18rpx;
				}

				div:nth-child(5) {
					margin: 0 18rpx;
				}

				div:nth-child(n+4) {
					margin-top: 40rpx;
				}
			}

			.arr {
				margin-right: 16rpx;
				margin-bottom: 32rpx;

				margin: 0 32rpx;
				margin-top: 32rpx;

				image {
					width: 40rpx;
					height: 40rpx;
				}

				text {
					font-size: 28rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #222222;
					line-height: 40rpx;
				}

			}

			.Type-confirmation {

				position: fixed;
				bottom: 0;

				.btn1 {
					width: 172rpx;
					height: 88rpx;
					background: #DDDDDD;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #585858;
					line-height: 40rpx;
				}

				.btn2 {
					width: 424rpx;
					height: 88rpx;
					background: #21BBF3;
					font-size: 28rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					line-height: 40rpx;
				}
			}
		}

		.input_right_btn {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: $base-color;
			width: 200rpx;
			height: 50rpx;
			line-height: 50rpx;
			text-align: center;
			border: 1rpx solid #999999;
			border-radius: 10rpx;

			.codeTime {
				color: #999999;
			}
		}

		.input_right_btn_active {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: $base-color;
			width: 200rpx;
			height: 50rpx;
			line-height: 50rpx;
			text-align: center;
			background: #19be6b;
			color: #fff;
			border-radius: 10rpx;

			.codeTime {
				color: #999999;
			}
		}
	}
</style>