You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
3.6 KiB

4 years ago
<template>
<view>
4 years ago
<view class="listActivity">
4 years ago
<view class="activityBox" v-for="(item,index) in list" :key="index" @click="openInfo(item)">
4 years ago
<view class="activityBox-top">
4 years ago
<image :src='item.cover_upload.url' style="width: 100%;height: 333rpx;"></image>
4 years ago
<view class="book-status">
4 years ago
{{item.rate_name}}
4 years ago
</view>
4 years ago
<view class="book-num" v-if="item.orders_count>0">
<text class="book-num-y"> {{isUnde(item.orders_count)}} </text>
4 years ago
<text>人已报名</text>
</view>
4 years ago
</view>
4 years ago
<view class="activityBox-content flex-col">
<view class="activityBox-row">
4 years ago
<text class="activityBox-title">{{isUnde(item.name)}}</text>
4 years ago
</view>
<view class="activityBox-row flex-row justify-between">
4 years ago
<view class="tag tag_green activityBox_btn">
4 years ago
<text>{{isUnde(item.target_name)}}</text>
4 years ago
</view>
4 years ago
<view class="tag" :class="{activityBox_btn:item.isCanBook}">
4 years ago
<text>{{item.isCanBook?"立即报名":"不可报名"}}</text>
4 years ago
</view>
</view>
<view class="activityBox-row">
<text class="icon-shijian iconfont"></text>
4 years ago
<text>活动时间{{isUnde(item.start_time)}}-{{getHm(item.end_time)}}</text>
4 years ago
</view>
4 years ago
<!-- <view class="activityBox-row">
4 years ago
<text class="icon-huodongfangshi iconfont"></text>
4 years ago
<text>活动方式{{isUnde(item.area_name)}}</text>
4 years ago
4 years ago
</view> -->
4 years ago
<view class="activityBox-row">
<text class="icon-huodong iconfont"></text>
4 years ago
<text>活动地址{{isUnde(item.address)}}</text>
4 years ago
</view>
<view class="activityBox-row">
<text class="icon-renshu iconfont"></text>
4 years ago
<text>人数限制{{isUnde(item.total)==0?'不限':isUnde(item.total)}}</text>
4 years ago
</view>
4 years ago
<view class="activityBox-row flex-row align-center" style="margin-bottom: 0rpx;"
@click.stop="tothere(item)">
4 years ago
<text class="icon-ditu-dibiao iconfont"></text>
4 years ago
<text>距离{{isUnde(item.distance)}}km</text>
4 years ago
<view class="tomap">
<text class="icon-daohang1 iconfont" style="margin-right: 0;"></text>
</view>
</view>
4 years ago
</view>
</view>
4 years ago
</view>
4 years ago
</view>
</template>
<script>
export default {
data() {
return {
4 years ago
showInfo: true,
4 years ago
list: [],
latitude: "",
longitude: "",
4 years ago
}
4 years ago
},
onLoad() {
var that = this;
wx.getLocation({
success(res) {
console.log(res)
that.latitude = res.latitude;
that.longitude = res.longitude;
that.loadActivity()
}
})
4 years ago
},
methods: {
4 years ago
tothere(item) {
uni.openLocation({
latitude: parseFloat(item.latitude),
longitude: parseFloat(item.longitude),
name: item.name,
address: item.address
})
},
4 years ago
openInfo(obj) {
4 years ago
4 years ago
uni.navigateTo({
url: "info?id=" + obj.id
})
4 years ago
},
loadActivity() {
var that = this;
4 years ago
var nt = new Date();
4 years ago
this.util.request({
api: '/api/mobile/activity/index',
data: {
latitude: that.latitude,
4 years ago
longitude: that.longitude,
page_size: 100
4 years ago
},
utilSuccess: function(res) {
4 years ago
for (var mod of res.data) {
mod.isCanBook = that.$moment(nt).isBefore(mod.end_plan);
}
4 years ago
that.list = res.data;
},
utilFail: function(res) {
}
4 years ago
})
4 years ago
},
isUnde(val) {
if (val) {
return val
} else {
return ""
}
},
getHm(val) {
4 years ago
if (val) {
return this.$moment(val).format("HH:mm")
4 years ago
} else return "";
4 years ago
}
4 years ago
}
}
</script>
<style>
4 years ago
@import url("@/static/css/activitybox.css");
4 years ago
page {
background-color: #f7f6f4;
}
4 years ago
</style>