s-activity-pop.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. '-' +
  62. sheep.$helper.timeFormat(item.validEndTime, 'yyyy-mm-dd')
  63. : '领取后' + item.fixedStartTerm + '-' + item.fixedEndTerm + '天可用'
  64. }}
  65. </view>
  66. </view>
  67. <view class="coupon" @click.stop="getBuy(item.id)" v-if="item.canTake"> 立即领取 </view>
  68. <view class="coupon2" v-else> 已领取 </view>
  69. </view>
  70. </view>
  71. </scroll-view>
  72. <view class="nullBox" v-else> 暂无可领优惠券 </view>
  73. </view>
  74. </su-popup>
  75. </template>
  76. <script setup>
  77. import sheep from '@/sheep';
  78. import { getRewardActivityRuleGroupDescriptions } from '@/sheep/hooks/useGoods';
  79. import { computed, reactive, watch, ref } from 'vue';
  80. import { fen2yuan } from '@/sheep/hooks/useGoods';
  81. const props = defineProps({
  82. modelValue: {
  83. type: Object,
  84. default() {},
  85. },
  86. show: {
  87. type: Boolean,
  88. default: false,
  89. },
  90. });
  91. const emits = defineEmits(['close']);
  92. const state = reactive({
  93. rewardActivity: computed(() => props.modelValue.rewardActivity),
  94. couponInfo: computed(() => props.modelValue.couponInfo),
  95. });
  96. // 领取优惠劵
  97. const getBuy = (id) => {
  98. emits('get', id);
  99. };
  100. function onGoodsList(e) {
  101. sheep.$router.go('/pages/activity/index', {
  102. activityId: e.id,
  103. });
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .model-box {
  108. height: 60vh;
  109. .title {
  110. justify-content: center;
  111. font-size: 36rpx;
  112. height: 80rpx;
  113. font-weight: bold;
  114. color: #333333;
  115. }
  116. }
  117. .model-content {
  118. height: fit-content;
  119. max-height: 380rpx;
  120. padding: 0 20rpx;
  121. box-sizing: border-box;
  122. margin-top: 20rpx;
  123. .model-content-tag {
  124. // background: rgba(#ff6911, 0.1);
  125. font-size: 35rpx;
  126. font-weight: 500;
  127. color: #ff6911;
  128. line-height: 150rpx;
  129. width: 200rpx;
  130. height: 150rpx;
  131. text-align: center;
  132. // border-radius: 5rpx;
  133. }
  134. .model-content-title {
  135. width: 450rpx;
  136. height: 150rpx;
  137. font-size: 26rpx;
  138. font-weight: 500;
  139. color: #333333;
  140. overflow: hidden;
  141. }
  142. .cicon-forward {
  143. font-size: 28rpx;
  144. color: #999999;
  145. margin: 0 auto;
  146. }
  147. }
  148. // 新增的
  149. .titleLi {
  150. margin: 10rpx 0 10rpx 20rpx;
  151. font-size: 26rpx;
  152. }
  153. .actBox {
  154. width: 700rpx;
  155. height: 150rpx;
  156. background-color: #fff2f2;
  157. margin: 10rpx auto;
  158. border-radius: 10rpx;
  159. }
  160. .boxCont {
  161. width: 700rpx;
  162. height: 150rpx;
  163. align-items: center;
  164. }
  165. .contBu {
  166. height: 80rpx;
  167. line-height: 80rpx;
  168. overflow: hidden;
  169. font-size: 30rpx;
  170. white-space: nowrap;
  171. text-overflow: ellipsis;
  172. -o-text-overflow: ellipsis;
  173. }
  174. .cotBu-txt {
  175. height: 70rpx;
  176. line-height: 70rpx;
  177. font-size: 25rpx;
  178. color: #999999;
  179. }
  180. .model-content-tag2 {
  181. font-size: 35rpx;
  182. font-weight: 500;
  183. color: #ff6911;
  184. width: 200rpx;
  185. height: 150rpx;
  186. text-align: center;
  187. }
  188. .usePrice {
  189. width: 200rpx;
  190. height: 90rpx;
  191. line-height: 100rpx;
  192. // background-color: red;
  193. }
  194. .impose {
  195. width: 200rpx;
  196. height: 50rpx;
  197. // line-height: 75rpx;
  198. font-size: 23rpx;
  199. // background-color: gold;
  200. }
  201. .model-content-title2 {
  202. width: 330rpx;
  203. height: 150rpx;
  204. font-size: 26rpx;
  205. font-weight: 500;
  206. color: #333333;
  207. overflow: hidden;
  208. }
  209. .coupon {
  210. width: 150rpx;
  211. height: 50rpx;
  212. line-height: 50rpx;
  213. background-color: rgb(255, 68, 68);
  214. color: white;
  215. border-radius: 30rpx;
  216. text-align: center;
  217. font-size: 25rpx;
  218. }
  219. .coupon2 {
  220. width: 150rpx;
  221. height: 50rpx;
  222. line-height: 50rpx;
  223. background-color: rgb(203, 192, 191);
  224. color: white;
  225. border-radius: 30rpx;
  226. text-align: center;
  227. font-size: 25rpx;
  228. }
  229. .nullBox {
  230. width: 100%;
  231. height: 300rpx;
  232. font-size: 25rpx;
  233. line-height: 300rpx;
  234. text-align: center;
  235. color: #999999;
  236. }
  237. </style>