zhengkaixin há 2 anos atrás
pai
commit
65e72337e3
1 ficheiros alterados com 68 adições e 6 exclusões
  1. 68 6
      pages/monthlyCardActivity/monthlyCardBuy.vue

+ 68 - 6
pages/monthlyCardActivity/monthlyCardBuy.vue

@@ -26,7 +26,7 @@
 			查看适用站点
 		</view>
 		<u-action-sheet :list="list" @click="click" v-model="show"></u-action-sheet>
-		<u-modal v-model="showModel" :show-cancel-button="true" @confirm="confirm" confirm-text="支付成功?" title="扫码支付">
+		<u-modal v-model="showModel" :show-cancel-button="true" @cancel="getUserInfo()" @confirm="confirm" confirm-text="支付成功?" title="扫码支付">
 			<view style="
 								text-align: center;
 							">
@@ -37,9 +37,16 @@
 							">请使用支付宝扫码</view>
 
 		</u-modal>
-		<img id="qrcode" style="display: none;">
+		<img id="qrcode" style="display: none;">
+		
+		<!-- 立即开通 -->
+		<view class="bottom" v-if="islogin" >
+			<button class="dredge" >已购买</button>
+			
+		</view>
+		
 		<!-- 立即开通 -->
-		<view class="bottom" v-if="detail.price" >
+		<view class="bottom" v-else-if="!islogin&&detail.price" >
 			<button class="dredge" v-if="detail.putShelf&&!detail.isVip" @click="show = true">立即开通 ¥{{detail.price.toFixed(2)}}/月</button>
 			<button class="dredge" v-if="detail.putShelf&&detail.isVip" @click="show = true">{{detail.platformText}}车主特惠 ¥{{detail.price.toFixed(2)}}/月<span style="font-size: 12px;    text-decoration: line-through;">¥{{detail.oldPrice.toFixed(2)}}</span></button>
 			
@@ -55,6 +62,7 @@
 <script>
 	import * as Pay from '@/apis/weixin.js'
 	import * as API from '@/apis/card.js'
+	import * as loginApi from '@/apis/login.js'
 
 	import QRCode from 'qrcodejs2'
 	import {
@@ -77,13 +85,66 @@
 				}],
 				show: false,
 				submitForm:{},
-				detail:{}
+				detail:{},
+				islogin:true,
 			}
 		},
 		onReady() {
 			this.getInfo();
-		},
+			this.getUserInfo()
+		},
+		 onShow(){
+			 this.getUserInfo();
+		 },
 		methods: {
+			userCardBool(userCard){
+				if(userCard){
+					var date=new Date().getTime()
+					var date2=new Date(userCard.endTime).getTime();
+					if(date<date2){
+						return true;
+					}
+				}
+				return false
+			},
+			getUserInfo(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				loginApi.findByOpenId({
+					openId: this.carhelp.getOpenId(),
+					onerror:true
+				}).then((res) => {
+					uni.hideLoading();
+					
+					if (res.code == 200&&res.result) {
+						
+						if(res.data.regUser){
+							var userCard=res.data.userCard;
+							this.islogin=	this.userCardBool(userCard)
+							
+						}else{
+							
+						}
+					
+					}
+					
+					
+					
+				
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			putShelf2(){
+				uni.showToast({
+					title:"暂不支持重复购买"
+				})
+			},
 			putShelf(){
 				uni.showToast({
 					title:"已下架,暂不支持购买"
@@ -180,7 +241,8 @@
 
 				})
 			},
-			confirm() {
+			confirm() {
+				this.getUserInfo();
 				uni.redirectTo({
 					url: "/pages/user/finance/rechargeRes?id=" + this.outOrderNo
 				})