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.
264 lines
5.2 KiB
264 lines
5.2 KiB
import { inputSync } from "@utils/tools";
|
|
import { wxRequestPost, wxNavigateTo } from "@utils/promise-wx-api";
|
|
import listBehavior from "@mixins/list";
|
|
// import authBehavior from "@mixins/operate-auth";
|
|
|
|
const app = getApp();
|
|
|
|
Component({
|
|
behaviors: [ listBehavior],
|
|
data: {
|
|
iniLoading: true, //初始化加载数据
|
|
refresh: true,
|
|
noMore: false, //没有更多了
|
|
|
|
customerId: "",
|
|
agencyId: "",
|
|
|
|
|
|
//年
|
|
yearArray: [],
|
|
yearIndex: 0,
|
|
|
|
mounthArray:[
|
|
{
|
|
label:'全部月份',
|
|
value: ''
|
|
}
|
|
],
|
|
mounthIndex:0,
|
|
|
|
//活动类型
|
|
behavieArray: [],
|
|
behavieIndex:0,
|
|
|
|
actList: [],
|
|
|
|
pageNo: 1,
|
|
pageSize: 20,
|
|
|
|
listParams:{},
|
|
// listUrl:'point/resi/point/records',
|
|
listUrl:'point/myPoint/partyBuildingPoint',
|
|
listIsMock:false,
|
|
scoreList:[]
|
|
|
|
},
|
|
|
|
methods: {
|
|
inputSync,
|
|
|
|
async onLoad() {
|
|
await app.doAfterLogin();
|
|
|
|
const { customerId, agencyId } = app.globalData;
|
|
let {listParams} = this.data
|
|
listParams={
|
|
customerId
|
|
}
|
|
this.setData({
|
|
customerId,
|
|
agencyId,
|
|
listParams
|
|
});
|
|
this.initYear()
|
|
|
|
await this.getApiData();
|
|
|
|
this.setData({
|
|
iniLoading: true,
|
|
});
|
|
},
|
|
//初始化下拉框
|
|
initYear(){
|
|
let {yearArray} = this.data
|
|
let year = new Date().getFullYear()+1
|
|
yearArray=[
|
|
{
|
|
label:'全部年份',
|
|
value:''
|
|
}
|
|
]
|
|
for(let i=1;i<=3;i++){
|
|
let oneYear={
|
|
label:(year-i) +'年',
|
|
value:(year-i) +''
|
|
}
|
|
|
|
yearArray.push(oneYear)
|
|
}
|
|
console.log('yearArray',yearArray)
|
|
this.setData({
|
|
yearArray,
|
|
});
|
|
|
|
},
|
|
// async getApiData() {
|
|
// await this.getList();
|
|
// },
|
|
|
|
async getApiData() {
|
|
await this.getCategrayList();
|
|
await this.bindFilterNew();
|
|
},
|
|
|
|
behaviePickerChange(e) {
|
|
this.setData({
|
|
behavieIndex: e.detail.value,
|
|
});
|
|
},
|
|
mounthPickerChange(e) {
|
|
this.setData({
|
|
mounthIndex: e.detail.value,
|
|
});
|
|
},
|
|
yearPickerChange(e) {
|
|
this.setData({
|
|
yearIndex: e.detail.value,
|
|
});
|
|
|
|
let {mounthArray,yearArray,yearIndex} = this.data
|
|
mounthArray=[
|
|
{
|
|
label:'全部月份',
|
|
value: ''
|
|
}
|
|
]
|
|
|
|
let year = new Date().getFullYear() +''
|
|
|
|
let maxMonth=12
|
|
|
|
if(year===yearArray[yearIndex].value){//当前年
|
|
maxMonth = new Date().getMonth()+1
|
|
|
|
}
|
|
|
|
for(let i=1;i<=maxMonth;i++){
|
|
let mounth
|
|
if(i<10){
|
|
mounth='0' + i
|
|
}else{
|
|
mounth='' + i
|
|
}
|
|
let oneMounth={
|
|
label:(i) +'月份',
|
|
value: mounth
|
|
}
|
|
|
|
mounthArray.push(oneMounth)
|
|
}
|
|
|
|
console.log('mounthArray',mounthArray)
|
|
this.setData({
|
|
mounthArray,
|
|
});
|
|
|
|
},
|
|
|
|
bindFilterNew() {
|
|
this.setData({
|
|
pageNo: 1,
|
|
pageSize: 20,
|
|
refresh: true,
|
|
noMore: false,
|
|
// actList:[]
|
|
});
|
|
this.bindFilter();
|
|
},
|
|
|
|
|
|
//点击筛选按钮
|
|
async bindFilter() {
|
|
const {yearArray,yearIndex,mounthArray,mounthIndex,behavieArray,behavieIndex} = this.data;
|
|
|
|
let {
|
|
pageSize,
|
|
pageNo,
|
|
scoreList,
|
|
refresh,
|
|
noMore,
|
|
} = this.data;
|
|
if (noMore) return;
|
|
|
|
|
|
let params={
|
|
year:yearArray[yearIndex].value,
|
|
month:mounthArray[mounthIndex].value,
|
|
type:behavieArray[behavieIndex].value,
|
|
}
|
|
|
|
const url = "point/resi/point/pagePartyPoint";
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(url, params, {
|
|
//isMock: true,
|
|
// isQuiet: true
|
|
});
|
|
|
|
if (msg === "success" && code === 0) {
|
|
|
|
if (pageNo == 1) {
|
|
scoreList = data;
|
|
} else {
|
|
scoreList = scoreList.concat(data);
|
|
}
|
|
|
|
pageNo = pageNo + 1;
|
|
|
|
if (data.length < pageSize) {
|
|
noMore = true;
|
|
} else {
|
|
noMore = false;
|
|
}
|
|
if (refresh) {
|
|
refresh = false;
|
|
}
|
|
|
|
this.setData({
|
|
scoreList,
|
|
pageSize,
|
|
pageNo,
|
|
refresh,
|
|
noMore,
|
|
|
|
});
|
|
console.log(this.data.scoreList)
|
|
}
|
|
},
|
|
|
|
// 党建活动
|
|
async getCategrayList () {
|
|
let {behavieArray} = this.data
|
|
const url = "resi/partymember/icPartyAct/acttypelist"
|
|
let params = {}
|
|
|
|
const {
|
|
data: {
|
|
data: { code, data },
|
|
},
|
|
msg,
|
|
} = await wxRequestPost(url, params)
|
|
|
|
if (msg === "success" && code === 0) {
|
|
behavieArray=[]
|
|
let obj={
|
|
value:'',
|
|
label:'全部党建活动'
|
|
}
|
|
behavieArray.push(obj)
|
|
data.forEach(element => {
|
|
behavieArray.push(element)
|
|
});
|
|
|
|
}
|
|
|
|
this.setData({
|
|
behavieArray,
|
|
});
|
|
},
|
|
},
|
|
});
|
|
|