作者 wumengyu

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

@@ -150,9 +150,28 @@ Page({ @@ -150,9 +150,28 @@ Page({
150 join_people: res.data.son, 150 join_people: res.data.son,
151 commentList:res.data.common, 151 commentList:res.data.common,
152 is_collect:res.data.is_collect, 152 is_collect:res.data.is_collect,
153 - count:res.data.count, 153 + count:res.data.count, // 留言板
154 }); 154 });
  155 + // (0全部,2待处理,4已拼成,5已取消,6已完成
  156 + const status = res.data.active.status;
  157 + if(status ===2 || status ===4 || status ===6 || status ===7) {
  158 + console.log('调用倒计时');
155 self.countDown(); 159 self.countDown();
  160 + }else {
  161 + console.log('不调用倒计时');
  162 + let countDownArr = [];
  163 + let obj = null;
  164 + obj = {
  165 + day: '00',
  166 + hou: '00',
  167 + min: '00',
  168 + sec: '00'
  169 + };
  170 + countDownArr.push(obj);
  171 + this.setData({
  172 + 'detail.time': countDownArr,
  173 + });
  174 + }
156 } 175 }
157 // wx.hideLoading() 176 // wx.hideLoading()
158 }) 177 })
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 <!--详细时间--> 73 <!--详细时间-->
74 <view class="detail-box"> 74 <view class="detail-box">
75 <text>时间:{{end_time}}</text> 75 <text>时间:{{end_time}}</text>
76 - <text>餐厅:{{detail.addr}}</text> 76 + <text>餐厅:{{detail.name}}</text>
77 <view class="position" bindtap="getNavigate"> 77 <view class="position" bindtap="getNavigate">
78 <text class="address">地址:{{detail.address}}</text> 78 <text class="address">地址:{{detail.address}}</text>
79 <text class="iconfont icon-location"></text> 79 <text class="iconfont icon-location"></text>
1 <view class="img-box" data-index="{{index}}"> 1 <view class="img-box" data-index="{{index}}">
2 <view class="img-border"> 2 <view class="img-border">
3 - <image src="{{item.pic}}"></image> 3 + <image src="{{item.pic}}" mode="aspectFill"></image>
4 <view class="area"> 4 <view class="area">
5 <text class="name">{{item.address}}</text> 5 <text class="name">{{item.address}}</text>
6 <text class="num">还差{{item.people}}人</text> 6 <text class="num">还差{{item.people}}人</text>
@@ -236,7 +236,7 @@ Page({ @@ -236,7 +236,7 @@ Page({
236 }); 236 });
237 } else if (+self.data.is_write === 1 && wx.getStorageSync('is_canSend') === 1 && wx.getStorageSync('is_answer') === 1) { //已填写且可以发布 =>去发布 237 } else if (+self.data.is_write === 1 && wx.getStorageSync('is_canSend') === 1 && wx.getStorageSync('is_answer') === 1) { //已填写且可以发布 =>去发布
238 self.setData({ 238 self.setData({
239 - is_showRelease: true //弹出 去答题弹框 239 + is_showRelease: true //弹出 发布弹框
240 }); 240 });
241 } else if (+self.data.is_write === 1 && wx.getStorageSync('is_canSend') === 2 && wx.getStorageSync('is_answer') === 1) { 241 } else if (+self.data.is_write === 1 && wx.getStorageSync('is_canSend') === 2 && wx.getStorageSync('is_answer') === 1) {
242 wx.showToast({title: '等级不够,无法使用发布功能', icon: 'none'}) 242 wx.showToast({title: '等级不够,无法使用发布功能', icon: 'none'})
@@ -20,6 +20,38 @@ Page({ @@ -20,6 +20,38 @@ Page({
20 list: [], 20 list: [],
21 page_number:1, 21 page_number:1,
22 hasMore:true, 22 hasMore:true,
  23 + cityList: [],
  24 + addr:'', //切换地址
  25 + },
  26 + //获取城市列表
  27 + getCityList() {
  28 + const self = this;
  29 + let url = '/portal/Index/cityList';
  30 + app.post(url, {}, {}).then((res) => {
  31 + console.log('获取城市列表', res);
  32 + if (+res.code === 1) {
  33 + const arr = [];
  34 + res.data.list.forEach((item) => {
  35 + arr.push(item.title)
  36 + });
  37 + self.setData({
  38 + city_picker_list: arr,
  39 + cityList:res.data.list,
  40 + });
  41 + }
  42 + })
  43 + },
  44 + //切换城市
  45 + cityPickerChange(e) {
  46 + this.setData({
  47 + current_city: e.detail.value,
  48 + is_city_change: true
  49 + });
  50 + const lat = this.data.cityList[e.detail.value].latng.split(',')[1];
  51 + const lng = this.data.cityList[e.detail.value].latng.split(',')[0];
  52 + this.setData({latitude: lat, longitude: lng,addr:this.data.cityList[e.detail.value].title});
  53 + console.log('lat', 'lng',lat,lng);
  54 + this.getTypeList();
23 }, 55 },
24 goPostDetail(e) { 56 goPostDetail(e) {
25 const id = +e.currentTarget.dataset.id; 57 const id = +e.currentTarget.dataset.id;
@@ -162,7 +194,7 @@ Page({ @@ -162,7 +194,7 @@ Page({
162 let params = { 194 let params = {
163 lat: self.data.latitude, 195 lat: self.data.latitude,
164 lng: self.data.longitude, 196 lng: self.data.longitude,
165 - addr: self.data.city, // 浮点型 必填 - - 用户位置名称 197 + addr: self.data.is_city_change?self.data.addr:self.data.city, // 浮点型 必填 - - 用户位置名称
166 keyword: '', // 浮点型 非必填 - - 搜索关键字 198 keyword: '', // 浮点型 非必填 - - 搜索关键字
167 score: self.data.score, // 浮点型 非必填 - - 排序(1智能排序,2最具人气,3距离最近) 199 score: self.data.score, // 浮点型 非必填 - - 排序(1智能排序,2最具人气,3距离最近)
168 startTime: self.data.start_time_date,// 浮点型 非必填 - - 筛选开始时间 200 startTime: self.data.start_time_date,// 浮点型 非必填 - - 筛选开始时间
@@ -223,6 +255,7 @@ Page({ @@ -223,6 +255,7 @@ Page({
223 onShow: function () { 255 onShow: function () {
224 const self = this; 256 const self = this;
225 self.getLocation(); 257 self.getLocation();
  258 + self.getCityList();
226 }, 259 },
227 260
228 /** 261 /**
@@ -2,11 +2,13 @@ @@ -2,11 +2,13 @@
2 <view class="fix-box"> 2 <view class="fix-box">
3 <view class="head"> 3 <view class="head">
4 <view class="position"> 4 <view class="position">
  5 + <picker class="picker" bindchange="cityPickerChange" value="{{current_city}}" range="{{city_picker_list}}" class="picker">
5 <view class="left"> 6 <view class="left">
6 <view class="iconfont icon-location"></view> 7 <view class="iconfont icon-location"></view>
7 - <text>{{city}}</text> 8 + <text>{{city_picker_list[current_city] || city}}</text>
8 <view class="iconfont icon-arrow-down"></view> 9 <view class="iconfont icon-arrow-down"></view>
9 </view> 10 </view>
  11 + </picker>
10 <view class="right" bindtap="search"> 12 <view class="right" bindtap="search">
11 <view class="input"></view> 13 <view class="input"></view>
12 <image src="../../../images/search@2x.png"></image> 14 <image src="../../../images/search@2x.png"></image>
@@ -164,7 +164,33 @@ Page({ @@ -164,7 +164,33 @@ Page({
164 is_collect:res.data.is_collect, 164 is_collect:res.data.is_collect,
165 count:res.data.count, 165 count:res.data.count,
166 }); 166 });
  167 + // self.countDown();
  168 +
  169 + // (0全部,2待处理,4已拼成,5已取消,6已完成
  170 +
  171 + // let newTime = new Date().getTime();//当前时间戳
  172 + // let end_time = app.nextTime(this.data.end_time, this.data.over_hours);//截止时间
  173 + // let endTime = new Date(end_time).getTime(); //截止时间戳
  174 + // if (endTime - newTime > 0) {}
  175 + const status = res.data.active.status;
  176 + if(status ===2 || status ===4 || status ===6 || status ===7) {
  177 + console.log('调用倒计时');
167 self.countDown(); 178 self.countDown();
  179 + }else {
  180 + console.log('不调用倒计时');
  181 + let countDownArr = [];
  182 + let obj = null;
  183 + obj = {
  184 + day: '00',
  185 + hou: '00',
  186 + min: '00',
  187 + sec: '00'
  188 + };
  189 + countDownArr.push(obj);
  190 + this.setData({
  191 + 'detail.time': countDownArr,
  192 + });
  193 + }
168 } 194 }
169 // wx.hideLoading() 195 // wx.hideLoading()
170 }) 196 })
@@ -187,14 +213,6 @@ Page({ @@ -187,14 +213,6 @@ Page({
187 console.log('确认拼餐', res); 213 console.log('确认拼餐', res);
188 if (+res.code === 1) { 214 if (+res.code === 1) {
189 wx.showToast({title:'拼餐成功',icon:'success'}) 215 wx.showToast({title:'拼餐成功',icon:'success'})
190 - // self.setData({  
191 - // detail: res.data.active,  
192 - // end_time: res.data.active.time,  
193 - // over_hours:res.data.active.over_time,//几小时截止  
194 - // join_people: res.data.son,  
195 - // commenList:res.data.common  
196 - // });  
197 - // self.countDown();  
198 } 216 }
199 }) 217 })
200 }, 218 },
@@ -203,7 +221,6 @@ Page({ @@ -203,7 +221,6 @@ Page({
203 }, 221 },
204 222
205 countDown() { //倒计时函数 223 countDown() { //倒计时函数
206 - // 获取当前时间,同时得到活动结束时间数组  
207 t = setTimeout(this.countDown, 1000); 224 t = setTimeout(this.countDown, 1000);
208 let newTime = new Date().getTime();//当前时间戳 225 let newTime = new Date().getTime();//当前时间戳
209 let end_time = app.nextTime(this.data.end_time, this.data.over_hours);//截止时间 226 let end_time = app.nextTime(this.data.end_time, this.data.over_hours);//截止时间
@@ -226,8 +243,9 @@ Page({ @@ -226,8 +243,9 @@ Page({
226 sec: this.timeFormat(sec) 243 sec: this.timeFormat(sec)
227 }; 244 };
228 t; 245 t;
229 - 246 + console.log('活动未结束');
230 } else { //活动已结束,全部设置为'00' 247 } else { //活动已结束,全部设置为'00'
  248 + console.log('活动已结束');
231 obj = { 249 obj = {
232 day: '00', 250 day: '00',
233 hou: '00', 251 hou: '00',
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <block wx:for="{{detail.banner}}" wx:key="index"> 36 <block wx:for="{{detail.banner}}" wx:key="index">
37 <navigator url="{{item}}" hover-class="navigator-hover"> 37 <navigator url="{{item}}" hover-class="navigator-hover">
38 <swiper-item> 38 <swiper-item>
39 - <image src="{{item}}" class="slide-image"/> 39 + <image src="{{item}}" class="slide-image" mode="aspectFill"/>
40 <!--<image src="http://pk86rwhci.bkt.clouddn.com/banner.png" class="slide-image"></image>--> 40 <!--<image src="http://pk86rwhci.bkt.clouddn.com/banner.png" class="slide-image"></image>-->
41 </swiper-item> 41 </swiper-item>
42 </navigator> 42 </navigator>
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <!--详细时间--> 76 <!--详细时间-->
77 <view class="detail-box"> 77 <view class="detail-box">
78 <text>时间:{{end_time}}</text> 78 <text>时间:{{end_time}}</text>
79 - <text>餐厅:{{detail.addr}}</text><!--餐厅--> 79 + <text>餐厅:{{detail.name}}</text><!--餐厅-->
80 <view class="position" bindtap="getNavigate"> 80 <view class="position" bindtap="getNavigate">
81 <text class="address">地址:{{detail.address}}</text><!--地址:--> 81 <text class="address">地址:{{detail.address}}</text><!--地址:-->
82 <!--侨福芳草地B2 OPERA BOMBANA--> 82 <!--侨福芳草地B2 OPERA BOMBANA-->
@@ -105,7 +105,7 @@ Page({ @@ -105,7 +105,7 @@ Page({
105 }else if(this.data.time === '') { 105 }else if(this.data.time === '') {
106 wx.showToast({title:'请选择时间',icon:'none'}) 106 wx.showToast({title:'请选择时间',icon:'none'})
107 }else if(this.data.address === '') { 107 }else if(this.data.address === '') {
108 - wx.showToast({title:'请填写地点',icon:'none'}) 108 + wx.showToast({title:'请填写餐厅',icon:'none'})
109 }else if(this.data.address_position === '') { 109 }else if(this.data.address_position === '') {
110 wx.showToast({title:'请定位地址',icon:'none'}) 110 wx.showToast({title:'请定位地址',icon:'none'})
111 }else if(this.data.over_time === '') { 111 }else if(this.data.over_time === '') {
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 width: 40rpx; 45 width: 40rpx;
46 height: 40rpx; 46 height: 40rpx;
47 margin-right: 16rpx; 47 margin-right: 16rpx;
  48 + border-radius:50%;
48 } 49 }
49 .no-data { 50 .no-data {
50 width: 100%; 51 width: 100%;
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <view class='content_item' wx:for="{{orderList}}" wx:key="index" 14 <view class='content_item' wx:for="{{orderList}}" wx:key="index"
15 bindtap='goPostDetail' data-index="{{index}}" data-id="{{item.id}}"> 15 bindtap='goPostDetail' data-index="{{index}}" data-id="{{item.id}}">
16 <!--<image src="../../images/lishi@2x.png" class="thumb"></image>--> 16 <!--<image src="../../images/lishi@2x.png" class="thumb"></image>-->
17 - <image src="{{item.pic}}" class="thumb"></image> 17 + <image src="{{item.pic}}" class="thumb" mode="aspectFill"></image>
18 <view class="lish-right"> 18 <view class="lish-right">
19 <view class="title-box"> 19 <view class="title-box">
20 <view class="title">{{item.title}}</view> 20 <view class="title">{{item.title}}</view>
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 <view class="name-left"> 28 <view class="name-left">
29 <!--<image src="../../images/avatar@2x.png" class="avatar"></image>--> 29 <!--<image src="../../images/avatar@2x.png" class="avatar"></image>-->
30 <image src="{{item.userPic}}" class="avatar"></image> 30 <image src="{{item.userPic}}" class="avatar"></image>
31 - <text>{{item.userName}} 在{{item.addr}}</text> 31 + <text>{{item.userName}} 在{{item.name}}</text>
32 </view> 32 </view>
33 <view class="btn"> 33 <view class="btn">
34 <text wx:if="{{item.status === 5 || item.status === 6}}" catchtap="cancel" data-id="{{item.id}}">删除</text> 34 <text wx:if="{{item.status === 5 || item.status === 6}}" catchtap="cancel" data-id="{{item.id}}">删除</text>
@@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
89 <view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}" 89 <view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}"
90 bindtap='goMealDetail' data-index="{{index}}" data-id="{{item.id}}"> 90 bindtap='goMealDetail' data-index="{{index}}" data-id="{{item.id}}">
91 <!--<image src="http://pk86rwhci.bkt.clouddn.com/activity_img@2x.png"></image>--> 91 <!--<image src="http://pk86rwhci.bkt.clouddn.com/activity_img@2x.png"></image>-->
92 - <image src="{{item.pic}}"></image> 92 + <image src="{{item.pic}}" mode="aspectFill"></image>
93 <view class="title"> 93 <view class="title">
94 <text class="area">{{item.address}}</text> 94 <text class="area">{{item.address}}</text>
95 <text class="num">还差{{item.people}}人</text> 95 <text class="num">还差{{item.people}}人</text>
@@ -107,7 +107,7 @@ @@ -107,7 +107,7 @@
107 <view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}" 107 <view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}"
108 bindtap='goActivityDetail' data-index="{{index}}" data-id="{{item.id}}"> 108 bindtap='goActivityDetail' data-index="{{index}}" data-id="{{item.id}}">
109 <!--<image src="http://pk86rwhci.bkt.clouddn.com/b1@2x%20%281%29.png"></image>--> 109 <!--<image src="http://pk86rwhci.bkt.clouddn.com/b1@2x%20%281%29.png"></image>-->
110 - <image src="{{item.pic}}"></image> 110 + <image src="{{item.pic}}" mode="aspectFill"></image>
111 <view class="title"> 111 <view class="title">
112 <text class="area">{{item.address}}</text> 112 <text class="area">{{item.address}}</text>
113 <text class="num">还差{{item.people}}人</text> 113 <text class="num">还差{{item.people}}人</text>