Browse Source

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 3 months ago
parent
commit
66bbb8b610
3 changed files with 53 additions and 23 deletions
  1. 39 15
      pages/pay/svip.vue
  2. 11 7
      pages/study/lookShipin.vue
  3. 3 1
      pages/unitTest/index.vue

+ 39 - 15
pages/pay/svip.vue

@@ -20,10 +20,10 @@
 		<view class="open-svip-box">
 			<view class="svip-price-box" v-if="cardId ==1">
 				<view>原价:<text class="original-price">¥499</text></view>
-				<view class="discount-price">活动价:¥299</view>
+				<view class="discount-price">活动价:¥399</view>
 			</view>
 			<view class="svip-price-box" v-if="cardId ==2">
-				<view>原价:<text class="original-price">¥399</text></view>
+				<view>原价:<text class="original-price">¥299</text></view>
 				<view class="discount-price">活动价:¥199</view>
 			</view>
 			<radio-group @change="radioChange" class="pay-type-box">
@@ -103,6 +103,7 @@
 		}
 	];
 	onLoad((options) => {
+		console.log('jinruaaaaaaaaaaaaa');
 		cardId.value = options.cardId
 		formPage.value = options.formPage
 	})
@@ -139,6 +140,11 @@
 
 	function creatOrder(data) {
 
+
+		uni.showLoading({
+			title: '',
+			mask: true
+		});
 		if (payType.value == 'weixin') {
 			let req = {
 				cardId: cardId.value
@@ -150,6 +156,7 @@
 				orderPayWx({
 					id: res.data.id
 				}).then(res2 => {
+					uni.hideLoading();
 					console.log('res2', res2);
 					uni.requestPayment({
 						"provider": "wxpay",
@@ -163,22 +170,26 @@
 							"sign": res2.data.sign // 签名,这里用的 MD5 签名
 						}, //此处为服务器返回的订单信息字符串
 						success: function(res) {
-							var rawdata = JSON.parse(res.rawdata);
-							console.log('支付成功');
-							console.log('rawdata', rawdata);
+
+							//var rawdata = JSON.parse(res.rawdata);
+							//	console.log('res',res);	
+							//	console.log('支付成功');
+							//	console.log('rawdata', rawdata);
 							uni.showLoading({
 								title: '会员开通中,请稍后...'
 							});
 							orderCheck({
 								id: orderId.value
 							}).then(res3 => {
-								console.log('res3',res3);
+								console.log('res3', res3);
 								if (res3.code == 0 && res3.data) {
-									
+
 									genggaiVip()
 								} else {
 									setTimeout(() => {
-										orderCheck({id:orderId.value}).then(res4 => {
+										orderCheck({
+											id: orderId.value
+										}).then(res4 => {
 											if (res4.code == 0 && res4
 												.data) {
 												genggaiVip()
@@ -202,15 +213,21 @@
 
 						},
 						fail: function(err) {
+							uni.hideLoading();
 							//  toast('支付失败:' + JSON.stringify(err));
 							console.log('支付失败:' + JSON.stringify(err));
 						}
 					});
 				}).catch((error) => {
+					uni.hideLoading();
 					console.log(error);
 				})
 
 
+			}).catch((err) => {
+				uni.hideLoading();
+				toast("订单创建失败")
+				return false
 			})
 		} else {
 			let req = {
@@ -218,18 +235,20 @@
 			}
 			orderAdd(req).then(res => {
 				console.log('res', res);
-					orderId.value = res.data.id
+				orderId.value = res.data.id
 				orderPayAli({
 					id: res.data.id
 				}).then(res2 => {
 					console.log('res2', res2);
+					uni.hideLoading();
 					uni.requestPayment({
 						"provider": "alipay",
 						"orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
 						success: function(res) {
-							var rawdata = JSON.parse(res.rawdata);
-							console.log('支付成功');
-							console.log('rawdata', rawdata);
+							// var rawdata = JSON.parse(res.rawdata);
+							// console.log('支付成功');
+							// console.log('rawdata', rawdata);
+
 							uni.showLoading({
 								title: '会员开通中,请稍后...'
 							});
@@ -240,7 +259,9 @@
 									genggaiVip()
 								} else {
 									setTimeout(() => {
-										orderCheck({id:orderId.value}).then(res4 => {
+										orderCheck({
+											id: orderId.value
+										}).then(res4 => {
 											if (res4.code == 0 && res4
 												.data) {
 												genggaiVip()
@@ -265,11 +286,14 @@
 						fail: function(err) {
 							//  toast('支付失败:' + JSON.stringify(err));
 							console.log('支付失败:' + JSON.stringify(err));
+							uni.hideLoading();
 						}
 					});
 				})
-
-
+			}).catch((err) => {
+				uni.hideLoading();
+				toast("订单创建失败")
+				return false
 			})
 		}
 

+ 11 - 7
pages/study/lookShipin.vue

@@ -211,6 +211,7 @@
 				this.goUpPage()
 			},
 			goNext() {
+				debugger
 				this.$refs.popupRef.close();
 				if (!cacheManager.get('auth')) {
 					console.log(this);
@@ -218,17 +219,20 @@
 				} else {
 					const AuthCode = getUserIdentity();
 					console.log(AuthCode);
-					if (AuthCode == 'Not-Vip') {
-						this.$refs.svipDialogRef.handleShow();
-						return false
-					}
+					// if (AuthCode == 'Not-Vip') {
+					// 	this.$refs.svipDialogRef.handleShow();
+					// 	return false
+					// }
 					//	debugger
 					Number(this.jieId++)
+					console.log('this.pageData',this.pageData);
 					let currentObject = this.cacheZhangInfo.zhangList[this.cacheCurrentZhangIndex].jieList.find(item =>
 						item.jieId == this.jieId);
-					this.pageData = {
-						...currentObject
-					}
+						if(currentObject){
+							this.pageData = {
+								...currentObject
+							}
+						}
 					// lastFlag是否是本章最后一节,0否1是  type,1视频,2试题
 					if (this.pageData.lastFlag == 1 && this.pageData.type == 2) {
 						uni.redirectTo({

+ 3 - 1
pages/unitTest/index.vue

@@ -128,10 +128,12 @@
 	}
 	// 继续学习
 	async function goStudyContinue() {
+		const list = cacheManager.get('zhangInfo').zhangList;
 		// 设置 从单元测试 到 岛 的路由参数
 		activeZhang.value.nextZhang ? activeZhang.value.nextZhang.zhangId : null;
 		cacheManager.updateObject('auth', {
-			zhangId: activeZhang.value.nextZhang.zhangId,
+			currentZhang: list.findIndex(item => item.zhangId == activeZhang.value.nextZhang.zhangId),
+			zhangId: activeZhang.value.nextZhang.zhangId
 		})
 		uni.redirectTo({
 			url: `/pages/study/index`