RulesModal.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <!-- 使用规则弹窗 -->
  3. <BasicModal type="bottom" v-model:open="getOpen" :is-mack="true">
  4. <view class="rules-modal">
  5. <!-- 标题栏 -->
  6. <view class="rules-modal__header">
  7. <text class="header-title">使用规则</text>
  8. <view class="close-btn" @click="handleClose">
  9. <view class="close-icon"></view>
  10. </view>
  11. </view>
  12. <!-- 优惠券卡片 - 与列表页样式一致 -->
  13. <view class="coupon-card-wrapper">
  14. <view class="coupon-card">
  15. <image :src="getFileUrl('img/personal/coupon.png')" mode="widthFix" class="coupon-card-bg"></image>
  16. <image :src="getFileUrl('img/personal/couponLeft.png')" mode="heightFix" class="coupon-card-bgLeft"></image>
  17. <view class="coupon-card-content">
  18. <!-- 左侧金额区域 -->
  19. <view class="coupon-card__left">
  20. <view class="amount-wrapper">
  21. <text class="amount-number">{{ couponData?.amount || 0 }}</text>
  22. <text class="amount-unit">元</text>
  23. </view>
  24. <text class="condition-text">满{{ couponData?.minAmount || 0 }}可用</text>
  25. </view>
  26. <!-- 右侧信息区域 -->
  27. <view class="coupon-card__right">
  28. <view class="coupon-info">
  29. <text class="coupon-name">{{ couponData?.name || '6元通用优惠券' }}</text>
  30. <text class="coupon-expire">{{ couponData?.expireDate || '' }}到期</text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 规则详情 -->
  37. <view class="rules-content">
  38. <view class="rules-item">
  39. <text class="rules-label">有效期</text>
  40. <text class="rules-value">{{ couponData?.validDays || 90 }}天</text>
  41. </view>
  42. <view class="rules-item">
  43. <text class="rules-label">补充说明</text>
  44. <text class="rules-value">{{ couponData?.description || '周一、周五不可用' }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. </BasicModal>
  49. </template>
  50. <script setup>
  51. import { computed } from 'vue';
  52. import BasicModal from '@/components/Modal/BasicModal.vue';
  53. import { getFileUrl } from '@/utils/file.js';
  54. const props = defineProps({
  55. open: {
  56. type: Boolean,
  57. default: false
  58. },
  59. couponData: {
  60. type: Object,
  61. default: () => ({
  62. amount: 6,
  63. minAmount: 66,
  64. name: '6元通用优惠券',
  65. expireDate: '2025/07/12',
  66. validDays: 90,
  67. description: '周一、周五不可用'
  68. })
  69. }
  70. });
  71. const emit = defineEmits(['update:open']);
  72. const getOpen = computed({
  73. get: () => props.open,
  74. set: (val) => emit('update:open', val)
  75. });
  76. // 关闭弹窗
  77. const handleClose = () => {
  78. getOpen.value = false;
  79. };
  80. </script>
  81. <style lang="scss" scoped>
  82. .rules-modal {
  83. width: 100%;
  84. background: #FFFFFF;
  85. border-radius: 24rpx 24rpx 0 0;
  86. padding: 32rpx 30rpx;
  87. padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  88. box-sizing: border-box;
  89. // 标题栏
  90. &__header {
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. margin-bottom: 32rpx;
  95. position: relative;
  96. .header-title {
  97. font-size: 36rpx;
  98. font-weight: bold;
  99. color: #151515;
  100. }
  101. .close-btn {
  102. position: absolute;
  103. right: 0;
  104. top: 50%;
  105. transform: translateY(-50%);
  106. width: 48rpx;
  107. height: 48rpx;
  108. display: flex;
  109. align-items: center;
  110. justify-content: center;
  111. .close-icon {
  112. width: 28rpx;
  113. height: 28rpx;
  114. position: relative;
  115. &::before,
  116. &::after {
  117. content: '';
  118. position: absolute;
  119. width: 28rpx;
  120. height: 2rpx;
  121. background: #999999;
  122. top: 50%;
  123. left: 50%;
  124. transform-origin: center;
  125. }
  126. &::before {
  127. transform: translate(-50%, -50%) rotate(45deg);
  128. }
  129. &::after {
  130. transform: translate(-50%, -50%) rotate(-45deg);
  131. }
  132. }
  133. }
  134. }
  135. // 优惠券卡片容器
  136. .coupon-card-wrapper {
  137. margin-bottom: 32rpx;
  138. }
  139. // 优惠券卡片样式 - 与列表页完全一致
  140. .coupon-card {
  141. display: flex;
  142. align-items: center;
  143. overflow: hidden;
  144. position: relative;
  145. box-sizing: border-box;
  146. .coupon-card-bg {
  147. position: absolute;
  148. top: 0;
  149. left: 0;
  150. width: 100%;
  151. height: 100%;
  152. z-index: 1;
  153. }
  154. .coupon-card-bgLeft {
  155. position: absolute;
  156. top: 0;
  157. left: 0;
  158. width: auto;
  159. height: 190rpx;
  160. z-index: 1;
  161. }
  162. .coupon-card-content {
  163. position: relative;
  164. z-index: 3;
  165. display: flex;
  166. align-items: center;
  167. width: 100%;
  168. height: 200rpx;
  169. }
  170. &__left {
  171. width: 200rpx;
  172. padding: 32rpx 0;
  173. display: flex;
  174. flex-direction: column;
  175. align-items: center;
  176. justify-content: center;
  177. .amount-wrapper {
  178. display: flex;
  179. align-items: baseline;
  180. margin-bottom: 8rpx;
  181. .amount-number {
  182. font-size: 64rpx;
  183. font-weight: bold;
  184. color: #F47D1F;
  185. line-height: 1;
  186. }
  187. .amount-unit {
  188. font-size: 28rpx;
  189. color: #F47D1F;
  190. margin-left: 4rpx;
  191. }
  192. }
  193. .condition-text {
  194. font-size: 22rpx;
  195. color: #F47D1F;
  196. }
  197. }
  198. &__right {
  199. flex: 1;
  200. display: flex;
  201. align-items: center;
  202. justify-content: space-between;
  203. padding: 32rpx 24rpx;
  204. .coupon-info {
  205. flex: 1;
  206. display: flex;
  207. flex-direction: column;
  208. .coupon-name {
  209. font-size: 28rpx;
  210. font-weight: bold;
  211. color: #151515;
  212. margin-bottom: 12rpx;
  213. }
  214. .coupon-expire {
  215. font-size: 22rpx;
  216. color: #999999;
  217. }
  218. }
  219. }
  220. }
  221. // 规则详情
  222. .rules-content {
  223. margin-bottom: 40rpx;
  224. padding: 0 8rpx;
  225. .rules-item {
  226. display: flex;
  227. align-items: flex-start;
  228. margin-bottom: 20rpx;
  229. font-size: 26rpx;
  230. line-height: 40rpx;
  231. &:last-child {
  232. margin-bottom: 0;
  233. }
  234. .rules-label {
  235. color: #666666;
  236. flex-shrink: 0;
  237. }
  238. .rules-value {
  239. color: #151515;
  240. margin-left: 16rpx;
  241. flex: 1;
  242. }
  243. }
  244. }
  245. }
  246. .hover-active {
  247. opacity: 0.8;
  248. transform: scale(0.98);
  249. transition: all 0.2s;
  250. }
  251. </style>