소스 검색

调整报告列表页面按钮显示情况

littleblue55 1 개월 전
부모
커밋
72806d02e6
1개의 변경된 파일133개의 추가작업 그리고 47개의 파일을 삭제
  1. 133 47
      pages/researchReport/reportList/reportList.vue

+ 133 - 47
pages/researchReport/reportList/reportList.vue

@@ -25,26 +25,51 @@
 						<span>{{item.type}}</span>
 					</view>
 					<view class="func">
-						<view class="" v-if="item.free > 0"></view>
-						<view class="price" v-if="item.price">
-							¥{{item.price}}元
+						<!-- 如果是免费,直接显示免费 -->
+						<view v-if="item.viewMode==='1'" class="func-box" style="justify-content: flex-end;">
+							<view class="button free" >免费</view>
 						</view>
-						<view class="member-free" v-if="item.price == null && item.free < 1">
-							{{item.memberFree > 0 ? '会员免费' : `会员:${item.memberPrice}元`}}
+						<view v-else-if="item.viewMode==='2' && isMember" class="func-box">
+							<view class="price">¥{{ item.price }}元</view>
+							<view class="button member-free">会员免费</view>
 						</view>
-						<view class="not-member-price" v-if="item.price == null && item.free < 1">
-							非会员:¥{{item.notMemberPrice}}元
+						<view v-else-if="item.viewMode==='2' && !isMember" class="func-box">
+							<view style="flex: 0 0 auto;display: flex;align-items: center;">
+								<view class="member-free">
+									会员免费
+								</view>
+								<view class="not-member-price">
+									非会员:¥{{item.price}}元
+								</view>
+							</view>
+							<view :class="['button', item.hasBuy ? 'free' : 'buy']">
+								{{item.hasBuy ? '已购买' : '立即购买'}}
+							</view>
 						</view>
-						<view v-if="item.free > 0" class="button free">免费</view>
-						<view v-else-if="item.memberFree > 0" class="button member-free">会员免费</view>
-						<view v-else :class="['button', item.status > 0 ? 'free' : 'buy']">
-							{{item.status > 0 ? '已购买' : '立即购买'}}
+						<view v-else-if="item.viewMode==='3' && item.price===item.priceMember" class="func-box">
+							<view class="price">¥{{ item.price }}元</view>
+							<view :class="['button', item.hasBuy ? 'free' : 'buy']">
+								{{item.hasBuy ? '已购买' : '立即购买'}}
+							</view>
+						</view>
+						<view v-else-if="item.viewMode==='3' && item.price!==item.priceMember" class="func-box">
+							<view style="flex: 0 0 auto;display: flex;align-items: center;">
+								<view class="member-free">
+									{{`会员:${item.priceMember}元`}}
+								</view>
+								<view class="not-member-price">
+									非会员:¥{{item.price}}元
+								</view>
+							</view>
+							<view :class="['button', item.hasBuy ? 'free' : 'buy']">
+								{{item.hasBuy ? '已购买' : '立即购买'}}
+							</view>
 						</view>
 					</view>
 				</view>
 			</view>
 		</view>
-		<u-loadmore :status="status" margin-top="20" margin-bottom="20" @loadmore="loadmore"/>
+		<u-loadmore :status="status" margin-top="20" margin-bottom="20" @loadmore="loadmore" />
 	</view>
 </template>
 
@@ -59,9 +84,15 @@
 	import {
 		loadReportList
 	} from '@/api/report.js'
-	import { useReportStore } from '@/store/reportStore.js'
+	import {
+		useReportStore
+	} from '@/store/reportStore.js'
+	import {
+		useAuthStore
+	} from '@/store/authStore.js'
 	const reportStore = useReportStore();
-	
+	const authStore = useAuthStore();
+
 	const customButtonStyle = {
 		height: '40rpx',
 		lineHeight: '40rpx',
@@ -71,21 +102,21 @@
 	const searchInputStyle = {
 		backgroundColor: '#E5E5E5'
 	}
-
+	const isMember = ref(false);
 	const categoryList = ref({});
 	const pageNum = ref(1);
 	const pageSize = ref(10);
 	const count = ref(0);
 	const model = ref(null);
 	const status = ref('loadmore');
-	
+
 	const searchType = ref([{
-			label: '全部',
-			value: ' '
-		}
-	])
+		label: '全部',
+		value: ' '
+	}])
 	// 对应tab的code
