item.js 557 Bytes
let router = global.router;

Component({
  properties: {
    item: {
      type: Object,
      value: {},
      observer: '_itemChange'
    }
  },
  data: {
    showMarketPrice: false
  },
  methods: {
    goDetail: function() {
      this.triggerEvent('productclick', {productSkn: this.properties.item.skn});
      router.go('productDetail', {productSkn: this.properties.item.skn});
    },
    _itemChange: function(item) {
      this.setData({
        showMarketPrice: +item.marketPrice > 0 && +item.marketPrice > +item.salesPrice
      });
    }
  }
});