zhengkaixin 2 years ago
parent
commit
3b04906524
3 changed files with 129 additions and 23 deletions
  1. 13 13
      pages/index/index.vue
  2. 61 4
      pages/searchPile/chargeProcess/charge.vue
  3. 55 6
      pages/user/finance/rechargeRes.vue

+ 13 - 13
pages/index/index.vue

@@ -71,7 +71,7 @@
 		:show-title="false" :show-confirm-button="false" >
 			<view class="slot-content">
 					<u-image width="250px"  style="margin: auto;"
-					mode="widthFix"
+					mode="widthFix" @click="clickBanner(showOssIndex,true)"
 					:src="showOssImg"></u-image>
 					<u-image width="36px"  style="margin: auto;"
 					mode="widthFix"  @click="showOss=false"
@@ -393,6 +393,7 @@
 				indexLogo: '',
 				showOss:false,
 				showOssImg:'',
+				showOssIndex:'',
 				show: false,
 				list: [{
 						name: '长辈模式',
@@ -647,25 +648,24 @@
 				 		})
 				 })
 			},
-			clickBanner(index){
+			clickBanner(index,bl){
 				var uurl="";
 				var mod = this.bannerList[index]
 				mod.clickUrl=mod.linkUrl
-				if (mod.clickUrl == null) {
 				
-				} else if (mod.clickUrl.slice(-5) == 'login' && this.userId) {
-				
-				} else if (mod.clickUrl.indexOf('http') == 0) {
+				if (mod.linkPicUrl&&!bl) {
 					
-					if (mod.clickUrl.indexOf('http://oss.xiaoxinda.com/') == 0) {
-						this.showOss=true;
-						this.showOssImg=mod.clickUrl;
-					}else{
-						window.location = mod.clickUrl+uurl;
-					}
+					this.showOss=true;
+					this.showOssImg=mod.linkPicUrl;
+					this.showOssIndex=index;
 					
 				
-				} else if (mod.clickUrl.indexOf('#/') == 0) {
+				}else if (mod.clickUrl == null) {
+				
+				} 
+				else if (mod.clickUrl.slice(-5) == 'login' && this.userId) {
+				
+				}  else if (mod.clickUrl.indexOf('#/') == 0) {
 					if (mod.clickUrl.indexOf("?") == -1) {
 						mod.clickUrl += '?';
 					}

+ 61 - 4
pages/searchPile/chargeProcess/charge.vue

@@ -1,7 +1,15 @@
 <template>
 	<view>
-		<ujp-navbar title="充电"  :is-back="isback" ></ujp-navbar>
-		<view class="recharge" >
+		<ujp-navbar title="充电"  :is-back="isback" ></ujp-navbar>
+		<!-- 优惠 -->
+		<view class="discounts" style="padding:0 18px;">
+			<u-swiper bg-color="#fff" :img-mode="'scaleToFill'" height="160" :list="bannerList" @click="clickBanner"
+				:name="'picUrl'">
+			</u-swiper>
+		</view>
+		<view class="recharge" >
+			
+			
 			<view class="title">请选择充电金额
 				<view class="to-recharge" @click="gotoUrl('pages/user/finance/recharge')">
 					去充值
@@ -133,6 +141,7 @@
 <script>
 	import * as API from '@/apis/chargeProcess.js'
 	import * as userApi from '@/apis/user.js'
+	import * as newsApi from '@/apis/news.js'
 
 	export default {
 		data() {
@@ -184,7 +193,8 @@
 				value:"",
 				// 优惠券
 				listlength:0,
-				vin:true,
+				vin:true,
+				bannerList:[],
 
 			}
 		},
@@ -232,7 +242,9 @@
 							this.couponsuse=couponsuse
 				}
 		},
-		onReady(){
+		onReady(){
+			this.getBannerInfo("charge-start")
+			
 			this.elderMode = this.carhelp.get('getElderModeClass')  == '长辈模式';
 			if(this.elderMode)
 				this.theme('elder')
@@ -250,6 +262,51 @@
 			this.getHomePage()
 		},
 		methods: {
+			clickBanner(index){
+				var mod= this.bannerList[index]
+				
+				if(mod.linkUrl.indexOf('http')==0){
+				    window.location=mod.linkUrl;
+				}
+				else if(mod.linkUrl.indexOf('#/')==0){
+					if(mod.linkUrl.indexOf("?")==-1){
+						mod.linkUrl+='?';
+					}
+				    //window.location=mod.linkUrl;
+					var url=mod.linkUrl.split("#")[1]
+					//window.location = mod.clickUrl;
+					uni.navigateTo({
+						url: url
+					})
+				}
+				else if(mod.linkUrl=='#'||mod.linkUrl==''){
+				
+				}
+				else{
+					uni.navigateTo({
+						url:mod.linkUrl
+					})
+				}
+				
+			},
+			getBannerInfo(code){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				newsApi.getBannerInfo(code).then((res) => {
+					uni.hideLoading();
+					this.bannerList =res.data;
+					
+					// document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 300px;"
+				 }).catch(error => {
+						uni.showToast({
+						
+							title: error,icon: "none"
+						})
+				})
+			},
+			
 			getPile(){
 				
 			},

+ 55 - 6
pages/user/finance/rechargeRes.vue

@@ -7,7 +7,7 @@
 			<view class="title oldTextjp" oldstyle="font-size: 20px;" v-if="detail.type=='2'" >开通{{detail.payStatus==20?'成功':'失败'}}</view>
 			
 			<view class="payPrice">
-				<font>{{detail.totalFee.toFixed(2)}}</font><span>元</span>
+				<font>{{detail.totalFee?detail.totalFee.toFixed(2):0}}</font><span>元</span>
 			</view>
 			<p class="oldTextjp2" oldstyle="font-size: 16px;"  >{{detail.payNameStr}}</p>
 		
@@ -40,12 +40,18 @@
 			</u-button>
 			
 			
+		</view>
+		<view class="discounts" style="padding:0 18px;margin-top: 20px;">
+			<u-swiper bg-color="#fff" :img-mode="'scaleToFill'" height="160" :list="bannerList" @click="clickBanner"
+				:name="'picUrl'">
+			</u-swiper>
 		</view>
 	</view>
 </template>
 
 <script>
 	import * as API from '@/apis/finance.js'
+	import * as newsApi from '@/apis/news.js'
 	
 	export default {
 		data() {
@@ -54,8 +60,8 @@
 				id: "",
 				charge:false,
 				chargeObj:{},
-				title:'充值结果'
-
+				title:'充值结果',
+				bannerList:[],
 			}
 		},
 		onLoad(op) {
@@ -68,13 +74,56 @@
 				this.charge=true
 				this.chargeObj=obj
 			}
-			
+			this.getBannerInfo("recharge-end")
 		},
 		onReady() {
 			
 		},
-		methods: {
-
+		methods: {
+			clickBanner(index){
+				var mod= this.bannerList[index]
+				
+				if(mod.linkUrl.indexOf('http')==0){
+				    window.location=mod.linkUrl;
+				}
+				else if(mod.linkUrl.indexOf('#/')==0){
+					if(mod.linkUrl.indexOf("?")==-1){
+						mod.linkUrl+='?';
+					}
+				    //window.location=mod.linkUrl;
+					var url=mod.linkUrl.split("#")[1]
+					//window.location = mod.clickUrl;
+					uni.navigateTo({
+						url: url
+					})
+				}
+				else if(mod.linkUrl=='#'||mod.linkUrl==''){
+				
+				}
+				else{
+					uni.navigateTo({
+						url:mod.linkUrl
+					})
+				}
+				
+			},
+			getBannerInfo(code){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				newsApi.getBannerInfo(code).then((res) => {
+					uni.hideLoading();
+					this.bannerList =res.data;
+					
+					// document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 300px;"
+				 }).catch(error => {
+						uni.showToast({
+						
+							title: error,icon: "none"
+						})
+				})
+			},
 			getInfo() {
 				uni.showLoading({
 					title: "加载中",