pinGoodsInfo.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // lionfish_comshop/moduleA/components/pinGoodsInfo.js
  2. Component({
  3. externalClasses: ["i-class", "i-class-identity"],
  4. properties: {
  5. isOrder: {
  6. type: Boolean,
  7. value: false
  8. },
  9. goodsInfo: {
  10. type: Object,
  11. value: {
  12. danprice: "0.00",
  13. goods_images: "",
  14. name: "",
  15. pin_count: "2",
  16. pinprice: "0.00",
  17. productprice: "0.00",
  18. seller_count: 0,
  19. subtitle: "",
  20. me_is_head: 1
  21. },
  22. observer: function (m) {
  23. let price = 0;
  24. price = ((m && m.price) && (m.price*1).toFixed(2)) || 0;
  25. this.setData({ price })
  26. }
  27. },
  28. me_is_head: {
  29. type: Boolean,
  30. value: false
  31. },
  32. skin: {
  33. type: Object
  34. }
  35. },
  36. /**
  37. * 组件的方法列表
  38. */
  39. methods: {
  40. goDetail: function(){
  41. let { isOrder, goodsInfo } = this.data;
  42. let goods_id = goodsInfo.goods_id || '';
  43. if (goods_id && !isOrder) {
  44. var pages_all = getCurrentPages();
  45. var url = `/lionfish_comshop/moduleA/pin/goodsDetail?id=${goods_id}`;
  46. if (pages_all.length > 3) {
  47. wx.redirectTo({ url })
  48. } else {
  49. wx.navigateTo({ url })
  50. }
  51. }
  52. }
  53. }
  54. })