InfoBuy.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!-- Buy.vue -->
  2. <template>
  3. <view class="div main-content" v-if="detailInfo">
  4. <flex-line :is-link="true" :show-border="true" @click.native="changeCartState()">
  5. <view class="div"
  6. :class="{'isopacity':!activeBuy}"
  7. >
  8. <view class="p" v-if="number <= 0">
  9. 请选择购买数量分类
  10. </view>
  11. <view class="p" v-if="number > 0">
  12. 已选数量{{ number }}
  13. </view>
  14. </view>
  15. </flex-line>
  16. </view>
  17. </template>
  18. <script>
  19. import { mapState, mapMutations } from 'vuex'
  20. import FlexLine from '../../../flexLine'
  21. export default {
  22. components: { FlexLine },
  23. data () {
  24. return {}
  25. },
  26. computed: {
  27. ...mapState({
  28. number: state => state.pointsgoods.number,
  29. detailInfo: state => state.pointsgoods.detailInfo
  30. })
  31. },
  32. created () {},
  33. methods: {
  34. ...mapMutations({
  35. saveCartState: 'saveCartState',
  36. changeType: 'changeType'
  37. }),
  38. activeBuy: function () {
  39. if (this.detailInfo.pgoods_storage > 0) {
  40. return true
  41. } else {
  42. return false
  43. }
  44. },
  45. changeCartState () {
  46. this.saveCartState(true)
  47. this.changeType('加入购物车')
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .main-content{padding:0 $pageSpace;background-color: #fff;}
  54. .isopacity {
  55. opacity: 0.5;
  56. }
  57. </style>