2022-08-30 18:08:25 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="sendScoped">
|
2022-08-31 17:05:17 +08:00
|
|
|
<div class="checkedBox">
|
|
|
|
|
<div class="item" v-for="(item,index) in checkList" :key="index" @click="checkBtn(item)">
|
|
|
|
|
<div class="left">
|
2022-09-09 16:55:42 +08:00
|
|
|
<icon type="success" size="18" v-if="item.value == sendScope"/>
|
|
|
|
|
<icon type="circle" size="18" v-if="item.value != sendScope" />
|
2022-08-31 17:05:17 +08:00
|
|
|
<div class="title">{{ item.name }}</div>
|
|
|
|
|
</div>
|
2022-09-09 16:55:42 +08:00
|
|
|
<div class="right" v-if="item.value != 0">
|
2022-09-08 10:38:13 +08:00
|
|
|
<div v-if="item.value == '1' && deptSelect.length">已选择{{ deptSelect.length }}个部门</div>
|
|
|
|
|
<div v-if="item.value == '2' && girdSelect.length">已选择{{ girdSelect.length }}个网格</div>
|
2022-09-09 16:55:42 +08:00
|
|
|
<u-icon name="arrow-right" color="#CCD0D3" ></u-icon>
|
2022-08-31 17:05:17 +08:00
|
|
|
</div>
|
2022-08-31 13:43:21 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-08-30 18:08:25 +08:00
|
|
|
|
|
|
|
|
<div class="btn">
|
2022-08-31 17:05:17 +08:00
|
|
|
<div class="submitBtn" @click="submit">确定</div>
|
2022-08-30 18:08:25 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: 'sendScoped',
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-08-31 13:43:21 +08:00
|
|
|
value: '',
|
|
|
|
|
checkList: [
|
2022-09-08 10:38:13 +08:00
|
|
|
{ name: '全部居民群', checked: true, value: '0'},
|
2022-09-02 14:14:55 +08:00
|
|
|
{ name: '按部门选择', checked: false, value: '1'},
|
|
|
|
|
{ name: '按网格选择', checked: false, value: '2' }
|
2022-08-31 13:43:21 +08:00
|
|
|
],
|
2022-08-31 17:05:17 +08:00
|
|
|
showContent: false,
|
2022-09-07 18:04:53 +08:00
|
|
|
sendType: '',
|
2022-08-31 17:05:17 +08:00
|
|
|
deptSelect: [],
|
|
|
|
|
girdSelect: [],
|
2022-09-02 14:14:55 +08:00
|
|
|
sendScope: '0',
|
2022-09-07 18:04:53 +08:00
|
|
|
girdListIds: [],
|
|
|
|
|
deptListIds: [],
|
2022-09-09 16:55:42 +08:00
|
|
|
wxGroups: [], // 居民群,居民,朋友圈
|
|
|
|
|
sex: '',
|
|
|
|
|
// groupList: [], // 居民
|
|
|
|
|
// executorList: [], // 朋友圈
|
|
|
|
|
ResidentTags: [],
|
|
|
|
|
ResidentTagsRemove: [],
|
|
|
|
|
startTime: '',
|
|
|
|
|
endTime: '',
|
2022-08-30 18:08:25 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-08-31 13:43:21 +08:00
|
|
|
checkBtn(e) {
|
2022-09-09 16:55:42 +08:00
|
|
|
// this.checkList.forEach(v=> v.checked = false)
|
|
|
|
|
// e.checked = true
|
|
|
|
|
|
2022-09-02 14:14:55 +08:00
|
|
|
if(e.value == '1' || e.value == '2') {
|
2022-09-07 18:04:53 +08:00
|
|
|
uni.navigateTo({url: `./scopedSelect?type=${e.value}&sendType=${this.sendType}`})
|
2022-09-09 16:55:42 +08:00
|
|
|
|
2022-08-31 17:05:17 +08:00
|
|
|
}
|
2022-09-09 16:55:42 +08:00
|
|
|
this.sendScope = e.value;
|
|
|
|
|
uni.setStorageSync('sendScope', this.sendScope)
|
|
|
|
|
// uni.clearStorageSync('ResidentTags')
|
|
|
|
|
// uni.clearStorageSync('ResidentTagsRemove')
|
|
|
|
|
// uni.clearStorageSync('circleTags')
|
|
|
|
|
// uni.clearStorageSync('circleTagsRemove')
|
2022-08-31 17:05:17 +08:00
|
|
|
},
|
|
|
|
|
submit() {
|
2022-09-09 16:55:42 +08:00
|
|
|
if(this.sendType == 'ResidentsGroup') {
|
|
|
|
|
this.getWxGroups()
|
|
|
|
|
} else if(this.sendType == 'Residents') {
|
|
|
|
|
this.getResidents()
|
|
|
|
|
} else if(this.sendType == 'CircleOfFriends') {
|
|
|
|
|
this.getCircleOfFriends()
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-07 18:04:53 +08:00
|
|
|
uni.setStorageSync('sendScope', this.sendScope)
|
2022-09-08 16:05:19 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
success: () => {
|
|
|
|
|
uni.$emit('predictUser', this.wxGroups)
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-09-13 10:15:58 +08:00
|
|
|
}, 1000)
|
2022-09-08 16:05:19 +08:00
|
|
|
|
2022-09-07 18:04:53 +08:00
|
|
|
},
|
2022-09-09 16:55:42 +08:00
|
|
|
// 群发居民群
|
2022-09-07 18:04:53 +08:00
|
|
|
getWxGroups() {
|
|
|
|
|
this.$http.post(`/app/appmasssendingtask/queryWxGroups?sendScope=${this.sendScope}`,
|
|
|
|
|
{
|
2022-09-08 16:05:19 +08:00
|
|
|
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',')
|
2022-09-07 18:04:53 +08:00
|
|
|
}).then(res => {
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
this.wxGroups = res.data
|
2022-09-08 16:05:19 +08:00
|
|
|
uni.setStorageSync('wxGroupsUser', this.wxGroups)
|
2022-09-07 18:04:53 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-09-09 16:55:42 +08:00
|
|
|
// 群发居民
|
|
|
|
|
getResidents() {
|
|
|
|
|
const tags = this.ResidentTags.join(',')
|
|
|
|
|
const removeTags = this.ResidentTagsRemove.join(',')
|
|
|
|
|
this.$http.post(`/app/whchatmomentstask/getCustomerGroups?sendScope=${this.sendScope}&addFromTime=${this.startTime}&addEndTime=${this.endTime}&gender=${this.sex}&filteTags=${tags}&excludeFilterTags=${removeTags}`,
|
|
|
|
|
{
|
2022-09-13 11:50:04 +08:00
|
|
|
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(','),
|
2022-09-09 16:55:42 +08:00
|
|
|
}).then(res => {
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
// this.groupList = res.data
|
|
|
|
|
// uni.setStorageSync('groupList', this.groupList)
|
|
|
|
|
this.wxGroups = res.data
|
|
|
|
|
uni.setStorageSync('wxGroupsUser', this.wxGroups)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-09-13 11:50:04 +08:00
|
|
|
|
|
|
|
|
// const array1 = [{name:'zs',num: 1},{name:'zls',num: 5},{name:'azs',num: 4}]
|
|
|
|
|
// const sum = array1.reduce((pre, cur) => pre + cur.num, 0)
|
|
|
|
|
// console.log(sum)
|
|
|
|
|
|
2022-09-09 16:55:42 +08:00
|
|
|
// 群发朋友圈
|
|
|
|
|
getCircleOfFriends() {
|
|
|
|
|
this.$http.post(`/app/whchatmomentstask/getExecutors?sendScope=${this.sendScope}`,
|
2022-09-13 11:50:04 +08:00
|
|
|
{
|
2022-09-09 16:55:42 +08:00
|
|
|
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',')
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
// this.executorList = res.data
|
|
|
|
|
// uni.setStorageSync('executorList', this.executorList)
|
|
|
|
|
this.wxGroups = res.data
|
|
|
|
|
uni.setStorageSync('wxGroupsUser', this.wxGroups)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-08-30 18:08:25 +08:00
|
|
|
},
|
|
|
|
|
onLoad(o) {
|
2022-09-07 18:04:53 +08:00
|
|
|
this.sendType = o.type;
|
2022-08-30 18:08:25 +08:00
|
|
|
document.title = "选择发送范围"
|
|
|
|
|
},
|
2022-09-07 18:04:53 +08:00
|
|
|
onShow() {
|
2022-09-08 16:05:19 +08:00
|
|
|
this.sendScope = uni.getStorageSync('sendScope') || ''
|
2022-09-09 16:55:42 +08:00
|
|
|
const girdArr = uni.getStorageSync('girdSelect')
|
|
|
|
|
if(girdArr.length) {
|
|
|
|
|
this.girdListIds = girdArr.map(e=>e.id)
|
|
|
|
|
}
|
|
|
|
|
const deptArr = uni.getStorageSync('deptList')
|
|
|
|
|
if(deptArr.length) {
|
|
|
|
|
this.deptListIds = deptArr.map(v=>v.id)
|
|
|
|
|
}
|
|
|
|
|
this.sex = uni.getStorageSync('gender')
|
|
|
|
|
// 标签
|
|
|
|
|
if(this.sendType == 'Residents') {
|
|
|
|
|
this.ResidentTags = uni.getStorageSync('ResidentTags') // 居民包含
|
|
|
|
|
this.ResidentTagsRemove = uni.getStorageSync('ResidentTagsRemove') // 居民剔除
|
|
|
|
|
}
|
|
|
|
|
// 时间
|
|
|
|
|
this.startTime = uni.getStorageSync('startTime')
|
|
|
|
|
this.endTime = uni.getStorageSync('endTime')
|
|
|
|
|
// else if(this.sendType == 'CircleOfFriends') {
|
|
|
|
|
// this.circleTags = uni.getStorageSync('circleTags') // 朋友圈包含
|
|
|
|
|
// this.circleTagsRemove = uni.getStorageSync('circleTagsRemove') // 朋友圈剔除
|
|
|
|
|
// }
|
2022-09-07 18:04:53 +08:00
|
|
|
}
|
2022-08-30 18:08:25 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.sendScoped {
|
2022-08-31 17:05:17 +08:00
|
|
|
.checkedBox {
|
|
|
|
|
background: #FFF;
|
|
|
|
|
padding: 0 32px;
|
2022-08-31 13:43:21 +08:00
|
|
|
box-sizing: border-box;
|
2022-08-31 17:05:17 +08:00
|
|
|
.item {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
border-bottom: 1px solid #DDD;
|
|
|
|
|
padding: 30px 0;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
.left,
|
|
|
|
|
.right {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
.title {
|
|
|
|
|
margin-left: 12px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-31 13:43:21 +08:00
|
|
|
}
|
2022-08-31 17:05:17 +08:00
|
|
|
|
2022-08-30 18:08:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
background: #FFF;
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 128px;
|
|
|
|
|
padding: 24px 32px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
.submitBtn {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 80px;
|
|
|
|
|
line-height: 80px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
border: 2px solid #CCCCCC;
|
|
|
|
|
background: #1365DD;
|
|
|
|
|
color: #FFF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|