lhl 3 年之前
父节点
当前提交
758bb3d18e
共有 8 个文件被更改,包括 607 次插入652 次删除
  1. 1 1
      api/ask.js
  2. 1 1
      pages/applic/science.vue
  3. 18 117
      pages/form/certificates.vue
  4. 197 188
      pages/form/certificatesList.vue
  5. 196 176
      pages/form/myDonate.vue
  6. 187 164
      pages/user/user.vue
  7. 3 1
      store/index.js
  8. 4 4
      utils/wxAuthorized.js

+ 1 - 1
api/ask.js

@@ -102,7 +102,7 @@ export function getDonaList(data) {
 // 我的捐赠 MyDonaList
 export function MyDonaList(data) {
 	return request({
-		url: '/api/my_donate',
+		url: '/api/lave/mylst',
 		method: 'get',
 		data
 	});

+ 1 - 1
pages/applic/science.vue

@@ -12,7 +12,7 @@
 		</view>
 		<view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item.id)">
 			<view class="box-left">
-				<image :src="item.image" mode="" class="left-img"></image>
+				<image :src="$store.state.baseURL + item.image" mode="" class="left-img"></image>
 			</view>
 			<view class="box-right">
 				<view class="right-top word1_ellipsis">

+ 18 - 117
pages/form/certificates.vue

@@ -4,6 +4,7 @@
 			<empty></empty>
 		</view>
 		<view class="certificates" v-if='is_over'>
+
 			<canvas v-if="showcanvas" id="qrShareBox" canvas-id="qrShareBox" class="tki-qrcode-canvas" />
 			<image class="imgbox" v-else :src="img" mode=" aspectFill"></image>
 		</view>
@@ -36,7 +37,6 @@
 		},
 		data() {
 			return {
-				send_time: 0,//发证时间
 				is_over: 1,
 				type: '', //0是个人报名,1是团体报名
 				id: '',
@@ -53,7 +53,7 @@
 				companyName: '',
 				companyphone: '',
 				num: '',
-				people: '咸宁市红十字会',
+				people: '神农架林区红十字会',
 				signDate: '',
 				loading: true, //是否载入图片中
 				size: 180,
@@ -63,15 +63,15 @@
 				url: '',
 				img: '',
 				showcanvas: true,
-				uid: ''
+				uid: '',
+				sendtime: ''
 			};
 		},
 		onLoad(option) {
 			this.type = option.type;
 			// this.id = option.id;
-			this.send_time = option.send_time
-			// this.
 			this.name = decodeURI(option.name)
+			this.sendtime = option.sendtime
 			this.IndexShare();
 			// this.loadData();
 
@@ -82,14 +82,14 @@
 			// }).then(({
 			// 	data
 			// }) => {
-				// console.log(999, data)
-				// this.name = data.name
-				// this.signDate = data.add_time
-				// this.is_over = data.is_over
-				// console.log(3, data.add_time)
+			// 	console.log(999, data)
+			// 	this.name = data.name
+			// 	this.signDate = data.add_time
+			// 	this.is_over = data.is_over
+			// 	console.log(3, data.add_time)
 				let obj = this;
 				let name = obj.name
-				let signDate = obj.signDate
+				let signDate = obj.sendtime
 
 				function getRecTime(timestamp, fmt) {
 					let d = new Date(timestamp * 1000)
@@ -116,7 +116,7 @@
 					return f;
 					console.log(f)
 				}
-				let send_time = getRecTime(obj.send_time)
+				let m = getRecTime(signDate)
 				let query = uni.createSelectorQuery();
 				// this.loadData();
 				// 获取页面比例
@@ -192,7 +192,7 @@
 				context.fillText('签发日期:', 300 * obj.ratio, 880 * obj.ratio)
 				context.fillText('Issuer Date:', 300 * obj.ratio, 910 * obj.ratio)
 				context.setFontSize(26 * obj.ratio)
-				context.fillText(send_time, 475 * obj.ratio, 908 * obj.ratio)
+				context.fillText(m, 475 * obj.ratio, 908 * obj.ratio)
 				context.fillText('咸宁市红十字会', 440 * obj.ratio, 820 * obj.ratio)
 				// 画横线
 				context.moveTo(430 * obj.ratio, 915 * obj.ratio)
@@ -217,7 +217,7 @@
 						width: obj.canWeidth,
 						height: obj.canHeight,
 						destWidth: obj.canWeidth,
-						destHeight: obj.canHeight,
+			  	destHeight: obj.canHeight,
 						canvasId: 'qrShareBox',
 						success: function(res) {
 							console.log(res)
@@ -228,8 +228,7 @@
 							// console.log(res.tempFilePath)
 							obj.showcanvas = false;
 							obj.img = res.tempFilePath
-
-						}
+			 		}
 					})
 				})
 			// })
