liujiaxin 3 viikkoa sitten
vanhempi
commit
8c50940384
3 muutettua tiedostoa jossa 227 lisäystä ja 170 poistoa
  1. 223 168
      pages/shopping/paymentOrder.vue
  2. 2 2
      pages/user/index.vue
  3. 2 0
      pages_course/living.vue

+ 223 - 168
pages/shopping/paymentOrder.vue

@@ -6,7 +6,7 @@
 				<text class="time">请在{{payLimitTime}}前完成支付</text>
 				<view class="price-box">
 					<text class="unit">¥</text>
-					<text class="num" >{{payMoney.toFixed(2)}}</text>
+					<text class="num">{{payMoney.toFixed(2)}}</text>
 				</view>
 				<!-- <text class="desc" v-if="payType==2">代收金额{{payDelivery.toFixed(2)}},请您在收到快递后支付尾款给快递人员。</text> -->
 				<!-- <text class="desc" v-if="payType==3">货到付款金额{{payDelivery.toFixed(2)}},请您在收到快递后支付给快递人员。</text> -->
@@ -15,10 +15,12 @@
 			<view class="pay-type">
 				<view class="title">支付方式</view>
 				<!-- 改价订单只能选择微信支付和物流代收 -->
-				<radio-group  @change="payTypeChange" v-if="order.isEditMoney!=null&&order.isEditMoney==1">
-					<view class="item"  >
-						<view class="left"  >
-							<image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png" mode=""></image>
+				<radio-group @change="payTypeChange" v-if="order.isEditMoney!=null&&order.isEditMoney==1">
+					<view class="item">
+						<view class="left">
+							<image
+								src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
+								mode=""></image>
 							<text class="text">微信支付</text>
 						</view>
 						<label>
@@ -35,11 +37,13 @@
 						</label>
 					</view> -->
 				</radio-group>
-				 
+
 				<radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&& order.orderCreateType==3">
-					<view class="item"  >
-						<view class="left" >
-							<image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png" mode=""></image>
+					<view class="item">
+						<view class="left">
+							<image
+								src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
+								mode=""></image>
 							<text class="text">微信支付</text>
 						</view>
 						<label>
@@ -67,9 +71,11 @@
 					</view> -->
 				</radio-group>
 				<radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&& order.orderCreateType==2">
-					<view class="item" v-if="payType==1||payType==4" >
-						<view class="left" >
-							<image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png" mode=""></image>
+					<view class="item" v-if="payType==1||payType==4">
+						<view class="left">
+							<image
+								src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
+								mode=""></image>
 							<text class="text">微信支付</text>
 						</view>
 						<label>
@@ -96,10 +102,13 @@
 						</label>
 					</view> -->
 				</radio-group>
-				<radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&&(order.orderCreateType==1)">
-					<view class="item"  >
-						<view class="left" >
-							<image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png" mode=""></image>
+				<radio-group @change="payTypeChange"
+					v-else-if="order.orderCreateType!=null&&(order.orderCreateType==1)">
+					<view class="item">
+						<view class="left">
+							<image
+								src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/wecha_pay.png"
+								mode=""></image>
 							<text class="text">微信支付</text>
 						</view>
 						<label>
@@ -126,14 +135,14 @@
 					<text class="label">订单金额</text>
 					<text class="text" v-if="order!=null">{{order.payPrice.toFixed(2)}}</text>
 				</view>
-				 
+
 				<!-- <view class="item">
 					<text class="label">支付方式</text>
 					<text class="text">微信支付</text>
 				</view> -->
-				 
+
 			</view>
-			
+
 		</view>
 		<view class="btn-box">
 			<view class="btn" @click="payOrder()">去支付</view>
@@ -146,24 +155,33 @@
 </template>
 
 <script>
