zouling 1 vuosi sitten
vanhempi
commit
5e97d468a0
1 muutettua tiedostoa jossa 73 lisäystä ja 74 poistoa
  1. 73 74
      work/pages/prove/addqy.vue

+ 73 - 74
work/pages/prove/addqy.vue

@@ -5,7 +5,8 @@
 			<view v-for="(ite,idx) in qylist" :key="idx" class="mt24">
 				<view class="flexcc mb20">
 					<view class="carbox" @click="getaddImage(idx)">
-						<image :src="cardq" class="img"></image>
+						<image :src="baseUrl+ite.imageUrl" v-if="ite.imageUrl" class="img"></image>
+						<image :src="cardq" v-else class="img"></image>
 						<view class="tit">营业执照</view>
 					</view>
 				</view>
@@ -61,7 +62,7 @@
 			<view class="rzbtns bgb" @click="getAddQyFn">
 				<image :src="addqy"></image>添加企业
 			</view>
-			<view class="rzbtns bga" @click="getNext">提交</view>
+			<view class="rzbtns bga" @click="getSubmit">提交</view>
 		</view>
 
 	</view>
@@ -71,7 +72,8 @@
 	import config from '@/config'
 	const baseUrl = config.baseUrl
 	import {uploadmore} from '@/utils/common.js'
-	import {getOcrBusinessLicense} from "@/api/mine/card.js"
+	import { getToken } from '@/utils/auth'
+	import {getOcrBusinessLicense,getEnterpriseAdd} from "@/api/mine/card.js"
 	import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
 	export default {
 		components: {},
@@ -85,9 +87,12 @@
 
 				},
 				zheList:[{zheflag:true}],
+				idCard:"34282419730618003X",
+				realName:"admin",
+				baseUrl:'',
 				qylist: [{
-					// "idCard":"",//身份证号码
-					 // "realName":"",//真实姓名
+					"idCard":"",//身份证号码
+					"realName":"",//真实姓名
 					 "creditCode":"",//统一社会信用代码
 					"enterpriseName":"",//企业名称
 					"enterpriseType":"",//企业类型
@@ -97,16 +102,17 @@
 					"establishData":"",//成立日期
 					"businessTerm":"",//营业期限
 					"businessScope":"",//经营范围
+					"imageUrl":'',//营业执照URL
 				}],
 				
 			}
 		},
+		onLoad() {
+			this.baseUrl=baseUrl
+		},
 		methods: {
 			checkPermi,
 			checkRole,
-			getNext() {
-				this.$tab.navigateTo("/work/pages/prove/zctype")
-			},
 			getZheFn(idx){
 				this.zheList[idx].zheflag=!this.zheList[idx].zheflag
 			},
@@ -123,6 +129,7 @@
 					"establishData":"",
 					"businessTerm":"",
 					"businessScope":"",
+					"imageUrl":'',
 				}
 				this.qylist.push(obj);
 				var zheobj={zheflag:true}
