123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- // components/toufang/index.ts
- namespace shiduan {
- const { line, upLine } = require("./F2");
- let { getHour } = 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() {
- first && this.init()
- first = false
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- onInitChart: undefined,
- DayList: {},
- select_act: 0,
- select: [
- {
- text: "费用",
- proportionType: "fee",
- type: 3,
- unit: "元",
- },
- {
- text: "时长",
- proportionType: "timeSize",
- type: 2,
- unit: "分",
- },
- {
- text: "频次",
- proportionType: "pinci",
- type: 1,
- unit: "次",
- },
- {
- text: "客户量",
- proportionType: "customer",
- type: 4,
- unit: "个",
- },
- ]
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- init() {
- let channelItem = this.data.channel;
- let arrayItem = this.data.array;
- Promise.all([
- getHour({
- channelId: channelItem.channelId,
- order: this.data.select[this.data.select_act].type,
- end: arrayItem.endDate,
- start: arrayItem.startDate
- }),
- ]).then((res: adDay[]) => {
- this.data.DayList = res[0];
- this.setData({
- onInitChart: line.bind(this)
- })
- })
- },
- upData() {
- let channelItem = this.data.channel;
- let arrayItem = this.data.array;
- Promise.all([
- getHour({
- channelId: channelItem.channelId,
- order: this.data.select[this.data.select_act].type,
- end: arrayItem.endDate,
- start: arrayItem.startDate
- }),
- ]).then((res: adDay[]) => {
- this.data.DayList = res[0];
- upLine.bind(this)()
- })
- },
- channelChange(event:wxPicker){
- this.setData({
- select_act: Number(event.detail.value)
- },()=>this.upData())
- }
- }
- })
-
- }
|