@@ -241,8 +240,7 @@
 			console.log('this.uid', this.uid)
 		},
 		computed: {
-			...mapState('user', ['hasLogin', 'userInfo']),
-			...mapState(['baseURL'])
+			...mapState('user', ['hasLogin', 'userInfo'])
 		},
 		methods: {
 			...mapMutations('user', ['setUserInfo']),
@@ -250,111 +248,14 @@
 			IndexShare() {
 				let obj = this;
 				let item = {
-					link: obj.baseURL + '/index/#/pages/form/certificates?type=' + obj.type + '&send_time=' + obj.send_time + '&name=' + encodeURI(obj.name), 
-					imgUrl: '/index/static/img/002.png',
+					link: obj.$store.state.baseURL + '/index/#/pages/form/certificates?name=' + encodeURI(obj.name) + '&sendtime=' + obj.sendtime,
+					imgUrl: obj.$store.state.baseURL + '/index/static/img/002.png',
 					desc: '结业证书',
 					title: '咸宁市红十字会',
 				};
 				console.log('分享加', item)
 				weixindata(item);
 			},
-			async loadData() {
-				let obj = this;
-				console.log('当前is_over', obj.is_over)
-				if (obj.is_over == 1) {
-					let uid = obj.userInfo.uid
-					console.log(9090, uid)
-				}
-				get_training({
-					id: obj.id,
-					// uid:uid
-				}).then(({
-					data
-				}) => {
-					obj.list = data;
-					console.log(9988, data)
-					if (obj.list.content != null) {
-						obj.description = obj.list.content.replace(/<img/g,
-							"<img style='max-width:100%;height:auto;'");
-					}
-				});
-
-			},
-			submit() {
-				let obj = this;
-				let data = {};
-				if (obj.type == 0) {
-					if (!obj.name) {
-						obj.$api.msg('请填写姓名!');
-						return;
-					}
-					if (!obj.phone) {
-						obj.$api.msg('请输入联系方式!');
-						return;
-					}
-					if (!obj.addr) {
-						obj.$api.msg('请输入联系方式!');
-						return;
-					}
-					data = {
-						name: obj.name,
-						work: obj.addr,
-						phone: obj.phone,
-						tid: obj.id,
-						type: 0
-					}
-				}
-				if (obj.type == 1) {
-					if (!obj.company) {
-						obj.$api.msg('请填写企业名称!');
-						return;
-					}
-					if (!obj.address) {
-						obj.$api.msg('请填写企业地址!');
-						return;
-					}
-					if (!obj.companyName) {
-						obj.$api.msg('请填写负责人姓名!');
-						return;
-					}
-					if (!obj.companyphone) {
-						obj.$api.msg('请输入联系方式!');
-						return;
-					}
-					if (!obj.num) {
-						obj.$api.msg('请输入参加培训人数!');
-						return;
-					}
-					data = {
-						company: obj.company,
-						address: obj.address,
-						name: obj.companyName,
-						phone: obj.companyphone,
-						num: obj.num,
-						tid: obj.id,
-						type: 1
-					}
-				}
-				sign_training(data).then(function(e) {
-					console.log(data.type)
-					let type = data.type
-					uni.setStorageSync('type', type)
-					obj.$api.msg(e.msg);
-					setTimeout(function() {
-						uni.navigateTo({
-							url: '/pages/train/index'
-						})
-					}, 1000);
-				}).catch(e => {
-					obj.$api.msg(e.message);
-					setTimeout(function() {
-						uni.navigateTo({
-							url: '/pages/train/index'
-						})
-					}, 1000);
-				});;
-
-			},
 			getRecTime(timestamp, fmt) {
 				let d = new Date(timestamp * 1000),
 					// f = fmt || 'yyyy/MM/dd', 

+ 197 - 188
pages/form/certificatesList.vue

@@ -1,193 +1,202 @@
-<template>
-	<view class="container">
-		<!-- <view class="top">
-			普及培训
-		</view> -->
-		<swiper class="swiper-box" duration="300" @change="changeTab">
-			<swiper-item class="tab-content">
-				<scroll-view class="list-scroll-content" scroll-y >
-					<!-- 空白页 -->
-					<empty v-if="loadingType === true && list.length === 0"></empty>
-					<!-- 订单列表 -->
-					<view class="order-item" @click="ToDetail(item)" v-for="(item, index) in list" :key="index">
-						<view class="list-cell">
-							<image class="image" :src="baseURL + item.training.image"></image>
-							<view class="list-tpl">{{ item.training.title }}</view>
-						</view>
-					</view>
-				</scroll-view>
-			</swiper-item>
-		</swiper>
-	</view>
-</template>
+<template>
+	<view class="container">
+		<!-- <view class="top">
+			普及培训
+		</view> -->
+		<swiper class="swiper-box" duration="300" @change="changeTab">
+			<swiper-item class="tab-content">
+				<scroll-view class="list-scroll-content" scroll-y>
+					<!-- 空白页 -->
+					<empty v-if="loaded && list.length == 0"></empty>
+					<!-- 订单列表 -->
+					<view class="order-item" @click="ToDetail(item)" v-for="(item, index) in list" :key="index">
+						<view class="list-cell">
+							<image class="image" :src="baseURL + item.training.image"></image>
+							<view class="list-tpl">{{ item.training.title }}</view>
+						</view>
+					</view>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+	</view>
+</template>
 <script>
 	import {
 		mapState,
 		mapMutations
-	} from 'vuex';
-import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
-import empty from '@/components/empty';
-import uniPopup from '@/components/uni-popup/uni-popup.vue';
-import { myTrainingList } from '@/api/index.js';
-export default {
-	components: {
-		uniLoadMore,
-		empty,
-		uniPopup
-	},
-	computed: {
-		...mapState(['baseURL'])
-	},
-	data() {
-		return {
-			page: 1, //当前页数
-			limit: 6, //每次信息条数
-			list: [],
-			loadingType: 'more', //加载更多状态
-		};
-	},
-	onLoad() {
-		console.log(22)
-		this.loadData();
-	},
-	methods: {
-		//获取订单列表
-		loadData(type) {
-			//这里是将订单挂载到tab列表下
-			let obj = this;
-			if (type != 'refresh') {
-				console.log(obj.loadingType, '456');
-				//没有更多数据直接跳出方法
-				if (obj.loadingType === 'nomore') {
-					return;
-				} else {
-					// 设置当前为数据载入中
-					obj.loadingType = 'loading';
-				}
-			} else {
-				//当重新加载数据时更新状态为可继续添加数据
-				obj.loadingType = 'more';
-			}
-			myTrainingList({})
-				.then(data => {
-					if (type === 'refresh') {
-						obj.list = [];
-					}
-					let arr = data.data
-					obj.list = obj.list.concat(arr);
-					//判断是否还有下一页,有是more  没有是nomore
-					if (obj.limit == arr.length) {
-						obj.page++;
-						obj.loadingType = 'more';
-					} else {
-						obj.loadingType = 'nomore';
-					}
-					// 判断是否为刷新数据
-					if (type === 'refresh') {
-						console.log('refresh');
-						// 判断是否为点击搜索按钮跳转加载
-						if (obj.loading == 1) {
-							uni.hideLoading();
-						} else {
-							uni.stopPullDownRefresh();
-						}
-					}
-				})
-				.catch(e => {
-					obj.loadingType = 'nomore';
-					uni.hideLoading();
-				});
-		},
-		//跳转到详情
-		ToDetail(e) {
-			let type = e.num == 1 ? '0': '1';//0是个人报名,1是团体报名
-			// let id = e.id;
-			uni.navigateTo({
-				url: '/pages/form/certificates?type=' + type+ '&send_time=' + e.sendtime + '&name=' + encodeURI(e.name)
-			});
-		}
-	}
-};
-</script>
-
-<style lang="scss">
-page {
-	background: #F2F2F2;
-	height: 100%;
-	padding-bottom: 25rpx;
-}
-.container {
-	height: 100%;
-	.top{
-		background-color: #FFFFFF;
-		height: 88rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		font-size: 36rpx;
-		font-weight: 500;
-		color: #333333;
-	}
-	.swiper-box {
-		height:100%;
-		.list-scroll-content {
-			height:100%;
-		}
-	}
-}
-.scroll-list {
-	width: 100%;
-	overflow: hidden;
-	white-space: nowrap;
-	background-color: #ffffff;
-	font-size: 32rpx;
-	.scoll-box {
-		text-align: center;
-		display: inline-block;
-		margin: 0rpx 38rpx;
-		padding: 15rpx 0rpx;
-		.scoll-img {
-			width: 130rpx;
-			height: 85rpx;
-			border-radius: 100%;
-			image {
-				width: 85rpx;
-				height: 100%;
-				border-radius: 100%;
-			}
-		}
-		.scoll-name {
-			padding-top: 15rpx;
-		}
-		&.active {
-			color: #ef3d28;
-			border-bottom: 6rpx solid #ef3d28;
-		}
-	}
-}
-
-.order-item {
-	width: 100%;
-	padding: 0rpx 25rpx;
-	padding-top: 25rpx !important;
-	.list-cell {
-		background-color: #ffffff;
-		border-radius: 20rpx;
-		width: 100%;
-		box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
-		.image {
-			width: 100%;
-			height: 300rpx;
-			border-top-left-radius: 25rpx;
-			border-top-right-radius: 25rpx;
-		}
-		.list-tpl {
-			padding: 25rpx 25rpx;
-			padding-bottom: 35rpx !important;
-			font-size: 34rpx;
-			color: #222222;
-			font-weight:500;
-		}
-	}
-}
+	} from 'vuex';
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	import empty from '@/components/empty';
+	import uniPopup from '@/components/uni-popup/uni-popup.vue';
+	import {
+		myTrainingList
+	} from '@/api/index.js';
+	export default {
+		components: {
+			uniLoadMore,
+			empty,
+			uniPopup
+		},
+		data() {
+			return {
+				page: 1, //当前页数
+				limit: 6, //每次信息条数
+				list: [],
+				loadingType: 'more', //加载更多状态
+				loaded: false
+			};
+		},
+		onLoad() {
+			console.log(22)
+			this.loadData();
+		},
+		computed: {
+			...mapState(['baseURL'])
+		},
+		onReachBottom() {
+			this.loadData()
+		},
+		methods: {
+			//获取订单列表
+			loadData() {
+				//这里是将订单挂载到tab列表下
+				let obj = this;
+				if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
+					return 
+				}
+				obj.loadingType = 'loading'
+				myTrainingList({
+					page: obj.page,
+					limit: obj.limit
+				})
+					.then(data => {
+						obj.loaded == true
+						let arr = data.data
+						obj.list = obj.list.concat(arr);
+						obj.page++;
+						//判断是否还有下一页,有是more  没有是nomore
+						if (obj.limit == arr.length) {
+							
+							obj.loadingType = 'more';
+						} else {
+							obj.loadingType = 'noMore';
+						}
+						obj.loaded = true
+					})
+					.catch(e => {
+						obj.loadingType = 'nomore';
+						// uni.hideLoading();
+					});
+			},
+			//跳转到详情
+			ToDetail(e) {
+				console.log(e)
+				let type ;
+				if(e.num == 1) {
+					type = 0
+				}else {
+					type = 1
+				}
+				let id = e.id;
+				uni.navigateTo({
+					url: '/pages/form/certificates?name=' + encodeURI(e.name) + '&sendtime=' + e.sendtime
+				});
+			}
+		}
+	};
+</script>
+
+<style lang="scss">
+	page {
+		background: #F2F2F2;
+		height: 100%;
+		padding-bottom: 25rpx;
+	}
+
+	.container {
+		height: 100%;
+
+		.top {
+			background-color: #FFFFFF;
+			height: 88rpx;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			font-size: 36rpx;
+			font-weight: 500;
+			color: #333333;
+		}
+
+		.swiper-box {
+			height: 100%;
+
+			.list-scroll-content {
+				height: 100%;
+			}
+		}
+	}
+
+	.scroll-list {
+		width: 100%;
+		overflow: hidden;
+		white-space: nowrap;
+		background-color: #ffffff;
+		font-size: 32rpx;
+
+		.scoll-box {
+			text-align: center;
+			display: inline-block;
+			margin: 0rpx 38rpx;
+			padding: 15rpx 0rpx;
+
+			.scoll-img {
+				width: 130rpx;
+				height: 85rpx;
+				border-radius: 100%;
+
+				image {
+					width: 85rpx;
+					height: 100%;
+					border-radius: 100%;
+				}
+			}
+
+			.scoll-name {
+				padding-top: 15rpx;
+			}
+
+			&.active {
+				color: #ef3d28;
+				border-bottom: 6rpx solid #ef3d28;
+			}
+		}
+	}
+
+	.order-item {
+		width: 100%;
+		padding: 0rpx 25rpx;
+		padding-top: 25rpx !important;
+
+		.list-cell {
+			// background-color: #ffffff;
+			border-radius: 20rpx;
+			width: 100%;
+			box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
+
+			.image {
+				width: 100%;
+				height: 300rpx;
+				border-top-left-radius: 25rpx;
+				border-top-right-radius: 25rpx;
+			}
+
+			.list-tpl {
+				padding: 25rpx 25rpx;
+				padding-bottom: 35rpx !important;
+				font-size: 34rpx;
+				color: #222222;
+				font-weight: 500;
+			}
+		}
+	}
 </style>

