소스 검색

修改粮商认证上传图片

wangchao 3 년 전
부모
커밋
284b785373
4개의 변경된 파일554개의 추가작업 그리고 434개의 파일을 삭제
  1. 2 1
      pageD/identity/companyIdentity.vue
  2. 403 307
      pageD/identity/companyIdentityEdit.vue
  3. 3 0
      pageD/identity/companyIdentityThree.vue
  4. 146 126
      pageD/identity/companyIdentityTwo.vue

+ 2 - 1
pageD/identity/companyIdentity.vue

@@ -37,7 +37,7 @@
 				<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
 					:size-type="['compressed']" @on-success="getImgUrl2" @on-error="onError" @on-remove="onRemove"
 					@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions2"
-					:custom="uploadCustom1" @on-progress="onProgress"></upload>
+					:custom="uploadCustom2" @on-progress="onProgress"></upload>
 			</view>
 			<view class="c-row b-b">
 				<text class="tit">姓名</text>
@@ -78,6 +78,7 @@
 				imgUrls: [],
 				uploadCustom: true,
 				uploadCustom1: true,
+				uploadCustom2:true,
 				uploadOptions: {
 					"text": "上传营业执照",
 					"bgc": ""

+ 403 - 307
pageD/identity/companyIdentityEdit.vue

@@ -1,257 +1,346 @@
 <template>
 	<view class="center">
-		<view>	
+		<view>
 			<text @click='consent' v-bind:class="switchs1">公司</text>
-			<text  @click='consent' v-bind:class="switchs2">个人</text>
+			<text @click='consent' v-bind:class="switchs2">个人</text>
 		</view>
 		<view v-if="consentStatus == true">
-			<view>
-				<view style="margin: 0 auto;" v-if="license1 != ''" @click="license">
-					<image v-bind:src = "license1" class="picture"></image>
-				</view>
-			</view>
-			
+			<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+				:size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
+				@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions"
+				:custom="uploadCustom" @on-progress="onProgress"></upload>
 			<view class="personalcss">
-			<view class="c-row b-b">
-				<text class="tit">公司名称</text>
-				<view class="con-list">
-					<input placeholder="请填写公司名称" name="input" v-model="deptList.compName"></input>
+				<view class="c-row b-b">
+					<text class="tit">公司名称</text>
+					<view class="con-list">
+						<input placeholder="请填写公司名称" name="input" v-model="deptList.compName"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row ">
-				<text class="tit">纳税人识别号</text>
-				<view class="con-list">
-				<input placeholder="请填写纳税人识别号" name="input" v-model="deptList.payTaxesCard"></input>
+				<view class="c-row ">
+					<text class="tit">纳税人识别号</text>
+					<view class="con-list">
+						<input placeholder="请填写纳税人识别号" name="input" v-model="deptList.payTaxesCard"></input>
+					</view>
 				</view>
 			</view>
-			</view>
-			
+
 			<view>
-			
+
 				<view style="margin: 0 auto;" v-if="idup != ''" @click="idUp">
-					<image v-bind:src = "idup" class="picture"></image>
+					<image v-bind:src="idup" class="picture"></image>
 				</view>
-		
+
 				<view style="margin: 0 auto;" v-if="idlow != ''" @click="idLow">
-					<image v-bind:src = "idlow" class="picture"></image>
+					<image v-bind:src="idlow" class="picture"></image>
 				</view>
 			</view>
 			<view class="personalcss">
-			<view class="c-row b-b">
-				<text class="tit">姓名</text>
-				<view class="con-list">
-					<input placeholder="请填写姓名" name="input" v-model="deptList.customerName"></input>
+				<view class="c-row b-b">
+					<text class="tit">姓名</text>
+					<view class="con-list">
+						<input placeholder="请填写姓名" name="input" v-model="deptList.customerName"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row ">
-				<text class="tit">身份证号</text>
-				<view class="con-list">
-					<input placeholder="请填写身份证号" name="input"
-						v-model="deptList.customerNumberCard"></input>
+				<view class="c-row ">
+					<text class="tit">身份证号</text>
+					<view class="con-list">
+						<input placeholder="请填写身份证号" name="input" v-model="deptList.customerNumberCard"></input>
+					</view>
 				</view>
 			</view>
-			</view>
 			<view>
-		
-				<view style="margin: 0 auto;" v-if="bank1 != ''"  @click="bankUp()">
-					<image v-bind:src = "bank1" class="picture"></image>
+
+				<view style="margin: 0 auto;" v-if="bank1 != ''" @click="bankUp()">
+					<image v-bind:src="bank1" class="picture"></image>
 				</view>
 
 				<view style="margin: 0 auto;" v-if="bank2 != ''" @click="bankLow()">
-					<image v-bind:src = "bank2" class="picture"></image>
+					<image v-bind:src="bank2" class="picture"></image>
 				</view>
 			</view>
 			<view class="personalcss">
-			<view class="c-row b-b">
-				<text class="tit">银行卡号</text>
-				<view class="con-list">
-					<input placeholder="请填写银行卡号" name="input" v-model="deptList.bankCard"></input>
+				<view class="c-row b-b">
+					<text class="tit">银行卡号</text>
+					<view class="con-list">
+						<input placeholder="请填写银行卡号" name="input" v-model="deptList.bankCard"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">开户行</text>
-				<view class="con-list">
-				<input placeholder="请填写开户行" name="input" v-model="deptList.bankDeposit"></input>
+				<view class="c-row b-b">
+					<text class="tit">开户行</text>
+					<view class="con-list">
+						<input placeholder="请填写开户行" name="input" v-model="deptList.bankDeposit"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">开户支行</text>
-				<view class="con-list">
-				<input placeholder="请填写开户支行" name="input"
-					v-model="deptList.bankDepositBranch"></input>
+				<view class="c-row b-b">
+					<text class="tit">开户支行</text>
+					<view class="con-list">
+						<input placeholder="请填写开户支行" name="input" v-model="deptList.bankDepositBranch"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">手机号</text>
-				<view class="con-list">
+				<view class="c-row b-b">
+					<text class="tit">手机号</text>
+					<view class="con-list">
 						<input placeholder="请填写手机号" @input='phoneinput' v-model="deptList.customerPhone"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row ">
-				<text class="tit">公司地址</text>
-				<view class="con-list">
-					<input placeholder="请填写公司地址" name="input" v-model="deptList.compAddress"></input>
+				<view class="c-row ">
+					<text class="tit">公司地址</text>
+					<view class="con-list">
+						<input placeholder="请填写公司地址" name="input" v-model="deptList.compAddress"></input>
+					</view>
 				</view>
 			</view>
 		</view>
-		</view>
 		<view v-else>
 			<view>
-				<view style="margin: 0 auto;" v-if="idup != ''" @click="idUp">
-					<image v-bind:src = "idup" class="picture"></image>
-				</view>
-						
-				<view style="margin: 0 auto;" v-if="idlow != ''" @click="idLow">
-					<image v-bind:src = "idlow" class="picture"></image>
-				</view>
+				<!-- 个人身份证正面 -->
+				<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+					:size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError" @on-remove="onRemove"
+					@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
+					:custom="uploadCustom1" @on-progress="onProgress"></upload>
+				<!-- 个人身份证反面 -->
+				<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+					:size-type="['compressed']" @on-success="getImgUrl2" @on-error="onError" @on-remove="onRemove"
+					@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions2"
+					:custom="uploadCustom2" @on-progress="onProgress"></upload>
 			</view>
 			<view class="personalcss">
-			<view class="c-row b-b">
-				<text class="tit">姓名</text>
-				<view class="con-list">
-					<input placeholder="请填写姓名" name="input" v-model="deptList.customerName"></input>
+				<view class="c-row b-b">
+					<text class="tit">姓名</text>
+					<view class="con-list">
+						<input placeholder="请填写姓名" name="input" v-model="deptList.customerName"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">身份证号</text>
-				<view class="con-list">
-					<input placeholder="请填写身份证号" name="input"
-						v-model="deptList.customerNumberCard"></input>
+				<view class="c-row b-b">
+					<text class="tit">身份证号</text>
+					<view class="con-list">
+						<input placeholder="请填写身份证号" name="input" v-model="deptList.customerNumberCard"></input>
+					</view>
 				</view>
 			</view>
-			</view>
 			<view>
-				<view style="margin: 0 auto;" v-if="bank1 != ''"  @click="bankUp()">
-					<image v-bind:src = "bank1" class="picture"></image>
-				</view>
-				
-				<view style="margin: 0 auto;" v-if="bank2 != ''" @click="bankLow()">
-					<image v-bind:src = "bank2" class="picture"></image>
-				</view>
+				<!-- 上传银行卡正面 -->
+				<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+					:size-type="['compressed']" @on-success="getImgUrl3" @on-error="onError" @on-remove="onRemove"
+					@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions3"
+					:custom="uploadCustom3" @on-progress="onProgress"></upload>
+				<!-- 上传银行卡反面 -->
+				<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+					:size-type="['compressed']" @on-success="getImgUrl4" @on-error="onError" @on-remove="onRemove"
+					@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions4"
+					:custom="uploadCustom4" @on-progress="onProgress"></upload>
 			</view>
 			<view class="personalcss">
-			<view class="c-row b-b">
-				<text class="tit">银行卡号</text>
-				<view class="con-list">
-					<input placeholder="请填写银行卡号" name="input" v-model="deptList.bankCard"></input>
+				<view class="c-row b-b">
+					<text class="tit">银行卡号</text>
+					<view class="con-list">
+						<input placeholder="请填写银行卡号" name="input" v-model="deptList.bankCard"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">开户行</text>
-				<view class="con-list">
-					<input placeholder="请填写开户行" name="input" v-model="deptList.bankDeposit"></input>
+				<view class="c-row b-b">
+					<text class="tit">开户行</text>
+					<view class="con-list">
+						<input placeholder="请填写开户行" name="input" v-model="deptList.bankDeposit"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">开户支行</text>
-				<view class="con-list">
-					<input placeholder="请填写开户支行" name="input"
-						v-model="deptList.bankDepositBranch"></input>
+				<view class="c-row b-b">
+					<text class="tit">开户支行</text>
+					<view class="con-list">
+						<input placeholder="请填写开户支行" name="input" v-model="deptList.bankDepositBranch"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">收款人姓名</text>
-				<view class="con-list">
-					<input placeholder="请填写收款人姓名" name="input" v-model="deptList.payeeName"></input>
+				<view class="c-row b-b">
+					<text class="tit">收款人姓名</text>
+					<view class="con-list">
+						<input placeholder="请填写收款人姓名" name="input" v-model="deptList.payeeName"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row">
-				<text class="tit">收款人身份证号</text>
-				<view class="con-list">
-					<input placeholder="请填写收款身份证号" name="input"
-						v-model="deptList.payeeNumberCard"></input>
+				<view class="c-row">
+					<text class="tit">收款人身份证号</text>
+					<view class="con-list">
+						<input placeholder="请填写收款身份证号" name="input" v-model="deptList.payeeNumberCard"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row b-b">
-				<text class="tit">手机号</text>
-				<view class="con-list">
-				<input placeholder="请填写手机号" @input='phoneinput' v-model="deptList.customerPhone"></input>
+				<view class="c-row b-b">
+					<text class="tit">手机号</text>
+					<view class="con-list">
+						<input placeholder="请填写手机号" @input='phoneinput' v-model="deptList.customerPhone"></input>
+					</view>
 				</view>
-			</view>
-			<view class="c-row ">
-				<text class="tit">联系地址</text>
-				<view class="con-list">
-					<input placeholder="请填写联系地址" name="input" v-model="deptList.compAddress"></input>
+				<view class="c-row ">
+					<text class="tit">联系地址</text>
+					<view class="con-list">
+						<input placeholder="请填写联系地址" name="input" v-model="deptList.compAddress"></input>
+					</view>
 				</view>
+
 			</view>
-		
 		</view>
-</view>
-			<button class="btn btns" @click="commitEdit">修改</button>
+		<button class="btn btns" @click="commitEdit">修改</button>
 
 	</view>
 </template>
 
 <script>
+	import upload from '@/components/upload.vue';
 	import {
-	    mapState 
+		mapState
 	} from 'vuex';
 	export default {
 		name: "buy",
 		data() {
 			return {
+
 				radios: 2,
-				deptList:{
-					compName:"",
-					payTaxesCard:"",
+				action: this.$uploadUrl,
+				maxSize: 5 * 1024 * 1024, //限制文件大小 2M
+				btnLoading: false, //防止重复点击
+				isAdd: true,
+				imgUrls: [],
+				uploadCustom: true,
+				uploadCustom1: true,
+				uploadCustom2: true,
+				uploadCustom3: true,
+				uploadCustom4: true,
+				uploadOptions: {
+					"text": "上传营业执照",
+					"bgc": ""
+				},
+				uploadOptions1: {
+					"text": "上传身份证头像页",
+					"bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identityup%282%29.png"
+				},
+				uploadOptions2: {
+					"text": "上传身份证国徽页",
+					"bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identitylow%282%29.png"
+				},
+				uploadOptions3: {
+					"text": "上传银行卡正面",
+					"bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/bankup%282%29.png"
+				},
+				uploadOptions4: {
+					"text": "上传银行卡反面",
+					"bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/banklow%282%29.png"
+				},
+				deptList: {
+					compName: "",
+					payTaxesCard: "",
 				},
-				consentStatus:true,
-				consentStatus1:false,
-				parameter:{},
-				businessman:{},
-				id:[],
-				idup:"",
-				idlow:"",
-				license1:"",
-				bank1:"",
-				bank2:"",
-				bankid:[],
-				payeeAddress:[],
-				commitEdits:{},
-				switchs1:"switchs1",
-				switchs2:"switchs2",
+				consentStatus: true,
+				consentStatus1: false,
+				parameter: {},
+				businessman: {},
+				id: [],
+				idup: "",
+				idlow: "",
+				license1: "",
+				bank1: "",
+				bank2: "",
+				bankid: [],
+				payeeAddress: [],
+				commitEdits: {},
+				switchs1: "switchs1",
+				switchs2: "switchs2",
 			};
 		},
 		onLoad(option) {
 			this.parameter.id = option.id,
-			this.getList()
+				this.getList()
 		},
 		computed: {
-			...mapState(['hasLogin','userInfo'])
+			...mapState(['hasLogin', 'userInfo'])
 		},
 		methods: {
-			commitEdit(item){
-				console.log(this.deptList.compName,"公司名称")
+			filterFileType(index, lists) {
+				if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
+					lists.splice(index, 1);
+					// 当前文件不支持
+					uni.showModal({
+						title: '暂不支持当前图片类型',
+						showCancel: false
+					});
+				} else {
+					this.isAdd = false;
+				}
+			},
+			onError(error) {
+				alert(error)
+				console.log('------------error-----------')
+				console.log(error)
+			},
+			onProgress(e) {
+				console.log(e)
+			},
+			onRemove(index) {
+				this.imgUrls.splice(index, 1);
+			},
+			getImgUrl(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				this.deptList.businessLicenseAddressUrl = res
+				this.license1 = res
+
+			},
+			getImgUrl1(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				that.id[0] = res
+				that.idup = res
+
+			},
+			getImgUrl2(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				that.id[1] = res
+				that.idlow = res
+
+			},
+			getImgUrl3(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				that.bankid[0] = res
+				that.bank1 = res
+
+			},
+			getImgUrl4(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				that.bankid[1] = res
+				that.bank2 = res
+
+			},
+			commitEdit(item) {
+				console.log(this.deptList.compName, "公司名称")
 				this.deptList.commonId = this.userInfo.id
 				this.deptList.cardAddressUrl = this.id.toString()
 				this.deptList.payeeAddressUrl = this.bankid.toString()
-				if(this.consentStatus1 == true){
+				if (this.consentStatus1 == true) {
 					this.deptList.customerTypeFlag = "个人"
-				}else if(this.consentStatus == true){
+				} else if (this.consentStatus == true) {
 					this.deptList.customerTypeFlag = "企业"
 				}
 				// console.log(this.deptList,"编辑对象")
-				this.$api.doRequest('post', '/identityAuthenticationInfo/api/editIdentityAuthenticationInfo', this.deptList, 'application/json;charset=UTF-8').then(res => {
+				this.$api.doRequest('post', '/identityAuthenticationInfo/api/editIdentityAuthenticationInfo', this
+						.deptList, 'application/json;charset=UTF-8').then(res => {
 						console.log("成功连接")
 						if (!this.deptList.goodsName) {
 							this.$api.msg('修改成功!')
-							
+
 							return
 						}
 						uni.navigateTo({
 							url: `/pages/attestation/index`
 						})
-					
+
 					})
 					.catch(res => {
-						if(res.errmsg){
+						if (res.errmsg) {
 							uni.showToast({
 								title: res.errmsg,
 								icon: 'none',
 								duration: 2000
 							})
-						}
-						else{
+						} else {
 							uni.showToast({
 								title: "系统异常,请联系管理员",
 								icon: 'none',
@@ -259,163 +348,163 @@
 							})
 						}
 					});
-				
-				
-				},
-				license() {
-					var that = this
-					uni.chooseImage({
-						success: function(res) {
-							uni.uploadFile({
-								url: 'https://www.zthymaoyi.com/upload/admin',
-								filePath: res.tempFilePaths[0],
-								name: 'file',
-								success(res) {
-									var data = res.data
-									var strToObj = JSON.parse(data)			
-									that.deptList.businessLicenseAddressUrl = strToObj.url
-									that.license1 = strToObj.url
-								}
-							})
+
+
+			},
+			// license() {
+			// 	var that = this
+			// 	uni.chooseImage({
+			// 		success: function(res) {
+			// 			uni.uploadFile({
+			// 				url: 'https://www.zthymaoyi.com/upload/admin',
+			// 				filePath: res.tempFilePaths[0],
+			// 				name: 'file',
+			// 				success(res) {
+			// 					var data = res.data
+			// 					var strToObj = JSON.parse(data)			
+			// 					that.deptList.businessLicenseAddressUrl = strToObj.url
+			// 					that.license1 = strToObj.url
+			// 				}
+			// 			})
+			// 		}
+			// 	})
+			// },
+			// idUp() {
+			// 	var that = this
+			// 	uni.chooseImage({
+			// 		success: function(res) {
+			// 			uni.uploadFile({
+			// 				url: 'https://www.zthymaoyi.com/upload/admin',
+			// 				filePath: res.tempFilePaths[0],
+			// 				name: 'file',
+			// 				success(res) {
+			// 					var data = res.data
+			// 					var strToObj = JSON.parse(data)
+			// 					that.id[0] = strToObj.url
+			// 					that.idup = strToObj.url
+			// 				}
+			// 			})
+			// 		}
+			// 	})
+			// },
+			// idLow() {
+			// 	var that = this
+			// 	uni.chooseImage({
+			// 		success: function(res) {
+			// 			uni.uploadFile({
+			// 				url: 'https://www.zthymaoyi.com/upload/admin',
+			// 				filePath: res.tempFilePaths[0],
+			// 				name: 'file',
+			// 				success(res) {
+			// 					var data = res.data
+			// 					var strToObj = JSON.parse(data)
+			// 					that.id[1] = strToObj.url
+			// 					that.idlow = strToObj.url
+			// 				}
+			// 			})
+			// 		}
+			// 	})
+			// },
+			// bankUp() {
+			// 	var that = this
+			// 	uni.chooseImage({
+			// 		success: function(res) {
+			// 			uni.uploadFile({
+			// 				url: 'https://www.zthymaoyi.com/upload/admin',
+			// 				filePath: res.tempFilePaths[0],
+			// 				name: 'file',
+			// 				success(res) {
+			// 					var data = res.data
+			// 					var strToObj = JSON.parse(data)
+			// 					that.bankid[0] = strToObj.url
+			// 					that.bank1 = strToObj.url
+			// 				}
+			// 			})
+			// 		}
+			// 	})
+			// },
+			// bankLow() {
+			// 	var that = this
+			// 	uni.chooseImage({
+			// 		success: function(res) {
+			// 			uni.uploadFile({
+			// 				url: 'https://www.zthymaoyi.com/upload/admin',
+			// 				filePath: res.tempFilePaths[0],
+			// 				name: 'file',
+			// 				success(res) {
+			// 					var data = res.data
+			// 					var strToObj = JSON.parse(data)
+			// 					that.bankid[1] = strToObj.url
+			// 					that.bank2 = strToObj.url
+			// 				}
+			// 			})
+			// 		}
+			// 	})
+			// },
+			getList(ids) {
+				this.$api.doRequest('get', '/identityAuthenticationInfo/api/getIdentityAuthenticationInfo', this.parameter,
+						'application/json;charset=UTF-8').then(res => {
+						console.log("成功连接")
+
+						this.deptList = res.data.data
+						if (this.deptList.businessLicenseAddressUrl != "") {
+							this.license1 = this.deptList.businessLicenseAddressUrl
 						}
-					})
-				},
-				idUp(){
-					var that = this
-					uni.chooseImage({
-						success: function(res) {
-							uni.uploadFile({
-								url: 'https://www.zthymaoyi.com/upload/admin',
-								filePath: res.tempFilePaths[0],
-								name: 'file',
-								success(res) {
-									var data = res.data
-									var strToObj = JSON.parse(data)			
-									that.id[0] = strToObj.url
-									that.idup = strToObj.url
-								}
-							})
+						if (this.deptList.cardAddressUrl != "") {
+							this.id = this.deptList.cardAddressUrl.split(",")
+							this.idup = this.id[0]
+							this.idlow = this.id[1]
 						}
-					})
-				},
-				idLow(){
-					var that = this
-					uni.chooseImage({
-						success: function(res) {
-							uni.uploadFile({
-								url: 'https://www.zthymaoyi.com/upload/admin',
-								filePath: res.tempFilePaths[0],
-								name: 'file',
-								success(res) {
-									var data = res.data
-									var strToObj = JSON.parse(data)			
-									that.id[1] = strToObj.url
-									that.idlow = strToObj.url
-								}
-							})
+						if (this.deptList.payeeAddressUrl != "") {
+							this.payeeAddress = this.deptList.payeeAddressUrl.split(","),
+								this.bank1 = this.payeeAddress[0]
+							this.bank2 = this.payeeAddress[1]
 						}
-					})
-				},
-				bankUp(){
-					var that = this
-					uni.chooseImage({
-						success: function(res) {
-							uni.uploadFile({
-								url: 'https://www.zthymaoyi.com/upload/admin',
-								filePath: res.tempFilePaths[0],
-								name: 'file',
-								success(res) {
-									var data = res.data
-									var strToObj = JSON.parse(data)			
-									that.bankid[0] = strToObj.url
-									that.bank1 = strToObj.url
-								}
-							})
+						console.log(this.deptList.customerTypeFlag, "判断")
+						if (this.deptList.customerTypeFlag == 2) {
+							this.consentStatus = true
+							this.consentStatus1 = false
+							this.switchs1 = "switchs1"
+							this.switchs2 = "switchs2"
+						} else {
+							this.consentStatus = false
+							this.consentStatus1 = true
+							this.switchs1 = "switchs2"
+							this.switchs2 = "switchs1"
 						}
+
 					})
-				},
-				bankLow(){
-					var that = this
-					uni.chooseImage({
-						success: function(res) {
-							uni.uploadFile({
-								url: 'https://www.zthymaoyi.com/upload/admin',
-								filePath: res.tempFilePaths[0],
-								name: 'file',
-								success(res) {
-									var data = res.data
-									var strToObj = JSON.parse(data)			
-									that.bankid[1] = strToObj.url
-									that.bank2 = strToObj.url
-								}
+					.catch(res => {
+						if (res.errmsg) {
+							uni.showToast({
+								title: res.errmsg,
+								icon: 'none',
+								duration: 2000
+							})
+						} else {
+							uni.showToast({
+								title: "系统异常,请联系管理员",
+								icon: 'none',
+								duration: 2000
 							})
 						}
-					})
-				},
-			getList(ids) {		
-					this.$api.doRequest('get', '/identityAuthenticationInfo/api/getIdentityAuthenticationInfo', this.parameter, 'application/json;charset=UTF-8').then(res => {
-							console.log("成功连接")
-				
-							this.deptList = res.data.data
-							if(this.deptList.businessLicenseAddressUrl != ""){
-								this.license1 = this.deptList.businessLicenseAddressUrl
-							}
-							if(this.deptList.cardAddressUrl != ""){
-								this.id = this.deptList.cardAddressUrl.split(",")
-								this.idup = this.id[0]
-								this.idlow = this.id[1]
-							}
-							if(this.deptList.payeeAddressUrl != ""){
-								this.payeeAddress = this.deptList.payeeAddressUrl.split(","),
-							this.bank1 = this.payeeAddress[0]
-							this.bank2 = this.payeeAddress[1]
-							}
-							console.log(this.deptList.customerTypeFlag,"判断")
-							if(this.deptList.customerTypeFlag == 2){
-								this.consentStatus = true
-								this.consentStatus1 = false
-								this.switchs1 = "switchs1"
-								this.switchs2 = "switchs2"
-							}else{
-								this.consentStatus = false
-								this.consentStatus1 = true
-								this.switchs1 = "switchs2"
-								this.switchs2 = "switchs1"
-							}
-		
-						})
-						.catch(res => {
-							if(res.errmsg){
-								uni.showToast({
-									title: res.errmsg,
-									icon: 'none',
-									duration: 2000
-								})
-							}
-							else{
-								uni.showToast({
-									title: "系统异常,请联系管理员",
-									icon: 'none',
-									duration: 2000
-								})
-							}
-						});
+					});
 			},
-			consent(){
-				if(this.consentStatus == false && this.consentStatus1 == true){
+			consent() {
+				if (this.consentStatus == false && this.consentStatus1 == true) {
 					this.consentStatus = true
 					this.consentStatus1 = false
 					this.switchs1 = "switchs1"
 					this.switchs2 = "switchs2"
-				}else if(this.consentStatus == true && this.consentStatus1 == false){
+				} else if (this.consentStatus == true && this.consentStatus1 == false) {
 					this.consentStatus = false
 					this.consentStatus1 = true
 					this.switchs1 = "switchs2"
 					this.switchs2 = "switchs1"
 				}
-				
+
 			},
-			
+
 		}
 	}
 </script>
@@ -453,45 +542,52 @@
 		padding-right: 20rpx;
 		font-size: 14px;
 	}
-	.picture{
+
+	.picture {
 		width: 100%;
-		 height: 220px;
-		 text-align: center;
-		 margin-top: 10px;
+		height: 220px;
+		text-align: center;
+		margin-top: 10px;
 	}
-	.fujians{
+
+	.fujians {
 		margin: 0 auto;
 		background-color: #FFFFFF;
 		margin-top: 30px;
 		border-radius: 20px;
 		padding: 10px 10px;
 	}
-	.picturebiaoti{
+
+	.picturebiaoti {
 		font-size: 17px;
 		font-weight: 700;
 	}
-	.personalcss{
+
+	.personalcss {
 		background-color: #FFFFFF;
 		border-radius: 20px;
 		margin-top: 10px;
 	}
+
 	.btn {
 		margin-top: 10px;
 		background-color: #FFFFFF;
 		border-radius: 25px;
 		border: none;
 	}
-	
+
 	.btns {
 		background-color: #22C572;
 		color: white;
 	}
-	.switchs1{
+
+	.switchs1 {
 		font-size: 20px;
 		font-weight: 700;
 		margin-right: 16px;
 	}
-	.switchs2{
+
+	.switchs2 {
 		font-size: 20px;
 		margin-right: 16px;
 	}

+ 3 - 0
pageD/identity/companyIdentityThree.vue

@@ -569,4 +569,7 @@
 		top: -150px;
 		text-align: center;
 	}
+	.upload {
+		margin: 20rpx 0;
+	}
 </style>

+ 146 - 126
pageD/identity/companyIdentityTwo.vue

@@ -1,26 +1,16 @@
 <template>
 	<view class="center">
 		<view>
-			<view style="margin: 0 auto;height: 240px;" @click="idUp">
-				<image v-bind:src = "id1" class="picture"></image>
-				<view class="floats" v-if="certificates == true">
-					<image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
-					</image>
-					<view class="words">
-						上传身份证头像页
-					</view>
-				</view>
-			</view>
-			<view style="margin: 0 auto;height: 240px;" @click="idLow">
-				<image v-bind:src = "id2" class="picture"></image>
-				<view class="floats" v-if="certificatesTwo == true">
-					<image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
-					</image>
-					<view class="words">
-						上传身份证国徽页
-					</view>
-				</view>
-			</view>
+			<!-- 个人身份证正面 -->
+			<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+				:size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError" @on-remove="onRemove"
+				@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
+				:custom="uploadCustom1" @on-progress="onProgress"></upload>
+			<!-- 个人身份证反面 -->
+			<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
+				:size-type="['compressed']" @on-success="getImgUrl2" @on-error="onError" @on-remove="onRemove"
+				@on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions2"
+				:custom="uploadCustom1" @on-progress="onProgress"></upload>
 		</view>
 		<view class="c-row b-b">
 			<text class="tit">姓名</text>
@@ -35,40 +25,138 @@
 					v-model="identityAuthenticationInfo.customerNumberCard"></input>
 			</view>
 		</view>
-		 <button class="btns btn"  @click="jumpUrl">下一步</button>
+		<button class="btns btn" @click="jumpUrl">下一步</button>
 	</view>
 </template>
 
 <script>
+	import upload from '@/components/upload.vue';
 	import {
 		mapState
 	} from 'vuex';
 	export default {
-		name: "buy",
+		components: {
+			upload
+		},
 		data() {
 			return {
-				
-				id:[],
-				id1:"../../static/img/authentication/identityup(3).png",
-				id2:"../../static/img/authentication/identitylow(3).png",
-				identityImgs1:{},
-				identityAuthenticationInfo:{},
-				certificates:true,
-				certificatesTwo:true,
+				action: this.$uploadUrl,
+				maxSize: 5 * 1024 * 1024, //限制文件大小 2M
+				btnLoading: false, //防止重复点击
+				isAdd: true,
+				imgUrls: [],
+				uploadCustom1: true,
+				uploadCustom2: true,
+				uploadOptions1: {
+					"text": "上传身份证头像页",
+					"bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identityup%282%29.png"
+				},
+				uploadOptions2: {
+					"text": "上传身份证国徽页",
+					"bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identitylow%282%29.png"
+				},
+				id: [],
+				id1: "../../static/img/authentication/identityup(3).png",
+				id2: "../../static/img/authentication/identitylow(3).png",
+				identityImgs1: {},
+				identityAuthenticationInfo: {},
+				certificates: true,
+				certificatesTwo: true,
 			}
 		},
-		onLoad(options){
+		onLoad(options) {
 			this.identityAuthenticationInfo = JSON.parse(options.identityAuthenticationInfo)
 			console.log(this.identityAuthenticationInfo)
 		},
-		methods:{
-			jumpUrl(){
+		methods: {
+			filterFileType(index, lists) {
+				if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
+					lists.splice(index, 1);
+					// 当前文件不支持
+					uni.showModal({
+						title: '暂不支持当前图片类型',
+						showCancel: false
+					});
+				} else {
+					this.isAdd = false;
+				}
+			},
+			getImgUrl1(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				let that = this;
+				that.id[0] = res
+				that.id1 = res
+				that.certificates = false
+				that.identityImgs1.personImg = res
+				that.$api.doRequest('get', '/driverViewInfo/personShibie', that.identityImgs1).then(res => {
+					if (res.data.data.recPerson != null) {
+						if (res.data.data.recPerson != "") {
+							that.$set(that.identityAuthenticationInfo, 'customerName', res.data.data.recPerson)
+						}
+					}
+					if (res.data.data.recPersonNo != null) {
+						if (res.data.data.recPersonNo != "") {
+							that.$set(that.identityAuthenticationInfo, 'customerNumberCard', res.data.data
+								.recPersonNo)
+						}
+					}
+				}).catch(res => {
+					uni.showToast({
+						title: res.data.message,
+						icon: 'none',
+						duration: 2000
+					})
+				})
+			},
+			getImgUrl2(res) {
+				console.log(res)
+				console.log('------------res-----------')
+				let that = this;
+				that.id[1] = res
+				that.id2 = res
+				that.certificatesTwo = false
+				that.identityImgs1.personImg = res
+				that.$api.doRequest('get', '/driverViewInfo/personShibie', that.identityImgs1).then(res => {
+					if (res.data.data.recPerson != null) {
+						if (res.data.data.recPerson != "") {
+							that.$set(that.identityAuthenticationInfo, 'customerName', res.data.data.recPerson)
+						}
+
+					}
+					if (res.data.data.recPersonNo != null) {
+						if (res.data.data.recPersonNo != "") {
+							that.$set(that.identityAuthenticationInfo, 'customerNumberCard', res.data.data
+								.recPersonNo)
+						}
+
+					}
+				}).catch(res => {
+					uni.showToast({
+						title: res.data.message,
+						icon: 'none',
+						duration: 2000
+					})
+				})
+			},
+			onError(error) {
+				alert(error)
+				console.log('------------error-----------')
+				console.log(error)
+			},
+			onProgress(e) {
+				console.log(e)
+			},
+			onRemove(index) {
+				this.imgUrls.splice(index, 1);
+			},
+			jumpUrl() {
 				this.identityAuthenticationInfo.cardAddressUrl = this.id.toString()
-				if(this.id[0] == '' || this.id[0] == null){
+				if (this.id[0] == '' || this.id[0] == null) {
 					this.$api.msg('请上传身份证正面')
 					return
 				}
-				if(this.id[1] == '' || this.id[1] == null){
+				if (this.id[1] == '' || this.id[1] == null) {
 					this.$api.msg('请上传身份证反面')
 					return
 				}
@@ -76,14 +164,15 @@
 					this.$api.msg('姓名不能为空')
 					return
 				}
-				if (this.identityAuthenticationInfo.customerName.length < 2 || this.identityAuthenticationInfo.customerName.length > 10) {
+				if (this.identityAuthenticationInfo.customerName.length < 2 || this.identityAuthenticationInfo.customerName
+					.length > 10) {
 					this.$api.msg('姓名输入错误')
 					return
 				}
 				if (!this.identityAuthenticationInfo.customerNumberCard) {
 					this.$api.msg('身份证号不能为空')
 					return
-				}	
+				}
 				if (this.identityAuthenticationInfo.customerNumberCard.length != 18) {
 					this.$api.msg('身份证号输入错误')
 					return
@@ -93,84 +182,6 @@
 					url: `/pageD/identity/companyIdentityThree?identityAuthenticationInfo=` + model,
 				})
 			},
-			idUp(){
-				var that = this
-				uni.chooseImage({
-					success: function(res) {
-						uni.uploadFile({
-							url: 'https://www.zthymaoyi.com/upload/admin',
-							filePath: res.tempFilePaths[0],
-							name: 'file',
-							success(res) {
-								var data = res.data
-								var strToObj = JSON.parse(data)			
-								that.id[0] = strToObj.url
-								that.id1 = strToObj.url
-								that.certificates = false
-								that.identityImgs1.personImg = strToObj.url
-								that.$api.doRequest('get', '/driverViewInfo/personShibie', that.identityImgs1).then(res => {
-									if(res.data.data.recPerson != null){
-										if(res.data.data.recPerson != ""){
-										that.$set(that.identityAuthenticationInfo,'customerName',res.data.data.recPerson)
-										}
-									}
-									if(res.data.data.recPersonNo != null){
-										if(res.data.data.recPersonNo != ""){
-										that.$set(that.identityAuthenticationInfo,'customerNumberCard',res.data.data.recPersonNo)
-										}
-									}
-								}).catch(res => {
-									uni.showToast({
-										title: res.data.message,
-										icon: 'none',
-										duration: 2000
-									})
-								})
-							}
-						})
-					}
-				})
-			},
-			idLow(){
-				var that = this
-				uni.chooseImage({
-					success: function(res) {
-						uni.uploadFile({
-							url: 'https://www.zthymaoyi.com/upload/admin',
-							filePath: res.tempFilePaths[0],
-							name: 'file',
-							success(res) {
-								var data = res.data
-								var strToObj = JSON.parse(data)			
-								that.id[1] = strToObj.url
-								that.id2 = strToObj.url
-								that.certificatesTwo = false
-								that.identityImgs1.personImg = strToObj.url
-								that.$api.doRequest('get', '/driverViewInfo/personShibie', that.identityImgs1).then(res => {
-									if(res.data.data.recPerson != null){
-										if(res.data.data.recPerson != ""){
-											that.$set(that.identityAuthenticationInfo,'customerName',res.data.data.recPerson)
-										}
-										
-									}
-									if(res.data.data.recPersonNo != null){
-										if(res.data.data.recPersonNo != ""){
-											that.$set(that.identityAuthenticationInfo,'customerNumberCard',res.data.data.recPersonNo)
-										}
-										
-									}
-								}).catch(res => {
-									uni.showToast({
-										title: res.data.message,
-										icon: 'none',
-										duration: 2000
-									})
-								})
-							}
-						})
-					}
-				})
-			},
 		}
 	}
 </script>
@@ -180,6 +191,7 @@
 		padding: 10px 20px;
 		background-color: #F5F6FA;
 	}
+
 	.c-row {
 		display: -webkit-box;
 		display: -webkit-flex;
@@ -190,6 +202,7 @@
 		padding: 20rpx 30rpx;
 		position: relative;
 	}
+
 	.con-list {
 		-webkit-box-flex: 1;
 		-webkit-flex: 1;
@@ -219,20 +232,27 @@
 		background-color: #22C572;
 		color: white;
 	}
-	.picture{
+
+	.picture {
 		width: 100%;
-		 height: 220px;
-		 text-align: center;
-		 margin-top: 10px;
+		height: 220px;
+		text-align: center;
+		margin-top: 10px;
 	}
-	.words{
+
+	.words {
 		font-size: 18px;
 		font-weight: 600;
 		color: #617E8B;
-		}
-		.floats{
-			position: relative;
-			top: -150px;
-			text-align: center;
-		}
+	}
+
+	.floats {
+		position: relative;
+		top: -150px;
+		text-align: center;
+	}
+
+	.upload {
+		margin: 20rpx 0;
+	}
 </style>