enterprise.vue 19.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
<template>
	<view class="containers">
		<view class="noResident">
			<!-- 个人信息 -->
			<view class="noCardWarp">
				<view class="flex flex-direction">
					<view class="text-xl text-bold">
						个人信息
					</view>
					<view class="flex margin-top justify-between">
						<view class="cardWarp flex flex-direction" @click="upload(0,'fSfzrxy')">
							<view class="flex justify-center margin-bottom-xl" style="position: relative;">
                  <u-image v-if="picture[0]?picture[0].temp:''"  :src="picture[0].temp" width="180rpx" height="108rpx"
                           @click="previewPicture(picture[0].temp)"></u-image>
								<u-image v-else src="@/static/images/gas-icon/front.png" width="180rpx"
									height="108rpx"></u-image>
                <u-icon v-if="(!this.optionsInfo.fRzzt||this.optionsInfo.fRzzt ==''||this.optionsInfo.fRzzt == '待认证' || this.optionsInfo.fRzzt == '认证未通过') && picture[0]?picture[0].temp:''" @click="deleteImg(0)" style="position: absolute; top:-10px;right: 22px;" name="close-circle-fill" color="red" size="14"></u-icon>
							</view>
							<view class="cardBar">
								<view class="flex justify-center">
									<view class="requiredCss">*</view>
									<view class="cardBarText">上传身份证人像面</view>
								</view>
							</view>
						</view>
						<view class="cardWarp flex flex-direction" @click="upload(1,'fSfzghy')">
							<view class="flex justify-center margin-bottom-xl"  style="position: relative;">
								<u-image v-if="picture[1]?picture[1].temp:''"  :src="picture[1].temp" width="180rpx" height="108rpx"
									@click="previewPicture(picture[1].temp)"></u-image>
								<u-image v-else src="@/static/images/gas-icon/back.png" width="180rpx"
									height="108rpx"></u-image>
                <u-icon v-if="(!this.optionsInfo.fRzzt||this.optionsInfo.fRzzt ==''||this.optionsInfo.fRzzt == '待认证' || this.optionsInfo.fRzzt == '认证未通过') && picture[1]?picture[1].temp:''" @click="deleteImg(1)" style="position: absolute; top:-10px;right: 22px;" name="close-circle-fill" color="red" size="14"></u-icon>
              </view>
							<view class="cardBar">
								<view class="flex justify-center">
									<view class="requiredCss">*</view>
									<view class="cardBarText">上传身份证国徽面</view>
								</view>
							</view>
						</view>
					</view>
					<view class="flex margin-top-sm">
						<u-icon name="error-circle"></u-icon>
						<view class="text-gray margin-left-xs">
							以上传图片信息为准,请仔细核对您提交的信息
						</view>
					</view>
				</view>
			</view>
			<!-- 企业信息 -->
			<view class="noCardWarp">
				<view class="flex flex-direction">
					<view class="text-xl text-bold">
						企业信息
					</view>
					<view class="flex margin-top flex-direction">
						<view class="flex justify-between">
							<view class="cardWarp flex flex-direction" @click="upload(2,'fYyzz')">
								<view class="flex justify-center margin-bottom-xl" style="position: relative;">
                  <u-image  v-if="picture[2]?picture[2].temp:''"  :src="picture[2].temp" width="180rpx"
                            @click="previewPicture(picture[2].temp)" height="108rpx"></u-image>
									<u-image v-else  src="@/static/images/gas-icon/front.png" width="180rpx"
										height="108rpx"></u-image>
                  <u-icon v-if="(!this.optionsInfo.fRzzt||this.optionsInfo.fRzzt ==''||this.optionsInfo.fRzzt == '待认证' || this.optionsInfo.fRzzt == '认证未通过') &&picture[2]?picture[2].temp:''" @click="deleteImg(2)" style="position: absolute; top:-10px;right: 22px;" name="close-circle-fill" color="red" size="14"></u-icon>
                </view>
								<view class="cardBar">
									<view class="flex justify-center">
										<view class="requiredCss">*</view>
										<view class="cardBarText">上传营业执照</view>
									</view>
								</view>
							</view>
							<view class="cardWarp flex flex-direction" @click="upload(3,'fKhxkz')">
								<view class="flex justify-center margin-bottom-xl" style="position: relative;">
                  <u-image  v-if="picture[3]?picture[3].temp:''"  :src="picture[3].temp"  width="180rpx"
                            @click="previewPicture(picture[3].temp)" height="108rpx"></u-image>
									<u-image  v-else src="@/static/images/gas-icon/back.png" width="180rpx"
										height="108rpx"></u-image>
                  <u-icon v-if="(!this.optionsInfo.fRzzt||this.optionsInfo.fRzzt ==''||this.optionsInfo.fRzzt == '待认证' || this.optionsInfo.fRzzt == '认证未通过') &&picture[3]?picture[3].temp:''" @click="deleteImg(3)" style="position: absolute; top:-10px;right: 22px;" name="close-circle-fill" color="red" size="14"></u-icon>
                </view>
								<view class="cardBar">
									<view class="flex justify-center">
										<view class="requiredCss">*</view>
										<view class="cardBarText">上传开户许可证</view>
									</view>
								</view>
							</view>
						</view>
						<view class="flex justify-between margin-top">
							<view class="cardWarp flex flex-direction" @click="upload(4,'fFrsfzrxy')">
								<view class="flex justify-center margin-bottom-xl" style="position: relative;">
                  <u-image v-if="picture[4]?picture[4].temp:''" :src="picture[4].temp" width="180rpx" height="108rpx"
                           @click="previewPicture(picture[4].temp)"></u-image>
									<u-image v-else src="@/static/images/gas-icon/front.png" width="180rpx"
										height="108rpx"></u-image>
                  <u-icon v-if="(!this.optionsInfo.fRzzt||this.optionsInfo.fRzzt ==''||this.optionsInfo.fRzzt == '待认证' || this.optionsInfo.fRzzt == '认证未通过') &&picture[4]?picture[4].temp:''" @click="deleteImg(4)" style="position: absolute; top:-10px;right: 22px;" name="close-circle-fill" color="red" size="14"></u-icon>
                </view>
								<view class="cardBar">
									<view class="flex justify-center">
										<view class="requiredCss">*</view>
										<view class="cardBarText">上传法人身份证正面</view>
									</view>
								</view>
							</view>
							<view class="cardWarp flex flex-direction" @click="upload(5,'fFrsfzghy')">
								<view class="flex justify-center margin-bottom-xl" style="position: relative;">
                  <u-image v-if="picture[5]?picture[5].temp:''" :src="picture[5].temp" width="180rpx" height="108rpx"
                           @click="previewPicture(picture[5].temp)"></u-image>
									<u-image v-else src="@/static/images/gas-icon/back.png" width="180rpx"
										height="108rpx"></u-image>
                  <u-icon v-if="(!this.optionsInfo.fRzzt||this.optionsInfo.fRzzt ==''||this.optionsInfo.fRzzt == '待认证' || this.optionsInfo.fRzzt == '认证未通过') &&picture[5]?picture[5].temp:''" @click="deleteImg(5)" style="position: absolute; top:-10px;right: 22px;" name="close-circle-fill" color="red" size="14"></u-icon>
                </view>
								<view class="cardBar">
									<view class="flex justify-center">
										<view class="requiredCss">*</view>
										<view class="cardBarText">上传法人身份证反面</view>
									</view>
								</view>
							</view>
						</view>

					</view>
					<view class="flex margin-top-sm">
						<u-icon name="error-circle"></u-icon>
						<view class="text-gray margin-left-xs">
							以上传图片信息为准,请仔细核对您提交的信息
						</view>
					</view>
				</view>
			</view>
			<!-- 认证信息 -->
			<view class="noCardWarp">
				<view class="flex flex-direction">
					<view class="text-xl text-bold flex">
						认证信息<view class="text-grey">(必填)</view>
					</view>
					<u-form labelPosition="left" :model="enterpriseObj" :rules="rules" ref="uForm">
						<view class="flex justify-between">
							<u-form-item class="w50">
								<u-input placeholder="经营者姓名" :disabled="canEditBtn" disabledColor="#fff" v-model="enterpriseObj.name" border="none"></u-input>
							</u-form-item>
							<u-form-item class="w50">
								<u-input placeholder="经营者联系电话" :disabled="canEditBtn" disabledColor="#fff" v-model="enterpriseObj.phone" border="none"></u-input>
							</u-form-item>
						</view>
						<view class="flex justify-between">
							<u-form-item class="w50">
								<u-input placeholder="经营者性别"  disabledColor="#fff" v-model="enterpriseObj.sex" disabled
									border="none">
									<u-icon name="arrow-down" slot="suffix" @click="canEditBtn?'':selectPickCloums('sex')"></u-icon>
								</u-input>
							</u-form-item>
							<u-form-item class="w45">
								<u-input placeholder="经营者年龄" :disabled="canEditBtn" disabledColor="#fff" v-model="enterpriseObj.age" border="none"></u-input>
							</u-form-item>
						</view>
						<u-form-item>
							<u-input placeholder="经营者身份证号" :disabled="canEditBtn" disabledColor="#fff" v-model="enterpriseObj.idcard" border="none"></u-input>
						</u-form-item>
            <u-form-item>
              <u-input placeholder="有效期" :disabled="canEditBtn" disabledColor="#fff" v-model="enterpriseObj.termOfValidity" border="none">
                <u-icon name="calendar" slot="suffix" @click="canEditBtn?'':dateShow = true"></u-icon>
              </u-input>
            </u-form-item>
						<u-form-item>
							<u-input placeholder="工/商业名称(填工商已有注册名称)" disabledColor="#fff" :disabled="canEditBtn" v-model="enterpriseObj.industryAndCommerce"
								border="none">
							</u-input>
						</u-form-item>
						<u-form-item>
							<u-input placeholder="统一社会信用代码(纳税人识别号)" :disabled="canEditBtn" disabledColor="#fff" v-model="enterpriseObj.socialUnifiedCreditCode"
								border="none">