+ 196 - 176
pages/form/myDonate.vue

@@ -1,177 +1,197 @@
-<template>
-	<view class="content">
-		<view class="top">
-			我的捐赠
-		</view>
-		<view class="total">
-			<view class="total-left">
-				捐赠总额
-			</view>
-			<view class="total-right">
-				{{ sum }}元
-			</view>
-		</view>
-		<view class="box">
-		<view class="box-item" v-for="item in list" :key="item.id">
-			<view class="header">
-				明细
-			</view>
-			<view class="main">
-				<view class="main-left">
-					<view class="project">
-						{{item.intention}}
-					</view>
-					<view class="time">
-						<!-- {{item.pay_time}} -->
-						{{getRecTime(item.pay_time)}}
-					</view>
-				</view>
-				<view class="mian-right">
-					{{item.money}}元
-				</view>
-			</view>
-			
-		</view>
-		</view>
-		<empty v-if="list.length === 0"></empty>
-		<uni-load-more :status="loadingType"></uni-load-more>
-	</view>
-</template>
-
-<script>
-	import { MyDonaList } from '@/api/ask.js';
-	import empty from '@/components/empty';
-	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
-	export default{
-		components: {
-			empty,
-			uniLoadMore
-		},
-		data() {
-			return{
-				page: 1,
-				limit: 10,
-				sum:3,
-				loadingType: 'more',
-				list:[
-					// { id: 0, price: '500.00', project: '疫情防控', name: '韩**', phone: '139****3217', time: '2020-10-24 16:42:53' },
-					// { id: 1, price: '450.00', project: '会费缴纳', name: '江**', phone: '139****3217', time: '2020-10-24 16:42:53' },
-					// { id: 2, price: '398.00', project: '红十字人道事业(非定向捐赠)',name: '阮**', phone: '139****3217', time: '2020-10-24 16:42:53' },
-				]
-			}
-		},
-		onLoad() {
-			this.loadData();
-		},
-		methods:{
-			async loadData() {
-				let obj = this;
-				if (obj.loadingType === 'noMore') {
-					//防止重复加载
-					return;
-				}
-				// 修改当前对象状态为加载中
-				obj.loadingType = 'loading';
-				MyDonaList({
-					page: obj.page,
-					limit: obj.limit
-				}).then(({
-					data
-				}) => {
-					console.log(data)
-					obj.sum = data.sum
-					// obj.list = data.list
-					obj.list = obj.list.concat(data.list);
-					obj.page++;
-					if (obj.limit == data.length) {
-						obj.loadingType = 'more';
-					} else {
-						obj.loadingType = 'noMore';
-					}
-				})
-			},
-			getRecTime(timestamp, fmt) {
-				let d = new Date(timestamp * 1000),
-					// f = fmt || 'yyyy/MM/dd', 
-					f = fmt || 'yyyy.MM.dd hh:mm:ss',
-					o = {
-						'M+': d.getMonth() + 1, //月份 
-						'd+': d.getDate(), //日 
-						'h+': d.getHours(), //小时 
-						'm+': d.getMinutes(), //分 
-						's+': d.getSeconds(), //秒 
-						'q+': Math.floor((d.getMonth() + 3) / 3), //季度 
-						'S': d.getMilliseconds() //毫秒 
-					};
-				if (/(y+)/.test(f)) {
-					f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
-				}
-				for (let k in o) {
-					if (new RegExp('(' + k + ')').test(f)) {
-						f = f.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)));
-					}
-				}
-				return f;
-				console.log(f)
-			},
-		}
-	}
-</script>
-
-<style lang="scss">
-	
-	page, .content{
-		height: 100vh;
-		background-color: #FFFFFF;
-	}
-	.top{
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		background-color: #E63931;
-		color: #FFFFFF;
-		padding: 22rpx 0;
-	}
-	.total{
-		padding: 18rpx 24rpx;
-		display: flex;
-		justify-content: space-between;
-		border-bottom: 1rpx solid #e0e0e0;
-	}
-	.box{			
-		padding: 0 24rpx;
-		.box-item{
-			padding: 24rpx 0;
-			border-bottom: 1rpx solid #e0e0e0;
-			.header{
-				color: #999999;
-				font-size: 24rpx;
-			}
-			.main{
-				margin-top: 22rpx;
-				display: flex;
-				justify-content: space-between;
-				.mian-right{
-					display: flex;
-					flex-direction: column;
-					justify-content: flex-end;
-				}
-				.main-left{
-					.project{
-						color: #333;
-						font-size: 28rpx;
-					}
-					.time{
-						margin-top: 6rpx;
-						color: #999999;
-						font-size: 22rpx;
-					}
-				}
-			}
-		}
-		
-	}
-	
-
-	
+<template>
+	<view class="content">
+		<!-- <view class="top">
+			我的捐赠
+		</view> -->
+		<!-- <view class="total">
+			<view class="total-left">
+				捐赠总额
+			</view>
+			<view class="total-right">
+				{{ sum }}元
+			</view>
+		</view> -->
+		<view class="box">
+			<view class="box-item" v-for="item in list" :key="item.id" @click="lookzs(item)">
+				<view class="header">
+					明细
+				</view>
+				<view class="main">
+					<view class="main-left">
+						<view class="project">
+							{{item.order_name}}
+						</view>
+						<view class="time">
+							{{item.paytime_text.split(' ')[0]}}
+							<!-- {{getRecTime(item.paytime)}} -->
+						</view>
+					</view>
+					<view class="mian-right">
+						{{item.amount}}元
+					</view>
+				</view>
+
+			</view>
+		</view>
+		<empty v-if="list.length === 0"></empty>
+		<uni-load-more :status="loadingType"></uni-load-more>
+	</view>
+</template>
+
+<script>
+	import {
+		MyDonaList
+	} from '@/api/ask.js';
+	import empty from '@/components/empty';
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	export default {
+		components: {
+			empty,
+			uniLoadMore
+		},
+		data() {
+			return {
+				page: 1,
+				limit: 10,
+				sum: 3,
+				loadingType: 'more',
+				list: []
+			}
+		},
+		onLoad() {
+			this.loadData();
+		},
+		onReachBottom() {
+			this.loadData();
+		},
+		methods: {
+			// 查看证书
+			lookzs(item) {
+				let date = new Date(item.paytime * 1000)
+				let year = date.getFullYear()
+				let month = date.getMonth() >= 9 ? date.getMonth() + 1 : '0' + (date
+					.getMonth() + 1)
+				let day = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()
+				uni.navigateTo({
+					url: '/pages/form/donaSuccess?money=' + item.amount + '&name=' + encodeURI(item.contact) +
+						'&time=' + encodeURI(year + '年' + month + '月' + day + '日')
+				})
+			},
+			async loadData() {
+				let obj = this;
+				if (obj.loadingType === 'noMore' || obj.loadingType == 'loading') {
+					//防止重复加载
+					return;
+				}
+				// 修改当前对象状态为加载中
+				obj.loadingType = 'loading';
+				MyDonaList({
+					page: obj.page,
+					limit: obj.limit
+				}).then(({
+					data
+				}) => {
+					console.log(data)
+					// obj.sum = data.sum
+					obj.list = obj.list.concat(data.data);
+					obj.page++;
+					if (obj.limit == data.data.length) {
+						obj.loadingType = 'more';
+					} else {
+						obj.loadingType = 'noMore';
+					}
+				})
+			},
+			getRecTime(timestamp, fmt) {
+				let d = new Date(timestamp * 1000),
+					// f = fmt || 'yyyy/MM/dd', 
+					f = fmt || 'yyyy.MM.dd hh:mm:ss',
+					o = {
+						'M+': d.getMonth() + 1, //月份 
+						'd+': d.getDate(), //日 
+						'h+': d.getHours(), //小时 
+						'm+': d.getMinutes(), //分 
+						's+': d.getSeconds(), //秒 
+						'q+': Math.floor((d.getMonth() + 3) / 3), //季度 
+						'S': d.getMilliseconds() //毫秒 
+					};
+				if (/(y+)/.test(f)) {
+					f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
+				}
+				for (let k in o) {
+					if (new RegExp('(' + k + ')').test(f)) {
+						f = f.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k])
+							.length)));
+					}
+				}
+				console.log(f)
+				return f;
+
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	page,
+	.content {
+		height: 100vh;
+		background-color: #FFFFFF;
+	}
+
+	.top {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		background-color: #E63931;
+		color: #FFFFFF;
+		padding: 22rpx 0;
+	}
+
+	.total {
+		padding: 18rpx 24rpx;
+		display: flex;
+		justify-content: space-between;
+		border-bottom: 1rpx solid #e0e0e0;
+	}
+
+	.box {
+		padding: 0 24rpx;
+
+		.box-item {
+			padding: 24rpx 0;
+			border-bottom: 1rpx solid #e0e0e0;
+
+			.header {
+				color: #999999;
+				font-size: 24rpx;
+			}
+
+			.main {
+				margin-top: 22rpx;
+				display: flex;
+				justify-content: space-between;
+
+				.mian-right {
+					display: flex;
+					flex-direction: column;
+					justify-content: flex-end;
+				}
+
+				.main-left {
+					.project {
+						color: #333;
+						font-size: 28rpx;
+					}
+
+					.time {
+						margin-top: 6rpx;
+						color: #999999;
+						font-size: 22rpx;
+					}
+				}
+			}
+		}
+
+	}
 </style>

