s-activity-pop.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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.activityMap[state.activityInfo[0]?.id]?.reduc">
  7. <view class="titleLi">促销</view>
  8. <scroll-view class="model-content" scroll-y :scroll-with-animation="false" :enable-back-to-top="true">
  9. <view class="actBox">
  10. <view class="boxCont ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(state.activityInfo[0])">
  11. <view class="model-content-tag ss-flex ss-row-center">满减</view>
  12. <view class="model-content-title">
  13. <view class="contBu">
  14. <text v-for="(item,index) in state.activityMap[state.activityInfo[0]?.id]?.reduc"
  15. :key="index">满{{fen2yuan(item.discountPrice)}}元减{{fen2yuan(item.limit)}}元;</text>
  16. </view>
  17. <view class="ss-m-b-24 cotBu-txt">
  18. {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}}
  19. </view>
  20. </view>
  21. <text class="cicon-forward" />
  22. </view>
  23. </view>
  24. <view class="actBox">
  25. <view class="boxCont ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(state.activityInfo[0])">
  26. <view class="model-content-tag ss-flex ss-row-center">包邮</view>
  27. <view class="model-content-title">
  28. <view class="contBu">
  29. <text v-for="(item,index) in state.activityMap[state.activityInfo[0]?.id]?.ship"
  30. :key="index" v-show="item.bull">满{{fen2yuan(item.discountPrice)}}元包邮;</text>
  31. </view>
  32. <view class="ss-m-b-24 cotBu-txt">
  33. {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}}
  34. </view>
  35. </view>
  36. <text class="cicon-forward" />
  37. </view>
  38. </view>
  39. <view class="actBox">
  40. <view class="boxCont ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(state.activityInfo[0])">
  41. <view class="model-content-tag ss-flex ss-row-center">送积分</view>
  42. <view class="model-content-title">
  43. <view class="contBu">
  44. <text v-for="(item,index) in state.activityMap[state.activityInfo[0]?.id]?.scor"
  45. :key="index"
  46. v-show="item.bull">满{{fen2yuan(item.discountPrice)}}元送{{item.value}}积分;</text>
  47. </view>
  48. <view class="ss-m-b-24 cotBu-txt">
  49. {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}}
  50. </view>
  51. </view>
  52. <text class="cicon-forward" />
  53. </view>
  54. </view>
  55. <view class="actBox">
  56. <view class="boxCont ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(state.activityInfo[0])">
  57. <view class="model-content-tag ss-flex ss-row-center">送优惠券</view>
  58. <view class="model-content-title">
  59. <view class="contBu">
  60. <text v-for="(item,index) in state.activityMap[state.activityInfo[0]?.id]?.cou"
  61. :key="index"
  62. v-show="item.bull">满{{fen2yuan(item.discountPrice)}}元送{{item.value}}张优惠券;</text>
  63. </view>
  64. <view class="ss-m-b-24 cotBu-txt">
  65. {{formatDateRange(state.activityInfo[0]?.startTime,state.activityInfo[0]?.endTime)}}
  66. </view>
  67. </view>
  68. <text class="cicon-forward" />
  69. </view>
  70. </view>
  71. </scroll-view>
  72. </view>
  73. <view class="titleLi">可领优惠券</view>
  74. <scroll-view class="model-content" scroll-y :scroll-with-animation="false" :enable-back-to-top="true">
  75. <view class="actBox" v-for="item in state.couponInfo" :key="item.id">
  76. <view class="boxCont ss-flex ss-col-top ss-m-b-40">
  77. <view class="model-content-tag2">
  78. <view class="usePrice">
  79. ¥{{fen2yuan(item.discountPrice)}}
  80. </view>
  81. <view class="impose">
  82. 满¥{{fen2yuan(item.usePrice)}}可用
  83. </view>
  84. </view>
  85. <view class="model-content-title2">
  86. <view class="contBu">
  87. {{item.name}}
  88. </view>
  89. <view class="ss-m-b-24 cotBu-txt">
  90. {{item.validityType==1?formatDateRange(item.validStartTime,item.validEndTime) : '领取后'+item.fixedStartTerm+'-'+item.fixedEndTerm +'天可用'}}
  91. </view>
  92. </view>
  93. <view class="coupon" @click.stop="getBuy(item.id)" v-if="item.canTake">
  94. 立即领取
  95. </view>
  96. <view class="coupon2" v-else>
  97. 已领取
  98. </view>
  99. </view>
  100. </view>
  101. </scroll-view>
  102. </view>
  103. </su-popup>
  104. </template>
  105. <script setup>
  106. import sheep from '@/sheep';
  107. import {
  108. computed,
  109. reactive,
  110. watch
  111. } from 'vue';
  112. import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
  113. import {
  114. fen2yuan,
  115. formatDateRange,
  116. handActitList
  117. } from '@/sheep/hooks/useGoods';
  118. const props = defineProps({
  119. modelValue: {
  120. type: Object,
  121. default () {},
  122. },
  123. show: {
  124. type: Boolean,
  125. default: false,
  126. },
  127. });
  128. const emits = defineEmits(['close']);
  129. const state = reactive({
  130. activityInfo: computed(() => props.modelValue.activityInfo),
  131. activityMap: {},
  132. couponInfo: computed(() => props.modelValue.couponInfo)
  133. });
  134. watch(
  135. () => props.show,
  136. () => {
  137. // 展示的情况下,加载每个活动的详细信息
  138. if (props.show) {
  139. state.activityInfo?.forEach(activity => {
  140. RewardActivityApi.getRewardActivity(activity.id).then(res => {
  141. if (res.code !== 0) {
  142. return;
  143. }
  144. state.activityMap[activity.id] = handActitList(res.data.rules);
  145. })
  146. });
  147. }
  148. },
  149. );
  150. // 领取优惠劵
  151. const getBuy = (id) => {
  152. emits('get', id);
  153. };
  154. function onGoodsList(e) {
  155. sheep.$router.go('/pages/activity/index', {
  156. activityId: e.id,
  157. });
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. .model-box {
  162. height: 60vh;
  163. .title {
  164. justify-content: center;
  165. font-size: 36rpx;
  166. height: 80rpx;
  167. font-weight: bold;
  168. color: #333333;
  169. }
  170. }
  171. .model-content {
  172. height: fit-content;
  173. max-height: 350rpx;
  174. padding: 0 20rpx;
  175. box-sizing: border-box;
  176. margin-top: 20rpx;
  177. .model-content-tag {
  178. // background: rgba(#ff6911, 0.1);
  179. font-size: 35rpx;
  180. font-weight: 500;
  181. color: #ff6911;
  182. line-height: 150rpx;
  183. width: 200rpx;
  184. height: 150rpx;
  185. text-align: center;
  186. // border-radius: 5rpx;
  187. }
  188. .model-content-title {
  189. width: 450rpx;
  190. height: 150rpx;
  191. font-size: 26rpx;
  192. font-weight: 500;
  193. color: #333333;
  194. overflow: hidden;
  195. }
  196. .cicon-forward {
  197. font-size: 28rpx;
  198. color: #999999;
  199. margin: 0 auto;
  200. }
  201. }
  202. // 新增的
  203. .titleLi {
  204. margin: 10rpx 0 10rpx 20rpx;
  205. font-size: 26rpx;
  206. }
  207. .actBox {
  208. width: 700rpx;
  209. height: 150rpx;
  210. background-color: #fff2f2;
  211. margin: 10rpx auto;
  212. border-radius: 10rpx;
  213. }
  214. .boxCont {
  215. width: 700rpx;
  216. height: 150rpx;
  217. align-items: center;
  218. }
  219. .contBu {
  220. height: 80rpx;
  221. line-height: 80rpx;
  222. overflow: hidden;
  223. font-size: 30rpx;
  224. white-space: nowrap;
  225. text-overflow: ellipsis;
  226. -o-text-overflow: ellipsis;
  227. }
  228. .cotBu-txt {
  229. height: 70rpx;
  230. line-height: 70rpx;
  231. font-size: 25rpx;
  232. color: #999999;
  233. }
  234. .model-content-tag2 {
  235. font-size: 35rpx;
  236. font-weight: 500;
  237. color: #ff6911;
  238. width: 200rpx;
  239. height: 150rpx;
  240. text-align: center;
  241. }
  242. .usePrice {
  243. width: 200rpx;
  244. height: 90rpx;
  245. line-height: 100rpx;
  246. // background-color: red;
  247. }
  248. .impose {
  249. width: 200rpx;
  250. height: 50rpx;
  251. // line-height: 75rpx;
  252. font-size: 23rpx;
  253. // background-color: gold;
  254. }
  255. .model-content-title2 {
  256. width: 330rpx;
  257. height: 150rpx;
  258. font-size: 26rpx;
  259. font-weight: 500;
  260. color: #333333;
  261. overflow: hidden;
  262. }
  263. .coupon {
  264. width: 150rpx;
  265. height: 50rpx;
  266. line-height: 50rpx;
  267. background-color: rgb(255, 68, 68);
  268. color: white;
  269. border-radius: 30rpx;
  270. text-align: center;
  271. font-size: 25rpx;
  272. }
  273. .coupon2 {
  274. width: 150rpx;
  275. height: 50rpx;
  276. line-height: 50rpx;
  277. background-color: rgb(203, 192, 191);
  278. color: white;
  279. border-radius: 30rpx;
  280. text-align: center;
  281. font-size: 25rpx;
  282. }
  283. </style>