日照项目的居民端小程序
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.
 
 
 

341 lines
7.1 KiB

const app = getApp();
import {
wxNavigateTo,
} from "@utils/promise-wx-api";
import {
wxRequestPost,
} from "@utils/promise-wx-api";
Component({
properties: {},
data: {
customerId: "",
showType:'list',//显示类型,map 地图 list 列表
iniLoaded: false,
showBtn:true,
menuList: [
{
name: "未处理",
value: 0,
},
{
name: "处理中",
value: 1,
},
{
name: "已办结",
value: 2,
},
],
current: 0, // 未处理un_read 处理中 processing 已办结 closed_case
reportUrl: "gov/project/resievent/resieventlist",
// reportUrl: "http://yapi.elinkservice.cn/mock/102/gov/project/resievent/resieventlist",
listParams1: {
statusCondition: "un_read",
},
listParams2: {
statusCondition: "processing",
},
listParams3: {
statusCondition: "closed_case",
},
listIsMock: false,
dialogVisible: false,//社区服务热线弹出框
agencyForm:{
agencyId:'',
agencyName:'',
mobile:'',
},
mapList1:[],
mapList2:[],
mapList3:[],
showComfirm:true,
},
lifetimes: {
attached() {
this.init();
},
},
methods: {
async toList(){
this.setData({
showType: 'list'
});
await this.refreshList()
},
async toMap(){
await this.refreshMap()
this.setData({
showType: 'map'
});
},
hiddenBtnList(){
this.setData({
showBtn: false
});
},
showBtnList(){
this.setData({
showBtn: true
});
},
async refreshData(){
await this.init();
const {showType} = this.data
if(showType==='list'){
this.refreshList()
}else{
await this.refreshMap()
}
this.setData({
iniLoaded: true,
});
},
async refreshList() {
await this.selectComponent("#votingList").refreshData();
await this.selectComponent("#turnedList").refreshData();
await this.selectComponent("#closedList").refreshData();
// this.selectComponent("#titleList").getInfo();
},
async refreshMap(){
const { gridId } = app.globalData;
const params1={
statusCondition:'un_read',
gridId,
isPage:false
}
const params2={
statusCondition:'processing',
gridId,
isPage:false
}
const params3={
statusCondition:'closed_case',
gridId,
isPage:false
}
await this.loadMapList(params1,1)
await this.loadMapList(params2,2)
await this.loadMapList(params3,3)
},
// 获取地图数据
async loadMapList(params,index) {
let {mapList1,mapList2,mapList3}= this.data
const url='gov/project/resievent/resieventlist'
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(url, params,
{
// isMock: true
});
if (msg === "success" && code === 0) {
data.forEach(item => {
item.name=item.eventContent
});
if(index===1){
mapList1 = data
}else if(index===2){
mapList2 = data
}else if(index===3){
mapList3 = data
}
this.setData({
mapList1,
mapList2,
mapList3,
});
}
},
//点击地图
handleClickMap(e){
// console.log(e)
const {
detail: { index },
} = e;
const {current,mapList1,mapList2,mapList3} = this.data
let selEvent={}
if(current===0){
selEvent = mapList1[index]
}else if(current===1){
selEvent = mapList2[index]
}else if(current===2){
selEvent = mapList3[index]
}
wxNavigateTo("/subpages/index/pages/report/detail/index", {
eventId: selEvent.resiEventId,
status:selEvent.status,
shiftProject:selEvent.shiftproject?"yes":"no",
replyButtonFlag:selEvent.replayflag
});
},
//随手拍
tapSuishoupai(){
wxNavigateTo("/subpages/index/pages/suishoupai/create", {
blurType:'text'
});
},
//随时讲
tapSuishijiang(){
wxNavigateTo("/subpages/index/pages/suishijiang/create", {
blurType:'voice'
});
},
//服务热线
tapFuwurexian(){
this.loadOrgMobile()
},
//网格员
tapWanggeyuan(){
wxNavigateTo("/subpages/event/pages/gridmember/gridmember", {
});
},
// 获取社区服务热线
async loadOrgMobile() {
const { gridId } = app.globalData;
let { agencyForm,showComfirm } = this.data;
const url='gov/org/customeragency/orgmobile'
// const url='http://yapi.elinkservice.cn/mock/102/gov/org/customeragency/orgmobile'
// topicdraft/createtopic topic/createtopic attachmentList
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestPost(url,
{
gridId
},
{
// isMock: true
});
if (msg === "success" && code === 0) {
agencyForm = data
if(data.mobile===null||data.mobile===''){
showComfirm=false
data.mobile='您所在的社区还未设置服务热线'
}else{
showComfirm=true
}
this.setData({
dialogVisible: true,
agencyForm,
showComfirm
});
}
},
async callComfire() {
const { agencyForm } = this.data;
this.setData({
dialogVisible: false,
});
wx.makePhoneCall({
phoneNumber: agencyForm.mobile,
});
},
async callCancel() {
this.setData({
dialogVisible: false,
});
},
async init() {
await app.doAfterLogin();
const { gridId } = app.globalData;
this.setData({
listParams1: {
gridId,
statusCondition: "un_read",
},
listParams2: {
gridId,
statusCondition: "processing",
},
listParams3: {
gridId,
statusCondition: "closed_case",
},
});
},
handleSwiperChange(e) {
const {
detail: { current, source },
} = e;
if (source == "touch") {
this.setData({ current });
}
},
// 点击顶部菜单
handleShiftMenu(e) {
const {
detail: { value },
} = e;
this.setData({ current: value });
},
handleTapTab(e) {
console.log(e)
const {
currentTarget: {
dataset: { index },
},
} = e;
this.setData({ currentTab: index });
},
},
});