index.js 967 Bytes
// pack-book/components/book/PreferentialDocking/index.js
import util from '../../../../utils/util'
import App from '../../../../utils/api';
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    sid:String,
  },
  /**
   * 组件的初始数据
   */
  data: {
    hide:true,
    detail:null,
  },
  attached(){
    this.getPreferentialDocking()
  },
  /**
   * 组件的方法列表
   */
  methods: {
    getPreferentialDocking(){
      App.Customer.GetSellerPreferentialDocking({sid:this.data.sid}).then(res=>{
        if(res.data){
          this.setData({
            detail:res.data,
          })
        }
      })
    },
    show(){
      if(!this.data.detail) return util.toast('没有优惠对接信息','none')
      this.setData({
        hide:false,
      })
    },
    hide(){
      this.setData({
        hide:true,
      })
    },
    call(e){
      wx.makePhoneCall({
        phoneNumber: util.attr(e,'phone')
      })
    },
  }
})