<!-- 关注店铺 -->
<template>
    <view class="jy-follow-shop">
        <JyShopInformation :imgStyle="imgStyle" :showStatus="true" :item="item"
            v-for="(item, index) in listProperty.list" :key="index">
            <template v-slot:shopRight>
                <uni-tag @click="cancelFavorites(item)" :inverted="true" text="取消关注" type="warning" />
            </template>
        </JyShopInformation>
    </view>
</template>

<script>
import { ref } from 'vue'
// 店铺信息
import JyShopInformation from '@/components/public/jy-shop-information'
import apiMixins from '@/components/public/apiMixins.js'
export default {
    components: {
        JyShopInformation
    },
    mixins: [apiMixins],
    data() {
        return {
            imgStyle: {
                'width': '78rpx',
                'height': '78rpx',
                'border-radius': ' 6px'
            },
        }
    },
    mounted() {
        this.init();
    },
    methods: {
        async cancelFavorites(val) {
            try {
                const res = await api['follow']['delete']({
                    userId: this.userId.userId,
                    storeId: val.storeId
                })
                if (res.code == 200) {
                    showToastAndRedirect('取消成功', 'none')
                    this.listProperty.params.pageNum = 1
                    this.init();
                }
            } catch (error) {

            }
        },
        init() {
            this.listProperty.params.pageSize = 20
            this.getData({
                api: 'follow',
                fn: 'list'
            }, {}, true);
        },
        onReachBottomHandler() {
            this.listProperty.params.pageNum++;
            this.init();
        },
        onPullDownRefreshHandler() {
            this.listProperty.params.pageNum = 1
            this.init();
        },
        checkboxChange(e) {
            console.log('checkboxChange', e)
            checkNum = e.detail.value
        }
    }
}

</script>
<style scoped lang="scss"></style>