<template>
	<view class="lists">
		<view class="status_bar" :style="navHeight"></view>
		<view class="header-bg">
			<image class="header-bg-img" src="@/static/image/nav_bg@3x.png" mode="scaleToFill"></image>
		</view>
		<view class="main">
			<view class="middle view">
				
				<view class="text-block">
					<text class="middle-date">匿名提报</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'SubmitMethod')"
									range-key='name' mode="selector" :value="condition.submitMethodName"
									:range="selectDataOptions.SubmitMethod">
									<text class="uni-input">{{condition.submitMethodName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">匿名口令</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.pwdInfo"
									placeholder="请输入匿名提报口令，后期查询使用" />
							</view>
						</view>
						<!-- <image class="icon-arrow icon-search" src="@/static/image/search_b@3x.png" mode=""></image> -->
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">违约类型</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'ViolationType')"
									range-key='name' mode="selector" :value="condition.viloationTypeName"
									:range="selectDataOptions.ViolationType">
									<text class="uni-input">{{condition.viloationTypeName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">细分类型</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'ChildType')"
									range-key='name' mode="selector" :value="condition.childTypeName"
									:range="selectDataOptions.ChildType">
									<text class="uni-input">{{condition.childTypeName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">事发渠道</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'ChannelType')"
									range-key='name' mode="selector" :value="condition.happenChannelIdName"
									:range="selectDataOptions.ChannelType">
									<text class="uni-input">{{condition.happenChannelIdName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">取证地</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'SupplyType')"
									range-key='name' mode="selector" :value="condition.supplyTypeName"
									:range="selectDataOptions.SupplyType">
									<text class="uni-input">{{condition.supplyTypeName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">省份</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'provincecode')"
									range-key='description' mode="selector" :value="condition.provinceName"
									:range="selectDataOptions.provincecode">
									<text class="uni-input">{{condition.provinceName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">城市</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'citycode')"
									range-key='description' mode="selector" :value="condition.cityName"
									:range="selectDataOptions.citycode">
									<text class="uni-input">{{condition.cityName}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block" v-if="condition.supplyType==='MARKET'">
					<text class="middle-date">市场名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.marketName"
									placeholder="" />
							</view>
						</view>
						<!-- <image class="icon-arrow icon-search" src="@/static/image/search_b@3x.png" mode=""></image> -->
					</view>
				</view>
				<view class="text-block" v-if="condition.supplyType==='PLATFORM'">
					<text class="middle-date">平台名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.platformName"
									placeholder="" />
							</view>
						</view>
						<!-- <image class="icon-arrow icon-search" src="@/static/image/search_b@3x.png" mode=""></image> -->
					</view>
				</view>
				<view class="text-block" v-if="condition.supplyType==='PLATFORM'">
					<text class="middle-date">商家名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.storeName"
									placeholder="" />
							</view>
						</view>
						<!-- <image class="icon-arrow icon-search" src="@/static/image/search_b@3x.png" mode=""></image> -->
					</view>
				</view>
				<view class="text-block" v-if="condition.supplyType==='PLATFORM'">
					<text class="middle-date">网址</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.storeAddress"
									placeholder="" />
							</view>
						</view>
						<!-- <image class="icon-arrow icon-search" src="@/static/image/search_b@3x.png" mode=""></image> -->
					</view>
				</view>
				<view class="text-block" v-if="condition.supplyType==='TERMINAL' || condition.supplyType==='MARKET' ">
					<text class="middle-date">终端名称</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.terminalName"
									placeholder="请填写" />
							</view>
						</view>
						<image class="icon-arrow icon-search" @click="selectClueTerminal"
							src="@/static/image/search_b@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block" v-if="condition.supplyType==='TERMINAL' || condition.supplyType==='MARKET' ">
					<text class="middle-date">终端地址</text>
					<input class="middle-date-des" type="text" v-model="condition.terminalAddress" placeholder="" />
				</view>
				<view class="text-block">
					<text class="middle-date">银行账户</text>
					<view class="middle-date-des uni-list picker-year" @click="selectSalesAreaAccountInfo">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.salesAreaAccountInfo.accountNumber"
									placeholder="请填写" />
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block">
					<text class="middle-date">稽查时间</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<picker class="picker-block" @change="bindPickerChange($event,'date')" mode="date"
									:value="condition.auditTime" fields='day'>
									<text class="uni-input">{{condition.auditTime}}</text>
								</picker>
							</view>
						</view>
						<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode=""></image>
					</view>
				</view>
				<view class="text-block text-block-last">
					<text class="middle-date">稽查说明</text>
				</view>
				<view class="remark">
					<textarea class="remark-text" v-model="condition.auditNotes" />
				</view>

			</view>

			<view class="middle view">
				<view class="text-block">
					<text class="middle-date">物流码</text>
					<input class="middle-date-des" type="text" v-model="condition.barcode" placeholder="请输入" />
				</view>
				<view class="text-block">
					<text class="middle-date">物流码行项目</text>
					<view class="middle-date-des middle-date-buttons">
						<button class="diy-entry" type="default" @click="handleScan">
							<image class="diy-icon" src="@/static/image/scan@3x.png" mode="">
							</image>
							<text class="diy-entry-text">扫码</text>
						</button>
						<button class="diy-entry" type="default" @click="addProductByBarcode">
							<image class="diy-icon" src="@/static/image/add@3x.png" mode="">
							</image>
							<text class="diy-entry-text">增加</text>
						</button>
						<button class="diy-entry" type="default" @click="deleteProductByBarcode">
							<image class="diy-icon" src="@/static/image/del@3x.png" mode="">
							</image>
							<text class="diy-entry-text">删除</text>
						</button>
					</view>
				</view>
			</view>
			<view class="planout-block">
				<button class="btn" type="default" @click="addProductByBarcode">
					<text class="btn-text">查询</text>
				</button>
			</view>

			<view class="middle view planout-block-item">
				<view class="text-block">
					<text class="middle-date">产品名称</text>
					<text class="middle-date-product">{{productByBarcode.name}}</text>
				</view>
				<view class="text-block">
					<text class="middle-date">物流码</text>
					<text class="middle-date-des">{{productByBarcode.barcode}}</text>
				</view>
				<view class="text-block">
					<text class="middle-date">出库时间</text>
					<text class="middle-date-des">{{productByBarcode.outboundTime}}</text>
				</view>
			</view>

			<view class="middle view planout-block-item">
				<view class="text-block">
					<text class="middle-date">收货金额(元)</text>
					<view class="middle-date-des uni-list picker-year">
						<view class="uni-list-cell">
							<view class="uni-list-cell-db">
								<input class="middle-date-des" type="text" v-model="condition.receiveAmount"
									placeholder="请输入收货金额，保留2位小数" />
							</view>
						</view>
					</view>
				</view>
				<view class="text-block no-border">
					<text class="middle-date">事发战区及货源相关信息</text>
				</view>
				<view class="text-block no-border" v-if="happenSalesDetail.happenSalesAreaName">
					<text class="middle-date">事发战区</text>
					<text class="middle-date-des">{{happenSalesDetail.happenSalesAreaName}}</text>
				</view>
				<view class="text-block no-border" v-if="happenSalesDetail.happenSubSalesAreaName">
					<text class="middle-date">事发基地</text>
					<text class="middle-date-des">{{happenSalesDetail.happenSubSalesAreaName}}</text>
				</view>
				<view class="text-block no-border" v-if="distributerByBarcode.productChannelName">
					<text class="middle-date">货源渠道</text>
					<text class="middle-date-des">{{distributerByBarcode.productChannelName}}</text>
				</view>
				<view class="text-block no-border" v-if="distributerByBarcode.productDisSalesAreaName">
					<text class="middle-date">货源经销商战区</text>
					<text class="middle-date-des">{{distributerByBarcode.productDisSalesAreaName}}</text>
				</view>
				<view class="text-block no-border" v-if="distributerByBarcode.productDisSubSalesAreaName">
					<text class="middle-date">货源经销商基地</text>
					<text class="middle-date-des">{{distributerByBarcode.productDisSubSalesAreaName}}</text>
				</view>
				<view class="text-block no-border" v-if="distributerByBarcode.productDistributerName">
					<text class="middle-date">货源经销商</text>
					<text class="middle-date-des">{{distributerByBarcode.productDistributerName}}</text>
				</view>
				<view class="text-block no-border" v-if="distributerByBarcode.productDisChaManagerName">
					<text class="middle-date">货源经销商渠道经理</text>
					<text class="middle-date-des">{{distributerByBarcode.productDisChaManagerName}}</text>
				</view>
			</view>
			<view class="middle view">
				<view class="upload-area view">
					<text class="title">门头照片</text>
					<view class="pic-lists">
						<uni-file-picker ref='files' :auto-upload='false' v-model="fileDoorList" file-mediatype="image"
							:imageStyles="imageStyles" @select="select($event,'door')" @progress="progress" @success="success"
							@fail='fail'>
							<text>+</text>
						</uni-file-picker>
					</view>
					<text class="des">(只能上传一次图片，多次上传至保留最后上传）</text>
				</view>
				<view class="upload-area view">
					<text class="title">产品照片</text>
					<view class="pic-lists">
						<uni-file-picker ref='files' :auto-upload='false' v-model="fileProList" file-mediatype="image"
							:imageStyles="imageStyles" @select="select($event,'pro')" @progress="progress" @success="success"
							@fail='fail'>
							<text>+</text>
						</uni-file-picker>
					</view>
					<text class="des">(只能上传一次图片，多次上传至保留最后上传）</text>
				</view>
				<view class="upload-area view">
					<text class="title">发票/收据照片</text>
					<view class="pic-lists">
						<uni-file-picker ref='files' :auto-upload='false' v-model="fileBillList" file-mediatype="image"
							:imageStyles="imageStyles" @select="select($event,'bill')" @progress="progress" @success="success"
							@fail='fail'>
							<text>+</text>
						</uni-file-picker>
					</view>
					<text class="des">(只能上传一次图片，多次上传至保留最后上传）</text>
				</view>
			</view>


		</view>
		<view class="bottom-area"></view>

		<view class="bottom">
			<button class="btn" type="default" @tap="submit">
				<text class="btn-text">提交</text>
			</button>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'

	import {
		apiGetDictionary,
		apiClueSubmit,
		apiGetClueProduct,
		apiGetClueDistributer,
		apiGetClueDistributerInfo
	} from '@/servers/breakwords.js'

	import {
		apiGetProvinceCode
	} from '@/servers/common.js'


	import timeFormat from '@/uview-ui/libs/function/timeFormat.js'
	import inputAutocomplete from '@/components/input-autocomplete/input-autocomplete.vue';
	export default {
		components: {
			inputAutocomplete
		},
		data() {
			return {
				flag: false,
				condition: {
					submitMethod: '',
					submitMethodName: '',
					pwdInfo: '',
					viloationType: '',
					viloationTypeName: '',
					childType: '',
					childTypeName: '',
					happenChannelId: '',
					happenChannelIdName: '',
					productChannelId: '',
					productChannelName: '',
					supplyType: '',
					supplyTypeName: '',
					provinceCode: '',
					provinceName: '',
					cityCode: '',
					cityName: '',
					terminalId: '',
					terminalName: '',
					terminalAddress: '',
					platformName: '',
					storeName: '',
					storeAddress: '',
					marketName: '',
					salesAreaAccountInfo: {},
					auditTime: '',
					auditNotes: '',
					barcode: '',
					receiveAmount: '',
					doorPicUrl: '',
					productPicUrl: '',
					invoicePicUrl: '',
					receiptPicUrl: '',
				},
				pickerIndexs: {
					submitMethodIndex: 0
				},
				fileDoorList: [],
				fileProList: [],
				fileBillList: [],
				selectDataOptions: {
					'SubmitMethod': [],
					'ViolationType': [],
					'ChildType': [],
					'ChannelType': [],
					'provincecode': [],
					'citycode': [],
				},
				productByBarcode: {},
				distributerByBarcode: {},
				happenSalesDetail: {},
			}
		},
		computed: {
			...mapState(['sysinfo', 'userInfo']),
			navHeight() {
				return {
					'height': `${this.sysinfo.safeArea.top + 44}px`
				}
			},
			imageStyles() {
				return {
					width: 64,
					height: 64,
					border: {
						radius: '10%'
					}
				}
			},
		},
		created() {
			this.condition.auditTime = timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
			// 提交方式
			this.getDictionary('SubmitMethod')
			// 违规类型
			this.getDictionary('ViolationType')
			// 细分类型
			this.getDictionary('ChildType')
			// 事发渠道
			this.getDictionary('ChannelType')
			// 取证地
			this.getDictionary('SupplyType')
			// 事发渠道
			this.getDictionary('ChannelType')
			this.getProvinceCode('provincecode')
			// 事发基地
			this.addDistributerByBarcodeInfo()
		},
		mounted() {
			console.log('监听到事件来自 update');
			let _this = this
			uni.$on('selectClueTerminal', function(data) {
				console.log('监听到事件来自 selectClueTerminal ，携带参数 msg 为：', data);
				_this.condition.terminalName = data.selectedClueTerminal.name
				_this.condition.terminalId = data.selectedClueTerminal.id
				_this.condition.terminalAddress = data.selectedClueTerminal.address
			})

			uni.$on('selectSalesAreaAccountInfo', function(data) {
				console.log('监听到事件来自 selectSalesAreaAccountInfo ，携带参数 msg 为：', data);
				_this.condition.salesAreaAccountInfo = {
					"bankName": data.selectedSalesAreaAccountInfo.bankName,
					"accountName": data.selectedSalesAreaAccountInfo.accountName,
					"accountNumber": data.selectedSalesAreaAccountInfo.accountNumber,
					"contact": data.selectedSalesAreaAccountInfo.contact,
					"contactPhone": data.selectedSalesAreaAccountInfo.contactPhone
				}
			})
		},
		onUnload() {
			console.log('onUnload')
			uni.$off('selectClueTerminal')
			uni.$off('selectSalesAreaAccountInfo')
		},
		beforeDestroy() {
			console.log('onUnload2')
			uni.$off('selectClueTerminal')
			uni.$off('selectSalesAreaAccountInfo')
		},
		methods: {
			async getDictionary(key) {
				const params = {
					dictionaryKey: key
				}
				const res = await apiGetDictionary(params)
				this.selectDataOptions[key] = res.data
			},
			// 获取省市
			async getProvinceCode(type, code) {
				const params = `?field=${type}&type=${code}`
				const res = await apiGetProvinceCode(params)
				this.selectDataOptions[type] = res.data
			},
			bindPickerChange(e, type) {
				console.log('picker发送选择改变，携带值为', e, type)
				const index = e.detail.value
				switch (type) {
					case 'SubmitMethod':
						this.condition.submitMethod = this.selectDataOptions[type][index].code
						this.condition.submitMethodName = this.selectDataOptions[type][index].name
						break;
					case 'ViolationType':
						this.condition.viloationType = this.selectDataOptions[type][index].code
						this.condition.viloationTypeName = this.selectDataOptions[type][index].name
						break;
					case 'ChildType':
						this.condition.childType = this.selectDataOptions[type][index].code
						this.condition.childTypeName = this.selectDataOptions[type][index].name
						break;
					case 'ChannelType':
						this.condition.happenChannelId = this.condition.productChannelId = this.selectDataOptions[type][
							index
						].code
						this.condition.happenChannelIdName = this.condition.productChannelName = this.selectDataOptions[
							type][index].name
						break;
					case 'SupplyType':
						this.condition.supplyType = this.selectDataOptions[type][index].code
						this.condition.supplyTypeName = this.selectDataOptions[type][index].name
						break;
					case 'provincecode':
						this.condition.provinceCode = this.selectDataOptions[type][index].id
						this.condition.provinceName = this.selectDataOptions[type][index].description
						this.getProvinceCode('citycode', this.condition.provinceCode)
						break;
					case 'citycode':
						this.condition.cityCode = this.selectDataOptions[type][index].id
						this.condition.cityName = this.selectDataOptions[type][index].description
						break;
					case 'date':
						this.condition.auditTime = index
						break;
				}
			},
			selectClueTerminal() {
				if(this.condition.provinceName&& this.condition.cityName){
					uni.navigateTo({
						url: `/pages/select-clue-terminal/select-clue-terminal?keywords=${this.condition.provinceName}`
					});
				}else{
					uni.showToast({
						title: '请先选择省份和城市',
						duration: 2000,
						icon: 'none'
					});
				}
			},
			selectSalesAreaAccountInfo() {
				uni.navigateTo({
					url: `/pages/select-salesarea-account/select-salesarea-account?keywords=`
				});
			},
			async addProductByBarcode() {
				const params = {
					barcode: this.condition.barcode
				}
				const res = await apiGetClueProduct(params)
				if (res.data) {
					this.productByBarcode = res.data
					this.productByBarcode.id = 1
					this.productByBarcode.group = res.data.classGroupId
					this.productByBarcode.productId = res.data.productId
					this.productByBarcode.productName = res.data.barcodeTypeName
				}
				this.addDistributerByBarcode()
			},
			async addDistributerByBarcode() {
				const params = {
					barcode: this.condition.barcode
				}
				const res = await apiGetClueDistributer(params)
				if (res.data) {
					this.distributerByBarcode = res.data
				}

			},
			async addDistributerByBarcodeInfo() {
				const params = {
					distributerId: '4000021900'
				}
				const res = await apiGetClueDistributerInfo(params)
				this.happenSalesDetail = {
					'happenSalesAreaCode': res.data.salesAreaId,
					'happenSalesAreaName': res.data.salesAreaName,
					'happenSubSalesAreaCode': res.data.subSalesAreaId,
					'happenSubSalesAreaName': res.data.subSalesAreaName
				}
			},
			deleteProductByBarcode() {
				this.productByBarcode = {}
				this.distributerByBarcode = {}
			},
			async submit() {
				if(this.flag){
					return
				}
				this.flag = true
				let params = {
					'supplyType': this.condition.supplyType,
					'auditTime': this.condition.auditTime,
					'auditNotes': this.condition.auditNotes,
					// 'channelId': this.condition.happenChannelId,
					'childType': this.condition.childType,
					'childTypeName': this.condition.childTypeName,
					'cityCode': this.condition.cityCode,
					'cityName': this.condition.cityName,
					'doorPicUrl': this.condition.doorPicUrl,
					'entries': [this.productByBarcode],
					'happenChannelId': this.condition.happenChannelId,
					'invoicePicUrl': this.condition.invoicePicUrl,
					
					// 战区
					'happenSalesAreaCode': this.happenSalesDetail.happenSalesAreaCode,
					'happenSalesAreaName': this.happenSalesDetail.happenSalesAreaName,
					'happenSubSalesAreaCode': this.happenSalesDetail.happenSubSalesAreaCode,
					'happenSubSalesAreaName': this.happenSalesDetail.happenSubSalesAreaName,
					// 战区下面五个字段
					'productChannelId': this.distributerByBarcode.productChannelId,
					'productChannelName': this.distributerByBarcode.productChannelName,
					'productDisChaManagerId': this.distributerByBarcode.productDisChaManagerId,
					'productDisChaManagerName': this.distributerByBarcode.productDisChaManagerName,
					'productDisSalesAreaId': this.distributerByBarcode.productDisSalesAreaId,
					'productDisSalesAreaName': this.distributerByBarcode.productDisSalesAreaName,
					'productDisSubSalesAreaId': this.distributerByBarcode.productDisSubSalesAreaId,
					'productDisSubSalesAreaName': this.distributerByBarcode.productDisSubSalesAreaName,
					'productDistributerId': this.distributerByBarcode.productDistributerId,
					'productDistributerName': this.distributerByBarcode.productDistributerName,
					
					'productPicUrl': this.condition.productPicUrl,
					'provinceCode': this.condition.provinceCode,
					'provinceName': this.condition.provinceName,
					'pwdInfo': this.condition.pwdInfo,
					'receiptPicUrl': this.condition.invoicePicUrl,
					'receiveAmount': this.condition.receiveAmount-0,
					'submitMethod': this.condition.submitMethod,
					'submitSource': 'DISTRIBUTER',
					'submitUserId': this.userInfo.code,
					'submitUserName': this.userInfo.name,
					'terminalAddress': this.condition.terminalAddress,
					'terminalId': this.condition.terminalId,
					'terminalName': this.condition.terminalName,
					'viloationType': this.condition.viloationType,
					'platformName': this.condition.platformName,
					'storeName': this.condition.storeName,
					'marketName': this.condition.marketName,
					'storeAddress': this.condition.storeAddress,
					'salesAreaAccountInfo': this.condition.salesAreaAccountInfo,
				}
				const res = await apiClueSubmit(params)
				if(res.result === 'S'){
					uni.showToast({
						title: '提报成功',
						duration: 2000,
						success: () => {
							setTimeout(() => {
								uni.navigateBack({delta:1})
							}, 1000)
						}
					})
				}else{
					this.flag = false
				}
			},
			handleScan() {
				uni.scanCode({
					scanType: ['barCode'],
					success: function(res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						this.condition.barcode = res.result
					}
				});
			},
			// 获取上传进度
			progress(e) {
				console.log('上传进度：', e)
			},
			// 选择文件
			select(e,type) {
				console.log(e,'选择文件')
				switch (type){
					case 'door':
						this.condition.doorPicUrl = e.tempFilePaths[e.tempFilePaths.length - 1]
						break;
					case 'pro':
						this.condition.productPicUrl = e.tempFilePaths[e.tempFilePaths.length - 1]
						break;
					case 'bill':
						this.condition.invoicePicUrl = e.tempFilePaths[e.tempFilePaths.length - 1]
						break;
					default:
						break;
				}
			},
			// 上传成功
			success(e) {
				console.log('上传成功', e)
			},
			// 上传失败
			fail(e) {
				console.log('上传失败：', e)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.view {
		display: flex;
		flex-direction: column;
	}

	.status_bar {
		height: var(--status-bar-height);
	}

	.header-bg {
		height: 284rpx;
		margin-top: -88rpx;
	}

	.header-bg-img {
		width: 100%;
	}

	.lists {
		position: relative;
		flex-direction: column;
		background: #f0f4f5;
	}

	.main {
		position: relative;
		overflow-y: scroll;
		flex-direction: column;
		margin-top: -164rpx;
		border-radius: 16rpx;
		padding: 0 16rpx;
	}

	.middle {
		background-color: #fff;
		border-radius: 16rpx;
		padding: 0 48rpx;
		margin-bottom: 32rpx;
	}

	.text-block {
		display: flex;
		overflow: hidden;
		height: 96rpx;
		border-bottom: 1px solid #f4f5f6;
	}

	.text-block-last {
		margin-bottom: 0;
		border-bottom: 0;
	}

	.no-border {
		border: 0;
	}

	.middle-date {
		flex: 3;
		font-size: 28rpx;
		color: #999;
		margin-bottom: 8rpx;
		line-height: 96rpx;
	}

	.middle-date-des {
		display: flex;
		align-items: center;
		flex: 4;
		font-size: 28rpx;
		color: $text-base-color;
		height: 96rpx;
		line-height: 96rpx;
	}
	.middle-date-product{
		display: flex;
		align-items: center;
		flex: 4;
		font-size: 28rpx;
		color: $text-base-color;
		height: 96rpx;
	}

	.middle-date-buttons {}

	.uni-input-placeholder {
		color: #DBDBDB;
	}

	.picker-year {
		position: relative;
		align-items: center;
		// padding-left: 14rpx;
	}

	.uni-list-cell {
		flex: 1;
		height: 100%;
		padding-right: 52rpx;
	}

	.uni-list-cell-db {
		flex: 1;
		height: 100%;
	}

	.picker-block {
		flex: 1;
		height: 100%;
	}

	.uni-input {
		font-size: 14px;
		color: $text-base-color;
	}

	.icon-arrow {
		position: absolute;
		right: 22rpx;
		top: 40rpx;
		width: 7px;
		height: 10px;
		z-index: 10;
	}

	.icon-search {
		width: 11px;
		height: 12px;
		top: 36rpx;
	}

	.remark {
		margin-bottom: 24px;
	}

	.remark-text {
		flex: 1;
		height: 180rpx;
		background: #f5f6f7;
		border-radius: 4px;
		padding: 12rpx 18rpx;
	}


	.diy-entry {
		width: 140rpx;
		height: 68rpx;
		background: #f8f8f8;
		border-radius: 8px;
		line-height: 68rpx;
		border: 1px solid #f8f8f8;
		margin-left: 16rpx;
	}

	.diy-icon {
		width: 24rpx;
		height: 20rpx;
		margin-right: 8rpx;
	}

	.diy-entry-text {
		color: #333;
		font-size: 12px;
	}

	.planout-block-item {
		margin-top: 48rpx;
	}

	.upload-area {
		padding-top: 32rpx;
		padding-bottom: 32rpx;

		.title {
			font-size: 28rpx;
			color: #333;
			font-weight: 500;
		}

		.pic-lists {
			margin-top: 24rpx;
			margin-bottom: 20rpx;
		}

		.des {
			color: #1C84FF;
			font-size: 20rpx;
		}
	}



	.bottom-area {
		height: 140rpx;
		margin-top: 12rpx;
	}

	.bottom {
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 10;
		width: 750rpx;
		height: 140rpx;
		padding: 0 32rpx;
		background-color: #fff;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.btn {
		flex: 1;
		height: 92rpx;
		background: $wly-primary-color;
		border-radius: 46rpx;
	}

	.btn-l {
		margin-right: 30rpx;
		border: 1px solid $wly-primary-color;
		background-color: transparent;

	}

	.btn-text {
		color: #fff;
		font-size: 34rpx;
	}

	.btn-text-l {
		color: $wly-primary-color;
	}
	::v-deep  .str-auto-complete-container{
		// min-width: 50%;
		max-width: 50%;
		position: fixed;
	}
	::v-deep  .str-auto-complete-item{
		line-height: 1;
	}
	::v-deep  .iac-input-wrap{
		min-height: 96rpx;
	}
	::v-deep  .uni-input-input{
		font-size: 28rpx;
	}
</style>
