Browse Source

2023-12-7 线上实战营报名

zhiquz 1 year ago
parent
commit
212378b6a9
6 changed files with 335 additions and 117 deletions
  1. 17 5
      apis/szy.js
  2. 1 1
      pages/index-my/index-my.vue
  3. 1 1
      pages/index/index.vue
  4. 3 1
      pages/payment/information.vue
  5. 312 108
      pages/payment/payment.vue
  6. 1 1
      store/modules/app.js

+ 17 - 5
apis/szy.js

@@ -2,12 +2,9 @@ import request from '@/common/util/request'
 
 /*实战营报名*/
 
-export const _API_payment = data => request.post('/pays/pays ', data) // 报名支付
-export const _API_SearchStatus = data => request.post('/pays/GetStatus', data) // 查询支付状态
-export const GetEnrollUserAddress = data => request.post('/pays/GetAddress', data) // 报名前获取收货地址
-export const UpdateAddAddress = data => request.post('/pays/UpdateAddAddress', data) // 提交收货地址
-export const GetEnrollInfo = data => request.get('/pays/GetEnrollInfo', data) // 获取报名信息
+export const _API_payment = data => request.post('/pays/pays ', data) // 获取名额
 
+export const GetEnrollInfo = data => request.get('/pays/GetEnrollInfo', data) // 获取报名信息
 
 
 
@@ -18,3 +15,18 @@ export const _API_QuickBankPay = data => request.post('/HuiFuSZ/QuickBankPay', d
 export const _API_QuickBankSms = data => request.post('/HuiFuSZ/QuickBankSms', data) // 携带验证码支付
 
 export const _API_CheckStatus = data => request.post('/HuiFuSZ/CheckStatus', data) // 根据id查询支付状态
+
+/*线上实战营报名*/
+
+export const _API_HuiFuCheck_online = data => request.get('/HuiFuSZOnline/check', data) // 获取绑卡情况
+
+export const _API_QuickBankPay_online = data => request.post('/HuiFuSZOnline/QuickBankPay', data) // 发起支付验证码
+
+export const _API_QuickBankSms_online = data => request.post('/HuiFuSZOnline/QuickBankSms', data) // 携带验证码支付
+
+export const _API_CheckStatus_online = data => request.post('/HuiFuSZOnline/CheckStatus', data) // 根据id查询支付状态
+
+
+export const GetEnrollInfo_online = data => request.post('/HuiFuSZOnline/GetEnrollInfo', data) // 获取报名信息
+export const GetEnrollUserAddress = data => request.post('/HuiFuSZOnline/GetAddress', data) // 报名后获取收货地址
+export const UpdateAddAddress = data => request.post('/HuiFuSZOnline/UpdateAddAddress', data) // 提交收货地址

+ 1 - 1
pages/index-my/index-my.vue

@@ -90,7 +90,7 @@
 		// 	url: 'address-manage/address-manage'
 		// },
 		{
-			name: '实战营报名',
+			name: '线上实战营',
 			icon: '8.png',
 			url: 'payment/payment'
 		},

+ 1 - 1
pages/index/index.vue

@@ -217,7 +217,7 @@
 				}
 				let teamModules = []
 				teamModules.push({
-					name: '实战营报名',
+					name: '线上实战营',
 					icon: require(`@/${requireBaseUrl}3_4.png`),
 					url: 'payment/payment'
 				})

+ 3 - 1
pages/payment/information.vue

@@ -17,7 +17,7 @@
 					<text>手机号</text>
 					<text class="star">*</text>
 				</view>
-				<input v-model="address.mobile" type="number" class="paybox-input" placeholder-class="input_placeholder" placeholder="请填写手机号码" maxlength="11" />
+				<input v-model="address.mobile" class="paybox-input" placeholder-class="input_placeholder" placeholder="请填写手机号码" maxlength="11" />
 			</view>
 			<view class="paybox-top">
 				<view class="title">
@@ -88,6 +88,7 @@
 							this.local =`${data.province}-${data.city}-${data.area}`
 							this.pickerDefaultVal = [ data.province, data.city, data.area ]
 							this.title = true
+							console.log(data)
 						} else {
 							this.title = false
 						}