-	const currentType = ref(null); 
+	const currentType = ref(null);
+
 	function onSearchTypeChange(val) {
 		currentType.value = searchType.value[val].value;
 		pageNum.value = 1;
@@ -98,7 +129,51 @@
 
 	const modelName = ref()
 
-	const list = ref([])
+	const list = ref([{
+			id: 66,
+			imgUrl: "http://www.gzrea.org.cn/upload/news/2025/03/teicvnoekviwelkv214234kk.png",
+			model: "二手住宅市场",
+			price: 0,
+			priceMember: 0,
+			title: "2025年2月从化区二手住宅市场交易简报",
+			type: "月度成交简报",
+			viewMode: "1",
+			viewObject: "4",
+		},
+		{
+			id: 33,
+			imgUrl: "http://www.gzrea.org.cn/upload/news/2025/03/teicvnoekviwelkv214234kk.png",
+			model: "二手住宅市场2",
+			price: 20,
+			priceMember: 30,
+			title: "2025年2月从化区二手住宅市场交易简报2",
+			type: "月度成交简报",
+			viewMode: "2",
+			viewObject: "4",
+		},
+		{
+			id: 663,
+			imgUrl: "http://www.gzrea.org.cn/upload/news/2025/03/teicvnoekviwelkv214234kk.png",
+			model: "二手住宅市场3",
+			price: 10,
+			priceMember: 40,
+			title: "2025年2月从化区二手住宅市场交易简报3",
+			type: "月度成交简报",
+			viewMode: "3",
+			viewObject: "4",
+		},
+		{
+			id: 663,
+			imgUrl: "http://www.gzrea.org.cn/upload/news/2025/03/teicvnoekviwelkv214234kk.png",
+			model: "二手住宅市场3",
+			price: 10,
+			priceMember: 10,
+			title: "2025年2月从化区二手住宅市场交易简报3",
+			type: "月度成交简报",
+			viewMode: "3",
+			viewObject: "4",
+		},
+	])
 	const listFilter = ref([])
 
 	function onClickReport(report) {
@@ -107,12 +182,12 @@
 		})
 	}
 
-	function init(){
+	function init() {
 		searchForm.value.keyword = '';
 		pageNum.value = 1
 		search('', 1, model.value, currentType.value)
 	}
-	
+
 	function search(keyword, pageNumber, model, type, pageSize) {
 		status.value = 'loading'
 		const form = {
@@ -124,42 +199,45 @@
 		}
 
 		loadReportList(form).then(res => {
-			if (res.code === 0) {
-				if (pageNumber === 1) {
-					list.value = res.data
-				} else {
-					list.value = [...list.value, ...res.data];
-				}
-				pageNum.value = pageNumber + 1;
-				count.value = res.count;
-				if(list.value.length===count.value){
-					status.value = 'nomore' 
-				}else{
-					status.value ='loadmore'
-				}
-			}
-		}).catch(()=>{
-			status.value ='loadmore'
+			console.log(res)
+			// if (res.code === 0) {
+			// 	if (pageNumber === 1) {
+			// 		list.value = res.data
+			// 	} else {
+			// 		list.value = [...list.value, ...res.data];
+			// 	}
+			// 	pageNum.value = pageNumber + 1;
+			// 	count.value = res.count;
+			// 	if(list.value.length===count.value){
+			// 		status.value = 'nomore' 
+			// 	}else{
+			// 		status.value ='loadmore'
+			// 	}
+			// }
+		}).catch(() => {
+			status.value = 'loadmore'
 		})
 	}
 
-	function loadmore(){
+	function loadmore() {
 		search(searchForm.value.keyword, pageNum.value, model.value, currentType.value);
 	}
-	function toSearch(){
+
+	function toSearch() {
 		search(searchForm.value.keyword, 1, model.value, currentType.value);
 	}
-	
+
 	onLoad((load) => {
+		isMember.value = authStore.userInfo.isMember === '0' ? false : true;
 		if (load.model) {
 			// console.log(load, reportStore.reportCate , "传过来的值")
 			searchType.value = reportStore.reportCate[load.model].child;
-			
+
 			modelName.value = load.model
 			model.value = load.value
-			
+
 			currentType.value = searchType.value[0].value;
-			
+
 			uni.setNavigationBarTitle({
 				title: modelName.value
 			})
@@ -210,7 +288,7 @@
 				padding: 30rpx 20rpx;
 				display: flex;
 				gap: 20rpx;
-				height: 210rpx;
+				// height: 210rpx;
 				border-bottom: 5rpx solid #E6E6E6;
 
 				&:active {
@@ -252,6 +330,14 @@
 						align-items: flex-end;
 						font-size: $uni-font-size-2;
 						font-weight: bold;
+						margin-top: 10rpx;
+
+						.func-box {
+							display: flex;
+							justify-content: space-between;
+							width: 100%;
+							align-items: center;
+						}
 
 						.button {
 							text-align: center;