var t = getApp();

t.request, require("../../../utils/util.js");

Page({
    data: {
        url: t.globalData.setting.url,
        resourceUrl: t.globalData.setting.resourceUrl,
        iurl: t.globalData.setting.imghost,
        coupons: null,
        lid: -1
    },
    onLoad: function(t) {
        var a = getCurrentPages();
        if (a.length > 1) {
            var e = a[a.length - 2];
            this.setData({
                coupons: e.data.coupons
            });
        }
        void 0 !== t.lid && this.setData({
            lid: t.lid
        });
    },
    useCoupon: function(t) {
        var a = this.data.coupons[t.currentTarget.dataset.idx];
        this.data.lid != a.id ? wx.setStorageSync("cart:cart2:cid", a) : wx.removeStorageSync("cart:cart2:cid"), 
        wx.navigateBack();
    }
});