s-activity-pop.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <!-- 商品信息:满减送等营销活动的弹窗 -->
  2. <template>
  3. <su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose>
  4. <view class="model-box">
  5. <view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠</view>
  6. <view v-if="state.rewardActivity && state.rewardActivity.id > 0">
  7. <view class="titleLi">促销</view>
  8. <scroll-view
  9. class="model-content"
  10. scroll-y
  11. :scroll-with-animation="false"
  12. :enable-back-to-top="true"
  13. >
  14. <view
  15. class="actBox"
  16. v-for="(item, index) in getRewardActivityRuleGroupDescriptions(state.rewardActivity)"
  17. :key="index"
  18. >
  19. <view
  20. class="boxCont ss-flex ss-col-top ss-m-b-40"
  21. @tap="onGoodsList(state.rewardActivity)"
  22. >
  23. <view class="model-content-tag ss-flex ss-row-center">{{ item.name }}</view>
  24. <view class="model-content-title">
  25. <view class="contBu">
  26. {{ item.values.join(';') }}
  27. </view>
  28. <view class="ss-m-b-24 cotBu-txt">
  29. {{ sheep.$helper.timeFormat(state.rewardActivity.startTime, 'yyyy.mm.dd') }}
  30. -
  31. {{ sheep.$helper.timeFormat(state.rewardActivity.endTime, 'yyyy.mm.dd') }}
  32. </view>
  33. </view>
  34. <text class="cicon-forward" />
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. <view class="titleLi">可领优惠券</view>
  40. <scroll-view
  41. class="model-content"
  42. scroll-y
  43. :scroll-with-animation="false"
  44. :enable-back-to-top="true"
  45. v-if="state.couponInfo.length"
  46. >
  47. <view class="actBox" v-for="item in state.couponInfo" :key="item.id">
  48. <view class="boxCont ss-flex ss-col-top ss-m-b-40">
  49. <view class="model-content-tag2">
  50. <view class="usePrice"> ¥{{ fen2yuan(item.discountPrice) }} </view>
  51. <view class="impose"> 满¥{{ fen2yuan(item.usePrice) }}可用 </view>
  52. </view>
  53. <view class="model-content-title2">
  54. <view class="contBu">
  55. {{ item.name }}
  56. </view>
  57. <view class="ss-m-b-24 cotBu-txt">
  58. {{
  59. item.validityType == 1
  60. ? sheep.$helper.timeFormat(item.validStartTime, 'yyyy.mm.dd') -
  61. sheep.$helper.timeFormat(item.validEndTime, 'yyyy.mm.dd')
  62. : '领取后' + item.fixedStartTerm + '-' + item.fixedEndTerm + '天可用'
  63. }}
  64. </view>
  65. </view>
  66. <view class="coupon" @click.stop="getBuy(item.id)" v-if="item.canTake"> 立即领取 </view>
  67. <view class="coupon2" v-else> 已领取 </view>
  68. </view>
  69. </view>
  70. </scroll-view>
  71. <view class="nullBox" v-else> 暂无可领优惠券 </view>
  72. </view>
  73. </su-popup>
  74. </template>
  75. <script setup>
  76. import sheep from '@/sheep';
  77. import { getRewardActivityRuleGroupDescriptions } from '@/sheep/hooks/useGoods';
  78. import { computed, reactive, watch, ref } from 'vue';
  79. import { fen2yuan } from '@/sheep/hooks/useGoods';
  80. const props = defineProps({
  81. modelValue: {
  82. type: Object,
  83. default() {},
  84. },
  85. show: {
  86. type: Boolean,
  87. default: false,
  88. },
  89. });
  90. const emits = defineEmits(['close']);
  91. const state = reactive({
  92. rewardActivity: computed(() => props.modelValue.rewardActivity),
  93. couponInfo: computed(() => props.modelValue.couponInfo),
  94. });
  95. // 领取优惠劵
  96. const getBuy = (id) => {
  97. emits('get', id);
  98. };
  99. function onGoodsList(e) {
  100. sheep.$router.go('/pages/activity/index', {
  101. activityId: e.id,
  102. });
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .model-box {
  107. height: 60vh;
  108. .title {
  109. justify-content: center;
  110. font-size: 36rpx;
  111. height: 80rpx;
  112. font-weight: bold;
  113. color: #333333;
  114. }
  115. }
  116. .model-content {
  117. height: fit-content;
  118. max-height: 380rpx;
  119. padding: 0 20rpx;
  120. box-sizing: border-box;
  121. margin-top: 20rpx;
  122. .model-content-tag {
  123. // background: rgba(#ff6911, 0.1);
  124. font-size: 35rpx;
  125. font-weight: 500;
  126. color: #ff6911;
  127. line-height: 150rpx;
  128. width: 200rpx;
  129. height: 150rpx;
  130. text-align: center;
  131. // border-radius: 5rpx;
  132. }
  133. .model-content-title {
  134. width: 450rpx;
  135. height: 150rpx;
  136. font-size: 26rpx;
  137. font-weight: 500;
  138. color: #333333;
  139. overflow: hidden;
  140. }
  141. .cicon-forward {
  142. font-size: 28rpx;
  143. color: #999999;
  144. margin: 0 auto;
  145. }
  146. }
  147. // 新增的
  148. .titleLi {
  149. margin: 10rpx 0 10rpx 20rpx;
  150. font-size: 26rpx;
  151. }
  152. .actBox {
  153. width: 700rpx;
  154. height: 150rpx;
  155. background-color: #fff2f2;
  156. margin: 10rpx auto;
  157. border-radius: 10rpx;
  158. }
  159. .boxCont {
  160. width: 700rpx;
  161. height: 150rpx;
  162. align-items: center;
  163. }
  164. .contBu {
  165. height: 80rpx;
  166. line-height: 80rpx;
  167. overflow: hidden;
  168. font-size: 30rpx;
  169. white-space: nowrap;
  170. text-overflow: ellipsis;
  171. -o-text-overflow: ellipsis;
  172. }
  173. .cotBu-txt {
  174. height: 70rpx;
  175. line-height: 70rpx;
  176. font-size: 25rpx;
  177. color: #999999;
  178. }
  179. .model-content-tag2 {
  180. font-size: 35rpx;
  181. font-weight: 500;
  182. color: #ff6911;
  183. width: 200rpx;
  184. height: 150rpx;
  185. text-align: center;
  186. }
  187. .usePrice {
  188. width: 200rpx;
  189. height: 90rpx;
  190. line-height: 100rpx;
  191. // background-color: red;
  192. }
  193. .impose {
  194. width: 200rpx;
  195. height: 50rpx;
  196. // line-height: 75rpx;
  197. font-size: 23rpx;
  198. // background-color: gold;
  199. }
  200. .model-content-title2 {
  201. width: 330rpx;
  202. height: 150rpx;
  203. font-size: 26rpx;
  204. font-weight: 500;
  205. color: #333333;
  206. overflow: hidden;
  207. }
  208. .coupon {
  209. width: 150rpx;
  210. height: 50rpx;
  211. line-height: 50rpx;
  212. background-color: rgb(255, 68, 68);
  213. color: white;
  214. border-radius: 30rpx;
  215. text-align: center;
  216. font-size: 25rpx;
  217. }
  218. .coupon2 {
  219. width: 150rpx;
  220. height: 50rpx;
  221. line-height: 50rpx;
  222. background-color: rgb(203, 192, 191);
  223. color: white;
  224. border-radius: 30rpx;
  225. text-align: center;
  226. font-size: 25rpx;
  227. }
  228. .nullBox {
  229. width: 100%;
  230. height: 300rpx;
  231. font-size: 25rpx;
  232. line-height: 300rpx;
  233. text-align: center;
  234. color: #999999;
  235. }
  236. </style>