// components/My_SearchInputBox/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        /* 粘性定位 */
        flexd: {
            type: Boolean,
            value: false
        },
        /* 搜索方法 */
        searchQuery: {
            type: Function
        },
        /* 新增按钮跳转 */
        route: {
            type: String
        },
        /* 是否主账号 */
        fisadministrator: {
            type: Boolean
        },
        butText: {
            type: String,
            value: "新增"
        },
        marTop: {
            type: Number,
            value: 30
        },
        inputColor: {
            type: String,
            value: "#FFFF"
        },
        inputRadius: {
            type: String,
            value: "10"
        },
        /* 邀请按钮 */
        invitation: {
            type: Boolean,
            value: false
        },
        /* 开启刷新 */
        isOnShow: {
            type: Function
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        text: ""
    },

    /**
     * 组件的方法列表
     */
    methods: {
        /* 输入 */
        inputText(e) {
            this.setData({
                text: e.detail.value
            })
        },
        /* 失去焦点 */
        searchBlur(e) {
            const {
                value
            } = e.detail;
            this.triggerEvent("searchQuery", value.trim())
        },
        /* 跳转页面 */
        itemAdd() {
            if (this.data.route == 'product') {
                this.triggerEvent("isOnShow");
                wx.navigateTo({
                    url: '/pages/productManagement/change',
                })
            } else if (this.data.route == 'team') {
                this.triggerEvent("isOnShow");
                wx.navigateTo({
                    url: '/pages/teamManagement/change',
                })
            } else if (this.data.route == 'consociation') {
                wx.navigateTo({
                    url: '/pages/businessPartner/applyFor',
                })
            }
        },
        /* 团队成员邀请 */
        InvitedToEnter() {
            this.triggerEvent("isOnShow");
            wx.navigateTo({
                url: '/pages/teamManagement/applyFor',
            })
        },
        /* 清空 */
        clearInput() {
            this.setData({
                text: ""
            })
            this.triggerEvent("searchQuery", '')
        }
    }
})