import TPL from './tpl';
import './style.scss';
import BaseFormControl from "../../baseFormControl";
import JDSelect from "../../formType/select/select";
import JDSwitch from "../../formType/switch";
import JDInput from "../../formType/input";
class MeGoodsSearch extends BaseFormControl{
    constructor(config){
        super(config);
        this.render();
    }
    render(){
        this.appendFormControl(TPL);
        this.sortTypeSelect = new JDSelect({
            domData: {
                title: '默认排序',
                node: this.element.find('.J_sortType'),
                name: 'sortType',
                formType: {
                    option: [{
                        text: '销量',
                        value: 5,
                    }, {
                        text: '价格',
                        value: 4,
                    }],
                },
            },
            defaultSelected: this.config.moduleData && this.config.moduleData.sortType ? this.config.moduleData.sortType : 5,
        })
      
    }
    getData(){
        const { name } = this.config.domData;
        const data = {};
        data[name] = {
            ...this.sortTypeSelect.getData(),
            defaultSearchSwitch:0,
            defaultSearchWord:''
        };
        return data;
    }
}
export default MeGoodsSearch;