+ 187 - 164
pages/user/user.vue

@@ -7,21 +7,21 @@
 			</view>
 			<view class="name-box">
 				<view class="name-top">
-					{{userInfo.nickname}}
-				</view>
-				<view class="name-phone">
-					{{getPhone}}
+					{{userInfo.nickname}}<text v-if="userInfo && userInfo.level_name && userInfo.level > 1">{{'('+ userInfo.level_name +')'}}</text>
+				</view>
+				<view class="" v-if="userInfo && userInfo.level_name && userInfo.level > 1" style="color: #fff;font-size: 32rpx;">
+					<text v-if="vip_endtime < newTime">已到期,立即续费</text><text>{{userInfo.vip_endtime | time}} 到期<text @click="xuFei()">(续费)</text></text>
 				</view>
 			</view>
 		</view>
 		<view class="nav-wrapper">
-			<view class="nav-item flex" @click="tohelp">
+			<!-- <view class="nav-item flex" @click="tohelp">
 				<view class="item-left flex">
 					<image src="../../static/icon/i6.png" mode="" class="img1"></image>
 					<view class="title">求救记录</view>
 				</view>
 				<view class="item-right">
-					<image src="../../static/index/right.png" mode=""></image>
+					>
 				</view>
 			</view>
 			<view class="nav-item flex" @click="torreco">
