<template>
    <view class="page">
        <view class="integral-rule">
            <view class="rule-item" v-for="(item, index) in rulesData.vipIntegralRuleList" :key="index">
                <view class="rule-t">{{ (index + 1) + '、' + item.obtainName }}</view>
                <view class="rule-desc">{{ item.haveUpperLimit == 0 ? '获取无限制' : '每日限制' + item.haveUpperLimit + '次' }},每次获得<text
                        class="strong">{{ item.obtainValue }}</text>积分</view>
            </view>
        </view>
    </view>
</template>

<script>
import $http from "@/utils/https";
export default {
    data() {
        return {
            integralUserId: null,
            rulesData: []
        }
    },
    onLoad(options) {
        if (options.hasOwnProperty('integralUserId') && options.integralUserId) {
            this.integralUserId = options.integralUserId
            this.getRuleList()
        }
    },
    methods: {
        // 规则有效期列表
        getRuleList() {
            const { integralUserId } = this
            let data = {
                params: [{
                    userId: integralUserId, // 积分会员ID
                }]
            }
            $http.post("urlS", this, {
                code: "WX01024",
                data: data,
                namespace: 'N',
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.rulesData = res.result.data
                    }
                }
            });
        }
    }
}
</script>