<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC强制全屏 -->
<meta name="full-screen" content="yes">
<!-- QQ强制全屏 -->
<meta name="x5-fullscreen" content="true">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<title></title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.1/lib/index.css">
<script src="js/rem.js"></script>
<script src="https://cdn.bootcss.com/babel-polyfill/7.4.4/polyfill.js"></script>
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vant@2.1/lib/vant.min.js"></script>
<!--<script src="https://unpkg.com/axios/dist/axios.min.js"></script>-->
<script src="https://unpkg.com/vue-resource@1.5.1/dist/vue-resource.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<style type="text/css">
opacity: 0;
width: 100%;
background:
}
.thematic{
position: relative;
width: 7.5rem;
margin: 0 auto;
}
/*list商品列表*/
.product_list_wp{
width: 6.9rem;
padding: 0.3rem 0.2rem;
overflow: hidden;
border-radius: 0.2rem;
background:
margin: 0 auto;
}
.product_list_wp ul:after{
display: block;
height: 0;
visibility: hidden;
content: " ";
clear: both;
}
.product_list_wp .list li{
position: relative;
float: left;
width: 2.2rem;
height: 4.3rem;
overflow: hidden;
background:
margin: 0 0.05rem 0.1rem 0.05rem;
border-radius: 0.1rem;
}
.product_list_wp .list li .figure{
width: 2.2rem;
height: 2.2rem;
}
.product_list_wp .list li .figure img{
display: block;
width: 2.2rem;
height: 2.2rem;
}
.product_list_wp .list li .g_title{
width: 1.92rem;
height: 0.63rem;
margin: 0.1rem auto 0;
display: table;
overflow: hidden;
}
.product_list_wp .list li .g_title .son{
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
font-size: 0.24rem;
color:
line-height: 0.31rem;
}
.product_list_wp .list li .dd{
height: 0.8rem;
margin: 0.2rem auto 0;
width: 2rem;
}
.product_list_wp .list li .price_wp{
float: left;
width: 1.4rem;
margin-top: 0.6rem;
}
.product_list_wp .list li .price_wp_hy{
float: left;
width: 1.4rem;
}
.price_wp_hy .y_price{
height: 0.33rem;
line-height: 0.33rem;
font-size: 0.2rem;
color:
}
.price_wp_hy .x_price{
height: 0.45rem;
line-height: 0.45rem;
font-size: 0.32rem;
color:
font-weight: bold;
}
.price_wp_hy .x_price span{
font-size: 0.2rem;
float: left;
margin-top: 0.03rem;
}
.price_wp_hy .mgroup{
width: 0.92rem;
height: 0.24rem;
margin-top: 0.01rem;
}
.price_wp_hy .mgroup img{
display: block;
width: 0.92rem;
height: 0.24rem;
}
.product_list_wp .list li .in_scart {
float: right;
width: 0.6rem;
height: 0.6rem;
margin-top: 0.3rem;
margin-right: 0.1rem;
}
.price_wp .x_price{
height: 0.45rem;
line-height: 0.45rem;
font-size: 0.32rem;
color:
font-weight: bold;
}
.price_wp .x_price span{
font-size: 0.2rem;
float: left;
margin-top: 0.03rem;
}
.product_list_wp .list li .in_scart img{
display: block;
width: 0.6rem;
height: 0.6rem;
}
.product_list_wp .list li .price_wp_a{
float: left;
width: 1.4rem;
}
.price_wp_a .x_price{
height: 0.45rem;
line-height: 0.45rem;
font-size: 0.2rem;
color:
font-weight: 500;
text-decoration: line-through;
overflow: hidden;
}
.price_wp_a .x_price span{
font-size: 0.2rem;
float: left;
margin-top: 0.03rem;
}
.price_wp_a .a_price{
height: 0.45rem;
line-height: 0.45rem;
font-size: 0.32rem;
color:
font-weight: bold;
}
.price_wp_a .a_price span{
font-size: 0.2rem;
float: left;
margin-top: 0.03rem;
}
.product_list_wp .list li .price_wp_y{
float: left;
width: 1.4rem;
margin-top: 0.4rem;
}
.price_wp_y .a_price{
height: 0.45rem;
line-height: 0.45rem;
font-size: 0.32rem;
color:
font-weight: bold;
margin-left: 0.1rem;
}
.price_wp_y .a_price span{
font-size: 0.2rem;
float: left;
margin-top: 0.03rem;
}
/*.product_list_wp .list li .flag{
position: absolute;
left: 50%;
top: 0.5rem;
margin-left: -0.6rem;
width: 1.2rem;
height: 1.2rem;
}*/
.product_list_wp .list li .flag {
position: absolute;
width: 2.2rem;
height: 2.2rem;
top: 0;
left: 0;
background:rgba(0,0,0,0.6);
}
.product_list_wp .list li .flag img{
display: block;
width: 1.5rem;
height: 1.3rem;
margin: 0 auto;
padding: 0.45rem 0;
}
.mc_list {
margin: 0 auto;
}
.active_state{
width: 7.2rem;
margin: 0 auto;
padding: 0.3rem 0;
}
.active_tit {
margin: 0 auto;
background: url(img/ac_title.png) no-repeat left top;
background-size: 6.24rem 0.8rem;
width: 6.24rem;
height: 0.8rem;
font-size: 0.32rem;
color:
font-weight: 500;
text-align: center;
line-height: 0.8rem;
}
.active_tit span{
font-size: 0.24rem;
}
.con_list {
font-size: 13px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
background:
}
.banner_act_1 {
width: 7.5rem;
height: 8rem;
}
.banner_act_1 img{
display: block;
width: 7.5rem;
height: 8rem;
}
/*浮动购物车*/
.float_scart{
position: fixed;
z-index: 9998;
bottom: 1.5rem;
right: 0.2rem;
width: 1rem;
height: 1rem;
}
.float_scart img{
display: block;
width: 1rem;
height: 1rem;
}
.float_scart .num{
position: absolute;
z-index: 9999;
top: 0;
right: 0;
background-color:
width: 0.4rem;
height: 0.4rem;
border-radius: 0.2rem;
text-align:center;
line-height: 0.4rem;
color:
font-weight:normal;
font-size: 0.24rem;
}
.backhome {
z-index: 99999;
position: fixed;
bottom: 0.45rem;
right: 0.2rem;
width: 1rem;
height: 1rem;
text-align: center;
box-sizing: border-box;
border-radius: 50%;
/*background: white;*/
background-size:0.5rem 0.5rem;
display: flex;
justify-content: center;
align-items: center;
}
.backhome img{
display: block;
position: relative;
width: 1rem;
height: 1rem;
}
.bg_overlay{
background-color: rgba(0,0,0,0)
}
.fixed_nav_bar_1 {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2000;
}
.fixed_nav_bar_1.show{
display: block;
}
.h_fixed {
height: 44px;
}
.zero_icon {
position: absolute;
width: 1.27rem;
height: 1rem;
top: 0.2rem;
right: 0.2rem;
}
.zero_icon img{
display: block;
width: 1.27rem;
height: 1rem;
}
.class_name {
width: 4.25rem;
height: 0.9rem;
margin: 0.4rem auto;
border-radius: 0.45rem;
text-align: center;
font-size: 0.32rem;
color:
line-height: 0.9rem;
font-weight: 500;
}
.van-toast {
background: rgba(50,50,51,.75);
}
.active_state_con {
width: 7rem;
height: 3.5rem;
margin: 0 auto;
background:
border-radius: 0.2rem;
padding: 0.25rem 0.1rem;
box-shadow:1px 5px 0px 0px rgba(215,121,0,1);
overflow: hidden;
}
.act_con_1 {
width: 6.88rem;
height: 2.48rem;
margin: 0 auto;
background: url(img/vip_bg.png) no-repeat left top;
background-size: 6.88rem 2.48rem;
opacity: 0;
}
.act_con_1.show{
opacity: 1;
}
.act_con_1 .dt_fl {
float: left;
margin: 0.6rem 0 0 0.35rem;
max-width: 3.5rem;
}
.act_con_1 .dt_fl .name_hy{
font-size: 0.5rem;
line-height: 0.72rem;
font-weight: 800;
color:
}
.act_con_1 .dt_fl .act_tips{
margin-top: 0.08rem;
line-height: 0.33rem;
font-size: 0.24rem;
color:
}
.act_con_1 .dt_fl .act_tips span{
color:
}
.act_con_1 .pri_fr {
float: right;
min-width: 2.1rem;
margin: 0.8rem 0.35rem 0 0;
}
.act_con_1 .pri_fr .y_price {
font-size: 0.2rem;
color:
text-align: center;
line-height: 0.4rem;
text-decoration: line-through;
display:none;
}
.act_con_1 .pri_fr .y_price span{
font-size: 0.32rem;
font-weight: 500;
}
.act_con_1 .btn_buy {
overflow: hidden;
padding: 0 0.1rem;
height: 0.6rem;
overflow: hidden;
border-radius: 0.3rem;
background:
text-align: center;
line-height: 0.6rem;
color:
font-size: 0.2rem;
}
.act_con_1 .btn_buy i{
font-style: normal;
font-size: 0.2rem;
float: left;
line-height: 0.7rem;
}
.act_con_1 .btn_buy span{
float: left;
font-size: 0.42rem;
}
.act_con_1 .act_text {
height: 0.66rem;
padding-top: 0.7rem;
font-size: 0.46rem;
font-weight: bold;
color:
text-align: center;
}
.act_con_1 .act_text span{
color:
}
.act_con_1 .date_limit {
width: 4.99rem;
margin: 0 auto;
font-size: 0.24rem;
color:
line-height: 0.33rem;
text-align: right;
}
.hint{
color:
font-size: 0.22rem;
padding: 0.3rem 0 0 0.15rem;
}
.hint .icon{
float: left;
width: 0.28rem;
height: 0.28rem;
}
.hint .icon img{
display: block;
width: 0.28rem;
height: 0.28rem;
}
.hint .text{
float: left;
width: 6.34rem;
font-size: 0.22rem;
line-height: 0.3rem;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
font-size: 0.24rem;
color:
line-height: 0.31rem;
}
.con_list .mc_list .refuelBag{
display:flex;
flex-direction:column;
align-items:center;
height:1.7rem;
background:linear-gradient(270deg,rgba(254,111,89,1) 0%,rgba(255,0,73,1) 100%);
border-radius:8px;
color:
}
.con_list .mc_list .refuelBag .refuel_title{
margin-top:0.2rem;
}
.con_list .mc_list .refuelBag .refuel_num{
font-size:0.36rem;
font-weight:800;
margin-bottom:0.1rem;
}
.con_list .mc_list .refuelBag .refuel_price{
width:1.6rem;
height:0.4rem;
text-align:center;
background:rgba(255,255,255,1);
box-shadow:0px 1px 3px 0px rgba(254,103,88,1);
border-radius:22px;
color:
font-weight:500;
line-height:0.4rem;
}
.con_list .mc_list .product_list_wp .unfold_desc{
color:
display:flex;
height:0.3rem;
line-height:0.3rem;
margin-top:0.3rem;
justify-content: center;
}
.mc_list .refuel_list{
margin-bottom:0.3rem;
}
.product_list_wp .unfold_desc img{
width:0.28rem;
height:0.28rem;
font-size:0.22rem;
}
</style>
</head>
<body>
<div id="app" ref="ulCenter">
<div class="thematic">
<div class="banner_act_1">
<img :src="banner"/>
</div>
</div>
<div class="con_list">
<div class="active_state">
<div class="active_tit">
活动说明
</div>
<div class="active_state_con">
<!--购买-->
<div class="act_con_1" v-if="isMember" :class="isMember ? 'show' : ''">
<div class="act_text">
本期您还剩<span>{{remainingSize}}次</span>特权机会
</div>
<div class="date_limit">
有效期:{{endTime}}
</div>
</div>
<!--购买end-->
<!--未购买-->
<div class="act_con_1" v-else :class="!isMember ? 'show' : ''">
<div class="dt_fl">
<div class="name_hy">
水果包月特权
</div>
<div class="act_tips">
每月享<span>{{orderSize}}次</span>水果任性选机会
</div>
</div>
<div class="pri_fr">
<div class="y_price">
原价:¥<span>{{oldMemberPrice}}</span>
</div>
<div class="btn_buy" @click="buyFuritVip">
<i>¥</i>
<span class="pri">{{activityMemberPrice}}</span>
立即抢购>
</div>
</div>
</div>
<!--未购买end-->
<div class="hint" @click="showAllSign">
<div class="icon">
<img src="img/warn_icon.png"/>
</div>
<div class="text">
{{activityRule}}
</div>
</div>
</div>
</div>
<div class="active_tit" v-if="isMember">
低价购买加油包<span>(请在{{endTime}}前购买使用)</span>
</div>
<div class="mc_list" v-if="isMember">
<van-list>
<div class="product_list_wp refuel_list">
<ul class="list">
<li :key="index" v-for="(product, index) in refuelBag" class="refuelBag" v-if="index<maxShow" @click="buynow(product.id)">
<div class="refuel_title">限量加油包</div>
<div class="refuel_num">{{product.limitBuySize}}次</div>
<div class="refuel_price">¥{{product.buyMoney}}购买</div>
</li>
</ul>
<div class="unfold_desc" v-if="refuelShow" @click="down">
<span>展开</span>
<img src="./img/1.png">
</div>
<div class="unfold_desc" v-else @click="up">
<span>收起</span>
<img src="./img/2.png">
</div>
</div>
</van-list>
</div>
<div class="active_tit">
今日特权商品<span>(会员可免费任选三种水果)</span>
</div>
<div class="mc_list">
<van-list
v-model="loading2"
:finished="finished2"
finished-text="没有更多数据了"
@load="onLoadtwo"
>
<div class="product_list_wp">
<ul class="list">
<li :key="index" v-for="(product, index) in yesInfo">
<div v-if="isMember">
<div class="figure" @click="nowBuy(product.id, product.activityStock, 5)">
<img :src="product.logo"/>
</div>
<div class="g_title" @click="nowBuy(product.id, product.activityStock, 5)">
<div class="son">
{{product.productName}}
</div>
</div>
<div class="price_wp_y">
<div class="a_price">
<span>¥</span>0
</div>
</div>
<div v-if="product.isFreeEatProduct" class="in_scart" @click="newAddCart(product.id, product.activityStock, 5, index)">
<img src="img/small_cart_icon.png"/>
</div>
<div v-else class="in_scart" @click="newAddCart(product.id, product.activityStock, null, index)">
<img src="img/small_cart_icon.png"/>
</div>
</div>
<div v-else @click="nomember">
<div class="figure">
<img :src="product.logo"/>
</div>
<div class="g_title">
<div class="son">
{{product.productName}}
</div>
</div>
<div class="price_wp_y">
<div class="a_price">
<span>¥</span>0
</div>
</div>
<div class="in_scart">
<img src="img/small_cart_icon.png"/>
</div>
</div>
<div class="flag" v-if="product.state == 1">
<img src="img/has_qg.png"/>
</div>
</li>
</ul>
</div>
</van-list>
</div>
<div class="active_tit">
推荐商品
</div>
<div class="mc_list">
<van-list
v-model="loading2"
:finished="finished2"
finished-text="没有更多数据了"
@load="onLoadtwo"
>
<div class="product_list_wp">
<ul class="list">
<li :key="index" v-for="(product, index) in yesInfo">
<div @click="gosimpleProduct(product.id)">
<div class="figure">
<img :src="product.logo"/>
</div>
<div class="g_title">
<div class="son">
{{product.productName}}
</div>
</div>
<div class="price_wp_y">
<div class="a_price">
<span>¥</span>{{product.price}}
</div>
</div>
<div class="in_scart">
<img src="img/small_cart_icon.png"/>
</div>
</div>
<div class="flag" v-if="product.state == 1">
<img src="img/has_qg.png"/>
</div>
</li>
</ul>
</div>
</van-list>
</div>
</div>
<!--浮动购物车-->
<div class="float_scart" @click="goCart" ref="cart">
<img src="img/gcart.png"/>
<div class="num" v-if="cartNum">{{cartNum > 99 ? '99+' : cartNum}}</div>
<div class="num ttt" style="opacity: 0;"></div>
</div>
<!--返回首页-->
<div class="backhome" @click="backindex">
<img src="img/home.png" />
</div>
<!--蒙版-->
<van-overlay
:show="isshowloading"
class-name="bg_overlay"
>
</van-overlay>
</div>
</body>
<script>
var Vue = window.Vue;
var vant = window.vant;
// 注册 组件
Vue.use(vant.Tab);
Vue.use(vant.Tabs);
Vue.use(vant.List);
Vue.use(vant.Overlay);
Vue.use(vant.Dialog);
var app = new Vue({
el: '#app',
data: {
noBuyFruit: true,
isshowloading: false,
searchBarFixed: false,
show: false,
loading2: false,
finished2: false,
colorValue: '5BB15D',
className: "全部",
// api: "http://192.168.1.135:8090/web/",
api: "http://pic.tongchengxianggou.com:9011/",
// api: "https://ha.tongchengxianggou.com/",// 线上
pageNum: 1,
activityProductType: null,
activityId: null,
yesInfo: [],
fruitMemberId:null,
uuid: null,
cartNum: null,
isoriginalpri: 0,
title: "专题活动",
banner: "",
remainingSize: null,
isMember: false,
endTime: null,
enabled: null,
activityRule: "",
oldMemberPrice: null,
activityMemberPrice: null,
orderSize: null,
refuelShow:true,
maxShow:3,
refuelBag:[
{id:1,limitBuySize:1,buyMoney:3}
]
},
methods: {
buynow(id){
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.switchTab({url: '../index/index'});
} else {
alert("fruitCumulativePack?"+this.fruitMemberId+","+id);
}
},
getcumulativelist(){
//获取加油包列表
var url = window.location.href;
var uuid = this.getUrlParam(url, 'uuid');
if(this.isMember){
this.$http.post(
''+ this.api +'api/buy/fruit/cumulative/list',
{
uuid: uuid,
fruitMemberId:this.fruitMemberId
},
{
emulateJSON: true
})
.then(function(res){
if (res.status == 200) {
this.refuelBag=res.data.data;
}
}, function(err){
console.log(err);
});
}
},
nomember() {
var that = this;
vant.Dialog.confirm({
title: '',
message: '您还不是会员,<br/>开通后立享包月吃水果特权!',
confirmButtonText: '去开通',
confirmButtonColor: '#51b237'
}).then(function() {
that.buyFuritVip();
// on confirm
}).catch(function() {
// on cancel
});
},
gosimpleProduct(id){
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.navigateTo({url: '../shop/product?id='+id});
} else {
alert("buy?"+id);
}
},
showAllSign() {
var that = this;
vant.Dialog.alert({
title: '活动规则',
message: that.activityRule,
confirmButtonColor: "#3FD15B"
}).then(function() {
// on close
});
},
backindex() {
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.switchTab({url: '../index/index'});
} else {
alert("home");
}
},
goCart() {
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateTo({url: '../index/cart2'});
} else {
alert("cart");
}
},
// 0元 1
nowBuy(id, stock, type , e) {
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.navigateTo({url: '../shop/product?id='+id+"&type="+type});
} else {
// 测试
alert("buy?" + id + "," + type);
// 线上
// alert("buy?" + id);
}
},
// 去买会员
buyFuritVip() {
var url = window.location.href;
var uuid = this.getUrlParam(url, 'uuid');
if (uuid) {
this.$http.post(
''+ this.api +'api/new/user',
{
uuid: uuid
},
{
emulateJSON: true
})
.then(function(res){
if (res.status == 200) {
if (res.body == "'login'") {
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.navigateTo({url: '../login/login'});
} else {
alert("login");
}
} else {
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.navigateTo({url: '../sub/mon'});
} else {
alert("fruitVip");
}
}
}
}, function(err){
console.log(err);
});
}else{
alert('login');
}
},
newAddCart(id, stock, activityType, event) {
var that = this;
if (id) {
this.isshowloading = true;
var url = window.location.href;
var uuid = this.getUrlParam(url, 'uuid');
if (uuid) {
this.$http.post(
''+ this.api +'api/user/cart/newAddDo',
{
uuid: uuid,
id: id,
activityType: activityType
},
{
emulateJSON: true
}
)
.then(function(res){
this.isshowloading = false;
if(res.body.state == 'login'){
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.navigateTo({url: '../login/login'});
} else {
alert("login");
}
} else {
if (res.body.code == 0) {
this.cartNum = res.body.enableCount;
vant.Toast({
type: "text",
position: "bottom",
message: "加入购物车成功"
});
}
if (res.body.code == 1) {
// 库存不足
vant.Toast({
type: "fail",
icon: "fail",
message: "库存不足"
});
this.cartNum = res.body.enableCount;
}
if (res.body.code == 2) {
// 商品下架
vant.Toast({
type: "fail",
icon: "fail",
message: "已经被抢光了哦~"
});
this.cartNum = res.body.enableCount;
}
if (res.body.code == 15) {
// 商品下架
vant.Toast({
type: "fail",
icon: "fail",
message: "水果VIP活动单个商品一次只能购买一件"
});
this.cartNum = res.body.enableCount;
}
if (res.body.code == 16) {
// 商品下架
vant.Toast({
type: "fail",
icon: "fail",
message: "水果VIP活动商品一次只能购买3件"
});
this.cartNum = res.body.enableCount;
}
if (res.body.code == 17) {
// 商品下架
vant.Toast({
type: "fail",
icon: "fail",
message: "水果VIP活动商品一天只能下一单"
});
this.cartNum = res.body.enableCount;
}
if (res.body.code == 8) {
// 商品下架
vant.Toast({
type: "fail",
icon: "fail",
message: "0元商品只能添加一个"
});
this.cartNum = res.body.enableCount;
}
if (res.body.code == 3) {
// 售罄
vant.Toast({
type: "fail",
icon: "fail",
message: "已售罄"
});
this.cartNum = res.body.enableCount;
}
}
}, function(res){
this.isshowloading = false;
console.log(err)
});
} else {
this.isshowloading = false;
if (window.__wxjs_environment === 'miniprogram'){
wx.miniProgram.navigateTo({url: '../login/login'});
} else {
alert("login");
}
}
}
},
bannerclick(state, thisurl){
var url = window.location.href;
var uuid = this.getUrlParam(url, 'uuid');
// console.log(thisurl.indexOf('/pages/member/center'));
if(state == 1){
if(thisurl.indexOf("http") != -1){
window.location.href=thisurl+"&uuid=" + uuid
}else{
if(thisurl.indexOf("/balance/recharge") != -1){
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateTo({url: thisurl});
} else {
alert('charge');
}
}else if(thisurl.indexOf("/pages/member/center") != -1){
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateTo({url: thisurl});
} else {
alert('memberCenter');
}
}else{
if (thisurl.length > 2) {
if (window.__wxjs_environment === 'miniprogram') {
if(thisurl.indexOf("/pages/index/index") != -1){
wx.miniProgram.switchTab({url: thisurl});
}else{
wx.miniProgram.navigateTo({url: thisurl});
}
} else {
alert('miniProgram,'+thisurl);
}
}
}
}
}else{
console.log("没有跳转")
}
},
getUrlParam(url, name) {
var pattern = new RegExp("[?&]" + name +"\=([^&]+)","g");
var matcher = pattern.exec(url);
var items = null;
if(matcher != null){
try{
items = decodeURIComponent(decodeURIComponent(matcher[1]));
}catch(e){
try{
items = decodeURIComponent(matcher[1]);
}catch(e){
items = matcher[1];
}
}
}
return items;
},
onLoadtwo() {
this.show = true;
var url = window.location.href;
var uuid = this.getUrlParam(url, 'uuid');
this.isshowloading = true;
if (this.loading2 === true && this.finished2 === false) {
this.$http.post(
''+ this.api +'api/v3/freeeat/fruit',
{
uuid: uuid,
page: this.pageNum ++,
max: 10
},
{
emulateJSON: true
})
.then(function(res){
this.isshowloading = false;
if (res.body.code === 200) {
this.show = false;
if (res.body.data.enabled == 1) {
this.activityRule = res.body.data.activityRule; // 规则
this.banner = res.body.data.banner;
this.isMember = res.body.data.isMember;
var Title = document.getElementsByTagName('title')[0].text = res.body.data.title;
if (res.body.data.isMember) {
this.remainingSize = res.body.data.remainingSize; // 会员次数
this.endTime = res.body.data.endTime; // 截止时间
this.fruitMemberId=res.body.data.fruitMemberId;
this.getcumulativelist();
} else {
this.orderSize = res.body.data.orderSize; // 次数
this.activityMemberPrice = res.body.data.activityMemberPrice; // 会员价格
this.oldMemberPrice = res.body.data.oldMemberPrice; // 会员原价
}
if (res.body.data.productList.length != 0) {
//新增数据拼接在后面
this.yesInfo = this.yesInfo.concat(res.body.data.productList);
}
this.loading2 = false;
this.showLoad2 = false;
if (res.body.data.productList.length == 0) {
this.loading2 = false;
this.finished2 = true;
this.loadText = "加载完成";
}
}
if (res.body.data.enabled == 2) {
this.loading2 = false;
this.finished2 = true;
this.loadText = "加载完成";
vant.Toast({
duration: 0,
type: "fail",
icon: "cross",
message: "活动暂未开通"
});
}
} else {
this.show = false;
this.finished2 = true;
this.loading2 = false;
this.showLoad2 = false;
// Toast(res.data.msg);
}
}, function(err){
this.isshowloading = false;
console.log(err);
});
// 异步更新数据,跟用list时的onLoad中代码是一样的
// 加载状态结束
// this.loading = false;
// this.showLoad = false;
}
},
// 获取0元列表和
getzero() {
},
down(){
this.maxShow=this.refuelBag.length;
this.refuelShow=false;
},
up(){
this.maxShow=3;
this.refuelShow=true;
}
},
created() {
var url = window.location.href;
var activityId = this.getUrlParam(url, 'activityId');
var uuid = this.getUrlParam(url, 'uuid');
// 获取购物车信息
if (uuid) {
this.$http.post(
''+ this.api +'api/user/cart/newInfo',
{
uuid: uuid
},
{
emulateJSON: true
})
.then(function(res){
if (res.status === 200) {
this.cartNum = res.body.enableCount;
}
}, function(err){
console.log(err);
});
}
},
mounted() {
this.$refs.ulCenter.style.opacity = 1;
}
})
</script>
</html>