GoodList.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="goodList">
  3. <div
  4. @click="goDetails(item)"
  5. class="item acea-row row-between-wrapper"
  6. v-for="(item, index) in goodList"
  7. :key="index"
  8. >
  9. <div class="pictrue">
  10. <img :src="item.image" class="image" />
  11. <span
  12. class="pictrue_log pictrue_log_class"
  13. v-if="item.activity && item.activity.type === '1'"
  14. >秒杀</span
  15. >
  16. <span
  17. class="pictrue_log pictrue_log_class"
  18. v-if="item.activity && item.activity.type === '2'"
  19. >砍价</span
  20. >
  21. <span
  22. class="pictrue_log pictrue_log_class"
  23. v-if="item.activity && item.activity.type === '3'"
  24. >拼团</span
  25. >
  26. </div>
  27. <div class="underline">
  28. <div class="text">
  29. <div class="line1">{{ item.store_name }}</div>
  30. <!-- <div class="money font-color-red">
  31. ¥<span class="num">{{ item.price }}</span>
  32. </div> -->
  33. <GoodItem :item="item" :isVip="isVip"></GoodItem>
  34. <div class="vip-money acea-row row-middle">
  35. <span class="num">已售{{ item.sales }}{{ item.unit_name }}</span>
  36. </div>
  37. </div>
  38. </div>
  39. <!-- <div
  40. class="iconfont icon-gouwuche cart-color acea-row row-center-wrapper"
  41. ></div> -->
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import { getUserInfo } from "@api/user";
  47. import { goShopDetail } from "@libs/order";
  48. import GoodItem from "@components/GoodItem";
  49. export default {
  50. name: "GoodList",
  51. components: {
  52. GoodItem
  53. },
  54. props: {
  55. goodList: {
  56. type: Array,
  57. default: () => []
  58. },
  59. isSort: {
  60. type: Boolean,
  61. default: true
  62. }
  63. },
  64. data: function() {
  65. return {
  66. isVip: false
  67. };
  68. },
  69. mounted: function() {
  70. this.updateVIP();
  71. },
  72. methods: {
  73. updateVIP() {
  74. var userinfo = this.$store.state.app.userInfo;
  75. if (this.$store.state.app.token) {
  76. getUserInfo().then(res => {
  77. userinfo = res.data;
  78. this.isVip = userinfo.vip_level > 0;
  79. console.log("Current VIP:", userinfo.vip_level);
  80. });
  81. return;
  82. }
  83. this.isVip = false;
  84. console.log("Current is not Login");
  85. },
  86. // 商品详情跳转
  87. goDetails(item) {
  88. goShopDetail(item).then(() => {
  89. this.$router.push({ path: "/detail/" + item.id });
  90. });
  91. }
  92. }
  93. };
  94. </script>