

// 创建一个混入对象
export default {
    data() {
        return {
            wholeList: [],
            provinceList: [],
            cityList: [],
            areaList: [],
            storeList: []
        }
    },
    created() {
        // console.log('Mixin created!')
        this.getWholeList()
        // this.getMechanismTree()

    },
    methods: {

        async getWholeList() {


            this.$API.mechanism.getMechanism({ type: 0, id: 9 }).then(res => {

                if (res.data.code === 200) {

                    this.wholeList = res.data.data
                }
            })




        },
        getProvinceList(id) {
            this.$API.mechanism.getMechanism({ type: 1, id: id }).then(res => {

                if (res.data.code === 200) {

                    this.provinceList = res.data.data
                }
            })
        },
        getCityList(id) {
            this.$API.mechanism.getMechanism({ type: 2, id: id }).then(res => {
                if (res.data.code === 200) {

                    this.cityList = res.data.data
                }
            })
        },
        getAreaList(id) {
            this.$API.mechanism.getMechanism({ type: 3, id: id }).then(res => {
                if (res.data.code === 200) {

                    this.areaList = res.data.data
                }
            })
        },
        getStoreList(id) {
            this.$API.mechanism.getMechanism({ type: 4, id: id }).then(res => {
                if (res.data.code === 200) {

                    this.storeList = res.data.data
                }
            })
        }
    }
}