2312970463@qq.com 4 anni fa
parent
commit
5b2e24a448

+ 9 - 1
api/money.js

@@ -132,4 +132,12 @@ export function getUserList(data) {
 		method: 'get',
 		data
 	})
-}
+}
+
+// export function getOrderInfo(data) {
+// 	return request({
+// 		url: '/api/project/order_info',
+// 		method: 'get',
+// 		data
+// 	})
+// }

+ 130 - 43
pages/donate/donate.vue

@@ -1,68 +1,144 @@
 <template>
 	<view class="donate-wrapper">
-		<view class="top-select flex">
+		<view class="top-select flex" style=" position: relative; z-index: 99;">
 			<view class="">选择地区</view>
-			<picker @change="bindAreaChange" :range="areas">
+			<picker @change="bindAreaChange" :range="areas" range-key="name">
 				<view class="area select" :class="{ action: area }">{{ area || '点击选择地区' }}</view>
 			</picker>
 			<picker @change="bindStatusChange" :range="statuss">
 				<view class="status select" :class="{ action: status }">{{ status }}</view>
 			</picker>
 		</view>
-		<view class="item-wrapper">
-			<view class="item flex" v-for="item in showList">
-				<view class="item-left"><image :src="item.img" mode=""></image></view>
-				<view class="item-right">
-					<view class="item-title clamp">{{ item.title }}</view>
-					<view class="item-content clamp2">{{ item.info }}</view>
-					<view class="item-status">
-						捐赠进度
-						<text>{{ item.project_progress }}%</text>
+		<scroll-view scroll-y="true" :style="{ height: height }" class="item-wrapper" >
+			<!-- <view class="item-wrapper"> -->
+			<empty v-if="showList.length === 0"></empty>
+			<template>
+				<view class="item flex" v-for="item in showList" >
+					<view class="item-left"><image :src="item.img" mode=""></image></view>
+					<view class="item-right">
+						<view class="item-title clamp">{{ item.title }}</view>
+						<view class="item-content clamp2">{{ item.info }}</view>
+						<view class="item-status">
+							捐赠进度
+							<text>{{ item.project_progress }}%</text>
+						</view>
+						<view class="item-btn" :class="{ 'btn-active': item.status === 0 }" @click="join(item.id)">{{ item.status === 0 ? '我要捐赠' : '已结束' }}</view>
 					</view>
-					<view class="item-btn" :class="{ 'btn-active': item.status === 0 }" @click="join(item.id)">{{ item.status === 0 ? '我要捐赠' : '已结束' }}</view>
 				</view>
-			</view>
-		</view>
+			</template>
+			
+
+			<!-- </view> -->
+			
+		</scroll-view>
+		
 	</view>
 </template>
 
 <script>
