// components/toufang/index.ts namespace hangyezhanbi{ let { getYoushi } = require('../../../../utils/api') let first = true; Component({ /** * 组件的属性列表 */ properties: { array: { type: Object }, channel: { type: Object }, }, observers: { 'array': function () { !first && this.upData() }, 'channel': function () { !first && this.upData() } }, ready() { this.init(); first = false; }, /** * 组件的初始数据 */ data: { DayList: [], select_act: 0, select: [ { text: "费用", proportionType: "fee", type: 3, unit: "万元", }, { text: "时长", proportionType: "timeSize", type: 2, unit: "分", }, { text: "频次", proportionType: "pinci", type: 1, unit: "次", }, ] }, /** * 组件的方法列表 */ methods: { init() { let channelItem = this.data.channel; let arrayItem = this.data.array; Promise.all([ getYoushi({ channelId: channelItem.channelId, order: this.data.select[this.data.select_act].type, end: arrayItem.endDate, start: arrayItem.startDate }), ]).then((res: adDay[]) => { this.setData({ DayList: res[0], }) }) }, upData() { let channelItem = this.data.channel; let arrayItem = this.data.array; Promise.all([ getYoushi({ channelId: channelItem.channelId, order: this.data.select[this.data.select_act].type, end: arrayItem.endDate, start: arrayItem.startDate }), ]).then((res: adDay[]) => { this.setData({ DayList: res[0], }) }) }, channelChange(event:wxPicker){ this.setData({ select_act: Number(event.detail.value) },()=>this.upData()) } } }) }