cm-unit-price.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template name="cm-price">
  2. <!-- 商品详情价格判断 -->
  3. <view class="sku-price-main">
  4. <view class="sku-price-viw">
  5. <!-- 价格等级和权限 -->
  6. <template v-if="!hasLogin">
  7. <!-- 游客 -->
  8. <view class="sku-price-text">
  9. <text class="sku-price-l">¥</text>
  10. <uni-grader :grade="Number(skuProduct.priceGrade)"></uni-grader>
  11. </view>
  12. </template>
  13. <template v-else>
  14. <!-- 资质机构 -->
  15. <view class="sku-price-text"> ¥{{ skuProduct.price | NumFormat }} </view>
  16. </template>
  17. </view>
  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-unit-price',
  25. components: {
  26. uniGrader
  27. },
  28. props: {
  29. skuProduct: {
  30. type: Object,
  31. default: {}
  32. }
  33. },
  34. data() {
  35. return {
  36. }
  37. },
  38. filters: {
  39. NumFormat(value) {
  40. //处理金额
  41. return Number(value).toFixed(2)
  42. }
  43. },
  44. created() {
  45. },
  46. computed: {
  47. ...mapState(['hasLogin', 'clubType'])
  48. },
  49. methods: {
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .sku-price-main {
  55. width: 100%;
  56. height: 100%;
  57. .sku-price-viw {
  58. width: 100%;
  59. height: 40rpx;
  60. margin-bottom: 24rpx;
  61. .sku-price-text {
  62. font-size: 28rpx;
  63. line-height: 40rpx;
  64. color: #f94b4b;
  65. font-weight: bold;
  66. .sku-price-l {
  67. float: left;
  68. font-weight: normal;
  69. }
  70. &.none {
  71. text-decoration: line-through;
  72. color: #999999;
  73. font-weight: normal;
  74. }
  75. }
  76. }
  77. .sku-price-vip {
  78. width: 100%;
  79. height: 40rpx;
  80. }
  81. }
  82. </style>