PromotionPopup.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <!-- PromotionPopup.vue -->
  2. <template>
  3. <view class="div" v-if="detailInfo && detailInfo.promos && detailInfo.promos.length > 0">
  4. <uni-popup
  5. background-color="#fff"
  6. ref="promoPopstatus"
  7. type="bottom"
  8. >
  9. <view class="div detail-promotions">
  10. <view class="div header">
  11. <text class="h3">促销信息</text>
  12. <text class="span iconfont" v-on:click="close()">&#xe65a;</text>
  13. </view>
  14. <view class="div promotions-body">
  15. <view
  16. class="div body-list"
  17. v-for="(item, index) in detailInfo.promos"
  18. :key="index"
  19. >
  20. <text class="span name">{{ item.name }}</text>
  21. <text class="span title">{{ item.promo }}</text>
  22. <view class="div content" v-if="item.desc">
  23. <view class="p">{{ item.desc }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </uni-popup>
  29. </view>
  30. </template>
  31. <script>
  32. import { mapState, mapMutations } from 'vuex'
  33. export default {
  34. data () {
  35. return {}
  36. },
  37. computed: {
  38. ...mapState({
  39. promoPopstatus: state => state.goodsdetail.promoPopstatus,
  40. detailInfo: state => state.goodsdetail.detailInfo
  41. })
  42. },
  43. watch: {
  44. promoPopstatus: function (value) {
  45. if(value){
  46. this.showPopup('promoPopstatus')
  47. }else{
  48. this.hidePopup('promoPopstatus')
  49. }
  50. },
  51. },
  52. methods:{
  53. showPopup(id){
  54. this.$refs[id].open()
  55. },
  56. hidePopup(id){
  57. this.$refs[id].close()
  58. },
  59. ...mapMutations({
  60. changePopstatus: 'changePopstatus'
  61. }),
  62. close () {
  63. this.changePopstatus(false)
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .detail-promotions {
  70. padding: 0 0.6rem;
  71. .div.header {
  72. position: relative;
  73. .h3 {
  74. font-size:$h3;
  75. color: rgba(78, 84, 93, 1);
  76. padding: 0;
  77. margin: 0;
  78. height:2.2rem;
  79. line-height:2.2rem;
  80. text-align: center;
  81. border-bottom: 0.5px solid rgba(232, 234, 237, 1);
  82. width: 100%;
  83. }
  84. .img {
  85. position: absolute;
  86. top:0.7rem;
  87. right:0.5rem;
  88. width:0.8rem;
  89. height:0.8rem;
  90. opacity: 1;
  91. }
  92. }
  93. .promotions-body {
  94. background: rgba(255, 255, 255, 1);
  95. padding: 0 0 0.6rem 0;
  96. .body-list {
  97. margin-top: 0.6rem;
  98. .span.name {
  99. background: rgba(255, 255, 255, 1);
  100. border-radius:0.1rem;
  101. font-size:$h6;
  102. color: $primaryColor;
  103. line-height:0.5rem;
  104. padding:0.15rem 0.3rem;
  105. display: inline-block;
  106. border: 1px solid $primaryColor;
  107. margin-right:0.35rem;
  108. }
  109. .span.title {
  110. font-size:$fontSize;
  111. color: rgba(71, 76, 82, 1);
  112. line-height:0.6rem;
  113. }
  114. .div.content {
  115. border-radius: 1px;
  116. padding:0.6rem 0 0 0;
  117. .p {
  118. padding: 0;
  119. margin: 0;
  120. font-size:$fontSize;
  121. color: $primaryColor;
  122. line-height:0.8rem;
  123. display: -webkit-box;
  124. -webkit-box-orient: vertical;
  125. -webkit-line-clamp: 2;
  126. overflow: hidden;
  127. padding:0.6rem 0.6rem 0.5rem 0.6rem;
  128. background: rgba(255, 244, 244, 1);
  129. }
  130. }
  131. }
  132. }
  133. }
  134. </style>