var app = getApp();
var that;
import 'dingtalk-jsapi/entry/mobile';
import openLink from 'dingtalk-jsapi/api/biz/util/openLink';
Page({
  data: {
    vipData:{}
  },
  onLoad(e) {
    that = this;
    dd.setNavigationBar({ title: "功道云尊享会员" });
    dd.setStorage({
      key: 'isShowNew',
      data: true,
    });
    if(e.code){
        this.getDetail(e.code)
     }
  },
  getDetail(code){
    app.$get("api/order/goods/info", {goods_code:code}).then((res) => {
        this.setData({
          vipData:res.data.data,
        })
    })
  },
  //跳转
  openUrl() {
    if(this.data.vipData.charge_type==1&&this.data.vipData.status==2){
         app.globalData.showToast("你已是尊享会员，请勿重复购买");
         return false;
    }
    app.$get("api/order/goods/sku", { callback: "pages/deploy/sku/sku", goods_code: this.data.vipData.goods_code }).then((res) => {
      openLink({
          url: res.data.data.url
      })
    })
  },
});