<!--								<view slot="suffix">清空</view>-->
							</u-input>
						</u-form-item>
            <u-form-item>
              <u-input placeholder="认证气站" v-model="enterpriseObj.fSsczmc"  disabledColor="#fff" disabled  border="none">
                <u-icon name="arrow-down" slot="suffix" @click="canEditBtn?'':selectPickCloums('rzqz')"></u-icon>
              </u-input>
            </u-form-item>
					</u-form>
				</view>
			</view>
		</view>
		<!-- 性别 -->
		<u-picker ref="Sex" :show="pickShow" @close="pickShow=false" closeOnClickOverlay :columns="columns"
			@cancel="pickShow=false" @confirm="sexConfirm"></u-picker>
    <!-- 有效期 -->
    <u-datetime-picker :show="dateShow" @close="dateShow=false" closeOnClickOverlay v-model="date" mode="date"
                       @cancel="dateShow=false" @confirm="dateConfirm"></u-datetime-picker>
	</view>
</template>

<script>
  import {
    mapState
  } from 'vuex';
  export default {
		props: {
      optionsInfo:{
        type:Object,
        default:{}
      }
		},
		components: {

		},
    computed: {
      // 使用 mapState 辅助函数将 Vuex state 中的 adsJd 和 adsWd 映射到当前组件的计算属性中
      ...mapState({
        adsJd: state => state.user.adsJd,
        adsWd: state => state.user.adsWd
      })
    },
    async mounted() {
      console.log(this.$store);
      // 如果未选择地址则获取当前定位
      if (!this.adsJd && !this.adsWd) {
        await this.getLocation();
      }
      console.log('打印是否出发这个事件',this.optionsInfo.fRzzt)
      if(this.optionsInfo.fRzzt == '已认证'||this.optionsInfo.fRzzt =='认证中' || this.optionsInfo.fRzzt == '认证未通过'){
        this.getRealNameDetail();
        this.canEditBtn = true;
        if(this.optionsInfo.fRzzt == '认证未通过'){
          this.canEditBtn = false;
        }
      }
      console.log('打印是否出阿飞this.addJd',this.adsJd,this.adsWd)
      await this.getStoreList();
    },
		watch: {},
		data() {
			return {
        pickShow: false,
        dateShow: false,
        canEditBtn:false,
        date: Number(new Date()),
				enterpriseObj: {
					name: "",
					phone: "",
					sex: "",
					age: "",
					idcard: "",
					industryAndCommerce: "",
					socialUnifiedCreditCode: "",
          termOfValidity:'',
          fSsczmc:'',
          fSsczID:'',
					front: [],
					back: [],
					yyzz: [],
					khxkz: [],
					frsfzzm: [],
					frsfzfm: [],
				},
        formData: {
          current: 1,
          size: -1,
          // jd: "114.347455", //PC无法定位调试使用
          // wd: "30.504396", //PC无法定位调试使用
          jd: "",
          wd: "",
        },
				rules: {},
				columns: [],
        sexColumns:[['男', '女']],
				picture: [],
        storeList:[],
        pickType:''
			}
		},
		onLoad(data) {

		},
		methods: {
      //获取审核详细信息
      async getRealNameDetail(){
        const reseult = await this.$api.realNameAuthApi.realNameDetailInfoPort(this.optionsInfo.id);
        const { value } = reseult;
        if(value.fSfzghy){
          let sfzghImg  = JSON.parse(value.fSfzghy);
          console.log('打印Result',sfzghImg);
          let sfzghImgUrl = await this.$getPhotoUrl(sfzghImg[0].response.fileId);
          this.$set(this.picture,1,{
            temp:sfzghImgUrl,
            fileId:sfzghImg[0].response.fileId,
            fileObj: JSON.stringify(sfzghImg)
          });
        }
        if(value.fSfzrxy){
          let sfzrxImg  = JSON.parse(value.fSfzrxy);
          let sfzrxImgUrl = await this.$getPhotoUrl(sfzrxImg[0].response.fileId);
          this.$set(this.picture,0,{
            temp:sfzrxImgUrl,
            fileId:sfzrxImg[0].response.fileId,
            fileObj: JSON.stringify(sfzrxImg)
          });
        }
        if(value.fYyzz){
          let yyzzImg  = JSON.parse(value.fYyzz);
          let yyzzImgUrl = await this.$getPhotoUrl(yyzzImg[0].response.fileId);
          this.$set(this.picture,2,{
            temp:yyzzImgUrl,
            fileId:yyzzImg[0].response.fileId,
            fileObj: JSON.stringify(yyzzImg)
          });
        }
        if(value.fKhxkz){
          let khxkzImg  = JSON.parse(value.fKhxkz);
          let khxkzImgUrl = await this.$getPhotoUrl(khxkzImg[0].response.fileId);
          this.$set(this.picture,3,{
            temp:khxkzImgUrl,
            fileId:khxkzImg[0].response.fileId,
            fileObj: JSON.stringify(khxkzImg)
          });
        }
        if(value.fFrsfzrxy){
          let frsfzrxImg  = JSON.parse(value.fFrsfzrxy);
          let frsfzrxImgUrl = await this.$getPhotoUrl(frsfzrxImg[0].response.fileId);
          this.$set(this.picture,4,{
            temp:frsfzrxImgUrl,
            fileId:frsfzrxImg[0].response.fileId,
            fileObj: JSON.stringify(frsfzrxImg)
          });
        }
        if(value.fFrsfzghy){
          let frsfzghImg  = JSON.parse(value.fFrsfzghy);
          let frsfzghImgUrl = await this.$getPhotoUrl(frsfzghImg[0].response.fileId);
          this.$set(this.picture,5,{
            temp:frsfzghImgUrl,
            fileId:frsfzghImg[0].response.fileId,
            fileObj: JSON.stringify(frsfzghImg)
          });
        }
        this.enterpriseObj.fSsczmc = value.fSsczmc;
        this.enterpriseObj.name = value.fXm;
        this.enterpriseObj.age = value.fNl;
        this.enterpriseObj.sex = value.fXb;
        this.enterpriseObj.phone = value.fSjh;
        this.enterpriseObj.idcard = value.fSfzh;
        this.enterpriseObj.industryAndCommerce = value.fSymc;
        let date = value.fSfzhyxq?value.fSfzhyxq.substring(0,10):'';
        console.log('打印date',date);
        this.enterpriseObj.termOfValidity = date;
        this.enterpriseObj.socialUnifiedCreditCode = value.fShtysbm;
        this.enterpriseObj.fSsczID = value.fSsczID;
      },
		  //获取当前的定位
      getLocation() {
        let that = this;
        return new Promise((resolve, reject) => {
          uni.getLocation({
            type: 'gcj02',
            success: (res) => {
              console.log('无地址,定位获取', JSON.parse(JSON.stringify(res)));
              that.formData.jd = res.longitude;
              that.formData.wd = res.latitude;
              resolve(); // 成功获取经纬度后 resolve
            },
            fail: (error) => {
              uni.$u.toast("定位失败");
              console.log("定位失败",error);
              reject(error); // 获取经纬度失败时 reject
            }
          });
        });
      },
      //获取当前的订气站
      async getStoreList() {
        // 如果有选择的地址经纬度
        if(this.adsJd && this.adsWd){
          this.formData.jd = this.adsJd;
          this.formData.wd = this.adsWd;
        }
        console.log('门店列表查询条件', JSON.parse(JSON.stringify(this.formData)));
        const result = await this.$api.memberApi.getwCzxxList(this.formData);
        let {
          code,
          value
        } = result;
        if (code === 200) {
          const newlist = value.records;
          this.storeList = newlist;
          console.log('门店列表', JSON.parse(JSON.stringify(newlist)));
        }
      },
      //选择选择器的数据
      selectPickCloums(type){
        this.pickType = type;
        this.pickShow = true;
        switch (type){
          case 'sex':
            this.columns = this.sexColumns;
            break;
          case 'rzqz':
            // let storeArry = [];
            // this.storeList.map((item)=>{
            //   storeArry.push({
            //     fSsczID:item.id,
            //     fSsczmc:item.fCzmc
            //   })
            // });
            let mcArrayList = this.storeList.map((item)=>item.fCzmc);
            this.columns = [mcArrayList];
            console.log('打印this.c',this.columns);
            break;
        }
      },
      //选择器确认的事件
			sexConfirm(e) {
				console.log(e);
        console.log(this.enterpriseObj.sex);
        let value = e.value[0];
        switch (this.pickType){
          case "sex":
            this.enterpriseObj.sex = value;
            break;
          case 'rzqz':
            this.enterpriseObj.fSsczmc = value;
            let choseObj = this.storeList.filter((item)=> item.fCzmc == value);
            this.enterpriseObj.fSsczID = choseObj[0]?choseObj[0].id:'';
            console.log('打印choseObj',choseObj);
            break;
        }
				this.pickShow = false;
			},
      //日期选择的确认事件
      dateConfirm(e) {
        console.log(e);
        let date = this.$u.timeFormat(e.value, 'yyyy-mm-dd')
        this.enterpriseObj.termOfValidity = date;
        this.dateShow = false;
      },
      //上传图片
			async upload(index,fileType) {
				console.log("上传图片", index);
        if(this.picture[index]){
          return;
        }
				uni.chooseImage({
					success: async (chooseImageRes) => {
						console.log(chooseImageRes);
						const tempFilePaths = chooseImageRes.tempFilePaths;
						const result = await this.$api.fileApi.uploadFile(tempFilePaths[0]);
						console.log('result=====>',result,this.picture);
						this.$set(this.picture,index,{
						  temp:result.url,
              fileId:result.response.fileId,
              type:fileType,
              fileObj: JSON.stringify(result)
            });
            // this.$set(this.picture,'temp',result.url);

            console.log(this.picture);
					}
				});
			},
      //预览图片
			previewPicture(url) {
				this.$previewPicture(url);
			},
      //删除图片
      deleteImg(index){
			  this.$set(this.picture,index,undefined);
        console.log('打印this.picture',this.picture);
			  // this.picture[index] =empty//删除索引为index的元素
      }
		}
	}
</script>

<style lang="scss" scoped>
	.containers {}


	.idCardWarp {
		background: #F4F5F8;
		border-radius: 10rpx;
		padding: 0 24rpx;
	}

	.noCardWarp {
		background: #fff;
		border-radius: 10rpx;
		display: flex;
		padding: 24rpx;
		margin: 24rpx;
	}

	.cardWarp {
		position: relative;
		width: 306rpx;
		height: 226rpx;
		display: flex;
		justify-content: center;
		background: #F0F3F7;
		border-radius: 14rpx;
	}

	.cardBar {
		position: absolute;
		bottom: 0;
		width: 100%;
		height: 56rpx;
		background: #DEE8F8;
		line-height: 56rpx;
		background-color: #dee8f8;
		border-radius: 0 0 14rpx 14rpx;
	}

	.cardBarText {
		text-align: center;
		color: #536CAA;
		font-weight: bold;
	}
</style>