-import { getProjectList, getProjectInfo ,getAllArea} from '../../api/money.js';
+import empty from '../../components/empty.vue';
+import { getProjectList, getProjectInfo, getAllArea } from '../../api/money.js';
 export default {
+	components: {
+		empty
+	},
 	data() {
 		return {
-			areas: ['沙市区红十字会', '荆州区红十字会', '石首区红十字会', '洪湖区红十字会', '松滋区红十字会', '监利区红十字会', '公安县红十字会', '江陵县红十字会'],
+			areas: [],
 			area: '',
+			select_area: 0,
 			area_id: 0,
 			statuss: ['全部', '进行中', '已结束'],
 			status: '全部',
-			status_id: 0,
+			select_status: 0,
 			list: [],
-			showList: []
+			height: 0
+			// showList: []
 		};
 	},
-	async onLoad() {
-		let a = await this.loadDate();
-		this.showList = this.list;
-		this.getAllArea()
+	onReady(res) {
+		var _this = this;
+		uni.getSystemInfo({
+			success: resu => {
+				const query = uni.createSelectorQuery();
+				query.select('.item-wrapper').boundingClientRect();
+				query.exec(function(res) {
+					console.log(res, 'ddddddddddddd');
+					_this.height = resu.windowHeight - res[0].top + 'px';
+					console.log('打印页面的剩余高度', _this.height);
+				});
+			},
+			fail: res => {}
+		});
+	},
+	computed: {
+		showList() {
+			let obj = this;
+			if (obj.list.length === 0) {
+				return [];
+			} else {
+				if (obj.select_area === 0) {
+					if (obj.select_status === 0) {
+						return obj.list;
+					} else if (obj.select_status === 1) {
+						return obj.list.filter(item => {
+							return item.status !== 4;
+						});
+					} else {
+						return obj.list.filter(item => {
+							return item.status === 4;
+						});
+					}
+				} else {
+					if (obj.select_status === 0) {
+						return obj.list.filter(item => {
+							return item.project_area === obj.select_area;
+						});
+					}else if(obj.select_status === 1){
+						 return obj.list.filter(item => {
+							return item.project_area === obj.select_area && item.status !== 4 
+						});
+					}else {
+						return obj.list.filter(item => {
+							return item.project_area === obj.select_area && item.status === 4 
+						});
+					}
+				}
+			}
+		}
+	},
+	onLoad() {
+		this.loadDate();
+		// this.showList = this.list;
+		this.getAllArea();
 	},
 	methods: {
 		bindAreaChange(e) {
 			console.log(e.target);
-			this.area = this.areas[e.target.value];
+			this.area = this.areas[e.target.value].name;
+			this.select_area = this.areas[e.target.value].id;
 		},
 		bindStatusChange(e) {
 			console.log(e.target);
-			if (this.status !== this.statuss[e.target.value]) {
-				this.status = this.statuss[e.target.value];
-				if(this.status == '全部') {
-					this.showList = this.list
-				}else if(this.status == '进行中'){
-					this.showList = this.list.map( item => {
-						return item
-					})
-				}
+			this.status = this.statuss[e.target.value];
+			if (this.status == '已结束') {
+				this.select_status = 4;
+			}else if(this.status == '全部'){
+				this.select_status = 0;
+			}else {
+				this.select_status = 1;
+				console.log(this.select_status,'this.select_status+++++++++++++')
 			}
+			// if (this.status !== this.statuss[e.target.value]) {
+			// 	this.status = this.statuss[e.target.value];
+			// 	if(this.status == '全部') {
+			// 		this.showList = this.list
+			// 	}else if(this.status == '进行中'){
+			// 		this.showList = this.list.map( item => {
+			// 			return item
+			// 		})
+			// 	}
+			// }
 		},
 		join(id) {
 			console.log(id);
@@ -74,7 +150,7 @@ export default {
 		loadDate() {
 			getProjectList({
 				page: 1,
-				limit: 1000
+				limit: 10000
 			}).then(({ data }) => {
 				// console.log(res,'+++++++++++++++++')
 				let list = [];
@@ -85,7 +161,7 @@ export default {
 						let data = JSON.parse(res.msg);
 						// console.log( data.project_progress,'999999999999999')
 						item.project_progress = data.project_progress;
-						item.info = item.info.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g,'').replace(/<[^>]+>/g, '');
+						item.info = item.info.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, '').replace(/<[^>]+>/g, '');
 						console.log(item);
 						this.list.push(item);
 						return item;
@@ -94,16 +170,27 @@ export default {
 				console.log(this.list, '5555555');
 			});
 		},
-		select(area,status) {
-			if(atea!== '') {
-				
-			}
-			
-		},
 		getAllArea() {
-			getAllArea().then(res => {
-				console.log(res,'6666666666')
-			})
+			getAllArea().then(({ data }) => {
+				console.log(data, '6666666666');
+				this.areas = data;
+			});
+		},
+		isShow(item) {
+			let obj = this;
+			if (obj.select_area === 0) {
+				if (obj.select_status === 0) {
+					return true;
+				} else {
+					return item.status === obj.select_status ? true : false;
+				}
+			} else {
+				if (obj.select_status === 0) {
+					return obj.select_area === item.project_area ? true : false;
+				} else {
+					return obj.select_area === item.project_area && item.status === obj.select_status ? true : false;
+				}
+			}
 		}
 	}
 };

+ 22 - 8
pages/donate/donateDetail.vue

@@ -25,7 +25,7 @@
 					{{ proInfo.end_time | time }}
 				</view>
 			</view>
-			<view class="dynamic flex">
+			<view class="dynamic flex" v-if="newItem">
 				<view class="left">实时动态</view>
 				<view class="right flex">
 					<view>捐赠时间:{{ newItem.add_time | time }}</view>
@@ -116,7 +116,7 @@
 				</view>
 			</view>
 		</view>
-		<view class="btn-wrapper flex">
+		<view class="btn-wrapper flex" v-if="isBottom">
 			<view class="btn1 btn" @click="navTo('/pages/donate/progress?id=' + proInfo.id)">实时进展</view>
 			<view class="btn2 btn" @click="want()">我要捐款</view>
 		</view>
@@ -156,12 +156,17 @@ export default {
 			pid: 0,
 			proInfo: {},
 			typeList: [], //物资分类列表
-			newItem: {} //最新动态
+			newItem: null ,//最新动态,
+			isBottom: false
 		};
 	},
+	onReachBottom() {
+		this.isBottom = true
+	},
 	filters: {
 		time(val) {
 			let str = '';
+			// console.log(val)
 			if (val) {
 				let date = new Date(val * 1000);
 				let Y = date.getFullYear();
@@ -205,8 +210,10 @@ export default {
 		}
 	},
 	onLoad(opt) {
+		console.log('onLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoad')
 		that = this;
 		this.pid = opt.id;
+		console.log(this.pid,'5555555555555555555555')
 		this.getNewOrder();
 
 		this.loadDate(this.pid);
@@ -221,6 +228,7 @@ export default {
 				console.log(data, 'loaddata++++++++++');
 				data.info = data.info.replace(/<img /g, '<img style="width:100%"');
 				this.proInfo = data;
+				console.log(this.proInfo,'this.proInfo++++++++++++++++')
 				let arr = this.proInfo.project_donation_info;
 				let len = arr.length;
 				let map = {},
@@ -297,11 +305,17 @@ export default {
 		},
 		getNewOrder() {
 			getAllOrder({
-				project_id: this.pid
+				project_id: this.pid,
+				page: 1,
+				limit: 1
 			}).then(({ data }) => {
-				console.log(data, '999999999999999999999999');
-				this.newItem = data.list[0];
-				console.log(this.newItem, '88888888888888888');
+				if(data.count!== 0){
+					console.log(data, '999999999999999999999999');
+					// this.newItem = data.list[0];
+					this.$set(this,'newItem', data.list[0])
+					console.log(this.newItem, '88888888888888888');
+				}
+				
 			});
 		},
 		getItem(item) {
@@ -329,7 +343,7 @@ page {
 	width: 100%;
 }
 .top {
-	height: 863rpx;
+	// height: 863rpx;
 	background-color: #fff;
 	border-top: 1rpx solid #f6f6f6;
 	padding-top: 33rpx;

+ 3 - 3
pages/donate/progress.vue

@@ -62,11 +62,11 @@
 				<image src="../../static/icon/xq3.png" mode=""></image>
 				<view class="item-info">
 					<view class="item-tit">捐赠审核</view>
-					<scroll-view scroll-y="true" class="item-num"  @scrolltolower="loadDate"  :class="[list.length <= 2 ? 'less': 'better']">
+					<scroll-view scroll-y="true" class="item-num"  @scrolltolower="loadDate"  :class="[list.length <= 2 ? 'less': 'better']" v-if="list.length>0">
 						<view class="item-wrapper">
 							<!-- <empty v-if="list.length === 0"></empty> -->
 							<template v-for="(item, index) in list">
-								<view :key="index" class="jzr-item" :class="[index % 4 === 0 ? 'bg1' : index % 4 === 1 ? 'bg2' : index % 4 === 2 ? 'bg3' : 'bg4']" @click="navTo('/pages/donate/progresst?name='+item.name)">
+								<view :key="index" class="jzr-item" :class="[index % 4 === 0 ? 'bg1' : index % 4 === 1 ? 'bg2' : index % 4 === 2 ? 'bg3' : 'bg4']" @click="navTo('/pages/donate/progresst?item='+JSON.stringify(item))">
 									<view class="item-title clamp">{{ item.name }}</view>
 									<view class="item-status">捐赠响应{{item.status_txt === '拒绝'?'未通过':item.status_txt==='待审核'?'待审核':'已通过'}}</view>
 								</view>	
@@ -365,7 +365,7 @@ export default {
 			.all-info {
 				margin-top: 20rpx;
 				width: 601rpx;
-				height: 174rpx;
+				height: 130rpx;
 				border: 1px solid #cccccc;
 				border-radius: 10rpx;
 				font-size: 24rpx;

+ 8 - 3
pages/donate/progresst.vue

@@ -43,7 +43,7 @@
 				<image src="../../static/icon/xq1.png" mode=""></image>
 				<view class="item-info">
 					<view class="item-tit">响应捐赠</view>
-					<view class="item-time">2021/06/17 12:20:34 荆州XXX公司响应捐赠(帐篷100顶),提交工作人员审核</view>
+					<view class="item-time">{{info.add_time}} {{info.name}}{{info}},提交工作人员审核</view>
 				</view>
 				<view class="line1"></view>
 				<view class="line5"></view>
@@ -117,14 +117,19 @@
 </template>
 
 <script>
+import {getOrderInfo} from '../../api/money.js'
 export default {
 	data() {
 		return {
 			peopleList: [],
-			isShow: false
+			isShow: false,
+			info: {}
 		};
 	},
-	mounted() {},
+	onLoad(opt) {
+		this.info = JSON.parse(opt.item)
+		console.log(this.info)
+	},
 	methods: {}
 };
 </script>

+ 3 - 3
pages/user/myaid.vue

@@ -30,18 +30,18 @@
 									{{item.title}}
 								</view>
 								<view class="info-content">
-									项目进度:您的捐赠{{item.order_status === 0 ? '正在审核中,请耐心等待':item.order_status !== -1 ? ' 审核未通过,感谢您的爱心!' : '审核已通过' }}
+									项目进度: 您的捐赠{{item.order_status === 0 ? '正在审核中,请耐心等待':item.order_status === -1 ? ' 审核未通过,感谢您的爱心!' : '审核已通过' }}
 								</view>
 								<view class="info-time">
 									申请时间 {{item.add_time | time}}
 								</view>
 							</view>
 						</view>
-						<view class="item-bottom flex" v-if="item.order_status > 1">
+						<view class="item-bottom flex" v-if="item.order_status >= 1">
 							<view class="yxs" @click="navTo('/pages/user/intent')">
 								捐献意向书
 							</view>
-							<view class="zs"  @click="navTo('/pages/user/thank')" >
+							<view class="zs"  @click="navTo('/pages/user/thank?project_id='+item.project_id + '&name=' + item.name + '&time=' + item.add_time+'&title=' + item.title ||'')"  v-if="item.order_status === 4">
 								捐赠证书
 							</view>
 						</view>

+ 23 - 4
pages/user/thank.vue

@@ -36,10 +36,20 @@ export default {
 			isStop: true,
 			demo: 0,
 			userName: '荆州XXX公司',
-			time: '2021-05-08',
-			itemName: '关心关爱留守儿童'
+			time: 0,
+			itemName: '',
+			pid: 0
 		};
 	},
+	computed: {
+		showtime() {
+			let date = new Date(this.time * 1000);
+			let Y = date.getFullYear();
+			let M = date.getMonth()
+			let D = date.getDate()
+			return Y + '年' + M + '月' + D + '日';
+		}
+	},
 	onReady() {
 		let query = uni.createSelectorQuery();
 		let obj = this;
@@ -111,9 +121,14 @@ export default {
 		context.setTextAlign('left')
 		context.setFillStyle('#533113');
 		context.setFontSize(30* obj.ratio);
-		context.fillText('感谢您于 ' + obj.time +' 对于', 198* obj.ratio, 940 * obj.ratio);
+		context.fillText('感谢您于 ' + obj.showtime , 198* obj.ratio, 940 * obj.ratio);
 		context.setTextAlign('center')
-		context.fillText('"'+obj.itemName+'"'+ '的爱心捐赠。',(750/2+20)* obj.ratio,980 * obj.ratio)
+		if(this.pid !== 0){
+			context.fillText('对'+'"'+obj.itemName+'"'+ '的爱心捐赠。',(750/2+20)* obj.ratio,980 * obj.ratio)
+		}else {
+			context.fillText('的爱心捐赠。',(750/2+20)* obj.ratio,980 * obj.ratio)
+		}
+		
 		
 		context.fillText('特发此证书,以示感谢!',(750/2)* obj.ratio,1020 * obj.ratio)
 		// context.fillText('衷心感谢您对荆州市红十字事业的信任与支持', 155 * obj.ratio, 460 * obj.ratio);
@@ -178,6 +193,10 @@ export default {
 		// this.money = option.money;
 		// this.IndexShare();
 		// this.ScanAudio(true);
+		this.pid = option.project_id
+		this.userName = option.name
+		this.time = option.time
+		this.itemName = option.title
 	},
 	onHide() {
 		//在页面隐藏时也要清除定时器