cm-price.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template name="cm-price">
  2. <!-- 商品详情价格判断 -->
  3. <view class="wrap-main">
  4. <template v-if="!hasLogin">
  5. <view class="p-login grade tui-skeleton-fillet">
  6. <uni-grader :grade="Number(product.priceGrade)"></uni-grader>
  7. <view class="floor-item-btn"> <view class="btn" @click.stop="loginClick">登录查看价格</view> </view>
  8. </view>
  9. </template>
  10. <template v-else>
  11. <view class="wrap-main-item">
  12. <view class="p-price tui-skeleton-fillet">
  13. <text class="txt sm">¥</text>
  14. <text class="txt big">{{ product.price | NumFormat}}</text>
  15. </view>
  16. </view>
  17. </template>
  18. </view>
  19. </template>
  20. <script>
  21. import { mapState, mapMutations } from 'vuex'
  22. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  23. export default {
  24. name: 'cm-price',
  25. components: {
  26. uniGrader
  27. },
  28. props: {
  29. product: {
  30. type: Object
  31. }
  32. },
  33. data() {
  34. return {
  35. popupShow: false,
  36. isIphoneX: this.$store.state.isIphoneX,
  37. }
  38. },
  39. filters: {
  40. NumFormat: function(text) {
  41. //处理金额
  42. return Number(text).toFixed(2)
  43. }
  44. },
  45. created() {
  46. },
  47. computed: {
  48. ...mapState(['hasLogin', 'clubType']),
  49. },
  50. methods: {
  51. hidePopup() {
  52. this.popupShow = false
  53. },
  54. loginClick() {
  55. this.$api.navigateTo('/pages/login/login')
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. .tui-flex-1 {
  62. flex: 1;
  63. }
  64. </style>