GetCoupon.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view :class="['qn-page-' + theme]" class="content">
  3. <!-- 空白页 -->
  4. <Aempty text="没有可领取的优惠券~~" src="https://onlineimg.qianniao.vip/coupon.png" v-if="discountList.length === 0"></Aempty>
  5. <view class="discount-mian">
  6. <block v-for="(item, index) in discountList" :key="index">
  7. <view class="discount-mian-list clearfix">
  8. <image src="https://onlineimg.qianniao.vip/coupon_bg.png" class="mian-list-img" alt="" />
  9. <view class="mian-Icon-top"></view>
  10. <view class="mian-Icon-bottom"></view>
  11. <view class="mian-list-left">
  12. <view class="list-title-mian primary-color">
  13. <span style="font-size: 56upx;font-weight:500;">{{ Number(item.reducePrice) }}</span>
  14. </view>
  15. <view class="list-title-subheading primary-color">
  16. {{ item.applyRange === 10 ? '全店商品通用' : item.applyRange === 20 ? '指定分类商品可用' : item.applyRange === 30 ? '指定品牌商品可用' : '' }}
  17. </view>
  18. </view>
  19. <view class="mian-list-right">
  20. <view class="list-right-shop">{{ item.name }}</view>
  21. <view class="list-right-time" v-if="item.couponType === 20">有效期:领取后30天内有效</view>
  22. <view class="list-right-time" v-else>有效期至:{{ $_utils.formatDate(item.endTime, 'yyyy-MM-dd') }}</view>
  23. </view>
  24. <view class="liet-right-click primary-btn-pain" @click="receive(item)">
  25. 立即领取
  26. </view>
  27. <view class="coupon-ruls" v-if="item.minPrice === '不限金额'">无门槛使用</view>
  28. <view class="coupon-ruls" v-else>满{{ item.minPrice }}元可用</view>
  29. <view class="coupon-rul">{{ item.couponType === 10 ? '普通优惠券' : '会员卡优惠券' }}</view>
  30. </view>
  31. </block>
  32. </view>
  33. <view class="buttom-btn">
  34. <text class="float_left get-coupon" @click="goCoupon('get')">领券中心</text>
  35. <text class="float_right my-coupon" @click="goCoupon('mine')">我的优惠券</text>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. discountList: [],
  44. vipCardId: ''
  45. };
  46. },
  47. onLoad() {
  48. this.getData();
  49. },
  50. onPullDownRefresh() {
  51. this.getData();
  52. },
  53. methods: {
  54. async getData() {
  55. this.$u.api.couponList({
  56. grantType: '10'
  57. }).then(res=>{
  58. uni.stopPullDownRefresh();
  59. this.discountList = res.data;
  60. });
  61. },
  62. async receive(item) {
  63. // if (this.$store.state.baseSet.personnelReview === 5) {
  64. // 验证账户状态
  65. this.userAudit();
  66. if (!this.isUserAudit) {
  67. return;
  68. }
  69. // }
  70. this.$u.api.receive({
  71. couponId: item.id,
  72. vipCardId: item.vipCardId
  73. }).then(res=>{
  74. this.$api.msg('领取成功');
  75. });
  76. },
  77. goCoupon(row) {
  78. if (row === 'mine') {
  79. this.goPage('/pagesT/user/DiscountCoupon', 'redirectTo');
  80. } else {
  81. // this.$api.msg('您已在优惠券领取页面');
  82. }
  83. }
  84. }
  85. };
  86. </script>
  87. <style lang="scss">
  88. page {
  89. background: #f5f5f5;
  90. }
  91. // 底部按钮
  92. .buttom-btn {
  93. background-color: #ffffff;
  94. position: fixed;
  95. bottom: 0;
  96. width: 100%;
  97. z-index: 95;
  98. display: flex;
  99. box-shadow: 0 0 10upx 1px #e7e7e7;
  100. .get-coupon {
  101. flex: 2;
  102. text-align: center;
  103. border-right: 1upx solid #f4f4f4;
  104. font-size: 28rpx;
  105. line-height: 88upx;
  106. color: #333333;
  107. }
  108. .my-coupon {
  109. flex: 2;
  110. text-align: center;
  111. font-size: 28rpx;
  112. line-height: 88upx;
  113. color: #333333;
  114. }
  115. }
  116. .content {
  117. width: 100%;
  118. height: 100vh;
  119. }
  120. .discount-mian{
  121. padding-bottom: 88rpx;
  122. }
  123. .discount-mian-list {
  124. border-radius: 10rpx;
  125. background-color: #FFFFFF;
  126. width: 700upx;
  127. height: 200upx;
  128. position: relative;
  129. margin: 24upx auto 0;
  130. box-shadow: 0px 38upx 14upx -30upx #e7e7e7;
  131. }
  132. .mian-list-img {
  133. width: 700upx;
  134. height: 200upx;
  135. border-radius: 6px;
  136. }
  137. .mian-list-left {
  138. width: 200upx;
  139. height: 200upx;
  140. position: absolute;
  141. left: 0upx;
  142. top: 0upx;
  143. z-index: 10;
  144. }
  145. .mian-Icon-bottom {
  146. height: 12upx;
  147. width: 24upx;
  148. position: absolute;
  149. left: 190upx;
  150. top: 190upx;
  151. border-radius: 100upx 100upx 0 0;
  152. z-index: 999;
  153. }
  154. .list-title-mian {
  155. font-size: 28upx;
  156. color: #45a418;
  157. position: absolute;
  158. top: 16upx;
  159. font-weight: 300;
  160. left: 0;
  161. width: 200upx;
  162. text-align: center;
  163. }
  164. .list-title-mian > span {
  165. font-size: 42upx;
  166. }
  167. .list-title-subheading {
  168. font-size: 24upx;
  169. color: #45a418;
  170. position: absolute;
  171. top: 75upx;
  172. left: 0;
  173. font-weight: 300;
  174. padding-top: 12upx;
  175. width: 216upx;
  176. text-align: center;
  177. }
  178. .mian-list-right {
  179. width: 500upx;
  180. height: 200upx;
  181. position: absolute;
  182. left: 200upx;
  183. top: 36upx;
  184. color: #333;
  185. }
  186. .list-right-shop {
  187. display: inline-block;
  188. overflow: hidden;
  189. white-space: nowrap;
  190. text-overflow: ellipsis;
  191. width: 300rpx;
  192. font-size: 30upx;
  193. line-height: 36upx;
  194. padding-bottom: 10upx;
  195. }
  196. .list-right-shop:hover {
  197. overflow: visible;
  198. }
  199. .coupon-ruls {
  200. font-size: 24upx;
  201. color: #666;
  202. font-weight: 300;
  203. position: absolute;
  204. bottom: 14upx;
  205. left: 24upx;
  206. }
  207. .coupon-rul {
  208. font-size: 24upx;
  209. color: #666;
  210. font-weight: 600;
  211. position: absolute;
  212. bottom: 14upx;
  213. right: 24upx;
  214. }
  215. .list-right-time {
  216. font-size: 24upx;
  217. /* position: absolute;
  218. top: 100upx;
  219. left: 30upx; */
  220. font-weight: 300;
  221. }
  222. .liet-right-click {
  223. font-size: 24upx;
  224. color: $uni-color-primary;
  225. width: 132upx;
  226. height: 50upx;
  227. border-radius: 50upx;
  228. text-align: center;
  229. line-height: 50upx;
  230. font-weight: 300;
  231. position: absolute;
  232. right: 30upx;
  233. top: 45upx;
  234. z-index: 2;
  235. border: 1px solid $uni-color-primary;
  236. }
  237. </style>