123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- // components/toufang/index.ts
- namespace hangyezhanbi{
- let { getQianzai } = 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([
- getQianzai({
- 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([
- getQianzai({
- 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())
- }
- }
- })
- }
|