import unit from '@/utils/tool/unit';
import config from "../../../config/config";
import url from '@/utils/tool/url';
import shop from '@/utils/controls/shop';
export default {

    data(){
        return {
            paddingTop: unit(333) - config.headerHeight - config.system.statusBarHeight,
            shopData:[{},{},{}]
        }
    },

    methods:{
        fetch(obj){
            return this.$request({
               url:'product/getProductRanking',
               cache:{
                   type:1,
                   expireTime: parseInt(new Date().getTime()/1000) + (30 * 60)
               }
            }).then((data)=>{

                data.data.map((item)=>{
                    item.image = url.handleImage(item.image);
                });

                this.shopData = data.data;
                return obj.success();
            }).catch(obj.fail);
        },
        goDetail(item){
            return shop.goShopDetail(item);
        }
    }

}