@@ -147,24 +154,7 @@
 			},
 			getaddImage(idx){
 				let that = this;
-				var rs=['D:\\zhizhao.jpg']
-				if(rs&&rs.length>0){
-					var obj={
-						// url:baseUrl+rs.join(',')
-						url:rs.join(','),
-						idx:idx
-					}
-					that.getOcrBusinessLicense(obj)
-				}
-				return
-				let file =[],count=9
-				// if(e=='zj'){
-				// 	file = that.zjfile;
-				// 	count=9
-				// }else{
-				// 	file = that.mjfile;
-				// 	count=9
-				// }
+				let file =[],count=1;
 				uni.chooseImage({
 					count: 1,
 					success:function(res){
@@ -180,8 +170,10 @@
 							var fuwufile = [];
 							uploadmore('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
 								if(rs&&rs.length>0){
+									var res=['D:\\zhizhao.jpg']
 									var obj={
-										url:baseUrl+rs.join(','),
+										url:rs.join(','),
+										urls:res.join(','),
 										idx:idx
 									}
 									that.getOcrBusinessLicense(obj)
@@ -204,77 +196,84 @@
 				// 	'establishData': "2020年02月24日",
 				// 	'legalName': "江瑾",
 				// 	'registeredCapital': "6000万元",
+				// 	"imageUrl":'123',
+				// 	"idCard":'123',
+				// 	"realName":'123',
 				// }
 				// that.qylist.splice(idx,1,obj)
 				// return
 				var params={
-					image:obj.url,
+					// image:baseUrl+obj.url,
+					image:obj.urls,
 					idCardSide:obj.type
 				}
 				getOcrBusinessLicense(params).then(res=>{
 					if(res.code==200){
-						that.qylist.splice(idx,1,res.data)
+						var params=JSON.parse(JSON.stringify(res.data))
+						params.imageUrl=obj.url
+						params.idCard=that.idCard
+						params.realName=that.realName
+						that.qylist.splice(idx,1,params);
 					}
 				})
 			},
 			getSubmit() {
 				var that = this;
-				this.$refs.form.validate().then(res => {
-					var params = JSON.parse(JSON.stringify(this.datainfob))
-					var list=this.classlist;
-					var newArr = []
-					var a=0;
-					Object.keys(list).some((key) => {
-						if(!list[key].studentName){
-							a=1;
-							this.$toast("请输入学生姓名" )
-							return
-						}else if(!list[key].studentNumber){
-							a=1;
-							this.$toast("请输入学生身份证号" )
-							return	
-						}else if (list[key].schoolName && list[key].className) {
-							let _IDRe18 =
-								/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
-							let _IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/
-							// 校验身份证:
-							if (_IDRe18.test(list[key].studentNumber) || _IDre15.test(list[key].studentNumber)) {
-								newArr.push(list[key])
+				// that.$toast("添加企业成功")
+				// setTimeout(function(){
+				// 	if (getToken()) {
+				// 		uni.$emit('qyRefresh')
+				// 		uni.navigateBack({
+				// 			delta:1
+				// 		})
+				// 	}else{
+				// 		that.$tab.reLaunch('/pages/login')
+				// 	}
+				// },1200)
+				// return
+				var qylist = JSON.parse(JSON.stringify(this.qylist))
+				var newArr = [],params=[];
+				qylist.forEach((item, idx) => {
+					if (item.imageUrl) {
+						newArr.push(item)
+					}
+				})
+				if (newArr.length < 1) {
+					uni.showToast({
+						title: '请上传营业执照',
+						icon: "none"
+					})
+					return
+				} else {
+					params = JSON.parse(JSON.stringify(newArr))
+				}
+				// 判断是否有值
+				getEnterpriseAdd(params).then(res=>{
+					if(res.code==200){
+						that.$toast("添加企业成功")
+						setTimeout(function(){
+							if (getToken()) {
+								uni.$emit('qyRefresh')
+								uni.navigateBack({
+									delta:1
+								})
 							}else{
-								a=1;
-								this.$toast('请输入学生'+ list[key].studentName + "正确身份证号")
-								return
+								that.$tab.reLaunch('/pages/login')
 							}
-						} else if (list[key].schoolName && !list[key].className) {
-							a=1;
-							this.$toast("请选择" + list[key].schoolName + "的班级")
-							return
-						} else if(!list[key].schoolName){
-							a=1;
-							this.$toast("请选择学校")
-							return
-						}
-					})
-					if(a==1){
-						return
+						},1200)
 					}
-					params.registerParentsStudentList = JSON.parse(JSON.stringify(newArr))
-					this.$emit('getparentsregFn',params)
-					
-			
-			
-					// this.$tab.navigateTo(`/mine/pages/mine/success`)
 				})
-			
 			},
 		}
 	}
 </script>
 
-<style lang="scss" scoped>
+<style>
 page{
 	background:#ffffff;
-}
+}	
+</style>
+<style lang="scss" scoped>
 .rzbox /deep/ .uni-forms-item{min-height: 116rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:22rpx 0;}
 .rzbox /deep/ .uni-forms-item__label{font-weight: bold;font-size: 30rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
 .rzbox /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 30rpx;color: #222327;}