| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 | 
							- <template>
 
- 	<view class="container">
 
- 		<page-title @searchClick='searchClick' :showSearch='true'>企业信息</page-title>
 
- <!-- 		<view class="back-btn">
 
- 			<u-icon name="arrow-left" color="#fff" size="20" customStyle="margin:0 auto" @click="backToBefore()"></u-icon>
 
- 			<text class="back-text" @click="backToBefore()">企业信息</text>
 
- 			<u-icon name="search" color="#fff" size="30" customStyle="position:absolute;top:0;right:0"
 
- 				@click="goToPage('/pages/enterpriseInfo/search/index')"></u-icon>
 
- 		</view> -->
 
- 		<view class="cards-list">
 
- 			<view class="card" v-for="(item,index) in enterpriseList" :key="index">
 
- 				<card-title :numerator="index+1" :denominator="listTotal"></card-title>
 
- 				<view class="card-name">
 
- 					<view class="card-name-title">
 
- 						<text class="card-name-description">企业名称</text>
 
- 					</view>
 
- 					<text class="card-name-text">{{item.title || "--"}}</text>
 
- 				</view>
 
- 				<view class="card-item">
 
- 					<view class="card-item-name">所在地</view>
 
- 					<view class="card-item-content">{{item.area || "--"}}</view>
 
- 				</view>
 
- 				<view class="card-item">
 
- 					<view class="card-item-name">当前状态</view>
 
- 					<view class="card-item-content">{{item.status || "--"}}</view>
 
- 				</view>
 
- 				<view class="card-item">
 
- 					<view class="card-item-name">注册资金</view>
 
- 					<view class="card-item-content">{{(item.amt!= null)? item.amt : "--"}}</view>
 
- 				</view>
 
- 				<view class="card-item">
 
- 					<view class="card-btn fat-btn" @click="gotoDetail(item.id,item.title)">企业查看</view>
 
- 				</view>
 
- 			</view>
 
- 			<empty-show v-if="enterpriseList.length===0"></empty-show>
 
- 		</view>
 
- 		<u-back-top :scroll-top="scrollTop"></u-back-top>
 
- 		<u-loading-page :loading="loading"></u-loading-page>
 
- 	</view>
 
- </template>
 
- <script setup>
 
- 	import {
 
- 		ref
 
- 	} from 'vue'
 
- 	import {
 
- 		onLoad,
 
- 		onUnload,
 
- 		onPullDownRefresh,
 
- 		onReachBottom,
 
- 		onPageScroll
 
- 	} from "@dcloudio/uni-app"
 
- 	import {
 
- 		getEnterpriseInfoList,
 
- 	} from "@/api/work/enterpriseInfo.js"
 
- 	// 返回上一级
 
- 	function backToBefore() {
 
- 		uni.reLaunch({
 
- 			url: "/pages/index"
 
- 		});
 
- 	};
 
- 	function goToPage(url) {
 
- 		uni.navigateTo({
 
- 			url
 
- 		})
 
- 	}
 
- 	let scrollTop = ref(0);
 
- 	let loading = ref(true);
 
- 	// 参数
 
- 	let searchInfo = ref({
 
- 		pageNo: 1,
 
- 		pageSize: 10,
 
- 	})
 
- 	
 
- 	function searchClick () {
 
- 		goToPage('/pages/enterpriseInfo/search/index')
 
- 	}
 
- 	// 获取列表
 
- 	function getList() {
 
- 		let params = {
 
- 			pageNo: searchInfo.value.pageNo,
 
- 			pageSize: searchInfo.value.pageSize,
 
- 			title: searchInfo.value.title,
 
- 			status: searchInfo.value.status
 
- 		}
 
- 		if(searchInfo.value.pageNo == 1){
 
- 			loading.value = true
 
- 		}
 
- 		getEnterpriseInfoList(params).then(res => {
 
- 			loading.value = false
 
- 			enterpriseList.value = enterpriseList.value.concat(res.data.list)
 
- 			listTotal.value = res.data.total
 
- 			if (res.data.total == searchInfo.value.pageNo*searchInfo.value.pageSize-(10 - res.data.list.length)) moreListFlag = false;
 
- 		}).catch(() => {
 
- 			loading.value = false
 
- 		})
 
- 	}
 
- 	// 主要列表
 
- 	let enterpriseList = ref([]);
 
- 	let listTotal = ref(0);
 
- 	// 去详情
 
- 	function gotoDetail(id, subName) {
 
- 		uni.navigateTo({
 
- 			url: `/pages/enterpriseInfo/detail/index?id=${id}&subName=${subName}`
 
- 		})
 
- 	}
 
- 	// 触底加载flag
 
- 	let moreListFlag = true
 
- 	onLoad(options => {
 
- 		// searchInfo.value = Object.assign(searchInfo.value, options)
 
- 		// let filterArr = ["null", "undefined", ""]
 
- 		// for (let i in searchInfo.value) {
 
- 		// 	if (filterArr.includes(searchInfo.value[i])) {
 
- 		// 		searchInfo.value[i] = null
 
- 		// 	}
 
- 		// }
 
- 		uni.$on('enterpriseInfoSearch', resolve => {
 
- 			searchInfo.value = Object.assign(searchInfo.value, resolve);
 
- 			searchInfo.value.pageNo = 1;
 
- 			enterpriseList.value = [];
 
- 			listTotal.value = 0;
 
- 			moreListFlag = true;
 
- 			getList();
 
- 		})
 
- 		getList();
 
- 	})
 
- 	onUnload(() => {
 
- 		uni.$off('enterpriseInfoSearch');
 
- 	});
 
- 	onPageScroll((e) => {
 
- 		scrollTop.value = e.scrollTop
 
- 	})
 
- 	onPullDownRefresh(() => {
 
- 		searchInfo.value.pageNo = 1;
 
- 		enterpriseList.value = [];
 
- 		moreListFlag = true;
 
- 		try {
 
- 			getList();
 
- 		} finally {
 
- 			uni.stopPullDownRefresh()
 
- 		}
 
- 	})
 
- 	onReachBottom(() => {
 
- 		if (!moreListFlag) {
 
- 			return uni.showToast({
 
- 				title: "已经到底了。",
 
- 				icon: "none",
 
- 				duration: 2000
 
- 			})
 
- 		}
 
- 		searchInfo.value.pageNo++;
 
- 		getList();
 
- 	})
 
- </script>
 
- <style lang="scss" scoped>
 
- 	// .back-btn {
 
- 	// 	position: absolute;
 
- 	// 	top: 8%;
 
- 	// 	left: 4%;
 
- 	// 	display: flex;
 
- 	// 	width: 92%;
 
- 	// 	font-size: 40rpx;
 
- 	// 	font-weight: 500;
 
- 	// 	color: #FFF;
 
- 	// 	.back-text {
 
- 	// 		margin-left: 28rpx;
 
- 	// 	}
 
- 	// }
 
- </style>
 
 
  |