-	import {getUserInfo} from '@/api/user'
-	import {getStoreConfig} from '@/api/common'
-	import {editPayType,pay,getStoreOrderById,orderBindUser} from '@/api/storeOrder'
+	import {
+		getUserInfo
+	} from '@/api/user'
+	import {
+		getStoreConfig
+	} from '@/api/common'
+	import {
+		editPayType,
+		pay,
+		getStoreOrderById,
+		orderBindUser
+	} from '@/api/storeOrder'
 	export default {
 		data() {
 			return {
-				orderId:null,
-				payDelivery:0,
-				payMoney:0,
-				config:null,
-				payType:1,
-				payLimitTime:null,
-				order:null,
-				user:null,
+				orderId: null,
+				payDelivery: 0,
+				payMoney: 0,
+				config: null,
+				payType: 1,
+				payLimitTime: null,
+				order: null,
+				user: null,
 			}
 		},
 		onLoad(option) {
-			this.orderId=JSON.parse(option.orderId);
+			this.orderId = JSON.parse(option.orderId);
 			// this.orderBindUser(this.orderId)
 			this.getStoreOrderById();
 			this.getStoreConfig();
@@ -181,32 +199,34 @@
 		// 		path: '/pages_user/user/otherPaymentOrder?orderId='+this.orderId,
 		// 		imageUrl: this.$store.state.imgpath+'/app/image/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
 		// 	}
-			
+
 		// },
 		methods: {
 			// 防抖函数
-						debounce(func, wait = 1000) {
-							return (...args) => {
-								// 清除之前的定时器
-								if (this.payDebounceTimer) {
-									clearTimeout(this.payDebounceTimer);
-								}
-								
-								// 设置新的定时器
-								this.payDebounceTimer = setTimeout(() => {
-									func.apply(this, args);
-									this.payDebounceTimer = null;
-								}, wait);
-							};
-						},
-			
+			debounce(func, wait = 1000) {
+				return (...args) => {
+					// 清除之前的定时器
+					if (this.payDebounceTimer) {
+						clearTimeout(this.payDebounceTimer);
+					}
+
+					// 设置新的定时器
+					this.payDebounceTimer = setTimeout(() => {
+						func.apply(this, args);
+						this.payDebounceTimer = null;
+					}, wait);
+				};
+			},
+
 			orderBindUser(orderId) {
 				uni.showLoading({
 					title: '加载中...'
 				})
-				orderBindUser({orderId: orderId}).then(res => {
+				orderBindUser({
+					orderId: orderId
+				}).then(res => {
 					uni.hideLoading()
-					if(res.code==200){
+					if (res.code == 200) {
 						this.getStoreOrderById();
 						this.getStoreConfig();
 						this.getUserInfo();
@@ -215,27 +235,27 @@
 						// 	//小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
 						// 	menus:["shareAppMessage"] //不设置默认发送给朋友
 						// })
-					}else{
+					} else {
 						uni.showToast({
-							icon:'none',
+							icon: 'none',
 							title: res.msg,
 						});
-						 
+
 					}
-				}).catch(()=>{
+				}).catch(() => {
 					uni.hideLoading()
 				});
 			},
-			getUserInfo(){
+			getUserInfo() {
 				getUserInfo().then(
 					res => {
-						if(res.code==200){
-							if(res.user!=null){
-								this.user=res.user;
+						if (res.code == 200) {
+							if (res.user != null) {
+								this.user = res.user;
 							}
-						}else{
+						} else {
 							uni.showToast({
-								icon:'none',
+								icon: 'none',
 								title: "请求失败",
 							});
 						}
@@ -243,149 +263,157 @@
 					rej => {}
 				);
 			},
-			getStoreConfig(){
+			getStoreConfig() {
 				getStoreConfig().then(
 					res => {
-						if(res.code==200){
-							this.config=res.data
+						if (res.code == 200) {
+							this.config = res.data
 							console.log(this.config);
 						}
 					},
 					rej => {}
 				);
 			},
-			payTypeChange(e){
+			payTypeChange(e) {
 				this.editPayType(e.detail.value)
 			},
 			copyOrderSn(text) {
 				// 复制方法
 				uni.setClipboardData({
-					data:text,
-					success:()=>{
+					data: text,
+					success: () => {
 						uni.showToast({
-							title:'内容已成功复制到剪切板',
-							icon:'none'
+							title: '内容已成功复制到剪切板',
+							icon: 'none'
 						})
 					}
 				});
 			},
-			getStoreOrderById(){
-				var data = {orderId:this.orderId};
-				var that=this;
+			getStoreOrderById() {
+				var data = {
+					orderId: this.orderId
+				};
+				var that = this;
 				uni.showLoading();
 				getStoreOrderById(data).then(
 					res => {
-						if(res.code==200){
+						if (res.code == 200) {
 							console.log(res);
 							uni.hideLoading();
-							that.order=res.order;
-							that.payLimitTime=res.payLimitTime;
+							that.order = res.order;
+							that.payLimitTime = res.payLimitTime;
 							//套餐订单处理
-							if(res.productPackage!=null){
-								this.payType=res.productPackage.payType;
+							if (res.productPackage != null) {
+								this.payType = res.productPackage.payType;
 								console.log(this.payType)
-								if(this.order.payType==4){
-									this.order.payType=1;
+								if (this.order.payType == 4) {
+									this.order.payType = 1;
 								}
 							}
 							this.editPayType(this.order.payType)
-							
-						}else{
+
+						} else {
 							uni.showToast({
-								icon:'none',
+								icon: 'none',
 								title: res.msg,
 							});
 						}
 					},
 					rej => {}
 				);
-				
+
 			},
-			editPayType(payType){
-				var data = {orderId:this.orderId,payType:payType};
-				var that=this;
+			editPayType(payType) {
+				var data = {
+					orderId: this.orderId,
+					payType: payType
+				};
+				var that = this;
 				uni.showLoading();
-				
+
 				editPayType(data).then(
 					res => {
-						if(res.code==200){
+						if (res.code == 200) {
 							console.log(res);
 							uni.hideLoading();
-							that.order=res.order;
+							that.order = res.order;
 							//this.payType=this.order.payType
-							this.payMoney=this.order.payMoney;
-							this.payDelivery=this.order.payDelivery;
-						}else{
+							this.payMoney = this.order.payMoney;
+							this.payDelivery = this.order.payDelivery;
+						} else {
 							uni.showToast({
-								icon:'none',
+								icon: 'none',
 								title: res.msg,
 							});
 						}
 					},
 					rej => {}
 				);
-				
+
 			},
-			otherPayOrder(){
+			otherPayOrder() {
 				uni.navigateTo({
-					url: '/pages_user/user/otherPaymentOrder?orderId='+this.orderId
+					url: '/pages_user/user/otherPaymentOrder?orderId=' + this.orderId
 				})
 			},
 			// 防抖后的支付方法
-						payOrder: function() {
-							// 创建防抖函数实例
-							const debouncedPay = this.debounce(function() {
-								this.executePay();
-							}, 1000); // 1秒防抖时间,可以根据需要调整
-							
-							// 执行防抖函数
-							debouncedPay();
-						},// 实际的支付执行逻辑
+			payOrder: function() {
+				// 创建防抖函数实例
+				const debouncedPay = this.debounce(function() {
+					this.executePay();
+				}, 1000); // 1秒防抖时间,可以根据需要调整
+
+				// 执行防抖函数
+				debouncedPay();
+			}, // 实际的支付执行逻辑
 			executePay() {
-				var data = {orderId:this.order.id,payType:this.order.payType};
-				var that=this;
-				
+				var data = {
+					orderId: this.order.id,
+					payType: this.order.payType
+				};
+				var that = this;
+
 				// 防止重复点击,可以添加加载状态
 				if (this.isPaying) return;
 				this.isPaying = true;
-				
+
 				uni.showLoading();
 				pay(data).then(
 					res => {
 						this.isPaying = false;
-						if(res.code==200){
-							 console.log(res);
-							 if(res.payType==1||res.payType==2||res.payType==3){
-								 uni.requestPayment({
-								 	provider: 'wxpay',
-								 	timeStamp: res.result.timeStamp,
-								 	nonceStr:res.result.nonceStr,
-								 	package: res.result.packageValue,
-								 	signType: res.result.signType,
-								 	paySign: res.result.paySign,
-								 	success: function(res) {
+						if (res.code == 200) {
+							console.log(res);
+							if (res.payType == 1 || res.payType == 2 || res.payType == 3) {
+								uni.requestPayment({
+									provider: 'wxpay',
+									timeStamp: res.result.timeStamp,
+									nonceStr: res.result.nonceStr,
+									package: res.result.packageValue,
+									signType: res.result.signType,
+									paySign: res.result.paySign,
+									success: function(res) {
 										console.log('yess:' + JSON.stringify(res));
-								 		 uni.hideLoading();
-										  uni.redirectTo({
-										  	url:"success?order="+JSON.stringify(that.order)
-										  }) 
-								 	},
-								 	fail: function(err) {
+										uni.hideLoading();
+										uni.redirectTo({
+											url: "success?order=" + JSON.stringify(that.order)
+										})
+									},
+									fail: function(err) {
 										uni.showToast({
-											icon:'none',
-											title:'支付失败',
+											icon: 'none',
+											title: '支付失败',
 										});
-								 		console.log('fail:' + JSON.stringify(err));
-								 		uni.hideLoading();
-								 	},
+										console.log('fail:' + JSON.stringify(err));
+										uni.hideLoading();
+									},
 									complete: (err) => {
 										console.log('fail:' + JSON.stringify(err));
 									}
-								 });
-							 }
-						}else{
+								});
+							}
+						} else {
 							uni.showToast({
-								icon:'none',
+								icon: 'none',
 								title: res.msg,
 							});
 						}
@@ -394,7 +422,7 @@
 						this.isPaying = false;
 						uni.hideLoading();
 						uni.showToast({
-							icon:'none',
+							icon: 'none',
 							title: '网络请求失败',
 						});
 					}
@@ -451,7 +479,7 @@
 			// 					// 	}) 
 			// 					//  }
 			// 				 // }
-							 
+
 			// 			}else{
 			// 				uni.showToast({
 			// 					icon:'none',
@@ -461,24 +489,27 @@
 			// 		},
 			// 		rej => {}
 			// 	);
-				
+
 			// }
 		}
 	}
 </script>
 
 <style lang="scss">
-	page{
+	page {
 		height: 100%;
 	}
-	.content{
+
+	.content {
 		height: 100%;
 		display: flex;
 		flex-direction: column;
 		justify-content: space-between;
-		.inner{
+
+		.inner {
 			padding: 20upx;
-			.time-price{
+
+			.time-price {
 				box-sizing: border-box;
 				padding: 50upx 0upx;
 				background: #FFFFFF;
@@ -486,7 +517,8 @@
 				display: flex;
 				flex-direction: column;
 				align-items: center;
-				.time{
+
+				.time {
 					font-size: 32upx;
 					font-family: PingFang SC;
 					font-weight: 500;
@@ -494,7 +526,8 @@
 					line-height: 1;
 					text-align: center;
 				}
-				.desc{
+
+				.desc {
 					margin: 30upx 0upx 15upx;
 					font-size: 26upx;
 					font-family: PingFang SC;
@@ -502,11 +535,13 @@
 					line-height: 1;
 					text-align: center;
 				}
-				.price-box{
+
+				.price-box {
 					display: flex;
 					align-items: flex-end;
 					margin-top: 28upx;
-					.unit{
+
+					.unit {
 						font-size: 32upx;
 						font-family: PingFang SC;
 						font-weight: bold;
@@ -514,7 +549,8 @@
 						line-height: 1.3;
 						margin-right: 10upx;
 					}
-					.num{
+
+					.num {
 						font-size: 56upx;
 						font-family: PingFang SC;
 						font-weight: bold;
@@ -523,7 +559,8 @@
 					}
 				}
 			}
-			.pay-type{
+
+			.pay-type {
 				box-sizing: border-box;
 				background: #FFFFFF;
 				border-radius: 16upx;
@@ -532,7 +569,8 @@
 				display: flex;
 				flex-direction: column;
 				justify-content: space-between;
-				.title{
+
+				.title {
 					font-size: 28upx;
 					font-family: PingFang SC;
 					font-weight: 500;
@@ -540,20 +578,24 @@
 					line-height: 1;
 					margin-bottom: 10upx;
 				}
-				.item{
+
+				.item {
 					padding: 15upx 0upx;
 					display: flex;
 					align-items: center;
 					justify-content: space-between;
-					.left{
+
+					.left {
 						display: flex;
 						align-items: center;
-						image{
+
+						image {
 							width: 44upx;
 							height: 44upx;
 							margin-right: 20upx;
 						}
-						.text{
+
+						.text {
 							font-size: 30upx;
 							font-family: PingFang SC;
 							font-weight: bold;
@@ -563,50 +605,59 @@
 					}
 				}
 			}
-			.order-info{
+
+			.order-info {
 				margin-top: 20upx;
 				background: #FFFFFF;
 				border-radius: 16upx;
 				padding: 40upx 30upx;
-				.title{
+
+				.title {
 					font-size: 30upx;
 					font-family: PingFang SC;
 					font-weight: bold;
 					color: #222222;
 					line-height: 1;
 				}
-				.item{
+
+				.item {
 					margin-top: 40upx;
 					display: flex;
 					align-items: center;
 					justify-content: space-between;
-					.label{
+
+					.label {
 						font-size: 26upx;
 						font-family: PingFang SC;
 						font-weight: 500;
 						color: #666666;
 						line-height: 1;
 					}
-					.text{
+
+					.text {
 						font-size: 26upx;
 						font-family: PingFang SC;
 						font-weight: 500;
 						color: #222222;
 						line-height: 32upx;
 					}
-					.cont-text{
+
+					.cont-text {
 						font-size: 26upx;
 						font-family: PingFang SC;
 						font-weight: 500;
 						color: #666666;
-						.bold{
+
+						.bold {
 							color: #111111;
 						}
 					}
-					.sn-box{
+
+					.sn-box {
 						display: flex;
 						align-items: center;
-						.copy-btn{
+
+						.copy-btn {
 							width: 58upx;
 							height: 32upx;
 							line-height: 32upx;
@@ -620,9 +671,10 @@
 							margin-left: 24upx;
 						}
 					}
-					 
+
 				}
-				.line{
+
+				.line {
 					width: 100%;
 					height: 1px;
 					background: #F0F0F0;
@@ -630,14 +682,16 @@
 				}
 			}
 		}
-		.btn-box{
+
+		.btn-box {
 			height: 242upx;
 			background: #FFFFFF;
 			display: flex;
 			align-items: center;
 			justify-content: center;
 			flex-direction: column;
-			.btn{
+
+			.btn {
 				width: 91.73%;
 				height: 88upx;
 				line-height: 88upx;
@@ -650,7 +704,8 @@
 				border-radius: 44upx;
 				margin-bottom: 10rpx;
 			}
-			.other-btn{
+
+			.other-btn {
 				width: 91.73%;
 				height: 88upx;
 				line-height: 88upx;
@@ -664,7 +719,8 @@
 				border-radius: 44upx;
 				margin-bottom: 10rpx;
 				position: relative;
-				.share{
+
+				.share {
 					display: inline-block;
 					position: absolute;
 					top: 0;
@@ -676,5 +732,4 @@
 			}
 		}
 	}
-	
-</style>
+</style>

+ 2 - 2
pages/user/index.vue

@@ -181,12 +181,12 @@
 
 
 							<!-- 测试用下面的 -->
-							<!-- <view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
+							<view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
 								<image
 									src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
 									mode=""></image>
 								<text class="text">直播</text>
-							</view> -->
+							</view>
 
 							<view class="item no-marin-bottom" @click="toManager()">
 								<image

+ 2 - 0
pages_course/living.vue

@@ -3211,8 +3211,10 @@
 			// 获取直播间用户
 			async getliveUser(isLoadMore = false) {
 				this.viewLoading = true;
+				
 				try {
 					const res = await watchUserList(this.liveId, this.viewPageSize, this.viewPageNum, false);
+					console.log("getliveUser",res);
 					if (res.code === 200) {
 						const userRows = Array.isArray(res.rows) ? res.rows : [];