作者 wumengyu

优化我的钱包背景图,添加倒计时结束调用的接口,发布和参与添加formid,添加城市切换,优化活动票样式

... ... @@ -150,9 +150,28 @@ Page({
join_people: res.data.son,
commentList:res.data.common,
is_collect:res.data.is_collect,
count:res.data.count,
count:res.data.count, // 留言板
});
self.countDown();
// (0全部,2待处理,4已拼成,5已取消,6已完成
const status = res.data.active.status;
if(status ===2 || status ===4 || status ===6 || status ===7) {
console.log('调用倒计时');
self.countDown();
}else {
console.log('不调用倒计时');
let countDownArr = [];
let obj = null;
obj = {
day: '00',
hou: '00',
min: '00',
sec: '00'
};
countDownArr.push(obj);
this.setData({
'detail.time': countDownArr,
});
}
}
// wx.hideLoading()
})
... ...
... ... @@ -73,7 +73,7 @@
<!--详细时间-->
<view class="detail-box">
<text>时间:{{end_time}}</text>
<text>餐厅:{{detail.addr}}</text>
<text>餐厅:{{detail.name}}</text>
<view class="position" bindtap="getNavigate">
<text class="address">地址:{{detail.address}}</text>
<text class="iconfont icon-location"></text>
... ...
<view class="img-box" data-index="{{index}}">
<view class="img-border">
<image src="{{item.pic}}"></image>
<image src="{{item.pic}}" mode="aspectFill"></image>
<view class="area">
<text class="name">{{item.address}}</text>
<text class="num">还差{{item.people}}人</text>
... ...
... ... @@ -236,7 +236,7 @@ Page({
});
} else if (+self.data.is_write === 1 && wx.getStorageSync('is_canSend') === 1 && wx.getStorageSync('is_answer') === 1) { //已填写且可以发布 =>去发布
self.setData({
is_showRelease: true //弹出 去答题弹框
is_showRelease: true //弹出 发布弹框
});
} else if (+self.data.is_write === 1 && wx.getStorageSync('is_canSend') === 2 && wx.getStorageSync('is_answer') === 1) {
wx.showToast({title: '等级不够,无法使用发布功能', icon: 'none'})
... ...
... ... @@ -20,6 +20,38 @@ Page({
list: [],
page_number:1,
hasMore:true,
cityList: [],
addr:'', //切换地址
},
//获取城市列表
getCityList() {
const self = this;
let url = '/portal/Index/cityList';
app.post(url, {}, {}).then((res) => {
console.log('获取城市列表', res);
if (+res.code === 1) {
const arr = [];
res.data.list.forEach((item) => {
arr.push(item.title)
});
self.setData({
city_picker_list: arr,
cityList:res.data.list,
});
}
})
},
//切换城市
cityPickerChange(e) {
this.setData({
current_city: e.detail.value,
is_city_change: true
});
const lat = this.data.cityList[e.detail.value].latng.split(',')[1];
const lng = this.data.cityList[e.detail.value].latng.split(',')[0];
this.setData({latitude: lat, longitude: lng,addr:this.data.cityList[e.detail.value].title});
console.log('lat', 'lng',lat,lng);
this.getTypeList();
},
goPostDetail(e) {
const id = +e.currentTarget.dataset.id;
... ... @@ -162,7 +194,7 @@ Page({
let params = {
lat: self.data.latitude,
lng: self.data.longitude,
addr: self.data.city, // 浮点型 必填 - - 用户位置名称
addr: self.data.is_city_change?self.data.addr:self.data.city, // 浮点型 必填 - - 用户位置名称
keyword: '', // 浮点型 非必填 - - 搜索关键字
score: self.data.score, // 浮点型 非必填 - - 排序(1智能排序,2最具人气,3距离最近)
startTime: self.data.start_time_date,// 浮点型 非必填 - - 筛选开始时间
... ... @@ -223,6 +255,7 @@ Page({
onShow: function () {
const self = this;
self.getLocation();
self.getCityList();
},
/**
... ...
... ... @@ -2,11 +2,13 @@
<view class="fix-box">
<view class="head">
<view class="position">
<view class="left">
<view class="iconfont icon-location"></view>
<text>{{city}}</text>
<view class="iconfont icon-arrow-down"></view>
</view>
<picker class="picker" bindchange="cityPickerChange" value="{{current_city}}" range="{{city_picker_list}}" class="picker">
<view class="left">
<view class="iconfont icon-location"></view>
<text>{{city_picker_list[current_city] || city}}</text>
<view class="iconfont icon-arrow-down"></view>
</view>
</picker>
<view class="right" bindtap="search">
<view class="input"></view>
<image src="../../../images/search@2x.png"></image>
... ...
... ... @@ -164,7 +164,33 @@ Page({
is_collect:res.data.is_collect,
count:res.data.count,
});
self.countDown();
// self.countDown();
// (0全部,2待处理,4已拼成,5已取消,6已完成
// let newTime = new Date().getTime();//当前时间戳
// let end_time = app.nextTime(this.data.end_time, this.data.over_hours);//截止时间
// let endTime = new Date(end_time).getTime(); //截止时间戳
// if (endTime - newTime > 0) {}
const status = res.data.active.status;
if(status ===2 || status ===4 || status ===6 || status ===7) {
console.log('调用倒计时');
self.countDown();
}else {
console.log('不调用倒计时');
let countDownArr = [];
let obj = null;
obj = {
day: '00',
hou: '00',
min: '00',
sec: '00'
};
countDownArr.push(obj);
this.setData({
'detail.time': countDownArr,
});
}
}
// wx.hideLoading()
})
... ... @@ -187,14 +213,6 @@ Page({
console.log('确认拼餐', res);
if (+res.code === 1) {
wx.showToast({title:'拼餐成功',icon:'success'})
// self.setData({
// detail: res.data.active,
// end_time: res.data.active.time,
// over_hours:res.data.active.over_time,//几小时截止
// join_people: res.data.son,
// commenList:res.data.common
// });
// self.countDown();
}
})
},
... ... @@ -203,7 +221,6 @@ Page({
},
countDown() { //倒计时函数
// 获取当前时间,同时得到活动结束时间数组
t = setTimeout(this.countDown, 1000);
let newTime = new Date().getTime();//当前时间戳
let end_time = app.nextTime(this.data.end_time, this.data.over_hours);//截止时间
... ... @@ -226,8 +243,9 @@ Page({
sec: this.timeFormat(sec)
};
t;
console.log('活动未结束');
} else { //活动已结束,全部设置为'00'
console.log('活动已结束');
obj = {
day: '00',
hou: '00',
... ...
... ... @@ -36,7 +36,7 @@
<block wx:for="{{detail.banner}}" wx:key="index">
<navigator url="{{item}}" hover-class="navigator-hover">
<swiper-item>
<image src="{{item}}" class="slide-image"/>
<image src="{{item}}" class="slide-image" mode="aspectFill"/>
<!--<image src="http://pk86rwhci.bkt.clouddn.com/banner.png" class="slide-image"></image>-->
</swiper-item>
</navigator>
... ... @@ -76,7 +76,7 @@
<!--详细时间-->
<view class="detail-box">
<text>时间:{{end_time}}</text>
<text>餐厅:{{detail.addr}}</text><!--餐厅-->
<text>餐厅:{{detail.name}}</text><!--餐厅-->
<view class="position" bindtap="getNavigate">
<text class="address">地址:{{detail.address}}</text><!--地址:-->
<!--侨福芳草地B2 OPERA BOMBANA-->
... ...
... ... @@ -105,7 +105,7 @@ Page({
}else if(this.data.time === '') {
wx.showToast({title:'请选择时间',icon:'none'})
}else if(this.data.address === '') {
wx.showToast({title:'请填写地点',icon:'none'})
wx.showToast({title:'请填写餐厅',icon:'none'})
}else if(this.data.address_position === '') {
wx.showToast({title:'请定位地址',icon:'none'})
}else if(this.data.over_time === '') {
... ...
... ... @@ -45,6 +45,7 @@
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
border-radius:50%;
}
.no-data {
width: 100%;
... ...
... ... @@ -14,7 +14,7 @@
<view class='content_item' wx:for="{{orderList}}" wx:key="index"
bindtap='goPostDetail' data-index="{{index}}" data-id="{{item.id}}">
<!--<image src="../../images/lishi@2x.png" class="thumb"></image>-->
<image src="{{item.pic}}" class="thumb"></image>
<image src="{{item.pic}}" class="thumb" mode="aspectFill"></image>
<view class="lish-right">
<view class="title-box">
<view class="title">{{item.title}}</view>
... ... @@ -28,7 +28,7 @@
<view class="name-left">
<!--<image src="../../images/avatar@2x.png" class="avatar"></image>-->
<image src="{{item.userPic}}" class="avatar"></image>
<text>{{item.userName}} 在{{item.addr}}</text>
<text>{{item.userName}} 在{{item.name}}</text>
</view>
<view class="btn">
<text wx:if="{{item.status === 5 || item.status === 6}}" catchtap="cancel" data-id="{{item.id}}">删除</text>
... ...
... ... @@ -89,7 +89,7 @@
<view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}"
bindtap='goMealDetail' data-index="{{index}}" data-id="{{item.id}}">
<!--<image src="http://pk86rwhci.bkt.clouddn.com/activity_img@2x.png"></image>-->
<image src="{{item.pic}}"></image>
<image src="{{item.pic}}" mode="aspectFill"></image>
<view class="title">
<text class="area">{{item.address}}</text>
<text class="num">还差{{item.people}}人</text>
... ... @@ -107,7 +107,7 @@
<view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}"
bindtap='goActivityDetail' data-index="{{index}}" data-id="{{item.id}}">
<!--<image src="http://pk86rwhci.bkt.clouddn.com/b1@2x%20%281%29.png"></image>-->
<image src="{{item.pic}}"></image>
<image src="{{item.pic}}" mode="aspectFill"></image>
<view class="title">
<text class="area">{{item.address}}</text>
<text class="num">还差{{item.people}}人</text>
... ...