|
|
|
@ -1,41 +1,13 @@ |
|
|
|
|
<template> |
|
|
|
|
<view> |
|
|
|
|
<!-- 状态栏 --> |
|
|
|
|
<view v-if="showHeader" class="status" |
|
|
|
|
:style="{ position: headerPosition,top:statusTop,opacity: afterHeaderOpacity}"></view> |
|
|
|
|
<!-- 顶部导航栏 --> |
|
|
|
|
<view v-if="showHeader" class="header" |
|
|
|
|
:style="{ position: headerPosition,top:headerTop,opacity: afterHeaderOpacity }"> |
|
|
|
|
<!-- 定位城市 --> |
|
|
|
|
<view class="addr" @click="goPostion"> |
|
|
|
|
<!-- <view class="icon location"></view> --> |
|
|
|
|
{{ city }} |
|
|
|
|
<image mode="widthFix" style="width: 15px;" :src="imagewxUrl+imgadres2"></image> |
|
|
|
|
</view> |
|
|
|
|
<!-- 搜索框 --> |
|
|
|
|
<view class="input-box"> |
|
|
|
|
<input placeholder="搜索门店" placeholder-style="color:#c0c0c0;" @tap="toSearch()" /> |
|
|
|
|
<view class="icon search"></view> |
|
|
|
|
</view> |
|
|
|
|
<!-- 右侧图标按钮 --> |
|
|
|
|
<!-- <view class="icon-btn"> --> |
|
|
|
|
<!-- <view class="icon yuyin-home"></view> --> |
|
|
|
|
<!-- <button open-type="contact" class="icon" show-message-card session-from send-message-path send-message-title> --> |
|
|
|
|
<!-- <image style="width: 30px;height: 30px;" @click="toScan" |
|
|
|
|
src="data:image/png;base64,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"> |
|
|
|
|
</image> --> |
|
|
|
|
<!-- </button> --> |
|
|
|
|
<!-- </view> --> |
|
|
|
|
</view> |
|
|
|
|
<!-- 占位 --> |
|
|
|
|
<view v-if="showHeader" class="place"></view> |
|
|
|
|
|
|
|
|
|
<!-- 轮播图 --> |
|
|
|
|
<view class="height90 backcor008 viewbor"></view> |
|
|
|
|
<view class="swiper"> |
|
|
|
|
<view class="swiper-box"> |
|
|
|
|
<swiper circular="true" autoplay="true" @change="swiperChange"> |
|
|
|
|
<swiper-item v-for="swiper in swiperList" :key="swiper.id"> |
|
|
|
|
<image :src="imageUrl+swiper.imgData" @click="jumplottery(swiper)"></image> |
|
|
|
|
<image :src="imagewxUrl+swiper.img" @click="jumplottery(swiper)"></image> |
|
|
|
|
</swiper-item> |
|
|
|
|
</swiper> |
|
|
|
|
<view class="indicator"> |
|
|
|
@ -47,38 +19,18 @@ |
|
|
|
|
<!-- /菜单 --> |
|
|
|
|
<view class="height60 backcorfff"></view> |
|
|
|
|
<view class="category-list"> |
|
|
|
|
<view class="category" v-for="(row, index) in categoryList" :key="index" @tap="toCategory(row)"> |
|
|
|
|
<view class="category" v-for="(row, index) in categoryList" :key="index" @tap="jumphuafei(row)"> |
|
|
|
|
<view class="img"> |
|
|
|
|
<image :src="imageUrl+row.imgData"></image> |
|
|
|
|
<image :src="imagewxUrl+row.imgData"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="text">{{ row.title }}</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<!-- 积分 --> |
|
|
|
|
<view style="width: 90%;margin-left: 5%;" v-if='goldproductList.length != 0' @click="goGoodsList(2)"> |
|
|
|
|
<image class="mart30 width100" mode="widthFix" :src="imagewxUrl+imgadres1"></image> |
|
|
|
|
</view> |
|
|
|
|
<swiper class="orange-content" :display-multiple-items="goldproductListleg" v-if='goldproductList.length != 0' |
|
|
|
|
next-margin="50rpx"> |
|
|
|
|
<swiper-item class="swiper-hed" v-for="(item,index) in goldproductList" :key="index" |
|
|
|
|
@click="toGoods(item.id)"> |
|
|
|
|
<view class="swiper-item" :data-id="item.id"> |
|
|
|
|
<image class="img" :src="imageUrl+item.couponImg" mode="aspectFit"></image> |
|
|
|
|
<view class="fotlt fcor333 font14 text1 mart10">{{item.couponName}}</view> |
|
|
|
|
<view class="subject fotct mart5"> |
|
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;margin-right: 5px;" |
|
|
|
|
src="../../../static/img/jfx.png"> |
|
|
|
|
</image>{{ item.discountPrice*100}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</swiper-item> |
|
|
|
|
</swiper> |
|
|
|
|
|
|
|
|
|
<image mode="widthFix" style="margin-top: 30px;width: 90%;margin-left: 5%;" v-for="(row, index) in homeCateList" |
|
|
|
|
:key="index" @click="jumphuafei(row)" :src="imageUrl+row.imgData"></image> |
|
|
|
|
<!-- 赠券 --> |
|
|
|
|
<view style="width: 91%;margin-left: 5%;" v-if='productList.length != 0' @click="goGoodsList(1)"> |
|
|
|
|
:key="index" @click="jumphuafei(row)" :src="imagewxUrl+row.imgData"></image> |
|
|
|
|
<!-- 银联赠券 --> |
|
|
|
|
<view style="width: 91%;margin-left: 5%;" v-if='productList.length != 0' @click="goGoodsList(3)"> |
|
|
|
|
<image class="mart30 width100" mode="widthFix" :src="imagewxUrl+imgadres"></image> |
|
|
|
|
</view> |
|
|
|
|
<swiper class="orange-content" style="border: 2px solid #ff5836;" v-if='productList.length != 0' |
|
|
|
@ -105,10 +57,10 @@ |
|
|
|
|
HandleCode, |
|
|
|
|
WXlogin, |
|
|
|
|
getCouponList, |
|
|
|
|
getH5UserInfo, |
|
|
|
|
getH5AccessToken, |
|
|
|
|
getTPigKFCToken, |
|
|
|
|
getTPigCinemaToken, |
|
|
|
|
getCacheParam, |
|
|
|
|
delCacheParam, |
|
|
|
|
getCmsContent, |
|
|
|
|
} from "../../../Utils/Api.js"; //您的api路径 |
|
|
|
|
import wybPopup from '../../../components/wyb-popup/wyb-popup.vue'; |
|
|
|
@ -130,7 +82,7 @@ |
|
|
|
|
currentSwiper: 0, |
|
|
|
|
imageUrl: app.globalData.imgUrl, |
|
|
|
|
imagewxUrl: app.globalData.imageWxImg, |
|
|
|
|
imgadres: 'headzq.png', |
|
|
|
|
imgadres: 'headunion.png', |
|
|
|
|
imgadres1: 'jbhed.png', |
|
|
|
|
imgadres2: 'jt.png', |
|
|
|
|
imgadres3: '', |
|
|
|
@ -156,90 +108,140 @@ |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 6, |
|
|
|
|
// 分类菜单 |
|
|
|
|
categoryList: [], |
|
|
|
|
homeCateList: [], |
|
|
|
|
categoryList: [{ |
|
|
|
|
'title': '在线加油', |
|
|
|
|
'imgData': 'onRefueling1.png' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
'title': '话费充值', |
|
|
|
|
'imgData': 'phonePay1.png' |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
homeCateList: [{ |
|
|
|
|
'title': '在线加油', |
|
|
|
|
'imgData': 'onRefueling2.png' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
'title': '话费充值', |
|
|
|
|
'imgData': 'phonePay2.png' |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
//切换状态 |
|
|
|
|
cpStuats: 1, |
|
|
|
|
jumpType:'' |
|
|
|
|
jumpType: '' |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onShow() { |
|
|
|
|
// #ifdef H5 |
|
|
|
|
var arr1 = window.location.href; |
|
|
|
|
var arr2 = arr1.split('='); |
|
|
|
|
if (!app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '2#/') { |
|
|
|
|
this.getH5UserInfo(arr2[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '1#/') { |
|
|
|
|
this.getH5AccessToken(arr2[1]); |
|
|
|
|
} |
|
|
|
|
// #endif |
|
|
|
|
if (app.globalData.cityName != '') { |
|
|
|
|
this.city = app.globalData.cityName; |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
this.getCouponListgold(); |
|
|
|
|
this.getCmsContent(); |
|
|
|
|
this.getCmsContentcmshome(); |
|
|
|
|
this.getCmsContentcmsContent(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(options) { |
|
|
|
|
let that = this; |
|
|
|
|
|
|
|
|
|
// 1.wx获取登录用户code |
|
|
|
|
// #ifdef MP |
|
|
|
|
uni.login({ |
|
|
|
|
provider: 'weixin', |
|
|
|
|
success: function(loginRes) { |
|
|
|
|
app.globalData.code = loginRes.code; |
|
|
|
|
// 请求接口 |
|
|
|
|
let params = { |
|
|
|
|
code: app.globalData.code |
|
|
|
|
} |
|
|
|
|
HandleCode(params).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
app.globalData.openId = res.return_data.openId; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
// #endif |
|
|
|
|
//定位 |
|
|
|
|
this.postionIng(); |
|
|
|
|
uni.getStorage({ |
|
|
|
|
key: "user", |
|
|
|
|
success(e) { |
|
|
|
|
app.globalData.userInfo = e.data //这就是你想要取的token |
|
|
|
|
app.globalData.userInfo = e.data; //这就是你想要取的token |
|
|
|
|
uni.getStorage({ |
|
|
|
|
key: 'token', |
|
|
|
|
success(e) { |
|
|
|
|
app.globalData.token = e.data; |
|
|
|
|
}, |
|
|
|
|
fail() { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (!app.globalData.userInfo.phone) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
that.getCacheParam(); |
|
|
|
|
}, |
|
|
|
|
fail: res => {} |
|
|
|
|
fail: res => { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
// #ifdef H5 |
|
|
|
|
uni.getStorage({ |
|
|
|
|
key: "openId", |
|
|
|
|
success(e) { |
|
|
|
|
app.globalData.openId = e.data |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// if (app.globalData.cityName != '') { |
|
|
|
|
// this.city = app.globalData.cityName; |
|
|
|
|
// this.getCouponListArea(); |
|
|
|
|
// this.getCouponListgold(); |
|
|
|
|
// this.getCmsContent(); |
|
|
|
|
// this.getCmsContentcmshome(); |
|
|
|
|
// this.getCmsContentcmsContent(); |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
onLoad() { |
|
|
|
|
this.hqaddress(); |
|
|
|
|
}, |
|
|
|
|
fail: res => {} |
|
|
|
|
methods: { |
|
|
|
|
//获取卡券ID |
|
|
|
|
getCacheParam() { |
|
|
|
|
let that = this; |
|
|
|
|
let params = { |
|
|
|
|
key: app.globalData.userInfo.phone |
|
|
|
|
} |
|
|
|
|
getCacheParam(params).then(res => { |
|
|
|
|
if (res.return_code == '000000' && res.return_data) { |
|
|
|
|
let datas = res.return_data; |
|
|
|
|
uni.showModal({ |
|
|
|
|
title: '优惠券领取', |
|
|
|
|
content: '前往领取优惠券', |
|
|
|
|
success: (res) => { |
|
|
|
|
if (res.confirm) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../goods/externalCoupon/externalCoupon?id=' + |
|
|
|
|
datas |
|
|
|
|
}) |
|
|
|
|
// #endif |
|
|
|
|
var arr1mp = decodeURIComponent(options.q); |
|
|
|
|
if (arr1mp) { |
|
|
|
|
var arr2mp = arr1mp.split('='); |
|
|
|
|
if (arr2mp) { |
|
|
|
|
app.globalData.identificationCode = arr2mp[2]; |
|
|
|
|
that.delCacheParam(); |
|
|
|
|
} else if (res.cancel) { |
|
|
|
|
console.log('用户点击取消'); |
|
|
|
|
that.delCacheParam(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 删除存的卡券 |
|
|
|
|
delCacheParam() { |
|
|
|
|
let params = { |
|
|
|
|
key: app.globalData.userInfo.phone |
|
|
|
|
} |
|
|
|
|
delCacheParam(params).then(res => { |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//定位信息 |
|
|
|
|
hqaddress() { |
|
|
|
|
let that = this; |
|
|
|
|
upsdk.pluginReady(function() { |
|
|
|
|
upsdk.getLocationCity({ |
|
|
|
|
success: function(cityCd) { |
|
|
|
|
app.globalData.cityId = cityCd; |
|
|
|
|
that.getCouponListArea(); |
|
|
|
|
}, |
|
|
|
|
fail: function(err) {} |
|
|
|
|
}); |
|
|
|
|
upsdk.getLocationGps({ |
|
|
|
|
success: function(res) { |
|
|
|
|
switch (uni.getSystemInfoSync().platform) { |
|
|
|
|
case 'android': |
|
|
|
|
let zuob = JSON.parse(res); |
|
|
|
|
app.globalData.latitude = zuob.latitude; |
|
|
|
|
app.globalData.longitude = zuob.longitude; |
|
|
|
|
break; |
|
|
|
|
case 'ios': |
|
|
|
|
app.globalData.latitude = res.latitude; |
|
|
|
|
app.globalData.longitude = res.longitude; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
fail: function() {} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//获取首页功能 |
|
|
|
|
getCmsContentcmsContent() { |
|
|
|
|
let params = { |
|
|
|
@ -308,13 +310,13 @@ |
|
|
|
|
* 跳转外链 |
|
|
|
|
*/ |
|
|
|
|
jumpWeb() { |
|
|
|
|
if(this.jumpType == 1){ |
|
|
|
|
if (this.jumpType == 1) { |
|
|
|
|
if (this.webUrl) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../order/webUrl/webUrl?url=' + this.webUrl |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: this.webUrl |
|
|
|
|
}) |
|
|
|
@ -322,126 +324,6 @@ |
|
|
|
|
|
|
|
|
|
this.closePopup(); |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 定位 |
|
|
|
|
*/ |
|
|
|
|
postionIng() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中' |
|
|
|
|
}) |
|
|
|
|
let that = this; |
|
|
|
|
uni.getLocation({ |
|
|
|
|
type: 'wgs84', |
|
|
|
|
success: function(res) { |
|
|
|
|
app.globalData.latitude = res.latitude; |
|
|
|
|
app.globalData.longitude = res.longitude; |
|
|
|
|
that.getUserLocation(res.longitude, res.latitude); |
|
|
|
|
// #ifdef MP |
|
|
|
|
uni.request({ |
|
|
|
|
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + |
|
|
|
|
',' + res.longitude + '&key=7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB', |
|
|
|
|
data: {}, |
|
|
|
|
success: function(res) { |
|
|
|
|
// that.city = res.data.result.address_component.city.replace(/市/g, |
|
|
|
|
// ''); |
|
|
|
|
that.city = res.data.result.address_component.province; |
|
|
|
|
app.globalData.cityName = res.data.result.address_component |
|
|
|
|
.province; |
|
|
|
|
app.globalData.cityId = res.data.result.ad_info.adcode; |
|
|
|
|
// app.globalData.cityId = '500100'; |
|
|
|
|
that.getCouponListArea(); |
|
|
|
|
that.getCouponListgold(); |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
that.getCmsContent(); |
|
|
|
|
that.getCmsAactibity(); |
|
|
|
|
that.getCmsContentcmshome(); |
|
|
|
|
that.getCmsContentcmsContent(); |
|
|
|
|
}, |
|
|
|
|
fail() { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
//#endif |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//H5 获取openId |
|
|
|
|
getH5AccessToken(item) { |
|
|
|
|
let params = { |
|
|
|
|
code: item |
|
|
|
|
} |
|
|
|
|
getH5AccessToken(params).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
app.globalData.openId = res.return_data.openid; |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "openId", |
|
|
|
|
data: res.return_data.openid |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//获取H5用户信息 |
|
|
|
|
getH5UserInfo(item) { |
|
|
|
|
let params = { |
|
|
|
|
code: item |
|
|
|
|
} |
|
|
|
|
getH5UserInfo(params).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
app.globalData.userInfo = res.return_data |
|
|
|
|
.object |
|
|
|
|
.highUser; |
|
|
|
|
app.globalData.token = res.return_data.uniqueCode; |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "user", |
|
|
|
|
data: res.return_data |
|
|
|
|
.object |
|
|
|
|
.highUser |
|
|
|
|
}) |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "token", |
|
|
|
|
data: res.return_data.uniqueCode |
|
|
|
|
}) |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "openId", |
|
|
|
|
data: res.return_data |
|
|
|
|
.object |
|
|
|
|
.highUser.openIdH5 |
|
|
|
|
}) |
|
|
|
|
app.globalData.openId = res.return_data |
|
|
|
|
.object |
|
|
|
|
.highUser.openIdH5; |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.return_msg |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//金纬度转 |
|
|
|
|
getUserLocation(long, lat) { |
|
|
|
|
let vm = this; |
|
|
|
|
let url = |
|
|
|
|
'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1'; |
|
|
|
|
let locationObj = lat + ',' + long; |
|
|
|
|
this.$jsonp(url, { |
|
|
|
|
key: '7UMBZ-HFEHX-HSD4Q-Z3QY6-OQKN7-2QBDB', |
|
|
|
|
location: locationObj |
|
|
|
|
}) |
|
|
|
|
.then(res => { |
|
|
|
|
vm.city = res.result.address_component.city.replace(/市/g, ''); |
|
|
|
|
app.globalData.cityName = res.result.address_component.city.replace(/市/g, ''); |
|
|
|
|
app.globalData.cityId = res.result.ad_info.adcode; |
|
|
|
|
vm.getCouponListArea(); |
|
|
|
|
vm.getCouponListgold(); |
|
|
|
|
uni.hideLoading() |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//搜索跳转 |
|
|
|
|
toSearch() { |
|
|
|
|
uni.navigateTo({ |
|
|
|
@ -460,32 +342,13 @@ |
|
|
|
|
url: '../../goods/goods?id=' + e |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//扫码 |
|
|
|
|
toScan() { |
|
|
|
|
uni.scanCode({ |
|
|
|
|
success: function(res) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../goods/coupons-info-details/coupons-info-details?id=' + JSON |
|
|
|
|
.parse(res.result).code |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
fail() { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '无法识别二维码', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//赠券卡券列表 |
|
|
|
|
//银联赠券卡券列表 |
|
|
|
|
getCouponListArea() { |
|
|
|
|
let params = { |
|
|
|
|
regionId: app.globalData.cityId, |
|
|
|
|
pageNum: this.pageNum, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
displayArea: 1 |
|
|
|
|
displayArea: 3 |
|
|
|
|
} |
|
|
|
|
getCouponList(params).then(res => { |
|
|
|
|
if (res.return_code == '000000' && res.return_data.list) { |
|
|
|
@ -518,23 +381,6 @@ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 跳转其他小程序 |
|
|
|
|
*/ |
|
|
|
|
tao(url, id) { |
|
|
|
|
console.log(url); |
|
|
|
|
uni.navigateToMiniProgram({ |
|
|
|
|
appId: id, |
|
|
|
|
path: url, |
|
|
|
|
success: res => { |
|
|
|
|
// 打开成功 |
|
|
|
|
console.log("打开成功", res); |
|
|
|
|
}, |
|
|
|
|
fail: err => { |
|
|
|
|
console.log(err); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//轮播图指示器 |
|
|
|
|
swiperChange(event) { |
|
|
|
|
this.currentSwiper = event.detail.current; |
|
|
|
@ -542,126 +388,6 @@ |
|
|
|
|
eheckStu(item) { |
|
|
|
|
this.cpStuats = item; |
|
|
|
|
}, |
|
|
|
|
//获取登陆信息 |
|
|
|
|
getuserinfos() { |
|
|
|
|
let that = this; |
|
|
|
|
// 获取微信用户信息 |
|
|
|
|
uni.getUserProfile({ |
|
|
|
|
desc: '登录中...', |
|
|
|
|
success: function(res) { |
|
|
|
|
let params = { |
|
|
|
|
openId: app.globalData.openId, |
|
|
|
|
iv: res.iv, |
|
|
|
|
encryptedData: res.encryptedData |
|
|
|
|
} |
|
|
|
|
getUserInfo(params).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '获取信息成功', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
app.globalData.userInfo = res |
|
|
|
|
.return_data |
|
|
|
|
.object |
|
|
|
|
.highUser; |
|
|
|
|
app.globalData.token = res |
|
|
|
|
.return_data.uniqueCode; |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "user", |
|
|
|
|
data: res.return_data |
|
|
|
|
.object |
|
|
|
|
.highUser |
|
|
|
|
}) |
|
|
|
|
uni.setStorage({ |
|
|
|
|
key: "token", |
|
|
|
|
data: res.return_data |
|
|
|
|
.uniqueCode |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.return_msg, |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
fail: res => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "微信登录授权失败", |
|
|
|
|
icon: "none" |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//跳转菜单 |
|
|
|
|
toCategory(item) { |
|
|
|
|
if (item.title == '在线加油') { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: item.ext1 |
|
|
|
|
}) |
|
|
|
|
} else if (item.title == '肯德基') { |
|
|
|
|
if (!app.globalData.userInfo) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!app.globalData.userInfo.phone) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/tabBar/order/order?id=1' |
|
|
|
|
}) |
|
|
|
|
} else if (item.title == '电影票') { |
|
|
|
|
if (!app.globalData.userInfo) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!app.globalData.userInfo.phone) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/tabBar/order/order?id=2' |
|
|
|
|
}) |
|
|
|
|
} else if (item.title == '话费充值') { |
|
|
|
|
if (!app.globalData.userInfo) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!app.globalData.userInfo.phone) { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '../../userLogin/userLogin' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/tabBar/order/order?id=3' |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '暂未开通', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//轮播跳转活动 |
|
|
|
|
jumplottery(item) { |
|
|
|
|
if (item.ext1) { |
|
|
|
@ -669,7 +395,6 @@ |
|
|
|
|
url: item.ext1 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//单独跳转话费充值 |
|
|
|
|
jumphuafei(item) { |
|
|
|
@ -685,12 +410,6 @@ |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (item.title == '汇联通') { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/goods/goods-list/goods-list?id=2' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (item.title == '在线加油') { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/goods/refuel/refuel' |
|
|
|
@ -699,19 +418,7 @@ |
|
|
|
|
} |
|
|
|
|
if (item.title == '话费充值') { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/tabBar/order/order?id=3' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (item.title == '电影票') { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/tabBar/order/order?id=2' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (item.title == '肯德基') { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/tabBar/order/order?id=1' |
|
|
|
|
url:'../../unionPay/recharge/recharge' |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -881,7 +588,7 @@ |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
position: absolute; |
|
|
|
|
top: 60px; |
|
|
|
|
top: 20px; |
|
|
|
|
|
|
|
|
|
.swiper-box { |
|
|
|
|
width: 92%; |
|
|
|
@ -1041,7 +748,6 @@ |
|
|
|
|
background-color: #FFFFFF; |
|
|
|
|
border-bottom: solid 2upx #f6f6f6; |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
|
|
|
|
.category { |
|
|
|
|