couponInfo.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="item" :class="item.useStatus ? 'item-disabled' : ''">
  3. <view class="top" :class="show ? 'checked' : ''">
  4. <view class="left">
  5. <view class="tag" v-if="props.types == 'select' || isMyCoupon">{{
  6. item.couponVo.businessId ? item.couponVo.businessName || "店铺卷" : "平台卷"
  7. }}</view>
  8. <view class="tag" v-else>{{
  9. item.businessId ? item.businessName || "店铺卷" : "平台卷"
  10. }}</view>
  11. <text class="face-price"
  12. >¥<text class="num">{{
  13. item.faceValue || item.couponVo.faceValue || 0
  14. }}</text></text
  15. >
  16. </view>
  17. <view class="right">
  18. <view class="tip" v-if="item.name">{{ item.name }}</view>
  19. <view class="tip" v-if="!item.name && item.couponVo">{{
  20. item.couponVo.name
  21. }}</view>
  22. <view class="flex-box">
  23. <view>
  24. <text
  25. v-if="
  26. item.hasThreshold ||
  27. (item.couponVo && item.couponVo.hasThreshold)
  28. "
  29. class="condition"
  30. >满¥{{
  31. item.threshold || (item.couponVo && item.couponVo.threshold)
  32. }}可用</text
  33. >
  34. <text v-else class="condition">无门槛</text>
  35. <view v-if="isMyCoupon || isCheck" class="tip2"
  36. >{{ item.expireTime }}到期</view
  37. >
  38. <!-- <view v-else class="tip2">{{ item.endTime }}到期</view> -->
  39. </view>
  40. <template v-if="props.types == 'select'">
  41. <button v-if="!props.select" @click="$emit('useTickets', item)">
  42. 使用
  43. </button>
  44. <button v-else class="no-have">已选择</button>
  45. </template>
  46. <template v-else>
  47. <button
  48. v-if="isMyCoupon && !item.useStatus"
  49. @click="$emit('useTickets', item.id)"
  50. >
  51. 去使用
  52. </button>
  53. <button v-if="isMyCoupon && item.useStatus" class="no-have">
  54. 已使用
  55. </button>
  56. <button
  57. v-if="!isMyCoupon"
  58. @click="$emit('grabTickets', item.id)"
  59. class="no-have"
  60. >
  61. 立即抢
  62. </button>
  63. </template>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="bottom" @click="$set(item, 'isOpen', !item.isOpen)">
  68. <text class="time"
  69. >领券后{{
  70. item.expiredDay || (item.couponVo && item.couponVo.expiredDay)
  71. }}天有效,记得及时使用噢</text
  72. >
  73. <text class="iconfont" :class="item.isOpen ? 'open' : ''">&#xe671;</text>
  74. </view>
  75. <view v-if="item.isOpen" class="desc">
  76. <text>{{ item.content || item.couponVo?.content }}</text>
  77. </view>
  78. </view>
  79. </template>
  80. <script setup name="couponInfo">
  81. import { ref, watch } from "vue";
  82. const props = defineProps({
  83. item: {
  84. type: Object,
  85. default: () => {},
  86. },
  87. show: {
  88. type: Boolean,
  89. default: false,
  90. },
  91. isMyCoupon: {
  92. type: Boolean,
  93. default: false,
  94. },
  95. isCheck: {
  96. type: Boolean,
  97. default: false,
  98. },
  99. select: {
  100. type: Boolean,
  101. default: false,
  102. },
  103. types: {
  104. type: String,
  105. default: "list", // list:页面使用, select:弹窗选择使用
  106. },
  107. });
  108. const item = ref(props.item || {});
  109. const show = ref(props.show);
  110. const modeList = ref([
  111. {
  112. text: "平台券",
  113. },
  114. {
  115. text: "店铺券",
  116. },
  117. ]);
  118. watch(
  119. () => props.show,
  120. (newValue) => {
  121. show.value = newValue;
  122. }
  123. );
  124. watch(
  125. () => props.item,
  126. (newValue) => {
  127. item.value = newValue;
  128. }
  129. );
  130. </script>
  131. <style lang="scss" scoped>
  132. .item-disabled {
  133. opacity: 0.6;
  134. }
  135. .item {
  136. position: relative;
  137. width: 690rpx;
  138. background: #ffffff;
  139. border-radius: 16rpx;
  140. margin: 40rpx auto 0 auto;
  141. box-sizing: border-box;
  142. // background-image: url('/static/couponCenter/card.png');
  143. // background-size: 100% 100%;
  144. // background-position: top;
  145. // background-repeat: no-repeat;
  146. padding-bottom: 19rpx;
  147. filter: drop-shadow(1px 2px 4px rgba(26, 58, 70, 0.1));
  148. &.checked {
  149. background: #fff8e1;
  150. button {
  151. background: #eb5153 !important;
  152. border-color: #eb5153 !important;
  153. }
  154. }
  155. .top {
  156. display: flex;
  157. align-items: center;
  158. justify-content: space-between;
  159. border-bottom: 1px dashed #cccccc;
  160. padding: 63rpx 0 19rpx 0;
  161. width: calc(100% - 60rpx);
  162. margin: 0 30rpx;
  163. }
  164. .tag {
  165. position: absolute;
  166. top: 0;
  167. left: 0;
  168. height: 45rpx;
  169. line-height: 45rpx;
  170. padding: 0 30rpx;
  171. background: #eb5153;
  172. border-radius: 16rpx 0px 16rpx 0px;
  173. font-size: 24rpx;
  174. font-family: PingFang SC, PingFang SC-Regular;
  175. font-weight: 400;
  176. text-align: left;
  177. color: #fff;
  178. }
  179. .left {
  180. margin-right: 26rpx;
  181. .face-price {
  182. font-size: 42rpx;
  183. font-family: PingFang SC, PingFang SC-Bold;
  184. font-weight: 700;
  185. text-align: left;
  186. color: #eb5153;
  187. .num {
  188. font-size: 54rpx;
  189. }
  190. }
  191. }
  192. .right {
  193. flex: 1;
  194. .flex-box {
  195. display: flex;
  196. align-items: self-end;
  197. justify-content: space-between;
  198. button {
  199. display: flex;
  200. align-items: center;
  201. width: fit-content;
  202. height: 56rpx;
  203. line-height: 56rpx;
  204. padding: 0 28rpx;
  205. border-radius: 28rpx;
  206. font-size: 30rpx;
  207. font-family: PingFang SC, PingFang SC-Regular;
  208. font-weight: 400;
  209. text-align: center;
  210. color: #ffffff;
  211. border: 1px solid #eb5153;
  212. color: #eb5153;
  213. white-space: nowrap;
  214. margin: 0;
  215. &.no-have {
  216. background: #eb5153;
  217. color: white;
  218. border: 1px solid #eb5153;
  219. }
  220. }
  221. .condition {
  222. vertical-align: middle;
  223. font-size: 24rpx;
  224. font-family: PingFang SC, PingFang SC-Regular;
  225. font-weight: 400;
  226. text-align: left;
  227. color: #808080;
  228. line-height: 28rpx;
  229. }
  230. .tip {
  231. font-size: 28rpx;
  232. font-family: PingFang SC, PingFang SC-Regular;
  233. font-weight: 400;
  234. text-align: left;
  235. color: #333333;
  236. line-height: 28rpx;
  237. margin-top: 5rpx;
  238. }
  239. .tip2 {
  240. font-size: 24rpx;
  241. font-family: PingFang SC, PingFang SC-Regular;
  242. font-weight: 400;
  243. text-align: left;
  244. line-height: 28rpx;
  245. color: #666666;
  246. margin-top: 5rpx;
  247. }
  248. }
  249. }
  250. .bottom {
  251. padding: 17rpx 30rpx 0 30rpx;
  252. display: flex;
  253. align-items: center;
  254. justify-content: space-between;
  255. .time {
  256. font-size: 24rpx;
  257. font-family: PingFang SC, PingFang SC-Regular;
  258. font-weight: 400;
  259. text-align: left;
  260. color: #666666;
  261. }
  262. .iconfont {
  263. transition: all 0.3s;
  264. transform: rotate(-90deg);
  265. &.open {
  266. transform: rotate(90deg);
  267. }
  268. }
  269. }
  270. .desc {
  271. padding: 10rpx 30rpx 0 30rpx;
  272. font-size: 24rpx;
  273. font-family: PingFang SC, PingFang SC-Regular;
  274. font-weight: 400;
  275. text-align: left;
  276. color: #666666;
  277. }
  278. }
  279. </style>