@@ -145,6 +146,7 @@
 				UpdateAddAddress(address).then(res => {
 					if (res.code === 200) {
 						uni.toast('保存成功')
+						uni.navigateBack()
 					} else {
 						uni.showModal({
 							content: res.message || '提交失败',

+ 312 - 108
pages/payment/payment.vue

@@ -1,21 +1,29 @@
 <template>
-	<view style="padding-top: 50rpx;">
-		<view class="top" v-if="!showSignup">
+	<view>
+		<view class="top" v-show="!showSignup">
 			<image src="https://qnys.chuliu.cc/daweiboshi_szy/1_1615541900_nrG1vctYn8.jpg"
 				mode="widthFix" style="width: 750rpx;margin-bottom: 60rpx;"></image>
 			<view class="title">
-				第{{ data.season }}届大卫博士创业实战营
+				第{{ data.season }}届大卫博士创业实战营(线上)
 			</view>
 			<view class="time">
 				举办时间:{{ data.start + '-' + data.end }}
 			</view>
-			<view v-if="data.status == 1" class="btnSig gray">已获取名额</view>
-			<view v-else class="btnSig" :class="status ? 'red' : 'gray'" v-throttle="2000" @click="singup">点击获取名额</view>
+			<view class="item">
+				<input maxlength="6" type="number" v-model="sms_code" placeholder="请输入验证码" />
+				<view v-throttle="2000" class="countdown"  :class="status ? 'red2' : 'gray2'" @tap="getCode">
+					{{ countDown ? `重新获取(${countDown}s)` : '获取验证码' }}
+				</view>
+			</view>
+			<view v-throttle="2000" class="pay_btnSig" :class="status ? 'red' : 'gray'" @click="singup">{{ status ? `支付${data.cost}报名` : '立即支付' }}</view>
+		</view>
+		<view v-show="!showSignup && id" class="payB" @click="goUnbank">
+			支付不了,重新绑定?
 		</view>
-		<view class="voucher" v-else>
+		<view v-show="showSignup" class="voucher">
 			<image src="../../static/new_my/bg.png" class="bgImg" mode="widthFix" style="width: 750rpx;"></image>
 			<view class="bgImg">
-				<text style="margin-top: 30rpx;">第{{ data.season }}届大卫博士创业实战营</text>
+				<text style="margin-top: 30rpx;">第{{ data.season }}届大卫博士创业实战营(线上)</text>
 			</view>
 			<view class="voucher_con">
 				<view class="voucher_icon">
@@ -25,15 +33,21 @@
 					<view class="timed">
 						举办时间:{{ data.start+ '-' +data.end }}
 					</view>
-					<view class="timed">
-						<view class="left">人脸照片:</view>
-						<view class="right">
-							<image v-if="data.path" :src="data.path" @click="initFace" mode="widthFix" style="width: 160rpx;height: 160rpx;">
-							</image>
-							<image v-else src="../../static/icon/uploadF.png" mode="widthFix" style="width: 160rpx;"
-								@click="initFace"></image>
-						</view>
+				</view>
+				<view class="info" v-show="data.pay_status">
+					<view>
+						<text>收货人:</text>
+						<text>{{ info.username }}</text>
 					</view>
+					<view>
+						<text>手机号:</text>
+						<text>{{ info.mobile }}</text>
+					</view>
+					<view>
+						<text>收货地址:</text>
+						<text>{{ info.local }}</text>
+					</view>
+					<navigator url="./information" class="info_btn">编辑地址</navigator>
 				</view>
 			</view>
 		</view>
@@ -42,9 +56,12 @@
 
 <script>
 	import {
-		_API_payment,
-		_API_SearchStatus,
-		GetEnrollInfo
+		GetEnrollInfo_online,
+		_API_HuiFuCheck_online,
+		_API_QuickBankPay_online,
+		_API_QuickBankSms_online,
+		_API_CheckStatus_online,
+		GetEnrollUserAddress
 	} from '@/apis/szy.js';
 	import {
 		UploadSzyImg
@@ -53,6 +70,7 @@
 		data() {
 			return {
 				status: false,
+				info: {},
 				data: {
 					season: '',
 					start: '',
@@ -64,10 +82,15 @@
 				},
 				noClick: true,
 				showSignup: false,
+				countDown: 0, // 倒计时,
+				sms_code: '', // 验证码,
+				id: '',
+				payId: ''
 			}
 		},
-		onLoad() {
+		onShow() {
 			this.getInfo()
+			this.getBank()
 			// this.getData()
 		},
 		computed: {
@@ -79,72 +102,192 @@
 			this.getInfo()
 		},
 		methods: {
-			initFace() {
-				uni.chooseImage({
-						count: 1, //默认9
-						sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-						sourceType: ['album'], //从相册选择
-						success: res => {
-							const tempFilePaths = res.tempFilePaths;
-							uni.uploadFile({
-								url: UploadSzyImg,
-								filePath: tempFilePaths[0],
-								name: 'image',
-								header: {
-									Authorization: 'Bearer ' + this.$store.state.app.token
-								},
-								success: (res) => {
-									const data = JSON.parse(res.data)
-									if (data.code == 200) {
-										this.getInfo()
-									} else {
-										uni.showToast({
-											title: res.message || '上传失败',
-											icon: 'none'
+			// 获取地址
+			getAddress() {
+				GetEnrollUserAddress().then(res => {
+					if (res.code === 200) {
+						this.info = res.data
+						const data = res.data
+						this.info.local = data.province + data.city + data.area + data.address
+					} else {
+						uni.showModal({
+							content: res.message || '获取失败',
+							showCancel: false
+						})
+					}
+				})
+			},
+			// 去重新绑定
+			goUnbank() {
+				uni.navigateTo({
+					url: '../zbs/unBank?type=2'
+				})
+			},
+			// 查询绑卡信息
+			getBank() {
+				uni.showLoading()
+				_API_HuiFuCheck_online().then(res => {
+					uni.hideLoading()
+					if (res.code == 200) {
+						this.id = res.data.id
+					} else if (res.code == 50014) {
+						this.id = ''
+						uni.showModal({
+							title: '提示',
+							content: '检测到您还未绑定银行卡,请前往绑定',
+							showCancel: false,
+							success: (res) => {
+								if (res.confirm) {
+									uni.navigateTo({
+										url: '../zbs/form?type=2'
+									})
+								}
+							}
+						})
+						return
+					} else {
+						this.id = ''
+						uni.showModal({
+							content: res.message || '获取失败',
+							showCancel: false
+						});
+						return false;
+					}
+				})
+			},
+			// 1.发送验证码
+			getCode() {
+				if (!this.status) {
+					return
+				}
+				if (!this.id) {
+					uni.showModal({
+						content: '未绑定银行卡',
+						showCancel: false
+					})
+					return
+				}
+				let that = this
+				_API_QuickBankPay_online({ id: this.id }).then(res => {
+					if (res.code == 200) {
+						uni.showModal({
+							content: '验证码发送成功',
+							showCancel: false,
+							success: (e) => {
+								if (e.confirm) {
+									that.payId = res.data.id
+									that.countDown = 180;
+									that.timer = setInterval(() => {
+										that.countDown--;
+										if (!that.countDown) {
+											that.countDown = 0;
+											clearInterval(that.timer);
+										}
+									}, 1000);
+								}
+							}
+						})
+					} else {
+						uni.showModal({
+							content: res.message || '获取验证码失败',
+							showCancel: false
+						});
+						return false;
+					}
+				})
+			},
+			// 2. 携带验证码支付
+			singup() {
+				let that = this
+				if (!this.status) {
+					return
+				}
+				if (!this.sms_code) {
+					uni.showModal({
+						content: '请先输入验证码',
+						showCancel: false
+					})
+					return
+				}
+				uni.showModal({
+					title: '提示',
+					content: '确定要支付吗?',
+					success: (res) => {
+						if (res.confirm) {
+							_API_QuickBankSms_online({ id: that.payId, sms_code: that.sms_code }).then(res => {
+								if (res.code == 200) {
+									if (res.data.status == 0) {
+										that.SearchStatus()
+									} else if (res.data.status == 1) {
+										uni.navigateBack({
+										  delta: 2
 										})
 									}
-								},
-								fail: err => {
-									uni.showToast({
-										title: '上传失败1',
-										icon: 'none'
+								} else {
+									uni.showModal({
+										title: '失败',
+										content: res.message || '获取失败',
+										showCancel: false
 									})
+									return false;
 								}
-							});
+							})
+								.catch(err => {})
+								.finally(() => {
+									setTimeout(() => {}, 3000)
+								})
 						}
-					})
-			},
-			getTimes(data) {
-				var time = new Date(data)
-				var year = time.getFullYear()
-				var month = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
-				var day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
-				var today = year + '.' + month + '.' + day;
-				return today;
+					}
+				})
 			},
-			// 支付状态
+			// 3. 查询支付状态
 			SearchStatus() {
+				let that = this
 				uni.showLoading({
+				    title: '查询支付状态中...',
 				    mask: true
-				})
-				_API_SearchStatus().then(res => {
-					uni.hideLoading()
+				});
+				_API_CheckStatus_online({ id: this.payId }).then(res => {
 					if (res.code == 200) {
-						this.getInfo()
+						if (res.data.status == 1) {
+							uni.hideLoading()
+							uni.navigateBack({
+							  delta: 2
+							})
+						} else {
+							that.SearchStatus()
+						}
 					} else {
+						uni.hideLoading()
 						uni.showModal({
-							content: res.message || '获取失败',
+							content: res.message || '查询失败',
 							showCancel: false
 						})
 					}
+				}).catch(err => {
+					uni.hideLoading()
+					uni.showModal({
+						content: err || '查询失败',
+						showCancel: false
+					})
 				})
 			},
+			
+			getTimes(data) {
+				var time = new Date(data)
+				var year = time.getFullYear()
+				var month = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
+				var day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
+				var today = year + '.' + month + '.' + day;
+				return today;
+			},
+			
 			// 获取赛季信息
 			getInfo() {
-				GetEnrollInfo().then(res => {
+				GetEnrollInfo_online().then(res => {
 					if (res.code == 200) {
 						// res.data.enroll_start_time = "2023-12-05 10:30:00" // 报名时间
-						
+						// res.data.status = 0
 						this.data = res.data
 						uni.setStorageSync("szy_data", res.data)
 						this.data.start = this.getTimes(res.data.start_time)
@@ -156,12 +299,8 @@
 							this.status = true
 						}
 						if (res.data.status == 1 && res.data.pay_status == 1) {
+							this.getAddress()
 							this.showSignup = true
-						} else if (res.data.status == 1 && res.data.pay_status == 0) {
-							this.showSignup = false
-							uni.navigateTo({
-								url: './singup'
-							})
 						} else {
 							this.showSignup = false
 						}
@@ -173,44 +312,98 @@
 					}
 				})
 			},
-			singup() {
-				if (!this.status && !this.data.status) {
-					return
-				}
-				let that = this
-				uni.showModal({
-					title: '提示',
-					content: '确定要获取名额吗?',
-					success: (res) => {
-						if (res.confirm) {
-							_API_payment().then(res => {
-								if (res.code == 200) {
-										// that.SearchStatus()
-										uni.navigateTo({
-											url: './singup'
-										})
-									} else {
-										uni.showModal({
-											title: '失败',
-											content: res.message || '获取失败',
-											showCancel: false
-										})
-										return false;
-									}
-								})
-								.catch(err => {})
-								.finally(() => {
-									setTimeout(() => {}, 3000)
-							})
-						}
-					}
-				})
-			}
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
+	.payB {
+		margin-top: 30rpx;
+		text-align: center;
+		color: #FF232C;
+		font-weight: bold;
+	}
+	.pay {
+		margin: 0 30rpx 0 30rpx;
+		border-radius: 16rpx;
+		background-color: #fff;
+		padding: 40rpx 20rpx 40rpx 20rpx;
+		&_title {
+			font-size: 34rpx;
+			font-weight: bold;
+		}
+		
+		&_time {
+			margin-top: 20rpx;
+			font-size: 32rpx;
+		}
+		
+		&_btnSig {
+			margin: 50rpx auto 0;
+			width: 600rpx;
+			line-height: 88rpx;
+			border-radius: 44rpx;
+			text-align: center;
+			color: #fff;
+			font-size: 32rpx;
+		}
+		.red {
+			background: linear-gradient(93deg, #FF232C 0%, #FF571B 100%);
+		}
+		.gray {
+			background-color: #E1E1E1;
+		}
+	}
+	.item {
+		@include flex();
+		height: 104rpx;
+		box-sizing: border-box;
+		color: $app-sec-text-color;
+		background: #F8F8F8;
+		margin: 50rpx 0 40rpx 0;
+		border-radius: 8rpx;
+		padding-left: 24rpx;
+	
+	
+	
+		.login_icon {
+			width: 36rpx;
+			height: 44rpx;
+		}
+	
+		.icon,
+		.cuIcon-roundclosefill {
+			margin: 0 20rpx;
+			font-size: 36rpx;
+		}
+	
+		input {
+			flex: 1;
+			height: 104rpx;
+			margin-left: 15rpx;
+		}
+	
+		.countdown {
+			@include flex();
+			height: 60rpx;
+			font-size: 24rpx;
+			padding: 0 20rpx;
+			margin-right: 20rpx;
+			border-radius: 33rpx;
+	
+			text {
+				margin-left: 8rpx;
+			}
+		}
+		.red2 {
+			border: 2rpx solid #FB231F;
+			color: $base-color;
+		}
+		.gray2 {
+			border: 2rpx solid #999;
+			color: #999;
+		}
+	}
 	.top {
 		margin: 0 30rpx 0 30rpx;
 		border-radius: 16rpx;
@@ -311,11 +504,9 @@
 
 				.timed {
 					margin-top: 36rpx;
-					font-size: 30rpx;
+					font-size: 40rpx;
 					font-weight: bold;
-					// color: #FF0000;
-					display: flex;
-					padding-left: 60rpx;
+					color: #FF0000;
 				}
 			}
 
@@ -333,14 +524,27 @@
 			.info {
 				margin: 68rpx 50rpx 40rpx 50rpx;
 				color: #333333;
-
+			
 				text {
 					font-size: 32rpx;
 				}
-
+			
 				>view {
 					margin-top: 20rpx;
 				}
+				&_btn {
+					margin: 30rpx auto 0 !important;
+					width: 388rpx;
+					line-height: 80rpx;
+					text-align: center;
+					background: #FFF4F3;
+					border: 2rpx solid #FB231F;
+					opacity: 1;
+					border-radius: 44rpx;
+					font-size: 30rpx;
+					font-weight: bold;
+					color: #FB231F;
+				}
 			}
 		}
 	}

+ 1 - 1
store/modules/app.js

@@ -8,7 +8,7 @@ export default {
 		indextabbarHeight: uni.upx2px(98), // 首页 tabbar 高
 		token: uni.getStorageSync('token'),
 		// token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkuYXBwLmNsaXUuY2NcL2FwaVwvbG9naW5cL2dldF91c2VyX29wZW5pZCIsImlhdCI6MTY5ODgxNTc0OSwiZXhwIjoxNjk5Njc5NzQ5LCJuYmYiOjE2OTg4MTU3NDksImp0aSI6InRMU25oSTdmMHVOZEZFamgiLCJzdWIiOjM5NTE2LCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.9W32gsVAoq1N1P1W38SCc-H8lCqKLxUfhWwHaGWszoM',
-		// token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkuYXBwLmNsaXUuY2NcL2FwaVwvbG9naW5cL2dldF91c2VyX29wZW5pZCIsImlhdCI6MTcwMTI1NDY5NSwiZXhwIjoxNzAyMTE4Njk1LCJuYmYiOjE3MDEyNTQ2OTUsImp0aSI6IjJNbXlnNjlGdVBUSVprYkQiLCJzdWIiOjc1NjYwLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.qH90YDzqfzozW4N23DeN_ysFLs8NDOxG5P_WXJvF38g',
+		token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkuYXBwLmNsaXUuY2NcL2FwaVwvbG9naW5cL2dldF91c2VyX29wZW5pZCIsImlhdCI6MTcwMTI1NDY5NSwiZXhwIjoxNzAyMTE4Njk1LCJuYmYiOjE3MDEyNTQ2OTUsImp0aSI6IjJNbXlnNjlGdVBUSVprYkQiLCJzdWIiOjc1NjYwLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.qH90YDzqfzozW4N23DeN_ysFLs8NDOxG5P_WXJvF38g',
 	},
 	mutations: {
 		LOGIN(state, payload) { // 登录 保存 token