Files
dvcp_v2_wxcp_app/library/project/activeAnalysis/AppWechatActivities/AppWechatActivities.vue

315 lines
8.0 KiB
Vue
Raw Normal View History

2023-01-17 09:28:01 +08:00
<template>
2023-01-30 16:14:55 +08:00
<div class="AppWechatActivities">
2023-01-30 16:17:57 +08:00
<div v-if="tabIndex == 1">
2023-01-30 16:14:55 +08:00
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in datas" :key="i" @click.native="toDetail(item)">
<template #custom>
<div class="left">
<div class="titles">{{ item.title }}</div>
<div class="times">
<span class="timesCont">{{ item.createTime }}</span>
</div>
<div class="areaName" v-if="item.areaName || item.address">{{ item.areaName }}{{ item.address }}</div>
2023-01-17 09:28:01 +08:00
</div>
2023-01-30 16:14:55 +08:00
</template>
</AiCard>
</template>
<AiEmpty description="暂无数据" v-else></AiEmpty>
</div>
2023-01-30 16:17:57 +08:00
<div class="calendar" v-else>
<div class="month-item">
<div class="title" @click="showTime=true">{{ym}}<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px"></u-icon></div>
<div class="day-list">
<!-- <div class="week-item">
<div v-for="(item, index) in weekList" :key="index">{{item}}</div>
</div> -->
<div class="day-item" v-for="(item, index) in dayList" :key="index">
<div>{{item.day}}</div>
<u-icon name="checkbox-mark" color="#5297FF" v-if="item.status == '使用' || item.status == '打开并活跃'"></u-icon>
<u-icon name="close" color="#ff4466" v-else></u-icon>
</div>
</div>
</div>
</div>
2023-01-30 16:14:55 +08:00
<div class="line-h100"></div>
<div class="tabs">
<div class="item" v-for="(item, index) in tabs" :key="index" @click="change(index)">
<u-icon :name="item.icon" :color="tabIndex == index ? '#3975C6' : '#999'" size="30"></u-icon>
<p :class="tabIndex == index ? 'active' : ''">{{item.name}}</p>
</div>
2023-01-29 14:06:30 +08:00
</div>
2023-01-30 16:14:55 +08:00
2023-01-29 14:06:30 +08:00
<u-modal v-model="show" :show-cancel-button="true" @confirm="bindPhoneConfirm" @cancel="cancel">
<div class="item">
<span class="label"><span class="tips">*</span>手机号</span>
<div class="value">
<u-input type="tel" placeholder="请填写手机号" v-model="phone" input-align="right" placeholder-style="color:#999;font-size:15px;" height="42" :maxlength="11" :clearable="false" />
</div>
</div>
</u-modal>
2023-01-30 16:14:55 +08:00
<u-picker v-model="showTime" mode="time" :params="params" @confirm="confirm" @cancel="show=false"></u-picker>
2023-01-17 09:28:01 +08:00
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'AppWechatActivities',
2023-01-18 10:04:50 +08:00
appName: '运营活动',
2023-01-17 09:28:01 +08:00
data() {
return {
datas: [],
2023-01-30 16:17:57 +08:00
tabs: [{ name: '打卡', icon: 'list'}, { name: '活动列表', icon: 'home-fill'}],
2023-01-17 09:28:01 +08:00
currentTabs: 0,
current: 1,
size: 6,
total: '',
2023-01-29 14:06:30 +08:00
show: false,
2023-01-30 16:14:55 +08:00
phone: '',
tabIndex: 0,
showTime: false,
params: {
year: true,
month: true,
day: false,
hour: false,
minute: false,
second: false
},
ym: '',
dayList: []
2023-01-17 09:28:01 +08:00
}
},
computed: {
...mapState(['user']),
},
2023-01-31 11:16:39 +08:00
created() {
2023-01-29 14:06:30 +08:00
this.getList()
2023-01-30 16:14:55 +08:00
const date = new Date();
let year = date.getFullYear()
let monNum = date.getMonth() + 1
let month = monNum < 10 ? `0${monNum}` : monNum
this.ym = `${year}-${month}`
this.getDayList()
2023-01-17 09:28:01 +08:00
},
onShow() {
2023-01-18 10:04:50 +08:00
document.title = '运营活动'
2023-01-17 09:28:01 +08:00
},
methods: {
2023-01-30 16:14:55 +08:00
change(e) {
this.tabIndex = e
},
2023-01-17 09:28:01 +08:00
getList() {
2023-01-31 11:42:49 +08:00
console.log(456)
2023-01-29 13:55:41 +08:00
this.$http.post('/app/appactivityinfo/listForWX', null, {
2023-01-17 10:09:16 +08:00
params: {
size: this.size,
current: this.current,
},
}).then((res) => {
2023-01-31 11:42:49 +08:00
console.log(res, 123)
2023-01-17 10:09:16 +08:00
if (res.code == 0) {
this.datas = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records
}
2023-01-31 11:42:49 +08:00
}).catch((err) => {
console.log(err)
2023-01-17 10:09:16 +08:00
})
2023-01-17 09:28:01 +08:00
},
toDetail(item) {
2023-01-29 13:55:41 +08:00
uni.navigateTo({ url: `./Detail?id=${item.id}` })
2023-01-17 09:28:01 +08:00
},
2023-01-29 14:06:30 +08:00
bindPhoneConfirm() {
if(!this.phone) {
return this.$u.toast('请输入手机号')
}
let regTel = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/
if (!regTel.test(this.phone)) {
return this.$u.toast('请输入正确的手机号')
}
this.$http.post(`/appactivityinfo/bindPhone?phone=${this.phone}`).then((res) => {
if (res.code == 0) {
this.getUserInfo()
this.$u.toast('绑定成功')
}
})
},
cancel() {
this.phone = ''
this.show = false
},
getUserInfo () {
this.$http.post('/api/user/info').then(res => {
if (res.code === 0) {
this.$store.commit('setUser', res.data)
}
2023-01-17 09:28:01 +08:00
})
},
2023-01-30 16:14:55 +08:00
getDayList() {
// this.$http.post(`/app/wxuseruselog/listForWX?wxUserId=LiuYe&ym=${this.ym}`).then(res => {
this.$http.post(`/app/wxuseruselog/listForWX?wxUserId=${this.user.phone}&ym=${this.ym}`).then(res => {
if (res.code == 0) {
res.data.map((item) => {
item.day = item.ymd.substring(8, 10)
})
this.dayList = res.data
}
})
},
confirm(e) {
this.ym = `${e.year}-${e.month}`
this.getDayList()
2023-01-29 14:06:30 +08:00
}
2023-01-17 09:28:01 +08:00
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
</script>
<style scoped lang="scss">
uni-page-body {
height: 100%;
}
2023-01-30 16:14:55 +08:00
.AppWechatActivities {
2023-01-17 09:28:01 +08:00
height: 100%;
2023-01-30 16:14:55 +08:00
.calendar {
background-color: #fff;
padding-bottom: 48px;
.month-item{
.title {
line-height: 88px;
text-align: center;
font-size: 28px;
color: #000;
}
.week-item {
div {
display: inline-block;
width: 107px;
text-align: center;
color: #666;
line-height: 44px;
}
}
.day-list {
.day-item {
display: inline-block;
position: relative;
width: 107px;
height: 107px;
line-height: 107px;
text-align: center;
color: #333;
}
.u-icon {
position: absolute;
top: 70px;
left: 40px;
}
2023-01-17 09:28:01 +08:00
}
}
}
::v-deep .AiCard {
background: #f3f6f9;
.start {
background: #fff;
padding: 32px;
border-radius: 16px;
.fill {
display: flex;
justify-content: space-between;
// align-items: center;
.left {
width: calc(100% - 205px);
// background: pink;
.titles {
margin-bottom: 8px;
color: #333333;
font-weight: 500;
font-size: 30px;
line-height: 1.3;
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.nums {
margin-top: 8px;
.specialColor {
color: #4181ff;
}
}
.times {
margin-top: 8px;
.timesCont {
margin-right: 10px;
}
}
2023-01-29 08:55:02 +08:00
.areaName {
2023-01-17 09:28:01 +08:00
margin-top: 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
img {
position: relative;
width: 182px;
height: 182px;
}
.hints {
position: absolute;
right: 52px;
width: 96px;
height: 44px;
font-size: 26px;
color: #ffffff;
line-height: 44px;
text-align: center;
}
}
}
}
2023-01-30 16:14:55 +08:00
.line-h100 {
height: 100px;
}
.tabs {
2023-01-29 14:06:30 +08:00
position: fixed;
bottom: 0;
left: 0;
width: 100%;
2023-01-30 16:14:55 +08:00
height: 100px;
background-color: #fff;
display: flex;
.item {
flex: 1;
2023-01-29 14:06:30 +08:00
text-align: center;
2023-01-30 16:14:55 +08:00
.u-icon {
margin: 12px 0 8px 0;
}
p {
font-family: PingFangSC-Regular;
letter-spacing: 0;
line-height: 28px;
font-size: 24px;
color: #999;
}
.active {
color: #3975C6;
font-weight: 500;
}
2023-01-17 09:28:01 +08:00
}
}
}
</style>