@@ -29,73 +29,64 @@
 					<image src="../../static/icon/u-help.png" mode="" class="img2"></image>
 					<view class="title">救援记录</view>
 				</view>
-				<view class="item-right">
-					<image src="../../static/index/right.png" mode=""></image>
-				</view>
-			</view>
-			<view class="nav-item flex" @click="getAdress">
-				<view class="item-left flex">
-					<image src="../../static/index/user13.png" mode="" class="img2"></image>
-					<view class="title">常用地址</view>
-				</view>
-				<view class="item-right">
-					<image src="../../static/index/right.png" mode=""></image>
-				</view>
-			</view>
-			<!-- <view class="nav-item flex" @click="navTo('/pages/user/myaid')">
-				<view class="item-left flex">
-					<image src="../../static/icon/u-jz.png" mode="" class="img1"></image>
-					<view class="title">捐赠记录</view>
-				</view>
 				<view class="item-right">
 					>
 				</view>
-			</view> -->
-			<!-- <view class="nav-item flex" @click="tojkjl">
-				<view class="item-left flex">
-					<image src="../../static/icon/u-jk.png" mode="" class="img1"></image>
-					<view class="title">捐款记录</view>
-				</view>
-				<view class="item-right">
-					>
-				</view>
-			</view> -->
-			<view class="nav-item flex" @click="tocertificates">
+			</view> -->
+			<!-- <view class="nav-item flex" @click="navTo('/pages/form/myDonate')">
+				<view class="item-left flex">
+					<image src="../../static/icon/u-jz.png" mode="" class="img1"></image>
+					<view class="title">捐赠记录</view>
+				</view>
+				<view class="item-right">
+					>
+				</view>
+			</view> -->
+			<view class="nav-item flex" @click="navTo('/pages/form/myDonate')">
+				<view class="item-left flex">
+					<image src="../../static/icon/u-jk.png" mode="" class="img1"></image>
+					<view class="title">捐款记录</view>
+				</view>
+				<view class="item-right">
+					>
+				</view>
+			</view>
+			<view class="nav-item flex" @click="tocertificates" >
 				<view class="item-left flex">
 					<image src="../../static/icon/i9.png" mode="" class="img4"></image>
 					<view class="title">我的证书</view>
 				</view>
