uniapp下拉选择picker-view搜索

<template>
	<view class="">
		<form @submit="formSubmit" @reset="formReset">
			<view style="background-color: #fff;margin-top: 8px;">
				<view class="content">
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>优先级:</view>
						<view style="float:right;overflow: hidden;">
							<picker @change="djrbindPickerChange" :value="djrindex" :range="djrarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="djr==''">请选择</view>
								<view class="uni-input" v-show="djr!=''">{{djrarray[djrindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>

						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>支付类别:</view>
						<view style="float:right;overflow: hidden;">

							<picker @change="bxlbbindPickerChange" :value="bxlbindex" :range="bxlbarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="bxlb==''">请选择</view>
								<view class="uni-input" v-show="bxlb!=''">{{bxlbarray[bxlbindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>

						</view>
					</view>

					<view class="li" v-show="bxlbindex==0||bxlbindex==2">
						<view style="float:left"><text style="color: red;">*</text>项目名称:</view>
						<view style="float:right;overflow: hidden;">
							<!-- <picker @change="xgxmbindPickerChange" :value="xgxmindex" :range="xgxmarray" @click="xgxmbindPickerClick('项目')"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="xgxm==''">请选择</view>
								<view class="uni-input" v-show="xgxm!=''">{{xgxmarray[xgxmindex]}}</view>
							</picker> -->
							<text @click="xgxmbindPickerClick('项目')" style="float: left;margin-right: 10px;"><text
									v-show="projectName==''" style="color: #AFAFAF;">请选择</text>{{projectName}}</text>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: right;margin-top: 22px;"></image>

						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>客户信息:</view>
						<view style="float:right;overflow: hidden;">
							<picker @change="khbindPickerChange" :value="khindex" :range="kharray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="kh==''">请选择</view>
								<view class="uni-input" v-show="kh!=''">{{kharray[khindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>

						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>供应商:</view>
						<view style="float:right;overflow: hidden;">

							<picker @change="gyslbbindPickerChange" :value="gyslbindex" :range="gyslbarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="gyslb==''">请选择</view>
								<view class="uni-input" v-show="gyslb!=''">{{gyslbarray[gyslbindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>

						</view>
					</view>

					<view class="li">
						<view style=""><text style="color: red;">*</text>付款说明:</view>
						<view style="">
							<textarea placeholder="请填写" v-model="fksm"
								style="line-height: 22px;font-weight: 400;font-size: 14px;"
								placeholder-style="color: rgba(0, 0, 0, 0.6);"></textarea>
						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>收款单位:</view>
						<view style="float:right;overflow: hidden;">
							<input type="text" placeholder="请填写" v-model="skdw"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" />
						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>开户银行:</view>
						<view style="float:right;overflow: hidden;">
							<input type="text" placeholder="请填写" v-model="khyh"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" />
						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>银行账号:</view>
						<view style="float:right;overflow: hidden;">
							<input type="text" placeholder="请填写" v-model="yhzh"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" />
						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>付款方式:</view>
						<view style="float:right;overflow: hidden;">

							<picker @change="fkfsbindPickerChange" :value="fkfsindex" :range="fkfsarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="fkfs==''">请选择</view>
								<view class="uni-input" v-show="fkfs!=''">{{fkfsarray[fkfsindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>
						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>发票类型:</view>
						<view style="float:right;overflow: hidden;">

							<picker @change="fplxbindPickerChange" :value="fplxindex" :range="fplxarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="fplx==''">请选择</view>
								<view class="uni-input" v-show="fplx!=''">{{fplxarray[fplxindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>
						</view>
					</view>
					<view class="li">
						<view style="float:left"><text style="color: red;">*</text>付款金额(元):</view>
						<view style="float:right;overflow: hidden;">
							<input type="number" placeholder="请填写" v-model="bxzje"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" />
						</view>
					</view>
					<view class="li">
						<view style="float:left">产品情况:</view>
						<view style="float:right;overflow: hidden;">
							<!-- <input type="text" placeholder="请填写" v-model="cpqk"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" /> -->
							<picker @change="cpqkbindPickerChange" :value="cpqkindex" :range="cpqkarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="cpqk==''">请选择</view>
								<view class="uni-input" v-show="cpqk!=''">{{cpqkarray[cpqkindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>
						</view>
					</view>
					<view class="li">
						<view style="float:left">票据情况:</view>
						<view style="float:right;overflow: hidden;">
							<!-- <input type="text" placeholder="请填写" v-model="pjqk"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" /> -->
							<picker @change="pjqkbindPickerChange" :value="pjqkindex" :range="pjqkarray"
								style="float: left;margin-right: 9px;">
								<view class="uni-input" style="color:rgba(0, 0, 0, 0.4);" v-show="pjqk==''">请选择</view>
								<view class="uni-input" v-show="pjqk!=''">{{pjqkarray[pjqkindex]}}</view>
							</picker>
							<image src="../../../static/hc.png"
								style="width: 6px;height: 12px;float: left;margin-top: 22px;"></image>
						</view>
					</view>
					<!-- <view class="li">
						<view style="float:left">状态:</view>
						<view style="float:right;overflow: hidden;">
							<input type="text" placeholder="请填写" v-model="zt"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" />
						</view>
					</view> -->
					<q-previewImage ref="previewImage" :urls="imgs"></q-previewImage>
					<view class="li">
						<view style="">附件:</view>
						<l-file ref="lFile" :logo="logo" @up-success="onSuccess"></l-file>
						<view class="padding">
							<button @tap="onUpload"
								style="line-height: 20px;border: 1px solid #007AFF;margin-bottom: 10px;
							padding: 5px;color: #007AFF;border-radius: 5px;text-align: center;background-color: #fff;font-size: 14px;">上传附件</button>
						</view>
						<view v-for="(itema,index) in wjDz" v-show="wjDz!=''">
							<view class="wenjianm">{{itema.name}}<text @click="shanchufujianClick(index)"
									style="float: right;padding-right: 10px;">删除</text></view>
						</view>
					</view>
					<!-- <view class="li">
						<view style="float:left">付款凭证:</view>
						<view style="float:right;overflow: hidden;">
							<input type="text" placeholder="请填写" v-model="bxpz"
								style="float:right;line-height: 55px;height: 55px;text-align: right;font-size: 14px;"
								placeholder-style="color:rgba(0, 0, 0, 0.4);" />
						</view>
					</view> -->
					<!-- <view class="li">
						<view style="">付款凭证:</view>
						<l-file ref="lFile" :logo="logo" @up-success="onSuccess"></l-file>
						<view class="padding">
							<button @tap="onUpload" style="background-color: #0066CC;color: #fff;">上传文件</button>
						</view>
						<view v-show="wjmc!=''">{{wjmc}}</view>
					</view> -->
				</view>
			</view>

		</form>

		<view style="background-color: #fff;">
			<view @click="tijiaoClick"
				style="position: fixed;left: 0;bottom: 0;background-color: #fff;box-shadow: 0px -7px 13px rgba(0, 47, 73, 0.07);width: 100%;z-index: 999;z-index: 999;">
				<view style="width: 92%;margin: 0 auto;background-color: #0898EF;border-radius: 8px;text-align: center;font-size: 16px;
			line-height: 44px;color: #fff;line-height: 44px;margin-top: 10px;margin-bottom: 10px;">提交</view>
			</view>
		</view>

		<!-- 项目名称选择-->
		<view
			style="background-color: #000;position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: 9999;opacity: 0.6;"
			v-show="xmmctcXS==true" @click="gbzzcClick">
		</view>
		<view
			style="bottom: 0;left: 0;position: fixed;background-color: #fff;width: 100%;z-index: 99999;opacity: 1 !important;"
			v-show="xmmctcXS==true">
			<view class="content">
				<!-- <view v-show="btShow==true"
						style="height: 48px;line-height: 48px;overflow: hidden;border-bottom: 1px solid rgba(0, 0, 0, 0.2);;">
						<view style="float: left;">项目名称</view>
						<view style="display: flex;float: right;margin-top: 10px;">
							<image src="../../../static/sousuo.png" style="width: 24px;height: 24px;margin-right: 20px;"
								@click="sousuoClick">
							</image>
							<image src="../../../static/gb.png" style="width: 24px;height: 24px;" @click="guanbiClick">
							</image>
						</view>
			
					</view> -->
				<!-- 搜索 -->
				<view style="padding-top: 16px;overflow: hidden;">
					<text style="color: #0898EF;float: left;line-height: 52px;margin-right: 5px;"
						@click="quxiaoClick">取消</text>
					<view
						style="background: #F2F2F2;border-radius: 8px;font-weight: 400;font-size: 16px;color: rgba(0, 0, 0, 0.4);width: 77%;float: left;display: flex;padding-top: 14px;padding-bottom: 14px;padding-left: 2%;padding-right: 2%;">
						<image src="../../../static/ssh.png" style="width: 24px;height: 24px;margin-right: 2%;">
						</image>
						<input v-model="sousuonr" @input="xinputClickdt" placeholder="搜索" style="width: 75%;" />
						<image src="../../../static/qxinput.png" style="width: 24px;height: 24px;margin-right: 2%;"
							v-show="sousuonr!=''" @click="inputquxiaoClick">
						</image>
					</view>
					<text style="color: #0898EF;float: right;line-height: 52px;" @click="quedingbutClick">确定</text>
				</view>
				<picker-view class="picker-view" style="height: 300rpx;margin-top: 0;padding-top: 0;"
					@change="xzbindChange" :value="[xgxmindex]" mask-style="height:100rpx;">
					<picker-view-column>
						<view class="item" v-for="(item,index) in xgxmList" :key="index">
							{{item.projectName}}
						</view>
					</picker-view-column>
				</picker-view>

				<!-- <view style="overflow-x: hidden;height: 260px;" v-show="xmmclbShow==true">
			
						<view style="padding-top: 10px;padding-bottom: 10px;overflow: hidden;"
							v-for="(item, index) in xgxmList" :key="item.value">
							<text style="float: left;">{{item.projectName}}</text>
							<radio-group style="float: right;" @change="radioChange">
								<radio :value="item.name" :checked="index === current"></radio>
							</radio-group>
			
						</view>
					</view>
					<view
						style="overflow: hidden;height: 300px;font-weight: 400;font-size: 14px;line-height: 22px;color: rgba(0, 0, 0, 0.6);text-align: center;line-height: 300px;"
						v-show="">
						<text>暂无关键词,请重新输入</text>
					</view>
			
					<view style="background-color: #fff;width: 100%;display: flex;">
						<view style="width: 45%;margin: 0 auto;border: 1px solid #0898EF;border-radius: 8px;text-align: center;font-size: 16px;
					line-height: 44px;color: #0898EF;line-height: 44px;margin-top: 10px;margin-bottom: 10px;" @click="quxiaobutClick">
							取消
						</view>
			
						<view style="width: 45%;margin: 0 auto;background-color:#0898EF;border-radius: 8px;text-align: center;font-size: 16px;
					line-height: 44px;color: #fff;line-height: 44px;margin-top: 10px;margin-bottom: 10px;" @click="quedingbutClick">确定
						</view>
					</view> -->
			</view>
		</view>

	</view>
</template>

<script>
	export default {

		data() {
			const currentDate = this.getDate({
				format: true
			})
			const currentDateGH = this.getDate({
				format: true
			})
			return {

				xgxmindex: 0,
				xgxmarray: [],
				xgxm: '', //相关项目
				xgxmList: [],

				khindex: 0,
				kharray: [],
				kh: '', //项目客户

				fkfsindex: 0,
				fkfsarray: [],
				fkfs: '', //付款类别

				fplxindex: 0,
				fplxarray: [],
				fplx: '', //票据类型


				//
				ztindex: 0,
				ztarray: [], //'正常', '终止', '完成'
				zt: '', //状态

				//
				jhrq: '',
				ghksTime: currentDate, //规划开始时间

				jhrqGH: '',
				dateGH: currentDateGH, //规划结束时间


				dh: '', //电话
				xmnr: '', //项目内容

				bz: '', //备注



				zje: null,
				daxiezje: null,

				items: [{
						value: 'jn',
						name: '济宁',
					},
					{
						value: 'hb',
						name: '淮北'
					},
				],
				current: null,

				sousuonr: '', //搜索内容

				qimgList: [],
				himgList: [],
				xmmctcXS: false,
				btShow: true,
				xmmclbShow: true,
				yeshu: 1,
				shuliang: 20,
				token: '',
				logo: '',
				wjDz: [],
				wjmc: [],
				xmlxList: [],
				yhList: [],
				xmjdList: [],
				xmztList: [],
				itemList: [], //列表点击传过来的数据
				uuid: '',
				fkfsList: [],
				zwwl: false,

				fkfsxx: '',
				fkfs: '',
				bxsm: '',
				bxzje: '',
				bxpz: '',

				fkfsList: [],
				fplxList: [],
				fksm: '',
				skdw: '',
				khyh: '',
				yhzh: '',

				cpqk: '',
				cpqkindex: 0,
				cpqkarray: ['已收到产品', '未收到产品'],

				pjqk: '',
				pjqkindex: 0,
				pjqkarray: ['已收', '未收'],

				filePath: [],
				djrindex: 0,
				djrarray: ['紧急', '普通', '较低'],
				djr: '', //优先级

				bxlbindex: 0,
				bxlbarray: [],
				bxlb: '', //类别

				bxlbList: [], //从接口获取类别数据

				gyslbindex: 0,
				gyslbarray: [],
				gyslb: '', //供应商
				gyslbList: '', //供应商信息
				projectName: '',
				imgs: [] //图片放大


			}
		},
		onLoad(options) {
			var that = this;
			uni.getStorage({
				key: 'token',
				success: function(res) {
					that.token = res.data
					var length = that.token.length;
					that.token = that.token.substring(7, length);
					//console.log(that.token);
				}
			})
			uni.getNetworkType({
				success: function(res) {
					if (res.networkType == 'none') {
						console.log(res.networkType);
						that.zwwl = true;
						uni.showToast({
							title: '网络好像有点问题,请检查后重试',
							icon: 'none'
						})
						return false;
					} else {
						that.zwwl = false;
						that.xgxmClick();
						that.khlbClick();
						that.fkfsClick();
						that.fplxClick();
						that.bxlbClick();
						that.gyslbClick();
					}
				}
			});
			//编辑
			if (options.item != undefined) {
				console.log(JSON.parse(options.item))
				that.itemList = JSON.parse(options.item)
				that.uuid = that.itemList.uuid
				that.kh = that.itemList.customer
				that.xgxm = that.itemList.project
				that.projectName = that.itemList.projectName
				that.fksm = that.itemList.paymentReason
				that.skdw = that.itemList.collectionOrg
				that.khyh = that.itemList.depositBank
				that.yhzh = that.itemList.bankAccount
				that.fkfs = that.itemList.paymentWay
				that.fplx = that.itemList.invoiceType
				that.bxzje = that.itemList.account

				that.cpqk = that.itemList.productInfo
				that.cpqkindex = that.itemList.productInfo - 1

				that.pjqk = that.itemList.notes
				that.pjqkindex = that.itemList.notes - 1

				that.zt = that.itemList.status
				if (that.itemList.filePath != '') {
					that.filePath = JSON.parse(that.itemList.filePath)
					that.wjDz = that.filePath //修改用
					//that.wjmc=
				}
				//优先级
				if (that.itemList.priority == 'priority01') {
					that.djr = '紧急'
					that.djrindex = 0
				} else if (that.itemList.priority == 'priority02') {
					that.djr = '普通'
					that.djrindex = 1
				} else if (that.itemList.priority == 'priority03') {
					that.djr = '较低'
					that.djrindex = 2
				}
				that.bxlb = that.itemList.paymentCategory //类别

			}
		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			},
			startDateGH() {
				return this.getDate('start');
			},
			endDateGH() {
				return this.getDate('end');
			}
		},
		methods: {
			gbzzcClick() {
				this.xmmctcXS = false;
			},
			//供应商列表
			gyslbClick() {
				// /ztoa/ztoaSupplier/searchSupplierList
				var that = this;
				uni.request({
					url: that.$Url + '/ztoa/ztoaSupplier/searchSupplierList', //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {

					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {
						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
						} else {
							console.log(res.data)
							that.gyslbList = res.data
							var arr = {};
							for (var i = 0; i < res.data.length; i++) {
								arr = res.data[i].supplierName
								// console.log(arr)
								that.gyslbarray.push(arr)
							}
							if (that.gyslbList.length != 0) {
								for (var gyslbi = 0; gyslbi < that.gyslbList.length; gyslbi++) {
									if (that.itemList.supplier == that.gyslbList[gyslbi]
										.value) {
										that.gyslbindex = gyslbi
										that.gyslb = that.gyslbList[gyslbi].value
									}
								}
							}
						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}

					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})
			},
			//支付类别
			bxlbClick() {
				// /system/dicSet/getDicItemByCode
				var that = this;
				uni.request({
					url: that.$Url + '/system/dicSet/getDicItemByCode', //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {
						code: 'payment_category'
					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {
						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
						} else {
							// console.log(res.data)
							that.bxlbList = res.data
							var arr = {};
							for (var i = 0; i < res.data.length; i++) {
								arr = res.data[i].text
								// console.log(arr)
								that.bxlbarray.push(arr)
							}
							if (that.bxlbList.length != 0) {
								for (var bxlbi = 0; bxlbi < that.bxlbList.length; bxlbi++) {
									if (that.itemList.paymentCategory == that.bxlbList[bxlbi]
										.value) {
										that.bxlbindex = bxlbi
										that.bxlb = that.bxlbList[bxlbi].value
									}
								}
							}
						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}

					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})
			},
			//类别
			bxlbbindPickerChange: function(e) {
				console.log('picker发送选择改变,携带值为', e.detail.value)
				this.bxlbindex = e.detail.value
				this.bxlb = this.bxlbList[e.detail.value].value
				if (e.detail.value == 1) {
					this.xgxm = '管理费用'
				} else if (e.detail.value == 3) {
					this.xgxm = '科技申报费用'
				} else {
					this.xgxm = ''
				}
			},
			//优先级
			djrbindPickerChange: function(e) {
				console.log('picker发送选择改变,携带值为', e.detail.value)
				this.djrindex = e.detail.value
				this.djr = this.djrarray[e.detail.value]
				console.log(this.djr)
				//this.djrarray[e.detail.value]
			},
			//删除附件
			shanchufujianClick(index) {
				var that = this;
				//console.log(that.wjDz.indexOf(index), 1)
				that.wjmc.splice(index, 1) //展示附件名称用
				that.wjDz.splice(index, 1) //接口提交数据
				//console.log(that.wjDz)
			},
			//发票类型
			fplxClick() {
				var that = this;
				uni.request({
					url: that.$Url + '/system/dicSet/getDicItemByCode', //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {
						code: 'invoiceType'
					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {
						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
						} else {
							console.log(res.data)
							that.fplxList = res.data
							var arr = {};
							for (var i = 0; i < res.data.length; i++) {
								arr = res.data[i].text
								console.log(arr)
								that.fplxarray.push(arr)
							}
							if (that.fplxList.length != 0) {
								for (var fplxi = 0; fplxi < that.fplxList.length; fplxi++) {
									if (that.itemList.invoiceType == that.fplxList[fplxi]
										.value) {
										that.fplxindex = fplxi
										that.fplx = that.fplxList[fplxi].value
									}
								}
							}
						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}
					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})
			},
			xgxmClick() {
				var that = this;
				uni.request({
					url: that.$Url +
						'/ztoa/ztoaProject/getPageSet', //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {
						pageNo: that.yeshu,
						pageSize: 999,
						projectName: that.sousuonr //项目名称
					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {

						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
							// return false;
						} else {
							that.xgxmList = res.data.rows
							// console.log(that.xgxmList)
							var arr = {};
							for (var i = 0; i < res.data.rows.length; i++) {
								arr = res.data.rows[i].projectName
								// console.log(arr)
								that.xgxmarray.push(arr)
							}
							if (that.xgxmList.length != 0) {
								for (var xgxmi = 0; xgxmi < that.xgxmList.length; xgxmi++) {
									if (that.itemList.project == that.xgxmList[xgxmi].projectCode) {
										that.xgxmindex = xgxmi
										that.xgxm = that.xgxmList[xgxmi].projectCode
									}
								}
							}
						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}

					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})
			},
			khlbClick() {
				var that = this;
				uni.request({
					url: that.$Url +
						'/ztoa/ztoaCustomerManage/getPageSet', //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {
						pageNo: 1,
						pageSize: 999,
					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {

						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
							// return false;
						} else {
							that.khList = res.data.rows
							var arr = {};
							for (var i = 0; i < res.data.rows.length; i++) {
								arr = res.data.rows[i].customerName
								// console.log(arr)
								that.kharray.push(arr)
							}
							if (that.khList.length != 0) {
								for (var khi = 0; khi < that.khList.length; khi++) {
									if (that.itemList.customer == that.khList[khi].customerId) {
										that.khindex = khi
										that.kh = that.khList[khi].customerId
									}
								}
							}
						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}

					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})
			},
			fkfsClick() {
				// /system/dicSet/getDicItemByCode

				var that = this;
				uni.request({
					url: that.$Url + '/system/dicSet/getDicItemByCode', //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {
						code: 'payment_way'
					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {
						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
						} else {
							console.log(res.data)
							that.fkfsList = res.data
							var arr = {};
							for (var i = 0; i < res.data.length; i++) {
								arr = res.data[i].text
								console.log(arr)
								that.fkfsarray.push(arr)
							}
							if (that.fkfsList.length != 0) {
								for (var fkfsi = 0; fkfsi < that.fkfsList.length; fkfsi++) {
									if (that.itemList.paymentWay == that.fkfsList[fkfsi]
										.value) {
										that.fkfsindex = fkfsi
										that.fkfs = that.fkfsList[fkfsi].value
									}
								}
							}
						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}

					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})
			},
			/* 上传 */
			onUpload() {
				/**
				 * currentWebview: 当前webview
				 * url:上传接口地址
				 * name:附件key,服务端根据key值获取文件流,默认file,上传文件的key
				 * header: 上传接口请求头
				 */
				var that = this;
				that.$refs.lFile.upload({
					// #ifdef APP-PLUS
					//(app端必传)nvue页面使用时请查阅nvue获取当前webview的api,当前示例为vue窗口
					currentWebview: that.$mp.page.$getAppWebview(),
					// #endif
					//替换为你的上传接口地址
					url: that.$Url + '/system/attachment/upload',
					// 服务端接收附件的key
					name: 'file',
					//根据你接口需求自定义 (优先不传content-type,安卓端无法收到参数再传)
					header: {
						// 'Authorization': 'bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mbyI6eyJ1c2VyTmFtZSI6',
						// 'uid': '27682',
						// 'client': 'app',
						// 'accountid': 'DPOA9487'

						// 'content-type': 'form-data',
						'token': that.token
					},


					// 限制选择附件的大小上限,默认10M
					// maxSize: 20,

					// 若需要在body单独添加附件名或附件大小如下方式传入组件:
					// addName: '后端要的附件名称字段key,此处请勿写name的同值如(file),会覆盖name',
					// addSize: '后端要的附件大小字段key'

					// body参数直接写key,value,如:
					// date: '2020-1-1',
					// key2: 'value2',
				});
			},
			onSuccess(res) {
				console.log(res);
				var that = this;
				var arrdz = {}
				arrdz.name = res.fileName;
				arrdz.url = res.filePath;
				that.wjDz.push(arrdz)
				that.wjmc.push(res.fileName)
				console.log('上传成功回调', JSON.stringify(res));
				console.log(JSON.stringify(that.wjDz))
				console.log(JSON.stringify(that.wjmc))

			},

			//关闭搜索项目名称弹窗
			guanbiClick() {
				this.xmmctcXS = false
			},
			//点击搜索名称按钮
			sousuoClick() {
				this.btShow = false
				//项目名称取消展示
				//this.xmmclbShow = false
			},
			//显示选择项目名称弹窗
			xmmctcClick() {
				this.xmmctcXS = true
			},
			//取消搜索项目名称
			quxiaoClick() {
				this.xmmctcXS = false;
			},
			//取消选择项目名称弹窗
			quxiaobutClick() {
				console.log(this.current)
				this.current = null;
				this.xmmc = '';
			},
			//确定选择项目名称
			quedingbutClick() {
				this.xmmctcXS = false
				//获取选择的值
				console.log(this.xmmc)

				this.xgxm = this.xgxmList[this.xgxmindex].projectCode
				this.projectName = this.xgxmList[this.xgxmindex].projectName

				//选项目的时候把客户带入
				for (var i = 0; i < this.khList.length; i++) {
					if (this.khList[i].customerName == this.xgxmList[this.xgxmindex].customerName) {
						this.khindex = i
						this.kh = this.khList[i].customerId
						console.log(this.khindex, this.kh)
						return false;
					}
				}

			},
			//上传图片
			shangchuanClick() {
				var that = this;
				uni.chooseImage({
					count: 1, //上传图片的数量,默认是9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
					sourceType: ['album'], //从相册选择
					success: function(res) {
						const tempFilePaths = res.tempFilePaths; //拿到选择的图片,是一个数组
						that.qimgList.push(tempFilePaths)
						console.log(tempFilePaths);
						console.log(that.qimgList)
						uni.uploadFile({
							url: 'http://localhost:3000/users/upload', //post请求的地址
							filePath: tempFilePaths[0],
							name: 'img',
							formData: {

							},
							success: (uploadFileRes) => {
								//这里要注意,uploadFileRes.data是个String类型,要转对象的话需要JSON.parse一下
								var obj = JSON.parse(uploadFileRes.data);

							}
						})
					}
				});
			},
			xinputClickdt(e) {
				console.log(e.detail.value)
				this.sousuonr = e.detail.value
				this.xgxmClick()
			},
			//picker-view
			xzbindChange(e) {
				console.log(e.detail.value)
				this.xgxmindex = e.detail.value
			},
			//取消input
			inputquxiaoClick() {
				console.log('取消input')
				this.sousuonr = '';
				this.xgxmClick()
			},
			radioChange: function(evt) {
				console.log(evt)
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].name === evt.detail.value) {
						this.current = i;
						break;
					}
				}
				this.xmmc = evt.detail.value;
			},
			formSubmit(e) {
				console.log(e)
			},
			formReset(e) {
				console.log(e)
			},
			//
			bindDateChange: function(e) {
				this.ghksTime = e.detail.value
				this.jhrq = e.detail.value
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			//
			bindDateChangeGH: function(e) {
				this.dateGH = e.detail.value
				this.jhrqGH = e.detail.value

			},
			getDateGH(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},

			// bindPickerChange: function(e) {
			// 	//console.log('picker发送选择改变,携带值为', e.detail.value)
			// 	this.index = e.detail.value
			// 	this.xmmc = this.array[e.detail.value]
			// },
			//付款类别
			fkfsbindPickerChange: function(e) {

				this.fkfsindex = e.detail.value
				this.fkfs = this.fkfsList[e.detail.value].value
			},
			xgxmbindPickerClick(e) {
				console.log(e)
				this.xmmctcXS = true
			},
			//相关项目
			xgxmbindPickerChange: function(e) {

				this.xgxmindex = e.detail.value
				this.xgxm = this.xgxmList[e.detail.value].projectCode
				//选项目的时候把客户带入
				for (var i = 0; i < this.khList.length; i++) {
					if (this.khList[i].customerName == this.xgxmList[e.detail.value].customerName) {
						this.khindex = i
						this.kh = this.khList[i].customerId
						console.log(this.khindex, this.kh)
						return false;
					}
				}


			},
			//客户信息
			khbindPickerChange: function(e) {
				console.log('picker发送选择改变,携带值为', e.detail.value)
				this.khindex = e.detail.value
				this.kh = this.khList[e.detail.value].customerId
				console.log(this.khindex, this.kh)
			},
			//供应商
			gyslbbindPickerChange: function(e) {

				this.gyslbindex = e.detail.value
				this.gyslb = this.gyslbList[e.detail.value].value
				this.skdw = this.gyslbList[e.detail.value].supplierName
				this.khyh = this.gyslbList[e.detail.value].depositBank
				this.yhzh = this.gyslbList[e.detail.value].bankAccount
			},
			//发票类型
			fplxbindPickerChange: function(e) {
				//console.log('picker发送选择改变,携带值为', e.detail.value)
				this.fplxindex = e.detail.value
				this.fplx = this.fplxList[e.detail.value].value
			},
			//产品
			cpqkbindPickerChange: function(e) {
				//console.log('picker发送选择改变,携带值为', e.detail.value)
				this.cpqkindex = e.detail.value
				this.cpqk = e.detail.value + Number(1)
				console.log(this.cpqk)
			},
			//票据
			pjqkbindPickerChange: function(e) {
				console.log('picker发送选择改变,携带值为', e.detail.value)
				this.pjqkindex = e.detail.value
				this.pjqk = e.detail.value + Number(1)
			},
			//
			ztbindPickerChange: function(e) {
				//console.log('picker发送选择改变,携带值为', e.detail.value)
				this.ztindex = e.detail.value
				this.zt = this.xmztList[e.detail.value].value
				//this.ztarray[e.detail.value]
			},
			//提交
			tijiaoClick() {
				var that = this;
				if (that.djr == '') {
					uni.showToast({
						icon: 'none',
						title: '请选择优先级'
					})
					return false;
				}
				if (that.bxlb == '') {
					uni.showToast({
						icon: 'none',
						title: '请选择支付类别'
					})
					return false;
				}
				if (that.kh == '') {
					uni.showToast({
						icon: 'none',
						title: '请选择客户信息'
					})
					return false;
				}
				if (that.bxlbindex == 0 || that.bxlbindex == 2) {
					if (that.xgxm == '') {
						uni.showToast({
							icon: 'none',
							title: '请选择项目名称'
						})
						return false;
					}

				}
				if (that.gyslb == '') {
					uni.showToast({
						icon: 'none',
						title: '请选择供应商'
					})
					return false;
				}
				if (that.fksm == '') {
					uni.showToast({
						icon: 'none',
						title: '请填写付款说明'
					})
					return false;
				}
				if (that.skdw == '') {
					uni.showToast({
						icon: 'none',
						title: '请填写收款单位'
					})
					return false;
				}
				if (that.khyh == '') {
					uni.showToast({
						icon: 'none',
						title: '请填写开户银行'
					})
					return false;
				}
				if (that.yhzh == '') {
					uni.showToast({
						icon: 'none',
						title: '请填写银行账号'
					})
					return false;
				}
				if (that.fkfs == '') {
					uni.showToast({
						icon: 'none',
						title: '请选择付款方式'
					})
					return false;
				}
				if (that.fplx == '') {
					uni.showToast({
						icon: 'none',
						title: '请选择发票类型'
					})
					return false;
				}
				if (that.bxzje == '') {
					console.log(that.bxzje)
					uni.showToast({
						icon: 'none',
						title: '请填写付款金额'
					})
					return false;
				}
				//优先级
				if (that.djr == '紧急') {
					var priority = 'priority01'
				} else if (that.djr == '普通') {
					var priority = 'priority02'
				} else if (that.djr == '较低') {
					var priority = 'priority03'
				}
				// 
				var bjUrl = ''
				if (that.itemList.length != 0) {
					bjUrl = '/ztoa/ztoaPayment/update'
				} else {
					bjUrl = '/ztoa/ztoaPayment/save'
				}
				console.log(bjUrl);

				uni.request({
					url: that.$Url + bjUrl, //接口地址
					// url: '/wapurl' + '', //接口地址
					header: {
						'content-type': "application/x-www-form-urlencoded",
						token: that.token
					},
					data: {
						uuid: that.uuid,
						customer: that.kh, //客户
						paymentCategory: that.bxlb, //支付类别
						paymentReason: that.fksm, //付款说明
						collectionOrg: that.skdw, //收款单位
						depositBank: that.khyh, //开户银行
						bankAccount: that.yhzh, //银行账户
						paymentWay: that.fkfs, //付款方式
						invoiceType: that.fplx, //发票类型
						account: that.bxzje, //总金额
						productInfo: that.cpqk, //产品情况
						notes: that.pjqk, //票据情况
						supplier: that.gyslb, //供应商
						priority: priority, //优先级
						project: that.xgxm, //相关项目
						projectName: that.xgxm, //相关项目
						//status: that.zt,
						filePath: JSON.stringify(that.wjDz), //附件
					},
					method: 'POST',
					sslVerify: false,
					success: function(res) {
						if (res.data.statusCode == 500 || res.data.statusCode == 400 ||
							res.data.statusCode == 300) {
							uni.showToast({
								title: '开小差啦,请稍后重试',
								icon: 'none'
							});
						} else {
							uni.showToast({
								title: '成功',
								icon: 'none'
							});
							uni.navigateBack()

						}
						if (res.statusCode == 401) {
							that.loginClick();
							return false;
						}

					},
					fail() {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
				})

			},
			tabClick(e) {
				var that = this;
				that.index = e.currentTarget.dataset.index
				console.log(that.index)
			},
			loginClick() {
				var that = this;
				var username = '';
				uni.getStorage({
					key: 'username',
					success(resusername) {
						console.log(resusername.data);
						username = resusername.data;
						var password = '';
						uni.getStorage({
							key: 'password',
							success(respassword) {
								console.log(respassword.data);
								password = respassword.data;
								if (password != '') {
									uni.request({
										url: that.$Url +
											'/system/jwtLogin', //接口地址
										// url: '/wapurl' + '/system/jwtLogin', //接口地址
										// header: {
										// 	'content-type': "application/x-www-form-urlencoded"
										// },
										data: {
											loginType: "app",
											code: '3490',
											userNameId: username,
											password: password,
										},
										method: 'POST',
										sslVerify: false,
										success: function(res) {
											console.log(res);
											//开小差啦,请稍后再试
											if (res.data.statusCode == 500 || res.data
												.statusCode == 400 ||
												res.data.statusCode == 300) {
												uni.showToast({
													title: '开小差啦,请稍后重试',
													icon: 'none'
												});
												// return false;
											} else if (res.data.statusCode == 200) {
												//存
												//token
												uni.setStorage({
													key: 'token',
													data: res.data.message,
													success: function() {}
												})
											}

										}
									})
								}
							}
						})
					}
				})
			}
		},
	}
</script>

<style>
	page {}

	.content {
		width: 92%;
		margin: 0 auto;
	}

	.li {
		border-bottom: 1px solid #CCCCCC;
		overflow: hidden;
		line-height: 55px;
		font-weight: 400;
	}

	page {
		padding-bottom: 70px;
		background: #F9F9F9;
		font-size: 14px;
	}

	input::placeholder {
		color: rgba(0, 0, 0, 0.4);
	}

	textarea::placeholder {
		color: rgba(0, 0, 0, 0.6);
	}

	.tpimg {
		overflow: hidden;
	}

	.tpimg image {
		float: left;
		margin-right: 1.5%;
		/*padding-bottom: 10px;*/
	}

	.tpimg image:nth-child(3) {
		margin-right: 0
	}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值