lsx 2 gadi atpakaļ
vecāks
revīzija
f4a98efe8b
1 mainītis faili ar 19 papildinājumiem un 5 dzēšanām
  1. 19 5
      src/pages/index/payExternal.vue

+ 19 - 5
src/pages/index/payExternal.vue

@@ -19,10 +19,12 @@
 		</view>
 		<!-- #endif -->
 		<!-- <web-view :src='info'></web-view> -->
-		
-		<view class="btn">
+		<view class="btn" v-if="paystatus == 0">
+			<u-button class="btn1" @click="openPay(1)" text="前往支付" shape="circle"></u-button>
+		</view>
+		<view class="btn" v-else>
 			<u-button class="btn1" @click="toPurchase" text="我已支付" shape="circle"></u-button>
-			<u-button class="btn2" @click="openPay" text="还未支付" shape="circle"></u-button>
+			<u-button class="btn2" @click="openPay(2)" text="还未支付" shape="circle"></u-button>
 		</view>
 	</view>
 </template>
@@ -35,12 +37,15 @@
 				info: 'https://openapi.ysepay.com/gateway.do?',
 				pagesNum: '',
 				orderId: '',
+				paystatus: 0,
 			}
 		},
 		onShow() {
 			this.pagesNum = getCurrentPages().length
+			this.paystatus = sessionStorage.getItem('paystatus') ? 1 : 0
 		},
 		onLoad(opthios) {
+			
 			if(opthios.orderId){
 				this.orderId = opthios.orderId
 			}
@@ -53,9 +58,18 @@
 			// location.href =  this.info
 			window.open(this.info);
 		},
+		onUnload() {
+			sessionStorage.removeItem('paystatus');
+		},
 		methods: {
-			openPay() {
-				window.open(this.info);
+			openPay(e) {
+				if(e == 1){
+					sessionStorage.setItem('paystatus', '1');
+					window.open(this.info);
+				}else{
+					window.open(this.info);
+				}
+				
 			},
 			
 			toPurchase() {