-				<view class="item-right">
-					<image src="../../static/index/right.png" mode=""></image>
-				</view>
-			</view>
-			<!-- <view class="nav-item flex" @click="navTo('/pages/applyHelp/cation')" >
-				<view class="item-left flex">
-					<image src="../../static/icon/i7.png" mode="" class="img4"></image>
-					<view class="title">申请帮扶</view>
-				</view>
-				<view class="item-right">
-					>
-				</view>
-			</view> -->
-			<!-- <view class="nav-item flex" @click="navTo('/pages/user/myFu')" >
-				<view class="item-left flex">
-					<image src="../../static/icon/u-m-f.png" mode="" class="img4"></image>
-					<view class="title">我的帮扶</view>
-				</view>
-				<view class="item-right">
-					>
-				</view>
-			</view> -->
-			<!-- @click="loginout"  -->
-			<!-- <view class="nav-item flex" @click="navTo('/pages/user/userSet')" >
-				<view class="item-left flex">
-					<image src="../../static/icon/u-set.png" mode="" class="img4"></image>
-					<view class="title">退出</view>
-				</view>
 				<view class="item-right">
 					>
 				</view>
+			</view>
+			<!-- <view class="nav-item flex" @click="navTo('/pages/applyHelp/cation')" >
+				<view class="item-left flex">
+					<image src="../../static/icon/i7.png" mode="" class="img4"></image>
+					<view class="title">申请帮扶</view>
+				</view>
+				<view class="item-right">
+					>
+				</view>
+			</view>
+			<view class="nav-item flex" @click="navTo('/pages/user/myFu')" >
+				<view class="item-left flex">
+					<image src="../../static/icon/u-m-f.png" mode="" class="img4"></image>
+					<view class="title">我的帮扶</view>
+				</view>
+				<view class="item-right">
+					>
+				</view>
+			</view> -->
+			<!-- @click="loginout"  -->
+			<!-- <view class="nav-item flex" @click="navTo('/pages/user/userSet')" >
+				<view class="item-left flex">
+					<image src="../../static/icon/u-set.png" mode="" class="img4"></image>
+					<view class="title">设置</view>
+				</view>
+				<view class="item-right">
+					>
+				</view>
 			</view> -->
 		</view>
 	</view>
@@ -110,35 +101,62 @@
 		saveUrl,
 		interceptor
 	} from '@/utils/loginUtils.js';
+	import { detail_training } from '@/api/train.js';
 	import {
-		detail_training
-	} from '@/api/train.js';
-	import {
-		userinfo,
+		userinfo,
 		logout
 	} from '@/api/user.js';
 	// #ifdef H5
 	import {
 		weixindata
 	} from '@/utils/wxAuthorized';
-	// #endif
+	// #endif
+	import { getVipmoney, createOrder } from '@/api/index.js'
 	export default {
 		data() {
 			return {
-				common_address: '',
-				name: '',
-				signDate: '',
-				id: 0,
-				is_over: 0,
-
+				common_address:'',
+				name:'',
+				signDate:'',
+				id:0,
+				is_over:0,
+				newTime: 0,
+				money: '',
+				mid: '',
 			}
+		},
+		filters: {
+			time(val) {
+				let str = '';
+				// console.log(val)
+				if (val) {
+					let date = new Date(val * 1000);
+					let Y = date.getFullYear();
+					let M = date.getMonth() + 1 > 9 ? (date.getMonth()+1) : '0' + (date.getMonth()+1);
+					let D = date.getDate() > 9 ? date.getDate() : '0' + date.getDate();
+					str = Y + '年' + M + '月' + D + '日';
+				}
+				return str;
+			},
 		},
-
 		onShow() {
-			console.log(this);
+			console.log(this);
+			let obj = this
 			//	判断是否已经登录
 			if (this.hasLogin) {
-				this.loadBaseData();
+				this.loadBaseData();
+				getVipmoney().then(({
+					data
+				}) => {
+					console.log(data, 'getVipmoney');
+					data.forEach(e => {
+						if (e.name == obj.userInfo.level_name) {
+							obj.money = e.pay_price;
+							obj.mid = e.id;
+							console.log(obj.money, obj.mid)
+						}
+					});
+				});
 			} else {
 				saveUrl();
 				uni.showModal({
@@ -155,9 +173,10 @@
 				});
 			}
 			this.type = this.userInfo.type;
-			this.common_address = this.userInfo.common_address
-			console.log(this.userInfo, 'wuwu')
-			console.log('点前保存的地址', this.common_address)
+			this.common_address = this.userInfo.common_address
+			let str = new Date()
+			this.newTime = str.getTime()
+			console.log('点前保存的地址',this.common_address)
 			// 保存当前页面
 		},
 		onReady() {
@@ -172,38 +191,81 @@
 			// })
 		},
 		computed: {
-			...mapState('user', ['hasLogin', 'userInfo']),
-			getPhone() {
-				return this.userInfo.mobile.substring(0, 3) + '****' + this.userInfo.mobile.substring(7)
-
-
-			}
+			...mapState('user', ['hasLogin', 'userInfo']),
+			...mapState(['weichatObj']),
 		},
 		methods: {
-			...mapMutations('user', ['setUserInfo', 'logout']),
-			loginout() {
-				let obj = this;
-				uni.showModal({
-					content: '确定要退出登录么',
-					success: e => {
-						if (e.confirm) {
-							logout({}).then(e => {
-									obj.logout();
-									uni.switchTab({
-										url: '/pages/index/index'
-									})
-								})
-								.catch(e => {
-									console.log(e);
-								});
-						}
-					}
-				});
-			},
-			tojkjl() {
-				uni.navigateTo({
-					url: '/pages/user/jkjl'
-				})
+			...mapMutations('user', ['setUserInfo','logout']),
+			// 续费
+			xuFei() {
+				let obj = this
+				uni.showModal({
+					title: '提示',
+					content: '续费' + obj.userInfo.level_name + '需要缴纳' + obj.money + '元年费,是否续费',
+					success: function(res) {
+						if (res.confirm) {
+							console.log('用户点击确定');
+							createOrder({
+								level_id: obj.mid,
+								body: '红会年费',
+								pay_type: 0,
+								// name: obj.name,
+								pay_price: obj.money,
+								from: 'weixin'
+							}).then(({data}) =>{
+								let res = data.jsConfig;
+								obj.weichatObj.chooseWXPay({
+									timestamp: res.timestamp,
+									nonceStr: res.nonceStr,
+									package: res.package,
+									signType: res.signType,
+									paySign: res.paySign,
+									success: function(res) {
+										// uni.navigateTo({
+										// 	url: '../joinSuc/joinNow'
+										// });
+										obj.loadBaseData()
+										uni.showModal({
+											title:'提示',
+											content: '续费成功'
+										})
+									},
+									fail: function(res) {
+										console.log(res, "失败")
+										console.log(res.errMsg)
+									}
+								});
+							})
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				});
+			},
+			// 登出
+			loginout() {
+				let obj = this;
+				uni.showModal({
+					content: '确定要退出登录么',
+					success: e => {
+						if (e.confirm) {
+							logout({}).then(e => {
+									obj.logout();
+									uni.switchTab({
+										url: '/pages/index/index'
+									})
+								})
+								.catch(e => {
+									console.log(e);
+								});
+						}
+					}
+				});
+			},
+			tojkjl() {
+				uni.navigateTo({
+					url: '/pages/user/jkjl'
+				})
 			},
 			loadBaseData() {
 				userinfo({}).then(({
@@ -228,11 +290,6 @@
 					url: '/pages/user/myFu'
 				})
 			},
-			getAdress(){
-				uni.navigateTo({
-					url:'/pages/applic/chooseAddress'
-				})
-			},
 			torreco() {
 				uni.navigateTo({
 					url: '/pages/applic/rescuerecords'
@@ -252,10 +309,10 @@
 				uni.navigateTo({
 					// pages/form/certificatesList
 					// url: '/pages/form/certificates?name=' + this.name + '&signDate=' + this.signDate
-					url: '/pages/form/certificatesList'
+					url: '/pages/form/certificatesList' 
 				})
 			},
-			navTo(url) {
+			navTo(url) {
 				console.log(url)
 				uni.navigateTo({
 					url: url
@@ -267,16 +324,14 @@
 
 <style lang="scss">
 	page {
-		min-height: 100%;
+		min-height: 100%;
 		height: auto;
 		background: #fff;
 	}
-
 	.content {
 		line-height: 1.5;
-		background-color: #fff;
+		background-color: #fff;
 		height: 100%;
-
 		.top {
 			width: 750rpx;
 			height: 312rpx;
@@ -289,7 +344,6 @@
 			justify-content: center;
 			background-image: url(../../static/img/userbg.png);
 			background-size: 100% 100%;
-
 			.avater {
 				width: 150rpx;
 				height: 150rpx;
@@ -305,33 +359,23 @@
 			.name-box {
 				// flex: 1;
 				padding-top: 25rpx;
-				display: flex;
-				flex-direction: column;
-				align-items: center;
-				justify-content: center;
-
 				.name-top {
-
+					font-size: 42rpx;
+					font-weight: 400;
+					margin-bottom: 15rpx;
 					font-size: 32rpx;
 					font-family: PingFang SC;
 					font-weight: 500;
-					color: #FFFFFF;
-				}
-
-				.name-phone {
-					font-size: 26rpx;
-					font-family: PingFang SC;
-					font-weight: 500;
-					color: #FFFFFF;
+					color: #FFFFFF;
+					text-align: center;
 				}
-
-				.name-bottom {
+				.name-bottom{
 					margin-top: 16rpx;
 					display: flex;
 					align-items: center;
 					// justify-content: center;
-
-					.nameInfo {
+					
+					.nameInfo{
 						color: #FFFFFF;
 						padding: 6rpx 16rpx;
 						border: 1rpx solid #FFFFFF;
@@ -420,8 +464,7 @@
 		.tt {
 			display: flex;
 			flex-wrap: wrap;
-			padding-left: 32rpx;
-
+			padding-left:32rpx;
 			.tt-box {
 				width: 206rpx;
 				height: 206rpx;
@@ -432,12 +475,10 @@
 				justify-content: center;
 				margin-right: 35rpx;
 				margin-bottom: 30rpx;
-
 				image {
 					width: 64rpx;
 					height: 64rpx;
 				}
-
 				.tt-txt {
 					font-size: 24rpx;
 					font-family: PingFang SC;
@@ -449,7 +490,6 @@
 
 		}
 	}
-
 	.nav-wrapper {
 		width: 678rpx;
 		// height: 560rpx;
@@ -458,51 +498,41 @@
 		border-radius: 20rpx;
 		margin: 32rpx auto 0;
 		color: #555555;
-
 		.nav-item {
 			height: 115rpx;
 			border-bottom: 1rpx #F6F6F6 solid;
-
 			&:last-of-type {
 				border-bottom: none;
 			}
-
 			justify-content: space-between;
 			align-items: center;
 			padding: 0 36rpx 0 40rpx;
-
 			.item-left {
-
+				
 				align-items: center;
-
 				image {
 					// background-color: red;
 				}
-
 				.img1 {
 					width: 34rpx;
 					height: 34rpx;
 					margin-right: 21rpx;
 				}
-
 				.img2 {
 					width: 36rpx;
 					height: 32rpx;
 					margin-right: 19rpx;
 				}
-
 				.img3 {
 					width: 28rpx;
 					height: 36rpx;
 					margin-right: 25rpx;
 				}
-
 				.img4 {
 					width: 36rpx;
 					height: 28rpx;
 					margin-right: 19rpx;
 				}
-
 				.title {
 					font-size: 32rpx;
 					font-family: PingFang SC;
@@ -510,15 +540,8 @@
 					color: #555555;
 				}
 			}
-
 			.item-right {
-				
-				width: 16rpx;
-				height: 30rpx;
-				image{
-					width: 100%;
-					height: 100%;
-				}
+				line-height: 115rpx;
 			}
 		}
 	}

+ 3 - 1
store/index.js

@@ -24,7 +24,9 @@ const store = new Vuex.Store({
 		// shareData:'',//分享信息
 		project_area: 0,
 		sys_appid: 'xnshszh2022120',//系统AppID
-		sys_appsecret: '2022120xnshszh',//系统AppSecret
+		sys_appsecret: '2022120xnshszh',//系统AppSecret
+		baseName: '咸宁市红十字会',
+		shareDesc: '弘扬红十字精神,传播红十字观念,宣传红十字工作,这是一个汇聚爱心、救助之家力量的平台!'
 	},
 	mutations: {
 	

+ 4 - 4
utils/wxAuthorized.js

@@ -183,10 +183,10 @@ function shareLoad(config) {
 		let url = window.location.href;
 		url = url.replace(/[\?,&]{0,1}from=singlemessage/g, '');
 		mess = {
-			title: shareData.title,
-			link: url, // 分享链接
-			imgUrl: shareData.img, // 分享图标
-			desc: shareData.synopsis,
+			title: store.state.baseName,
+			link: url, // 分享链接
+			imgUrl: store.state.baseURL + '/index/static/img/002.png', // 分享图标
+			desc: store.state.shareDesc,
 			success: function() {},
 			fail: function(e) {
 				console.log(e);